/**
  * Create a PAsite Cash Account via Webservice
  */
 function wps_paysite_cash_create_account()
 {
     $status = false;
     $response = $website_id = '';
     $user_type = !empty($_POST['status']) ? $_POST['status'] : '';
     $last_name = !empty($_POST['lastname']) ? $_POST['lastname'] : '';
     $first_name = !empty($_POST['firstname']) ? $_POST['firstname'] : '';
     $company_name = !empty($_POST['company_name']) ? $_POST['company_name'] : '';
     $registration_country = !empty($_POST['registration_country']) ? $_POST['registration_country'] : '';
     $residence_country = !empty($_POST['director_residence']) ? $_POST['director_residence'] : '';
     $vat_number = !empty($_POST['vat_number']) ? $_POST['vat_number'] : '';
     $address = !empty($_POST['address']) ? $_POST['address'] : '';
     $zip_code = !empty($_POST['zip_code']) ? $_POST['zip_code'] : '';
     $city = !empty($_POST['city']) ? $_POST['city'] : '';
     $country = !empty($_POST['country']) ? $_POST['country'] : '';
     $phone = !empty($_POST['phone']) ? $_POST['phone'] : '';
     $email = !empty($_POST['email']) ? $_POST['email'] : '';
     $description = !empty($_POST['description']) ? $_POST['description'] : '';
     $username = !empty($_POST['username']) ? $_POST['username'] : '';
     $language = !empty($_POST['language']) ? $_POST['language'] : '';
     if (!empty($user_type) && !empty($last_name) && !empty($first_name) && !empty($address) && !empty($zip_code) && !empty($city) && !empty($country) && !empty($phone) && !empty($email) && !empty($description) && !empty($username) && !empty($language)) {
         if ($user_type == 'company' && !empty($registration_country) && !empty($residence_country) && !empty($company_name) || $user_type != 'company') {
             $merchant_data = array('status' => $user_type, 'firstname' => $first_name, 'lastname' => $last_name, 'company' => $company_name, 'registration_country' => $registration_country, 'director_country' => $residence_country, 'eu_vat' => $vat_number, 'postal_address' => $address, 'zipcode' => $zip_code, 'city' => $city, 'country' => $country, 'phone_number' => $phone, 'email' => $email, 'business_description' => $description, 'username' => $username, 'language' => $language);
             try {
                 $client = new SoapClient(null, array('location' => 'https://billing.paysite-cash.biz/service/merchant_reg_srv.php', 'uri' => 'https://billing.paysite-cash.biz/service/merchant_reg_srv.php', 'trace' => true));
                 $apikey = '25ef148b36a9087e0200fb561f28662d';
                 try {
                     $result = (array) $client->lightRegister($apikey, $merchant_data);
                     $output = $result['status'];
                     $status = true;
                     if ($output) {
                         if (!empty($result['merchant_id'])) {
                             $merchant_data['merchant_id'] = $result['merchant_id'];
                         }
                         update_option('wps_paysite_cash_account_informations', $merchant_data);
                         // Register a website on Paysite Cash.
                         $website_id = $this->wps_paysite_cash_register_website($merchant_data);
                     }
                 } catch (SoapFault $e) {
                     $output = $e->getMessage();
                     $response = sprintf(__('Error: %s', 'wps_paysite_cash'), $output);
                 }
             } catch (Exception $e) {
                 $response = __('Soap functions are not enabled on your server, Please visit Paysite Cash website to create your account', 'wps_paysite_cash');
             }
         } else {
             $response .= __('Please fill all required informations', 'wps_paysite_cash');
         }
     } else {
         $response .= __('Please fill all required informations', 'wps_paysite_cash');
     }
     echo json_encode(array('status' => $status, 'response' => $response, 'website_id' => $website_id));
     wp_die();
 }