(self, request)
Create a new user subscription
Create a new user subscription
Create a new user subscription
def create(self, request):
        ''' Create a new user subscription '''
        form_data = self.parse_form(request)
        if self.user.monitorCount == 0:
        # Require at least one subscription
            self.user.subplans = 1
        else:
            self.user.subplans = self.user.monitorCount
        if form_data['type'] is "subscribe":
            result = self.create_subscription(form_data)
            if result:
                self.user.stripeid = result
                self.user.stripe = form_data['stripe_token']
                self.user.subscription = form_data['plan']
                if "pro_plus" in form_data['plan'] or "proplus" in form_data['plan']:
                    self.user.acttype = "proplus"
                else:
                    self.user.acttype = "pro"
                set_subscription = self.user.setSubscription(self.rdb)
                if set_subscription:
                    return True
                else:
                    return False
            else:
                return False
        else:
            return False
def create ( self , request ) : form_data = self . parse_form ( request ) if self . user . monitorCount == 0 : # Require at least one subscription self . user . subplans = 1 else : self . user . subplans = self . user . monitorCount if form_data [ 'type' ] is "subscribe" : result = self . create_subscription ( form_data ) if result : self . user . stripeid = result self . user . stripe = form_data [ 'stripe_token' ] self . user . subscription = form_data [ 'plan' ] if "pro_plus" in form_data [ 'plan' ] or "proplus" in form_data [ 'plan' ] : self . user . acttype = "proplus" else : self . user . acttype = "pro" set_subscription = self . user . setSubscription ( self . rdb ) if set_subscription : return True else : return False else : return False else : return False