mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 02:34:35 -04:00
Set credit payments for subscriptions
This commit is contained in:
parent
079889a711
commit
c7fe3c8824
@ -150,11 +150,17 @@ class PaymentController extends Controller
|
|||||||
|
|
||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')));
|
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')));
|
||||||
|
|
||||||
|
$invoices->each(function ($i){
|
||||||
|
$i->is_proforma = false;
|
||||||
|
$i->saveQuietly();
|
||||||
|
});
|
||||||
|
|
||||||
event('eloquent.created: App\Models\Payment', $payment);
|
event('eloquent.created: App\Models\Payment', $payment);
|
||||||
|
|
||||||
if($invoices->sum('balance') > 0){
|
if($invoices->sum('balance') > 0){
|
||||||
|
|
||||||
$invoice = $invoices->first();
|
$invoice = $invoices->first();
|
||||||
|
$invoice->service()->touchPdf(true);
|
||||||
|
|
||||||
return redirect()->route('client.invoice.show', ['invoice' => $invoice->hashed_id, 'hash' => $request->input('hash')]);
|
return redirect()->route('client.invoice.show', ['invoice' => $invoice->hashed_id, 'hash' => $request->input('hash')]);
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ class InvoicesTable extends Component
|
|||||||
$query = Invoice::query()
|
$query = Invoice::query()
|
||||||
->where('company_id', $this->company->id)
|
->where('company_id', $this->company->id)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
|
->where('is_proforma', false)
|
||||||
->with('client.gateway_tokens', 'client.contacts')
|
->with('client.gateway_tokens', 'client.contacts')
|
||||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
|
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ class InstantPayment
|
|||||||
$payment_method_id = $this->request->input('payment_method_id');
|
$payment_method_id = $this->request->input('payment_method_id');
|
||||||
$invoice_totals = $payable_invoices->sum('amount');
|
$invoice_totals = $payable_invoices->sum('amount');
|
||||||
$first_invoice = $invoices->first();
|
$first_invoice = $invoices->first();
|
||||||
$credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'always' ? $first_invoice->client->service()->getCreditBalance() : 0;
|
$credit_totals = in_array($first_invoice->client->getSetting('use_credits_payment'), ['always', 'option']) ? $first_invoice->client->service()->getCreditBalance() : 0;
|
||||||
$starting_invoice_amount = $first_invoice->balance;
|
$starting_invoice_amount = $first_invoice->balance;
|
||||||
|
|
||||||
/* Schedule a job to check the gateway fees for this invoice*/
|
/* Schedule a job to check the gateway fees for this invoice*/
|
||||||
|
@ -271,11 +271,6 @@ class CreditService
|
|||||||
|
|
||||||
public function restoreCredit()
|
public function restoreCredit()
|
||||||
{
|
{
|
||||||
// $this->credit->payments()->each(function ($payment){
|
|
||||||
|
|
||||||
// $payment->pivot->update(['deleted_at' => null]);
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
$this->credit
|
$this->credit
|
||||||
->client
|
->client
|
||||||
|
Loading…
x
Reference in New Issue
Block a user