paid_up 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -9
- data/README.md +3 -1
- data/VERSION +1 -1
- data/app/controllers/paid_up/paid_up_controller.rb +9 -0
- data/app/controllers/paid_up/subscriptions_controller.rb +2 -2
- data/app/helpers/paid_up/plans_helper.rb +4 -1
- data/app/mailers/paid_up/paid_up_mailer.rb +6 -0
- data/app/mailers/paid_up/subscription_mailer.rb +9 -0
- data/app/views/layouts/mailer.html.haml +3 -0
- data/app/views/layouts/mailer.text.haml +1 -0
- data/app/views/paid_up/features/_abilities_table.html.haml +22 -2
- data/app/views/paid_up/subscription_mailer/payment_failed_email.html.haml +0 -0
- data/app/views/paid_up/subscription_mailer/payment_failed_email.text.haml +0 -0
- data/app/views/paid_up/subscriptions/index.html.haml +16 -14
- data/config/locales/en.yml +8 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +162 -63
- data/lib/paid_up.rb +1 -2
- data/lib/paid_up/extensions/stripe.rb +1 -0
- data/lib/paid_up/mixins/subscriber.rb +27 -10
- data/paid_up.gemspec +15 -3
- data/spec/dummy/config/routes.rb +2 -15
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/seeds.rb +149 -121
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/tasks/system.rake +12 -0
- data/spec/dummy/log/development.log +16385 -10278
- data/spec/factories/user.rb +22 -8
- data/spec/mailers/paid_up/subscription_mailer_spec.rb +5 -0
- data/spec/mailers/previews/paid_up/subscription_mailer_preview.rb +7 -0
- metadata +25 -2
    
        data/lib/paid_up.rb
    CHANGED
    
    | @@ -39,8 +39,7 @@ end | |
| 39 39 |  | 
| 40 40 | 
             
            Integer.send(:include, PaidUp::Extensions::Integer)
         | 
| 41 41 |  | 
| 42 | 
            -
            Stripe:: | 
| 43 | 
            -
            Stripe::Plan.send(:include, PaidUp::Extensions::Stripe)
         | 
| 42 | 
            +
            Stripe::APIResource.send(:include, PaidUp::Extensions::Stripe)
         | 
| 44 43 |  | 
| 45 44 | 
             
            ActiveRecord::Base.send(:include, PaidUp::Mixins::Subscriber)
         | 
| 46 45 | 
             
            ActiveRecord::Base.send(:include, PaidUp::Mixins::PaidFor)
         | 
| @@ -28,10 +28,10 @@ module PaidUp::Mixins | |
| 28 28 | 
             
                        nil
         | 
| 29 29 | 
             
                      end
         | 
| 30 30 | 
             
                    }
         | 
