public function MiniorangeCustomerSetup::createCustomer in Google Authenticator / 2 Factor Authentication - 2FA 8.2
Same name and namespace in other branches
- 8 src/MiniorangeCustomerSetup.php \Drupal\miniorange_2fa\MiniorangeCustomerSetup::createCustomer()
Create Customer.
File
- src/
MiniorangeCustomerSetup.php, line 54 - Contains miniOrange Customer class.
Class
- MiniorangeCustomerSetup
- @file This class represents configuration for customer.
Namespace
Drupal\miniorange_2faCode
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, false);
if (json_last_error() == JSON_ERROR_NONE && strcasecmp($response->status, 'CURL_ERROR')) {
MoAuthUtilities::mo_add_loggers_for_failures($response->message, $response->status === 'SUCCESS' ? 'info' : 'error');
}
return $response;
}