You are here

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

Create Customer.

File

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

Class

MiniorangeCustomerSetup
@file This class represents configuration for customer.

Code

public function createCustomer() {
  $url = MoAuthConstants::getBaseUrl() . MoAuthConstants::$CUSTOMER_CREATE_API;
  $fields = array(
    'companyName' => $_SERVER['SERVER_NAME'],
    'areaOfInterest' => MoAuthConstants::$PLUGIN_NAME,
    'email' => $this->email,
    'phone' => $this->phone,
    'password' => $this->password,
  );
  $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')) {
    $error = array(
      '%method' => 'createCustomer',
      '%file' => 'CustomerSetup.php',
      '%error' => $response->message,
    );
    watchdog('mo_auth', 'Error at %method of %file: %error', $error);
  }
  return $response;
}