Completed
Push — master ( a0d185...9fc190 )
by Chris
01:39
created
class/class-edu-sveawebpay.php 5 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,6 @@
 block discarded – undo
5 5
 
6 6
 use Svea\WebPay\WebPay;
7 7
 use Svea\WebPay\WebPayItem;
8
-use Svea\WebPay\Config\ConfigurationService;
9
-use Svea\WebPay\Response\SveaResponse;
10 8
 
11 9
 if ( ! class_exists( 'EDU_SveaWebPay' ) ):
12 10
 
Please login to merge, or discard this patch.
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.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Svea\WebPay\Config\ConfigurationService;
9 9
 use Svea\WebPay\Response\SveaResponse;
10 10
 
11
-if ( ! class_exists( 'EDU_SveaWebPay' ) ):
11
+if ( !class_exists( 'EDU_SveaWebPay' ) ):
12 12
 
13 13
 	/**
14 14
 	 * EDU_SveaWebPay integrates EduAdmin-WordPress plugin with SveaWebPay as payment gateway
@@ -79,7 +79,7 @@  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 84
 			} else {
85 85
 				do_action( 'eduadmin-processbooking', $ebi );
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
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
 		}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			foreach ( $countries as $country ) {
194 194
 				if ( $invoiceCountry == $country['CountryName'] ) {
195 195
 					$selectedCountry = $country['CountryCode'];
196
-					if ( ! empty( $country['CultureName'] ) ) {
196
+					if ( !empty( $country['CultureName'] ) ) {
197 197
 						$selectedLocale = $country['CultureName'];
198 198
 					}
199 199
 					break;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 			$locationCountry    = '';
214 214
 			$locationPostalCode = '';
215 215
 
216
-			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
216
+			if ( !empty( $ebi->EventBooking['BookingId'] ) ) {
217 217
 				$booking_id   = intval( $ebi->EventBooking['BookingId'] );
218 218
 				$reference_id = $booking_id;
219 219
 
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 
222 222
 				$eventName = $_event['EventName'];
223 223
 
224
-				if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
224
+				if ( !empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
225 225
 					$locationAddress    = $_event['LocationAddress']['Address'];
226 226
 					$locationCountry    = $_event['LocationAddress']['Country'];
227 227
 					$locationPostalCode = $_event['LocationAddress']['AddressZip'];
228 228
 				}
229 229
 			}
230 230
 
231
-			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
231
+			if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
232 232
 				$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
233 233
 				$reference_id         = $programme_booking_id;
234 234
 
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
 
258 258
 			$customer = WebPayItem::companyCustomer();
259 259
 
260
-			$customerName  = ! empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName'];
261
-			$streetAddress = ! empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address'];
262
-			$zipCode       = ! empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip'];
260
+			$customerName  = !empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName'];
261
+			$streetAddress = !empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address'];
262
+			$zipCode       = !empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip'];
263 263
 			$city          = $ebi->Customer['BillingInfo']['City'] ? $ebi->Customer['BillingInfo']['City'] : $ebi->Customer['City'];
264 264
 			$phone         = $ebi->Customer['Phone'];
265
-			$email         = ! empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email'];
265
+			$email         = !empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email'];
266 266
 
267 267
 			$customer->setCompanyName( $customerName );
268 268
 			$customer->setStreetAddress( $streetAddress );
269 269
 			$customer->setZipCode( $zipCode );
270 270
 			$customer->setLocality( $city );
271 271
 
272
-			if ( ! empty( $phone ) ) {
272
+			if ( !empty( $phone ) ) {
273 273
 				$customer->setPhoneNumber( $phone );
274 274
 				$phonePreset = WebPayItem::presetValue()
275 275
 				                         ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER )
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				->setConfirmationUri( $defaultThankYou )
341 341
 				->setPushUri( $defaultPushUrl )
342 342
 				->setCheckoutUri( $defaultCancel ); // We have no "checkout"-url.. So we just cancel the booking instead.
343
-			$wpForm  = $wpBuild->createOrder();
343
+			$wpForm = $wpBuild->createOrder();
344 344
 
345 345
 			EDU()->session['svea-order-id'] = $wpForm['OrderId'];
346 346
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 		}
349 349
 
350 350
 		public function process_paymentstatus() {
351
-			if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) {
351
+			if ( !empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && !empty( $_GET['status'] ) ) {
352 352
 
353 353
 				$booking_id           = intval( $_GET['booking_id'] );
354 354
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 				exit( 0 );
359 359
 			}
360 360
 
361
-			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) {
361
+			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && !empty( $_GET['status'] ) ) {
362 362
 				$booking_id           = intval( $_GET['booking_id'] );
363 363
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
364 364
 
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
 					@wp_redirect( get_home_url() );
153 153
 					echo "<script type='text/javascript>location.href = '" . esc_js( get_home_url() ) . "';</script>";
154 154
 					exit( 0 );
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
 		/**
160 160
 		 * @param $ebi EduAdmin_BookingInfo|null $bookingInfo
161 161
 		 */