| 31 | 
            -
                    self.send(:define_method, :subscribe_to_plan) { |plan_to_set,  | 
| 31 | 
            +
                    self.send(:define_method, :subscribe_to_plan) { |plan_to_set, stripe_token = nil, trial_end = nil|
         | 
| 32 32 | 
             
                      if stripe_id.present? && !subscription.nil? # There is an existing subscription
         | 
| 33 | 
            -
                        if  | 
| 34 | 
            -
                          subscription.source =  | 
| 33 | 
            +
                        if stripe_token.present? # The customer has entered a new card
         | 
| 34 | 
            +
                          subscription.source = stripe_token
         | 
| 35 35 | 
             
                          subscription.save
         | 
| 36 36 | 
             
                          reload
         | 
| 37 37 | 
             
                        end
         | 
| @@ -39,13 +39,18 @@ module PaidUp::Mixins | |
| 39 39 | 
             
                          stripe_data.coupon = coupon_code
         | 
| 40 40 | 
             
                          stripe_data.save
         | 
| 41 41 | 
             
                        end
         | 
| 42 | 
            +
                        if trial_end.present?
         | 
| 43 | 
            +
                          stripe_data.subscription.trial_end = trial_end
         | 
| 44 | 
            +
                          stripe_data.subscription.save
         | 
| 45 | 
            +
                        end
         | 
| 42 46 | 
             
                        subscription.plan = plan_to_set.stripe_id
         | 
| 43 47 | 
             
                        result = subscription.save || ( raise(:could_not_update_subscription.l) && false )
         | 
| 44 48 | 
             
                      else # Totally new subscription
         | 
| 45 49 | 
             
                        args = {
         | 
| 46 | 
            -
                          source:  | 
| 50 | 
            +
                          source: stripe_token,
         | 
| 47 51 | 
             
                          plan: plan_to_set.stripe_id,
         | 
| 48 | 
            -
                          email: email
         | 
| 52 | 
            +
                          email: email,
         | 
| 53 | 
            +
                          trial_end: trial_end
         | 
| 49 54 | 
             
                        }
         | 
| 50 55 | 
             
                        if coupon_code.present?
         | 
| 51 56 | 
             
                          args[:coupon] = coupon_code
         | 
| @@ -70,7 +75,11 @@ module PaidUp::Mixins | |
| 70 75 | 
             
                      subscribe_to_plan PaidUp::Plan.free
         | 
| 71 76 | 
             
                    }
         | 
| 72 77 | 
             
                    self.send(:define_method, :plan) {
         | 
| 73 | 
            -
                       | 
| 78 | 
            +
                      if subscription.present?
         | 
| 79 | 
            +
                        PaidUp::Plan.find_by_stripe_id(subscription.plan.id)
         | 
| 80 | 
            +
                      else
         | 
| 81 | 
            +
                        PaidUp::Plan.free
         | 
| 82 | 
            +
                      end
         | 
| 74 83 | 
             
                    }
         | 
| 75 84 | 
             
                    self.send(:define_method, :table_rows_unlimited?) { |table_name|
         | 
| 76 85 | 
             
                      table_rows_allowed(table_name) == PaidUp::Unlimited.to_i
         | 
| @@ -110,16 +119,24 @@ module PaidUp::Mixins | |
| 110 119 | 
             
                      stripe_data.subscriptions.data.first
         | 
| 111 120 | 
             
                    }
         | 
| 112 121 | 
             
                    self.send(:define_method, :is_subscribed_to?) { |plan_to_check|
         | 
| 113 | 
            -
                      plan.id == plan_to_check.id
         | 
| 122 | 
            +
                      plan.present? && plan.id == plan_to_check.id
         | 
| 114 123 | 
             
                    }
         | 
| 115 124 | 
             
                    self.send(:define_method, :can_upgrade_to?) { |plan_to_check|
         | 
| 116 | 
            -
                       | 
| 125 | 
            +
                      plan.nil? || (
         | 
| 126 | 
            +
                        !is_subscribed_to?(plan_to_check) &&
         | 
| 127 | 
            +
                        (plan_to_check.sort_order.to_i > plan.sort_order.to_i)
         | 
| 128 | 
            +
                      )
         | 
| 117 129 | 
             
                    }
         | 
| 118 130 | 
             
                    self.send(:define_method, :can_downgrade_to?) { |plan_to_check|
         | 
| 119 | 
            -
                      ! | 
| 131 | 
            +
                      !plan.nil? && (
         | 
| 132 | 
            +
                        !is_subscribed_to?(plan_to_check) &&
         | 
| 133 | 
            +
                        (plan_to_check.sort_order.to_i < plan.sort_order.to_i)
         | 
| 134 | 
            +
                      )
         | 
| 120 135 | 
             
                    }
         | 
| 121 136 | 
             
                    self.send(:define_method, :using_free_plan?) {
         | 
| 122 | 
            -
                      plan. | 
| 137 | 
            +
                      plan.nil? ||
         | 
| 138 | 
            +
                        stripe_data.delinquent ||
         | 
| 139 | 
            +
                        (plan.stripe_id == PaidUp.configuration.free_plan_stripe_id)
         | 
| 123 140 | 
             
                    }
         | 
| 124 141 | 
             
                    self.send(:define_method, :set_default_attributes) {
         | 
| 125 142 | 
             
                      if new_record?
         | 
    
        data/paid_up.gemspec
    CHANGED
    
    | @@ -2,16 +2,16 @@ | |
| 2 2 | 
             
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 3 | 
             
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
            # stub: paid_up 0.9. | 
| 5 | 
            +
            # stub: paid_up 0.9.2 ruby lib
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gem::Specification.new do |s|
         | 
| 8 8 | 
             
              s.name = "paid_up"
         | 
| 9 | 
            -
              s.version = "0.9. | 
| 9 | 
            +
              s.version = "0.9.2"
         | 
| 10 10 |  | 
| 11 11 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 12 12 | 
             
              s.require_paths = ["lib"]
         | 
| 13 13 | 
             
              s.authors = ["Karen Lundgren"]
         | 
| 14 | 
            -
              s.date = "2016-02- | 
| 14 | 
            +
              s.date = "2016-02-16"
         | 
| 15 15 | 
             
              s.description = "Allows a model of your choosing (such as users) to subscribe to a plan, which enables features."
         | 
| 16 16 | 
             
              s.email = "karen.e.lundgren@gmail.com"
         | 
| 17 17 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -34,6 +34,8 @@ Gem::Specification.new do |s| | |
| 34 34 | 
             
                "app/helpers/paid_up/paid_up_helper.rb",
         | 
| 35 35 | 
             
                "app/helpers/paid_up/plans_helper.rb",
         | 
| 36 36 | 
             
                "app/helpers/paid_up/subscriptions_helper.rb",
         | 
| 37 | 
            +
                "app/mailers/paid_up/paid_up_mailer.rb",
         | 
| 38 | 
            +
                "app/mailers/paid_up/subscription_mailer.rb",
         | 
| 37 39 | 
             
                "app/models/paid_up/ability.rb",
         | 
| 38 40 | 
             
                "app/models/paid_up/plan.rb",
         | 
| 39 41 | 
             
                "app/models/paid_up/plan_feature_setting.rb",
         | 
| @@ -48,9 +50,13 @@ Gem::Specification.new do |s| | |
| 48 50 | 
             
                "app/views/devise/sessions/new.html.haml",
         | 
| 49 51 | 
             
                "app/views/devise/shared/_links.html.haml",
         | 
| 50 52 | 
             
                "app/views/devise/unlocks/new.html.haml",
         | 
| 53 | 
            +
                "app/views/layouts/mailer.html.haml",
         | 
| 54 | 
            +
                "app/views/layouts/mailer.text.haml",
         | 
| 51 55 | 
             
                "app/views/paid_up/features/_abilities_table.html.haml",
         | 
| 52 56 | 
             
                "app/views/paid_up/features/_table.html.haml",
         | 
| 53 57 | 
             
                "app/views/paid_up/plans/index.html.haml",
         | 
| 58 | 
            +
                "app/views/paid_up/subscription_mailer/payment_failed_email.html.haml",
         | 
| 59 | 
            +
                "app/views/paid_up/subscription_mailer/payment_failed_email.text.haml",
         | 
| 54 60 | 
             
                "app/views/paid_up/subscriptions/index.html.haml",
         | 
| 55 61 | 
             
                "app/views/paid_up/subscriptions/new.html.haml",
         | 
| 56 62 | 
             
                "config/initializers/stripe.rb",
         | 
| @@ -139,6 +145,7 @@ Gem::Specification.new do |s| | |
| 139 145 | 
             
                "spec/dummy/db/seeds.rb",
         | 
| 140 146 | 
             
                "spec/dummy/db/test.sqlite3",
         | 
| 141 147 | 
             
                "spec/dummy/lib/assets/.keep",
         | 
| 148 | 
            +
                "spec/dummy/lib/tasks/system.rake",
         | 
| 142 149 | 
             
                "spec/dummy/log/.keep",
         | 
| 143 150 | 
             
                "spec/dummy/log/development.log",
         | 
| 144 151 | 
             
                "spec/dummy/public/404.html",
         | 
| @@ -157,6 +164,8 @@ Gem::Specification.new do |s| | |
| 157 164 | 
             
                "spec/factories/plan.rb",
         | 
| 158 165 | 
             
                "spec/factories/plan_feature_setting.rb",
         | 
| 159 166 | 
             
                "spec/factories/user.rb",
         | 
| 167 | 
            +
                "spec/mailers/paid_up/subscription_mailer_spec.rb",
         | 
| 168 | 
            +
                "spec/mailers/previews/paid_up/subscription_mailer_preview.rb",
         | 
| 160 169 | 
             
                "spec/models/group_spec.rb",
         | 
| 161 170 | 
             
                "spec/models/paid_up/feature_spec.rb",
         | 
| 162 171 | 
             
                "spec/models/paid_up/plan_feature_setting_spec.rb",
         | 
| @@ -201,6 +210,7 @@ Gem::Specification.new do |s| | |
| 201 210 | 
             
                  s.add_runtime_dependency(%q<stripe>, ["~> 1.21"])
         | 
| 202 211 | 
             
                  s.add_development_dependency(%q<jeweler>, ["~> 2"])
         | 
| 203 212 | 
             
                  s.add_development_dependency(%q<bundler>, ["~> 1"])
         | 
| 213 | 
            +
                  s.add_development_dependency(%q<web-console>, ["~> 3.0"])
         | 
| 204 214 | 
             
                  s.add_development_dependency(%q<sqlite3>, ["~> 1.3"])
         | 
| 205 215 | 
             
                  s.add_development_dependency(%q<forgery>, ["~> 0.6"])
         | 
| 206 216 | 
             
                  s.add_development_dependency(%q<bootstrap-sass>, ["~> 3.3"])
         | 
| @@ -223,6 +233,7 @@ Gem::Specification.new do |s| | |
| 223 233 | 
             
                  s.add_dependency(%q<stripe>, ["~> 1.21"])
         | 
| 224 234 | 
             
                  s.add_dependency(%q<jeweler>, ["~> 2"])
         | 
| 225 235 | 
             
                  s.add_dependency(%q<bundler>, ["~> 1"])
         | 
| 236 | 
            +
                  s.add_dependency(%q<web-console>, ["~> 3.0"])
         | 
| 226 237 | 
             
                  s.add_dependency(%q<sqlite3>, ["~> 1.3"])
         | 
| 227 238 | 
             
                  s.add_dependency(%q<forgery>, ["~> 0.6"])
         | 
| 228 239 | 
             
                  s.add_dependency(%q<bootstrap-sass>, ["~> 3.3"])
         | 
| @@ -246,6 +257,7 @@ Gem::Specification.new do |s| | |
| 246 257 | 
             
                s.add_dependency(%q<stripe>, ["~> 1.21"])
         | 
| 247 258 | 
             
                s.add_dependency(%q<jeweler>, ["~> 2"])
         | 
| 248 259 | 
             
                s.add_dependency(%q<bundler>, ["~> 1"])
         | 
| 260 | 
            +
                s.add_dependency(%q<web-console>, ["~> 3.0"])
         | 
| 249 261 | 
             
                s.add_dependency(%q<sqlite3>, ["~> 1.3"])
         | 
| 250 262 | 
             
                s.add_dependency(%q<forgery>, ["~> 0.6"])
         | 
| 251 263 | 
             
                s.add_dependency(%q<bootstrap-sass>, ["~> 3.3"])
         | 
    
        data/spec/dummy/config/routes.rb
    CHANGED
    
    
| Binary file | 
    
        data/spec/dummy/db/seeds.rb
    CHANGED
    
    | @@ -1,99 +1,114 @@ | |
| 1 | 
            -
            # Dir[Rails.root.join("spec/factories/*.rb")].each {|f| require f}
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            ###############
         | 
| 4 | 
            -
            # Plans | 
| 2 | 
            +
            # Plans     #
         | 
| 5 3 | 
             
            ###############
         | 
| 6 4 |  | 
| 7 5 | 
             
            Stripe::Plan.find_or_create_by_id(
         | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                }
         | 
| 6 | 
            +
              'anonymous-plan',
         | 
| 7 | 
            +
              {
         | 
| 8 | 
            +
                amount: 0,
         | 
| 9 | 
            +
                interval: 'month',
         | 
| 10 | 
            +
                name: 'Anonymous Plan',
         | 
| 11 | 
            +
                currency: 'usd'
         | 
| 12 | 
            +
              }
         | 
| 16 13 | 
             
            )
         | 
| 17 14 | 
             
            anonymous_plan = PaidUp::Plan.create(
         | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 15 | 
            +
              title: 'Anonymous',
         | 
| 16 | 
            +
              stripe_id: 'anonymous-plan',
         | 
| 17 | 
            +
              description: "What you can do without logging in.",
         | 
| 18 | 
            +
              sort_order: -1
         | 
| 22 19 | 
             
            )
         | 
| 23 20 | 
             
            Stripe::Plan.find_or_create_by_id(
         | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
                }
         | 
| 21 | 
            +
              'free-plan',
         | 
| 22 | 
            +
              {
         | 
| 23 | 
            +
                amount: 0,
         | 
| 24 | 
            +
                interval: 'month',
         | 
| 25 | 
            +
                name: 'Free Plan',
         | 
| 26 | 
            +
                currency: 'usd'
         | 
| 27 | 
            +
              }
         | 
| 32 28 | 
             
            )
         | 
