Beispiel #1
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        kenny = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Kenny",
                                    last_name="Kim")
        kenny.set_password("Thing5Ar3Gr34t")
        kenny.save()

        clara = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Clara",
                                    last_name="Chang")
        clara.set_password("Thing5Ar3Gr34t")
        clara.save()

        settings_kenny = UserSettings()
        settings_kenny = settings_kenny.get_settings_based_on_user(kenny)
        settings_kenny.save()

        settings_clara = UserSettings()
        settings_clara = settings_clara.get_settings_based_on_user(clara)
        settings_clara.BusinessName = "InFlow"
        settings_clara.Region = "New York"
        settings_clara.PhoneNumber = "2125555555"
        settings_clara.StripeConnectAccountKey = "1234567890"
        settings_clara.save()
Beispiel #2
0
    def get(self, request):
        context = self.get_context_data(request)

        # If true, This call came from a Stripe page and came back with a User ID
        if context["came_from_stripe"] and context["user_stripe_acct"] != "":
            user_settings = UserSettings()
            user_settings = user_settings.get_settings_based_on_user(
                request.user)
            user_settings.StripeConnectAccountKey = context["user_stripe_acct"]
            user_settings.save()
            context["needs_stripe"] = False

        return render(request, self.template_name, context)
Beispiel #3
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        # Users
        user_1 = User.objects.create(username="******",
                                     email="*****@*****.**",
                                     first_name="Brian",
                                     last_name="Katchmar")
        user_1.set_password("Th3L10nK1ng15Fun")
        user_1.save()
        settings_user_1 = UserSettings()
        settings_user_1 = settings_user_1.get_settings_based_on_user(user_1)
        settings_user_1.BusinessName = "MIAC"
        settings_user_1.Region = "New York"
        settings_user_1.save()

        user_2 = User.objects.create(username="******",
                                     email="*****@*****.**",
                                     first_name="Brian",
                                     last_name="Katchmar")
        user_2.set_password("Thing5Ar3Gr34t")
        user_2.save()
        settings_user_2 = UserSettings()
        settings_user_2 = settings_user_2.get_settings_based_on_user(user_2)
        settings_user_2.save()

        user_3 = User.objects.create(username="******",
                                     email="*****@*****.**",
                                     first_name="Brian",
                                     last_name="Katchmar")
        user_3.set_password("Thing5Ar3Gr34t")
        user_3.save()
        settings_user_3 = UserSettings()
        settings_user_3 = settings_user_3.get_settings_based_on_user(user_3)
        settings_user_3.BusinessName = "InFlow"
        settings_user_3.Region = "New York"
        settings_user_3.PhoneNumber = "2125555555"
        settings_user_3.StripeConnectAccountKey = "1234567890"
        settings_user_3.save()
Beispiel #4
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        # Users
        brian = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Brian",
                                    last_name="Katchmar")
        brian.set_password("Th3L10nK1ng15Fun")
        brian.save()
        settings_brian = UserSettings()
        settings_brian = settings_brian.get_settings_based_on_user(brian)
        settings_brian.BusinessName = "MIAC"
        settings_brian.Region = "New York"
        settings_brian.save()

        kenny = User.objects.create(
            username="******",
            email="*****@*****.**",
            first_name="Kenny",
            last_name="Kim"
        )  # Has User Settings, has associated types, neither of the two fields we check
        kenny.set_password("Thing5Ar3Gr34t")
        kenny.save()
        settings_kenny = UserSettings()
        settings_kenny = settings_kenny.get_settings_based_on_user(kenny)
        settings_kenny.save()

        clara = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Clara",
                                    last_name="Chang")
        clara.set_password("Thing5Ar3Gr34t")
        clara.save()
        settings_clara = UserSettings()
        settings_clara = settings_clara.get_settings_based_on_user(clara)
        settings_clara.BusinessName = "InFlow"
        settings_clara.Region = "New York"
        settings_clara.PhoneNumber = "2125555555"
        settings_clara.StripeConnectAccountKey = "1234567890"
        settings_clara.save()

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_1).exists():
            ns1 = NotificationSetting.objects.get(
                SettingName=self.setting_string_1)
        else:
            ns1 = NotificationSetting.objects.create(
                SettingName=self.setting_string_1)

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_2).exists():
            ns2 = NotificationSetting.objects.get(
                SettingName=self.setting_string_2)
        else:
            ns2 = NotificationSetting.objects.create(
                SettingName=self.setting_string_2)

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_3).exists():
            ns3 = NotificationSetting.objects.get(
                SettingName=self.setting_string_3)
        else:
            ns3 = NotificationSetting.objects.create(
                SettingName=self.setting_string_3)

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_4).exists():
            ns4 = NotificationSetting.objects.get(
                SettingName=self.setting_string_4)
        else:
            ns4 = NotificationSetting.objects.create(
                SettingName=self.setting_string_4)

        # Purge the DB Entries, we're rebuild what we're expecting
        UserNotificationSettings.objects.filter(UserAccount=brian).delete()
        UserNotificationSettings.objects.filter(UserAccount=kenny).delete()
        UserNotificationSettings.objects.filter(UserAccount=clara).delete()

        # Brian
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns1,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns2,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns3,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns4,
                                                Selected=True)

        # Kenny
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns1,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns2,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns3,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns4,
                                                Selected=True)

        # Clara
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns1,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns2,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns3,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns4,
                                                Selected=True)