162
-		public function process_booking( $ebi = null ) {
163
-			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
162
+		public function process_booking( $ebi = null ) {
163
+			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
164 164
 				return;
165 165
 			}
166 166
 
167 167
 			$ebi->NoRedirect = true;
168 168
 
169
-			if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) {
169
+			if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) {
170 170
 				$checkout = $this->create_checkout( $ebi );
171 171
 
172 172
 				$snippet = $checkout['Gui']['Snippet'];
@@ -179,21 +179,21 @@  discard block
 block discarded – undo
179 179
 		 *
180 180
 		 * @returns array
181 181
 		 */
182
-		public function create_checkout( $ebi ) {
182
+		public function create_checkout( $ebi ) {
183 183
 			$countries = EDUAPI()->OData->Countries->Search()['value'];
184 184
 
185 185
 			$selectedCountry = 'SE';
186 186
 			$selectedLocale  = 'sv-SE';
187 187
 
188 188
 			$invoiceCountry = $ebi->Customer['BillingInfo']['Country'];
189
-			if ( empty( $invoiceCountry ) ) {
189
+			if ( empty( $invoiceCountry ) ) {
190 190
 				$invoiceCountry = $ebi->Customer['Country'];
191 191
 			}
192 192
 
193
-			foreach ( $countries as $country ) {
194
-				if ( $invoiceCountry == $country['CountryName'] ) {
193
+			foreach ( $countries as $country ) {
194
+				if ( $invoiceCountry == $country['CountryName'] ) {
195 195
 					$selectedCountry = $country['CountryCode'];
196
-					if ( ! empty( $country['CultureName'] ) ) {
196
+					if ( ! empty( $country['CultureName'] ) ) {
197 197
 						$selectedLocale = $country['CultureName'];
198 198
 					}
199 199
 					break;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 			$locationCountry    = '';
214 214
 			$locationPostalCode = '';
215 215
 
216
-			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
216
+			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
217 217
 				$booking_id   = intval( $ebi->EventBooking['BookingId'] );
218 218
 				$reference_id = $booking_id;
219 219
 
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 
222 222
 				$eventName = $_event['EventName'];
223 223
 
224
-				if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
224
+				if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
225 225
 					$locationAddress    = $_event['LocationAddress']['Address'];
226 226
 					$locationCountry    = $_event['LocationAddress']['Country'];
227 227
 					$locationPostalCode = $_event['LocationAddress']['AddressZip'];
228 228
 				}
229 229
 			}
230 230
 
231
-			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
231
+			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
232 232
 				$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
233 233
 				$reference_id         = $programme_booking_id;
234 234
 
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 
240 240
 			$currency = EDU()->get_option( 'eduadmin-currency', 'SEK' );
241 241
 
242
-			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
242
+			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
243 243
 				$wpConfig = new EduSveaWebPayTestConfig( $this );
244
-			} else {
244
+			} else {
245 245
 				$wpConfig = new EduSveaWebPayProductionConfig( $this );
246 246
 			}
247 247
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			$customer->setZipCode( $zipCode );
270 270
 			$customer->setLocality( $city );
271 271
 
272
-			if ( ! empty( $phone ) ) {
272
+			if ( ! empty( $phone ) ) {
273 273
 				$customer->setPhoneNumber( $phone );
274 274
 				$phonePreset = WebPayItem::presetValue()
275 275
 				                         ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER )
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 			return $wpForm;
348 348
 		}
349 349
 
350
-		public function process_paymentstatus() {
351
-			if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) {
350
+		public function process_paymentstatus() {
351
+			if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) {
352 352
 
353 353
 				$booking_id           = intval( $_GET['booking_id'] );
354 354
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 				exit( 0 );
359 359
 			}
360 360
 
361
-			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) {
361
+			if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) {
362 362
 				$booking_id           = intval( $_GET['booking_id'] );
363 363
 				$programme_booking_id = intval( $_GET['programme_booking_id'] );
364 364
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
 				EDU()->session['svea-order-id'] = null;
368 368
 
369
-				if ( $deleted ) {
369
+				if ( $deleted ) {
370 370
 					@wp_redirect( get_home_url() );
371 371
 					echo "<script type='text/javascript>location.href = '" . esc_js( get_home_url() ) . "';</script>";
372 372
 					exit( 0 );
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
 		 * @return bool If the booking was deleted, due to cancellation
383 383
 		 * @throws \Svea\WebPay\BuildOrder\Validator\ValidationException
384 384
 		 */
385
-		private function update_booking( $order_id, $booking_id, $programme_booking_id ) {
386
-			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
385
+		private function update_booking( $order_id, $booking_id, $programme_booking_id ) {
386
+			if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
387 387
 				$wpConfig = new EduSveaWebPayTestConfig( $this );
388
-			} else {
388
+			} else {
389 389
 				$wpConfig = new EduSveaWebPayProductionConfig( $this );
390 390
 			}
391 391
 
@@ -399,39 +399,39 @@  discard block
 block discarded – undo
399 399
 			$patch_booking                  = new stdClass();
400 400
 			$patch_booking->PaymentMethodId = 2;
401 401
 
402
-			if ( 'Cancelled' === $order['Status'] ) {
402
+			if ( 'Cancelled' === $order['Status'] ) {
403 403
 				$patch_booking->Paid = false;
404 404
 				$delete_booking      = true;
405
-			} else if ( 'Final' === $order['Status'] ) {
405
+			} else if ( 'Final' === $order['Status'] ) {
406 406
 				$patch_booking->Paid = true;
407
-			} else if ( 'Created' === $order['Status'] ) {
407
+			} else if ( 'Created' === $order['Status'] ) {
408 408
 				$patch_booking->Paid = false;
409 409
 			}
410 410
 
411
-			if ( isset( $_GET['status'] ) && 'cancel' === $_GET['status'] ) {
411
+			if ( isset( $_GET['status'] ) && 'cancel' === $_GET['status'] ) {
412 412
 				$patch_booking->Paid = false;
413 413
 				$delete_booking      = true;
414 414
 			}
415 415
 
416
-			if ( $booking_id > 0 ) {
416
+			if ( $booking_id > 0 ) {
417 417
 				EDUAPI()->REST->Booking->PatchBooking(
418 418
 					$booking_id,
419 419
 					$patch_booking
420 420
 				);
421 421
 
422
-				if ( $delete_booking ) {
422
+				if ( $delete_booking ) {
423 423
 					EDUAPI()->REST->Booking->DeleteBooking( $booking_id );
424 424
 				}
425 425
 			}
426 426
 
427
-			if ( $programme_booking_id > 0 ) {
427
+			if ( $programme_booking_id > 0 ) {
428 428
 
429 429
 				EDUAPI()->REST->ProgrammeBooking->PatchBooking(
430 430
 					$programme_booking_id,
431 431
 					$patch_booking
432 432
 				);
433 433
 
434
-				if ( $delete_booking ) {
434
+				if ( $delete_booking ) {
435 435
 					EDUAPI()->REST->ProgrammeBooking->DeleteBooking( $programme_booking_id );
436 436
 				}
437 437
 			}
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.