| 33 29 | 
             
            free_plan = PaidUp::Plan.create(
         | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 30 | 
            +
              title: 'Free',
         | 
| 31 | 
            +
              stripe_id: 'free-plan',
         | 
| 32 | 
            +
              description: "Can't beat the price!",
         | 
| 33 | 
            +
              sort_order: 0
         | 
| 38 34 | 
             
            )
         | 
| 39 35 | 
             
            Stripe::Plan.find_or_create_by_id(
         | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
                }
         | 
| 36 | 
            +
              'no-ads-plan',
         | 
| 37 | 
            +
              {
         | 
| 38 | 
            +
                amount: 100,
         | 
| 39 | 
            +
                interval: 'month',
         | 
| 40 | 
            +
                name: 'No Ads Plan',
         | 
| 41 | 
            +
                currency: 'usd'
         | 
| 42 | 
            +
              }
         | 
| 48 43 | 
             
            )
         | 
| 49 44 | 
             
            no_ads_plan = PaidUp::Plan.create(
         | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 45 | 
            +
              title: 'No Ads',
         | 
| 46 | 
            +
              stripe_id: 'no-ads-plan',
         | 
| 47 | 
            +
              description: "No frills, just removes the ads.",
         | 
| 48 | 
            +
              sort_order: 1
         | 
| 54 49 | 
             
            )
         | 
