Exemplo n.º 1
0
 def get_context_data(self, **kwargs):
     data = super(CheckoutView, self).get_context_data(**kwargs)
     data["plans"] = get_plans()
     data["OCTOBAT_PUBLIC_KEY"] = settings.OCTOBAT_PUBLIC_KEY
     data["OCTOBAT_SUPPLIER_NAME"] = settings.OCTOBAT_SUPPLIER_NAME
     data["OCTOBAT_IMAGE"] = settings.OCTOBAT_IMAGE
     data["octobat_button"] = True
     return data
Exemplo n.º 2
0
    def test_plans_with_free(self):
        plan = Plan.objects.create(
            stripe_id="foo",
            name="foo", amount=20, currency="USD", interval="2", interval_count=1)

        plans = get_plans(free_plan=True)
        self.assertEquals(len(plans), 2)
        self.assertTrue(isinstance(plans[0]["plan"], FreePlan))
Exemplo n.º 3
0
    def test_plans(self):
        plan = Plan.objects.create(
            stripe_id="foo",
            name="foo", amount=20, currency="USD", interval="2", interval_count=1)

        plans = get_plans()
        self.assertEquals(len(plans), 1)
        self.assertEquals(plans[0]["plan"], plan)
Exemplo n.º 4
0
 def get_context_data(self, **kwargs):
     data = super(CustomSubscriptionUpdateView, self).get_context_data(**kwargs)
     data["plans"] = get_plans()
     data["change_button"] = True
     return data
 def get_context_data(self, **kwargs):
     data = super(PricingView, self).get_context_data(**kwargs)
     data["plans"] = get_plans(free_plan=True)
     data["col"] = "col-md-{}".format(int(12 / len(data["plans"]))) if len(data["plans"]) else "col-md-4"
     return data
Exemplo n.º 6
0
 def test_plan_does_not_exist(self):
     Plan.objects.create(stripe_id="foo", name="foo", amount=20, currency="USD", interval="2", interval_count=1)
     with self.assertRaises(ImproperlyConfigured):
         get_plans()
Exemplo n.º 7
0
 def test_freemium_but_free_plan_does_not_exist(self):
     with self.assertRaises(ImproperlyConfigured):
         get_plans(free_plan=True)
Exemplo n.º 8
0
 def test_no_plans_exist(self):
     self.assertEquals(get_plans(), [])