AddOnGateway.php
952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Braintree;
class AddOnGateway
{
/**
*
* @var Gateway
*/
private $_gateway;
/**
*
* @var Configuration
*/
private $_config;
/**
*
* @var Http
*/
private $_http;
/**
*
* @param Gateway $gateway
*/
public function __construct($gateway)
{
$this->_gateway = $gateway;
$this->_config = $gateway->config;
$this->_config->assertHasAccessTokenOrKeys();
$this->_http = new Http($gateway->config);
}
/**
*
* @return AddOn[]
*/
public function all()
{
$path = $this->_config->merchantPath() . '/add_ons';
$response = $this->_http->get($path);
$addOns = ["addOn" => $response['addOns']];
return Util::extractAttributeAsArray(
$addOns,
'addOn'
);
}
}
class_alias('Braintree\AddOnGateway', 'Braintree_AddOnGateway');