| 55 50 | 
             
            Stripe::Plan.find_or_create_by_id(
         | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
                }
         | 
| 51 | 
            +
              'group-leader-plan',
         | 
| 52 | 
            +
              {
         | 
| 53 | 
            +
                amount: 500,
         | 
| 54 | 
            +
                interval: 'month',
         | 
| 55 | 
            +
                name: 'Group Leader Plan',
         | 
| 56 | 
            +
                currency: 'usd'
         | 
| 57 | 
            +
              }
         | 
| 64 58 | 
             
            )
         | 
| 65 59 | 
             
            group_leader_plan = PaidUp::Plan.create(
         | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 60 | 
            +
              title: 'Group Leader',
         | 
| 61 | 
            +
              stripe_id: 'group-leader-plan',
         | 
| 62 | 
            +
              description: "For leaders of single groups, with configuration.",
         | 
| 63 | 
            +
              sort_order: 2
         | 
| 70 64 | 
             
            )
         | 
| 71 65 | 
             
            Stripe::Plan.find_or_create_by_id(
         | 
| 72 | 
            -
             | 
| 66 | 
            +
              'professional-plan',
         | 
| 67 | 
            +
              {
         | 
| 68 | 
            +
                amount: 1000,
         | 
| 69 | 
            +
                interval: 'month',
         | 
| 70 | 
            +
                name: 'Professional Plan',
         | 
| 71 | 
            +
                currency: 'usd'
         | 
| 72 | 
            +
              }
         | 
| 73 | 
            +
            )
         | 
