mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Minor fixes for subscriptions
This commit is contained in:
parent
b915cc32c3
commit
b92f16bfe5
@ -39,7 +39,6 @@ class NinjaPlanController extends Controller
|
||||
else
|
||||
$account = $company->account;
|
||||
|
||||
|
||||
if (MultiDB::findAndSetDbByContactKey($contact_key) && $client_contact = ClientContact::where('contact_key', $contact_key)->first())
|
||||
{
|
||||
|
||||
@ -49,7 +48,7 @@ class NinjaPlanController extends Controller
|
||||
|
||||
/* Current paid users get pushed straight to subscription overview page*/
|
||||
if($account->isPaidHostedClient())
|
||||
return redirect('/client/subscriptions');
|
||||
return redirect('/client/dashboard');
|
||||
|
||||
/* Users that are not paid get pushed to a custom purchase page */
|
||||
return $this->render('subscriptions.ninja_plan', ['settings' => $client_contact->company->settings]);
|
||||
|
@ -51,7 +51,7 @@ class PaymentType extends StaticModel
|
||||
const PRZELEWY24 = 40;
|
||||
const EPS = 41;
|
||||
const DIRECT_DEBIT = 42;
|
||||
` const BECS = 43;
|
||||
const BECS = 43;
|
||||
const ACSS = 44;
|
||||
|
||||
public static function parseCardType($cardName)
|
||||
|
@ -39,7 +39,7 @@ class MarkPaid extends AbstractService
|
||||
public function run()
|
||||
{
|
||||
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
||||
$this->invoice->service()->markSent();
|
||||
$this->invoice->service()->markSent()->save();
|
||||
}
|
||||
|
||||
/*Don't double pay*/
|
||||
@ -77,14 +77,16 @@ class MarkPaid extends AbstractService
|
||||
|
||||
$this->invoice->next_send_date = null;
|
||||
|
||||
$this->invoice->service()
|
||||
$this->invoice
|
||||
->service()
|
||||
->setExchangeRate()
|
||||
->updateBalance($payment->amount * -1)
|
||||
->updatePaidToDate($payment->amount)
|
||||
->setStatus(Invoice::STATUS_PAID)
|
||||
->save();
|
||||
|
||||
$this->invoice->service()
|
||||
$this->invoice
|
||||
->service()
|
||||
->applyNumber()
|
||||
->deletePdf()
|
||||
->save();
|
||||
|
@ -223,6 +223,7 @@ class SubscriptionService
|
||||
->first();
|
||||
|
||||
}
|
||||
|
||||
if ($outstanding->count() == 0){
|
||||
//nothing outstanding
|
||||
return $target->price - $this->calculateProRataRefundForSubscription($outstanding_invoice);
|
||||
@ -426,7 +427,9 @@ class SubscriptionService
|
||||
|
||||
nlog("total payable = {$total_payable}");
|
||||
|
||||
$credit = $this->createCredit($last_invoice, $target_subscription, $is_credit);
|
||||
/* Only generate a credit if the previous invoice was paid in full. */
|
||||
if($last_invoice->balance == 0)
|
||||
$credit = $this->createCredit($last_invoice, $target_subscription, $is_credit);
|
||||
|
||||
$new_recurring_invoice = $this->createNewRecurringInvoice($recurring_invoice);
|
||||
|
||||
@ -575,7 +578,7 @@ class SubscriptionService
|
||||
$old_recurring_invoice->service()->stop()->save();
|
||||
|
||||
$recurring_invoice_repo = new RecurringInvoiceRepository();
|
||||
$recurring_invoice_repo->archive($old_recurring_invoice);
|
||||
$recurring_invoice_repo->delete($old_recurring_invoice);
|
||||
|
||||
$recurring_invoice = $this->convertInvoiceToRecurring($old_recurring_invoice->client_id);
|
||||
$recurring_invoice = $recurring_invoice_repo->save([], $recurring_invoice);
|
||||
|
@ -6,7 +6,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddStripePaymentsToPaymentTypes extends Migration
|
||||
class StripePaymentGateways extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
Loading…
x
Reference in New Issue
Block a user