diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index c9031daaeae0..a85229956014 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -256,13 +256,13 @@ class BaseDriver extends AbstractPaymentDriver $this->payment_hash->payment_id = $payment->id; $this->payment_hash->save(); + $this->attachInvoices($payment, $this->payment_hash); + if($this->payment_hash->credits_total() > 0) $payment = $payment->service()->applyCredits($this->payment_hash)->save(); $payment->service()->updateInvoicePayment($this->payment_hash); - $this->attachInvoices($payment, $this->payment_hash); - event('eloquent.created: App\Models\Payment', $payment); if ($this->client->getSetting('client_online_payment_notification') && in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING])) diff --git a/app/Services/Invoice/TriggeredActions.php b/app/Services/Invoice/TriggeredActions.php index b2f2ee395b53..f9b19f4b1b5c 100644 --- a/app/Services/Invoice/TriggeredActions.php +++ b/app/Services/Invoice/TriggeredActions.php @@ -49,6 +49,7 @@ class TriggeredActions extends AbstractService } if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') { + $this->invoice->service()->touchPdf()->save(); $this->sendEmail(); }