| 74 | 
            +
            professional_plan = PaidUp::Plan.create(
         | 
| 75 | 
            +
              title: 'Professional',
         | 
| 76 | 
            +
              stripe_id: 'professional-plan',
         | 
| 77 | 
            +
              description: "Designed for professionals with unlimited groups, a calendar and configuration.",
         | 
| 78 | 
            +
              sort_order: 3
         | 
| 79 | 
            +
            )
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            ###############
         | 
| 82 | 
            +
            # Coupons     #
         | 
| 83 | 
            +
            ###############
         | 
| 84 | 
            +
             | 
| 85 | 
            +
            Stripe::Coupon.find_or_create_by_id(
         | 
| 86 | 
            +
                '25OFF',
         | 
| 73 87 | 
             
                {
         | 
| 74 | 
            -
                    : | 
| 75 | 
            -
                    : | 
| 76 | 
            -
                    : | 
| 77 | 
            -
                    :currency => 'usd',
         | 
| 78 | 
            -
                    :id => 'professional-plan'
         | 
| 88 | 
            +
                    percent_off: 25,
         | 
| 89 | 
            +
                    currency: 'usd',
         | 
| 90 | 
            +
                    duration: 'forever'
         | 
| 79 91 | 
             
                }
         | 
| 80 92 | 
             
            )
         | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
                 | 
