|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Adyen |
|
4
|
|
|
* |
|
5
|
|
|
* @author Pronamic <[email protected]> |
|
6
|
|
|
* @copyright 2005-2018 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
|
|
|
/** |
|
14
|
|
|
* Adyen |
|
15
|
|
|
* |
|
16
|
|
|
* @author Remco Tolsma |
|
17
|
|
|
* @version 2.0.0 |
|
18
|
|
|
* @since 1.0.0 |
|
19
|
|
|
* @link https://github.com/adyenpayments/php/blob/master/generatepaymentform.php |
|
20
|
|
|
*/ |
|
21
|
|
|
class Adyen { |
|
22
|
|
|
/** |
|
23
|
|
|
* The payment server URL |
|
24
|
|
|
* |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
private $payment_server_url; |
|
28
|
|
|
|
|
29
|
|
|
////////////////////////////////////////////////// |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Constructs and initialize a iDEAL kassa object |
|
33
|
|
|
*/ |
|
34
|
|
|
public function __construct() { |
|
35
|
|
|
|
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
////////////////////////////////////////////////// |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Get the payment server URL |
|
42
|
|
|
* |
|
43
|
|
|
* @return the payment server URL |
|
|
|
|
|
|
44
|
|
|
*/ |
|
45
|
|
|
public function get_payment_server_url() { |
|
46
|
|
|
return $this->payment_server_url; |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Set the payment server URL |
|
51
|
|
|
* |
|
52
|
|
|
* @param string $url an URL |
|
53
|
|
|
*/ |
|
54
|
|
|
public function set_payment_server_url( $url ) { |
|
55
|
|
|
$this->payment_server_url = $url; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
////////////////////////////////////////////////// |
|
59
|
|
|
|
|
60
|
|
|
public function get_merchant_reference() { |
|
61
|
|
|
return $this->merchant_reference; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function set_merchant_reference( $merchant_reference ) { |
|
65
|
|
|
$this->merchant_reference = $merchant_reference; |
|
|
|
|
|
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
////////////////////////////////////////////////// |
|
69
|
|
|
|
|
70
|
|
|
public function get_payment_amount() { |
|
71
|
|
|
return $this->payment_amount; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function set_payment_amount( $payment_amount ) { |
|
75
|
|
|
$this->payment_amount = $payment_amount; |
|
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
////////////////////////////////////////////////// |
|
79
|
|
|
|
|
80
|
|
|
public function get_currency_code() { |
|
81
|
|
|
return $this->currency_code; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function set_currency_code( $currency_code ) { |
|
85
|
|
|
$this->currency_code = $currency_code; |
|
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
////////////////////////////////////////////////// |
|
89
|
|
|
|
|
90
|
|
|
public function get_ship_before_date() { |
|
91
|
|
|
return $this->ship_before_date; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public function set_ship_before_date( DateTime $date ) { |
|
|
|
|
|
|
95
|
|
|
$this->ship_before_date = $date; |
|
|
|
|
|
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
////////////////////////////////////////////////// |
|
99
|
|
|
|
|
100
|
|
|
public function get_skin_code() { |
|
101
|
|
|
return $this->skin_code; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function set_skin_code( $skin_code ) { |
|
105
|
|
|
$this->skin_code = $skin_code; |
|
|
|
|
|
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
////////////////////////////////////////////////// |
|
109
|
|
|
|
|
110
|
|
|
public function get_merchant_account() { |
|
111
|
|
|
return $this->merchant_account; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function set_merchant_account( $merchant_account ) { |
|
115
|
|
|
$this->merchant_account = $merchant_account; |
|
|
|
|
|
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
////////////////////////////////////////////////// |
|
119
|
|
|
|
|
120
|
|
|
public function get_shopper_locale() { |
|
121
|
|
|
return $this->shopper_locale; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
public function set_shopper_locale( $shopper_locale ) { |
|
125
|
|
|
$this->shopper_locale = $shopper_locale; |
|
|
|
|
|
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
////////////////////////////////////////////////// |
|
129
|
|
|
|
|
130
|
|
|
public function get_order_data() { |
|
131
|
|
|
return $this->order_data; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function set_order_data( $order_data ) { |
|
135
|
|
|
$this->order_data = $order_data; |
|
|
|
|
|
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
////////////////////////////////////////////////// |
|
139
|
|
|
|
|
140
|
|
|
public function get_session_validity() { |
|
141
|
|
|
return $this->session_validity; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
public function set_session_validity( DateTime $session_validity = null ) { |
|
145
|
|
|
$this->session_validity = $session_validity; |
|
|
|
|
|
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
////////////////////////////////////////////////// |
|
149
|
|
|
|
|
150
|
|
|
public function get_shopper_email() { |
|
151
|
|
|
return $this->shopper_email; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
public function set_shopper_email( $email ) { |
|
155
|
|
|
$this->shopper_email = $email; |
|
|
|
|
|
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
////////////////////////////////////////////////// |
|
159
|
|
|
|
|
160
|
|
|
public function get_shopper_reference() { |
|
161
|
|
|
return $this->shopper_reference; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
public function set_shopper_reference( $reference ) { |
|
165
|
|
|
$this->shopper_reference = $reference; |
|
|
|
|
|
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
////////////////////////////////////////////////// |
|
169
|
|
|
|
|
170
|
|
|
public function get_shared_secret() { |
|
171
|
|
|
return $this->shared_secret; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
public function set_shared_secret( $shared_secret ) { |
|
175
|
|
|
$this->shared_secret = $shared_secret; |
|
|
|
|
|
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
////////////////////////////////////////////////// |
|
179
|
|
|
|
|
180
|
|
|
public function get_signature() { |
|
181
|
|
|
$data = array( |
|
182
|
|
|
Pronamic_WP_Util::amount_to_cents( $this->get_payment_amount() ), |
|
|
|
|
|
|
183
|
|
|
$this->get_currency_code(), |
|
184
|
|
|
Pronamic_WP_Util::format_date( 'Y-m-d', $this->get_ship_before_date() ), |
|
185
|
|
|
$this->get_merchant_reference(), |
|
186
|
|
|
$this->get_skin_code(), |
|
187
|
|
|
$this->get_merchant_account(), |
|
188
|
|
|
Pronamic_WP_Util::format_date( DATE_ATOM, $this->get_session_validity() ), |
|
189
|
|
|
$this->get_shopper_email(), |
|
190
|
|
|
$this->get_shopper_reference(), |
|
191
|
|
|
); |
|
192
|
|
|
|
|
193
|
|
|
$data = implode( '', $data ); |
|
194
|
|
|
|
|
195
|
|
|
$signature = base64_encode( hash_hmac( 'sha1', $data, $this->get_shared_secret(), true ) ); |
|
196
|
|
|
|
|
197
|
|
|
return $signature; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
////////////////////////////////////////////////// |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* Get HTML fields |
|
204
|
|
|
* |
|
205
|
|
|
* @return string |
|
206
|
|
|
*/ |
|
207
|
|
|
public function get_html_fields() { |
|
208
|
|
|
return Pronamic_IDeal_IDeal::htmlHiddenFields( array( |
|
|
|
|
|
|
209
|
|
|
Pronamic_Gateways_Adyen_Parameters::MERCHANT_REFERENCE => $this->get_merchant_reference(), |
|
|
|
|
|
|
210
|
|
|
Pronamic_Gateways_Adyen_Parameters::PAYMENT_AMOUNT => Pronamic_WP_Util::amount_to_cents( $this->get_payment_amount() ), |
|
211
|
|
|
Pronamic_Gateways_Adyen_Parameters::CURRENCY_CODE => $this->get_currency_code(), |
|
212
|
|
|
Pronamic_Gateways_Adyen_Parameters::SHIP_BEFORE_DATE => Pronamic_WP_Util::format_date( 'Y-m-d', $this->get_ship_before_date() ), |
|
213
|
|
|
Pronamic_Gateways_Adyen_Parameters::SKIN_CODE => $this->get_skin_code(), |
|
214
|
|
|
Pronamic_Gateways_Adyen_Parameters::MERCHANT_ACCOUNT => $this->get_merchant_account(), |
|
215
|
|
|
Pronamic_Gateways_Adyen_Parameters::SHOPPER_LOCALE => $this->get_shopper_locale(), |
|
216
|
|
|
Pronamic_Gateways_Adyen_Parameters::ORDER_DATA => base64_encode( gzencode( $this->get_order_data() ) ), |
|
217
|
|
|
Pronamic_Gateways_Adyen_Parameters::SESSION_VALIDITY => Pronamic_WP_Util::format_date( DATE_ATOM, $this->get_session_validity() ), |
|
218
|
|
|
Pronamic_Gateways_Adyen_Parameters::MERCHANT_SIGNATURE => $this->get_signature(), |
|
219
|
|
|
Pronamic_Gateways_Adyen_Parameters::SHOPPER_EMAIL => $this->get_shopper_email(), |
|
220
|
|
|
Pronamic_Gateways_Adyen_Parameters::SHOPPER_REFERENCE => $this->get_shopper_reference(), |
|
221
|
|
|
) ); |
|
222
|
|
|
} |
|
223
|
|
|
} |
|
224
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths