Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Subscriptions support #260

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/Picqer/Financials/Moneybird/Entities/Subscription.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Picqer\Financials\Moneybird\Entities;

use Picqer\Financials\Moneybird\Actions\Filterable;
use Picqer\Financials\Moneybird\Actions\FindAll;
use Picqer\Financials\Moneybird\Actions\FindOne;
use Picqer\Financials\Moneybird\Actions\Removable;
use Picqer\Financials\Moneybird\Actions\Storable;
use Picqer\Financials\Moneybird\Model;

/**
* Class Subscription.
*
* @property string $id
*/
class Subscription extends Model
{
use FindAll, FindOne, Storable, Removable, Filterable;

/**
* @var array
*/
protected $fillable = [
'id',
'start_date',
'product_id',
'contact_id',
'end_date',
'reference',
'document_style_id',
'frequency',
'frequency_type',
];

/**
* @var string
*/
protected $endpoint = 'subscriptions';

/**
* @var string
*/
protected $namespace = 'subscription';
}
10 changes: 10 additions & 0 deletions src/Picqer/Financials/Moneybird/Moneybird.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Picqer\Financials\Moneybird\Entities\SalesInvoiceDetail;
use Picqer\Financials\Moneybird\Entities\SalesInvoicePayment;
use Picqer\Financials\Moneybird\Entities\SalesInvoiceReminder;
use Picqer\Financials\Moneybird\Entities\Subscription;
use Picqer\Financials\Moneybird\Entities\TaxRate;
use Picqer\Financials\Moneybird\Entities\TimeEntry;
use Picqer\Financials\Moneybird\Entities\TypelessDocument;
Expand Down Expand Up @@ -444,4 +445,13 @@ public function workflow($attributes = [])
{
return new Workflow($this->connection, $attributes);
}

/**
* @param array $attributes
* @return \Picqer\Financials\Moneybird\Entities\Subscription
*/
public function subscription($attributes = [])
{
return new Subscription($this->connection, $attributes);
}
}