mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 12:42:36 +01:00
Label credits created by deleting payments
This commit is contained in:
parent
018960105b
commit
7c4d0a2af5
@ -41,27 +41,7 @@ class CreditListener
|
||||
$credit->client_id = $payment->client_id;
|
||||
$credit->credit_date = Carbon::now()->toDateTimeString();
|
||||
$credit->balance = $credit->amount = $payment->getCompletedAmount();
|
||||
$credit->private_notes = $payment->transaction_reference;
|
||||
$credit->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentWasRefunded $event
|
||||
*/
|
||||
public function refundedPayment(PaymentWasRefunded $event)
|
||||
{
|
||||
$payment = $event->payment;
|
||||
|
||||
// if the payment was from a credit we need to refund the credit
|
||||
if ($payment->payment_type_id != PAYMENT_TYPE_CREDIT) {
|
||||
return;
|
||||
}
|
||||
|
||||
$credit = Credit::createNew();
|
||||
$credit->client_id = $payment->client_id;
|
||||
$credit->credit_date = Carbon::now()->toDateTimeString();
|
||||
$credit->balance = $credit->amount = $event->refundAmount;
|
||||
$credit->private_notes = $payment->transaction_reference;
|
||||
$credit->private_notes = trans('texts.refunded_credit_payment');
|
||||
$credit->save();
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,6 @@ class EventServiceProvider extends ServiceProvider {
|
||||
'App\Events\PaymentWasRefunded' => [
|
||||
'App\Listeners\ActivityListener@refundedPayment',
|
||||
'App\Listeners\InvoiceListener@refundedPayment',
|
||||
'App\Listeners\CreditListener@refundedPayment',
|
||||
],
|
||||
'App\Events\PaymentWasVoided' => [
|
||||
'App\Listeners\ActivityListener@voidedPayment',
|
||||
|
@ -2258,6 +2258,7 @@ $LANG = array(
|
||||
'redirect_url' => 'Redirect URL',
|
||||
'redirect_url_help' => 'Optionally specify a URL to redirect to after a payment is made entered.',
|
||||
'save_draft' => 'Save Draft',
|
||||
'refunded_credit_payment' => 'Refunded credit payment',
|
||||
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user