| 84 | 
            -
                 | 
| 85 | 
            -
             | 
| 93 | 
            +
             | 
| 94 | 
            +
            Stripe::Coupon.find_or_create_by_id(
         | 
| 95 | 
            +
                'MINUS25',
         | 
| 96 | 
            +
                {
         | 
| 97 | 
            +
                    amount_off: 25,
         | 
| 98 | 
            +
                    currency: 'usd',
         | 
| 99 | 
            +
                    duration: 'forever'
         | 
| 100 | 
            +
                }
         | 
| 86 101 | 
             
            )
         | 
| 102 | 
            +
             | 
| 87 103 | 
             
            ######################
         | 
| 88 104 | 
             
            # Anonymous Customer #
         | 
| 89 105 | 
             
            ######################
         | 
| 90 106 | 
             
            Stripe::Customer.find_or_create_by_id(
         | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
                }
         | 
| 107 | 
            +
              'anonymous-customer',
         | 
| 108 | 
            +
              {
         | 
| 109 | 
            +
                description: 'Anonymous Customer',
         | 
| 110 | 
            +
                plan: 'anonymous-plan'
         | 
| 111 | 
            +
              }
         | 
| 97 112 | 
             
            )
         | 
| 98 113 | 
             
            #######################
         | 
| 99 114 | 
             
            # PlanFeatureSettings #
         | 
