diff --git a/VERSION.txt b/VERSION.txt index b812bb222390..40508d90a485 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.1.26 \ No newline at end of file +5.1.27 \ No newline at end of file diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 8cd0a3bc9221..88e4997212dc 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -1,4 +1,13 @@ $this->contact->client->id, 'date' => now()->format('Y-m-d'), @@ -142,6 +152,7 @@ class BillingPortalPurchase extends Component $this->emit('beforePaymentEventsCompleted'); } + //this isn't managed here - this is taken care of in the BS public function applyCouponCode() { dd('Applying coupon code: ' . $this->coupon); diff --git a/app/Jobs/Entity/CreateEntityPdf.php b/app/Jobs/Entity/CreateEntityPdf.php index 03886ce5e402..edaa6776ea8b 100644 --- a/app/Jobs/Entity/CreateEntityPdf.php +++ b/app/Jobs/Entity/CreateEntityPdf.php @@ -25,6 +25,7 @@ use App\Models\RecurringInvoiceInvitation; use App\Services\PdfMaker\Design as PdfDesignModel; use App\Services\PdfMaker\Design as PdfMakerDesign; use App\Services\PdfMaker\PdfMaker as PdfMakerService; +use App\Utils\HostedPDF\NinjaPdf; use App\Utils\HtmlEngine; use App\Utils\Ninja; use App\Utils\PhantomJS\Phantom; @@ -160,7 +161,13 @@ class CreateEntityPdf implements ShouldQueue $pdf = null; try { - $pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true)); + + if(config('ninja.invoiceninja_hosted_pdf_generation')){ + $pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true)); + } + else { + $pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true)); + } } catch (\Exception $e) { nlog(print_r($e->getMessage(), 1)); } diff --git a/app/Services/BillingSubscription/BillingSubscriptionService.php b/app/Services/BillingSubscription/BillingSubscriptionService.php index df74d59b7b5b..d93f65f41da2 100644 --- a/app/Services/BillingSubscription/BillingSubscriptionService.php +++ b/app/Services/BillingSubscription/BillingSubscriptionService.php @@ -29,18 +29,27 @@ class BillingSubscriptionService $this->billing_subscription = $billing_subscription; } + public function completePurchase(PaymentHash $payment_hash) + { + + // create client subscription record + // + // create recurring invoice if is_recurring + // + // s + + + } + + public function startTrial(array $data) + { + + } + public function createInvoice($data): ?\App\Models\Invoice { $invoice_repo = new InvoiceRepository(); - // $data = [ - // 'client_id' =>, - // 'date' => Y-m-d, - // 'invitations' => [ - // 'client_contact_id' => hashed_id - // ], - // 'line_items' => [], - // ]; $data['line_items'] = $this->createLineItems($data['quantity']); /* diff --git a/app/Utils/HostedPDF/NinjaPdf.php b/app/Utils/HostedPDF/NinjaPdf.php new file mode 100644 index 000000000000..f0137fd459a1 --- /dev/null +++ b/app/Utils/HostedPDF/NinjaPdf.php @@ -0,0 +1,37 @@ + + [ + 'X-Ninja-Token' => 'test_token_for_now', + ] + ]); + + $response = $client->post($this->url,[ + RequestOptions::JSON => ['html' => $html] + ]); + + return $response->getBody(); + } + +} diff --git a/config/ninja.php b/config/ninja.php index 6e53977e9565..41fba0ff0de1 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -13,7 +13,7 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', ''), - 'app_version' => '5.1.26', + 'app_version' => '5.1.27', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false), @@ -144,4 +144,5 @@ return [ 'flutter_canvas_kit' => env('FLUTTER_CANVAS_KIT', false), 'webcron_secret' => env('WEBCRON_SECRET', false), 'disable_auto_update' => env('DISABLE_AUTO_UPDATE', false), + 'invoiceninja_hosted_pdf_generation' => env('NINJA_HOSTED_PDF', false), ];