You are here

public function MiniorangeCustomerSetup::checkCustomer in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/MiniorangeCustomerSetup.php \Drupal\miniorange_2fa\MiniorangeCustomerSetup::checkCustomer()

Check if customer exists.

File

src/MiniorangeCustomerSetup.php, line 36
Contains miniOrange Customer class.

Class

MiniorangeCustomerSetup
@file This class represents configuration for customer.

Namespace

Drupal\miniorange_2fa

Code

public function checkCustomer() {
  $url = MoAuthConstants::$CUSTOMER_CHECK_API;
  $fields = array(
    'email' => $this->email,
  );
  $json = json_encode($fields);
  $response = MoAuthUtilities::callService($this->defaultCustomerId, $this->defaultCustomerApiKey, $url, $json);
  if (json_last_error() == JSON_ERROR_NONE && strcasecmp($response->status, 'CURL_ERROR') == 0) {
    \Drupal::logger('miniorange_2fa')
      ->error($response->message);
  }
  return $response;
}