Completed
Push — master ( 151998...bd9a16 )
by Chris
01:31
created
class/class-edu-sveawebpay.php 4 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -265,23 +265,23 @@
 block discarded – undo
265 265
 			if ( ! empty( $phone ) ) {
266 266
 				$customer->setPhoneNumber( $phone );
267 267
 				$phonePreset = WebPayItem::presetValue()
268
-				                         ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER )
269
-				                         ->setValue( $phone )
270
-				                         ->setIsReadonly( false );
268
+										 ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER )
269
+										 ->setValue( $phone )
270
+										 ->setIsReadonly( false );
271 271
 				$wpOrder->addPresetValue( $phonePreset );
272 272
 			}
273 273
 			$customer->setEmail( $email );
274 274
 
275 275
 			$zipPreset = WebPayItem::presetValue()
276
-			                       ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::POSTAL_CODE )
277
-			                       ->setValue( $zipCode )
278
-			                       ->setIsReadonly( false );
276
+								   ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::POSTAL_CODE )
277
+								   ->setValue( $zipCode )
278
+								   ->setIsReadonly( false );
279 279
 			$wpOrder->addPresetValue( $zipPreset );
280 280
 
281 281
 			$emailPreset = WebPayItem::presetValue()
282
-			                         ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::EMAIL_ADDRESS )
283
-			                         ->setValue( $email )
284
-			                         ->setIsReadonly( false );
282
+									 ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::EMAIL_ADDRESS )
283
+									 ->setValue( $email )
284
+									 ->setIsReadonly( false );
285 285
 			$wpOrder->addPresetValue( $emailPreset );
286 286
 
287 287
 			$current_url = esc_url( "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" );
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -375,9 +375,9 @@
 block discarded – undo
375 375
 		}
376 376
 
377 377
 		/**
378
-		 * @param $order_id numeric SVEA WebPay OrderId
379
-		 * @param $booking_id
380
-		 * @param $programme_booking_id
378
+		 * @param integer $order_id numeric SVEA WebPay OrderId
379
+		 * @param integer $booking_id
380
+		 * @param integer $programme_booking_id
381 381
 		 *
382 382
 		 * @return bool If the booking was deleted, due to cancellation
383 383
 		 * @throws \Svea\WebPay\BuildOrder\Validator\ValidationException
Please login to merge, or discard this patch.
Braces   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	/**
14 14
 	 * EDU_SveaWebPay integrates EduAdmin-WordPress plugin with SveaWebPay as payment gateway
15 15
 	 */
