|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PeterIcebear\Mollie; |
|
4
|
|
|
|
|
5
|
|
|
class MollieApiClientManager |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* The application instance. |
|
9
|
|
|
* |
|
10
|
|
|
* @var \Illuminate\Foundation\Application |
|
11
|
|
|
*/ |
|
12
|
|
|
protected $app; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* The default settings. |
|
16
|
|
|
*/ |
|
17
|
|
|
protected $config; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Create a new Mollie instance. |
|
21
|
|
|
* |
|
22
|
|
|
* @param \Illuminate\Foundation\Application $app |
|
23
|
|
|
* @param array $config |
|
24
|
|
|
*/ |
|
25
|
51 |
|
public function __construct($app, $config = []) |
|
26
|
|
|
{ |
|
27
|
51 |
|
$this->app = $app; |
|
28
|
51 |
|
$this->config = $config; |
|
29
|
51 |
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @throws \Mollie_API_Exception |
|
33
|
|
|
* |
|
34
|
|
|
* @return \Mollie_API_Client |
|
35
|
|
|
*/ |
|
36
|
30 |
|
public function client() |
|
37
|
|
|
{ |
|
38
|
30 |
|
$mollie = new \Mollie_API_Client(); |
|
39
|
|
|
|
|
40
|
30 |
|
if ($this->config['test_mode']) { |
|
41
|
27 |
|
$mollie->setApiKey($this->config['api_keys']['test']); |
|
42
|
|
|
} else { |
|
43
|
3 |
|
$mollie->setApiKey($this->config['api_keys']['live']); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
30 |
|
return $mollie; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return \Mollie_API_Resource_Payments |
|
51
|
|
|
*/ |
|
52
|
3 |
|
public function getPayments() |
|
53
|
|
|
{ |
|
54
|
3 |
|
return $this->client()->payments; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return \Mollie_API_Resource_Payments_Refunds |
|
59
|
|
|
*/ |
|
60
|
3 |
|
public function getPaymentsRefunds() |
|
61
|
|
|
{ |
|
62
|
3 |
|
return $this->client()->payments_refunds; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return \Mollie_API_Resource_Issuers |
|
67
|
|
|
*/ |
|
68
|
3 |
|
public function getIssuers() |
|
69
|
|
|
{ |
|
70
|
3 |
|
return $this->client()->issuers; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @return \Mollie_API_Resource_Methods |
|
75
|
|
|
*/ |
|
76
|
3 |
|
public function getMethods() |
|
77
|
|
|
{ |
|
78
|
3 |
|
return $this->client()->methods; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @return \Mollie_API_Resource_Customers |
|
83
|
|
|
*/ |
|
84
|
3 |
|
public function getCustomers() |
|
85
|
|
|
{ |
|
86
|
3 |
|
return $this->client()->customers; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @return \Mollie_API_Resource_Customers_Payments |
|
91
|
|
|
*/ |
|
92
|
3 |
|
public function getCustomersPayments() |
|
93
|
|
|
{ |
|
94
|
3 |
|
return $this->client()->customers_payments; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @return \Mollie_API_Resource_Customers_Mandates |
|
99
|
|
|
*/ |
|
100
|
3 |
|
public function getCustomersMandates() |
|
101
|
|
|
{ |
|
102
|
3 |
|
return $this->client()->customers_mandates; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @return \Mollie_API_Resource_Customers_Subscriptions |
|
107
|
|
|
*/ |
|
108
|
3 |
|
public function getCustomersSubscriptions() |
|
109
|
|
|
{ |
|
110
|
3 |
|
return $this->client()->customers_subscriptions; |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|