| @@ -101,105 +116,112 @@ Stripe::Customer.find_or_create_by_id( | |
| 101 116 |  | 
| 102 117 | 
             
            # Ad Free
         | 
| 103 118 | 
             
            PaidUp::PlanFeatureSetting.create(
         | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 119 | 
            +
              feature: 'ad_free',
         | 
| 120 | 
            +
              plan: no_ads_plan,
         | 
| 121 | 
            +
              setting: 1
         | 
| 107 122 | 
             
            )
         | 
| 108 123 |  | 
| 109 124 | 
             
            # Group Leader
         | 
| 110 125 | 
             
            PaidUp::PlanFeatureSetting.create(
         | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 126 | 
            +
              feature: 'ad_free',
         | 
| 127 | 
            +
              plan: group_leader_plan,
         | 
| 128 | 
            +
              setting: 1
         | 
| 114 129 | 
             
            )
         | 
| 115 130 | 
             
            PaidUp::PlanFeatureSetting.create(
         | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 131 | 
            +
              feature: 'groups',
         | 
| 132 | 
            +
              plan: group_leader_plan,
         | 
| 133 | 
            +
              setting: 5
         | 
| 119 134 | 
             
            )
         | 
| 120 135 | 
             
            PaidUp::PlanFeatureSetting.create(
         | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 136 | 
            +
              feature: 'doodads',
         | 
| 137 | 
            +
              plan: group_leader_plan,
         | 
| 138 | 
            +
              setting: 10
         | 
| 124 139 | 
             
            )
         | 
| 125 140 |  | 
| 126 141 | 
             
            # Professional
         | 
| 127 142 | 
             
            PaidUp::PlanFeatureSetting.create(
         | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 143 | 
            +
              feature: 'ad_free',
         | 
| 144 | 
            +
              plan: professional_plan,
         | 
| 145 | 
            +
              setting: 1
         | 
| 131 146 | 
             
            )
         | 
| 132 147 | 
             
            PaidUp::PlanFeatureSetting.create(
         | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 148 | 
            +
              feature: 'groups',
         | 
| 149 | 
            +
              plan: professional_plan,
         | 
| 150 | 
            +
              setting: PaidUp::Unlimited.to_i(:db)
         | 
| 136 151 | 
             
            )
         | 
| 137 152 | 
             
            PaidUp::PlanFeatureSetting.create(
         | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 153 | 
            +
              feature: 'doodads',
         | 
| 154 | 
            +
              plan: professional_plan,
         | 
| 155 | 
            +
              setting: PaidUp::Unlimited.to_i(:db)
         | 
| 141 156 | 
             
            )
         | 
| 142 157 |  | 
| 143 158 | 
             
            ###############
         | 
| 144 | 
            -
            # Users | 
| 159 | 
            +
            # Users     #
         | 
| 145 160 | 
             
            ###############
         | 
| 146 161 |  | 
| 147 162 | 
             
            free_subscriber = FactoryGirl.create(
         | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
             | 
| 163 | 
            +
              :user,
         | 
| 164 | 
            +
              name: 'Free Subscriber',
         | 
| 165 | 
            +
              plan: free_plan
         | 
| 151 166 | 
             
            )
         | 
| 152 167 |  | 
| 153 168 | 
             
            no_ads_subscriber = FactoryGirl.create(
         | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
             | 
| 169 | 
            +
              :user,
         | 
| 170 | 
            +
              name: 'No Ads Subscriber',
         | 
| 171 | 
            +
              plan: no_ads_plan
         | 
| 157 172 | 
             
            )
         | 
| 158 173 |  | 
| 159 174 | 
             
            group_leader_subscriber = FactoryGirl.create(
         | 
| 160 | 
            -
             | 
| 161 | 
            -
             | 
| 162 | 
            -
             | 
| 175 | 
            +
              :user,
         | 
| 176 | 
            +
              name: 'Group Leader Subscriber',
         | 
| 177 | 
            +
              plan: group_leader_plan
         | 
| 163 178 | 
             
            )
         | 
| 164 179 |  | 
| 165 180 | 
             
            disabling_subscriber = FactoryGirl.create(
         | 
| 166 | 
            -
             | 
| 167 | 
            -
             | 
| 168 | 
            -
             | 
| 181 | 
            +
              :user,
         | 
| 182 | 
            +
              name: 'Disabling Subscriber',
         | 
| 183 | 
            +
              plan: group_leader_plan
         | 
| 169 184 | 
             
            )
         | 
| 170 185 |  | 
| 171 186 | 
             
            professional_subscriber = FactoryGirl.create(
         | 
| 172 | 
            -
             | 
| 173 | 
            -
             | 
| 174 | 
            -
             | 
| 187 | 
            +
              :user,
         | 
| 188 | 
            +
              name: 'Professional Subscriber',
         | 
| 189 | 
            +
              plan: professional_plan
         | 
| 175 190 | 
             
            )
         | 
| 176 191 |  | 
| 177 192 | 
             
            blank_subscriber = FactoryGirl.create(
         | 
| 178 | 
            -
             | 
| 179 | 
            -
             | 
| 180 | 
            -
             | 
| 193 | 
            +
              :user,
         | 
| 194 | 
            +
              name: 'Blank Subscriber',
         | 
| 195 | 
            +
              plan: professional_plan
         | 
| 196 | 
            +
            )
         | 
| 197 | 
            +
             | 
| 198 | 
            +
            past_due_subscriber = FactoryGirl.create(
         | 
| 199 | 
            +
              :user,
         | 
| 200 | 
            +
              name: 'Past Due Subscriber',
         | 
| 201 | 
            +
              plan: professional_plan,
         | 
| 202 | 
            +
              past_due: true
         | 
| 181 203 | 
             
            )
         | 
| 182 204 |  | 
| 183 205 | 
             
            ###############
         | 
| 184 | 
            -
            # Groups | 
| 206 | 
            +
            # Groups    #
         | 
| 185 207 | 
             
            ###############
         | 
| 186 208 |  | 
| 187 209 | 
             
            FactoryGirl.create(
         | 
| 188 | 
            -
             | 
| 189 | 
            -
             | 
| 190 | 
            -
             | 
| 210 | 
            +
              :group,
         | 
| 211 | 
            +
              title: 'First Group',
         | 
| 212 | 
            +
              owner: group_leader_subscriber
         | 
| 191 213 | 
             
            )
         | 
| 192 214 |  | 
| 193 215 | 
             
            FactoryGirl.create(
         | 
| 194 | 
            -
             | 
| 195 | 
            -
             | 
| 196 | 
            -
             | 
| 216 | 
            +
              :group,
         | 
| 217 | 
            +
              title: 'Second Group',
         | 
| 218 | 
            +
              owner: professional_subscriber
         | 
| 197 219 | 
             
            )
         | 
| 198 220 |  | 
| 199 221 | 
             
            FactoryGirl.create(
         | 
| 200 | 
            -
             | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 222 | 
            +
              :group,
         | 
| 223 | 
            +
              title: 'Third Group',
         | 
| 224 | 
            +
              owner: professional_subscriber
         | 
| 203 225 | 
             
            )
         | 
| 204 226 |  | 
| 205 227 | 
             
            5.times do
         | 
| @@ -207,7 +229,13 @@ FactoryGirl.create( | |
| 207 229 | 
             
            end
         | 
| 208 230 |  | 
| 209 231 | 
             
            FactoryGirl.create(
         | 
| 210 | 
            -
             | 
| 211 | 
            -
             | 
| 212 | 
            -
             | 
| 232 | 
            +
              :group,
         | 
| 233 | 
            +
              title: 'Disabled Group',
         | 
| 234 | 
            +
              owner: disabling_subscriber
         | 
| 235 | 
            +
            )
         | 
| 236 | 
            +
             | 
| 237 | 
            +
            FactoryGirl.create(
         | 
| 238 | 
            +
              :group,
         | 
| 239 | 
            +
              title: 'Past Due Group',
         | 
| 240 | 
            +
              owner: past_due_subscriber
         | 
| 213 241 | 
             
            )
         |