Client can register

This commit is contained in:
David Bomba 2020-06-28 20:28:35 +10:00
parent 9656baa5f4
commit 6bf5621cde
4 changed files with 59 additions and 41 deletions

View File

@ -121,7 +121,8 @@ class CompanyTransformer extends EntityTransformer
'slack_webhook_url' => (string)$company->slack_webhook_url, 'slack_webhook_url' => (string)$company->slack_webhook_url,
'google_analytics_url' => (string)$company->google_analytics_key, //@deprecate 'google_analytics_url' => (string)$company->google_analytics_key, //@deprecate
'google_analytics_key' => (string)$company->google_analytics_key, 'google_analytics_key' => (string)$company->google_analytics_key,
'enabled_item_tax_rates' => (int) $company->enabled_item_tax_rates 'enabled_item_tax_rates' => (int) $company->enabled_item_tax_rates,
'client_can_register' => (bool) $company->client_can_register,
]; ];
} }

View File

@ -45,16 +45,18 @@ class SystemHealth
*/ */
public static function check() : array public static function check() : array
{ {
$system_health = true; $system_health = "true";
if (in_array(false, Arr::dot(self::extensions()))) { if (in_array(false, Arr::dot(self::extensions()))) {
$system_health = false; $system_health = "false";
} elseif (phpversion() < self::$php_version) { } elseif (phpversion() < self::$php_version) {
$system_health = false; $system_health = "false";
} elseif(!self::simpleDbCheck()) {
$system_health = "false";
} }
return [ return [
'system_health' => (bool) $system_health, 'system_health' => $system_health,
'extensions' => self::extensions(), 'extensions' => self::extensions(),
'php_version' => [ 'php_version' => [
'minimum_php_version' => self::$php_version, 'minimum_php_version' => self::$php_version,
@ -62,11 +64,26 @@ class SystemHealth
'is_okay' => version_compare(phpversion(), self::$php_version, '>='), 'is_okay' => version_compare(phpversion(), self::$php_version, '>='),
], ],
'env_writable' => self::checkEnvWritable(), 'env_writable' => self::checkEnvWritable(),
//'dbs' => self::dbCheck(),
//'mail' => self::testMailServer(), //'mail' => self::testMailServer(),
]; ];
} }
private static function simpleDbCheck() :bool
{
$result = true;
try {
$pdo = DB::connection()->getPdo();
$result = true;
}
catch (\Exception $e) {
$result = false;
}
info("returning false");
return $result;
}
private static function extensions() :array private static function extensions() :array
{ {
$loaded_extensions = []; $loaded_extensions = [];

View File

@ -24,6 +24,6 @@ trait AppSetup
$check = SystemHealth::check(); $check = SystemHealth::check();
return settype($check['system_health'], "bool"); // Do the system tests pass? return $check == "true";
} }
} }

View File

@ -265,29 +265,29 @@ class RandomDataSeeder extends Seeder
]); ]);
// if (config('ninja.testvars.stripe')) { if (config('ninja.testvars.stripe')) {
// $cg = new CompanyGateway; $cg = new CompanyGateway;
// $cg->company_id = $company->id; $cg->company_id = $company->id;
// $cg->user_id = $user->id; $cg->user_id = $user->id;
// $cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23'; $cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
// $cg->require_cvv = true; $cg->require_cvv = true;
// $cg->show_billing_address = true; $cg->show_billing_address = true;
// $cg->show_shipping_address = true; $cg->show_shipping_address = true;
// $cg->update_details = true; $cg->update_details = true;
// $cg->config = encrypt(config('ninja.testvars.stripe')); $cg->config = encrypt(config('ninja.testvars.stripe'));
// $cg->save(); $cg->save();
// $cg = new CompanyGateway; $cg = new CompanyGateway;
// $cg->company_id = $company->id; $cg->company_id = $company->id;
// $cg->user_id = $user->id; $cg->user_id = $user->id;
// $cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23'; $cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
// $cg->require_cvv = true; $cg->require_cvv = true;
// $cg->show_billing_address = true; $cg->show_billing_address = true;
// $cg->show_shipping_address = true; $cg->show_shipping_address = true;
// $cg->update_details = true; $cg->update_details = true;
// $cg->config = encrypt(config('ninja.testvars.stripe')); $cg->config = encrypt(config('ninja.testvars.stripe'));
// $cg->save(); $cg->save();
// } }
// if (config('ninja.testvars.paypal')) { // if (config('ninja.testvars.paypal')) {
// $cg = new CompanyGateway; // $cg = new CompanyGateway;
@ -315,18 +315,18 @@ class RandomDataSeeder extends Seeder
// $cg->save(); // $cg->save();
// } // }
if(config('ninja.testvars.authorize')) { // if(config('ninja.testvars.authorize')) {
$cg = new CompanyGateway; // $cg = new CompanyGateway;
$cg->company_id = $company->id; // $cg->company_id = $company->id;
$cg->user_id = $user->id; // $cg->user_id = $user->id;
$cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb'; // $cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb';
$cg->require_cvv = true; // $cg->require_cvv = true;
$cg->show_billing_address = true; // $cg->show_billing_address = true;
$cg->show_shipping_address = true; // $cg->show_shipping_address = true;
$cg->update_details = true; // $cg->update_details = true;
$cg->config = encrypt(config('ninja.testvars.authorize')); // $cg->config = encrypt(config('ninja.testvars.authorize'));
$cg->save(); // $cg->save();
} // }
} }
} }