| Conditions | 1 |
| Paths | 1 |
| Total Lines | 225 |
| Code Lines | 156 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 49 | public function fields( array $fields ) { |
||
| 50 | /* |
||
| 51 | * General |
||
| 52 | */ |
||
| 53 | |||
| 54 | // PSPID |
||
| 55 | $fields[] = array( |
||
| 56 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 57 | 'section' => 'ogone', |
||
| 58 | 'meta_key' => '_pronamic_gateway_ogone_psp_id', |
||
| 59 | 'title' => __( 'PSPID', 'pronamic_ideal' ), |
||
| 60 | 'type' => 'text', |
||
| 61 | 'classes' => array( 'code' ), |
||
| 62 | 'tooltip' => __( 'PSPID as mentioned in the payment provider dashboard.', 'pronamic_ideal' ), |
||
| 63 | 'methods' => array( 'ogone_orderstandard_easy', 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 64 | ); |
||
| 65 | |||
| 66 | // API user ID |
||
| 67 | $fields[] = array( |
||
| 68 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 69 | 'section' => 'ogone', |
||
| 70 | 'meta_key' => '_pronamic_gateway_ogone_user_id', |
||
| 71 | 'title' => __( 'API user ID', 'pronamic_ideal' ), |
||
| 72 | 'type' => 'text', |
||
| 73 | 'classes' => array( 'regular-text', 'code' ), |
||
| 74 | 'methods' => array( 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 75 | 'tooltip' => __( 'User ID of the API user in the payment provider dashboard: Configuration » Users', 'pronamic_ideal' ), |
||
| 76 | ); |
||
| 77 | |||
| 78 | // API user password |
||
| 79 | $fields[] = array( |
||
| 80 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 81 | 'section' => 'ogone', |
||
| 82 | 'meta_key' => '_pronamic_gateway_ogone_password', |
||
| 83 | 'title' => __( 'API user password', 'pronamic_ideal' ), |
||
| 84 | 'type' => 'password', |
||
| 85 | 'classes' => array( 'regular-text', 'code' ), |
||
| 86 | 'methods' => array( 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 87 | 'tooltip' => __( 'Password of the API user in the payment provider dashboard: Configuration » Users', 'pronamic_ideal' ), |
||
| 88 | ); |
||
| 89 | |||
| 90 | // SHA-IN Pass phrase |
||
| 91 | $fields[] = array( |
||
| 92 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 93 | 'section' => 'ogone', |
||
| 94 | 'meta_key' => '_pronamic_gateway_ogone_sha_in_pass_phrase', |
||
| 95 | 'title' => __( 'SHA-IN Pass phrase', 'pronamic_ideal' ), |
||
| 96 | 'type' => 'password', |
||
| 97 | 'classes' => array( 'regular-text', 'code' ), |
||
| 98 | 'tooltip' => __( 'SHA-IN pass phrase as mentioned in the payment provider dashboard: Configuration » Technical information » Data and origin verification.', 'pronamic_ideal' ), |
||
| 99 | 'methods' => array( 'ogone_orderstandard' ), |
||
| 100 | ); |
||
| 101 | |||
| 102 | // SHA-IN Pass phrase |
||
| 103 | $fields[] = array( |
||
| 104 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 105 | 'section' => 'ogone', |
||
| 106 | 'meta_key' => '_pronamic_gateway_ogone_directlink_sha_in_pass_phrase', |
||
| 107 | 'title' => __( 'SHA-IN Pass phrase', 'pronamic_ideal' ), |
||
| 108 | 'type' => 'password', |
||
| 109 | 'classes' => array( 'regular-text', 'code' ), |
||
| 110 | 'tooltip' => __( 'SHA-IN pass phrase as mentioned in the payment provider dashboard: Configuration » Technical information » Data and origin verification.', 'pronamic_ideal' ), |
||
| 111 | 'methods' => array( 'ogone_directlink' ), |
||
| 112 | ); |
||
| 113 | |||
| 114 | // SHA-OUT Pass phrase |
||
| 115 | $fields[] = array( |
||
| 116 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 117 | 'section' => 'ogone', |
||
| 118 | 'meta_key' => '_pronamic_gateway_ogone_sha_out_pass_phrase', |
||
| 119 | 'title' => __( 'SHA-OUT Pass phrase', 'pronamic_ideal' ), |
||
| 120 | 'type' => 'password', |
||
| 121 | 'classes' => array( 'regular-text', 'code' ), |
||
| 122 | 'tooltip' => __( 'SHA-OUT pass phrase as mentioned in the payment provider dashboard: Configuration » Technical information » Transaction feedback.', 'pronamic_ideal' ), |
||
| 123 | 'methods' => array( 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 124 | ); |
||
| 125 | |||
| 126 | // Hash algorithm |
||
| 127 | $fields[] = array( |
||
| 128 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 129 | 'section' => 'ogone', |
||
| 130 | 'meta_key' => '_pronamic_gateway_ogone_hash_algorithm', |
||
| 131 | 'title' => __( 'Hash algorithm', 'pronamic_ideal' ), |
||
| 132 | 'type' => 'optgroup', |
||
| 133 | 'tooltip' => 'Hash algorithm as mentioned in the payment provider dashboard: Configuration » Technical information', |
||
| 134 | 'options' => array( |
||
| 135 | Ingenico::SHA_1 => __( 'SHA-1', 'pronamic_ideal' ), |
||
| 136 | Ingenico::SHA_256 => __( 'SHA-256', 'pronamic_ideal' ), |
||
| 137 | Ingenico::SHA_512 => __( 'SHA-512', 'pronamic_ideal' ), |
||
| 138 | ), |
||
| 139 | 'default' => Ingenico::SHA_1, |
||
| 140 | 'methods' => array( 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 141 | ); |
||
| 142 | |||
| 143 | // 3-D Secure |
||
| 144 | $fields[] = array( |
||
| 145 | 'filter' => FILTER_VALIDATE_BOOLEAN, |
||
| 146 | 'section' => 'ogone', |
||
| 147 | 'meta_key' => '_pronamic_gateway_ogone_3d_secure_enabled', |
||
| 148 | 'title' => __( '3-D Secure', 'pronamic_ideal' ), |
||
| 149 | 'type' => 'checkbox', |
||
| 150 | 'label' => __( 'Enable 3-D Secure protocol', 'pronamic_ideal' ), |
||
| 151 | 'methods' => array( 'ogone_directlink' ), |
||
| 152 | ); |
||
| 153 | |||
| 154 | // Transaction feedback fields |
||
| 155 | $fields[] = array( |
||
| 156 | 'section' => 'ogone', |
||
| 157 | 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
||
| 158 | 'type' => 'description', |
||
| 159 | 'methods' => array( 'ogone_orderstandard_easy' ), |
||
| 160 | 'html' => sprintf( |
||
| 161 | '<span class="dashicons dashicons-no"></span> %s', |
||
| 162 | __( 'Payment status updates are not supported by this payment provider.', 'pronamic_ideal' ) |
||
| 163 | ), |
||
| 164 | ); |
||
| 165 | |||
| 166 | $fields[] = array( |
||
| 167 | 'section' => 'ogone', |
||
| 168 | 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
||
| 169 | 'type' => 'description', |
||
| 170 | 'methods' => array( 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 171 | 'html' => sprintf( |
||
| 172 | '<span class="dashicons dashicons-warning"></span> %s', |
||
| 173 | __( 'Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal' ) |
||
| 174 | ), |
||
| 175 | ); |
||
| 176 | |||
| 177 | /* |
||
| 178 | * Advanced settings |
||
| 179 | */ |
||
| 180 | |||
| 181 | // Form Action URL |
||
| 182 | $fields[] = array( |
||
| 183 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 184 | 'section' => 'ogone_advanced', |
||
| 185 | 'meta_key' => '_pronamic_gateway_ogone_form_action_url', |
||
| 186 | 'title' => __( 'Form Action URL', 'pronamic_ideal' ), |
||
| 187 | 'type' => 'text', |
||
| 188 | 'classes' => array( 'regular-text', 'code' ), |
||
| 189 | 'tooltip' => __( 'With this setting you can override the default Ogone e-Commerce form action URL to the payment processing page.', 'pronamic_ideal' ), |
||
| 190 | 'methods' => array( 'ogone_orderstandard_easy', 'ogone_orderstandard' ), |
||
| 191 | ); |
||
| 192 | |||
| 193 | // Order ID |
||
| 194 | $fields[] = array( |
||
| 195 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 196 | 'section' => 'ogone_advanced', |
||
| 197 | 'meta_key' => '_pronamic_gateway_ogone_order_id', |
||
| 198 | 'title' => __( 'Order ID', 'pronamic_ideal' ), |
||
| 199 | 'type' => 'text', |
||
| 200 | 'classes' => array( 'regular-text', 'code' ), |
||
| 201 | 'tooltip' => sprintf( |
||
| 202 | __( 'The Ogone %s parameter.', 'pronamic_ideal' ), |
||
| 203 | sprintf( '<code>%s</code>', 'ORDERID' ) |
||
| 204 | ), |
||
| 205 | 'description' => sprintf( |
||
| 206 | '%s<br />%s', |
||
| 207 | sprintf( __( 'Available tags: %s', 'pronamic_ideal' ), sprintf( '<code>%s</code> <code>%s</code>', '{order_id}', '{payment_id}' ) ), |
||
| 208 | sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), '{payment_id}' ) |
||
| 209 | ), |
||
| 210 | 'methods' => array( 'ogone_orderstandard_easy', 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 211 | ); |
||
| 212 | |||
| 213 | // Parameter Variable |
||
| 214 | $fields[] = array( |
||
| 215 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 216 | 'section' => 'ogone_advanced', |
||
| 217 | 'meta_key' => '_pronamic_gateway_ogone_param_var', |
||
| 218 | 'title' => __( 'Parameter Variable', 'pronamic_ideal' ), |
||
| 219 | 'type' => 'text', |
||
| 220 | 'classes' => array( 'regular-text', 'code' ), |
||
| 221 | 'tooltip' => sprintf( |
||
| 222 | __( 'The Ogone %s parameter.', 'pronamic_ideal' ), |
||
| 223 | sprintf( '<code>%s</code>', 'PARAMVAR' ) |
||
| 224 | ), |
||
| 225 | 'description' => sprintf( |
||
| 226 | __( 'Available tags: %s', 'pronamic_ideal' ), |
||
| 227 | sprintf( '<code>%s</code> <code>%s</code>', '{site_url}', '{home_url}' ) |
||
| 228 | ), |
||
| 229 | 'methods' => array( 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 230 | ); |
||
| 231 | |||
| 232 | // Template Page |
||
| 233 | $fields[] = array( |
||
| 234 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 235 | 'section' => 'ogone_advanced', |
||
| 236 | 'meta_key' => '_pronamic_gateway_ogone_template_page', |
||
| 237 | 'title' => __( 'Template Page', 'pronamic_ideal' ), |
||
| 238 | 'type' => 'text', |
||
| 239 | 'tooltip' => sprintf( |
||
| 240 | __( 'The Ogone %s parameter.', 'pronamic_ideal' ), |
||
| 241 | sprintf( '<code>%s</code>', 'TP' ) |
||
| 242 | ), |
||
| 243 | 'methods' => array( 'ogone_orderstandard', 'ogone_directlink' ), |
||
| 244 | ); |
||
| 245 | |||
| 246 | /* |
||
| 247 | * Transaction feedback - Direct HTTP server-to-server request URLs |
||
| 248 | */ |
||
| 249 | |||
| 250 | // URL accepted, on hold or uncertain |
||
| 251 | $fields[] = array( |
||
| 252 | 'section' => 'ogone_feedback', |
||
| 253 | 'title' => __( 'URL accepted, on hold or uncertain', 'pronamic_ideal' ), |
||
| 254 | 'type' => 'text', |
||
| 255 | 'value' => site_url( '/' ), |
||
| 256 | 'classes' => array( 'regular-text', 'code' ), |
||
| 257 | 'tooltip' => __( 'Direct HTTP server-to-server request URL for payment statuses accepted, on hold or uncertain".', 'pronamic_ideal' ), |
||
| 258 | 'readonly' => true, |
||
| 259 | ); |
||
| 260 | |||
| 261 | // URL cancel or deny |
||
| 262 | $fields[] = array( |
||
| 263 | 'section' => 'ogone_feedback', |
||
| 264 | 'title' => __( 'URL cancel or deny', 'pronamic_ideal' ), |
||
| 265 | 'type' => 'text', |
||
| 266 | 'value' => site_url( '/' ), |
||
| 267 | 'classes' => array( 'regular-text', 'code' ), |
||
| 268 | 'tooltip' => __( 'Direct HTTP server-to-server request URL for payment statuses "cancelled by the client" or "too many rejections by the acquirer".', 'pronamic_ideal' ), |
||
| 269 | 'readonly' => true, |
||
| 270 | ); |
||
| 271 | |||
| 272 | // Return fields |
||
| 273 | return $fields; |
||
| 274 | } |
||
| 276 |