mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Track payment ID with Activity 54
This commit is contained in:
parent
45cc39a3f1
commit
8e06644fac
@ -13,6 +13,7 @@ namespace App\Events\Invoice;
|
|||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\Payment;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,6 +28,8 @@ class InvoiceWasPaid
|
|||||||
*/
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
|
public $payment;
|
||||||
|
|
||||||
public $company;
|
public $company;
|
||||||
|
|
||||||
public $event_vars;
|
public $event_vars;
|
||||||
@ -38,9 +41,10 @@ class InvoiceWasPaid
|
|||||||
* @param Company $company
|
* @param Company $company
|
||||||
* @param array $event_vars
|
* @param array $event_vars
|
||||||
*/
|
*/
|
||||||
public function __construct(Invoice $invoice, Company $company, array $event_vars)
|
public function __construct(Invoice $invoice, Payment $payment, Company $company, array $event_vars)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
|
$this->payment = $payment;
|
||||||
$this->company = $company;
|
$this->company = $company;
|
||||||
$this->event_vars = $event_vars;
|
$this->event_vars = $event_vars;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,8 @@ class InvoicePaidActivity implements ShouldQueue
|
|||||||
$fields->user_id = $event->invoice->user_id;
|
$fields->user_id = $event->invoice->user_id;
|
||||||
$fields->company_id = $event->invoice->company_id;
|
$fields->company_id = $event->invoice->company_id;
|
||||||
$fields->activity_type_id = Activity::PAID_INVOICE;
|
$fields->activity_type_id = Activity::PAID_INVOICE;
|
||||||
|
$fields->payment_id = $event->payment->id;
|
||||||
|
|
||||||
$this->activity_repo->save($fields, $event->invoice, $event->event_vars);
|
$this->activity_repo->save($fields, $event->invoice, $event->event_vars);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -187,7 +187,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$payment->invoices()->sync($invoices);
|
$payment->invoices()->sync($invoices);
|
||||||
|
|
||||||
$invoices->each(function ($invoice) use ($payment) {
|
$invoices->each(function ($invoice) use ($payment) {
|
||||||
event(new InvoiceWasPaid($invoice, $payment->company, Ninja::eventVars()));
|
event(new InvoiceWasPaid($invoice, $payment, $payment->company, Ninja::eventVars()));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $payment->service()->applyNumber()->save();
|
return $payment->service()->applyNumber()->save();
|
||||||
|
@ -148,7 +148,7 @@ class ApplyPayment
|
|||||||
|
|
||||||
if ((int)$this->invoice->balance == 0) {
|
if ((int)$this->invoice->balance == 0) {
|
||||||
$this->invoice->service()->deletePdf();
|
$this->invoice->service()->deletePdf();
|
||||||
event(new InvoiceWasPaid($this->invoice, $this->payment->company, Ninja::eventVars()));
|
event(new InvoiceWasPaid($this->invoice, $payment, $this->payment->company, Ninja::eventVars()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class MarkPaid extends AbstractService
|
|||||||
|
|
||||||
/* Update Invoice balance */
|
/* Update Invoice balance */
|
||||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||||
event(new InvoiceWasPaid($this->invoice, $payment->company, Ninja::eventVars()));
|
event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
->updatePaymentBalance($payment->amount * -1);
|
->updatePaymentBalance($payment->amount * -1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user