Пример #1
0
    def setup_terms(self):
        scope = Scope.for_brand(self.brand_id)

        snippet, _ = snippet_service.create_fragment(
            scope,
            'terms_of_service',
            self.admin.id,
            'Don\'t do anything stupid!',
        )

        consent_subject = consent_subject_service.create_subject(
            f'{self.brand_id}_terms-of-service_v1',
            f'Terms of service for {self.brand.title} / v1',
            'terms_of_service',
        )

        terms_document_id = self.brand_id
        terms_document = terms_document_service.create_document(
            terms_document_id, terms_document_id)

        terms_version = terms_version_service.create_version(
            terms_document.id, '01-Jan-2016', snippet.id, consent_subject.id)

        terms_document_service.set_current_version(terms_document_id,
                                                   terms_version.id)

        brand_settings_service.create_setting(self.brand.id,
                                              'terms_document_id',
                                              str(terms_document.id))

        self.terms_version_id = terms_version.id
        self.terms_consent_subject_id = terms_version.consent_subject_id
Пример #2
0
    def setup_privacy_policy(self):
        consent_subject = consent_subject_service.create_subject(
            '{}_privacy_policy_v1'.format(self.brand_id),
            'Privacy policy for {} / v1'.format(self.brand.title),
            'privacy_policy')

        brand_settings_service.create_setting(
            self.brand.id, 'privacy_policy_consent_subject_id',
            str(consent_subject.id))

        self.privacy_policy_consent_subject_id = consent_subject.id
Пример #3
0
    def setup_privacy_policy(self):
        consent_subject = consent_subject_service.create_subject(
            f'{self.brand_id}_privacy_policy_v1',
            f'Privacy policy for {self.brand.title} / v1',
            'privacy_policy',
        )

        brand_settings_service.create_setting(
            self.brand.id,
            'privacy_policy_consent_subject_id',
            str(consent_subject.id),
        )

        self.privacy_policy_consent_subject_id = consent_subject.id
Пример #4
0
def execute(brand, document_id, title, snippet_version_id,
            consent_subject_name_suffix):
    consent_subject_name \
        = f'{brand.id}_terms-of-service_{consent_subject_name_suffix}'

    consent_subject_title = f'AGB {brand.title} / {title}'

    consent_subject = consent_subject_service.create_subject(
        consent_subject_name, consent_subject_title, 'terms_of_service')

    terms_version_service \
        .create_version(document_id, title, snippet_version_id, consent_subject.id)

    click.secho('Done.', fg='green')