Updates for readme

This commit is contained in:
David Bomba 2023-12-10 13:22:51 +11:00
parent 1f2d608742
commit 23fb0d4cda
2 changed files with 28 additions and 4 deletions

View File

@ -22,6 +22,11 @@ use Twilio\Rest\Client;
class TwilioController extends BaseController class TwilioController extends BaseController
{ {
private array $invalid_codes = [
'+21',
'+17152567760',
];
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
@ -39,7 +44,7 @@ class TwilioController extends BaseController
$account = $user->company()->account; $account = $user->company()->account;
if(stripos($request->phone, '+21') !== false) { if(!$this->checkPhoneValidity($request->phone)) {
return response()->json(['message' => 'This phone number is not supported'], 400); return response()->json(['message' => 'This phone number is not supported'], 400);
} }
@ -70,6 +75,19 @@ class TwilioController extends BaseController
return response()->json(['message' => 'Code sent.'], 200); return response()->json(['message' => 'Code sent.'], 200);
} }
private function checkPhoneValidity($phone)
{
foreach($this->invalid_codes as $code){
if(stripos($phone, $code) !== false) {
return false;
}
return true;
}
}
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* *

View File

@ -305,14 +305,20 @@ class ProcessPostmarkWebhook implements ShouldQueue
if($sl) { if($sl) {
$this->updateSystemLog($sl, $data); $this->updateSystemLog($sl, $data);
if (config('ninja.notification.slack')) {
$this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();
}
return; return;
} }
(new SystemLogger($data, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company))->handle(); (new SystemLogger($data, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company))->handle();
if (config('ninja.notification.slack')) { if (config('ninja.notification.slack')) {
$this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja(); $this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();
} }
} }
private function discoverInvitation($message_id) private function discoverInvitation($message_id)