2021-03-18 01:53:08 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2024-04-12 06:15:41 +02:00
|
|
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
2021-03-18 01:53:08 +01:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2021-03-18 01:53:08 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Utils\HostedPDF;
|
|
|
|
|
|
|
|
use GuzzleHttp\RequestOptions;
|
|
|
|
|
|
|
|
class NinjaPdf
|
|
|
|
{
|
|
|
|
private $url = 'https://pdf.invoicing.co/api/';
|
|
|
|
|
|
|
|
public function build($html)
|
|
|
|
{
|
2022-06-21 11:57:17 +02:00
|
|
|
$client = new \GuzzleHttp\Client(['headers' => [
|
|
|
|
'X-Ninja-Token' => 'test_token_for_now',
|
2024-10-02 04:46:30 +02:00
|
|
|
'X-URL' => config('ninja.app_url'),
|
|
|
|
],
|
2021-03-18 01:53:08 +01:00
|
|
|
]);
|
|
|
|
|
2022-06-21 11:57:17 +02:00
|
|
|
$response = $client->post($this->url, [
|
|
|
|
RequestOptions::JSON => ['html' => $html],
|
2021-03-18 01:53:08 +01:00
|
|
|
]);
|
2022-06-21 11:57:17 +02:00
|
|
|
|
2024-10-02 04:46:30 +02:00
|
|
|
|
2022-11-28 02:16:58 +01:00
|
|
|
return $response->getBody()->getContents();
|
2021-03-18 01:53:08 +01:00
|
|
|
}
|
2024-10-02 04:46:30 +02:00
|
|
|
|
2021-03-18 01:53:08 +01:00
|
|
|
}
|
2024-10-02 04:46:30 +02:00
|
|
|
|