updated process send eve mail job
updated test command to work on resposne codes
This commit is contained in:
@@ -42,6 +42,13 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
*/
|
||||
//public $retries = 3;
|
||||
|
||||
/**
|
||||
* Middleware for the job
|
||||
*
|
||||
* @var \Spatie\RateLimitedMiddleware\RateLimited
|
||||
*/
|
||||
private $middleware;
|
||||
|
||||
private $sender;
|
||||
private $body;
|
||||
private $recipient;
|
||||
@@ -54,13 +61,17 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($body, $recipient, $recipient_type, $subject, $sender) {
|
||||
//Set the connection
|
||||
$this->connection = 'redis';
|
||||
|
||||
//Private variables
|
||||
$this->body = $body;
|
||||
$this->recipient = $recipient;
|
||||
$this->recipient_type = $recipient_type;
|
||||
$this->subject = $subject;
|
||||
$this->sender = $sender;
|
||||
|
||||
$this->connection = 'redis';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,14 +91,19 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
$config = config('esi');
|
||||
|
||||
//Retrieve the token for main character to send mails from
|
||||
$token = $esiHelper->GetRefreshToken($config['primary']);
|
||||
|
||||
$refreshToken = $esiHelper->GetRefreshToken($config['primary']);
|
||||
//Create the ESI authentication container
|
||||
$esi = $esiHelper->SetupEsiAuthentication($token);
|
||||
$esi = $esiHelper->SetupEsiAuthentication($refreshToken);
|
||||
|
||||
//Check to see if the token is valid or not
|
||||
if($esiHelper->TokenExpired($refreshToken)) {
|
||||
$refreshToken = $esiHelper->GetRefreshToken($config['primary']);
|
||||
$esi = $esiHelper->SetupEsiAuthentication($refreshToken);
|
||||
}
|
||||
|
||||
//Attemp to send the mail
|
||||
try {
|
||||
$esi->setBody([
|
||||
$reponse = $esi->setBody([
|
||||
'approved_cost' => 100,
|
||||
'body' => $this->body,
|
||||
'recipients' => [[
|
||||
@@ -122,7 +138,7 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
->releaseAfterOneMinute()
|
||||
->releaseAfterBackoff($this->attempts());
|
||||
|
||||
return [new RateLimited()];
|
||||
return [$rateLimitedMiddleware];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user