Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

Commit 8d6fcd3

Browse files
committed
Helper methods for PDF attachments. Methods to get the existing attachment and to upload a new attachment.
1 parent 536739a commit 8d6fcd3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Billogram/Api/Objects/BillogramObject.php

+27
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,31 @@ public function getInvoicePdf($letterId = null, $invoiceNo = null)
198198

199199
return base64_decode($response->data->content);
200200
}
201+
202+
/**
203+
* Returns the PDF-file content for the billogram's attachment.
204+
*
205+
**/
206+
public function getAttachmentPdf()
207+
{
208+
$response = $this->api->get(
209+
$this->url() . '/attachment.pdf',
210+
null,
211+
'application/json'
212+
);
213+
214+
return base64_decode($response->data->content);
215+
}
216+
217+
/**
218+
* Attach a PDF to the billogram.
219+
*
220+
**/
221+
public function attachPdf($filepath)
222+
{
223+
$content = file_get_contents($filepath);
224+
$filename = basename($filepath);
225+
226+
return $this->performEvent('attach', array('filename' => $filename, 'content' => base64_encode('asdf')));
227+
}
201228
}

0 commit comments

Comments
 (0)