/**
  * ajax module for validation of API access key
  *
  * @options :
  *  ws_main_option
  *  ws_token_store
  *  ws_error_type
  */
 public static function ajax_validation_process()
 {
     if (!class_exists('Mailin')) {
         require_once 'mailin.php';
     }
     $access_key = trim($_POST['access_key']);
     try {
         $mailin = new Mailin(self::sendinblue_api_url, $access_key);
     } catch (Exception $e) {
         if ($e->getMessage() == 'Mailin requires CURL module') {
             $ws_error_type = __('Please install curl on site to use sendinblue plugin.', 'wc_sendinblue');
         } else {
             $ws_error_type = __('Curl error.', 'wc_sendinblue');
         }
         $settings = array('error_type' => $ws_error_type);
         update_option('ws_error_type', $settings);
         die;
     }
     $response = $mailin->get_access_tokens();
     if (is_array($response)) {
         if ($response['code'] == 'success') {
             // store api info
             $settings = array('access_key' => $access_key);
             update_option('ws_main_option', $settings);
             // Create woocommerce attributes on SendinBlue
             $data = array("type" => "transactional", "data" => array('ORDER_ID' => 'ID', 'ORDER_DATE' => 'DATE', 'ORDER_PRICE' => 'NUMBER'));
             $mailin->create_attribute($data);
             $mailin->partnerWordpress();
             echo 'success';
         } else {
             $settings = array('error_type' => __('Please input correct information.', 'wc_sendinblue'));
             update_option('ws_error_type', $settings);
         }
     } else {
         echo 'fail';
     }
     die;
 }