1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

Small fix for new PDF generator

This commit is contained in:
David Bomba 2021-03-18 20:57:55 +11:00
parent bbcc06f22c
commit ac6feb706e
4 changed files with 20 additions and 11 deletions

View File

@ -18,6 +18,7 @@ use App\Models\Invoice;
use App\Models\InvoiceInvitation;
use App\Services\PdfMaker\Design;
use App\Services\PdfMaker\PdfMaker;
use App\Utils\HostedPDF\NinjaPdf;
use App\Utils\HtmlEngine;
use App\Utils\Ninja;
use App\Utils\PhantomJS\Phantom;
@ -134,6 +135,10 @@ class PreviewController extends BaseController
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
}
if(config('ninja.invoiceninja_hosted_pdf_generation')){
return (new NinjaPdf())->build($maker->getCompiledHTML(true));
}
//else
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
@ -217,6 +222,10 @@ class PreviewController extends BaseController
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
}
if(config('ninja.invoiceninja_hosted_pdf_generation')){
return (new NinjaPdf())->build($maker->getCompiledHTML(true));
}
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
DB::rollBack();

View File

@ -241,7 +241,7 @@ class BaseDriver extends AbstractPaymentDriver
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
BillingSubscriptionService::completePurchase($this->payment_hash);
(new BillingSubscriptionService)->completePurchase($this->payment_hash);
return $payment->service()->applyNumber()->save();
}

View File

@ -32,11 +32,17 @@ class BillingSubscriptionService
public function completePurchase(PaymentHash $payment_hash)
{
if (!property_exists($payment_hash, 'billing_context')) {
return;
}
// At this point we have some state carried from the billing page
// to this, available as $payment_hash->data->billing_context. Make something awesome ⭐
// create client subscription record
//
// create recurring invoice if is_recurring
//
// s
}
@ -53,7 +59,6 @@ class BillingSubscriptionService
$data['line_items'] = $this->createLineItems($data['quantity']);
/*
If trial_enabled -> return early
-- what we need to know that we don't already
@ -118,13 +123,5 @@ class BillingSubscriptionService
//scan for any notification we are required to send
}
public static function completePurchase(PaymentHash $payment_hash)
{
if (!property_exists($payment_hash, 'billing_context')) {
return;
}
// At this point we have some state carried from the billing page
// to this, available as $payment_hash->data->billing_context. Make something awesome ⭐
}
}

View File

@ -21,6 +21,9 @@ class NinjaPdf
public function build($html)
{
nlog("building remotely");
$client = new \GuzzleHttp\Client(['headers' =>
[
'X-Ninja-Token' => 'test_token_for_now',