1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Fenerum; |
6
|
|
|
|
7
|
|
|
use Fenerum\API\Account; |
8
|
|
|
use Fenerum\API\CashFlow; |
9
|
|
|
use Fenerum\API\Contract; |
10
|
|
|
use Fenerum\API\ContractTier; |
11
|
|
|
use Fenerum\API\DraftInvoiceLines; |
12
|
|
|
use Fenerum\API\Invoice; |
13
|
|
|
use Fenerum\API\InvoiceLine; |
14
|
|
|
use Fenerum\API\PaymentCard; |
15
|
|
|
use Fenerum\API\Plan; |
16
|
|
|
use Fenerum\API\Recipient; |
17
|
|
|
use Fenerum\API\Subscription; |
18
|
|
|
use Fenerum\API\Webhook; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class ApiService. |
22
|
|
|
* @see http://docs.fenerum.com/ |
23
|
|
|
*/ |
24
|
|
|
class ApiService |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var \Fenerum\ApiClient |
28
|
|
|
*/ |
29
|
|
|
protected $client; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* ApiService constructor. |
33
|
|
|
* @param \Fenerum\ApiClient $client |
34
|
|
|
*/ |
35
|
|
|
public function __construct(ApiClient $client) |
36
|
|
|
{ |
37
|
|
|
$this->client = $client; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @return \Fenerum\API\Account |
42
|
|
|
*/ |
43
|
|
|
public function account(): Account |
44
|
|
|
{ |
45
|
|
|
return new Account($this->client); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return \Fenerum\API\CashFlow |
50
|
|
|
*/ |
51
|
|
|
public function cashFlow(): CashFlow |
52
|
|
|
{ |
53
|
|
|
return new CashFlow($this->client); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return \Fenerum\API\Contract |
58
|
|
|
*/ |
59
|
|
|
public function contract(): Contract |
60
|
|
|
{ |
61
|
|
|
return new Contract($this->client); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return \Fenerum\API\ContractTier |
66
|
|
|
*/ |
67
|
|
|
public function contractTier(): ContractTier |
68
|
|
|
{ |
69
|
|
|
return new ContractTier($this->client); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return \Fenerum\API\DraftInvoiceLines |
74
|
|
|
*/ |
75
|
|
|
public function draftInvoiceLine(): DraftInvoiceLines |
76
|
|
|
{ |
77
|
|
|
return new DraftInvoiceLines($this->client); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return \Fenerum\API\Invoice |
82
|
|
|
*/ |
83
|
|
|
public function invoice(): Invoice |
84
|
|
|
{ |
85
|
|
|
return new Invoice($this->client); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return \Fenerum\API\InvoiceLine |
90
|
|
|
*/ |
91
|
|
|
public function invoiceLine(): InvoiceLine |
92
|
|
|
{ |
93
|
|
|
return new InvoiceLine($this->client); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return \Fenerum\API\PaymentCard |
98
|
|
|
*/ |
99
|
|
|
public function paymentCard(): PaymentCard |
100
|
|
|
{ |
101
|
|
|
return new PaymentCard($this->client); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return \Fenerum\API\Plan |
106
|
|
|
*/ |
107
|
|
|
public function plan(): Plan |
108
|
|
|
{ |
109
|
|
|
return new Plan($this->client); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return \Fenerum\API\Recipient |
114
|
|
|
*/ |
115
|
|
|
public function recipient(): Recipient |
116
|
|
|
{ |
117
|
|
|
return new Recipient($this->client); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return \Fenerum\API\Subscription |
122
|
|
|
*/ |
123
|
|
|
public function subscription(): Subscription |
124
|
|
|
{ |
125
|
|
|
return new Subscription($this->client); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return \Fenerum\API\Webhook |
130
|
|
|
*/ |
131
|
|
|
public function webhook(): Webhook |
132
|
|
|
{ |
133
|
|
|
return new Webhook($this->client); |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
|