@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @param string $file The plugin file. |
62 | 62 | */ |
63 | - public static function instance( $file = null ) { |
|
64 | - if ( is_null( self::$instance ) ) { |
|
63 | + public static function instance($file = null) { |
|
64 | + if (is_null(self::$instance)) { |
|
65 | 65 | self::$instance = new self(); |
66 | 66 | |
67 | 67 | // Backward compatibility. |
68 | 68 | self::$file = $file; |
69 | - self::$dirname = dirname( $file ); |
|
69 | + self::$dirname = dirname($file); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return self::$instance; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | Extensions\RestrictContentPro\Extension::bootstrap(); |
98 | 98 | |
99 | 99 | // Settings. |
100 | - $this->settings = new Settings( $this ); |
|
100 | + $this->settings = new Settings($this); |
|
101 | 101 | |
102 | 102 | // Data Stores. |
103 | 103 | $this->payments_data_store = new Payments\PaymentsDataStoreCPT(); |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $this->subscription_post_type = new SubscriptionPostType(); |
110 | 110 | |
111 | 111 | // License Manager. |
112 | - $this->license_manager = new LicenseManager( $this ); |
|
112 | + $this->license_manager = new LicenseManager($this); |
|
113 | 113 | |
114 | 114 | // Modules. |
115 | - $this->forms_module = new Forms\FormsModule( $this ); |
|
116 | - $this->subscriptions_module = new Subscriptions\SubscriptionsModule( $this ); |
|
115 | + $this->forms_module = new Forms\FormsModule($this); |
|
116 | + $this->subscriptions_module = new Subscriptions\SubscriptionsModule($this); |
|
117 | 117 | |
118 | 118 | // Payment Status Checker. |
119 | 119 | $this->payment_status_checker = new Payments\StatusChecker(); |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | $this->google_analytics_ecommerce = new GoogleAnalyticsEcommerce(); |
123 | 123 | |
124 | 124 | // Admin. |
125 | - if ( is_admin() ) { |
|
126 | - $this->admin = new Admin\AdminModule( $this ); |
|
125 | + if (is_admin()) { |
|
126 | + $this->admin = new Admin\AdminModule($this); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /* |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * @see https://github.com/wp-e-commerce/WP-e-Commerce/blob/branch-3.11.2/wp-shopping-cart.php#L54 |
142 | 142 | * @see https://github.com/wp-e-commerce/WP-e-Commerce/blob/branch-3.11.2/wp-shopping-cart.php#L296-L297 |
143 | 143 | */ |
144 | - add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 5 ); |
|
144 | + add_action('plugins_loaded', array($this, 'plugins_loaded'), 5); |
|
145 | 145 | |
146 | 146 | // Exclude payment and subscription notes. |
147 | - add_filter( 'comments_clauses', array( $this, 'exclude_comment_notes' ), 10, 2 ); |
|
147 | + add_filter('comments_clauses', array($this, 'exclude_comment_notes'), 10, 2); |
|
148 | 148 | |
149 | 149 | // Payment redirect URL. |
150 | - add_filter( 'pronamic_payment_redirect_url', array( $this, 'payment_redirect_url' ), 5, 2 ); |
|
150 | + add_filter('pronamic_payment_redirect_url', array($this, 'payment_redirect_url'), 5, 2); |
|
151 | 151 | |
152 | 152 | // Plugin locale. |
153 | - add_filter( 'plugin_locale', array( $this, 'plugin_locale' ), 10, 2 ); |
|
153 | + add_filter('plugin_locale', array($this, 'plugin_locale'), 10, 2); |
|
154 | 154 | |
155 | 155 | // If WordPress is loaded check on returns and maybe redirect requests. |
156 | - add_action( 'wp_loaded', array( $this, 'handle_returns' ) ); |
|
157 | - add_action( 'wp_loaded', array( $this, 'maybe_redirect' ) ); |
|
156 | + add_action('wp_loaded', array($this, 'handle_returns')); |
|
157 | + add_action('wp_loaded', array($this, 'maybe_redirect')); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return string |
184 | 184 | */ |
185 | 185 | public function get_plugin_dir_path() { |
186 | - return plugin_dir_path( $this->get_file() ); |
|
186 | + return plugin_dir_path($this->get_file()); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return array |
196 | 196 | */ |
197 | - public function exclude_comment_notes( $clauses, $query ) { |
|
197 | + public function exclude_comment_notes($clauses, $query) { |
|
198 | 198 | $type = $query->query_vars['type']; |
199 | 199 | |
200 | 200 | // Ignore payment notes comments if it's not specifically requested. |
201 | - if ( 'payment_note' !== $type ) { |
|
201 | + if ('payment_note' !== $type) { |
|
202 | 202 | $clauses['where'] .= " AND comment_type != 'payment_note'"; |
203 | 203 | } |
204 | 204 | |
@@ -213,40 +213,40 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public function payment_redirect_url( $url, $payment ) { |
|
216 | + public function payment_redirect_url($url, $payment) { |
|
217 | 217 | $page_id = null; |
218 | 218 | |
219 | - switch ( $payment->status ) { |
|
219 | + switch ($payment->status) { |
|
220 | 220 | case Core\Statuses::CANCELLED: |
221 | - $page_id = pronamic_pay_get_page_id( 'cancel' ); |
|
221 | + $page_id = pronamic_pay_get_page_id('cancel'); |
|
222 | 222 | |
223 | 223 | break; |
224 | 224 | case Core\Statuses::EXPIRED: |
225 | - $page_id = pronamic_pay_get_page_id( 'expired' ); |
|
225 | + $page_id = pronamic_pay_get_page_id('expired'); |
|
226 | 226 | |
227 | 227 | break; |
228 | 228 | case Core\Statuses::FAILURE: |
229 | - $page_id = pronamic_pay_get_page_id( 'error' ); |
|
229 | + $page_id = pronamic_pay_get_page_id('error'); |
|
230 | 230 | |
231 | 231 | break; |
232 | 232 | case Core\Statuses::OPEN: |
233 | - $page_id = pronamic_pay_get_page_id( 'unknown' ); |
|
233 | + $page_id = pronamic_pay_get_page_id('unknown'); |
|
234 | 234 | |
235 | 235 | break; |
236 | 236 | case Core\Statuses::SUCCESS: |
237 | - $page_id = pronamic_pay_get_page_id( 'completed' ); |
|
237 | + $page_id = pronamic_pay_get_page_id('completed'); |
|
238 | 238 | |
239 | 239 | break; |
240 | 240 | default: |
241 | - $page_id = pronamic_pay_get_page_id( 'unknown' ); |
|
241 | + $page_id = pronamic_pay_get_page_id('unknown'); |
|
242 | 242 | |
243 | 243 | break; |
244 | 244 | } |
245 | 245 | |
246 | - if ( ! empty( $page_id ) ) { |
|
247 | - $page_url = get_permalink( $page_id ); |
|
246 | + if ( ! empty($page_id)) { |
|
247 | + $page_url = get_permalink($page_id); |
|
248 | 248 | |
249 | - if ( false !== $page_url ) { |
|
249 | + if (false !== $page_url) { |
|
250 | 250 | $url = $page_url; |
251 | 251 | } |
252 | 252 | } |
@@ -260,43 +260,43 @@ discard block |
||
260 | 260 | * @param Payment $payment The payment to update. |
261 | 261 | * @param bool $can_redirect Flag to indicate if redirect is allowed after the payment update. |
262 | 262 | */ |
263 | - public static function update_payment( $payment = null, $can_redirect = true ) { |
|
264 | - if ( empty( $payment ) ) { |
|
263 | + public static function update_payment($payment = null, $can_redirect = true) { |
|
264 | + if (empty($payment)) { |
|
265 | 265 | return; |
266 | 266 | } |
267 | 267 | |
268 | - $gateway = Plugin::get_gateway( $payment->config_id ); |
|
268 | + $gateway = Plugin::get_gateway($payment->config_id); |
|
269 | 269 | |
270 | - if ( empty( $gateway ) ) { |
|
270 | + if (empty($gateway)) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | 274 | $amount = $payment->get_amount(); |
275 | 275 | |
276 | - if ( empty( $amount ) ) { |
|
277 | - $payment->set_status( Core\Statuses::SUCCESS ); |
|
276 | + if (empty($amount)) { |
|
277 | + $payment->set_status(Core\Statuses::SUCCESS); |
|
278 | 278 | } else { |
279 | - $gateway->update_status( $payment ); |
|
279 | + $gateway->update_status($payment); |
|
280 | 280 | |
281 | - if ( $gateway->has_error() ) { |
|
282 | - foreach ( $gateway->error->get_error_codes() as $code ) { |
|
283 | - $payment->add_note( sprintf( '%s: %s', $code, $gateway->error->get_error_message( $code ) ) ); |
|
281 | + if ($gateway->has_error()) { |
|
282 | + foreach ($gateway->error->get_error_codes() as $code) { |
|
283 | + $payment->add_note(sprintf('%s: %s', $code, $gateway->error->get_error_message($code))); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | 288 | global $pronamic_ideal; |
289 | 289 | |
290 | - $pronamic_ideal->payments_data_store->update( $payment ); |
|
290 | + $pronamic_ideal->payments_data_store->update($payment); |
|
291 | 291 | |
292 | - if ( defined( 'DOING_CRON' ) && ( empty( $payment->status ) || Statuses::OPEN === $payment->status ) ) { |
|
292 | + if (defined('DOING_CRON') && (empty($payment->status) || Statuses::OPEN === $payment->status)) { |
|
293 | 293 | $can_redirect = false; |
294 | 294 | } |
295 | 295 | |
296 | - if ( $can_redirect ) { |
|
296 | + if ($can_redirect) { |
|
297 | 297 | $url = $payment->get_return_redirect_url(); |
298 | 298 | |
299 | - wp_redirect( $url ); |
|
299 | + wp_redirect($url); |
|
300 | 300 | |
301 | 301 | exit; |
302 | 302 | } |
@@ -306,27 +306,27 @@ discard block |
||
306 | 306 | * Handle returns. |
307 | 307 | */ |
308 | 308 | public function handle_returns() { |
309 | - if ( ! filter_has_var( INPUT_GET, 'payment' ) ) { |
|
309 | + if ( ! filter_has_var(INPUT_GET, 'payment')) { |
|
310 | 310 | return; |
311 | 311 | } |
312 | 312 | |
313 | - $payment_id = filter_input( INPUT_GET, 'payment', FILTER_SANITIZE_NUMBER_INT ); |
|
313 | + $payment_id = filter_input(INPUT_GET, 'payment', FILTER_SANITIZE_NUMBER_INT); |
|
314 | 314 | |
315 | - $payment = get_pronamic_payment( $payment_id ); |
|
315 | + $payment = get_pronamic_payment($payment_id); |
|
316 | 316 | |
317 | 317 | // Check if payment key is valid. |
318 | 318 | $valid_key = false; |
319 | 319 | |
320 | - if ( empty( $payment->key ) ) { |
|
320 | + if (empty($payment->key)) { |
|
321 | 321 | $valid_key = true; |
322 | - } elseif ( filter_has_var( INPUT_GET, 'key' ) ) { |
|
323 | - $key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING ); |
|
322 | + } elseif (filter_has_var(INPUT_GET, 'key')) { |
|
323 | + $key = filter_input(INPUT_GET, 'key', FILTER_SANITIZE_STRING); |
|
324 | 324 | |
325 | - $valid_key = ( $key === $payment->key ); |
|
325 | + $valid_key = ($key === $payment->key); |
|
326 | 326 | } |
327 | 327 | |
328 | - if ( ! $valid_key ) { |
|
329 | - wp_redirect( home_url() ); |
|
328 | + if ( ! $valid_key) { |
|
329 | + wp_redirect(home_url()); |
|
330 | 330 | |
331 | 331 | exit; |
332 | 332 | } |
@@ -336,71 +336,71 @@ discard block |
||
336 | 336 | |
337 | 337 | // Check if the request is an callback request. |
338 | 338 | // Sisow gatway will extend callback requests with querystring "callback=true". |
339 | - if ( filter_has_var( INPUT_GET, 'callback' ) && filter_input( INPUT_GET, 'callback', FILTER_VALIDATE_BOOLEAN ) ) { |
|
339 | + if (filter_has_var(INPUT_GET, 'callback') && filter_input(INPUT_GET, 'callback', FILTER_VALIDATE_BOOLEAN)) { |
|
340 | 340 | $should_redirect = false; |
341 | 341 | } |
342 | 342 | |
343 | 343 | // Check if the request is an notify request. |
344 | 344 | // Sisow gatway will extend callback requests with querystring "notify=true". |
345 | - if ( filter_has_var( INPUT_GET, 'notify' ) && filter_input( INPUT_GET, 'notify', FILTER_VALIDATE_BOOLEAN ) ) { |
|
345 | + if (filter_has_var(INPUT_GET, 'notify') && filter_input(INPUT_GET, 'notify', FILTER_VALIDATE_BOOLEAN)) { |
|
346 | 346 | $should_redirect = false; |
347 | 347 | } |
348 | 348 | |
349 | - self::update_payment( $payment, $should_redirect ); |
|
349 | + self::update_payment($payment, $should_redirect); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Maybe redirect. |
354 | 354 | */ |
355 | 355 | public function maybe_redirect() { |
356 | - if ( ! filter_has_var( INPUT_GET, 'payment_redirect' ) ) { |
|
356 | + if ( ! filter_has_var(INPUT_GET, 'payment_redirect')) { |
|
357 | 357 | return; |
358 | 358 | } |
359 | 359 | |
360 | - $payment_id = filter_input( INPUT_GET, 'payment_redirect', FILTER_SANITIZE_NUMBER_INT ); |
|
360 | + $payment_id = filter_input(INPUT_GET, 'payment_redirect', FILTER_SANITIZE_NUMBER_INT); |
|
361 | 361 | |
362 | - $payment = get_pronamic_payment( $payment_id ); |
|
362 | + $payment = get_pronamic_payment($payment_id); |
|
363 | 363 | |
364 | 364 | // HTML Answer. |
365 | - $html_answer = $payment->get_meta( 'ogone_directlink_html_answer' ); |
|
365 | + $html_answer = $payment->get_meta('ogone_directlink_html_answer'); |
|
366 | 366 | |
367 | - if ( ! empty( $html_answer ) ) { |
|
367 | + if ( ! empty($html_answer)) { |
|
368 | 368 | echo $html_answer; // WPCS: XSS ok. |
369 | 369 | |
370 | 370 | exit; |
371 | 371 | } |
372 | 372 | |
373 | - $redirect_message = $payment->get_meta( 'payment_redirect_message' ); |
|
373 | + $redirect_message = $payment->get_meta('payment_redirect_message'); |
|
374 | 374 | |
375 | - if ( ! empty( $redirect_message ) ) { |
|
376 | - $key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING ); |
|
375 | + if ( ! empty($redirect_message)) { |
|
376 | + $key = filter_input(INPUT_GET, 'key', FILTER_SANITIZE_STRING); |
|
377 | 377 | |
378 | - if ( $key !== $payment->key ) { |
|
379 | - wp_redirect( home_url() ); |
|
378 | + if ($key !== $payment->key) { |
|
379 | + wp_redirect(home_url()); |
|
380 | 380 | |
381 | 381 | exit; |
382 | 382 | } |
383 | 383 | |
384 | 384 | // @see https://github.com/woothemes/woocommerce/blob/2.3.11/includes/class-wc-cache-helper.php |
385 | 385 | // @see https://www.w3-edge.com/products/w3-total-cache/ |
386 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
387 | - define( 'DONOTCACHEPAGE', true ); |
|
386 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
387 | + define('DONOTCACHEPAGE', true); |
|
388 | 388 | } |
389 | 389 | |
390 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
391 | - define( 'DONOTCACHEDB', true ); |
|
390 | + if ( ! defined('DONOTCACHEDB')) { |
|
391 | + define('DONOTCACHEDB', true); |
|
392 | 392 | } |
393 | 393 | |
394 | - if ( ! defined( 'DONOTMINIFY' ) ) { |
|
395 | - define( 'DONOTMINIFY', true ); |
|
394 | + if ( ! defined('DONOTMINIFY')) { |
|
395 | + define('DONOTMINIFY', true); |
|
396 | 396 | } |
397 | 397 | |
398 | - if ( ! defined( 'DONOTCDN' ) ) { |
|
399 | - define( 'DONOTCDN', true ); |
|
398 | + if ( ! defined('DONOTCDN')) { |
|
399 | + define('DONOTCDN', true); |
|
400 | 400 | } |
401 | 401 | |
402 | - if ( ! defined( 'DONOTCACHEOBJECT' ) ) { |
|
403 | - define( 'DONOTCACHEOBJECT', true ); |
|
402 | + if ( ! defined('DONOTCACHEOBJECT')) { |
|
403 | + define('DONOTCACHEOBJECT', true); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | nocache_headers(); |
@@ -410,22 +410,22 @@ discard block |
||
410 | 410 | exit; |
411 | 411 | } |
412 | 412 | |
413 | - $gateway = Plugin::get_gateway( $payment->config_id ); |
|
413 | + $gateway = Plugin::get_gateway($payment->config_id); |
|
414 | 414 | |
415 | - if ( $gateway && $gateway->is_html_form() ) { |
|
416 | - $gateway->start( $payment ); |
|
415 | + if ($gateway && $gateway->is_html_form()) { |
|
416 | + $gateway->start($payment); |
|
417 | 417 | |
418 | 418 | $error = $gateway->get_error(); |
419 | 419 | |
420 | - if ( is_wp_error( $error ) ) { |
|
421 | - Plugin::render_errors( $error ); |
|
420 | + if (is_wp_error($error)) { |
|
421 | + Plugin::render_errors($error); |
|
422 | 422 | } else { |
423 | - $gateway->redirect( $payment ); |
|
423 | + $gateway->redirect($payment); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
427 | - if ( ! empty( $payment->action_url ) ) { |
|
428 | - wp_redirect( $payment->action_url ); |
|
427 | + if ( ! empty($payment->action_url)) { |
|
428 | + wp_redirect($payment->action_url); |
|
429 | 429 | |
430 | 430 | exit; |
431 | 431 | } |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | public static function get_number_payments() { |
440 | 440 | $number = false; |
441 | 441 | |
442 | - $count = wp_count_posts( 'pronamic_payment' ); |
|
442 | + $count = wp_count_posts('pronamic_payment'); |
|
443 | 443 | |
444 | - if ( isset( $count, $count->payment_completed ) ) { |
|
445 | - $number = intval( $count->payment_completed ); |
|
444 | + if (isset($count, $count->payment_completed)) { |
|
445 | + $number = intval($count->payment_completed); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | return $number; |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | */ |
454 | 454 | public function plugins_loaded() { |
455 | 455 | // Load plugin text domain. |
456 | - $rel_path = dirname( plugin_basename( self::$file ) ) . '/languages/'; |
|
456 | + $rel_path = dirname(plugin_basename(self::$file)) . '/languages/'; |
|
457 | 457 | |
458 | - load_plugin_textdomain( 'pronamic_ideal', false, $rel_path ); |
|
458 | + load_plugin_textdomain('pronamic_ideal', false, $rel_path); |
|
459 | 459 | |
460 | 460 | // Gateway Integrations. |
461 | 461 | $this->register_gateway_integrations(); |
@@ -472,118 +472,118 @@ discard block |
||
472 | 472 | |
473 | 473 | // ABN AMRO iDEAL Easy. |
474 | 474 | $integration = new Gateways\Ingenico\OrderStandardEasy\Integration(); |
475 | - $integration->set_id( 'abnamro-ideal-easy' ); |
|
476 | - $integration->set_name( 'ABN AMRO - iDEAL Easy' ); |
|
475 | + $integration->set_id('abnamro-ideal-easy'); |
|
476 | + $integration->set_name('ABN AMRO - iDEAL Easy'); |
|
477 | 477 | $integration->url = 'https://internetkassa.abnamro.nl/'; |
478 | 478 | $integration->product_url = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/'; |
479 | 479 | $integration->dashboard_url = 'https://internetkassa.abnamro.nl/'; |
480 | 480 | $integration->provider = 'abnamro'; |
481 | 481 | |
482 | - $integrations[ $integration->get_id() ] = $integration; |
|
482 | + $integrations[$integration->get_id()] = $integration; |
|
483 | 483 | |
484 | 484 | // ABN AMRO - iDEAL Only Kassa. |
485 | 485 | $integration = new Gateways\Ingenico\OrderStandard\Integration(); |
486 | - $integration->set_id( 'abnamro-ideal-only-kassa' ); |
|
487 | - $integration->set_name( 'ABN AMRO - iDEAL Only Kassa' ); |
|
486 | + $integration->set_id('abnamro-ideal-only-kassa'); |
|
487 | + $integration->set_name('ABN AMRO - iDEAL Only Kassa'); |
|
488 | 488 | $integration->url = 'https://internetkassa.abnamro.nl/'; |
489 | 489 | $integration->product_url = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/'; |
490 | 490 | $integration->dashboard_url = 'https://internetkassa.abnamro.nl/'; |
491 | 491 | $integration->provider = 'abnamro'; |
492 | 492 | |
493 | - $integrations[ $integration->get_id() ] = $integration; |
|
493 | + $integrations[$integration->get_id()] = $integration; |
|
494 | 494 | |
495 | 495 | // ABN AMRO - Internetkassa. |
496 | 496 | $integration = new Gateways\Ingenico\OrderStandard\Integration(); |
497 | - $integration->set_id( 'abnamro-internetkassa' ); |
|
498 | - $integration->set_name( 'ABN AMRO - Internetkassa' ); |
|
497 | + $integration->set_id('abnamro-internetkassa'); |
|
498 | + $integration->set_name('ABN AMRO - Internetkassa'); |
|
499 | 499 | $integration->url = 'https://internetkassa.abnamro.nl/'; |
500 | 500 | $integration->product_url = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/'; |
501 | 501 | $integration->dashboard_url = 'https://internetkassa.abnamro.nl/'; |
502 | 502 | $integration->provider = 'abnamro'; |
503 | 503 | |
504 | - $integrations[ $integration->get_id() ] = $integration; |
|
504 | + $integrations[$integration->get_id()] = $integration; |
|
505 | 505 | |
506 | 506 | // ABN AMRO - iDEAL Zelfbouw (v3). |
507 | 507 | $integration = new Gateways\IDeal_Advanced_V3\Integration(); |
508 | - $integration->set_id( 'abnamro-ideal-zelfbouw-v3' ); |
|
509 | - $integration->set_name( 'ABN AMRO - iDEAL Zelfbouw (v3)' ); |
|
508 | + $integration->set_id('abnamro-ideal-zelfbouw-v3'); |
|
509 | + $integration->set_name('ABN AMRO - iDEAL Zelfbouw (v3)'); |
|
510 | 510 | $integration->url = 'https://abnamro.ideal-payment.de/'; |
511 | 511 | $integration->product_url = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/'; |
512 | 512 | $integration->dashboard_url = array( |
513 | 513 | 'test' => 'https://abnamro-test.ideal-payment.de/', |
514 | 514 | 'live' => 'https://abnamro.ideal-payment.de/', |
515 | 515 | ); |
516 | - $integration->provider = 'abnamro'; |
|
516 | + $integration->provider = 'abnamro'; |
|
517 | 517 | |
518 | - $integrations[ $integration->get_id() ] = $integration; |
|
518 | + $integrations[$integration->get_id()] = $integration; |
|
519 | 519 | |
520 | 520 | // Buckaroo. |
521 | 521 | $integration = new Gateways\Buckaroo\Integration(); |
522 | 522 | |
523 | - $integrations[ $integration->get_id() ] = $integration; |
|
523 | + $integrations[$integration->get_id()] = $integration; |
|
524 | 524 | |
525 | 525 | // Deutsche Bank - iDEAL via Ogone. |
526 | 526 | $integration = new Gateways\Ingenico\OrderStandardEasy\Integration(); |
527 | - $integration->set_id( 'deutschebank-ideal-via-ogone' ); |
|
528 | - $integration->set_name( 'Deutsche Bank - iDEAL via Ogone' ); |
|
527 | + $integration->set_id('deutschebank-ideal-via-ogone'); |
|
528 | + $integration->set_name('Deutsche Bank - iDEAL via Ogone'); |
|
529 | 529 | $integration->product_url = 'https://www.deutschebank.nl/nl/content/producten_en_services_commercial_banking_cash_management_betalen_ideal.html'; |
530 | 530 | $integration->provider = 'deutschebank'; |
531 | 531 | |
532 | - $integrations[ $integration->get_id() ] = $integration; |
|
532 | + $integrations[$integration->get_id()] = $integration; |
|
533 | 533 | |
534 | 534 | // Deutsche Bank - iDEAL Expert (v3). |
535 | 535 | $integration = new Gateways\IDeal_Advanced_V3\Integration(); |
536 | - $integration->set_id( 'deutschebank-ideal-expert-v3' ); |
|
537 | - $integration->set_name( 'Deutsche Bank - iDEAL Expert (v3)' ); |
|
536 | + $integration->set_id('deutschebank-ideal-expert-v3'); |
|
537 | + $integration->set_name('Deutsche Bank - iDEAL Expert (v3)'); |
|
538 | 538 | $integration->product_url = 'https://www.deutschebank.nl/nl/content/producten_en_services_commercial_banking_cash_management_betalen_ideal.html'; |
539 | 539 | $integration->dashboard_url = array( |
540 | 540 | 'test' => 'https://myideal.test.db.com/', |
541 | 541 | 'live' => 'https://myideal.db.com/', |
542 | 542 | ); |
543 | - $integration->provider = 'deutschebank'; |
|
543 | + $integration->provider = 'deutschebank'; |
|
544 | 544 | |
545 | - $integrations[ $integration->get_id() ] = $integration; |
|
545 | + $integrations[$integration->get_id()] = $integration; |
|
546 | 546 | |
547 | 547 | // EMS e-Commerce Gateway. |
548 | 548 | $integration = new Gateways\EMS_ECommerce\Integration(); |
549 | 549 | |
550 | - $integrations[ $integration->get_id() ] = $integration; |
|
550 | + $integrations[$integration->get_id()] = $integration; |
|
551 | 551 | |
552 | 552 | // Fibonacci ORANGE. |
553 | 553 | $integration = new Gateways\Icepay\Integration(); |
554 | - $integration->set_id( 'fibonacciorange' ); |
|
555 | - $integration->set_name( 'Fibonacci ORANGE' ); |
|
554 | + $integration->set_id('fibonacciorange'); |
|
555 | + $integration->set_name('Fibonacci ORANGE'); |
|
556 | 556 | $integration->product_url = 'http://www.fibonacciorange.nl/'; |
557 | 557 | $integration->provider = 'fibonacciorange'; |
558 | 558 | |
559 | - $integrations[ $integration->get_id() ] = $integration; |
|
559 | + $integrations[$integration->get_id()] = $integration; |
|
560 | 560 | |
561 | 561 | // ICEPAY. |
562 | 562 | $integration = new Gateways\Icepay\Integration(); |
563 | 563 | |
564 | - $integrations[ $integration->get_id() ] = $integration; |
|
564 | + $integrations[$integration->get_id()] = $integration; |
|
565 | 565 | |
566 | 566 | // iDEAL Simulator - iDEAL Lite / Basic. |
567 | 567 | $integration = new Gateways\IDeal_Basic\Integration(); |
568 | - $integration->set_id( 'ideal-simulator-ideal-basic' ); |
|
569 | - $integration->set_name( 'iDEAL Simulator - iDEAL Lite / Basic' ); |
|
568 | + $integration->set_id('ideal-simulator-ideal-basic'); |
|
569 | + $integration->set_name('iDEAL Simulator - iDEAL Lite / Basic'); |
|
570 | 570 | $integration->provider = 'ideal-simulator'; |
571 | 571 | |
572 | - $integrations[ $integration->get_id() ] = $integration; |
|
572 | + $integrations[$integration->get_id()] = $integration; |
|
573 | 573 | |
574 | 574 | // iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3). |
575 | 575 | $integration = new Gateways\IDeal_Advanced_V3\Integration(); |
576 | - $integration->set_id( 'ideal-simulator-ideal-advanced-v3' ); |
|
577 | - $integration->set_name( 'iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3)' ); |
|
576 | + $integration->set_id('ideal-simulator-ideal-advanced-v3'); |
|
577 | + $integration->set_name('iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3)'); |
|
578 | 578 | $integration->provider = 'ideal-simulator'; |
579 | 579 | $integration->product_url = 'https://www.ideal-checkout.nl/support/ideal-simulator'; |
580 | 580 | |
581 | - $integrations[ $integration->get_id() ] = $integration; |
|
581 | + $integrations[$integration->get_id()] = $integration; |
|
582 | 582 | |
583 | 583 | // ING - iDEAL Basic. |
584 | 584 | $integration = new Gateways\IDeal_Basic\Integration(); |
585 | - $integration->set_id( 'ing-ideal-basic' ); |
|
586 | - $integration->set_name( 'ING - iDEAL Basic' ); |
|
585 | + $integration->set_id('ing-ideal-basic'); |
|
586 | + $integration->set_name('ING - iDEAL Basic'); |
|
587 | 587 | $integration->provider = 'ing'; |
588 | 588 | $integration->product_url = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/ideal/'; |
589 | 589 | $integration->dashboard_url = array( |
@@ -591,12 +591,12 @@ discard block |
||
591 | 591 | 'live' => 'https://ideal.secure-ing.com/', |
592 | 592 | ); |
593 | 593 | |
594 | - $integrations[ $integration->get_id() ] = $integration; |
|
594 | + $integrations[$integration->get_id()] = $integration; |
|
595 | 595 | |
596 | 596 | // ING - iDEAL Advanced (v3). |
597 | 597 | $integration = new Gateways\IDeal_Advanced_V3\Integration(); |
598 | - $integration->set_id( 'ing-ideal-advanced-v3' ); |
|
599 | - $integration->set_name( 'ING - iDEAL Advanced (v3)' ); |
|
598 | + $integration->set_id('ing-ideal-advanced-v3'); |
|
599 | + $integration->set_name('ING - iDEAL Advanced (v3)'); |
|
600 | 600 | $integration->provider = 'ing'; |
601 | 601 | $integration->product_url = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/ideal/'; |
602 | 602 | $integration->dashboard_url = array( |
@@ -604,98 +604,98 @@ discard block |
||
604 | 604 | 'live' => 'https://ideal.secure-ing.com/', |
605 | 605 | ); |
606 | 606 | |
607 | - $integrations[ $integration->get_id() ] = $integration; |
|
607 | + $integrations[$integration->get_id()] = $integration; |
|
608 | 608 | |
609 | 609 | // ING - Kassa Compleet. |
610 | 610 | $integration = new Gateways\ING_KassaCompleet\Integration(); |
611 | 611 | |
612 | - $integrations[ $integration->get_id() ] = $integration; |
|
612 | + $integrations[$integration->get_id()] = $integration; |
|
613 | 613 | |
614 | 614 | // Mollie. |
615 | 615 | $integration = new Gateways\Mollie\Integration(); |
616 | 616 | |
617 | - $integrations[ $integration->get_id() ] = $integration; |
|
617 | + $integrations[$integration->get_id()] = $integration; |
|
618 | 618 | |
619 | 619 | // Mollie - iDEAL. |
620 | 620 | $integration = new Gateways\Mollie_IDeal\Integration(); |
621 | 621 | |
622 | - $integrations[ $integration->get_id() ] = $integration; |
|
622 | + $integrations[$integration->get_id()] = $integration; |
|
623 | 623 | |
624 | 624 | // Mollie - iDEAL Basic. |
625 | 625 | $integration = new Gateways\IDeal_Basic\Integration(); |
626 | - $integration->set_id( 'mollie-ideal-basic' ); |
|
627 | - $integration->set_name( 'Mollie - iDEAL Basic' ); |
|
626 | + $integration->set_id('mollie-ideal-basic'); |
|
627 | + $integration->set_name('Mollie - iDEAL Basic'); |
|
628 | 628 | $integration->dashboard_url = 'http://www.mollie.nl/beheer/'; |
629 | 629 | $integration->provider = 'mollie'; |
630 | 630 | $integration->deprecated = true; |
631 | 631 | |
632 | - $integrations[ $integration->get_id() ] = $integration; |
|
632 | + $integrations[$integration->get_id()] = $integration; |
|
633 | 633 | |
634 | 634 | // MultiSafepay. |
635 | 635 | $integration = new Gateways\MultiSafepay\Connect\Integration(); |
636 | 636 | |
637 | - $integrations[ $integration->get_id() ] = $integration; |
|
637 | + $integrations[$integration->get_id()] = $integration; |
|
638 | 638 | |
639 | 639 | // Ogone - DirectLink. |
640 | 640 | $integration = new Gateways\Ingenico\DirectLink\Integration(); |
641 | 641 | |
642 | - $integrations[ $integration->get_id() ] = $integration; |
|
642 | + $integrations[$integration->get_id()] = $integration; |
|
643 | 643 | |
644 | 644 | // Ogone - OrderStandard. |
645 | 645 | $integration = new Gateways\Ingenico\OrderStandard\Integration(); |
646 | 646 | |
647 | - $integrations[ $integration->get_id() ] = $integration; |
|
647 | + $integrations[$integration->get_id()] = $integration; |
|
648 | 648 | |
649 | 649 | // OmniKassa. |
650 | 650 | $integration = new Gateways\OmniKassa\Integration(); |
651 | 651 | |
652 | - $integrations[ $integration->get_id() ] = $integration; |
|
652 | + $integrations[$integration->get_id()] = $integration; |
|
653 | 653 | |
654 | 654 | // OmniKassa 2.0. |
655 | 655 | $integration = new Gateways\OmniKassa2\Integration(); |
656 | 656 | |
657 | - $integrations[ $integration->get_id() ] = $integration; |
|
657 | + $integrations[$integration->get_id()] = $integration; |
|
658 | 658 | |
659 | 659 | // Pay.nl. |
660 | 660 | $integration = new Gateways\PayNL\Integration(); |
661 | 661 | |
662 | - $integrations[ $integration->get_id() ] = $integration; |
|
662 | + $integrations[$integration->get_id()] = $integration; |
|
663 | 663 | |
664 | 664 | // Paytor. |
665 | 665 | $integration = new Gateways\Mollie\Integration(); |
666 | - $integration->set_id( 'paytor' ); |
|
667 | - $integration->set_name( 'Paytor' ); |
|
666 | + $integration->set_id('paytor'); |
|
667 | + $integration->set_name('Paytor'); |
|
668 | 668 | $integration->url = 'http://paytor.com/'; |
669 | 669 | $integration->product_url = 'http://paytor.com/'; |
670 | 670 | $integration->provider = 'paytor'; |
671 | 671 | |
672 | - $integrations[ $integration->get_id() ] = $integration; |
|
672 | + $integrations[$integration->get_id()] = $integration; |
|
673 | 673 | |
674 | 674 | // Postcode iDEAL. |
675 | 675 | $integration = new Gateways\IDeal_Advanced_V3\Integration(); |
676 | - $integration->set_id( 'postcode-ideal' ); |
|
677 | - $integration->set_name( 'Postcode iDEAL' ); |
|
676 | + $integration->set_id('postcode-ideal'); |
|
677 | + $integration->set_name('Postcode iDEAL'); |
|
678 | 678 | $integration->provider = 'postcode.nl'; |
679 | 679 | $integration->product_url = 'https://services.postcode.nl/ideal'; |
680 | 680 | $integration->dashboard_url = 'https://services.postcode.nl/ideal'; |
681 | 681 | |
682 | - $integrations[ $integration->get_id() ] = $integration; |
|
682 | + $integrations[$integration->get_id()] = $integration; |
|
683 | 683 | |
684 | 684 | // Qantani (new platform). |
685 | 685 | $integration = new Gateways\Mollie\Integration(); |
686 | - $integration->set_id( 'qantani-mollie' ); |
|
687 | - $integration->set_name( __( 'Qantani (new platform)', 'pronamic_ideal' ) ); |
|
686 | + $integration->set_id('qantani-mollie'); |
|
687 | + $integration->set_name(__('Qantani (new platform)', 'pronamic_ideal')); |
|
688 | 688 | $integration->url = 'https://www.qantani.com/'; |
689 | 689 | $integration->product_url = 'https://www.qantani.com/tarieven/'; |
690 | 690 | $integration->dashboard_url = 'https://www.qantani.eu/'; |
691 | 691 | $integration->provider = 'qantani'; |
692 | 692 | |
693 | - $integrations[ $integration->get_id() ] = $integration; |
|
693 | + $integrations[$integration->get_id()] = $integration; |
|
694 | 694 | |
695 | 695 | // Rabobank - iDEAL Professional (v3). |
696 | 696 | $integration = new Gateways\IDeal_Advanced_V3\Integration(); |
697 | - $integration->set_id( 'rabobank-ideal-professional-v3' ); |
|
698 | - $integration->set_name( 'Rabobank - iDEAL Professional (v3)' ); |
|
697 | + $integration->set_id('rabobank-ideal-professional-v3'); |
|
698 | + $integration->set_name('Rabobank - iDEAL Professional (v3)'); |
|
699 | 699 | $integration->provider = 'rabobank'; |
700 | 700 | $integration->product_url = 'https://www.rabobank.nl/bedrijven/betalen/geld-ontvangen/ideal-professional/'; |
701 | 701 | $integration->dashboard_url = array( |
@@ -703,35 +703,35 @@ discard block |
||
703 | 703 | 'live' => 'https://ideal.rabobank.nl/', |
704 | 704 | ); |
705 | 705 | |
706 | - $integrations[ $integration->get_id() ] = $integration; |
|
706 | + $integrations[$integration->get_id()] = $integration; |
|
707 | 707 | |
708 | 708 | // Sisow. |
709 | 709 | $integration = new Gateways\Sisow\Integration(); |
710 | 710 | |
711 | - $integrations[ $integration->get_id() ] = $integration; |
|
711 | + $integrations[$integration->get_id()] = $integration; |
|
712 | 712 | |
713 | 713 | // Sisow - iDEAL Basic. |
714 | 714 | $integration = new Gateways\IDeal_Basic\Integration(); |
715 | - $integration->set_id( 'sisow-ideal-basic' ); |
|
716 | - $integration->set_name( 'Sisow - iDEAL Basic' ); |
|
715 | + $integration->set_id('sisow-ideal-basic'); |
|
716 | + $integration->set_name('Sisow - iDEAL Basic'); |
|
717 | 717 | $integration->url = 'https://www.sisow.nl/'; |
718 | 718 | $integration->dashboard_url = 'https://www.sisow.nl/Sisow/iDeal/Login.aspx'; |
719 | 719 | $integration->provider = 'sisow'; |
720 | 720 | $integration->deprecated = true; |
721 | 721 | |
722 | - $integrations[ $integration->get_id() ] = $integration; |
|
722 | + $integrations[$integration->get_id()] = $integration; |
|
723 | 723 | |
724 | 724 | // TargetPay. |
725 | 725 | $integration = new Gateways\TargetPay\Integration(); |
726 | 726 | |
727 | - $integrations[ $integration->get_id() ] = $integration; |
|
727 | + $integrations[$integration->get_id()] = $integration; |
|
728 | 728 | |
729 | 729 | // Gateway integrations. |
730 | 730 | $this->gateway_integrations = $integrations; |
731 | 731 | |
732 | 732 | // Register config providers. |
733 | - foreach ( $integrations as $integration ) { |
|
734 | - Core\ConfigProvider::register( $integration->get_id(), $integration->get_config_factory_class() ); |
|
733 | + foreach ($integrations as $integration) { |
|
734 | + Core\ConfigProvider::register($integration->get_id(), $integration->get_config_factory_class()); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
@@ -743,16 +743,16 @@ discard block |
||
743 | 743 | * |
744 | 744 | * @return string |
745 | 745 | */ |
746 | - public function plugin_locale( $locale, $domain ) { |
|
747 | - if ( 'pronamic_ideal' !== $domain ) { |
|
746 | + public function plugin_locale($locale, $domain) { |
|
747 | + if ('pronamic_ideal' !== $domain) { |
|
748 | 748 | return $locale; |
749 | 749 | } |
750 | 750 | |
751 | - if ( 'nl_NL_formal' === $locale ) { |
|
751 | + if ('nl_NL_formal' === $locale) { |
|
752 | 752 | return 'nl_NL'; |
753 | 753 | } |
754 | 754 | |
755 | - if ( 'nl_BE' === $locale ) { |
|
755 | + if ('nl_BE' === $locale) { |
|
756 | 756 | return 'nl_NL'; |
757 | 757 | } |
758 | 758 | |
@@ -766,14 +766,14 @@ discard block |
||
766 | 766 | */ |
767 | 767 | public static function get_payment_states() { |
768 | 768 | return array( |
769 | - 'payment_pending' => _x( 'Pending', 'Payment status', 'pronamic_ideal' ), |
|
770 | - 'payment_processing' => _x( 'Processing', 'Payment status', 'pronamic_ideal' ), |
|
771 | - 'payment_on_hold' => _x( 'On Hold', 'Payment status', 'pronamic_ideal' ), |
|
772 | - 'payment_completed' => _x( 'Completed', 'Payment status', 'pronamic_ideal' ), |
|
773 | - 'payment_cancelled' => _x( 'Cancelled', 'Payment status', 'pronamic_ideal' ), |
|
774 | - 'payment_refunded' => _x( 'Refunded', 'Payment status', 'pronamic_ideal' ), |
|
775 | - 'payment_failed' => _x( 'Failed', 'Payment status', 'pronamic_ideal' ), |
|
776 | - 'payment_expired' => _x( 'Expired', 'Payment status', 'pronamic_ideal' ), |
|
769 | + 'payment_pending' => _x('Pending', 'Payment status', 'pronamic_ideal'), |
|
770 | + 'payment_processing' => _x('Processing', 'Payment status', 'pronamic_ideal'), |
|
771 | + 'payment_on_hold' => _x('On Hold', 'Payment status', 'pronamic_ideal'), |
|
772 | + 'payment_completed' => _x('Completed', 'Payment status', 'pronamic_ideal'), |
|
773 | + 'payment_cancelled' => _x('Cancelled', 'Payment status', 'pronamic_ideal'), |
|
774 | + 'payment_refunded' => _x('Refunded', 'Payment status', 'pronamic_ideal'), |
|
775 | + 'payment_failed' => _x('Failed', 'Payment status', 'pronamic_ideal'), |
|
776 | + 'payment_expired' => _x('Expired', 'Payment status', 'pronamic_ideal'), |
|
777 | 777 | ); |
778 | 778 | } |
779 | 779 | |
@@ -784,12 +784,12 @@ discard block |
||
784 | 784 | */ |
785 | 785 | public static function get_subscription_states() { |
786 | 786 | return array( |
787 | - 'subscr_pending' => _x( 'Pending', 'Subscription status', 'pronamic_ideal' ), |
|
788 | - 'subscr_cancelled' => _x( 'Cancelled', 'Subscription status', 'pronamic_ideal' ), |
|
789 | - 'subscr_expired' => _x( 'Expired', 'Subscription status', 'pronamic_ideal' ), |
|
790 | - 'subscr_failed' => _x( 'Failed', 'Subscription status', 'pronamic_ideal' ), |
|
791 | - 'subscr_active' => _x( 'Active', 'Subscription status', 'pronamic_ideal' ), |
|
792 | - 'subscr_completed' => _x( 'Completed', 'Subscription status', 'pronamic_ideal' ), |
|
787 | + 'subscr_pending' => _x('Pending', 'Subscription status', 'pronamic_ideal'), |
|
788 | + 'subscr_cancelled' => _x('Cancelled', 'Subscription status', 'pronamic_ideal'), |
|
789 | + 'subscr_expired' => _x('Expired', 'Subscription status', 'pronamic_ideal'), |
|
790 | + 'subscr_failed' => _x('Failed', 'Subscription status', 'pronamic_ideal'), |
|
791 | + 'subscr_active' => _x('Active', 'Subscription status', 'pronamic_ideal'), |
|
792 | + 'subscr_completed' => _x('Completed', 'Subscription status', 'pronamic_ideal'), |
|
793 | 793 | ); |
794 | 794 | } |
795 | 795 | |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | * @return string |
800 | 800 | */ |
801 | 801 | public static function get_default_error_message() { |
802 | - return __( 'Something went wrong with the payment. Please try again later or pay another way.', 'pronamic_ideal' ); |
|
802 | + return __('Something went wrong with the payment. Please try again later or pay another way.', 'pronamic_ideal'); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | /** |
@@ -809,22 +809,22 @@ discard block |
||
809 | 809 | * |
810 | 810 | * @return array |
811 | 811 | */ |
812 | - public static function get_config_select_options( $payment_method = null ) { |
|
812 | + public static function get_config_select_options($payment_method = null) { |
|
813 | 813 | $args = array( |
814 | 814 | 'post_type' => 'pronamic_gateway', |
815 | 815 | 'nopaging' => true, |
816 | 816 | ); |
817 | 817 | |
818 | - if ( $payment_method ) { |
|
818 | + if ($payment_method) { |
|
819 | 819 | $gateways = array(); |
820 | 820 | |
821 | - switch ( $payment_method ) { |
|
821 | + switch ($payment_method) { |
|
822 | 822 | case PaymentMethods::ALIPAY: |
823 | - $gateways = array( 'multisafepay-connect' ); |
|
823 | + $gateways = array('multisafepay-connect'); |
|
824 | 824 | |
825 | 825 | break; |
826 | 826 | case PaymentMethods::BUNQ: |
827 | - $gateways = array( 'sisow-ideal' ); |
|
827 | + $gateways = array('sisow-ideal'); |
|
828 | 828 | |
829 | 829 | break; |
830 | 830 | case PaymentMethods::BANCONTACT: |
@@ -899,11 +899,11 @@ discard block |
||
899 | 899 | |
900 | 900 | break; |
901 | 901 | case PaymentMethods::GIROPAY: |
902 | - $gateways = array( 'multisafepay-connect' ); |
|
902 | + $gateways = array('multisafepay-connect'); |
|
903 | 903 | |
904 | 904 | break; |
905 | 905 | case PaymentMethods::IDEALQR: |
906 | - $gateways = array( 'multisafepay-connect' ); |
|
906 | + $gateways = array('multisafepay-connect'); |
|
907 | 907 | |
908 | 908 | break; |
909 | 909 | case PaymentMethods::KBC: |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | |
923 | 923 | break; |
924 | 924 | case PaymentMethods::PAYCONIQ: |
925 | - $gateways = array( 'ing-kassa-compleet' ); |
|
925 | + $gateways = array('ing-kassa-compleet'); |
|
926 | 926 | |
927 | 927 | break; |
928 | 928 | case PaymentMethods::PAYPAL: |
@@ -958,17 +958,17 @@ discard block |
||
958 | 958 | ); |
959 | 959 | } |
960 | 960 | |
961 | - $query = new WP_Query( $args ); |
|
961 | + $query = new WP_Query($args); |
|
962 | 962 | |
963 | - $options = array( __( '— Select Configuration —', 'pronamic_ideal' ) ); |
|
963 | + $options = array(__('— Select Configuration —', 'pronamic_ideal')); |
|
964 | 964 | |
965 | - foreach ( $query->posts as $post ) { |
|
965 | + foreach ($query->posts as $post) { |
|
966 | 966 | $id = $post->ID; |
967 | 967 | |
968 | - $options[ $id ] = sprintf( |
|
968 | + $options[$id] = sprintf( |
|
969 | 969 | '%s (%s)', |
970 | - get_the_title( $id ), |
|
971 | - get_post_meta( $id, '_pronamic_gateway_mode', true ) |
|
970 | + get_the_title($id), |
|
971 | + get_post_meta($id, '_pronamic_gateway_mode', true) |
|
972 | 972 | ); |
973 | 973 | } |
974 | 974 | |
@@ -981,9 +981,9 @@ discard block |
||
981 | 981 | * @since unreleased |
982 | 982 | */ |
983 | 983 | public static function maybe_set_active_payment_methods() { |
984 | - $active_methods = get_option( 'pronamic_pay_active_payment_methods' ); |
|
984 | + $active_methods = get_option('pronamic_pay_active_payment_methods'); |
|
985 | 985 | |
986 | - if ( is_array( $active_methods ) ) { |
|
986 | + if (is_array($active_methods)) { |
|
987 | 987 | return; |
988 | 988 | } |
989 | 989 | |
@@ -995,12 +995,12 @@ discard block |
||
995 | 995 | * |
996 | 996 | * @param array $errors An array with errors to render. |
997 | 997 | */ |
998 | - public static function render_errors( $errors = array() ) { |
|
999 | - if ( ! is_array( $errors ) ) { |
|
1000 | - $errors = array( $errors ); |
|
998 | + public static function render_errors($errors = array()) { |
|
999 | + if ( ! is_array($errors)) { |
|
1000 | + $errors = array($errors); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | - foreach ( $errors as $error ) { |
|
1003 | + foreach ($errors as $error) { |
|
1004 | 1004 | include Plugin::$dirname . '/views/error.php'; |
1005 | 1005 | } |
1006 | 1006 | } |
@@ -1012,14 +1012,14 @@ discard block |
||
1012 | 1012 | * |
1013 | 1013 | * @return Gateway |
1014 | 1014 | */ |
1015 | - public static function get_gateway( $config_id ) { |
|
1016 | - $gateway_id = get_post_meta( $config_id, '_pronamic_gateway_id', true ); |
|
1017 | - $mode = get_post_meta( $config_id, '_pronamic_gateway_mode', true ); |
|
1018 | - $is_utf8 = strcasecmp( get_bloginfo( 'charset' ), 'UTF-8' ) === 0; |
|
1015 | + public static function get_gateway($config_id) { |
|
1016 | + $gateway_id = get_post_meta($config_id, '_pronamic_gateway_id', true); |
|
1017 | + $mode = get_post_meta($config_id, '_pronamic_gateway_mode', true); |
|
1018 | + $is_utf8 = strcasecmp(get_bloginfo('charset'), 'UTF-8') === 0; |
|
1019 | 1019 | |
1020 | - $config = Core\ConfigProvider::get_config( $gateway_id, $config_id ); |
|
1020 | + $config = Core\ConfigProvider::get_config($gateway_id, $config_id); |
|
1021 | 1021 | |
1022 | - switch ( $gateway_id ) { |
|
1022 | + switch ($gateway_id) { |
|
1023 | 1023 | case 'abnamro-ideal-easy': |
1024 | 1024 | case 'abnamro-ideal-only-kassa': |
1025 | 1025 | case 'abnamro-internetkassa': |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | case 'abnamro-ideal-zelfbouw-v3': |
1034 | 1034 | $config->payment_server_url = 'https://abnamro.ideal-payment.de/ideal/iDEALv3'; |
1035 | 1035 | |
1036 | - if ( 'test' === $mode ) { |
|
1036 | + if ('test' === $mode) { |
|
1037 | 1037 | $config->payment_server_url = 'https://abnamro-test.ideal-payment.de/ideal/iDEALv3'; |
1038 | 1038 | } |
1039 | 1039 | |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | case 'ing-ideal-basic': |
1060 | 1060 | $config->url = 'https://ideal.secure-ing.com/ideal/mpiPayInitIng.do'; |
1061 | 1061 | |
1062 | - if ( 'test' === $mode ) { |
|
1062 | + if ('test' === $mode) { |
|
1063 | 1063 | $config->url = 'https://idealtest.secure-ing.com/ideal/mpiPayInitIng.do'; |
1064 | 1064 | } |
1065 | 1065 | |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | case 'ing-ideal-advanced-v3': |
1068 | 1068 | $config->payment_server_url = 'https://ideal.secure-ing.com/ideal/iDEALv3'; |
1069 | 1069 | |
1070 | - if ( 'test' === $mode ) { |
|
1070 | + if ('test' === $mode) { |
|
1071 | 1071 | $config->payment_server_url = 'https://idealtest.secure-ing.com/ideal/iDEALv3'; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | case 'mollie-ideal-basic': |
1078 | 1078 | $config->url = 'https://secure.mollie.nl/xml/idealAcquirer/lite/'; |
1079 | 1079 | |
1080 | - if ( 'test' === $mode ) { |
|
1080 | + if ('test' === $mode) { |
|
1081 | 1081 | $config->url = 'https://secure.mollie.nl/xml/idealAcquirer/testmode/lite/'; |
1082 | 1082 | } |
1083 | 1083 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | case 'postcode-ideal': |
1086 | 1086 | $config->payment_server_url = 'https://ideal.postcode.nl/ideal'; |
1087 | 1087 | |
1088 | - if ( 'test' === $mode ) { |
|
1088 | + if ('test' === $mode) { |
|
1089 | 1089 | $config->payment_server_url = 'https://ideal-test.postcode.nl/ideal'; |
1090 | 1090 | } |
1091 | 1091 | |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | case 'rabobank-ideal-professional-v3': |
1096 | 1096 | $config->payment_server_url = 'https://ideal.rabobank.nl/ideal/iDEALv3'; |
1097 | 1097 | |
1098 | - if ( 'test' === $mode ) { |
|
1098 | + if ('test' === $mode) { |
|
1099 | 1099 | $config->payment_server_url = 'https://idealtest.rabobank.nl/ideal/iDEALv3'; |
1100 | 1100 | } |
1101 | 1101 | |
@@ -1105,14 +1105,14 @@ discard block |
||
1105 | 1105 | case 'sisow-ideal-basic': |
1106 | 1106 | $config->url = 'https://www.sisow.nl/Sisow/iDeal/IssuerHandler.ashx'; |
1107 | 1107 | |
1108 | - if ( 'test' === $mode ) { |
|
1108 | + if ('test' === $mode) { |
|
1109 | 1109 | $config->url = 'https://www.sisow.nl/Sisow/iDeal/IssuerHandler.ashx/test'; |
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | break; |
1113 | 1113 | } |
1114 | 1114 | |
1115 | - $gateway = Core\GatewayFactory::create( $config ); |
|
1115 | + $gateway = Core\GatewayFactory::create($config); |
|
1116 | 1116 | |
1117 | 1117 | return $gateway; |
1118 | 1118 | } |
@@ -1127,13 +1127,13 @@ discard block |
||
1127 | 1127 | * |
1128 | 1128 | * @return Payment |
1129 | 1129 | */ |
1130 | - public static function start( $config_id, Gateway $gateway, PaymentDataInterface $data, $payment_method = null ) { |
|
1130 | + public static function start($config_id, Gateway $gateway, PaymentDataInterface $data, $payment_method = null) { |
|
1131 | 1131 | $payment = new Payments\Payment(); |
1132 | 1132 | |
1133 | - $payment->title = sprintf( __( 'Payment for %s', 'pronamic_ideal' ), $data->get_title() ); |
|
1133 | + $payment->title = sprintf(__('Payment for %s', 'pronamic_ideal'), $data->get_title()); |
|
1134 | 1134 | $payment->user_id = $data->get_user_id(); |
1135 | 1135 | $payment->config_id = $config_id; |
1136 | - $payment->key = uniqid( 'pay_' ); |
|
1136 | + $payment->key = uniqid('pay_'); |
|
1137 | 1137 | $payment->order_id = $data->get_order_id(); |
1138 | 1138 | $payment->currency = $data->get_currency(); |
1139 | 1139 | $payment->amount = $data->get_amount(); |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | $payment->email = $data->get_email(); |
1147 | 1147 | $payment->status = null; |
1148 | 1148 | $payment->method = $payment_method; |
1149 | - $payment->issuer = $data->get_issuer( $payment_method ); |
|
1149 | + $payment->issuer = $data->get_issuer($payment_method); |
|
1150 | 1150 | $payment->first_name = $data->get_first_name(); |
1151 | 1151 | $payment->last_name = $data->get_last_name(); |
1152 | 1152 | $payment->customer_name = $data->get_customer_name(); |
@@ -1159,9 +1159,9 @@ discard block |
||
1159 | 1159 | $payment->recurring = $data->get_recurring(); |
1160 | 1160 | $payment->subscription = $data->get_subscription(); |
1161 | 1161 | $payment->subscription_id = $data->get_subscription_id(); |
1162 | - $payment->set_credit_card( $data->get_credit_card() ); |
|
1162 | + $payment->set_credit_card($data->get_credit_card()); |
|
1163 | 1163 | |
1164 | - return self::start_payment( $payment, $gateway ); |
|
1164 | + return self::start_payment($payment, $gateway); |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | /** |
@@ -1172,47 +1172,47 @@ discard block |
||
1172 | 1172 | * |
1173 | 1173 | * @return Payment |
1174 | 1174 | */ |
1175 | - public static function start_payment( Payment $payment, Gateway $gateway ) { |
|
1175 | + public static function start_payment(Payment $payment, Gateway $gateway) { |
|
1176 | 1176 | global $pronamic_ideal; |
1177 | 1177 | |
1178 | - $pronamic_ideal->payments_data_store->create( $payment ); |
|
1178 | + $pronamic_ideal->payments_data_store->create($payment); |
|
1179 | 1179 | |
1180 | 1180 | // Start payment at the gateway. |
1181 | - $result = $gateway->start( $payment ); |
|
1181 | + $result = $gateway->start($payment); |
|
1182 | 1182 | |
1183 | 1183 | // If result is false the payment failed to start. |
1184 | - if ( false === $result ) { |
|
1184 | + if (false === $result) { |
|
1185 | 1185 | // If payment failed to start we directly update the payment status to 'failure'. |
1186 | - $payment->set_status( Core\Statuses::FAILURE ); |
|
1186 | + $payment->set_status(Core\Statuses::FAILURE); |
|
1187 | 1187 | |
1188 | 1188 | // Check if there is a subscription attached to the payment. |
1189 | 1189 | $subscription = $payment->get_subscription(); |
1190 | 1190 | |
1191 | - if ( $subscription ) { |
|
1192 | - if ( ! $payment->get_recurring() ) { |
|
1191 | + if ($subscription) { |
|
1192 | + if ( ! $payment->get_recurring()) { |
|
1193 | 1193 | // First payment. |
1194 | 1194 | // Cancel subscription to prevent unwanted recurring payments in the future, |
1195 | 1195 | // when a valid customer ID might be set for the user. |
1196 | - $subscription->update_status( Core\Statuses::CANCELLED ); |
|
1196 | + $subscription->update_status(Core\Statuses::CANCELLED); |
|
1197 | 1197 | } else { |
1198 | - $subscription->set_status( Core\Statuses::FAILURE ); |
|
1198 | + $subscription->set_status(Core\Statuses::FAILURE); |
|
1199 | 1199 | } |
1200 | 1200 | |
1201 | - $pronamic_ideal->subscriptions_data_store->update( $subscription ); |
|
1201 | + $pronamic_ideal->subscriptions_data_store->update($subscription); |
|
1202 | 1202 | } |
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | // Check if the gateway has an error. |
1206 | - if ( $gateway->has_error() ) { |
|
1207 | - foreach ( $gateway->error->get_error_codes() as $code ) { |
|
1208 | - $payment->add_note( sprintf( '%s: %s', $code, $gateway->error->get_error_message( $code ) ) ); |
|
1206 | + if ($gateway->has_error()) { |
|
1207 | + foreach ($gateway->error->get_error_codes() as $code) { |
|
1208 | + $payment->add_note(sprintf('%s: %s', $code, $gateway->error->get_error_message($code))); |
|
1209 | 1209 | } |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - $pronamic_ideal->payments_data_store->update( $payment ); |
|
1212 | + $pronamic_ideal->payments_data_store->update($payment); |
|
1213 | 1213 | |
1214 | - if ( $gateway->supports( 'payment_status_request' ) ) { |
|
1215 | - Payments\StatusChecker::schedule_event( $payment ); |
|
1214 | + if ($gateway->supports('payment_status_request')) { |
|
1215 | + Payments\StatusChecker::schedule_event($payment); |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | return $payment; |
@@ -1227,17 +1227,17 @@ discard block |
||
1227 | 1227 | $return = array(); |
1228 | 1228 | |
1229 | 1229 | $pages = array( |
1230 | - 'completed' => __( 'Completed', 'pronamic_ideal' ), |
|
1231 | - 'cancel' => __( 'Canceled', 'pronamic_ideal' ), |
|
1232 | - 'expired' => __( 'Expired', 'pronamic_ideal' ), |
|
1233 | - 'error' => __( 'Error', 'pronamic_ideal' ), |
|
1234 | - 'unknown' => __( 'Unknown', 'pronamic_ideal' ), |
|
1230 | + 'completed' => __('Completed', 'pronamic_ideal'), |
|
1231 | + 'cancel' => __('Canceled', 'pronamic_ideal'), |
|
1232 | + 'expired' => __('Expired', 'pronamic_ideal'), |
|
1233 | + 'error' => __('Error', 'pronamic_ideal'), |
|
1234 | + 'unknown' => __('Unknown', 'pronamic_ideal'), |
|
1235 | 1235 | ); |
1236 | 1236 | |
1237 | - foreach ( $pages as $key => $label ) { |
|
1238 | - $id = sprintf( 'pronamic_pay_%s_page_id', $key ); |
|
1237 | + foreach ($pages as $key => $label) { |
|
1238 | + $id = sprintf('pronamic_pay_%s_page_id', $key); |
|
1239 | 1239 | |
1240 | - $return[ $id ] = $label; |
|
1240 | + $return[$id] = $label; |
|
1241 | 1241 | } |
1242 | 1242 | |
1243 | 1243 | return $return; |