1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00

Merge pull request #5173 from turbo124/v5-stable

small fix for PDF generator
This commit is contained in:
David Bomba 2021-03-18 20:58:56 +11:00 committed by GitHub
commit 544da36f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
@ -133,6 +134,10 @@ class PreviewController extends BaseController
if (config('ninja.phantomjs_pdf_generation')) {
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());
@ -216,6 +221,10 @@ class PreviewController extends BaseController
if (config('ninja.phantomjs_pdf_generation')) {
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());

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',