@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @param $signing_key |
| 24 | 24 | */ |
| 25 | - public function set_signing_key( $signing_key ) { |
|
| 25 | + public function set_signing_key($signing_key) { |
|
| 26 | 26 | $this->signing_key = $signing_key; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -34,6 +34,6 @@ discard block |
||
| 34 | 34 | public function get_signature() { |
| 35 | 35 | $data = $this->get_signature_data(); |
| 36 | 36 | |
| 37 | - return Security::calculate_signature( $data, $this->signing_key ); |
|
| 37 | + return Security::calculate_signature($data, $this->signing_key); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -49,8 +49,8 @@ |
||
| 49 | 49 | * |
| 50 | 50 | * @return string|null |
| 51 | 51 | */ |
| 52 | - public static function transform( $status ) { |
|
| 53 | - switch ( $status ) { |
|
| 52 | + public static function transform($status) { |
|
| 53 | + switch ($status) { |
|
| 54 | 54 | case self::CANCELLED: |
| 55 | 55 | return Core_Statuses::CANCELLED; |
| 56 | 56 | |
@@ -15,16 +15,16 @@ |
||
| 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 | 21 | $config->post_id = $post_id; |
| 22 | - $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
| 23 | - $config->refresh_token = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_refresh_token', true ); |
|
| 24 | - $config->signing_key = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_signing_key', true ); |
|
| 25 | - $config->access_token = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_access_token', true ); |
|
| 26 | - $config->access_token_valid_until = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', true ); |
|
| 27 | - $config->order_id = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_order_id', true ); |
|
| 22 | + $config->mode = get_post_meta($post_id, '_pronamic_gateway_mode', true); |
|
| 23 | + $config->refresh_token = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_refresh_token', true); |
|
| 24 | + $config->signing_key = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_signing_key', true); |
|
| 25 | + $config->access_token = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_access_token', true); |
|
| 26 | + $config->access_token_valid_until = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', true); |
|
| 27 | + $config->order_id = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_order_id', true); |
|
| 28 | 28 | |
| 29 | 29 | return $config; |
| 30 | 30 | } |
@@ -56,8 +56,8 @@ |
||
| 56 | 56 | * |
| 57 | 57 | * @return string |
| 58 | 58 | */ |
| 59 | - public static function transform( $payment_method ) { |
|
| 60 | - switch ( $payment_method ) { |
|
| 59 | + public static function transform($payment_method) { |
|
| 60 | + switch ($payment_method) { |
|
| 61 | 61 | case PaymentMethods::BANCONTACT: |
| 62 | 62 | return self::BANCONTACT; |
| 63 | 63 | case PaymentMethods::CREDIT_CARD: |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @param string $url an URL |
| 73 | 73 | */ |
| 74 | - public function set_url( $url ) { |
|
| 74 | + public function set_url($url) { |
|
| 75 | 75 | $this->url = $url; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Set refresh token. |
| 87 | 87 | */ |
| 88 | - public function set_refresh_token( $refresh_token ) { |
|
| 88 | + public function set_refresh_token($refresh_token) { |
|
| 89 | 89 | $this->refresh_token = $refresh_token; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Set signing key. |
| 101 | 101 | */ |
| 102 | - public function set_signing_key( $signing_key ) { |
|
| 102 | + public function set_signing_key($signing_key) { |
|
| 103 | 103 | $this->signing_key = $signing_key; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | * @param array $args Arguments. |
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | - private function get_remote_request_args( $args = array() ) { |
|
| 116 | - $args = wp_parse_args( $args, array( |
|
| 115 | + private function get_remote_request_args($args = array()) { |
|
| 116 | + $args = wp_parse_args($args, array( |
|
| 117 | 117 | // We send an empty User-Agent string so OmniKassa 2.0 servers can't block requests based on the User-Agent. |
| 118 | 118 | 'user-agent' => '', |
| 119 | - ) ); |
|
| 119 | + )); |
|
| 120 | 120 | |
| 121 | 121 | return $args; |
| 122 | 122 | } |
@@ -127,36 +127,36 @@ discard block |
||
| 127 | 127 | public function get_access_token_data() { |
| 128 | 128 | $url = $this->get_url() . 'gatekeeper/refresh'; |
| 129 | 129 | |
| 130 | - $response = wp_remote_get( $url, $this->get_remote_request_args( array( |
|
| 130 | + $response = wp_remote_get($url, $this->get_remote_request_args(array( |
|
| 131 | 131 | 'headers' => array( |
| 132 | 132 | 'Authorization' => 'Bearer ' . $this->get_refresh_token(), |
| 133 | 133 | ), |
| 134 | - ) ) ); |
|
| 134 | + ))); |
|
| 135 | 135 | |
| 136 | - if ( is_wp_error( $response ) ) { |
|
| 136 | + if (is_wp_error($response)) { |
|
| 137 | 137 | $this->error = $response; |
| 138 | 138 | |
| 139 | - $this->error->add( 'omnikassa_2_error', 'HTTP Request Failed' ); |
|
| 139 | + $this->error->add('omnikassa_2_error', 'HTTP Request Failed'); |
|
| 140 | 140 | |
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $body = wp_remote_retrieve_body( $response ); |
|
| 144 | + $body = wp_remote_retrieve_body($response); |
|
| 145 | 145 | |
| 146 | - $data = json_decode( $body ); |
|
| 146 | + $data = json_decode($body); |
|
| 147 | 147 | |
| 148 | - if ( is_object( $data ) && isset( $data->errorCode ) && isset( $data->errorMessage ) ) { |
|
| 149 | - $this->error = new \WP_Error( 'omnikassa_2_error', $data->errorMessage, $data ); |
|
| 148 | + if (is_object($data) && isset($data->errorCode) && isset($data->errorMessage)) { |
|
| 149 | + $this->error = new \WP_Error('omnikassa_2_error', $data->errorMessage, $data); |
|
| 150 | 150 | |
| 151 | 151 | return false; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if ( is_object( $data ) && '200' != wp_remote_retrieve_response_code( $response ) ) { // WPCS: loose comparison ok. |
|
| 154 | + if (is_object($data) && '200' != wp_remote_retrieve_response_code($response)) { // WPCS: loose comparison ok. |
|
| 155 | 155 | return false; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if ( ! is_object( $data ) ) { |
|
| 159 | - $this->error = new \WP_Error( 'omnikassa_2_error', 'Could not parse response.' ); |
|
| 158 | + if ( ! is_object($data)) { |
|
| 159 | + $this->error = new \WP_Error('omnikassa_2_error', 'Could not parse response.'); |
|
| 160 | 160 | |
| 161 | 161 | return false; |
| 162 | 162 | } |
@@ -164,50 +164,50 @@ discard block |
||
| 164 | 164 | return $data; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - public function order_announce( $config, Order $order ) { |
|
| 167 | + public function order_announce($config, Order $order) { |
|
| 168 | 168 | $url = $this->get_url() . 'order/server/api/order'; |
| 169 | 169 | |
| 170 | - $order->set_signing_key( $config->signing_key ); |
|
| 170 | + $order->set_signing_key($config->signing_key); |
|
| 171 | 171 | |
| 172 | 172 | $object = $order->get_json(); |
| 173 | 173 | $object->signature = $order->get_signature(); |
| 174 | 174 | |
| 175 | - $response = wp_remote_post( $url, $this->get_remote_request_args( array( |
|
| 175 | + $response = wp_remote_post($url, $this->get_remote_request_args(array( |
|
| 176 | 176 | 'headers' => array( |
| 177 | 177 | 'Content-Type' => 'application/json', |
| 178 | 178 | 'Authorization' => 'Bearer ' . $config->access_token, |
| 179 | 179 | ), |
| 180 | - 'body' => wp_json_encode( $object ), |
|
| 181 | - ) ) ); |
|
| 180 | + 'body' => wp_json_encode($object), |
|
| 181 | + ))); |
|
| 182 | 182 | |
| 183 | - if ( is_wp_error( $response ) ) { |
|
| 183 | + if (is_wp_error($response)) { |
|
| 184 | 184 | return false; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $body = wp_remote_retrieve_body( $response ); |
|
| 187 | + $body = wp_remote_retrieve_body($response); |
|
| 188 | 188 | |
| 189 | - $data = json_decode( $body ); |
|
| 189 | + $data = json_decode($body); |
|
| 190 | 190 | |
| 191 | - if ( is_object( $data ) && isset( $data->errorCode ) && isset( $data->errorMessage ) ) { |
|
| 192 | - $this->error = new \WP_Error( 'omnikassa_2_error', $data->errorMessage, $data ); |
|
| 191 | + if (is_object($data) && isset($data->errorCode) && isset($data->errorMessage)) { |
|
| 192 | + $this->error = new \WP_Error('omnikassa_2_error', $data->errorMessage, $data); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ( is_object( $data ) && '201' != wp_remote_retrieve_response_code( $response ) ) { // WPCS: loose comparison ok. |
|
| 196 | - if ( isset( $data->consumerMessage ) ) { |
|
| 195 | + if (is_object($data) && '201' != wp_remote_retrieve_response_code($response)) { // WPCS: loose comparison ok. |
|
| 196 | + if (isset($data->consumerMessage)) { |
|
| 197 | 197 | $message = $data->consumerMessage; |
| 198 | - } elseif ( isset( $data->errorMessage ) ) { |
|
| 198 | + } elseif (isset($data->errorMessage)) { |
|
| 199 | 199 | $message = $data->errorMessage; |
| 200 | 200 | } else { |
| 201 | 201 | $message = 'Unknown error.'; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $this->error = new \WP_Error( 'omnikassa_2_error', $message, $data ); |
|
| 204 | + $this->error = new \WP_Error('omnikassa_2_error', $message, $data); |
|
| 205 | 205 | |
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if ( ! is_object( $data ) ) { |
|
| 210 | - $this->error = new \WP_Error( 'omnikassa_2_error', 'Could not parse response.' ); |
|
| 209 | + if ( ! is_object($data)) { |
|
| 210 | + $this->error = new \WP_Error('omnikassa_2_error', 'Could not parse response.'); |
|
| 211 | 211 | |
| 212 | 212 | return false; |
| 213 | 213 | } |
@@ -215,47 +215,47 @@ discard block |
||
| 215 | 215 | return $data; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - public function retrieve_announcement( $announcement ) { |
|
| 219 | - if ( ! is_object( $announcement ) ) { |
|
| 218 | + public function retrieve_announcement($announcement) { |
|
| 219 | + if ( ! is_object($announcement)) { |
|
| 220 | 220 | return; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | $url = $this->get_url() . 'order/server/api/events/results/' . $announcement->eventName; |
| 224 | 224 | |
| 225 | - $response = wp_remote_get( $url, $this->get_remote_request_args( array( |
|
| 225 | + $response = wp_remote_get($url, $this->get_remote_request_args(array( |
|
| 226 | 226 | 'headers' => array( |
| 227 | 227 | 'Authorization' => 'Bearer ' . $announcement->authentication, |
| 228 | 228 | ), |
| 229 | - ) ) ); |
|
| 229 | + ))); |
|
| 230 | 230 | |
| 231 | - if ( is_wp_error( $response ) ) { |
|
| 231 | + if (is_wp_error($response)) { |
|
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $body = wp_remote_retrieve_body( $response ); |
|
| 235 | + $body = wp_remote_retrieve_body($response); |
|
| 236 | 236 | |
| 237 | - $data = json_decode( $body ); |
|
| 237 | + $data = json_decode($body); |
|
| 238 | 238 | |
| 239 | - if ( is_object( $data ) && isset( $data->errorCode ) && isset( $data->errorMessage ) ) { |
|
| 240 | - $this->error = new \WP_Error( 'omnikassa_2_error', $data->errorMessage, $data ); |
|
| 239 | + if (is_object($data) && isset($data->errorCode) && isset($data->errorMessage)) { |
|
| 240 | + $this->error = new \WP_Error('omnikassa_2_error', $data->errorMessage, $data); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if ( is_object( $data ) && '200' != wp_remote_retrieve_response_code( $response ) ) { // WPCS: loose comparison ok. |
|
| 244 | - if ( isset( $data->consumerMessage ) ) { |
|
| 243 | + if (is_object($data) && '200' != wp_remote_retrieve_response_code($response)) { // WPCS: loose comparison ok. |
|
| 244 | + if (isset($data->consumerMessage)) { |
|
| 245 | 245 | $message = $data->consumerMessage; |
| 246 | - } elseif ( isset( $data->errorMessage ) ) { |
|
| 246 | + } elseif (isset($data->errorMessage)) { |
|
| 247 | 247 | $message = $data->errorMessage; |
| 248 | 248 | } else { |
| 249 | 249 | $message = 'Unknown error.'; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - $this->error = new \WP_Error( 'omnikassa_2_error', $message, $data ); |
|
| 252 | + $this->error = new \WP_Error('omnikassa_2_error', $message, $data); |
|
| 253 | 253 | |
| 254 | 254 | return false; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - if ( ! is_object( $data ) ) { |
|
| 258 | - $this->error = new \WP_Error( 'omnikassa_2_error', 'Could not parse response.' ); |
|
| 257 | + if ( ! is_object($data)) { |
|
| 258 | + $this->error = new \WP_Error('omnikassa_2_error', 'Could not parse response.'); |
|
| 259 | 259 | |
| 260 | 260 | return false; |
| 261 | 261 | } |
@@ -22,25 +22,25 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @param \Pronamic\WordPress\Pay\Gateways\OmniKassa2\Config $config |
| 24 | 24 | */ |
| 25 | - public function __construct( Config $config ) { |
|
| 26 | - parent::__construct( $config ); |
|
| 25 | + public function __construct(Config $config) { |
|
| 26 | + parent::__construct($config); |
|
| 27 | 27 | |
| 28 | - $this->set_method( self::METHOD_HTTP_REDIRECT ); |
|
| 29 | - $this->set_has_feedback( true ); |
|
| 30 | - $this->set_amount_minimum( 0.01 ); |
|
| 28 | + $this->set_method(self::METHOD_HTTP_REDIRECT); |
|
| 29 | + $this->set_has_feedback(true); |
|
| 30 | + $this->set_amount_minimum(0.01); |
|
| 31 | 31 | |
| 32 | 32 | // Client |
| 33 | 33 | $this->client = new Client(); |
| 34 | 34 | |
| 35 | 35 | $url = Client::URL_PRODUCTION; |
| 36 | 36 | |
| 37 | - if ( self::MODE_TEST === $config->mode ) { |
|
| 37 | + if (self::MODE_TEST === $config->mode) { |
|
| 38 | 38 | $url = Client::URL_SANDBOX; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $this->client->set_url( $url ); |
|
| 42 | - $this->client->set_refresh_token( $config->refresh_token ); |
|
| 43 | - $this->client->set_signing_key( $config->signing_key ); |
|
| 41 | + $this->client->set_url($url); |
|
| 42 | + $this->client->set_refresh_token($config->refresh_token); |
|
| 43 | + $this->client->set_signing_key($config->signing_key); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -64,29 +64,29 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @param Payment $payment |
| 66 | 66 | */ |
| 67 | - public function start( Payment $payment ) { |
|
| 67 | + public function start(Payment $payment) { |
|
| 68 | 68 | $order = new Order(); |
| 69 | 69 | |
| 70 | - $order->timestamp = date( DATE_ATOM ); |
|
| 71 | - $order->merchant_order_id = $payment->format_string( $this->config->order_id ); |
|
| 70 | + $order->timestamp = date(DATE_ATOM); |
|
| 71 | + $order->merchant_order_id = $payment->format_string($this->config->order_id); |
|
| 72 | 72 | $order->description = $payment->get_description(); |
| 73 | 73 | $order->amount = $payment->get_amount()->get_amount(); |
| 74 | 74 | $order->currency = $payment->get_currency(); |
| 75 | 75 | $order->language = $payment->get_language(); |
| 76 | 76 | $order->merchant_return_url = $payment->get_return_url(); |
| 77 | - $order->payment_brand = Methods::transform( $payment->get_method() ); |
|
| 77 | + $order->payment_brand = Methods::transform($payment->get_method()); |
|
| 78 | 78 | |
| 79 | - if ( null !== $order->payment_brand ) { |
|
| 79 | + if (null !== $order->payment_brand) { |
|
| 80 | 80 | // Payment brand force should only be set if payment brand is not empty. |
| 81 | 81 | $order->payment_brand_force = PaymentBrandForce::FORCE_ONCE; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if ( ! $this->config->is_access_token_valid() ) { |
|
| 84 | + if ( ! $this->config->is_access_token_valid()) { |
|
| 85 | 85 | $data = $this->client->get_access_token_data(); |
| 86 | 86 | |
| 87 | 87 | $error = $this->client->get_error(); |
| 88 | 88 | |
| 89 | - if ( is_wp_error( $error ) ) { |
|
| 89 | + if (is_wp_error($error)) { |
|
| 90 | 90 | $this->error = $error; |
| 91 | 91 | |
| 92 | 92 | return; |
@@ -95,22 +95,22 @@ discard block |
||
| 95 | 95 | $this->config->access_token = $data->token; |
| 96 | 96 | $this->config->access_token_valid_until = $data->validUntil; |
| 97 | 97 | |
| 98 | - update_post_meta( $this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token', $data->token ); |
|
| 99 | - update_post_meta( $this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', $data->validUntil ); |
|
| 98 | + update_post_meta($this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token', $data->token); |
|
| 99 | + update_post_meta($this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', $data->validUntil); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $result = $this->client->order_announce( $this->config, $order ); |
|
| 102 | + $result = $this->client->order_announce($this->config, $order); |
|
| 103 | 103 | |
| 104 | 104 | $error = $this->client->get_error(); |
| 105 | 105 | |
| 106 | - if ( is_wp_error( $error ) ) { |
|
| 106 | + if (is_wp_error($error)) { |
|
| 107 | 107 | $this->error = $error; |
| 108 | 108 | |
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if ( $result ) { |
|
| 113 | - $payment->set_action_url( $result->redirectUrl ); |
|
| 112 | + if ($result) { |
|
| 113 | + $payment->set_action_url($result->redirectUrl); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -119,46 +119,46 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @param Payment $payment |
| 121 | 121 | */ |
| 122 | - public function update_status( Payment $payment ) { |
|
| 122 | + public function update_status(Payment $payment) { |
|
| 123 | 123 | $input_status = null; |
| 124 | 124 | |
| 125 | 125 | // Update status on customer return |
| 126 | - if ( filter_has_var( INPUT_GET, 'status' ) && filter_has_var( INPUT_GET, 'signature' ) ) { |
|
| 126 | + if (filter_has_var(INPUT_GET, 'status') && filter_has_var(INPUT_GET, 'signature')) { |
|
| 127 | 127 | // Input data |
| 128 | - $input_status = filter_input( INPUT_GET, 'status', FILTER_SANITIZE_STRING ); |
|
| 129 | - $input_signature = filter_input( INPUT_GET, 'signature', FILTER_SANITIZE_STRING ); |
|
| 128 | + $input_status = filter_input(INPUT_GET, 'status', FILTER_SANITIZE_STRING); |
|
| 129 | + $input_signature = filter_input(INPUT_GET, 'signature', FILTER_SANITIZE_STRING); |
|
| 130 | 130 | |
| 131 | 131 | // Validate signature |
| 132 | 132 | $merchant_order_id = $payment->get_id(); |
| 133 | 133 | |
| 134 | - if ( '{order_id}' === $this->config->order_id ) { |
|
| 134 | + if ('{order_id}' === $this->config->order_id) { |
|
| 135 | 135 | $merchant_order_id = $payment->get_order_id(); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $data = array( $merchant_order_id, $input_status ); |
|
| 138 | + $data = array($merchant_order_id, $input_status); |
|
| 139 | 139 | |
| 140 | - $signature = Security::calculate_signature( $data, $this->config->signing_key ); |
|
| 140 | + $signature = Security::calculate_signature($data, $this->config->signing_key); |
|
| 141 | 141 | |
| 142 | - if ( ! Security::validate_signature( $input_signature, $signature ) ) { |
|
| 142 | + if ( ! Security::validate_signature($input_signature, $signature)) { |
|
| 143 | 143 | // Invalid signature |
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Update status via webhook |
| 149 | - if ( isset( $payment->meta['omnikassa_2_update_order_status'] ) ) { |
|
| 149 | + if (isset($payment->meta['omnikassa_2_update_order_status'])) { |
|
| 150 | 150 | $input_status = $payment->meta['omnikassa_2_update_order_status']; |
| 151 | 151 | |
| 152 | - $payment->set_meta( 'omnikassa_2_update_order_status', null ); |
|
| 152 | + $payment->set_meta('omnikassa_2_update_order_status', null); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if ( ! $input_status ) { |
|
| 155 | + if ( ! $input_status) { |
|
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | // Update payment status |
| 160 | - $status = Statuses::transform( $input_status ); |
|
| 160 | + $status = Statuses::transform($input_status); |
|
| 161 | 161 | |
| 162 | - $payment->set_status( $status ); |
|
| 162 | + $payment->set_status($status); |
|
| 163 | 163 | } |
| 164 | 164 | } |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | $more_results_available, |
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | - if ( ! $this->order_results ) { |
|
| 27 | + if ( ! $this->order_results) { |
|
| 28 | 28 | return $data; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - foreach ( $this->order_results as $order ) { |
|
| 31 | + foreach ($this->order_results as $order) { |
|
| 32 | 32 | $order_data = array( |
| 33 | 33 | $order->merchantOrderId, |
| 34 | 34 | $order->omnikassaOrderId, |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $order->totalAmount->amount, |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - $data = array_merge( $data, $order_data ); |
|
| 45 | + $data = array_merge($data, $order_data); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | return $data; |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | $this->provider = 'rabobank'; |
| 24 | 24 | |
| 25 | 25 | // Actions |
| 26 | - $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
|
| 26 | + $function = array(__NAMESPACE__ . '\Listener', 'listen'); |
|
| 27 | 27 | |
| 28 | - if ( ! has_action( 'wp_loaded', $function ) ) { |
|
| 29 | - add_action( 'wp_loaded', $function ); |
|
| 28 | + if ( ! has_action('wp_loaded', $function)) { |
|
| 29 | + add_action('wp_loaded', $function); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | 'description' => $this->description, |
| 47 | 47 | 'amount' => (object) array( |
| 48 | 48 | 'currency' => $this->currency, |
| 49 | - 'amount' => Core_Util::amount_to_cents( $this->amount ), |
|
| 49 | + 'amount' => Core_Util::amount_to_cents($this->amount), |
|
| 50 | 50 | ), |
| 51 | 51 | 'language' => $this->language, |
| 52 | 52 | 'merchantReturnURL' => $this->merchant_return_url, |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $this->timestamp, |
| 64 | 64 | $this->merchant_order_id, |
| 65 | 65 | $this->currency, |
| 66 | - Core_Util::amount_to_cents( $this->amount ), |
|
| 66 | + Core_Util::amount_to_cents($this->amount), |
|
| 67 | 67 | $this->language, |
| 68 | 68 | $this->description, |
| 69 | 69 | $this->merchant_return_url, |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | 78 | // Remove empty optional fields |
| 79 | - $optional = array_filter( $optional ); |
|
| 79 | + $optional = array_filter($optional); |
|
| 80 | 80 | |
| 81 | - return array_merge( $fields, $optional ); |
|
| 81 | + return array_merge($fields, $optional); |
|
| 82 | 82 | } |
| 83 | 83 | } |