|
1
|
|
|
<?php |
|
2
|
|
|
namespace Braintree; |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Braintree Gateway module |
|
6
|
|
|
* |
|
7
|
|
|
* @package Braintree |
|
8
|
|
|
* @category Resources |
|
9
|
|
|
* @copyright 2015 Braintree, a division of PayPal, Inc. |
|
10
|
|
|
*/ |
|
11
|
|
|
class Gateway |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* |
|
15
|
|
|
* @var Configuration |
|
16
|
|
|
*/ |
|
17
|
|
|
public $config; |
|
18
|
|
|
|
|
19
|
|
|
public function __construct($config) |
|
20
|
|
|
{ |
|
21
|
|
|
if (is_array($config)) { |
|
22
|
|
|
$config = new Configuration($config); |
|
23
|
|
|
} |
|
24
|
|
|
$this->config = $config; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* |
|
29
|
|
|
* @return AddOnGateway |
|
30
|
|
|
*/ |
|
31
|
|
|
public function addOn() |
|
32
|
|
|
{ |
|
33
|
|
|
return new AddOnGateway($this); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* |
|
38
|
|
|
* @return AddressGateway |
|
39
|
|
|
*/ |
|
40
|
|
|
public function address() |
|
41
|
|
|
{ |
|
42
|
|
|
return new AddressGateway($this); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* |
|
47
|
|
|
* @return ClientTokenGateway |
|
48
|
|
|
*/ |
|
49
|
|
|
public function clientToken() |
|
50
|
|
|
{ |
|
51
|
|
|
return new ClientTokenGateway($this); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* |
|
56
|
|
|
* @return CreditCardGateway |
|
57
|
|
|
*/ |
|
58
|
|
|
public function creditCard() |
|
59
|
|
|
{ |
|
60
|
|
|
return new CreditCardGateway($this); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* |
|
65
|
|
|
* @return CreditCardVerificationGateway |
|
66
|
|
|
*/ |
|
67
|
|
|
public function creditCardVerification() |
|
68
|
|
|
{ |
|
69
|
|
|
return new CreditCardVerificationGateway($this); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* |
|
74
|
|
|
* @return CustomerGateway |
|
75
|
|
|
*/ |
|
76
|
|
|
public function customer() |
|
77
|
|
|
{ |
|
78
|
|
|
return new CustomerGateway($this); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* |
|
83
|
|
|
* @return DiscountGateway |
|
84
|
|
|
*/ |
|
85
|
|
|
public function discount() |
|
86
|
|
|
{ |
|
87
|
|
|
return new DiscountGateway($this); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* |
|
92
|
|
|
* @return MerchantGateway |
|
93
|
|
|
*/ |
|
94
|
|
|
public function merchant() |
|
95
|
|
|
{ |
|
96
|
|
|
return new MerchantGateway($this); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* |
|
101
|
|
|
* @return MerchantAccountGateway |
|
102
|
|
|
*/ |
|
103
|
|
|
public function merchantAccount() |
|
104
|
|
|
{ |
|
105
|
|
|
return new MerchantAccountGateway($this); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* |
|
110
|
|
|
* @return OAuthGateway |
|
111
|
|
|
*/ |
|
112
|
|
|
public function oauth() |
|
113
|
|
|
{ |
|
114
|
|
|
return new OAuthGateway($this); |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* |
|
119
|
|
|
* @return PaymentMethodGateway |
|
120
|
|
|
*/ |
|
121
|
|
|
public function paymentMethod() |
|
122
|
|
|
{ |
|
123
|
|
|
return new PaymentMethodGateway($this); |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* |
|
128
|
|
|
* @return PaymentMethodNonceGateway |
|
129
|
|
|
*/ |
|
130
|
|
|
public function paymentMethodNonce() |
|
131
|
|
|
{ |
|
132
|
|
|
return new PaymentMethodNonceGateway($this); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* |
|
137
|
|
|
* @return PayPalAccountGateway |
|
138
|
|
|
*/ |
|
139
|
|
|
public function payPalAccount() |
|
140
|
|
|
{ |
|
141
|
|
|
return new PayPalAccountGateway($this); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* |
|
146
|
|
|
* @return PlanGateway |
|
147
|
|
|
*/ |
|
148
|
|
|
public function plan() |
|
149
|
|
|
{ |
|
150
|
|
|
return new PlanGateway($this); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* |
|
155
|
|
|
* @return SettlementBatchSummaryGateway |
|
156
|
|
|
*/ |
|
157
|
|
|
public function settlementBatchSummary() |
|
158
|
|
|
{ |
|
159
|
|
|
return new SettlementBatchSummaryGateway($this); |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* |
|
164
|
|
|
* @return SubscriptionGateway |
|
165
|
|
|
*/ |
|
166
|
|
|
public function subscription() |
|
167
|
|
|
{ |
|
168
|
|
|
return new SubscriptionGateway($this); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* |
|
173
|
|
|
* @return TestingGateway |
|
174
|
|
|
*/ |
|
175
|
|
|
public function testing() |
|
176
|
|
|
{ |
|
177
|
|
|
return new TestingGateway($this); |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* |
|
182
|
|
|
* @return TransactionGateway |
|
183
|
|
|
*/ |
|
184
|
|
|
public function transaction() |
|
185
|
|
|
{ |
|
186
|
|
|
return new TransactionGateway($this); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* |
|
191
|
|
|
* @return TransparentRedirectGateway |
|
192
|
|
|
*/ |
|
193
|
|
|
public function transparentRedirect() |
|
194
|
|
|
{ |
|
195
|
|
|
return new TransparentRedirectGateway($this); |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* |
|
200
|
|
|
* @return UsBankAccountGateway |
|
201
|
|
|
*/ |
|
202
|
|
|
public function usBankAccount() |
|
203
|
|
|
{ |
|
204
|
|
|
return new UsBankAccountGateway($this); |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
} |
|
208
|
|
|
class_alias('Braintree\Gateway', 'Braintree_Gateway'); |
|
209
|
|
|
|