@@ -136,13 +136,13 @@ |
||
| 136 | 136 | * @param mixed $default |
| 137 | 137 | * @return string |
| 138 | 138 | */ |
| 139 | - public static function transform( $payment_method, $default = null ) { |
|
| 140 | - if ( ! is_scalar( $payment_method ) ) { |
|
| 139 | + public static function transform($payment_method, $default = null) { |
|
| 140 | + if ( ! is_scalar($payment_method)) { |
|
| 141 | 141 | return null; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if ( isset( self::$map[ $payment_method ] ) ) { |
|
| 145 | - return self::$map[ $payment_method ]; |
|
| 144 | + if (isset(self::$map[$payment_method])) { |
|
| 145 | + return self::$map[$payment_method]; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return $default; |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | class Listener { |
| 19 | 19 | public static function listen() { |
| 20 | - if ( filter_has_var( INPUT_GET, 'buckaroo_push' ) ) { |
|
| 21 | - $method = Server::get( 'REQUEST_METHOD', FILTER_SANITIZE_STRING ); |
|
| 20 | + if (filter_has_var(INPUT_GET, 'buckaroo_push')) { |
|
| 21 | + $method = Server::get('REQUEST_METHOD', FILTER_SANITIZE_STRING); |
|
| 22 | 22 | |
| 23 | 23 | $data = array(); |
| 24 | 24 | |
| 25 | - switch ( $method ) { |
|
| 25 | + switch ($method) { |
|
| 26 | 26 | case 'GET': |
| 27 | 27 | $data = $_GET; // WPCS: CSRF OK |
| 28 | 28 | |
@@ -33,37 +33,37 @@ discard block |
||
| 33 | 33 | break; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $data = array_change_key_case( $data, CASE_LOWER ); |
|
| 36 | + $data = array_change_key_case($data, CASE_LOWER); |
|
| 37 | 37 | |
| 38 | 38 | $payment_id = null; |
| 39 | 39 | |
| 40 | - if ( isset( |
|
| 41 | - $data[ Parameters::ADD_PRONAMIC_PAYMENT_ID ], |
|
| 42 | - $data[ Parameters::STATUS_CODE ] |
|
| 43 | - ) ) { |
|
| 44 | - $payment_id = $data[ Parameters::ADD_PRONAMIC_PAYMENT_ID ]; |
|
| 45 | - } elseif ( isset( |
|
| 46 | - $data[ Parameters::INVOICE_NUMBER ], |
|
| 47 | - $data[ Parameters::STATUS_CODE ] |
|
| 48 | - ) ) { |
|
| 40 | + if (isset( |
|
| 41 | + $data[Parameters::ADD_PRONAMIC_PAYMENT_ID], |
|
| 42 | + $data[Parameters::STATUS_CODE] |
|
| 43 | + )) { |
|
| 44 | + $payment_id = $data[Parameters::ADD_PRONAMIC_PAYMENT_ID]; |
|
| 45 | + } elseif (isset( |
|
| 46 | + $data[Parameters::INVOICE_NUMBER], |
|
| 47 | + $data[Parameters::STATUS_CODE] |
|
| 48 | + )) { |
|
| 49 | 49 | // Fallback for payments started with plugin version <= 4.5.5 |
| 50 | - $payment_id = $data[ Parameters::INVOICE_NUMBER ]; |
|
| 50 | + $payment_id = $data[Parameters::INVOICE_NUMBER]; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ( $payment_id ) { |
|
| 54 | - $payment = get_pronamic_payment( $payment_id ); |
|
| 53 | + if ($payment_id) { |
|
| 54 | + $payment = get_pronamic_payment($payment_id); |
|
| 55 | 55 | |
| 56 | 56 | // Add note. |
| 57 | 57 | $note = sprintf( |
| 58 | 58 | /* translators: %s: Buckaroo */ |
| 59 | - __( 'Webhook requested by %s.', 'pronamic_ideal' ), |
|
| 60 | - __( 'Buckaroo', 'pronamic_ideal' ) |
|
| 59 | + __('Webhook requested by %s.', 'pronamic_ideal'), |
|
| 60 | + __('Buckaroo', 'pronamic_ideal') |
|
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - $payment->add_note( $note ); |
|
| 63 | + $payment->add_note($note); |
|
| 64 | 64 | |
| 65 | 65 | // Update payment. |
| 66 | - Plugin::update_payment( $payment ); |
|
| 66 | + Plugin::update_payment($payment); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * Constructs and initialize a iDEAL kassa object |
| 190 | 190 | */ |
| 191 | 191 | public function __construct() { |
| 192 | - $this->set_payment_server_url( self::GATEWAY_URL ); |
|
| 192 | + $this->set_payment_server_url(self::GATEWAY_URL); |
|
| 193 | 193 | |
| 194 | 194 | $this->requested_services = array(); |
| 195 | 195 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @param string $url an URL |
| 220 | 220 | */ |
| 221 | - public function set_payment_server_url( $url ) { |
|
| 221 | + public function set_payment_server_url($url) { |
|
| 222 | 222 | $this->payment_server_url = $url; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | return $this->website_key; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - public function set_website_key( $website_key ) { |
|
| 229 | + public function set_website_key($website_key) { |
|
| 230 | 230 | $this->website_key = $website_key; |
| 231 | 231 | } |
| 232 | 232 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | return $this->secret_key; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - public function set_secret_key( $secret_key ) { |
|
| 237 | + public function set_secret_key($secret_key) { |
|
| 238 | 238 | $this->secret_key = $secret_key; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | return $this->payment_method; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - public function set_payment_method( $payment_method ) { |
|
| 245 | + public function set_payment_method($payment_method) { |
|
| 246 | 246 | $this->payment_method = $payment_method; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @param string $issuer |
| 265 | 265 | */ |
| 266 | - public function set_ideal_issuer( $issuer ) { |
|
| 266 | + public function set_ideal_issuer($issuer) { |
|
| 267 | 267 | $this->ideal_issuer = $issuer; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | return $this->requested_services; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - public function add_requested_service( $service ) { |
|
| 274 | + public function add_requested_service($service) { |
|
| 275 | 275 | $this->requested_services[] = $service; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | return $this->excluded_services; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - public function set_excluded_services( $service ) { |
|
| 282 | + public function set_excluded_services($service) { |
|
| 283 | 283 | $this->excluded_services = $service; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | return $this->culture; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - public function set_culture( $culture ) { |
|
| 290 | + public function set_culture($culture) { |
|
| 291 | 291 | $this->culture = $culture; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | return $this->currency; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - public function set_currency( $currency ) { |
|
| 298 | + public function set_currency($currency) { |
|
| 299 | 299 | $this->currency = $currency; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | return $this->invoice_number; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - public function set_invoice_number( $invoice_number ) { |
|
| 306 | + public function set_invoice_number($invoice_number) { |
|
| 307 | 307 | $this->invoice_number = $invoice_number; |
| 308 | 308 | } |
| 309 | 309 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | return $this->description; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - public function set_description( $description ) { |
|
| 314 | + public function set_description($description) { |
|
| 315 | 315 | $this->description = $description; |
| 316 | 316 | } |
| 317 | 317 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | return $this->amount; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - public function set_amount( $amount ) { |
|
| 322 | + public function set_amount($amount) { |
|
| 323 | 323 | $this->amount = $amount; |
| 324 | 324 | } |
| 325 | 325 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * |
| 338 | 338 | * @param string $url |
| 339 | 339 | */ |
| 340 | - public function set_return_url( $url ) { |
|
| 340 | + public function set_return_url($url) { |
|
| 341 | 341 | $this->return_url = $url; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @param string $url |
| 357 | 357 | */ |
| 358 | - public function set_return_reject_url( $url ) { |
|
| 358 | + public function set_return_reject_url($url) { |
|
| 359 | 359 | $this->return_reject_url = $url; |
| 360 | 360 | } |
| 361 | 361 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * |
| 374 | 374 | * @param string $url |
| 375 | 375 | */ |
| 376 | - public function set_return_error_url( $url ) { |
|
| 376 | + public function set_return_error_url($url) { |
|
| 377 | 377 | $this->return_error_url = $url; |
| 378 | 378 | } |
| 379 | 379 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | * |
| 392 | 392 | * @param string $url |
| 393 | 393 | */ |
| 394 | - public function set_return_cancel_url( $url ) { |
|
| 394 | + public function set_return_cancel_url($url) { |
|
| 395 | 395 | $this->return_cancel_url = $url; |
| 396 | 396 | } |
| 397 | 397 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | * |
| 410 | 410 | * @param string $url |
| 411 | 411 | */ |
| 412 | - public function set_push_url( $url ) { |
|
| 412 | + public function set_push_url($url) { |
|
| 413 | 413 | $this->push_url = $url; |
| 414 | 414 | } |
| 415 | 415 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * |
| 428 | 428 | * @param string $payment_id |
| 429 | 429 | */ |
| 430 | - public function set_payment_id( $payment_id ) { |
|
| 430 | + public function set_payment_id($payment_id) { |
|
| 431 | 431 | $this->payment_id = $payment_id; |
| 432 | 432 | } |
| 433 | 433 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | public function get_issuers() { |
| 442 | 442 | $issuers = array(); |
| 443 | 443 | |
| 444 | - $url = add_query_arg( 'op', 'TransactionRequestSpecification', self::GATEWAY_NVP_TEST_URL ); |
|
| 444 | + $url = add_query_arg('op', 'TransactionRequestSpecification', self::GATEWAY_NVP_TEST_URL); |
|
| 445 | 445 | |
| 446 | 446 | $data = array( |
| 447 | 447 | 'brq_websitekey' => $this->get_website_key(), |
@@ -449,72 +449,72 @@ discard block |
||
| 449 | 449 | 'brq_latestversiononly' => 'True', |
| 450 | 450 | ); |
| 451 | 451 | |
| 452 | - $signature = Security::create_signature( $data, $this->get_secret_key() ); |
|
| 452 | + $signature = Security::create_signature($data, $this->get_secret_key()); |
|
| 453 | 453 | |
| 454 | - $data[ Parameters::SIGNATURE ] = $signature; |
|
| 454 | + $data[Parameters::SIGNATURE] = $signature; |
|
| 455 | 455 | |
| 456 | - $result = wp_remote_post( $url, array( |
|
| 457 | - 'body' => http_build_query( $data ), |
|
| 458 | - ) ); |
|
| 456 | + $result = wp_remote_post($url, array( |
|
| 457 | + 'body' => http_build_query($data), |
|
| 458 | + )); |
|
| 459 | 459 | |
| 460 | - $body = wp_remote_retrieve_body( $result ); |
|
| 460 | + $body = wp_remote_retrieve_body($result); |
|
| 461 | 461 | |
| 462 | - wp_parse_str( $body, $data ); |
|
| 462 | + wp_parse_str($body, $data); |
|
| 463 | 463 | |
| 464 | - $data = Util::transform_flat_response( $data ); |
|
| 464 | + $data = Util::transform_flat_response($data); |
|
| 465 | 465 | |
| 466 | - $error_msg = __( 'Unable to retrieve issuers from Buckaroo.', 'pronamic_ideal' ); |
|
| 466 | + $error_msg = __('Unable to retrieve issuers from Buckaroo.', 'pronamic_ideal'); |
|
| 467 | 467 | |
| 468 | - if ( 200 !== wp_remote_retrieve_response_code( $result ) ) { |
|
| 469 | - $this->error = new WP_Error( 'buckaroo_error', $error_msg, $data ); |
|
| 468 | + if (200 !== wp_remote_retrieve_response_code($result)) { |
|
| 469 | + $this->error = new WP_Error('buckaroo_error', $error_msg, $data); |
|
| 470 | 470 | |
| 471 | 471 | return $issuers; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - if ( isset( $data['BRQ_APIRESULT'] ) && 'Fail' === $data['BRQ_APIRESULT'] ) { |
|
| 475 | - if ( isset( $data['BRQ_APIERRORMESSAGE'] ) ) { |
|
| 476 | - $error_msg = sprintf( '%s %s', $error_msg, $data['BRQ_APIERRORMESSAGE'] ); |
|
| 474 | + if (isset($data['BRQ_APIRESULT']) && 'Fail' === $data['BRQ_APIRESULT']) { |
|
| 475 | + if (isset($data['BRQ_APIERRORMESSAGE'])) { |
|
| 476 | + $error_msg = sprintf('%s %s', $error_msg, $data['BRQ_APIERRORMESSAGE']); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - $this->error = new WP_Error( 'buckaroo_error', $error_msg, $data ); |
|
| 479 | + $this->error = new WP_Error('buckaroo_error', $error_msg, $data); |
|
| 480 | 480 | |
| 481 | 481 | return $issuers; |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | - if ( ! isset( $data['BRQ_SERVICES'] ) ) { |
|
| 484 | + if ( ! isset($data['BRQ_SERVICES'])) { |
|
| 485 | 485 | return $issuers; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - foreach ( $data['BRQ_SERVICES'] as $service ) { |
|
| 489 | - if ( ! isset( $service['NAME'], $service['VERSION'], $service['ACTIONDESCRIPTION'] ) ) { |
|
| 488 | + foreach ($data['BRQ_SERVICES'] as $service) { |
|
| 489 | + if ( ! isset($service['NAME'], $service['VERSION'], $service['ACTIONDESCRIPTION'])) { |
|
| 490 | 490 | return $issuers; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - if ( PaymentMethods::IDEAL !== $service['NAME'] ) { |
|
| 493 | + if (PaymentMethods::IDEAL !== $service['NAME']) { |
|
| 494 | 494 | continue; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - foreach ( $service['ACTIONDESCRIPTION'] as $action ) { |
|
| 498 | - if ( ! isset( $action['NAME'], $action['REQUESTPARAMETERS'] ) ) { |
|
| 497 | + foreach ($service['ACTIONDESCRIPTION'] as $action) { |
|
| 498 | + if ( ! isset($action['NAME'], $action['REQUESTPARAMETERS'])) { |
|
| 499 | 499 | return $issuers; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - if ( 'Pay' !== $action['NAME'] ) { |
|
| 502 | + if ('Pay' !== $action['NAME']) { |
|
| 503 | 503 | continue; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - foreach ( $action['REQUESTPARAMETERS'] as $parameter ) { |
|
| 506 | + foreach ($action['REQUESTPARAMETERS'] as $parameter) { |
|
| 507 | 507 | |
| 508 | - if ( ! isset( $parameter['NAME'], $parameter['LISTITEMDESCRIPTION'] ) ) { |
|
| 508 | + if ( ! isset($parameter['NAME'], $parameter['LISTITEMDESCRIPTION'])) { |
|
| 509 | 509 | return $issuers; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if ( 'issuer' !== $parameter['NAME'] ) { |
|
| 512 | + if ('issuer' !== $parameter['NAME']) { |
|
| 513 | 513 | continue; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - foreach ( $parameter['LISTITEMDESCRIPTION'] as $issuer ) { |
|
| 517 | - $issuers[ $issuer['VALUE'] ] = $issuer['DESCRIPTION']; |
|
| 516 | + foreach ($parameter['LISTITEMDESCRIPTION'] as $issuer) { |
|
| 517 | + $issuers[$issuer['VALUE']] = $issuer['DESCRIPTION']; |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | break; |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | Parameters::ADD_PRONAMIC_PAYMENT_ID => $this->get_payment_id(), |
| 537 | 537 | Parameters::WEBSITE_KEY => $this->get_website_key(), |
| 538 | 538 | Parameters::INVOICE_NUMBER => $this->get_invoice_number(), |
| 539 | - Parameters::AMOUNT => number_format( $this->get_amount(), 2, '.', '' ), |
|
| 539 | + Parameters::AMOUNT => number_format($this->get_amount(), 2, '.', ''), |
|
| 540 | 540 | Parameters::CURRENCY => $this->get_currency(), |
| 541 | 541 | Parameters::CULTURE => $this->get_culture(), |
| 542 | 542 | Parameters::DESCRIPTION => $this->get_description(), |
@@ -547,14 +547,14 @@ discard block |
||
| 547 | 547 | Parameters::RETURN_CANCEL_URL => $this->get_return_cancel_url(), |
| 548 | 548 | Parameters::PUSH_URL => $this->get_push_url(), |
| 549 | 549 | Parameters::PUSH_FAILURE_URL => $this->get_push_url(), |
| 550 | - Parameters::REQUESTED_SERVICES => implode( ',', $this->get_requested_services() ), |
|
| 550 | + Parameters::REQUESTED_SERVICES => implode(',', $this->get_requested_services()), |
|
| 551 | 551 | Parameters::EXCLUDED_SERVICES => $this->get_excluded_services(), |
| 552 | 552 | Parameters::IDEAL_ISSUER => $this->get_ideal_issuer(), |
| 553 | 553 | ); |
| 554 | 554 | |
| 555 | - $signature = Security::create_signature( $data, $this->get_secret_key() ); |
|
| 555 | + $signature = Security::create_signature($data, $this->get_secret_key()); |
|
| 556 | 556 | |
| 557 | - $data[ Parameters::SIGNATURE ] = $signature; |
|
| 557 | + $data[Parameters::SIGNATURE] = $signature; |
|
| 558 | 558 | |
| 559 | 559 | return $data; |
| 560 | 560 | } |
@@ -562,17 +562,17 @@ discard block |
||
| 562 | 562 | /** |
| 563 | 563 | * Verify request Buckaroo |
| 564 | 564 | */ |
| 565 | - public function verify_request( $data ) { |
|
| 565 | + public function verify_request($data) { |
|
| 566 | 566 | $result = false; |
| 567 | 567 | |
| 568 | - $signature = Security::get_signature( $data ); |
|
| 568 | + $signature = Security::get_signature($data); |
|
| 569 | 569 | |
| 570 | - $signature_check = Security::create_signature( $data, $this->get_secret_key() ); |
|
| 570 | + $signature_check = Security::create_signature($data, $this->get_secret_key()); |
|
| 571 | 571 | |
| 572 | - if ( 0 === strcasecmp( $signature, $signature_check ) ) { |
|
| 573 | - $data = array_change_key_case( $data, CASE_LOWER ); |
|
| 572 | + if (0 === strcasecmp($signature, $signature_check)) { |
|
| 573 | + $data = array_change_key_case($data, CASE_LOWER); |
|
| 574 | 574 | |
| 575 | - $result = filter_var_array( $data, array( |
|
| 575 | + $result = filter_var_array($data, array( |
|
| 576 | 576 | Parameters::ADD_PRONAMIC_PAYMENT_ID => FILTER_SANITIZE_STRING, |
| 577 | 577 | Parameters::PAYMENT => FILTER_SANITIZE_STRING, |
| 578 | 578 | Parameters::PAYMENT_METHOD => FILTER_SANITIZE_STRING, |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | Parameters::SERVICE_IDEAL_CONSUMER_IBAN => FILTER_SANITIZE_STRING, |
| 589 | 589 | Parameters::SERVICE_IDEAL_CONSUMER_BIC => FILTER_SANITIZE_STRING, |
| 590 | 590 | Parameters::TRANSACTIONS => FILTER_SANITIZE_STRING, |
| 591 | - ) ); |
|
| 591 | + )); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | return $result; |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param Config $config |
| 31 | 31 | */ |
| 32 | - public function __construct( Config $config ) { |
|
| 33 | - parent::__construct( $config ); |
|
| 32 | + public function __construct(Config $config) { |
|
| 33 | + parent::__construct($config); |
|
| 34 | 34 | |
| 35 | - $this->set_method( Gateway::METHOD_HTML_FORM ); |
|
| 36 | - $this->set_has_feedback( true ); |
|
| 37 | - $this->set_amount_minimum( 0.01 ); |
|
| 38 | - $this->set_slug( self::SLUG ); |
|
| 35 | + $this->set_method(Gateway::METHOD_HTML_FORM); |
|
| 36 | + $this->set_has_feedback(true); |
|
| 37 | + $this->set_amount_minimum(0.01); |
|
| 38 | + $this->set_slug(self::SLUG); |
|
| 39 | 39 | |
| 40 | 40 | $this->client = new Client(); |
| 41 | - $this->client->set_website_key( $config->website_key ); |
|
| 42 | - $this->client->set_secret_key( $config->secret_key ); |
|
| 43 | - $this->client->set_excluded_services( $config->excluded_services ); |
|
| 44 | - $this->client->set_invoice_number( $config->invoice_number ); |
|
| 45 | - $this->client->set_push_url( add_query_arg( 'buckaroo_push', '', home_url( '/' ) ) ); |
|
| 46 | - |
|
| 47 | - if ( 'test' === $config->mode ) { |
|
| 48 | - $this->client->set_payment_server_url( Client::GATEWAY_TEST_URL ); |
|
| 41 | + $this->client->set_website_key($config->website_key); |
|
| 42 | + $this->client->set_secret_key($config->secret_key); |
|
| 43 | + $this->client->set_excluded_services($config->excluded_services); |
|
| 44 | + $this->client->set_invoice_number($config->invoice_number); |
|
| 45 | + $this->client->set_push_url(add_query_arg('buckaroo_push', '', home_url('/'))); |
|
| 46 | + |
|
| 47 | + if ('test' === $config->mode) { |
|
| 48 | + $this->client->set_payment_server_url(Client::GATEWAY_TEST_URL); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $result = $this->client->get_issuers(); |
| 62 | 62 | |
| 63 | - if ( $result ) { |
|
| 63 | + if ($result) { |
|
| 64 | 64 | $groups[] = array( |
| 65 | 65 | 'options' => $result, |
| 66 | 66 | ); |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | * @return array |
| 78 | 78 | */ |
| 79 | 79 | public function get_issuer_field() { |
| 80 | - if ( Core_PaymentMethods::IDEAL === $this->get_payment_method() ) { |
|
| 80 | + if (Core_PaymentMethods::IDEAL === $this->get_payment_method()) { |
|
| 81 | 81 | return array( |
| 82 | 82 | 'id' => 'pronamic_ideal_issuer_id', |
| 83 | 83 | 'name' => 'pronamic_ideal_issuer_id', |
| 84 | - 'label' => __( 'Choose your bank', 'pronamic_ideal' ), |
|
| 84 | + 'label' => __('Choose your bank', 'pronamic_ideal'), |
|
| 85 | 85 | 'required' => true, |
| 86 | 86 | 'type' => 'select', |
| 87 | 87 | 'choices' => $this->get_transient_issuers(), |
@@ -113,22 +113,22 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @see Pronamic_WP_Pay_Gateway::start() |
| 115 | 115 | */ |
| 116 | - public function start( Payment $payment ) { |
|
| 117 | - $payment->set_action_url( $this->client->get_payment_server_url() ); |
|
| 116 | + public function start(Payment $payment) { |
|
| 117 | + $payment->set_action_url($this->client->get_payment_server_url()); |
|
| 118 | 118 | |
| 119 | 119 | $payment_method = $payment->get_method(); |
| 120 | 120 | |
| 121 | - switch ( $payment_method ) { |
|
| 121 | + switch ($payment_method) { |
|
| 122 | 122 | case Core_PaymentMethods::IDEAL: |
| 123 | - $this->client->set_payment_method( PaymentMethods::IDEAL ); |
|
| 124 | - $this->client->set_ideal_issuer( $payment->get_issuer() ); |
|
| 123 | + $this->client->set_payment_method(PaymentMethods::IDEAL); |
|
| 124 | + $this->client->set_ideal_issuer($payment->get_issuer()); |
|
| 125 | 125 | |
| 126 | 126 | break; |
| 127 | 127 | case Core_PaymentMethods::CREDIT_CARD: |
| 128 | - $this->client->add_requested_service( PaymentMethods::AMERICAN_EXPRESS ); |
|
| 129 | - $this->client->add_requested_service( PaymentMethods::MAESTRO ); |
|
| 130 | - $this->client->add_requested_service( PaymentMethods::MASTERCARD ); |
|
| 131 | - $this->client->add_requested_service( PaymentMethods::VISA ); |
|
| 128 | + $this->client->add_requested_service(PaymentMethods::AMERICAN_EXPRESS); |
|
| 129 | + $this->client->add_requested_service(PaymentMethods::MAESTRO); |
|
| 130 | + $this->client->add_requested_service(PaymentMethods::MASTERCARD); |
|
| 131 | + $this->client->add_requested_service(PaymentMethods::VISA); |
|
| 132 | 132 | |
| 133 | 133 | break; |
| 134 | 134 | case Core_PaymentMethods::BANK_TRANSFER: |
@@ -137,31 +137,31 @@ discard block |
||
| 137 | 137 | case Core_PaymentMethods::GIROPAY: |
| 138 | 138 | case Core_PaymentMethods::PAYPAL: |
| 139 | 139 | case Core_PaymentMethods::SOFORT: |
| 140 | - $this->client->set_payment_method( PaymentMethods::transform( $payment_method ) ); |
|
| 140 | + $this->client->set_payment_method(PaymentMethods::transform($payment_method)); |
|
| 141 | 141 | |
| 142 | 142 | break; |
| 143 | 143 | default: |
| 144 | - if ( '0' !== $payment_method ) { |
|
| 144 | + if ('0' !== $payment_method) { |
|
| 145 | 145 | // Leap of faith if the WordPress payment method could not transform to a Buckaroo method? |
| 146 | - $this->client->set_payment_method( $payment_method ); |
|
| 146 | + $this->client->set_payment_method($payment_method); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | break; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // Buckaroo uses 'nl-NL' instead of 'nl_NL' |
| 153 | - $culture = str_replace( '_', '-', $payment->get_locale() ); |
|
| 154 | - |
|
| 155 | - $this->client->set_payment_id( $payment->get_id() ); |
|
| 156 | - $this->client->set_culture( $culture ); |
|
| 157 | - $this->client->set_currency( $payment->get_currency() ); |
|
| 158 | - $this->client->set_description( $payment->get_description() ); |
|
| 159 | - $this->client->set_amount( $payment->get_amount()->get_amount() ); |
|
| 160 | - $this->client->set_invoice_number( Util::get_invoice_number( $this->client->get_invoice_number(), $payment ) ); |
|
| 161 | - $this->client->set_return_url( $payment->get_return_url() ); |
|
| 162 | - $this->client->set_return_cancel_url( $payment->get_return_url() ); |
|
| 163 | - $this->client->set_return_error_url( $payment->get_return_url() ); |
|
| 164 | - $this->client->set_return_reject_url( $payment->get_return_url() ); |
|
| 153 | + $culture = str_replace('_', '-', $payment->get_locale()); |
|
| 154 | + |
|
| 155 | + $this->client->set_payment_id($payment->get_id()); |
|
| 156 | + $this->client->set_culture($culture); |
|
| 157 | + $this->client->set_currency($payment->get_currency()); |
|
| 158 | + $this->client->set_description($payment->get_description()); |
|
| 159 | + $this->client->set_amount($payment->get_amount()->get_amount()); |
|
| 160 | + $this->client->set_invoice_number(Util::get_invoice_number($this->client->get_invoice_number(), $payment)); |
|
| 161 | + $this->client->set_return_url($payment->get_return_url()); |
|
| 162 | + $this->client->set_return_cancel_url($payment->get_return_url()); |
|
| 163 | + $this->client->set_return_error_url($payment->get_return_url()); |
|
| 164 | + $this->client->set_return_reject_url($payment->get_return_url()); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @param Payment $payment |
| 181 | 181 | */ |
| 182 | - public function update_status( Payment $payment ) { |
|
| 183 | - $method = filter_var( $_SERVER['REQUEST_METHOD'], FILTER_SANITIZE_STRING ); |
|
| 182 | + public function update_status(Payment $payment) { |
|
| 183 | + $method = filter_var($_SERVER['REQUEST_METHOD'], FILTER_SANITIZE_STRING); |
|
| 184 | 184 | |
| 185 | 185 | $data = array(); |
| 186 | 186 | |
| 187 | - switch ( $method ) { |
|
| 187 | + switch ($method) { |
|
| 188 | 188 | case 'GET': |
| 189 | 189 | $data = $_GET; // WPCS: CSRF OK |
| 190 | 190 | |
@@ -195,54 +195,54 @@ discard block |
||
| 195 | 195 | break; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - $data = Util::urldecode( $data ); |
|
| 198 | + $data = Util::urldecode($data); |
|
| 199 | 199 | |
| 200 | - $data = stripslashes_deep( $data ); |
|
| 200 | + $data = stripslashes_deep($data); |
|
| 201 | 201 | |
| 202 | - $data = $this->client->verify_request( $data ); |
|
| 202 | + $data = $this->client->verify_request($data); |
|
| 203 | 203 | |
| 204 | - if ( $data ) { |
|
| 205 | - $payment->set_transaction_id( $data[ Parameters::PAYMENT ] ); |
|
| 206 | - $payment->set_status( Statuses::transform( $data[ Parameters::STATUS_CODE ] ) ); |
|
| 207 | - $payment->set_consumer_iban( $data[ Parameters::SERVICE_IDEAL_CONSUMER_IBAN ] ); |
|
| 208 | - $payment->set_consumer_bic( $data[ Parameters::SERVICE_IDEAL_CONSUMER_BIC ] ); |
|
| 209 | - $payment->set_consumer_name( $data[ Parameters::SERVICE_IDEAL_CONSUMER_NAME ] ); |
|
| 204 | + if ($data) { |
|
| 205 | + $payment->set_transaction_id($data[Parameters::PAYMENT]); |
|
| 206 | + $payment->set_status(Statuses::transform($data[Parameters::STATUS_CODE])); |
|
| 207 | + $payment->set_consumer_iban($data[Parameters::SERVICE_IDEAL_CONSUMER_IBAN]); |
|
| 208 | + $payment->set_consumer_bic($data[Parameters::SERVICE_IDEAL_CONSUMER_BIC]); |
|
| 209 | + $payment->set_consumer_name($data[Parameters::SERVICE_IDEAL_CONSUMER_NAME]); |
|
| 210 | 210 | |
| 211 | 211 | $labels = array( |
| 212 | - Parameters::PAYMENT => __( 'Payment', 'pronamic_ideal' ), |
|
| 213 | - Parameters::PAYMENT_METHOD => __( 'Payment Method', 'pronamic_ideal' ), |
|
| 214 | - Parameters::STATUS_CODE => __( 'Status Code', 'pronamic_ideal' ), |
|
| 215 | - Parameters::STATUS_CODE_DETAIL => __( 'Status Code Detail', 'pronamic_ideal' ), |
|
| 216 | - Parameters::STATUS_MESSAGE => __( 'Status Message', 'pronamic_ideal' ), |
|
| 217 | - Parameters::INVOICE_NUMBER => __( 'Invoice Number', 'pronamic_ideal' ), |
|
| 218 | - Parameters::AMOUNT => __( 'Amount', 'pronamic_ideal' ), |
|
| 219 | - Parameters::CURRENCY => __( 'Currency', 'pronamic_ideal' ), |
|
| 220 | - Parameters::TIMESTAMP => __( 'Timestamp', 'pronamic_ideal' ), |
|
| 221 | - Parameters::SERVICE_IDEAL_CONSUMER_ISSUER => __( 'Service iDEAL Consumer Issuer', 'pronamic_ideal' ), |
|
| 222 | - Parameters::SERVICE_IDEAL_CONSUMER_NAME => __( 'Service iDEAL Consumer Name', 'pronamic_ideal' ), |
|
| 223 | - Parameters::SERVICE_IDEAL_CONSUMER_IBAN => __( 'Service iDEAL Consumer IBAN', 'pronamic_ideal' ), |
|
| 224 | - Parameters::SERVICE_IDEAL_CONSUMER_BIC => __( 'Service iDEAL Consumer BIC', 'pronamic_ideal' ), |
|
| 225 | - Parameters::TRANSACTIONS => __( 'Transactions', 'pronamic_ideal' ), |
|
| 212 | + Parameters::PAYMENT => __('Payment', 'pronamic_ideal'), |
|
| 213 | + Parameters::PAYMENT_METHOD => __('Payment Method', 'pronamic_ideal'), |
|
| 214 | + Parameters::STATUS_CODE => __('Status Code', 'pronamic_ideal'), |
|
| 215 | + Parameters::STATUS_CODE_DETAIL => __('Status Code Detail', 'pronamic_ideal'), |
|
| 216 | + Parameters::STATUS_MESSAGE => __('Status Message', 'pronamic_ideal'), |
|
| 217 | + Parameters::INVOICE_NUMBER => __('Invoice Number', 'pronamic_ideal'), |
|
| 218 | + Parameters::AMOUNT => __('Amount', 'pronamic_ideal'), |
|
| 219 | + Parameters::CURRENCY => __('Currency', 'pronamic_ideal'), |
|
| 220 | + Parameters::TIMESTAMP => __('Timestamp', 'pronamic_ideal'), |
|
| 221 | + Parameters::SERVICE_IDEAL_CONSUMER_ISSUER => __('Service iDEAL Consumer Issuer', 'pronamic_ideal'), |
|
| 222 | + Parameters::SERVICE_IDEAL_CONSUMER_NAME => __('Service iDEAL Consumer Name', 'pronamic_ideal'), |
|
| 223 | + Parameters::SERVICE_IDEAL_CONSUMER_IBAN => __('Service iDEAL Consumer IBAN', 'pronamic_ideal'), |
|
| 224 | + Parameters::SERVICE_IDEAL_CONSUMER_BIC => __('Service iDEAL Consumer BIC', 'pronamic_ideal'), |
|
| 225 | + Parameters::TRANSACTIONS => __('Transactions', 'pronamic_ideal'), |
|
| 226 | 226 | ); |
| 227 | 227 | |
| 228 | 228 | $note = ''; |
| 229 | 229 | |
| 230 | 230 | $note .= '<p>'; |
| 231 | - $note .= __( 'Buckaroo data:', 'pronamic_ideal' ); |
|
| 231 | + $note .= __('Buckaroo data:', 'pronamic_ideal'); |
|
| 232 | 232 | $note .= '</p>'; |
| 233 | 233 | |
| 234 | 234 | $note .= '<dl>'; |
| 235 | 235 | |
| 236 | - foreach ( $labels as $key => $label ) { |
|
| 237 | - if ( isset( $data[ $key ] ) ) { |
|
| 238 | - $note .= sprintf( '<dt>%s</dt>', esc_html( $label ) ); |
|
| 239 | - $note .= sprintf( '<dd>%s</dd>', esc_html( $data[ $key ] ) ); |
|
| 236 | + foreach ($labels as $key => $label) { |
|
| 237 | + if (isset($data[$key])) { |
|
| 238 | + $note .= sprintf('<dt>%s</dt>', esc_html($label)); |
|
| 239 | + $note .= sprintf('<dd>%s</dd>', esc_html($data[$key])); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | $note .= '</dl>'; |
| 244 | 244 | |
| 245 | - $payment->add_note( $note ); |
|
| 245 | + $payment->add_note($note); |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return null or signature value |
| 22 | 22 | */ |
| 23 | - public static function get_signature( $data ) { |
|
| 23 | + public static function get_signature($data) { |
|
| 24 | 24 | $result = null; |
| 25 | 25 | |
| 26 | - foreach ( $data as $key => $value ) { |
|
| 27 | - if ( Util::string_equals( $key, Parameters::SIGNATURE ) ) { |
|
| 26 | + foreach ($data as $key => $value) { |
|
| 27 | + if (Util::string_equals($key, Parameters::SIGNATURE)) { |
|
| 28 | 28 | $result = $value; |
| 29 | 29 | |
| 30 | 30 | break; |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return array |
| 43 | 43 | */ |
| 44 | - public static function filter_data( $data ) { |
|
| 44 | + public static function filter_data($data) { |
|
| 45 | 45 | $filter = array(); |
| 46 | 46 | |
| 47 | 47 | // List all parameters prefixed with brq_, add_ or cust_, except brq_signature |
| 48 | - foreach ( $data as $key => $value ) { |
|
| 49 | - if ( ! ( Util::string_starts_with( $key, 'brq_' ) || Util::string_starts_with( $key, 'add_' ) || Util::string_starts_with( $key, 'cust_' ) ) ) { |
|
| 48 | + foreach ($data as $key => $value) { |
|
| 49 | + if ( ! (Util::string_starts_with($key, 'brq_') || Util::string_starts_with($key, 'add_') || Util::string_starts_with($key, 'cust_'))) { |
|
| 50 | 50 | continue; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ( Util::string_equals( $key, Parameters::SIGNATURE ) ) { |
|
| 53 | + if (Util::string_equals($key, Parameters::SIGNATURE)) { |
|
| 54 | 54 | continue; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $filter[ $key ] = $value; |
|
| 57 | + $filter[$key] = $value; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | return $filter; |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return array |
| 69 | 69 | */ |
| 70 | - public static function sort( $data ) { |
|
| 71 | - uksort( $data, 'strcasecmp' ); |
|
| 70 | + public static function sort($data) { |
|
| 71 | + uksort($data, 'strcasecmp'); |
|
| 72 | 72 | |
| 73 | 73 | return $data; |
| 74 | 74 | } |
@@ -84,17 +84,17 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - public static function create_signature( $data, $secret_key ) { |
|
| 87 | + public static function create_signature($data, $secret_key) { |
|
| 88 | 88 | $string = ''; |
| 89 | 89 | |
| 90 | 90 | // 1. List all parameters prefixed with brq_, add_ or cust_, except brq_signature |
| 91 | - $data = self::filter_data( $data ); |
|
| 91 | + $data = self::filter_data($data); |
|
| 92 | 92 | |
| 93 | 93 | // 2. Sort these parameters alphabetically on the parameter name |
| 94 | - $data = self::sort( $data ); |
|
| 94 | + $data = self::sort($data); |
|
| 95 | 95 | |
| 96 | 96 | // 3. Concatenate all the parameters |
| 97 | - foreach ( $data as $key => $value ) { |
|
| 97 | + foreach ($data as $key => $value) { |
|
| 98 | 98 | $string .= $key . '=' . $value; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $string .= $secret_key; |
| 103 | 103 | |
| 104 | 104 | // 5. Calculate a SHA-1 hash over this string. |
| 105 | - $hash = hash( 'sha1', $string ); |
|
| 105 | + $hash = hash('sha1', $string); |
|
| 106 | 106 | |
| 107 | 107 | // Return the hash in hexadecimal format |
| 108 | 108 | return $hash; |
@@ -99,8 +99,8 @@ |
||
| 99 | 99 | * |
| 100 | 100 | * @return null|string |
| 101 | 101 | */ |
| 102 | - public static function transform( $status_code ) { |
|
| 103 | - switch ( $status_code ) { |
|
| 102 | + public static function transform($status_code) { |
|
| 103 | + switch ($status_code) { |
|
| 104 | 104 | case self::PAYMENT_SUCCESS: |
| 105 | 105 | return Core_Statuses::SUCCESS; |
| 106 | 106 | |
@@ -16,48 +16,48 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Settings extends GatewaySettings { |
| 18 | 18 | public function __construct() { |
| 19 | - add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
|
| 20 | - add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
|
| 19 | + add_filter('pronamic_pay_gateway_sections', array($this, 'sections')); |
|
| 20 | + add_filter('pronamic_pay_gateway_fields', array($this, 'fields')); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function sections( array $sections ) { |
|
| 23 | + public function sections(array $sections) { |
|
| 24 | 24 | // Buckaroo |
| 25 | 25 | $sections['buckaroo'] = array( |
| 26 | - 'title' => __( 'Buckaroo', 'pronamic_ideal' ), |
|
| 27 | - 'methods' => array( 'buckaroo' ), |
|
| 26 | + 'title' => __('Buckaroo', 'pronamic_ideal'), |
|
| 27 | + 'methods' => array('buckaroo'), |
|
| 28 | 28 | 'description' => sprintf( |
| 29 | 29 | /* translators: %s: Buckaroo */ |
| 30 | - __( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ), |
|
| 31 | - __( 'Buckaroo', 'pronamic_ideal' ) |
|
| 30 | + __('Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal'), |
|
| 31 | + __('Buckaroo', 'pronamic_ideal') |
|
| 32 | 32 | ), |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | $sections['buckaroo_advanced'] = array( |
| 36 | - 'title' => __( 'Advanced', 'pronamic_ideal' ), |
|
| 37 | - 'methods' => array( 'buckaroo' ), |
|
| 38 | - 'description' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ), |
|
| 36 | + 'title' => __('Advanced', 'pronamic_ideal'), |
|
| 37 | + 'methods' => array('buckaroo'), |
|
| 38 | + 'description' => __('Optional settings for advanced usage only.', 'pronamic_ideal'), |
|
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | // Transaction feedback |
| 42 | 42 | $sections['buckaroo_feedback'] = array( |
| 43 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 44 | - 'methods' => array( 'buckaroo' ), |
|
| 45 | - 'description' => __( 'Payment status updates will be processed without any additional configuration. The <em>Push URL</em> is being used to receive the status updates.', 'pronamic_ideal' ), |
|
| 43 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 44 | + 'methods' => array('buckaroo'), |
|
| 45 | + 'description' => __('Payment status updates will be processed without any additional configuration. The <em>Push URL</em> is being used to receive the status updates.', 'pronamic_ideal'), |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | return $sections; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function fields( array $fields ) { |
|
| 51 | + public function fields(array $fields) { |
|
| 52 | 52 | // Website Key |
| 53 | 53 | $fields[] = array( |
| 54 | 54 | 'filter' => FILTER_SANITIZE_STRING, |
| 55 | 55 | 'section' => 'buckaroo', |
| 56 | 56 | 'meta_key' => '_pronamic_gateway_buckaroo_website_key', |
| 57 | - 'title' => __( 'Website Key', 'pronamic_ideal' ), |
|
| 57 | + 'title' => __('Website Key', 'pronamic_ideal'), |
|
| 58 | 58 | 'type' => 'text', |
| 59 | - 'classes' => array( 'code' ), |
|
| 60 | - 'tooltip' => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ), |
|
| 59 | + 'classes' => array('code'), |
|
| 60 | + 'tooltip' => __('Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal'), |
|
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | // Secret Key |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | 'filter' => FILTER_SANITIZE_STRING, |
| 66 | 66 | 'section' => 'buckaroo', |
| 67 | 67 | 'meta_key' => '_pronamic_gateway_buckaroo_secret_key', |
| 68 | - 'title' => __( 'Secret Key', 'pronamic_ideal' ), |
|
| 68 | + 'title' => __('Secret Key', 'pronamic_ideal'), |
|
| 69 | 69 | 'type' => 'text', |
| 70 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 71 | - 'tooltip' => __( 'Secret key as mentioned in the Buckaroo dashboardb on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ), |
|
| 70 | + 'classes' => array('regular-text', 'code'), |
|
| 71 | + 'tooltip' => __('Secret key as mentioned in the Buckaroo dashboardb on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal'), |
|
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | 74 | // Transaction feedback |
| 75 | 75 | $fields[] = array( |
| 76 | 76 | 'section' => 'buckaroo', |
| 77 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 77 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 78 | 78 | 'type' => 'description', |
| 79 | 79 | 'html' => sprintf( |
| 80 | 80 | '<span class="dashicons dashicons-yes"></span> %s', |
| 81 | - __( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
| 81 | + __('Payment status updates will be processed without any additional configuration.', 'pronamic_ideal') |
|
| 82 | 82 | ), |
| 83 | 83 | ); |
| 84 | 84 | |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | 'filter' => FILTER_SANITIZE_STRING, |
| 88 | 88 | 'section' => 'buckaroo_advanced', |
| 89 | 89 | 'meta_key' => '_pronamic_gateway_buckaroo_excluded_services', |
| 90 | - 'title' => __( 'Excluded services', 'pronamic_ideal' ), |
|
| 90 | + 'title' => __('Excluded services', 'pronamic_ideal'), |
|
| 91 | 91 | 'type' => 'text', |
| 92 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 92 | + 'classes' => array('regular-text', 'code'), |
|
| 93 | 93 | 'tooltip' => sprintf( |
| 94 | 94 | /* translators: %s: <code>brq_exludedservices</code> */ |
| 95 | - __( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), |
|
| 96 | - sprintf( '<code>%s</code>', 'brq_exludedservices' ) |
|
| 95 | + __('This controls the Buckaroo %s parameter.', 'pronamic_ideal'), |
|
| 96 | + sprintf('<code>%s</code>', 'brq_exludedservices') |
|
| 97 | 97 | ), |
| 98 | 98 | ); |
| 99 | 99 | |
@@ -102,32 +102,32 @@ discard block |
||
| 102 | 102 | 'filter' => FILTER_SANITIZE_STRING, |
| 103 | 103 | 'section' => 'buckaroo_advanced', |
| 104 | 104 | 'meta_key' => '_pronamic_gateway_buckaroo_invoice_number', |
| 105 | - 'title' => __( 'Invoice number', 'pronamic_ideal' ), |
|
| 105 | + 'title' => __('Invoice number', 'pronamic_ideal'), |
|
| 106 | 106 | 'type' => 'text', |
| 107 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 107 | + 'classes' => array('regular-text', 'code'), |
|
| 108 | 108 | 'tooltip' => sprintf( |
| 109 | 109 | /* translators: %s: <code>brq_invoicenumber</code> */ |
| 110 | - __( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), |
|
| 111 | - sprintf( '<code>%s</code>', 'brq_invoicenumber' ) |
|
| 110 | + __('This controls the Buckaroo %s parameter.', 'pronamic_ideal'), |
|
| 111 | + sprintf('<code>%s</code>', 'brq_invoicenumber') |
|
| 112 | 112 | ), |
| 113 | 113 | 'description' => sprintf( |
| 114 | 114 | '%s<br />%s', |
| 115 | 115 | /* translators: %s: <code>{order_id}</code> <code>{payment_id}</code> */ |
| 116 | - sprintf( __( 'Available tags: %s', 'pronamic_ideal' ), sprintf( '<code>%s</code> <code>%s</code>', '{order_id}', '{payment_id}' ) ), |
|
| 116 | + sprintf(__('Available tags: %s', 'pronamic_ideal'), sprintf('<code>%s</code> <code>%s</code>', '{order_id}', '{payment_id}')), |
|
| 117 | 117 | /* translators: %s: <code>{payment_id}</code> */ |
| 118 | - sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), '{payment_id}' ) |
|
| 118 | + sprintf(__('Default: <code>%s</code>', 'pronamic_ideal'), '{payment_id}') |
|
| 119 | 119 | ), |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | 122 | // Push URL |
| 123 | 123 | $fields[] = array( |
| 124 | 124 | 'section' => 'buckaroo_feedback', |
| 125 | - 'title' => __( 'Push URL', 'pronamic_ideal' ), |
|
| 125 | + 'title' => __('Push URL', 'pronamic_ideal'), |
|
| 126 | 126 | 'type' => 'text', |
| 127 | - 'classes' => array( 'large-text', 'code' ), |
|
| 128 | - 'value' => add_query_arg( 'buckaroo_push', '', home_url( '/' ) ), |
|
| 127 | + 'classes' => array('large-text', 'code'), |
|
| 128 | + 'value' => add_query_arg('buckaroo_push', '', home_url('/')), |
|
| 129 | 129 | 'readonly' => true, |
| 130 | - 'tooltip' => __( 'The Push URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), |
|
| 130 | + 'tooltip' => __('The Push URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal'), |
|
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | return $fields; |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | * @since 1.0.0 |
| 16 | 16 | */ |
| 17 | 17 | class ConfigFactory extends GatewayConfigFactory { |
| 18 | - public function get_config( $post_id ) { |
|
| 18 | + public function get_config($post_id) { |
|
| 19 | 19 | $config = new Config(); |
| 20 | 20 | |
| 21 | - $config->website_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ); |
|
| 22 | - $config->secret_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ); |
|
| 23 | - $config->excluded_services = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_excluded_services', true ); |
|
| 24 | - $config->invoice_number = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_invoice_number', true ); |
|
| 25 | - $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
| 21 | + $config->website_key = get_post_meta($post_id, '_pronamic_gateway_buckaroo_website_key', true); |
|
| 22 | + $config->secret_key = get_post_meta($post_id, '_pronamic_gateway_buckaroo_secret_key', true); |
|
| 23 | + $config->excluded_services = get_post_meta($post_id, '_pronamic_gateway_buckaroo_excluded_services', true); |
|
| 24 | + $config->invoice_number = get_post_meta($post_id, '_pronamic_gateway_buckaroo_invoice_number', true); |
|
| 25 | + $config->mode = get_post_meta($post_id, '_pronamic_gateway_mode', true); |
|
| 26 | 26 | |
| 27 | 27 | return $config; |
| 28 | 28 | } |
@@ -19,15 +19,15 @@ |
||
| 19 | 19 | $this->id = 'buckaroo'; |
| 20 | 20 | $this->name = 'Buckaroo - HTML'; |
| 21 | 21 | $this->url = 'https://plaza.buckaroo.nl/'; |
| 22 | - $this->product_url = __( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ); |
|
| 22 | + $this->product_url = __('http://www.buckaroo-payments.com', 'pronamic_ideal'); |
|
| 23 | 23 | $this->dashboard_url = 'https://plaza.buckaroo.nl/'; |
| 24 | 24 | $this->provider = 'buckaroo'; |
| 25 | 25 | |
| 26 | 26 | // Actions |
| 27 | - $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
|
| 27 | + $function = array(__NAMESPACE__ . '\Listener', 'listen'); |
|
| 28 | 28 | |
| 29 | - if ( ! has_action( 'wp_loaded', $function ) ) { |
|
| 30 | - add_action( 'wp_loaded', $function ); |
|
| 29 | + if ( ! has_action('wp_loaded', $function)) { |
|
| 30 | + add_action('wp_loaded', $function); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |