Passed
Push — master ( e76702...e1fb16 )
by Reüel
04:32
created
src/Integration.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@
 block discarded – undo
19 19
 		$this->id            = 'icepay-ideal';
20 20
 		$this->name          = 'ICEPAY';
21 21
 		$this->url           = 'https://icepay.com/';
22
-		$this->product_url   = __( 'https://icepay.com/nl/en/pricing-and-accounts/', 'pronamic_ideal' );
22
+		$this->product_url   = __('https://icepay.com/nl/en/pricing-and-accounts/', 'pronamic_ideal');
23 23
 		$this->dashboard_url = 'https://portal.icepay.com/';
24 24
 		$this->provider      = 'icepay';
25 25
 
26 26
 		// Actions
27
-		$function = array( __NAMESPACE__ . '\Listener', 'listen' );
27
+		$function = array(__NAMESPACE__ . '\Listener', 'listen');
28 28
 
29
-		if ( ! has_action( 'wp_loaded', $function ) ) {
30
-			add_action( 'wp_loaded', $function );
29
+		if ( ! has_action('wp_loaded', $function)) {
30
+			add_action('wp_loaded', $function);
31 31
 		}
32 32
 	}
33 33
 
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -16,44 +16,44 @@  discard block
 block discarded – undo
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
 		// iDEAL
25 25
 		$sections['icepay'] = array(
26
-			'title'       => __( 'ICEPAY', 'pronamic_ideal' ),
27
-			'methods'     => array( 'icepay' ),
28
-			'description' => __( 'Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal' ),
26
+			'title'       => __('ICEPAY', 'pronamic_ideal'),
27
+			'methods'     => array('icepay'),
28
+			'description' => __('Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal'),
29 29
 		);
30 30
 
31 31
 		// Advanced
32 32
 		$sections['icepay_advanced'] = array(
33
-			'title'       => __( 'Advanced', 'pronamic_ideal' ),
34
-			'methods'     => array( 'icepay' ),
35
-			'description' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ),
33
+			'title'       => __('Advanced', 'pronamic_ideal'),
34
+			'methods'     => array('icepay'),
35
+			'description' => __('Optional settings for advanced usage only.', 'pronamic_ideal'),
36 36
 		);
37 37
 
38 38
 		// Transaction feedback
39 39
 		$sections['icepay_feedback'] = array(
40
-			'title'       => __( 'Transaction feedback', 'pronamic_ideal' ),
41
-			'methods'     => array( 'icepay' ),
42
-			'description' => __( 'Set the below URLs in the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ),
40
+			'title'       => __('Transaction feedback', 'pronamic_ideal'),
41
+			'methods'     => array('icepay'),
42
+			'description' => __('Set the below URLs in the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal'),
43 43
 		);
44 44
 
45 45
 		return $sections;
46 46
 	}
47 47
 
