@@ -16,18 +16,18 @@ 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 | $sections['multisafepay'] = array( |
| 25 | - 'title' => __( 'MultiSafepay', 'pronamic_ideal' ), |
|
| 26 | - 'methods' => array( 'multisafepay' ), |
|
| 25 | + 'title' => __('MultiSafepay', 'pronamic_ideal'), |
|
| 26 | + 'methods' => array('multisafepay'), |
|
| 27 | 27 | 'description' => sprintf( |
| 28 | 28 | /* translators: 1: MultiSafepay */ |
| 29 | - __( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ), |
|
| 30 | - __( 'MultiSafepay', 'pronamic_ideal' ) |
|
| 29 | + __('Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal'), |
|
| 30 | + __('MultiSafepay', 'pronamic_ideal') |
|
| 31 | 31 | ), |
| 32 | 32 | ); |
| 33 | 33 | |
@@ -35,21 +35,21 @@ discard block |
||
| 35 | 35 | return $sections; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function fields( array $fields ) { |
|
| 38 | + public function fields(array $fields) { |
|
| 39 | 39 | // Account ID |
| 40 | 40 | $fields[] = array( |
| 41 | 41 | 'filter' => FILTER_SANITIZE_STRING, |
| 42 | 42 | 'section' => 'multisafepay', |
| 43 | 43 | 'meta_key' => '_pronamic_gateway_multisafepay_account_id', |
| 44 | - 'title' => __( 'Account ID', 'pronamic_ideal' ), |
|
| 44 | + 'title' => __('Account ID', 'pronamic_ideal'), |
|
| 45 | 45 | 'type' => 'text', |
| 46 | - 'classes' => array( 'code' ), |
|
| 47 | - 'methods' => array( 'multisafepay_connect' ), |
|
| 46 | + 'classes' => array('code'), |
|
| 47 | + 'methods' => array('multisafepay_connect'), |
|
| 48 | 48 | 'tooltip' => sprintf( |
| 49 | 49 | '%s %s.', |
| 50 | - __( 'Account ID', 'pronamic_ideal' ), |
|
| 50 | + __('Account ID', 'pronamic_ideal'), |
|
| 51 | 51 | /* translators: %s: MultiSafepay */ |
| 52 | - sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
|
| 52 | + sprintf(__('as mentioned in the %s dashboard', 'pronamic_ideal'), __('MultiSafepay', 'pronamic_ideal')) |
|
| 53 | 53 | ), |
| 54 | 54 | ); |
| 55 | 55 | |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | 'filter' => FILTER_SANITIZE_STRING, |
| 59 | 59 | 'section' => 'multisafepay', |
| 60 | 60 | 'meta_key' => '_pronamic_gateway_multisafepay_site_id', |
| 61 | - 'title' => __( 'Site ID', 'pronamic_ideal' ), |
|
| 61 | + 'title' => __('Site ID', 'pronamic_ideal'), |
|
| 62 | 62 | 'type' => 'text', |
| 63 | - 'classes' => array( 'code' ), |
|
| 64 | - 'methods' => array( 'multisafepay_connect' ), |
|
| 63 | + 'classes' => array('code'), |
|
| 64 | + 'methods' => array('multisafepay_connect'), |
|
| 65 | 65 | 'tooltip' => sprintf( |
| 66 | 66 | '%s %s.', |
| 67 | - __( 'Site ID', 'pronamic_ideal' ), |
|
| 67 | + __('Site ID', 'pronamic_ideal'), |
|
| 68 | 68 | /* translators: %s: MultiSafepay */ |
| 69 | - sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
|
| 69 | + sprintf(__('as mentioned in the %s dashboard', 'pronamic_ideal'), __('MultiSafepay', 'pronamic_ideal')) |
|
| 70 | 70 | ), |
| 71 | 71 | ); |
| 72 | 72 | |
@@ -75,26 +75,26 @@ discard block |
||
| 75 | 75 | 'filter' => FILTER_SANITIZE_STRING, |
| 76 | 76 | 'section' => 'multisafepay', |
| 77 | 77 | 'meta_key' => '_pronamic_gateway_multisafepay_site_code', |
| 78 | - 'title' => __( 'Site Security Code', 'pronamic_ideal' ), |
|
| 78 | + 'title' => __('Site Security Code', 'pronamic_ideal'), |
|
| 79 | 79 | 'type' => 'text', |
| 80 | - 'classes' => array( 'code' ), |
|
| 81 | - 'methods' => array( 'multisafepay_connect' ), |
|
| 80 | + 'classes' => array('code'), |
|
| 81 | + 'methods' => array('multisafepay_connect'), |
|
| 82 | 82 | 'tooltip' => sprintf( |
| 83 | 83 | '%s %s.', |
| 84 | - __( 'Site Security Code', 'pronamic_ideal' ), |
|
| 84 | + __('Site Security Code', 'pronamic_ideal'), |
|
| 85 | 85 | /* translators: %s: MultiSafepay */ |
| 86 | - sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
|
| 86 | + sprintf(__('as mentioned in the %s dashboard', 'pronamic_ideal'), __('MultiSafepay', 'pronamic_ideal')) |
|
| 87 | 87 | ), |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | // Transaction feedback |
| 91 | 91 | $fields[] = array( |
| 92 | 92 | 'section' => 'multisafepay', |
| 93 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 93 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 94 | 94 | 'type' => 'description', |
| 95 | 95 | 'html' => sprintf( |
| 96 | 96 | '<span class="dashicons dashicons-yes"></span> %s', |
| 97 | - __( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
| 97 | + __('Payment status updates will be processed without any additional configuration.', 'pronamic_ideal') |
|
| 98 | 98 | ), |
| 99 | 99 | ); |
| 100 | 100 | |
@@ -170,13 +170,13 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return string |
| 172 | 172 | */ |
| 173 | - public static function transform( $payment_method, $default = null ) { |
|
| 174 | - if ( ! is_scalar( $payment_method ) ) { |
|
| 173 | + public static function transform($payment_method, $default = null) { |
|
| 174 | + if ( ! is_scalar($payment_method)) { |
|
| 175 | 175 | return null; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if ( isset( self::$map[ $payment_method ] ) ) { |
|
| 179 | - return self::$map[ $payment_method ]; |
|
| 178 | + if (isset(self::$map[$payment_method])) { |
|
| 179 | + return self::$map[$payment_method]; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | return $default; |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | * |
| 192 | 192 | * @return string |
| 193 | 193 | */ |
| 194 | - public static function transform_gateway_method( $method ) { |
|
| 195 | - if ( ! is_scalar( $method ) ) { |
|
| 194 | + public static function transform_gateway_method($method) { |
|
| 195 | + if ( ! is_scalar($method)) { |
|
| 196 | 196 | return null; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $payment_method = array_search( $method, self::$map, true ); |
|
| 199 | + $payment_method = array_search($method, self::$map, true); |
|
| 200 | 200 | |
| 201 | - if ( ! $payment_method ) { |
|
| 201 | + if ( ! $payment_method) { |
|
| 202 | 202 | return null; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -40,18 +40,18 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | - public static function generate( $amount, $currency, $account, $site_id, $transaction_id ) { |
|
| 43 | + public static function generate($amount, $currency, $account, $site_id, $transaction_id) { |
|
| 44 | 44 | $values = array( |
| 45 | - Util::amount_to_cents( $amount ), |
|
| 45 | + Util::amount_to_cents($amount), |
|
| 46 | 46 | $currency, |
| 47 | 47 | $account, |
| 48 | 48 | $site_id, |
| 49 | 49 | $transaction_id, |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | - $string = implode( '', $values ); |
|
| 52 | + $string = implode('', $values); |
|
| 53 | 53 | |
| 54 | - $signature = md5( $string ); |
|
| 54 | + $signature = md5($string); |
|
| 55 | 55 | |
| 56 | 56 | return $signature; |
| 57 | 57 | } |
@@ -24,15 +24,15 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @return Config |
| 26 | 26 | */ |
| 27 | - public function get_config( $post_id ) { |
|
| 27 | + public function get_config($post_id) { |
|
| 28 | 28 | $config = new Config(); |
| 29 | 29 | |
| 30 | - $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
| 31 | - $config->account_id = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_account_id', true ); |
|
| 32 | - $config->site_id = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_id', true ); |
|
| 33 | - $config->site_code = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_code', true ); |
|
| 30 | + $config->mode = get_post_meta($post_id, '_pronamic_gateway_mode', true); |
|
| 31 | + $config->account_id = get_post_meta($post_id, '_pronamic_gateway_multisafepay_account_id', true); |
|
| 32 | + $config->site_id = get_post_meta($post_id, '_pronamic_gateway_multisafepay_site_id', true); |
|
| 33 | + $config->site_code = get_post_meta($post_id, '_pronamic_gateway_multisafepay_site_code', true); |
|
| 34 | 34 | |
| 35 | - if ( Gateway::MODE_TEST === $config->mode ) { |
|
| 35 | + if (Gateway::MODE_TEST === $config->mode) { |
|
| 36 | 36 | $config->api_url = MultiSafepay::API_TEST_URL; |
| 37 | 37 | } else { |
| 38 | 38 | $config->api_url = MultiSafepay::API_PRODUCTION_URL; |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @param Config $config |
| 42 | 42 | */ |
| 43 | - public function __construct( Config $config ) { |
|
| 44 | - parent::__construct( $config ); |
|
| 43 | + public function __construct(Config $config) { |
|
| 44 | + parent::__construct($config); |
|
| 45 | 45 | |
| 46 | 46 | $this->supports = array( |
| 47 | 47 | 'payment_status_request', |
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | - $this->set_method( Gateway::METHOD_HTTP_REDIRECT ); |
|
| 51 | - $this->set_has_feedback( true ); |
|
| 52 | - $this->set_amount_minimum( 0 ); |
|
| 53 | - $this->set_slug( self::SLUG ); |
|
| 50 | + $this->set_method(Gateway::METHOD_HTTP_REDIRECT); |
|
| 51 | + $this->set_has_feedback(true); |
|
| 52 | + $this->set_amount_minimum(0); |
|
| 53 | + $this->set_slug(self::SLUG); |
|
| 54 | 54 | |
| 55 | 55 | $this->client = new Client(); |
| 56 | 56 | |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | $merchant->site_id = $this->config->site_id; |
| 73 | 73 | $merchant->site_secure_code = $this->config->site_code; |
| 74 | 74 | |
| 75 | - $result = $this->client->get_ideal_issuers( $merchant ); |
|
| 75 | + $result = $this->client->get_ideal_issuers($merchant); |
|
| 76 | 76 | |
| 77 | - if ( $result ) { |
|
| 77 | + if ($result) { |
|
| 78 | 78 | $groups[] = array( |
| 79 | 79 | 'options' => $result, |
| 80 | 80 | ); |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | public function get_credit_card_issuers() { |
| 92 | 92 | $groups[] = array( |
| 93 | 93 | 'options' => array( |
| 94 | - Methods::AMEX => _x( 'AMEX', 'Payment method name', 'pronamic_ideal' ), |
|
| 95 | - Methods::MAESTRO => _x( 'Maestro', 'Payment method name', 'pronamic_ideal' ), |
|
| 96 | - Methods::MASTERCARD => _x( 'MASTER', 'Payment method name', 'pronamic_ideal' ), |
|
| 97 | - Methods::VISA => _x( 'VISA', 'Payment method name', 'pronamic_ideal' ), |
|
| 94 | + Methods::AMEX => _x('AMEX', 'Payment method name', 'pronamic_ideal'), |
|
| 95 | + Methods::MAESTRO => _x('Maestro', 'Payment method name', 'pronamic_ideal'), |
|
| 96 | + Methods::MASTERCARD => _x('MASTER', 'Payment method name', 'pronamic_ideal'), |
|
| 97 | + Methods::VISA => _x('VISA', 'Payment method name', 'pronamic_ideal'), |
|
| 98 | 98 | ), |
| 99 | 99 | ); |
| 100 | 100 | |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | * @since 1.2.0 |
| 108 | 108 | */ |
| 109 | 109 | public function get_issuer_field() { |
| 110 | - switch ( $this->get_payment_method() ) { |
|
| 110 | + switch ($this->get_payment_method()) { |
|
| 111 | 111 | case PaymentMethods::IDEAL: |
| 112 | 112 | return array( |
| 113 | 113 | 'id' => 'pronamic_ideal_issuer_id', |
| 114 | 114 | 'name' => 'pronamic_ideal_issuer_id', |
| 115 | - 'label' => __( 'Choose your bank', 'pronamic_ideal' ), |
|
| 115 | + 'label' => __('Choose your bank', 'pronamic_ideal'), |
|
| 116 | 116 | 'required' => true, |
| 117 | 117 | 'type' => 'select', |
| 118 | 118 | 'choices' => $this->get_transient_issuers(), |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | return array( |
| 123 | 123 | 'id' => 'pronamic_credit_card_issuer_id', |
| 124 | 124 | 'name' => 'pronamic_credit_card_issuer_id', |
| 125 | - 'label' => __( 'Choose your credit card issuer', 'pronamic_ideal' ), |
|
| 125 | + 'label' => __('Choose your credit card issuer', 'pronamic_ideal'), |
|
| 126 | 126 | 'required' => true, |
| 127 | 127 | 'type' => 'select', |
| 128 | 128 | 'choices' => $this->get_transient_credit_card_issuers(), |
@@ -148,18 +148,18 @@ discard block |
||
| 148 | 148 | $customer = new Customer(); |
| 149 | 149 | |
| 150 | 150 | // Get gateways. |
| 151 | - $result = $this->client->get_gateways( $merchant, $customer ); |
|
| 151 | + $result = $this->client->get_gateways($merchant, $customer); |
|
| 152 | 152 | |
| 153 | - if ( ! $result ) { |
|
| 153 | + if ( ! $result) { |
|
| 154 | 154 | $this->error = $this->client->get_error(); |
| 155 | 155 | |
| 156 | 156 | return $payment_methods; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - foreach ( $result as $method => $title ) { |
|
| 160 | - $payment_method = Methods::transform_gateway_method( $method ); |
|
| 159 | + foreach ($result as $method => $title) { |
|
| 160 | + $payment_method = Methods::transform_gateway_method($method); |
|
| 161 | 161 | |
| 162 | - if ( $payment_method ) { |
|
| 162 | + if ($payment_method) { |
|
| 163 | 163 | $payment_methods[] = $payment_method; |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @param Payment $payment payment object |
| 196 | 196 | */ |
| 197 | - public function start( Payment $payment ) { |
|
| 197 | + public function start(Payment $payment) { |
|
| 198 | 198 | $payment_method = $payment->get_method(); |
| 199 | 199 | |
| 200 | 200 | $transaction_description = $payment->get_description(); |
| 201 | 201 | |
| 202 | - if ( empty( $transaction_description ) ) { |
|
| 202 | + if (empty($transaction_description)) { |
|
| 203 | 203 | $transaction_description = $payment->get_id(); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | // Customer |
| 217 | 217 | $customer = new Customer(); |
| 218 | 218 | $customer->locale = $payment->get_locale(); |
| 219 | - $customer->ip_address = Server::get( 'REMOTE_ADDR', FILTER_VALIDATE_IP ); |
|
| 220 | - $customer->forwarded_ip = Server::get( 'HTTP_X_FORWARDED_FOR', FILTER_VALIDATE_IP ); |
|
| 219 | + $customer->ip_address = Server::get('REMOTE_ADDR', FILTER_VALIDATE_IP); |
|
| 220 | + $customer->forwarded_ip = Server::get('HTTP_X_FORWARDED_FOR', FILTER_VALIDATE_IP); |
|
| 221 | 221 | $customer->first_name = $payment->get_first_name(); |
| 222 | 222 | $customer->last_name = $payment->get_last_name(); |
| 223 | 223 | $customer->email = $payment->get_email(); |
@@ -229,96 +229,96 @@ discard block |
||
| 229 | 229 | $transaction->amount = $payment->get_amount()->get_amount(); |
| 230 | 230 | $transaction->description = $transaction_description; |
| 231 | 231 | |
| 232 | - switch ( $payment_method ) { |
|
| 232 | + switch ($payment_method) { |
|
| 233 | 233 | case PaymentMethods::IDEAL: |
| 234 | 234 | $transaction->gateway = Methods::IDEAL; |
| 235 | 235 | |
| 236 | 236 | $issuer = $payment->get_issuer(); |
| 237 | 237 | |
| 238 | - if ( empty( $issuer ) ) { |
|
| 239 | - $message = new RedirectTransactionRequestMessage( $merchant, $customer, $transaction ); |
|
| 238 | + if (empty($issuer)) { |
|
| 239 | + $message = new RedirectTransactionRequestMessage($merchant, $customer, $transaction); |
|
| 240 | 240 | } else { |
| 241 | 241 | $gateway_info = new GatewayInfo(); |
| 242 | 242 | |
| 243 | 243 | $gateway_info->issuer_id = $issuer; |
| 244 | 244 | |
| 245 | - $message = new DirectTransactionRequestMessage( $merchant, $customer, $transaction, $gateway_info ); |
|
| 245 | + $message = new DirectTransactionRequestMessage($merchant, $customer, $transaction, $gateway_info); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | break; |
| 249 | 249 | case PaymentMethods::CREDIT_CARD: |
| 250 | - $gateway = Methods::transform( $payment_method ); |
|
| 250 | + $gateway = Methods::transform($payment_method); |
|
| 251 | 251 | |
| 252 | 252 | $issuer = $payment->get_issuer(); |
| 253 | 253 | |
| 254 | - if ( empty( $issuer ) ) { |
|
| 255 | - if ( $gateway ) { |
|
| 254 | + if (empty($issuer)) { |
|
| 255 | + if ($gateway) { |
|
| 256 | 256 | $transaction->gateway = $gateway; |
| 257 | 257 | } |
| 258 | 258 | } else { |
| 259 | 259 | $transaction->gateway = $issuer; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - $message = new RedirectTransactionRequestMessage( $merchant, $customer, $transaction ); |
|
| 262 | + $message = new RedirectTransactionRequestMessage($merchant, $customer, $transaction); |
|
| 263 | 263 | |
| 264 | 264 | break; |
| 265 | 265 | default: |
| 266 | - $gateway = Methods::transform( $payment_method ); |
|
| 266 | + $gateway = Methods::transform($payment_method); |
|
| 267 | 267 | |
| 268 | - if ( $gateway ) { |
|
| 268 | + if ($gateway) { |
|
| 269 | 269 | $transaction->gateway = $gateway; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if ( ! isset( $transaction->gateway ) && ! empty( $payment_method ) ) { |
|
| 272 | + if ( ! isset($transaction->gateway) && ! empty($payment_method)) { |
|
| 273 | 273 | // Leap of faith if the WordPress payment method could not transform to a Mollie method? |
| 274 | 274 | $transaction->gateway = $payment_method; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - $message = new RedirectTransactionRequestMessage( $merchant, $customer, $transaction ); |
|
| 277 | + $message = new RedirectTransactionRequestMessage($merchant, $customer, $transaction); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $signature = Signature::generate( $transaction->amount, $transaction->currency, $merchant->account, $merchant->site_id, $transaction->id ); |
|
| 280 | + $signature = Signature::generate($transaction->amount, $transaction->currency, $merchant->account, $merchant->site_id, $transaction->id); |
|
| 281 | 281 | |
| 282 | 282 | $message->signature = $signature; |
| 283 | 283 | |
| 284 | - $response = $this->client->start_transaction( $message ); |
|
| 284 | + $response = $this->client->start_transaction($message); |
|
| 285 | 285 | |
| 286 | - if ( $response ) { |
|
| 286 | + if ($response) { |
|
| 287 | 287 | $transaction = $response->transaction; |
| 288 | 288 | |
| 289 | - $payment->set_transaction_id( $transaction->id ); |
|
| 289 | + $payment->set_transaction_id($transaction->id); |
|
| 290 | 290 | |
| 291 | - if ( isset( $transaction->payment_url ) ) { |
|
| 292 | - $payment->set_action_url( $transaction->payment_url ); |
|
| 291 | + if (isset($transaction->payment_url)) { |
|
| 292 | + $payment->set_action_url($transaction->payment_url); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if ( isset( $response->gateway_info->redirect_url ) ) { |
|
| 296 | - $payment->set_action_url( $response->gateway_info->redirect_url ); |
|
| 295 | + if (isset($response->gateway_info->redirect_url)) { |
|
| 296 | + $payment->set_action_url($response->gateway_info->redirect_url); |
|
| 297 | 297 | } |
| 298 | 298 | } else { |
| 299 | 299 | $this->error = $this->client->get_error(); |
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - public function update_status( Payment $payment ) { |
|
| 303 | + public function update_status(Payment $payment) { |
|
| 304 | 304 | $merchant = new Merchant(); |
| 305 | 305 | |
| 306 | 306 | $merchant->account = $this->config->account_id; |
| 307 | 307 | $merchant->site_id = $this->config->site_id; |
| 308 | 308 | $merchant->site_secure_code = $this->config->site_code; |
| 309 | 309 | |
| 310 | - $message = new StatusRequestMessage( $merchant, $payment->get_transaction_id() ); |
|
| 310 | + $message = new StatusRequestMessage($merchant, $payment->get_transaction_id()); |
|
| 311 | 311 | |
| 312 | - $result = $this->client->get_status( $message ); |
|
| 312 | + $result = $this->client->get_status($message); |
|
| 313 | 313 | |
| 314 | - if ( $result ) { |
|
| 315 | - $status = Statuses::transform( $result->ewallet->status ); |
|
| 314 | + if ($result) { |
|
| 315 | + $status = Statuses::transform($result->ewallet->status); |
|
| 316 | 316 | |
| 317 | - $payment->set_status( $status ); |
|
| 318 | - $payment->set_consumer_name( $result->payment_details->account_holder_name ); |
|
| 319 | - $payment->set_consumer_iban( $result->payment_details->account_iban ); |
|
| 320 | - $payment->set_consumer_bic( $result->payment_details->account_bic ); |
|
| 321 | - $payment->set_consumer_account_number( $result->payment_details->account_id ); |
|
| 317 | + $payment->set_status($status); |
|
| 318 | + $payment->set_consumer_name($result->payment_details->account_holder_name); |
|
| 319 | + $payment->set_consumer_iban($result->payment_details->account_iban); |
|
| 320 | + $payment->set_consumer_bic($result->payment_details->account_bic); |
|
| 321 | + $payment->set_consumer_account_number($result->payment_details->account_id); |
|
| 322 | 322 | } else { |
| 323 | 323 | $this->error = $this->client->get_error(); |
| 324 | 324 | } |
@@ -70,8 +70,8 @@ |
||
| 70 | 70 | * |
| 71 | 71 | * @return null|string |
| 72 | 72 | */ |
| 73 | - public static function transform( $status ) { |
|
| 74 | - switch ( $status ) { |
|
| 73 | + public static function transform($status) { |
|
| 74 | + switch ($status) { |
|
| 75 | 75 | case self::COMPLETED: |
| 76 | 76 | return Core_Statuses::SUCCESS; |
| 77 | 77 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | $this->id = 'multisafepay-connect'; |
| 20 | 20 | $this->name = 'MultiSafepay - Connect'; |
| 21 | 21 | $this->url = 'http://www.multisafepay.com/'; |
| 22 | - $this->product_url = __( 'http://www.multisafepay.com/', 'pronamic_ideal' ); |
|
| 22 | + $this->product_url = __('http://www.multisafepay.com/', 'pronamic_ideal'); |
|
| 23 | 23 | $this->dashboard_url = 'https://merchant.multisafepay.com/'; |
| 24 | 24 | $this->provider = 'multisafepay'; |
| 25 | 25 | } |
@@ -57,50 +57,50 @@ discard block |
||
| 57 | 57 | return $this->error; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - private function parse_xml( $xml ) { |
|
| 61 | - switch ( $xml->getName() ) { |
|
| 60 | + private function parse_xml($xml) { |
|
| 61 | + switch ($xml->getName()) { |
|
| 62 | 62 | case IDealIssuersRequestMessage::NAME: |
| 63 | - return IDealIssuersResponseMessage::parse( $xml ); |
|
| 63 | + return IDealIssuersResponseMessage::parse($xml); |
|
| 64 | 64 | |
| 65 | 65 | case GatewaysRequestMessage::NAME: |
| 66 | - return GatewaysResponseMessage::parse( $xml ); |
|
| 66 | + return GatewaysResponseMessage::parse($xml); |
|
| 67 | 67 | |
| 68 | 68 | case DirectTransactionRequestMessage::NAME: |
| 69 | - return DirectTransactionResponseMessage::parse( $xml ); |
|
| 69 | + return DirectTransactionResponseMessage::parse($xml); |
|
| 70 | 70 | |
| 71 | 71 | case RedirectTransactionRequestMessage::NAME: |
| 72 | - return RedirectTransactionResponseMessage::parse( $xml ); |
|
| 72 | + return RedirectTransactionResponseMessage::parse($xml); |
|
| 73 | 73 | |
| 74 | 74 | case StatusRequestMessage::NAME: |
| 75 | - return StatusResponseMessage::parse( $xml ); |
|
| 75 | + return StatusResponseMessage::parse($xml); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - private function request( $message ) { |
|
| 81 | + private function request($message) { |
|
| 82 | 82 | $return = false; |
| 83 | 83 | |
| 84 | - $result = Core_Util::remote_get_body( $this->api_url, 200, array( |
|
| 84 | + $result = Core_Util::remote_get_body($this->api_url, 200, array( |
|
| 85 | 85 | 'method' => 'POST', |
| 86 | 86 | 'body' => (string) $message, |
| 87 | - ) ); |
|
| 87 | + )); |
|
| 88 | 88 | |
| 89 | - if ( is_wp_error( $result ) ) { |
|
| 89 | + if (is_wp_error($result)) { |
|
| 90 | 90 | $this->error = $result; |
| 91 | 91 | |
| 92 | 92 | return false; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $xml = Core_Util::simplexml_load_string( $result ); |
|
| 95 | + $xml = Core_Util::simplexml_load_string($result); |
|
| 96 | 96 | |
| 97 | - if ( is_wp_error( $xml ) ) { |
|
| 97 | + if (is_wp_error($xml)) { |
|
| 98 | 98 | $this->error = $xml; |
| 99 | 99 | } else { |
| 100 | - $return = $this->parse_xml( $xml ); |
|
| 100 | + $return = $this->parse_xml($xml); |
|
| 101 | 101 | |
| 102 | - if ( is_object( $return ) && isset( $return->result ) && 'error' === $return->result ) { |
|
| 103 | - $this->error = new WP_Error( 'multisafepay_error', $xml->error->description, $xml->error ); |
|
| 102 | + if (is_object($return) && isset($return->result) && 'error' === $return->result) { |
|
| 103 | + $this->error = new WP_Error('multisafepay_error', $xml->error->description, $xml->error); |
|
| 104 | 104 | $return = false; |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @since 1.2.0 |
| 115 | 115 | */ |
| 116 | - public function get_ideal_issuers( $merchant ) { |
|
| 116 | + public function get_ideal_issuers($merchant) { |
|
| 117 | 117 | $return = false; |
| 118 | 118 | |
| 119 | - $request = new IDealIssuersRequestMessage( $merchant ); |
|
| 119 | + $request = new IDealIssuersRequestMessage($merchant); |
|
| 120 | 120 | |
| 121 | - $response = $this->request( $request ); |
|
| 121 | + $response = $this->request($request); |
|
| 122 | 122 | |
| 123 | - if ( $response ) { |
|
| 123 | + if ($response) { |
|
| 124 | 124 | $return = $response->issuers; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @since 1.2.0 |
| 134 | 134 | */ |
| 135 | - public function get_gateways( $merchant, $customer ) { |
|
| 135 | + public function get_gateways($merchant, $customer) { |
|
| 136 | 136 | $return = false; |
| 137 | 137 | |
| 138 | - $request = new GatewaysRequestMessage( $merchant, $customer ); |
|
| 138 | + $request = new GatewaysRequestMessage($merchant, $customer); |
|
| 139 | 139 | |
| 140 | - $response = $this->request( $request ); |
|
| 140 | + $response = $this->request($request); |
|
| 141 | 141 | |
| 142 | - if ( $response ) { |
|
| 142 | + if ($response) { |
|
| 143 | 143 | $return = $response->gateways; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @param array $message |
| 153 | 153 | */ |
| 154 | - public function start_transaction( $message ) { |
|
| 154 | + public function start_transaction($message) { |
|
| 155 | 155 | $return = false; |
| 156 | 156 | |
| 157 | - $response = $this->request( $message ); |
|
| 157 | + $response = $this->request($message); |
|
| 158 | 158 | |
| 159 | - if ( $response ) { |
|
| 159 | + if ($response) { |
|
| 160 | 160 | $return = $response; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @param array $message |
| 170 | 170 | */ |
| 171 | - public function get_status( $message ) { |
|
| 171 | + public function get_status($message) { |
|
| 172 | 172 | $return = false; |
| 173 | 173 | |
| 174 | - $response = $this->request( $message ); |
|
| 174 | + $response = $this->request($message); |
|
| 175 | 175 | |
| 176 | - if ( $response ) { |
|
| 176 | + if ($response) { |
|
| 177 | 177 | $return = $response; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | /** |
| 38 | 38 | * Constructs and initialize an message |
| 39 | 39 | */ |
| 40 | - public function __construct( $name ) { |
|
| 40 | + public function __construct($name) { |
|
| 41 | 41 | $this->name = $name; |
| 42 | 42 | } |
| 43 | 43 | |