@@ -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 | |
@@ -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; |
@@ -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 | |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param Merchant $merchant |
| 37 | 37 | */ |
| 38 | - public function __construct( Merchant $merchant ) { |
|
| 39 | - parent::__construct( self::NAME ); |
|
| 38 | + public function __construct(Merchant $merchant) { |
|
| 39 | + parent::__construct(self::NAME); |
|
| 40 | 40 | |
| 41 | 41 | $this->merchant = $merchant; |
| 42 | 42 | } |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | $document = parent::get_document(); |
| 51 | 51 | |
| 52 | 52 | // Merchant |
| 53 | - $merchant = XML_Util::add_element( $document, $document->documentElement, 'merchant' ); |
|
| 53 | + $merchant = XML_Util::add_element($document, $document->documentElement, 'merchant'); |
|
| 54 | 54 | |
| 55 | - XML_Util::add_elements( $document, $merchant, array( |
|
| 55 | + XML_Util::add_elements($document, $merchant, array( |
|
| 56 | 56 | 'account' => $this->merchant->account, |
| 57 | 57 | 'site_id' => $this->merchant->site_id, |
| 58 | 58 | 'site_secure_code' => $this->merchant->site_secure_code, |
| 59 | - ) ); |
|
| 59 | + )); |
|
| 60 | 60 | |
| 61 | 61 | return $document; |
| 62 | 62 | } |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | * @param Merchant $merchant |
| 37 | 37 | * @param $transaction_id |
| 38 | 38 | */ |
| 39 | - public function __construct( Merchant $merchant, $transaction_id ) { |
|
| 40 | - parent::__construct( self::NAME ); |
|
| 39 | + public function __construct(Merchant $merchant, $transaction_id) { |
|
| 40 | + parent::__construct(self::NAME); |
|
| 41 | 41 | |
| 42 | 42 | $this->merchant = $merchant; |
| 43 | 43 | $this->transaction_id = $transaction_id; |
@@ -52,20 +52,20 @@ discard block |
||
| 52 | 52 | $document = parent::get_document(); |
| 53 | 53 | |
| 54 | 54 | // Merchant |
| 55 | - $merchant = XML_Util::add_element( $document, $document->documentElement, 'merchant' ); |
|
| 55 | + $merchant = XML_Util::add_element($document, $document->documentElement, 'merchant'); |
|
| 56 | 56 | |
| 57 | - XML_Util::add_elements( $document, $merchant, array( |
|
| 57 | + XML_Util::add_elements($document, $merchant, array( |
|
| 58 | 58 | 'account' => $this->merchant->account, |
| 59 | 59 | 'site_id' => $this->merchant->site_id, |
| 60 | 60 | 'site_secure_code' => $this->merchant->site_secure_code, |
| 61 | - ) ); |
|
| 61 | + )); |
|
| 62 | 62 | |
| 63 | 63 | // Transaction |
| 64 | - $transaction = XML_Util::add_element( $document, $document->documentElement, 'transaction' ); |
|
| 64 | + $transaction = XML_Util::add_element($document, $document->documentElement, 'transaction'); |
|
| 65 | 65 | |
| 66 | - XML_Util::add_elements( $document, $transaction, array( |
|
| 66 | + XML_Util::add_elements($document, $transaction, array( |
|
| 67 | 67 | 'id' => $this->transaction_id, |
| 68 | - ) ); |
|
| 68 | + )); |
|
| 69 | 69 | |
| 70 | 70 | return $document; |
| 71 | 71 | } |