diff --git a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php index 8b4a9109e2..cfb39c4488 100644 --- a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php @@ -34,7 +34,7 @@ class StoreCompanyGatewayRequest extends Request public function rules() { $rules = [ - 'gateway_key' => 'required', + 'gateway_key' => 'required|alpha_num', 'fees_and_limits' => new ValidCompanyGatewayFeesAndLimitsRule(), ]; @@ -45,9 +45,8 @@ class StoreCompanyGatewayRequest extends Request { $input = $this->all(); - $gateway = Gateway::where('key', $input['gateway_key'])->first(); - - if($gateway); + + if($gateway = Gateway::where('key', $input['gateway_key'])->first()) { $default_gateway_fields = json_decode($gateway->fields); diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index e77379786c..e0a78a829d 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -112,6 +112,10 @@ class NinjaMailerJob implements ShouldQueue } catch (\Exception $e) { + // if($e instanceof GuzzleHttp\Exception\ClientException){ + + // } + nlog("error failed with {$e->getMessage()}"); if($this->nmo->entity) diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 6c9a9217a0..511930eea9 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -107,7 +107,10 @@ class TemplateEmail extends Mailable $message->invitation = $this->invitation; }); - //hosted | plan check here + /*TODO insert another check here for whether the attachment exists */ + nlog($this->build_email->getAttachments()); + + foreach ($this->build_email->getAttachments() as $file) { if(is_string($file)) diff --git a/config/database.php b/config/database.php index 30f3f2d5d1..18bf7497f2 100644 --- a/config/database.php +++ b/config/database.php @@ -46,7 +46,7 @@ return [ 'prefix' => '', 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), - // 'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8', + // 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', ], 'sqlite' => [ @@ -93,7 +93,7 @@ return [ 'prefix' => '', 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), - 'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8', + 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', // 'options' => array( // PDO::ATTR_EMULATE_PREPARES => true // ), @@ -111,7 +111,7 @@ return [ 'prefix' => '', 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), - 'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8', + 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', // 'options' => array( // PDO::ATTR_EMULATE_PREPARES => true // ), @@ -129,7 +129,7 @@ return [ 'prefix' => '', 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), - 'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8', + 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', // 'options' => array( // PDO::ATTR_EMULATE_PREPARES => true // ), @@ -147,7 +147,7 @@ return [ 'prefix' => '', 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), - 'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8', + 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', // 'options' => array( // PDO::ATTR_EMULATE_PREPARES => true // ), diff --git a/tests/Feature/CompanyGatewayApiTest.php b/tests/Feature/CompanyGatewayApiTest.php index 33f7bd55e4..4896a3837c 100644 --- a/tests/Feature/CompanyGatewayApiTest.php +++ b/tests/Feature/CompanyGatewayApiTest.php @@ -45,6 +45,43 @@ class CompanyGatewayApiTest extends TestCase Model::reguard(); } + public function testCompanyGatewayEndPointsWithIncorrectFields() + { + $data = [ + 'config' => 'random config', + 'gateway_key' => '', + ]; + + /* POST */ + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/company_gateways', $data); + + $response->assertStatus(302); + + } + + + public function testCompanyGatewayEndPointsWithInvalidFields() + { + $data = [ + 'config' => 'random config', + 'gateway_key' => '$#%^&*(', + ]; + + /* POST */ + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/company_gateways', $data); + + $response->assertStatus(302); + + } + + + public function testCompanyGatewayEndPoints() { $data = [