Skip to content

tos and privacy

charkhaw edited this page May 9, 2024 · 2 revisions

# Details

Scope: buildfire.atlassian.net/browse/WEB2-8437

## 1- ROUTES ### Privacy policy Route:

  • Path: /app/:appId/security/privacyPolicy

### Terms and Conditions Route:

  • Path: /app/:appId/security/termsAndConditions

### Method

#### GET

  • payload: appId

  • Controller /others/security/privacyPolicy.ejs

  • logic:

    - Render the EJS file.
    - Check if the `appId` is active; if not, respond with a 404.
    - Call the Auth Settings in order to calculate the correct documents keys
  let authDS = new DatastoreAPI({
      appId: window.appContext.currentApp.appId
      , pluginId: 'authSettings'
      , instanceId: 'authSettings'
      , liveMode: 0
      , writeKey: window.appContext.currentApp.keys.datastoreKey
  });

  authDS.get({ tag: 'authSettings', withDynamicData: false }, (err, result) => {
- if `termsConditionsAndPrivacyPolicy.custom.active` 
   - terms and conditions key = termsConditionsAndPrivacyPolicy.custom.settings.termsAndConditionsDocumentKey
   - privacy policy key = termsConditionsAndPrivacyPolicy.custom.settings.privacyPolicyDocumentKey
- if termsConditionsAndPrivacyPolicy is not available in auth settings (not defined), try to fetch from appearanceHelper
   
  appearanceHelper.get((err, result) => { 
- keys are res.customRegistration.singlePage.formControls['termsConditionsAndPrivacyPolicy'] if available and `res.customRegistration.active` - otherwise keys default to: ['bf_terms_and_conditions', 'bf_privacy_policy']
  • having the right keys, call crm to get the corresponding document

  • “‘javascript

    let crmDocumentApiPath = ‘api/app/’ + window.appContext.currentApp.appId + ‘/crm/documents/’ + keys;

    $http.get(crmDocumentApiPath).success((obj) => { “‘

  • If error occured, respond with 400 (message: invalid request).

  • display the document content in privacyPolicy.ejs

#### GET

  • payload: appId

  • Controller /others/security/termsAndConditions.ejs

  • logic:

    - Render the EJS file.
    - Check if the `appId` is active; if not, respond with a 404.
    - Same logic that we did above

### 3. Publishing info:

  • We should add the generated URL to:

    - WL build queue
    - App publishing info / new section: Security or Terms and conditions & privacy policy (under App Publishing Info > Google play store)

Clone this wiki locally