-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add downloadable attachment option (as mentioned in the changelog per…
… 2023-07-27) for the entities: - estimates - external sales invoice - sales invoice - document: general document - document: general journal document - document: purchase invoice - document: receipt - document: typeless document
- Loading branch information
1 parent
edafecc
commit daef42f
Showing
17 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/EstimateAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class EstimateAttachment. | ||
*/ | ||
class EstimateAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'estimates'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/ExternalSalesInvoiceAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class ExternalSalesInvoiceAttachment. | ||
*/ | ||
class ExternalSalesInvoiceAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'external_sales_invoices'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/GeneralDocumentAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class GeneralDocumentAttachment. | ||
*/ | ||
class GeneralDocumentAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'documents/general_documents'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/GeneralJournalDocumentAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class GeneralJournalDocumentAttachment. | ||
*/ | ||
class GeneralJournalDocumentAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'documents/general_journal_documents'; | ||
} |
46 changes: 46 additions & 0 deletions
46
src/Picqer/Financials/Moneybird/Entities/Generic/Attachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities\Generic; | ||
|
||
use Picqer\Financials\Moneybird\Model; | ||
|
||
/** | ||
* Class InvoiceDetail. | ||
*/ | ||
abstract class Attachment extends Model | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $attachmentPath = 'attachments'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'id', | ||
'administration_id', | ||
'attachable_id', | ||
'attachable_type', | ||
'filename', | ||
'content_type', | ||
'size', | ||
'rotation', | ||
'created_at', | ||
'updated_at', | ||
]; | ||
|
||
/** | ||
* Download the file. | ||
* | ||
* @return string file data | ||
* | ||
* @throws \Picqer\Financials\Moneybird\Exceptions\ApiException | ||
*/ | ||
public function download() | ||
{ | ||
$response = $this->connection()->download($this->getEndpoint() . '/' . urlencode($this->attachable_id) . '/' . $this->attachmentPath . '/' . urlencode($this->id) . '/download'); | ||
|
||
return $response->getBody()->getContents(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/PurchaseInvoiceAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class SalesInvoiceAttachment. | ||
*/ | ||
class PurchaseInvoiceAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'documents/purchase_invoices'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/ReceiptAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class ReceiptAttachment. | ||
*/ | ||
class ReceiptAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'documents/receipts'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/SalesInvoiceAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class SalesInvoiceAttachment. | ||
*/ | ||
class SalesInvoiceAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'sales_invoices'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Picqer/Financials/Moneybird/Entities/TypelessDocumentAttachment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Picqer\Financials\Moneybird\Entities; | ||
|
||
use Picqer\Financials\Moneybird\Entities\Generic\Attachment; | ||
|
||
/** | ||
* Class TypelessDocumentAttachment. | ||
*/ | ||
class TypelessDocumentAttachment extends Attachment | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint = 'documents/typeless_documents'; | ||
} |