updated hardcoded character with env variable
This commit is contained in:
@@ -35,6 +35,9 @@ class Esi {
|
||||
* @return true,false
|
||||
*/
|
||||
public function HaveEsiScope($charId, $scope) {
|
||||
//Get the esi config
|
||||
$config = config('esi');
|
||||
|
||||
//Check for an esi scope
|
||||
$checks = DB::table('EsiScopes')->where('character_id', $charId)->get();
|
||||
foreach($checks as $check) {
|
||||
@@ -44,7 +47,7 @@ class Esi {
|
||||
}
|
||||
|
||||
$mail = new EveMail;
|
||||
$mail->sender = 93738489;
|
||||
$mail->sender = $config['primary'];
|
||||
$mail->subject = 'W4RP Services - Incorrect ESI Scope';
|
||||
$mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope;
|
||||
$mail->recipient = (int)$charId;
|
||||
|
||||
@@ -16,8 +16,11 @@ use Seat\Eseye\Exceptions\RequestFailedException;
|
||||
class Mail {
|
||||
|
||||
public function SendMail($recipient, $rType, $subject, $body) {
|
||||
//Get the esi config
|
||||
$config = config('esi');
|
||||
|
||||
//Retrieve the token for main character to send mails from
|
||||
$token = EsiToken::where(['character_id' => 93738489])->first();
|
||||
$token = EsiToken::where(['character_id' => $config['primary']])->first();
|
||||
//Create the ESI authentication container
|
||||
$config = config('esi');
|
||||
$authentication = new EsiAuthentication([
|
||||
@@ -36,7 +39,7 @@ class Mail {
|
||||
]],
|
||||
'subject' => $subject,
|
||||
])->invoke('post', '/characters/{character_id}/mail/', [
|
||||
'character_id'=> 93738489,
|
||||
'character_id'=> $config['primary'],
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
return 1;
|
||||
|
||||
@@ -316,10 +316,14 @@ class FinanceHelper {
|
||||
}
|
||||
|
||||
private function TokenNotFound($token, $scope, $charId) {
|
||||
//Get the esi config
|
||||
$config = config('esi');
|
||||
|
||||
|
||||
if(!isset($token[0]->refresh_token) || !isset($scope[0]->scope)) {
|
||||
//Register a mail to be dispatched as a job
|
||||
$mail = new EveMail;
|
||||
$mail->sender = 93738489;
|
||||
$mail->sender = $config['primary'];
|
||||
$mail->subject = 'W4RP Services ESI API';
|
||||
$mail->body = 'You need to register an ESI API on the services site for esi-wallet.read_corporation_wallet.v1<br>This is also labeled Corporation Wallets';
|
||||
$mail->recipient = (int)$charId;
|
||||
|
||||
Reference in New Issue
Block a user