diff --git a/app/Jobs/Mail/AutoBillingFailureMailer.php b/app/Jobs/Mail/AutoBillingFailureMailer.php deleted file mode 100644 index 3ccd0c420005..000000000000 --- a/app/Jobs/Mail/AutoBillingFailureMailer.php +++ /dev/null @@ -1,109 +0,0 @@ -client = $client; - - $this->error = $error; - - $this->company = $company; - - $this->payment_hash = $payment_hash; - - $this->company = $company; - - $this->settings = $client->getMergedSettings(); - } - - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - - /*If we are migrating data we don't want to fire these notification*/ - if ($this->company->is_disabled) { - return true; - } - - //Set DB - MultiDB::setDb($this->company->db); - - //if we need to set an email driver do it now - $this->setMailDriver(); - - //iterate through company_users - $this->company->company_users->each(function ($company_user) { - - //determine if this user has the right permissions - $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure','all_notifications']); - - //if mail is a method type -fire mail!! - if (($key = array_search('mail', $methods)) !== false) { - unset($methods[$key]); - - $mail_obj = (new AutoBillingFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build(); - $mail_obj->from = [config('mail.from.address'), config('mail.from.name')]; - - //send email - try { - Mail::to($company_user->user->email) - ->send(new EntityNotificationMailer($mail_obj)); - } catch (\Exception $e) { - //$this->failed($e); - $this->logMailError($e->getMessage(), $this->client); - } - } - }); - } -} diff --git a/app/Jobs/Mail/ClientPaymentFailureMailer.php b/app/Jobs/Mail/ClientPaymentFailureMailer.php deleted file mode 100644 index 7db3617995cd..000000000000 --- a/app/Jobs/Mail/ClientPaymentFailureMailer.php +++ /dev/null @@ -1,111 +0,0 @@ -company = $company; - - $this->error = $error; - - $this->client = $client; - - $this->payment_hash = $payment_hash; - - $this->company = $company; - - $this->settings = $client->getMergedSettings(); - } - - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - - /*If we are migrating data we don't want to fire these notification*/ - if ($this->company->is_disabled) { - return true; - } - - //Set DB - MultiDB::setDb($this->company->db); - - //if we need to set an email driver do it now - $this->setMailDriver(); - - $this->invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->get(); - - $this->invoices->first()->invitations->each(function ($invitation) { - - if ($invitation->contact->send_email && $invitation->contact->email) { - - $mail_obj = (new ClientPaymentFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build(); - $mail_obj->from = [config('mail.from.address'), config('mail.from.name')]; - - //send email - try { - Mail::to($invitation->contact->email) - ->send(new EntityNotificationMailer($mail_obj)); - } catch (\Exception $e) { - - $this->logMailError($e->getMessage(), $this->client); - } - - } - - }); - - - } -} diff --git a/app/Jobs/Mail/PaymentFailureMailer.php b/app/Jobs/Mail/PaymentFailureMailer.php index c1a5dbc47977..5bb1ef5dbfde 100644 --- a/app/Jobs/Mail/PaymentFailureMailer.php +++ b/app/Jobs/Mail/PaymentFailureMailer.php @@ -82,7 +82,6 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue //determine if this user has the right permissions $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure','all_notifications']); - //if mail is a method type -fire mail!! if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); diff --git a/app/Notifications/ClientContactResetPassword.php b/app/Notifications/ClientContactResetPassword.php index ff9cd764efb9..731d7deab6c2 100644 --- a/app/Notifications/ClientContactResetPassword.php +++ b/app/Notifications/ClientContactResetPassword.php @@ -67,16 +67,6 @@ class ClientContactResetPassword extends Notification */ public function toMail($notifiable) { - if (static::$toMailCallback) { - return call_user_func(static::$toMailCallback, $notifiable, $this->token); - } - - return (new MailMessage) - ->subject('Reset Password Notification') - ->line('You are receiving this email because we received a password reset request for your account.') - ->action('Reset Password', url(config('app.url').route('client.password.reset', ['token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset()], false))) - ->line('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.users.expire')]) - ->line('If you did not request a password reset, no further action is required.'); } /** diff --git a/app/Notifications/ResetPasswordNotification.php b/app/Notifications/ResetPasswordNotification.php index 387e79441539..34b7f4ad69c5 100644 --- a/app/Notifications/ResetPasswordNotification.php +++ b/app/Notifications/ResetPasswordNotification.php @@ -42,8 +42,6 @@ class ResetPasswordNotification extends Notification */ public function toMail($notifiable) { - return (new MailMessage) - ->view('email.auth.password-reset', ['link' => route('password.reset', $this->token)]); } /** diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 3cb8e83c7a0e..5b84299bfd28 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -16,8 +16,6 @@ use App\Events\Payment\PaymentWasCreated; use App\Exceptions\PaymentFailed; use App\Factory\PaymentFactory; use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; -use App\Jobs\Mail\AutoBillingFailureMailer; -use App\Jobs\Mail\ClientPaymentFailureMailer; use App\Jobs\Mail\NinjaMailer; use App\Jobs\Mail\NinjaMailerJob; use App\Jobs\Mail\NinjaMailerObject; diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index d27d691a0582..1d8952dac4ad 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -466,7 +466,10 @@ trait MockAccountData $this->invoice->ledger()->updateInvoiceBalance($this->invoice->amount); // UpdateCompanyLedgerWithInvoice::dispatchNow($this->invoice, $this->invoice->amount, $this->invoice->company); + $user_id = $this->invoice->user_id; + $recurring_invoice = InvoiceToRecurringInvoiceFactory::create($this->invoice); + $recurring_invoice->user_id = $user_id; $recurring_invoice->next_send_date = Carbon::now(); $recurring_invoice->status_id = RecurringInvoice::STATUS_ACTIVE; $recurring_invoice->remaining_cycles = 2; @@ -477,6 +480,7 @@ trait MockAccountData $recurring_invoice->save(); $recurring_invoice = InvoiceToRecurringInvoiceFactory::create($this->invoice); + $recurring_invoice->user_id = $user_id; $recurring_invoice->next_send_date = Carbon::now()->addMinutes(2); $recurring_invoice->status_id = RecurringInvoice::STATUS_ACTIVE; $recurring_invoice->remaining_cycles = 2; @@ -487,6 +491,7 @@ trait MockAccountData $recurring_invoice->save(); $recurring_invoice = InvoiceToRecurringInvoiceFactory::create($this->invoice); + $recurring_invoice->user_id = $user_id; $recurring_invoice->next_send_date = Carbon::now()->addMinutes(10); $recurring_invoice->status_id = RecurringInvoice::STATUS_ACTIVE; $recurring_invoice->remaining_cycles = 2; @@ -497,6 +502,7 @@ trait MockAccountData $recurring_invoice->save(); $recurring_invoice = InvoiceToRecurringInvoiceFactory::create($this->invoice); + $recurring_invoice->user_id = $user_id; $recurring_invoice->next_send_date = Carbon::now()->addMinutes(15); $recurring_invoice->status_id = RecurringInvoice::STATUS_ACTIVE; $recurring_invoice->remaining_cycles = 2; @@ -507,6 +513,7 @@ trait MockAccountData $recurring_invoice->save(); $recurring_invoice = InvoiceToRecurringInvoiceFactory::create($this->invoice); + $recurring_invoice->user_id = $user_id; $recurring_invoice->next_send_date = Carbon::now()->addMinutes(20); $recurring_invoice->status_id = RecurringInvoice::STATUS_ACTIVE; $recurring_invoice->remaining_cycles = 2; @@ -517,6 +524,7 @@ trait MockAccountData $recurring_invoice->save(); $recurring_invoice = InvoiceToRecurringInvoiceFactory::create($this->invoice); + $recurring_invoice->user_id = $user_id; $recurring_invoice->next_send_date = Carbon::now()->addDays(10); $recurring_invoice->status_id = RecurringInvoice::STATUS_ACTIVE; $recurring_invoice->remaining_cycles = 2;