16
-	class EDU_SveaWebPay extends EDU_Integration {
16
+	class EDU_SveaWebPay extends EDU_Integration {
17 17
 		/**
18 18
 		 * Constructor
19 19
 		 */
20
-		public function __construct() {
20
+		public function __construct() {
21 21
 			$this->id          = 'eduadmin-sveawebpay';
22 22
 			$this->displayName = __( 'Svea Webpay (Checkout)', 'eduadmin-sveawebpay' );
23 23
 			$this->description = '';
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		/**
38 38
 		 * @param $attributes
39 39
 		 */
40
-		public function test_page( $attributes ) {
40
+		public function test_page( $attributes ) {
41 41
 			$attributes = shortcode_atts(
42 42
 				array(
43 43
 					'bookingid'          => 0,
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 				'test_page'
48 48
 			);
49 49
 
50
-			if ( $attributes['bookingid'] > 0 ) {
50
+			if ( $attributes['bookingid'] > 0 ) {
51 51
 				$event_booking = EDUAPI()->OData->Bookings->GetItem(
52 52
 					$attributes['bookingid'],
53 53
 					null,
54 54
 					'Customer($select=CustomerId;),ContactPerson($select=PersonId;),OrderRows',
55 55
 					false
56 56
 				);
57
-			} elseif ( $attributes['programmebookingid'] > 0 ) {
57
+			} elseif ( $attributes['programmebookingid'] > 0 ) {
58 58
 				$event_booking = EDUAPI()->OData->ProgrammeBookings->GetItem(
59 59
 					$attributes['programmebookingid'],
60 60
 					null,
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 
80 80
 			$ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact );
81 81
 
82
-			if ( ! empty( EDU()->session['svea-order-id'] ) && ! empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) {
82
+			if ( ! empty( EDU()->session['svea-order-id'] ) && ! empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) {
83 83
 				do_action( 'eduadmin-bookingcompleted', $ebi );
84
-			} else {
84
+			} else {
85 85
 				do_action( 'eduadmin-processbooking', $ebi );
86 86
 			}
87 87
 		}
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 		/**
91 91
 		 * @param EduAdmin_BookingInfo|null $ebi
92 92
 		 */
93
-		public function intercept_booking( $ebi = null ) {
94
-			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
93
+		public function intercept_booking( $ebi = null ) {
94
+			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
95 95
 				return;
96 96
 			}
97 97
 
98
-			if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
98
+			if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
99 99
 				$ebi->NoRedirect = true;
100 100
 			}
101 101
 		}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		/**
104 104
 		 * Initializes the settingsfields
105 105
 		 */
106
-		public function init_form_fields() {
106
+		public function init_form_fields() {
107 107
 			$this->setting_fields = array(
108 108
 				'enabled'         => array(
109 109
 					'title'       => __( 'Enabled', 'eduadmin-sveawebpay' ),
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
 		/**
136 136
 		 *
137 137
 		 */
138
-		public function process_svearesponse() {
139
-			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
138
+		public function process_svearesponse() {
139
+			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
140 140
 				return;
141 141
 			}
142 142
 
143
-			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) ) {
143
+			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) ) {
144 144
 				$booking_id           = intval( $_GET['booking_id'] );
145 145
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
146 146
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 				EDU()->session['svea-order-id'] = null;
150 150
 
151
-				if ( $deleted ) {
151
+				if ( $deleted ) {
152 152
 					$this->handle_cancelled_payment();
153 153
 				}
154 154
 			}
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 		/**
158 158
 		 * @param $ebi EduAdmin_BookingInfo|null $bookingInfo
159 159
 		 */
160
-		public function process_booking( $ebi = null ) {
161
-			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
160
+		public function process_booking( $ebi = null ) {
161
+			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
162 162
 				return;
163 163
 			}
164 164
 
165 165
 			$ebi->NoRedirect = true;
166 166
 
167
-			if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) {
167
+			if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) {
168 168
 				$checkout = $this->create_checkout( $ebi );
169 169
 
170 170
 				$snippet = $checkout['Gui']['Snippet'];
@@ -177,21 +177,21 @@  discard block
 block discarded – undo
177 177
 		 *
178 178
 		 * @returns array
179 179
 		 */
180
-		public function create_checkout( $ebi ) {
180
+		public function create_checkout( $ebi ) {
181 181
 			$countries = EDUAPI()->OData->Countries->Search()['value'];
182 182
 
183 183
 			$selectedCountry = 'SE';
184 184
 			$selectedLocale  = 'sv-SE';
185 185
 
186 186
 			$invoiceCountry = $ebi->Customer['BillingInfo']['Country'];
187
-			if ( empty( $invoiceCountry ) ) {
187
+			if ( empty( $invoiceCountry ) ) {
188 188
 				$invoiceCountry = $ebi->Customer['Country'];
189 189
 			}
190 190
 
191
-			foreach ( $countries as $country ) {
192
-				if ( $invoiceCountry == $country['CountryName'] ) {
191
+			foreach ( $countries as $country ) {
192
+				if ( $invoiceCountry == $country['CountryName'] ) {
193 193
 					$selectedCountry = $country['CountryCode'];
194
-					if ( ! empty( $country['CultureName'] ) ) {
194
+					if ( ! empty( $country['CultureName'] ) ) {
195 195
 						$selectedLocale = $country['CultureName'];
196 196
 					}
197 197
 					break;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 			$eventName = '';
209 209
 
210
-			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
210
+			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
211 211
 				$booking_id   = intval( $ebi->EventBooking['BookingId'] );
212 212
 				$reference_id = $booking_id;
213 213
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				$eventName = $_event['EventName'];
217 217
 			}
218 218
 
219
-			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
219
+			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
220 220
 				$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
221 221
 				$reference_id         = $programme_booking_id;
222 222
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 			$currency = EDU()->get_option( 'eduadmin-currency', 'SEK' );
229 229
 
230
-			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
230
+			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
231 231
 				$wpConfig = new EduSveaWebPayTestConfig( $this );
232
-			} else {
232
+			} else {
233 233
 				$wpConfig = new EduSveaWebPayProductionConfig( $this );
234 234
 			}
235 235
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			$customer->setZipCode( $zipCode );
258 258
 			$customer->setLocality( $city );
259 259
 
260
-			if ( ! empty( $phone ) ) {
260
+			if ( ! empty( $phone ) ) {
261 261
 				$customer->setPhoneNumber( $phone );
262 262
 				$phonePreset = WebPayItem::presetValue()
263 263
 				                         ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER )
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 			return $wpForm;
336 336
 		}
337 337
 
338
-		public function process_paymentstatus() {
339
-			if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) {
338
+		public function process_paymentstatus() {
339
+			if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) {
340 340
 
341 341
 				$booking_id           = intval( $_GET['booking_id'] );
342 342
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 				exit( 0 );
347 347
 			}
348 348
 
349
-			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) {
349
+			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) {
350 350
 				$booking_id           = intval( $_GET['booking_id'] );
351 351
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
352 352
 
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
 
355 355
 				EDU()->session['svea-order-id'] = null;
356 356
 
357
-				if ( $deleted ) {
357
+				if ( $deleted ) {
358 358
 					$this->handle_cancelled_payment();
359 359
 				}
360 360
 			}
361 361
 		}
362 362
 
363
-		private function handle_cancelled_payment() {
363
+		private function handle_cancelled_payment() {
364 364
 			@wp_redirect( get_home_url() );
365 365
 			wp_add_inline_script( 'edu-svea-redirecthome', "location.href = '" . esc_js( get_home_url() ) . "';" );
366 366
 			wp_enqueue_script( 'edu-svea-redirecthome', false, array( 'jquery' ) );
@@ -375,10 +375,10 @@  discard block
 block discarded – undo
375 375
 		 * @return bool If the booking was deleted, due to cancellation
376 376
 		 * @throws \Svea\WebPay\BuildOrder\Validator\ValidationException
377 377
 		 */
378
-		private function update_booking( $order_id, $booking_id, $programme_booking_id ) {
379
-			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
378
+		private function update_booking( $order_id, $booking_id, $programme_booking_id ) {
379
+			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
380 380
 				$wpConfig = new EduSveaWebPayTestConfig( $this );
381
-			} else {
381
+			} else {
382 382
 				$wpConfig = new EduSveaWebPayProductionConfig( $this );
383 383
 			}
384 384
 
@@ -392,39 +392,39 @@  discard block
 block discarded – undo
392 392
 			$patch_booking                  = new stdClass();
393 393
 			$patch_booking->PaymentMethodId = 2;
394 394
 
395
-			if ( 'Cancelled' === $order['Status'] ) {
395
+			if ( 'Cancelled' === $order['Status'] ) {
396 396
 				$patch_booking->Paid = false;
397 397
 				$delete_booking      = true;
398
-			} else if ( 'Final' === $order['Status'] ) {
398
+			} else if ( 'Final' === $order['Status'] ) {
399 399
 				$patch_booking->Paid = true;
400
-			} else if ( 'Created' === $order['Status'] ) {
400
+			} else if ( 'Created' === $order['Status'] ) {
401 401
 				$patch_booking->Paid = false;
402 402
 			}
403 403
 
404
-			if ( isset( $_GET['status'] ) && 'cancel' === $_GET['status'] ) {
404
+			if ( isset( $_GET['status'] ) && 'cancel' === $_GET['status'] ) {
405 405
 				$patch_booking->Paid = false;
406 406
 				$delete_booking      = true;
407 407
 			}
408 408
 
409
-			if ( $booking_id > 0 ) {
409
+			if ( $booking_id > 0 ) {
410 410
 				EDUAPI()->REST->Booking->PatchBooking(
411 411
 					$booking_id,
412 412
 					$patch_booking
413 413
 				);
414 414
 
415
-				if ( $delete_booking ) {
415
+				if ( $delete_booking ) {
416 416
 					EDUAPI()->REST->Booking->DeleteBooking( $booking_id );
417 417
 				}
418 418
 			}
419 419
 
420
-			if ( $programme_booking_id > 0 ) {
420
+			if ( $programme_booking_id > 0 ) {
421 421
 
422 422
 				EDUAPI()->REST->ProgrammeBooking->PatchBooking(
423 423
 					$programme_booking_id,
424 424
 					$patch_booking
425 425
 				);
426 426
 
427
-				if ( $delete_booking ) {
427
+				if ( $delete_booking ) {
428 428
 					EDUAPI()->REST->ProgrammeBooking->DeleteBooking( $programme_booking_id );
429 429
 				}
430 430
 			}
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use Svea\WebPay\WebPay;
7 7
 use Svea\WebPay\WebPayItem;
8 8
 
9
-if ( ! class_exists( 'EDU_SveaWebPay' ) ):
9
+if ( !class_exists( 'EDU_SveaWebPay' ) ):
10 10
 
11 11
 	/**
12 12
 	 * EDU_SveaWebPay integrates EduAdmin-WordPress plugin with SveaWebPay as payment gateway
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 			$ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact );
79 79
 
80
-			if ( ! empty( EDU()->session['svea-order-id'] ) && ! empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) {
80
+			if ( !empty( EDU()->session['svea-order-id'] ) && !empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) {
81 81
 				do_action( 'eduadmin-bookingcompleted', $ebi );
82 82
 			} else {
83 83
 				do_action( 'eduadmin-processbooking', $ebi );
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 				return;
94 94
 			}
95 95
 
96
-			if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
96
+			if ( !empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
97 97
 				$ebi->NoRedirect = true;
98 98
 			}
99 99
 		}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			foreach ( $countries as $country ) {
190 190
 				if ( $invoiceCountry == $country['CountryName'] ) {
191 191
 					$selectedCountry = $country['CountryCode'];
192
-					if ( ! empty( $country['CultureName'] ) ) {
192
+					if ( !empty( $country['CultureName'] ) ) {
193 193
 						$selectedLocale = $country['CultureName'];
194 194
 					}
195 195
 					break;
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 			$eventName = '';
207 207
 
208
-			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
208
+			if ( !empty( $ebi->EventBooking['BookingId'] ) ) {
209 209
 				$booking_id   = intval( $ebi->EventBooking['BookingId'] );
210 210
 				$reference_id = $booking_id;
211 211
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 				$eventName = $_event['EventName'];
215 215
 			}
216 216
 
217
-			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
217
+			if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
218 218
 				$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
219 219
 				$reference_id         = $programme_booking_id;
220 220
 
@@ -243,19 +243,19 @@  discard block
 block discarded – undo
243 243
 
244 244
 			$customer = WebPayItem::companyCustomer();
245 245
 
246
-			$customerName  = ! empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName'];
247
-			$streetAddress = ! empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address'];
248
-			$zipCode       = ! empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip'];
246
+			$customerName  = !empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName'];
247
+			$streetAddress = !empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address'];
248
+			$zipCode       = !empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip'];
249 249
 			$city          = $ebi->Customer['BillingInfo']['City'] ? $ebi->Customer['BillingInfo']['City'] : $ebi->Customer['City'];
250 250
 			$phone         = $ebi->Customer['Phone'];
251
-			$email         = ! empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email'];
251
+			$email         = !empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email'];
252 252
 
253 253
 			$customer->setCompanyName( $customerName );
254 254
 			$customer->setStreetAddress( $streetAddress );
255 255
 			$customer->setZipCode( $zipCode );
256 256
 			$customer->setLocality( $city );
257 257
 
258
-			if ( ! empty( $phone ) ) {
258
+			if ( !empty( $phone ) ) {
259 259
 				$customer->setPhoneNumber( $phone );
260 260
 				$phonePreset = WebPayItem::presetValue()
261 261
 				                         ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER )
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 				->setConfirmationUri( $defaultThankYou )
327 327
 				->setPushUri( $defaultPushUrl )
328 328
 				->setCheckoutUri( $defaultCancel ); // We have no "checkout"-url.. So we just cancel the booking instead.
329
-			$wpForm  = $wpBuild->createOrder();
329
+			$wpForm = $wpBuild->createOrder();
330 330
 
331 331
 			EDU()->session['svea-order-id'] = $wpForm['OrderId'];
332 332
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		}
335 335
 
336 336
 		public function process_paymentstatus() {
337
-			if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) {
337
+			if ( !empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && !empty( $_GET['status'] ) ) {
338 338
 
339 339
 				$booking_id           = intval( $_GET['booking_id'] );
340 340
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 				exit( 0 );
345 345
 			}
346 346
 
347
-			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) {
347
+			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && !empty( $_GET['status'] ) ) {
348 348
 				$booking_id           = intval( $_GET['booking_id'] );
349 349
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
350 350
 
Please login to merge, or discard this patch.
class/class-edu-sveawebpay-config.php 1 patch
Braces   +19 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class EduSveaWebPayBaseConfig implements \Svea\WebPay\Config\ConfigurationProvider {
3
+class EduSveaWebPayBaseConfig implements \Svea\WebPay\Config\ConfigurationProvider {
4 4
 	/**
5 5
 	 * @var EDU_SveaWebPay
6 6
 	 */
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	 *
12 12
 	 * @param EDU_SveaWebPay $_plugin
13 13
 	 */
14
-	public function __construct( $_plugin ) {
14
+	public function __construct( $_plugin ) {
15 15
 		$this->plugin = $_plugin;
16 16
 	}
17 17
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
27 27
 	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
28 28
 	 */
29
-	public function getUsername( $type, $country ) {
29
+	public function getUsername( $type, $country ) {
30 30
 		echo 'username';
31 31
 	}
32 32
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
42 42
 	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
43 43
 	 */
44
-	public function getPassword( $type, $country ) {
44
+	public function getPassword( $type, $country ) {
45 45
 		echo 'password';
46 46
 	}
47 47
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
57 57
 	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
58 58
 	 */
59
-	public function getClientNumber( $type, $country ) {
59
+	public function getClientNumber( $type, $country ) {
60 60
 		echo 'client';
61 61
 	}
62 62
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return string
70 70
 	 *
71 71
 	 */
72
-	public function getMerchantId( $type, $country ) {
72
+	public function getMerchantId( $type, $country ) {
73 73
 		$merchantId = $this->plugin->get_option( 'merchant_key', '' );
74 74
 
75 75
 		return $merchantId;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @return string
85 85
 	 *
86 86
 	 */
87
-	public function getSecret( $type, $country ) {
87
+	public function getSecret( $type, $country ) {
88 88
 		$secret = $this->plugin->get_option( 'merchant_secret', '' );
89 89
 
90 90
 		return $secret;
@@ -100,7 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @throws Exception
101 101
 	 */
102 102
 
103
-	public function getEndPoint( $type ) { /* Defined in subclasses */
103
+	public function getEndPoint( $type ) {
104
+/* Defined in subclasses */
104 105
 	}
105 106
 
106 107
 	/**
@@ -108,7 +109,7 @@  discard block
 block discarded – undo
108 109
 	 *
109 110
 	 * @return string
110 111
 	 */
111
-	public function getCheckoutMerchantId( $country = null ) {
112
+	public function getCheckoutMerchantId( $country = null ) {
112 113
 		$merchantId = $this->plugin->get_option( 'merchant_key', '' );
113 114
 
114 115
 		return $merchantId;
@@ -119,22 +120,22 @@  discard block
 block discarded – undo
119 120
 	 *
120 121
 	 * @return string
121 122
 	 */
122
-	public function getCheckoutSecret( $country = null ) {
123
+	public function getCheckoutSecret( $country = null ) {
123 124
 		$secret = $this->plugin->get_option( 'merchant_secret', '' );
124 125
 
125 126
 		return $secret;
126 127
 	}
127 128
 
128
-	public function getIntegrationCompany() {
129
+	public function getIntegrationCompany() {
129 130
 		return 'MultiNet Interactive AB : EduAdmin WordPress-plugin';
130 131
 	}
131 132
 
132
-	public function getIntegrationPlatform() {
133
+	public function getIntegrationPlatform() {
133 134
 		return 'EduAdmin WordPress';
134 135
 	}
135 136
 }
136 137
 
137
-class EduSveaWebPayProductionConfig extends EduSveaWebPayBaseConfig {
138
+class EduSveaWebPayProductionConfig extends EduSveaWebPayBaseConfig {
138 139
 
139 140
 	/**
140 141
 	 * Constants for the endpoint url found in the class ConfigurationService.php
@@ -146,8 +147,8 @@  discard block
 block discarded – undo
146 147
 	 * @throws Exception
147 148
 	 */
148 149
 
149
-	public function getEndPoint( $type ) {
150
-		switch ( strtoupper( $type ) ) {
150
+	public function getEndPoint( $type ) {
151
+		switch ( strtoupper( $type ) ) {
151 152
 			case 'HOSTED':
152 153
 				return Svea\WebPay\Config\ConfigurationService::SWP_PROD_URL;
153 154
 				break;
@@ -171,7 +172,7 @@  discard block
 block discarded – undo
171 172
 	}
172 173
 }
173 174
 
174
-class EduSveaWebPayTestConfig extends EduSveaWebPayBaseConfig {
175
+class EduSveaWebPayTestConfig extends EduSveaWebPayBaseConfig {
175 176
 
176 177
 	/**
177 178
 	 * Constants for the endpoint url found in the class ConfigurationService.php
@@ -182,8 +183,8 @@  discard block
 block discarded – undo
182 183
 	 * @return string
183 184
 	 * @throws Exception
184 185
 	 */
185
-	public function getEndPoint( $type ) {
186
-		switch ( strtoupper( $type ) ) {
186
+	public function getEndPoint( $type ) {
187
+		switch ( strtoupper( $type ) ) {
187 188
 			case 'HOSTED':
188 189
 				return Svea\WebPay\Config\ConfigurationService::SWP_TEST_URL;
189 190
 				break;
Please login to merge, or discard this patch.
eduadmin-wordpress-sveawebpay.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 
38 38
 add_action( 'admin_init', 'checkForEduAdminPlugin' );
39 39
 function checkForEduAdminPlugin() {
40
-	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
-		add_action( 'admin_notices', function () {
40
+	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( !is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && !is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
+		add_action( 'admin_notices', function() {
42 42
 			?>
43 43
             <div class="error">
44 44
             <p><?php _e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-sveawebpay' ); ?></p>
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 }
54 54
 
55
-if ( ! class_exists( 'EDU_SveaWebPay_Loader' ) ):
55
+if ( !class_exists( 'EDU_SveaWebPay_Loader' ) ):
56 56
 
57 57
 	final class EDU_SveaWebPay_Loader {
58 58
 		public function __construct() {
Please login to merge, or discard this patch.
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  */
37 37
 
38 38
 add_action( 'admin_init', 'checkForEduAdminPlugin' );
39
-function checkForEduAdminPlugin() {
40
-	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
-		add_action( 'admin_notices', function () {
39
+function checkForEduAdminPlugin() {
40
+	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
+		add_action( 'admin_notices', function () {
42 42
 			?>
43 43
             <div class="error">
44 44
             <p><?php _e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-sveawebpay' ); ?></p>
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		} );
47 47
 		deactivate_plugins( plugin_basename( __FILE__ ) );
48 48
 
49
-		if ( isset( $_GET['activate'] ) ) {
49
+		if ( isset( $_GET['activate'] ) ) {
50 50
 			unset( $_GET['activate'] );
51 51
 		}
52 52
 	}
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 
55 55
 if ( ! class_exists( 'EDU_SveaWebPay_Loader' ) ):
56 56
 
57
-	final class EDU_SveaWebPay_Loader {
58
-		public function __construct() {
57
+	final class EDU_SveaWebPay_Loader {
58
+		public function __construct() {
59 59
 			add_action( 'plugins_loaded', array( $this, 'init' ) );
60 60
 		}
61 61
 
62
-		public function init() {
63
-			if ( class_exists( 'EDU_Integration' ) ) {
62
+		public function init() {
63
+			if ( class_exists( 'EDU_Integration' ) ) {
64 64
 				require_once( __DIR__ . '/vendor/autoload.php' ); // Load dependencies
65 65
 				require_once( __DIR__ . '/class/class-edu-sveawebpay.php' );
66 66
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			}
69 69
 		}
70 70
 
71
-		public function add_integration( $integrations ) {
71
+		public function add_integration( $integrations ) {
72 72
 			$integrations[] = 'EDU_SveaWebPay';
73 73
 
74 74
 			return $integrations;
Please login to merge, or discard this patch.
src/eduadmin-wordpress-sveawebpay.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 
38 38
 add_action( 'admin_init', 'checkForEduAdminPlugin' );
39 39
 function checkForEduAdminPlugin() {
40
-	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
-		add_action( 'admin_notices', function () {
40
+	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( !is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && !is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
+		add_action( 'admin_notices', function() {
42 42
 			?>
43 43
             <div class="error">
44 44
             <p><?php _e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-sveawebpay' ); ?></p>
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 }
54 54
 
55
-if ( ! class_exists( 'EDU_SveaWebPay_Loader' ) ):
55
+if ( !class_exists( 'EDU_SveaWebPay_Loader' ) ):
56 56
 
57 57
 	final class EDU_SveaWebPay_Loader {
58 58
 		public function __construct() {
Please login to merge, or discard this patch.
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  */
37 37
 
38 38
 add_action( 'admin_init', 'checkForEduAdminPlugin' );
39
-function checkForEduAdminPlugin() {
40
-	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
-		add_action( 'admin_notices', function () {
39
+function checkForEduAdminPlugin() {
40
+	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
41
+		add_action( 'admin_notices', function () {
42 42
 			?>
43 43
             <div class="error">
44 44
             <p><?php _e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-sveawebpay' ); ?></p>
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		} );
47 47
 		deactivate_plugins( plugin_basename( __FILE__ ) );
48 48
 
49
-		if ( isset( $_GET['activate'] ) ) {
49
+		if ( isset( $_GET['activate'] ) ) {
50 50
 			unset( $_GET['activate'] );
51 51
 		}
52 52
 	}
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 
55 55
 if ( ! class_exists( 'EDU_SveaWebPay_Loader' ) ):
56 56
 
57
-	final class EDU_SveaWebPay_Loader {
58
-		public function __construct() {
57
+	final class EDU_SveaWebPay_Loader {
58
+		public function __construct() {
59 59
 			add_action( 'plugins_loaded', array( $this, 'init' ) );
60 60
 		}
61 61
 
62
-		public function init() {
63
-			if ( class_exists( 'EDU_Integration' ) ) {
62
+		public function init() {
63
+			if ( class_exists( 'EDU_Integration' ) ) {
64 64
 				require_once( __DIR__ . '/vendor/autoload.php' ); // Load dependencies
65 65
 				require_once( __DIR__ . '/class/class-edu-sveawebpay.php' );
66 66
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			}
69 69
 		}
70 70
 
71
-		public function add_integration( $integrations ) {
71
+		public function add_integration( $integrations ) {
72 72
 			$integrations[] = 'EDU_SveaWebPay';
73 73
 
74 74
 			return $integrations;
Please login to merge, or discard this patch.