Changeset View
Changeset View
Standalone View
Standalone View
src/app/Jobs/WalletCheck.php
Show First 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | class WalletCheck implements ShouldQueue | ||||
{ | { | ||||
// TODO: Send the email to all wallet controllers? | // TODO: Send the email to all wallet controllers? | ||||
$mail = new $class($this->wallet, $this->wallet->owner); | $mail = new $class($this->wallet, $this->wallet->owner); | ||||
list($to, $cc) = \App\Mail\Helper::userEmails($this->wallet->owner, $with_external); | list($to, $cc) = \App\Mail\Helper::userEmails($this->wallet->owner, $with_external); | ||||
if (!empty($to) || !empty($cc)) { | if (!empty($to) || !empty($cc)) { | ||||
try { | |||||
Mail::to($to)->cc($cc)->send($mail); | Mail::to($to)->cc($cc)->send($mail); | ||||
} catch (\Exception $e) { | |||||
$msg = sprintf( | |||||
"[WalletCheck] Failed to send mail for wallet %s (%s): %s", | |||||
$this->wallet->id, | |||||
json_encode(array_merge([$to], $cc)), | |||||
$e->getMessage() | |||||
); | |||||
\Log::error($msg); | |||||
throw $e; | |||||
} | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Get the date-time for an action threshold. Calculated using | * Get the date-time for an action threshold. Calculated using | ||||
* the date when a wallet balance turned negative. | * the date when a wallet balance turned negative. | ||||
* | * | ||||
* @param \App\Wallet $wallet A wallet | * @param \App\Wallet $wallet A wallet | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |