Untitled

mail@pastecode.io avatar
unknown
plain_text
23 days ago
1.8 kB
3
Indexable
Never
async function getConsent() {
  let name: any;
  let surname: any;
  let tckn: any;
  let email: any;
  let phoneNum: any;

  quick.Quick.host.trigger("GetIdentity", {}).then(response => {
    name = response.retVal["funcRetVal"].Name;
    surname = response.retVal["funcRetVal"].Surname;
    tckn = response.retVal["funcRetVal"].TCKN;

    quick.store.set('$name', name);
    quick.store.set('$surname', surname);
    quick.store.set('$tckn', tckn);

    quick.Quick.host.trigger("GetMailAddress", {}).then(response => {
      email = response.retVal["funcRetVal"].Email;

      quick.store.set('$email', email);

      quick.Quick.host.trigger("GetPhoneNumber", {}).then(response => {
        phoneNum = response.retVal["funcRetVal"].PhoneNumber;

        quick.store.set('$phoneNum', phoneNum);

        let userInfo = {
          username: email,
          first_name: name,
          last_name: surname,
          national_id: tckn,
          phone_number: phoneNum,
        };

        let bodyString = `{"first_name":"${userInfo.first_name}","last_name":"${userInfo.last_name}","national_id":"${userInfo.national_id}","phone_number":"${userInfo.phone_number}","username":"${userInfo.username}"}`;

        let message = ACCESS_KEY + PROVIDER_KEY + PASS_PHRASE + TIMESTAMP + bodyString;
        const secret = hashWithSecret(quick.store.get("$message"), API_SECRET).toUpperCase();

        quick.store.set('$userInfo', userInfo);
        quick.store.set("$message", message);
        quick.store.set('$userSecret', secret);

        quick.EM.trace(quick.store.get("$message"));
        quick.EM.trace(quick.store.get("$userInfo"));

        quick.MM.trigger('getInfo');

      }).catch(err => {

      })

    }).catch(err => {

    })

  }).catch(err => {

  })
};

getConsent();
Leave a Comment