@@ -44,16 +44,16 @@ |
||
| 44 | 44 | $payment_id = null; |
| 45 | 45 | |
| 46 | 46 | if ( isset( |
| 47 | - $data[ Parameters::ADD_PRONAMIC_PAYMENT_ID ], |
|
| 48 | - $data[ Parameters::STATUS_CODE ] |
|
| 47 | + $data[Parameters::ADD_PRONAMIC_PAYMENT_ID], |
|
| 48 | + $data[Parameters::STATUS_CODE] |
|
| 49 | 49 | ) ) { |
| 50 | - $payment_id = $data[ Parameters::ADD_PRONAMIC_PAYMENT_ID ]; |
|
| 50 | + $payment_id = $data[Parameters::ADD_PRONAMIC_PAYMENT_ID]; |
|
| 51 | 51 | } elseif ( isset( |
| 52 | - $data[ Parameters::INVOICE_NUMBER ], |
|
| 53 | - $data[ Parameters::STATUS_CODE ] |
|
| 52 | + $data[Parameters::INVOICE_NUMBER], |
|
| 53 | + $data[Parameters::STATUS_CODE] |
|
| 54 | 54 | ) ) { |
| 55 | 55 | // Fallback for payments started with plugin version <= 4.5.5. |
| 56 | - $payment_id = $data[ Parameters::INVOICE_NUMBER ]; |
|
| 56 | + $payment_id = $data[Parameters::INVOICE_NUMBER]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | if ( $payment_id ) { |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | continue; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $filter[ $key ] = $value; |
|
| 57 | + $filter[$key] = $value; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | return $filter; |
@@ -143,8 +143,8 @@ |
||
| 143 | 143 | return null; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if ( isset( self::$map[ $payment_method ] ) ) { |
|
| 147 | - return self::$map[ $payment_method ]; |
|
| 146 | + if ( isset( self::$map[$payment_method] ) ) { |
|
| 147 | + return self::$map[$payment_method]; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return $default; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | if ( is_array( $response ) ) { |
| 99 | 99 | foreach ( $response as $flat_key => $value ) { |
| 100 | - unset( $response[ $flat_key ] ); |
|
| 100 | + unset( $response[$flat_key] ); |
|
| 101 | 101 | |
| 102 | 102 | $is_brq = ( 'BRQ_' === substr( $flat_key, 0, 4 ) ); |
| 103 | 103 | |
@@ -113,15 +113,15 @@ discard block |
||
| 113 | 113 | $parts[0] = sprintf( 'BRQ_%s', $parts[0] ); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $item =& $return; |
|
| 116 | + $item = & $return; |
|
| 117 | 117 | |
| 118 | 118 | // Define key parts as array and set current item |
| 119 | 119 | foreach ( $parts as $key ) { |
| 120 | - if ( ! isset( $item[ $key ] ) ) { |
|
| 121 | - $item[ $key ] = array(); |
|
| 120 | + if ( ! isset( $item[$key] ) ) { |
|
| 121 | + $item[$key] = array(); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $item =& $item[ $key ]; |
|
| 124 | + $item = & $item[$key]; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Set value of item |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | // WARNING WARNING WARNING! |
| 31 | 31 | // These tests will DROP ALL TABLES in the database with the prefix named below. |
| 32 | 32 | // DO NOT use a production database or one that is shared with something else. |
| 33 | -define( 'DB_NAME' , getenv( 'WP_TESTS_DB_NAME' ) ?: 'wp_phpunit_tests' ); |
|
| 34 | -define( 'DB_USER' , getenv( 'WP_TESTS_DB_USER' ) ?: 'root' ); |
|
| 35 | -define( 'DB_PASSWORD' , getenv( 'WP_TESTS_DB_PASS' ) ?: '' ); |
|
| 36 | -define( 'DB_HOST' , getenv( 'WP_TESTS_DB_HOST' ) ?: 'localhost' ); |
|
| 37 | -define( 'DB_CHARSET' , 'utf8' ); |
|
| 38 | -define( 'DB_COLLATE' , '' ); |
|
| 33 | +define( 'DB_NAME', getenv( 'WP_TESTS_DB_NAME' ) ?: 'wp_phpunit_tests' ); |
|
| 34 | +define( 'DB_USER', getenv( 'WP_TESTS_DB_USER' ) ?: 'root' ); |
|
| 35 | +define( 'DB_PASSWORD', getenv( 'WP_TESTS_DB_PASS' ) ?: '' ); |
|
| 36 | +define( 'DB_HOST', getenv( 'WP_TESTS_DB_HOST' ) ?: 'localhost' ); |
|
| 37 | +define( 'DB_CHARSET', 'utf8' ); |
|
| 38 | +define( 'DB_COLLATE', '' ); |
|
| 39 | 39 | |
| 40 | 40 | /**#@+ |
| 41 | 41 | * Authentication Unique Keys and Salts. |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * Change these to different unique phrases! |
| 44 | 44 | * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} |
| 45 | 45 | */ |
| 46 | -define( 'AUTH_KEY', 'put your unique phrase here' ); |
|
| 47 | -define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); |
|
| 48 | -define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); |
|
| 49 | -define( 'NONCE_KEY', 'put your unique phrase here' ); |
|
| 50 | -define( 'AUTH_SALT', 'put your unique phrase here' ); |
|
| 46 | +define( 'AUTH_KEY', 'put your unique phrase here' ); |
|
| 47 | +define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); |
|
| 48 | +define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); |
|
| 49 | +define( 'NONCE_KEY', 'put your unique phrase here' ); |
|
| 50 | +define( 'AUTH_SALT', 'put your unique phrase here' ); |
|
| 51 | 51 | define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); |
| 52 | -define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); |
|
| 53 | -define( 'NONCE_SALT', 'put your unique phrase here' ); |
|
| 52 | +define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); |
|
| 53 | +define( 'NONCE_SALT', 'put your unique phrase here' ); |
|
| 54 | 54 | |
| 55 | 55 | define( 'WP_TESTS_DOMAIN', 'example.org' ); |
| 56 | 56 | define( 'WP_TESTS_EMAIL', '[email protected]' ); |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | $signature = Security::create_signature( $data, (string) $this->get_secret_key() ); |
| 551 | 551 | |
| 552 | - $data[ Parameters::SIGNATURE ] = $signature; |
|
| 552 | + $data[Parameters::SIGNATURE] = $signature; |
|
| 553 | 553 | |
| 554 | 554 | $result = wp_remote_post( |
| 555 | 555 | $url, |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | foreach ( $parameter['LISTITEMDESCRIPTION'] as $issuer ) { |
| 615 | - $issuers[ $issuer['VALUE'] ] = $issuer['DESCRIPTION']; |
|
| 615 | + $issuers[$issuer['VALUE']] = $issuer['DESCRIPTION']; |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | break; |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | $signature = Security::create_signature( $data, (string) $this->get_secret_key() ); |
| 659 | 659 | |
| 660 | - $data[ Parameters::SIGNATURE ] = $signature; |
|
| 660 | + $data[Parameters::SIGNATURE] = $signature; |
|
| 661 | 661 | |
| 662 | 662 | return $data; |
| 663 | 663 | } |
@@ -131,23 +131,23 @@ |
||
| 131 | 131 | $authorization = 'hmac ' . $this->config->website_key . ':' . hash_hmac( 'sha256', $data, $this->config->secret_key ) . ':' . $nonce . ':' . $request_timestamp; |
| 132 | 132 | |
| 133 | 133 | $postArray = array( |
| 134 | - "Currency" => "EUR", |
|
| 135 | - "AmountDebit" => 10.00, |
|
| 136 | - "Invoice" => "testinvoice 123", |
|
| 137 | - "Services" => array( |
|
| 138 | - "ServiceList" => array( |
|
| 139 | - array( |
|
| 140 | - "Action" => "Pay", |
|
| 141 | - "Name" => "ideal", |
|
| 142 | - "Parameters" => array( |
|
| 143 | - array( |
|
| 144 | - "Name" => "issuer", |
|
| 145 | - "Value" => "ABNANL2A" |
|
| 146 | - ) |
|
| 147 | - ) |
|
| 148 | - ) |
|
| 149 | - ) |
|
| 150 | - ) |
|
| 134 | + "Currency" => "EUR", |
|
| 135 | + "AmountDebit" => 10.00, |
|
| 136 | + "Invoice" => "testinvoice 123", |
|
| 137 | + "Services" => array( |
|
| 138 | + "ServiceList" => array( |
|
| 139 | + array( |
|
| 140 | + "Action" => "Pay", |
|
| 141 | + "Name" => "ideal", |
|
| 142 | + "Parameters" => array( |
|
| 143 | + array( |
|
| 144 | + "Name" => "issuer", |
|
| 145 | + "Value" => "ABNANL2A" |
|
| 146 | + ) |
|
| 147 | + ) |
|
| 148 | + ) |
|
| 149 | + ) |
|
| 150 | + ) |
|
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | 153 | |
@@ -151,29 +151,29 @@ discard block |
||
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | 153 | |
| 154 | -$post = json_encode($postArray); |
|
| 154 | +$post = json_encode( $postArray ); |
|
| 155 | 155 | |
| 156 | 156 | echo $post . '<br><br>'; |
| 157 | 157 | |
| 158 | -$md5 = md5($post, true); |
|
| 159 | -$post = base64_encode($md5); |
|
| 158 | +$md5 = md5( $post, true ); |
|
| 159 | +$post = base64_encode( $md5 ); |
|
| 160 | 160 | |
| 161 | 161 | echo '<b>MD5 from json</b> ' . $md5 . '<br><br>'; |
| 162 | 162 | echo '<b>base64 from MD5</b> ' . $post . '<br><br>'; |
| 163 | 163 | |
| 164 | 164 | $websiteKey = $this->config->website_key; |
| 165 | 165 | $test = 'testcheckout.buckaroo.nl/json/Transaction'; |
| 166 | -$uri = strtolower(urlencode($test)); |
|
| 167 | -$nonce = 'nonce_' . rand(0000000, 9999999); |
|
| 166 | +$uri = strtolower( urlencode( $test ) ); |
|
| 167 | +$nonce = 'nonce_' . rand( 0000000, 9999999 ); |
|
| 168 | 168 | $time = time(); |
| 169 | 169 | |
| 170 | 170 | $hmac = $websiteKey . 'POST' . $uri . $time . $nonce . $post; |
| 171 | -$s = hash_hmac('sha256', $hmac, $this->config->secret_key, true); |
|
| 172 | -$hmac = base64_encode($s); |
|
| 171 | +$s = hash_hmac( 'sha256', $hmac, $this->config->secret_key, true ); |
|
| 172 | +$hmac = base64_encode( $s ); |
|
| 173 | 173 | |
| 174 | -$authorization = ("hmac " . $this->config->website_key . ':' . $hmac . ':' . $nonce . ':' . $time); |
|
| 175 | -var_dump($this->config ); |
|
| 176 | -var_dump($authorization ); |
|
| 174 | +$authorization = ( "hmac " . $this->config->website_key . ':' . $hmac . ':' . $nonce . ':' . $time ); |
|
| 175 | +var_dump( $this->config ); |
|
| 176 | +var_dump( $authorization ); |
|
| 177 | 177 | $test = \Pronamic\WordPress\Http\Facades\Http::request( |
| 178 | 178 | 'https://' . $test, |
| 179 | 179 | array( |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | 'Authorization' => $authorization, |
| 183 | 183 | 'Content-Type' => 'application/json', |
| 184 | 184 | ), |
| 185 | - 'body' => \json_encode($postArray), |
|
| 185 | + 'body' => \json_encode( $postArray ), |
|
| 186 | 186 | ) |
| 187 | 187 | ); |
| 188 | 188 | |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | return; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - $payment->set_transaction_id( (string) $data[ Parameters::PAYMENT ] ); |
|
| 302 | - $payment->set_status( Statuses::transform( (string) $data[ Parameters::STATUS_CODE ] ) ); |
|
| 301 | + $payment->set_transaction_id( (string) $data[Parameters::PAYMENT] ); |
|
| 302 | + $payment->set_status( Statuses::transform( (string) $data[Parameters::STATUS_CODE] ) ); |
|
| 303 | 303 | |
| 304 | 304 | // Consumer bank details. |
| 305 | 305 | $consumer_bank_details = $payment->get_consumer_bank_details(); |
@@ -311,15 +311,15 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | if ( \array_key_exists( Parameters::SERVICE_IDEAL_CONSUMER_NAME, $data ) ) { |
| 314 | - $consumer_bank_details->set_name( (string) $data[ Parameters::SERVICE_IDEAL_CONSUMER_NAME ] ); |
|
| 314 | + $consumer_bank_details->set_name( (string) $data[Parameters::SERVICE_IDEAL_CONSUMER_NAME] ); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | if ( \array_key_exists( Parameters::SERVICE_IDEAL_CONSUMER_IBAN, $data ) ) { |
| 318 | - $consumer_bank_details->set_iban( (string) $data[ Parameters::SERVICE_IDEAL_CONSUMER_IBAN ] ); |
|
| 318 | + $consumer_bank_details->set_iban( (string) $data[Parameters::SERVICE_IDEAL_CONSUMER_IBAN] ); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | if ( \array_key_exists( Parameters::SERVICE_IDEAL_CONSUMER_BIC, $data ) ) { |
| 322 | - $consumer_bank_details->set_bic( (string) $data[ Parameters::SERVICE_IDEAL_CONSUMER_BIC ] ); |
|
| 322 | + $consumer_bank_details->set_bic( (string) $data[Parameters::SERVICE_IDEAL_CONSUMER_BIC] ); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | $labels = array( |
@@ -348,14 +348,14 @@ discard block |
||
| 348 | 348 | $note .= '<dl>'; |
| 349 | 349 | |
| 350 | 350 | foreach ( $labels as $key => $label ) { |
| 351 | - if ( ! isset( $data[ $key ] ) ) { |
|
| 351 | + if ( ! isset( $data[$key] ) ) { |
|
| 352 | 352 | continue; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $note .= sprintf( |
| 356 | 356 | '<dt>%s</dt><dd>%s</dd>', |
| 357 | 357 | esc_html( $label ), |
| 358 | - esc_html( (string) $data[ $key ] ) |
|
| 358 | + esc_html( (string) $data[$key] ) |
|
| 359 | 359 | ); |
| 360 | 360 | } |
| 361 | 361 | |