48
-	public function fields( array $fields ) {
48
+	public function fields(array $fields) {
49 49
 		// Merchant ID
50 50
 		$fields[] = array(
51 51
 			'filter'   => FILTER_SANITIZE_STRING,
52 52
 			'section'  => 'icepay',
53 53
 			'meta_key' => '_pronamic_gateway_icepay_merchant_id',
54
-			'title'    => _x( 'Merchant ID', 'icepay', 'pronamic_ideal' ),
54
+			'title'    => _x('Merchant ID', 'icepay', 'pronamic_ideal'),
55 55
 			'type'     => 'text',
56
-			'tooltip'  => __( 'Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ),
56
+			'tooltip'  => __('Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal'),
57 57
 		);
58 58
 
59 59
 		// Secret Code
@@ -61,20 +61,20 @@  discard block
 block discarded – undo
61 61
 			'filter'   => FILTER_SANITIZE_STRING,
62 62
 			'section'  => 'icepay',
63 63
 			'meta_key' => '_pronamic_gateway_icepay_secret_code',
64
-			'title'    => _x( 'Secret Code', 'icepay', 'pronamic_ideal' ),
64
+			'title'    => _x('Secret Code', 'icepay', 'pronamic_ideal'),
65 65
 			'type'     => 'text',
66
-			'classes'  => array( 'regular-text', 'code' ),
67
-			'tooltip'  => __( 'Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ),
66
+			'classes'  => array('regular-text', 'code'),
67
+			'tooltip'  => __('Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal'),
68 68
 		);
69 69
 
70 70
 		// Transaction feedback
71 71
 		$fields[] = array(
72 72
 			'section' => 'icepay',
73
-			'title'   => __( 'Transaction feedback', 'pronamic_ideal' ),
73
+			'title'   => __('Transaction feedback', 'pronamic_ideal'),
74 74
 			'type'    => 'description',
75 75
 			'html'    => sprintf(
76 76
 				'<span class="dashicons dashicons-warning"></span> %s',
77
-				__( 'Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal' )
77
+				__('Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal')
78 78
 			),
79 79
 		);
80 80
 
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 			),
87 87
 			'section'     => 'icepay_advanced',
88 88
 			'meta_key'    => '_pronamic_gateway_icepay_order_id',
89
-			'title'       => __( 'Order ID', 'pronamic_ideal' ),
89
+			'title'       => __('Order ID', 'pronamic_ideal'),
90 90
 			'type'        => 'text',
91
-			'classes'     => array( 'regular-text', 'code' ),
91
+			'classes'     => array('regular-text', 'code'),
92 92
 			'tooltip'     => sprintf(
93 93
 				/* translators: %s: <code>OrderID</code> */
94
-				__( 'The Icepay %s parameter.', 'pronamic_ideal' ),
95
-				sprintf( '<code>%s</code>', 'OrderID' )
94
+				__('The Icepay %s parameter.', 'pronamic_ideal'),
95
+				sprintf('<code>%s</code>', 'OrderID')
96 96
 			),
97 97
 			'description' => sprintf(
98 98
 				'%s %s<br />%s',
99
-				__( 'Available tags:', 'pronamic_ideal' ),
99
+				__('Available tags:', 'pronamic_ideal'),
100 100
 				sprintf(
101 101
 					'<code>%s</code> <code>%s</code>',
102 102
 					'{order_id}',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 				),
105 105
 				sprintf(
106 106
 					/* translators: %s: <code>{payment_id}</code> */
107
-					__( 'Default: <code>%s</code>', 'pronamic_ideal' ),
107
+					__('Default: <code>%s</code>', 'pronamic_ideal'),
108 108
 					'{payment_id}'
109 109
 				)
110 110
 			),
@@ -113,30 +113,30 @@  discard block
 block discarded – undo
113 113
 		// Thank you page URL
114 114
 		$fields[] = array(
115 115
 			'section'  => 'icepay_feedback',
116
-			'title'    => __( 'Thank you page URL', 'pronamic_ideal' ),
116
+			'title'    => __('Thank you page URL', 'pronamic_ideal'),
117 117
 			'type'     => 'text',
118
-			'classes'  => array( 'regular-text', 'code' ),
119
-			'value'    => home_url( '/' ),
118
+			'classes'  => array('regular-text', 'code'),
119
+			'value'    => home_url('/'),
120 120
 			'readonly' => true,
121 121
 		);
122 122
 
123 123
 		// Error page URL
124 124
 		$fields[] = array(
125 125
 			'section'  => 'icepay_feedback',
126
-			'title'    => __( 'Error page URL', 'pronamic_ideal' ),
126
+			'title'    => __('Error page URL', 'pronamic_ideal'),
127 127
 			'type'     => 'text',
128
-			'classes'  => array( 'regular-text', 'code' ),
129
-			'value'    => home_url( '/' ),
128
+			'classes'  => array('regular-text', 'code'),
129
+			'value'    => home_url('/'),
130 130
 			'readonly' => true,
131 131
 		);
132 132
 
133 133
 		// Postback URL
134 134
 		$fields[] = array(
135 135
 			'section'  => 'icepay_feedback',
136
-			'title'    => __( 'Postback URL', 'pronamic_ideal' ),
136
+			'title'    => __('Postback URL', 'pronamic_ideal'),
137 137
 			'type'     => 'text',
138
-			'classes'  => array( 'regular-text', 'code' ),
139
-			'value'    => home_url( '/' ),
138
+			'classes'  => array('regular-text', 'code'),
139
+			'value'    => home_url('/'),
140 140
 			'readonly' => true,
141 141
 		);
142 142
 
Please login to merge, or discard this patch.
src/ConfigFactory.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
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
-		$config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_icepay_merchant_id', true );
22
-		$config->secret_code = get_post_meta( $post_id, '_pronamic_gateway_icepay_secret_code', true );
23
-		$config->order_id    = get_post_meta( $post_id, '_pronamic_gateway_icepay_order_id', true );
21
+		$config->merchant_id = get_post_meta($post_id, '_pronamic_gateway_icepay_merchant_id', true);
22
+		$config->secret_code = get_post_meta($post_id, '_pronamic_gateway_icepay_secret_code', true);
23
+		$config->order_id    = get_post_meta($post_id, '_pronamic_gateway_icepay_order_id', true);
24 24
 
25 25
 		return $config;
26 26
 	}
Please login to merge, or discard this patch.
src/Gateway.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param Config $config Config.
36 36
 	 */
37
-	public function __construct( Config $config ) {
38
-		parent::__construct( $config );
37
+	public function __construct(Config $config) {
38
+		parent::__construct($config);
39 39
 
40 40
 		// Default properties for this gateway.
41
-		$this->set_method( self::METHOD_HTTP_REDIRECT );
42
-		$this->set_slug( 'icepay' );
41
+		$this->set_method(self::METHOD_HTTP_REDIRECT);
42
+		$this->set_slug('icepay');
43 43
 	}
44 44
 
45 45
 	/**
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return bool
51 51
 	 */
52
-	private function filter_ideal( $method ) {
53
-		return is_array( $method ) && isset( $method['PaymentMethodCode'] ) && 'IDEAL' === $method['PaymentMethodCode'];
52
+	private function filter_ideal($method) {
53
+		return is_array($method) && isset($method['PaymentMethodCode']) && 'IDEAL' === $method['PaymentMethodCode'];
54 54
 	}
55 55
 
56 56
 	/**
@@ -65,28 +65,28 @@  discard block
 block discarded – undo
65 65
 		try {
66 66
 			$methods = Icepay_Api_Webservice::getInstance()
67 67
 						->paymentmethodService()
68
-						->setMerchantID( $this->config->merchant_id )
69
-						->setSecretCode( $this->config->secret_code )
68
+						->setMerchantID($this->config->merchant_id)
69
+						->setSecretCode($this->config->secret_code)
70 70
 						->retrieveAllPaymentmethods()
71 71
 						->asArray();
72
-		} catch ( Exception $e ) {
72
+		} catch (Exception $e) {
73 73
 			return $groups;
74 74
 		}
75 75
 
76
-		$ideal_methods = array_filter( $methods, array( $this, 'filter_ideal' ) );
76
+		$ideal_methods = array_filter($methods, array($this, 'filter_ideal'));
77 77
 
78
-		if ( ! empty( $ideal_methods ) ) {
78
+		if ( ! empty($ideal_methods)) {
79 79
 			$issuers = Icepay_Api_Webservice::getInstance()->singleMethod()
80
-						->loadFromArray( $methods )
81
-						->selectPaymentMethodByCode( 'IDEAL' )
80
+						->loadFromArray($methods)
81
+						->selectPaymentMethodByCode('IDEAL')
82 82
 						->getIssuers();
83 83
 		}
84 84
 
85
-		if ( $issuers ) {
85
+		if ($issuers) {
86 86
 			$options = array();
87 87
 
88
-			foreach ( $issuers as $issuer ) {
89
-				$options[ $issuer['IssuerKeyword'] ] = $issuer['Description'];
88
+			foreach ($issuers as $issuer) {
89
+				$options[$issuer['IssuerKeyword']] = $issuer['Description'];
90 90
 			}
91 91
 
92 92
 			$groups[] = array(
@@ -108,25 +108,25 @@  discard block
 block discarded – undo
108 108
 
109 109
 		$method = new Icepay_Paymentmethod_Creditcard();
110 110
 
111
-		if ( isset( $method->_issuer ) ) {
111
+		if (isset($method->_issuer)) {
112 112
 			$issuers = $method->_issuer;
113 113
 		}
114 114
 
115
-		if ( $issuers ) {
115
+		if ($issuers) {
116 116
 			$options = array();
117 117
 
118
-			foreach ( $issuers as $issuer ) {
119
-				switch ( $issuer ) {
118
+			foreach ($issuers as $issuer) {
119
+				switch ($issuer) {
120 120
 					case 'AMEX':
121
-						$name = _x( 'AMEX', 'Payment method name', 'pronamic_ideal' );
121
+						$name = _x('AMEX', 'Payment method name', 'pronamic_ideal');
122 122
 
123 123
 						break;
124 124
 					case 'MASTER':
125
-						$name = _x( 'MASTER', 'Payment method name', 'pronamic_ideal' );
125
+						$name = _x('MASTER', 'Payment method name', 'pronamic_ideal');
126 126
 
127 127
 						break;
128 128
 					case 'VISA':
129
-						$name = _x( 'VISA', 'Payment method name', 'pronamic_ideal' );
129
+						$name = _x('VISA', 'Payment method name', 'pronamic_ideal');
130 130
 
131 131
 						break;
132 132
 					default:
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 						break;
136 136
 				}
137 137
 
138
-				$options[ $issuer ] = $name;
138
+				$options[$issuer] = $name;
139 139
 			}
140 140
 
141 141
 			$groups[] = array(
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @param Payment $payment Payment.
169 169
 	 */
170
-	public function start( Payment $payment ) {
170
+	public function start(Payment $payment) {
171 171
 		try {
172 172
 			/*
173 173
 			 * Order ID
@@ -182,25 +182,25 @@  discard block
 block discarded – undo
182 182
 			// Payment object.
183 183
 			$payment_object = new Icepay_PaymentObject();
184 184
 			$payment_object
185
-				->setAmount( $payment->get_total_amount()->get_cents() )
186
-				->setReference( $payment->get_order_id() )
187
-				->setDescription( $payment->get_description() )
188
-				->setCurrency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() )
189
-				->setIssuer( $payment->get_issuer() )
190
-				->setOrderID( $payment->format_string( $this->config->order_id ) );
191
-
192
-			if ( null !== $payment->get_customer() ) {
185
+				->setAmount($payment->get_total_amount()->get_cents())
186
+				->setReference($payment->get_order_id())
187
+				->setDescription($payment->get_description())
188
+				->setCurrency($payment->get_total_amount()->get_currency()->get_alphabetic_code())
189
+				->setIssuer($payment->get_issuer())
190
+				->setOrderID($payment->format_string($this->config->order_id));
191
+
192
+			if (null !== $payment->get_customer()) {
193 193
 				// Language.
194
-				$language = strtoupper( $payment->get_customer()->get_language() );
194
+				$language = strtoupper($payment->get_customer()->get_language());
195 195
 
196
-				$payment_object->setLanguage( $language );
196
+				$payment_object->setLanguage($language);
197 197
 
198 198
 				// Country.
199 199
 				$locale = $payment->get_customer()->get_locale();
200 200
 
201
-				$country = strtoupper( substr( $locale, 3, 2 ) );
201
+				$country = strtoupper(substr($locale, 3, 2));
202 202
 
203
-				$payment_object->setCountry( $country );
203
+				$payment_object->setCountry($country);
204 204
 			}
205 205
 
206 206
 			/*
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			 */
210 210
 			$icepay_method = null;
211 211
 
212
-			switch ( $payment->get_method() ) {
212
+			switch ($payment->get_method()) {
213 213
 				case PaymentMethods::CREDIT_CARD:
214 214
 					// @link https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/creditcard.php
215 215
 					$icepay_method = new Icepay_Paymentmethod_Creditcard();
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 					break;
234 234
 			}
235 235
 
236
-			if ( isset( $icepay_method ) ) {
236
+			if (isset($icepay_method)) {
237 237
 				// @link https://github.com/icepay/icepay/blob/2.4.0/api/icepay_api_base.php#L342-L353
238
-				$payment_object->setPaymentMethod( $icepay_method->getCode() );
238
+				$payment_object->setPaymentMethod($icepay_method->getCode());
239 239
 			}
240 240
 
241 241
 			// Protocol.
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
 			// Basic mode.
245 245
 			$basicmode = Icepay_Basicmode::getInstance();
246 246
 			$basicmode
247
-				->setMerchantID( $this->config->merchant_id )
248
-				->setSecretCode( $this->config->secret_code )
249
-				->setProtocol( $protocol )
250
-				->setSuccessURL( $payment->get_return_url() )
251
-				->setErrorURL( $payment->get_return_url() )
252
-				->validatePayment( $payment_object );
247
+				->setMerchantID($this->config->merchant_id)
248
+				->setSecretCode($this->config->secret_code)
249
+				->setProtocol($protocol)
250
+				->setSuccessURL($payment->get_return_url())
251
+				->setErrorURL($payment->get_return_url())
252
+				->validatePayment($payment_object);
253 253
 
254 254
 			// Action URL.
255
-			$payment->set_action_url( $basicmode->getURL() );
256
-		} catch ( Exception $exception ) {
257
-			$this->error = new WP_Error( 'icepay_error', $exception->getMessage(), $exception );
255
+			$payment->set_action_url($basicmode->getURL());
256
+		} catch (Exception $exception) {
257
+			$this->error = new WP_Error('icepay_error', $exception->getMessage(), $exception);
258 258
 		}
259 259
 	}
260 260
 
@@ -265,34 +265,34 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @throws Exception
267 267
 	 */
268
-	public function update_status( Payment $payment ) {
268
+	public function update_status(Payment $payment) {
269 269
 		// Get the Icepay Result and set the required fields.
270 270
 		$result = new Icepay_Result();
271 271
 		$result
272
-			->setMerchantID( $this->config->merchant_id )
273
-			->setSecretCode( $this->config->secret_code );
272
+			->setMerchantID($this->config->merchant_id)
273
+			->setSecretCode($this->config->secret_code);
274 274
 
275 275
 		try {
276 276
 			// Determine if the result can be validated.
277
-			if ( $result->validate() ) {
277
+			if ($result->validate()) {
278 278
 				// What was the status response.
279
-				switch ( $result->getStatus() ) {
279
+				switch ($result->getStatus()) {
280 280
 					case Icepay_StatusCode::SUCCESS:
281
-						$payment->set_status( Statuses::SUCCESS );
281
+						$payment->set_status(Statuses::SUCCESS);
282 282
 
283 283
 						break;
284 284
 					case Icepay_StatusCode::OPEN:
285
-						$payment->set_status( Statuses::OPEN );
285
+						$payment->set_status(Statuses::OPEN);
286 286
 
287 287
 						break;
288 288
 					case Icepay_StatusCode::ERROR:
289
-						$payment->set_status( Statuses::FAILURE );
289
+						$payment->set_status(Statuses::FAILURE);
290 290
 
291 291
 						break;
292 292
 				}
293 293
 			}
294
-		} catch ( Exception $exception ) {
295
-			$this->error = new WP_Error( 'icepay_error', $exception->getMessage(), $exception );
294
+		} catch (Exception $exception) {
295
+			$this->error = new WP_Error('icepay_error', $exception->getMessage(), $exception);
296 296
 		}
297 297
 	}
298 298
 }
Please login to merge, or discard this patch.
src/Listener.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,24 +30,24 @@
 block discarded – undo
30 30
 			'Checksum',
31 31
 		);
32 32
 
33
-		if ( ! Util::input_has_vars( INPUT_GET, $variable_names ) ) {
33
+		if ( ! Util::input_has_vars(INPUT_GET, $variable_names)) {
34 34
 			return;
35 35
 		}
36 36
 
37
-		$reference = filter_input( INPUT_GET, 'OrderID', FILTER_SANITIZE_STRING );
37
+		$reference = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_STRING);
38 38
 
39
-		$payment = get_pronamic_payment( $reference );
39
+		$payment = get_pronamic_payment($reference);
40 40
 
41 41
 		// Add note.
42 42
 		$note = sprintf(
43 43
 			/* translators: %s: ICEPAY */
44
-			__( 'Webhook requested by %s.', 'pronamic_ideal' ),
45
-			__( 'ICEPAY', 'pronamic_ideal' )
44
+			__('Webhook requested by %s.', 'pronamic_ideal'),
45
+			__('ICEPAY', 'pronamic_ideal')
46 46
 		);
47 47
 
48
-		$payment->add_note( $note );
48
+		$payment->add_note($note);
49 49
 
50 50
 		// Update payment.
51
-		Plugin::update_payment( $payment );
51
+		Plugin::update_payment($payment);
52 52
 	}
53 53
 }
Please login to merge, or discard this patch.