You are here

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

Check if customer exists.

File

classes/CustomerSetup.php, line 36
Contains miniOrange Customer class.

Class

MiniorangeCustomerSetup
@file This class represents configuration for customer.

Code

public function checkCustomer() {
  $url = MoAuthConstants::getBaseUrl() . 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 && isset($response->status) && strcasecmp($response->status, 'CURL_ERROR') == 0) {
    $error = array(
      '%method' => 'checkCustomer',
      '%file' => 'CustomerSetup.php',
      '%error' => $response->message,
    );
    watchdog('mo_auth', 'Error at %method of %file: %error', $error);
  }
  return $response;
}