|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ipag; |
|
4
|
|
|
|
|
5
|
|
|
use Ipag\Classes\Authentication; |
|
6
|
|
|
use Ipag\Classes\Endpoint; |
|
7
|
|
|
|
|
8
|
|
|
class Ipag |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @var Endpoint |
|
12
|
|
|
*/ |
|
13
|
|
|
private $endpoint; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @var Authentication |
|
17
|
|
|
*/ |
|
18
|
|
|
private $authentication; |
|
19
|
|
|
|
|
20
|
|
|
public function __construct(Authentication $authentication, $url = null) |
|
21
|
|
|
{ |
|
22
|
|
|
$this->authentication = $authentication; |
|
23
|
|
|
$this->endpoint = new Classes\Endpoint($url); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function transaction() |
|
27
|
|
|
{ |
|
28
|
|
|
return new Classes\Transaction($this); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function order() |
|
32
|
|
|
{ |
|
33
|
|
|
return new Classes\Order(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function customer() |
|
37
|
|
|
{ |
|
38
|
|
|
return new Classes\Customer(); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function creditCard() |
|
42
|
|
|
{ |
|
43
|
|
|
return new Classes\CreditCard(); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function address() |
|
47
|
|
|
{ |
|
48
|
|
|
return new Classes\Address(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function cart(array...$products) |
|
52
|
|
|
{ |
|
53
|
|
|
return new Classes\Cart(...$products); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function product() |
|
57
|
|
|
{ |
|
58
|
|
|
return new Classes\Product(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function payment() |
|
62
|
|
|
{ |
|
63
|
|
|
return new Classes\Payment(); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function subscription() |
|
67
|
|
|
{ |
|
68
|
|
|
return new Classes\Subscription(); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function splitRule() |
|
72
|
|
|
{ |
|
73
|
|
|
return new Classes\SplitRule(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @return Authentication |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getAuthentication() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->authentication; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @param Authentication $authentication |
|
86
|
|
|
*/ |
|
87
|
|
|
public function setAuthentication(Authentication $authentication) |
|
88
|
|
|
{ |
|
89
|
|
|
$this->authentication = $authentication; |
|
90
|
|
|
|
|
91
|
|
|
return $this; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return Endpoint |
|
96
|
|
|
*/ |
|
97
|
|
|
public function getEndpoint() |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->endpoint; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @param Endpoint $endpoint |
|
104
|
|
|
*/ |
|
105
|
|
|
public function setEndpoint(Endpoint $endpoint) |
|
106
|
|
|
{ |
|
107
|
|
|
$this->endpoint = $endpoint; |
|
108
|
|
|
|
|
109
|
|
|
return $this; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|