1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #6882 from turbo124/v5-develop

Minor fixes
This commit is contained in:
David Bomba 2021-10-22 20:57:31 +11:00 committed by GitHub
commit d807d51f67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 9 deletions

View File

@ -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]);

View File

@ -70,7 +70,10 @@ class InstantPayment
$invoices = Invoice::whereIn('id', $this->transformKeys($payable_invoices->pluck('invoice_id')->toArray()))->withTrashed()->get();
$invoices->each(function($invoice){
$invoice->service()->removeUnpaidGatewayFees()->save();
$invoice->service()
->markSent()
->removeUnpaidGatewayFees()
->save();
});
/* pop non payable invoice from the $payable_invoices array */

View File

@ -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();

View File

@ -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);

View File

@ -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.