public function checkCredentials()
  {
      if (!$phone = $this->dissectPhone()) {
          throw new Exception('The provided phone number is not valid.');
      }

      $countryCode = ($phone['ISO3166'] != '') ? $phone['ISO3166'] : 'US';
      $langCode = ($phone['ISO639'] != '') ? $phone['ISO639'] : 'en';

      // Build the url.
      $host = 'https://'.Constants::WHATSAPP_CHECK_HOST;
      $query = [
      'cc'                 => $phone['cc'],
      'in'                 => $phone['phone'],
      'lg'                 => $langCode,
      'lc'                 => $countryCode,
      'id'                 => $this->identity,
      'mistyped'           => '6',
      'network_radio_type' => '1',
      'simnum'             => '1',
      's'                  => '',
      'copiedrc'           => '1',
      'hasinrc'            => '1',
      'rcmatch'            => '1',
      'pid'                => mt_rand(100, 9999),
      //'rchash' => hash('sha256', openssl_random_pseudo_bytes(20)),
      //'anhash' => md5(openssl_random_pseudo_bytes(20)),
      'extexist' => '1',
      'extstate' => '1',
      ];

      $this->debugPrint($query);

      $response = $this->getResponse($host, $query);

      $this->debugPrint($response);
      
      if ($response->status != 'ok') {
          $this->eventManager()->fire('onCredentialsBad',
            [
                $this->phoneNumber,
                $response->status,
                $response->reason,
            ]);

          throw new Exception('There was a problem trying to request the code.');
      } else {
          $this->eventManager()->fire('onCredentialsGood',
            [
                $this->phoneNumber,
                $response->login,
                $response->pw,
                $response->type,
                $response->expiration,
                $response->kind,
                $response->price,
                $response->cost,
                $response->currency,
                $response->price_expiration,
            ]);
      }

      return $response;
  }