1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Ingenico; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Title: Ingenico gateway settings |
7
|
|
|
* Description: |
8
|
|
|
* Copyright: 2005-2019 Pronamic |
9
|
|
|
* Company: Pronamic |
10
|
|
|
* |
11
|
|
|
* @author Remco Tolsma |
12
|
|
|
* @version 2.0.2 |
13
|
|
|
* @since 1.3.0 |
14
|
|
|
*/ |
15
|
|
|
class Settings { |
16
|
|
|
/** |
17
|
|
|
* Fields. |
18
|
|
|
* |
19
|
|
|
* @param array $fields Settings fields. |
20
|
|
|
* |
21
|
|
|
* @return array |
22
|
|
|
*/ |
23
|
|
|
public static function get_settings_fields( $type ) { |
24
|
|
|
$fields = array(); |
25
|
|
|
|
26
|
|
|
/* |
27
|
|
|
* General. |
28
|
|
|
*/ |
29
|
|
|
$fields[] = array( |
30
|
|
|
'section' => 'general', |
31
|
|
|
'type' => 'html', |
32
|
|
|
'html' => __( 'Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal' ), |
33
|
|
|
); |
34
|
|
|
|
35
|
|
|
// PSPID. |
36
|
|
|
$fields[] = array( |
37
|
|
|
'section' => 'general', |
38
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
39
|
|
|
'meta_key' => '_pronamic_gateway_ogone_psp_id', |
40
|
|
|
'title' => __( 'PSPID', 'pronamic_ideal' ), |
41
|
|
|
'type' => 'text', |
42
|
|
|
'classes' => array( 'code' ), |
43
|
|
|
'tooltip' => __( 'PSPID as mentioned in the payment provider dashboard.', 'pronamic_ideal' ), |
44
|
|
|
); |
45
|
|
|
|
46
|
|
|
// API user ID. |
47
|
|
|
$fields[] = array( |
48
|
|
|
'section' => 'general', |
49
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
50
|
|
|
'meta_key' => '_pronamic_gateway_ogone_user_id', |
51
|
|
|
'title' => __( 'API user ID', 'pronamic_ideal' ), |
52
|
|
|
'type' => 'text', |
53
|
|
|
'classes' => array( 'regular-text', 'code' ), |
54
|
|
|
'tooltip' => __( 'User ID of the API user in the payment provider dashboard: Configuration » Users', 'pronamic_ideal' ), |
55
|
|
|
); |
56
|
|
|
|
57
|
|
|
// API user password. |
58
|
|
|
$fields[] = array( |
59
|
|
|
'section' => 'general', |
60
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
61
|
|
|
'meta_key' => '_pronamic_gateway_ogone_password', |
62
|
|
|
'title' => __( 'API user password', 'pronamic_ideal' ), |
63
|
|
|
'type' => 'password', |
64
|
|
|
'classes' => array( 'regular-text', 'code' ), |
65
|
|
|
'tooltip' => __( 'Password of the API user in the payment provider dashboard: Configuration » Users', 'pronamic_ideal' ), |
66
|
|
|
); |
67
|
|
|
|
68
|
|
|
if ( 'standard' === $type ) { |
69
|
|
|
// SHA-IN Pass phrase. |
70
|
|
|
$fields[] = array( |
71
|
|
|
'section' => 'general', |
72
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
73
|
|
|
'meta_key' => '_pronamic_gateway_ogone_sha_in_pass_phrase', |
74
|
|
|
'title' => __( 'SHA-IN Pass phrase', 'pronamic_ideal' ), |
75
|
|
|
'type' => 'password', |
76
|
|
|
'classes' => array( 'regular-text', 'code' ), |
77
|
|
|
'tooltip' => __( 'SHA-IN pass phrase as mentioned in the payment provider dashboard: Configuration » Technical information » Data and origin verification.', 'pronamic_ideal' ), |
78
|
|
|
); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
if ( 'directlink' === $type ) { |
82
|
|
|
// SHA-IN Pass phrase. |
83
|
|
|
$fields[] = array( |
84
|
|
|
'section' => 'general', |
85
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
86
|
|
|
'meta_key' => '_pronamic_gateway_ogone_directlink_sha_in_pass_phrase', |
87
|
|
|
'title' => __( 'SHA-IN Pass phrase', 'pronamic_ideal' ), |
88
|
|
|
'type' => 'password', |
89
|
|
|
'classes' => array( 'regular-text', 'code' ), |
90
|
|
|
'tooltip' => __( 'SHA-IN pass phrase as mentioned in the payment provider dashboard: Configuration » Technical information » Data and origin verification.', 'pronamic_ideal' ), |
91
|
|
|
); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
// SHA-OUT Pass phrase. |
95
|
|
|
$fields[] = array( |
96
|
|
|
'section' => 'general', |
97
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
98
|
|
|
'meta_key' => '_pronamic_gateway_ogone_sha_out_pass_phrase', |
99
|
|
|
'title' => __( 'SHA-OUT Pass phrase', 'pronamic_ideal' ), |
100
|
|
|
'type' => 'password', |
101
|
|
|
'classes' => array( 'regular-text', 'code' ), |
102
|
|
|
'tooltip' => __( 'SHA-OUT pass phrase as mentioned in the payment provider dashboard: Configuration » Technical information » Transaction feedback.', 'pronamic_ideal' ), |
103
|
|
|
); |
104
|
|
|
|
105
|
|
|
// Hash algorithm. |
106
|
|
|
$fields[] = array( |
107
|
|
|
'section' => 'general', |
108
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
109
|
|
|
'meta_key' => '_pronamic_gateway_ogone_hash_algorithm', |
110
|
|
|
'title' => __( 'Hash algorithm', 'pronamic_ideal' ), |
111
|
|
|
'type' => 'optgroup', |
112
|
|
|
'tooltip' => 'Hash algorithm as mentioned in the payment provider dashboard: Configuration » Technical information', |
113
|
|
|
'options' => array( |
114
|
|
|
Ingenico::SHA_1 => __( 'SHA-1', 'pronamic_ideal' ), |
115
|
|
|
Ingenico::SHA_256 => __( 'SHA-256', 'pronamic_ideal' ), |
116
|
|
|
Ingenico::SHA_512 => __( 'SHA-512', 'pronamic_ideal' ), |
117
|
|
|
), |
118
|
|
|
'default' => Ingenico::SHA_1, |
119
|
|
|
); |
120
|
|
|
|
121
|
|
|
if ( 'directlink' === $type ) { |
122
|
|
|
// 3-D Secure |
123
|
|
|
$fields[] = array( |
124
|
|
|
'section' => 'general', |
125
|
|
|
'filter' => FILTER_VALIDATE_BOOLEAN, |
126
|
|
|
'meta_key' => '_pronamic_gateway_ogone_3d_secure_enabled', |
127
|
|
|
'title' => __( '3-D Secure', 'pronamic_ideal' ), |
128
|
|
|
'type' => 'checkbox', |
129
|
|
|
'label' => __( 'Enable 3-D Secure protocol', 'pronamic_ideal' ), |
130
|
|
|
); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/* |
134
|
|
|
* Advanced settings |
135
|
|
|
*/ |
136
|
|
|
|
137
|
|
|
$fields[] = array( |
138
|
|
|
'section' => 'advanced', |
139
|
|
|
'type' => 'html', |
140
|
|
|
'html' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ), |
141
|
|
|
); |
142
|
|
|
|
143
|
|
|
// Form Action URL. |
144
|
|
|
if ( 'standard' === $type ) { |
145
|
|
|
$fields[] = array( |
146
|
|
|
'section' => 'advanced', |
147
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
148
|
|
|
'meta_key' => '_pronamic_gateway_ogone_form_action_url', |
149
|
|
|
'title' => __( 'Form Action URL', 'pronamic_ideal' ), |
150
|
|
|
'type' => 'text', |
151
|
|
|
'classes' => array( 'regular-text', 'code' ), |
152
|
|
|
'tooltip' => __( 'With this setting you can override the default Ingenico e-Commerce form action URL to the payment processing page.', 'pronamic_ideal' ), |
153
|
|
|
); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
// Order ID. |
157
|
|
|
$fields[] = array( |
158
|
|
|
'section' => 'advanced', |
159
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
160
|
|
|
'meta_key' => '_pronamic_gateway_ogone_order_id', |
161
|
|
|
'title' => __( 'Order ID', 'pronamic_ideal' ), |
162
|
|
|
'type' => 'text', |
163
|
|
|
'classes' => array( 'regular-text', 'code' ), |
164
|
|
|
'tooltip' => sprintf( |
165
|
|
|
/* translators: %s: <code>ORDERID</code> */ |
166
|
|
|
__( 'The Ingenico %s parameter.', 'pronamic_ideal' ), |
167
|
|
|
sprintf( '<code>%s</code>', 'ORDERID' ) |
168
|
|
|
), |
169
|
|
|
'description' => sprintf( |
170
|
|
|
'%s<br />%s', |
171
|
|
|
sprintf( |
172
|
|
|
/* translators: %s: <code>{order_id}</code> <code>{payment_id}</code> */ |
173
|
|
|
__( 'Available tags: %s', 'pronamic_ideal' ), |
174
|
|
|
sprintf( '<code>%s</code> <code>%s</code>', '{order_id}', '{payment_id}' ) |
175
|
|
|
), |
176
|
|
|
sprintf( |
177
|
|
|
/* translators: %s: {payment_id} */ |
178
|
|
|
__( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
179
|
|
|
'{payment_id}' |
180
|
|
|
) |
181
|
|
|
), |
182
|
|
|
); |
183
|
|
|
|
184
|
|
|
// Parameter Variable. |
185
|
|
|
$fields[] = array( |
186
|
|
|
'section' => 'advanced', |
187
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
188
|
|
|
'meta_key' => '_pronamic_gateway_ogone_param_var', |
189
|
|
|
'title' => __( 'Parameter Variable', 'pronamic_ideal' ), |
190
|
|
|
'type' => 'text', |
191
|
|
|
'classes' => array( 'regular-text', 'code' ), |
192
|
|
|
'tooltip' => sprintf( |
193
|
|
|
/* translators: %s: <code>PARAMVAR</code> */ |
194
|
|
|
__( 'The Ingenico %s parameter.', 'pronamic_ideal' ), |
195
|
|
|
sprintf( '<code>%s</code>', 'PARAMVAR' ) |
196
|
|
|
), |
197
|
|
|
'description' => sprintf( |
198
|
|
|
/* translators: %s: <code>{site_url}</code> <code>{home_url}</code> */ |
199
|
|
|
__( 'Available tags: %s', 'pronamic_ideal' ), |
200
|
|
|
sprintf( '<code>%s</code> <code>%s</code>', '{site_url}', '{home_url}' ) |
201
|
|
|
), |
202
|
|
|
); |
203
|
|
|
|
204
|
|
|
// Alias. |
205
|
|
|
$fields[] = array( |
206
|
|
|
'section' => 'advanced', |
207
|
|
|
'filter' => FILTER_VALIDATE_BOOLEAN, |
208
|
|
|
'meta_key' => '_pronamic_gateway_ogone_alias_enabled', |
209
|
|
|
'title' => __( 'Alias', 'pronamic_ideal' ), |
210
|
|
|
'type' => 'checkbox', |
211
|
|
|
'label' => __( 'Enable alias registration', 'pronamic_ideal' ), |
212
|
|
|
'tooltip' => __( 'Enable alias creation as reference for batch payments. Requires the Alias Manager option (`REQ1`) to be enabled for the Ingenico account.', 'pronamic_ideal' ), |
213
|
|
|
); |
214
|
|
|
|
215
|
|
|
// Alias usage. |
216
|
|
|
$fields[] = array( |
217
|
|
|
'section' => 'advanced', |
218
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
219
|
|
|
'meta_key' => '_pronamic_gateway_ogone_alias_usage', |
220
|
|
|
'title' => __( 'Alias Usage', 'pronamic_ideal' ), |
221
|
|
|
'type' => 'text', |
222
|
|
|
'classes' => array( 'regular-text', 'code' ), |
223
|
|
|
'tooltip' => sprintf( |
224
|
|
|
/* translators: %s: <code>ALIASUSAGE</code> */ |
225
|
|
|
__( 'The Ingenico %s parameter.', 'pronamic_ideal' ), |
226
|
|
|
sprintf( '<code>%s</code>', 'ALIASUSAGE' ) |
227
|
|
|
), |
228
|
|
|
'description' => __( 'Description on payment page of how aliases are used.', 'pronamic_ideal' ), |
229
|
|
|
); |
230
|
|
|
|
231
|
|
|
// Template Page. |
232
|
|
|
$fields[] = array( |
233
|
|
|
'section' => 'advanced', |
234
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
235
|
|
|
'meta_key' => '_pronamic_gateway_ogone_template_page', |
236
|
|
|
'title' => __( 'Template Page', 'pronamic_ideal' ), |
237
|
|
|
'type' => 'text', |
238
|
|
|
'classes' => array( 'regular-text', 'code' ), |
239
|
|
|
'tooltip' => sprintf( |
240
|
|
|
/* translators: %s: <code>TP</code> */ |
241
|
|
|
__( 'The Ingenico %s parameter.', 'pronamic_ideal' ), |
242
|
|
|
sprintf( '<code>%s</code>', 'TP' ) |
243
|
|
|
), |
244
|
|
|
); |
245
|
|
|
|
246
|
|
|
/* |
247
|
|
|
* Transaction feedback - Direct HTTP server-to-server request URLs |
248
|
|
|
*/ |
249
|
|
|
$fields[] = array( |
250
|
|
|
'section' => 'feedback', |
251
|
|
|
'type' => 'html', |
252
|
|
|
'html' => __( 'The URLs below need to be copied to the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
253
|
|
|
); |
254
|
|
|
|
255
|
|
|
// URL accepted, on hold or uncertain. |
256
|
|
|
$fields[] = array( |
257
|
|
|
'section' => 'feedback', |
258
|
|
|
'title' => __( 'URL accepted, on hold or uncertain', 'pronamic_ideal' ), |
259
|
|
|
'type' => 'text', |
260
|
|
|
'value' => site_url( '/' ), |
261
|
|
|
'classes' => array( 'regular-text', 'code' ), |
262
|
|
|
'tooltip' => __( 'Direct HTTP server-to-server request URL for payment statuses accepted, on hold or uncertain".', 'pronamic_ideal' ), |
263
|
|
|
'readonly' => true, |
264
|
|
|
); |
265
|
|
|
|
266
|
|
|
// URL cancel or deny. |
267
|
|
|
$fields[] = array( |
268
|
|
|
'section' => 'feedback', |
269
|
|
|
'title' => __( 'URL cancel or deny', 'pronamic_ideal' ), |
270
|
|
|
'type' => 'text', |
271
|
|
|
'value' => site_url( '/' ), |
272
|
|
|
'classes' => array( 'regular-text', 'code' ), |
273
|
|
|
'tooltip' => __( 'Direct HTTP server-to-server request URL for payment statuses "cancelled by the client" or "too many rejections by the acquirer".', 'pronamic_ideal' ), |
274
|
|
|
'readonly' => true, |
275
|
|
|
); |
276
|
|
|
|
277
|
|
|
// Return fields. |
278
|
|
|
return $fields; |
279
|
|
|
} |
280
|
|
|
} |
281
|
|
|
|