1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Config |
4
|
|
|
* |
5
|
|
|
* @author Pronamic <[email protected]> |
6
|
|
|
* @copyright 2005-2020 Pronamic |
7
|
|
|
* @license GPL-3.0-or-later |
8
|
|
|
* @package Pronamic\WordPress\Pay\Gateways\Adyen |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Adyen; |
12
|
|
|
|
13
|
|
|
use Pronamic\WordPress\Pay\Core\Gateway as Core_Gateway; |
14
|
|
|
use Pronamic\WordPress\Pay\Core\GatewayConfig; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Config |
18
|
|
|
* |
19
|
|
|
* @author Remco Tolsma |
20
|
|
|
* @version 1.1.1 |
21
|
|
|
* @since 1.0.0 |
22
|
|
|
*/ |
23
|
|
|
class Config extends GatewayConfig { |
24
|
|
|
/** |
25
|
|
|
* API Key. |
26
|
|
|
* |
27
|
|
|
* @var string|null |
28
|
|
|
*/ |
29
|
|
|
public $api_key; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* API Live URL Prefix. |
33
|
|
|
* |
34
|
|
|
* @var string|null |
35
|
|
|
*/ |
36
|
|
|
public $api_live_url_prefix; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Merchant Account. |
40
|
|
|
* |
41
|
|
|
* @var string|null |
42
|
|
|
*/ |
43
|
|
|
public $merchant_account; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Merchant Order Reference. |
47
|
|
|
* |
48
|
|
|
* @var string|null |
49
|
|
|
*/ |
50
|
|
|
public $merchant_order_reference; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Origin key. |
54
|
|
|
* |
55
|
|
|
* @var string|null |
56
|
|
|
*/ |
57
|
|
|
public $origin_key; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Apple Pay merchant identifier. |
61
|
|
|
* |
62
|
|
|
* @var string|null |
63
|
|
|
*/ |
64
|
|
|
public $apple_pay_merchant_id; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Apple Pay merchant identity certificate. |
68
|
|
|
* |
69
|
|
|
* @var string|null |
70
|
|
|
*/ |
71
|
|
|
public $apple_pay_merchant_id_certificate; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Apple Pay merchant identity private key. |
75
|
|
|
* |
76
|
|
|
* @var string|null |
77
|
|
|
*/ |
78
|
|
|
public $apple_pay_merchant_id_private_key; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Apple Pay merchant identity private key password. |
82
|
|
|
* |
83
|
|
|
* @var string|null |
84
|
|
|
*/ |
85
|
|
|
public $apple_pay_merchant_id_private_key_password; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Google Pay merchant identifier. |
89
|
|
|
* |
90
|
|
|
* @var string|null |
91
|
|
|
*/ |
92
|
|
|
public $google_pay_merchant_identifier; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Get API key. |
96
|
|
|
* |
97
|
|
|
* @return string|null |
98
|
|
|
*/ |
99
|
11 |
|
public function get_api_key() { |
100
|
11 |
|
return $this->api_key; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Get merchant account. |
105
|
|
|
* |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
1 |
|
public function get_merchant_account() { |
109
|
1 |
|
return strval( $this->merchant_account ); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Get merchant order reference. |
114
|
|
|
* |
115
|
|
|
* @return string |
116
|
|
|
*/ |
117
|
|
|
public function get_merchant_order_reference() { |
118
|
|
|
return strval( $this->merchant_order_reference ); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Get Apple Pay merchant identifier. |
123
|
|
|
* |
124
|
|
|
* @return string|null |
125
|
|
|
*/ |
126
|
|
|
public function get_apple_pay_merchant_id() { |
127
|
|
|
return $this->apple_pay_merchant_id; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Get Apple Pay merchant identity certificate. |
132
|
|
|
* |
133
|
|
|
* @return string|null |
134
|
|
|
*/ |
135
|
|
|
public function get_apple_pay_merchant_id_certificate() { |
136
|
|
|
return $this->apple_pay_merchant_id_certificate; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Get Apple Pay merchant identity private key. |
141
|
|
|
* |
142
|
|
|
* @return string|null |
143
|
|
|
*/ |
144
|
|
|
public function get_apple_pay_merchant_id_private_key() { |
145
|
|
|
return $this->apple_pay_merchant_id_private_key; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Get Apple Pay merchant identity private key password. |
150
|
|
|
* |
151
|
|
|
* @return string|null |
152
|
|
|
*/ |
153
|
|
|
public function get_apple_pay_merchant_id_private_key_password() { |
154
|
|
|
return $this->apple_pay_merchant_id_private_key_password; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Get Google Pay merchant identifier. |
159
|
|
|
* |
160
|
|
|
* @return string|null |
161
|
|
|
*/ |
162
|
|
|
public function get_google_pay_merchant_identifier() { |
163
|
|
|
return $this->google_pay_merchant_identifier; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Get API URL. |
168
|
|
|
* |
169
|
|
|
* @param string $method API method. |
170
|
|
|
* @return string |
171
|
|
|
* @throws \Exception Throws exception when mode is live and API live URL prefix is empty. |
172
|
|
|
*/ |
173
|
12 |
|
public function get_api_url( $method ) { |
174
|
12 |
|
if ( Core_Gateway::MODE_TEST === $this->mode ) { |
175
|
11 |
|
return sprintf( Endpoint::API_URL_TEST, $method ); |
176
|
|
|
} |
177
|
|
|
|
178
|
2 |
|
if ( empty( $this->api_live_url_prefix ) ) { |
179
|
1 |
|
throw new \Exception( 'Adyen API Live URL prefix is required for live configurations.' ); |
180
|
|
|
} |
181
|
|
|
|
182
|
1 |
|
return sprintf( Endpoint::API_URL_LIVE, $this->api_live_url_prefix, $method ); |
183
|
|
|
} |
184
|
|
|
} |
185
|
|
|
|