You are here

public static function Utilities::send_demo_query in OAuth2 Login 8

2 calls to Utilities::send_demo_query()
MiniorangeLicensing::send_rfd_query in src/Form/MiniorangeLicensing.php
MiniorangeRFD::submitForm in src/Form/MiniorangeRFD.php
Form submission handler.

File

src/Utilities.php, line 231

Class

Utilities

Namespace

Drupal\oauth2_login

Code

public static function send_demo_query($email, $query, $description) {
  if (empty($email) || empty($description)) {
    \Drupal::messenger()
      ->addMessage(t('The <b><u>Email</u></b> and <b><u>Description</u></b> fields are mandatory.'), 'error');
    return;
  }
  elseif (!valid_email_address($email)) {
    \Drupal::messenger()
      ->addMessage(t('The email address <b><i>' . $email . '</i></b> is not valid.'), 'error');
    return;
  }
  $phone = \Drupal::config('oauth2_login.settings')
    ->get('miniorange_oauth_client_customer_admin_phone');
  $support = new MiniorangeOAuthClientSupport($email, $phone, $query, 'demo');
  $support_response = $support
    ->sendSupportQuery();
  if ($support_response) {
    \Drupal::messenger()
      ->addMessage(t('Request demo query successfully sent. We will get back to you shortly.'), 'status');
  }
  else {
    \Drupal::messenger()
      ->addMessage(t('Error sending request demo query'), 'error');
  }
}