Completed
Push — master ( 1060c4...6b8585 )
by Chris
16s queued 12s
created
eduadmin-wp-klarna-checkout.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	along with this program. If not, see <http://www.gnu.org/licenses/>.
30 30
  */
31 31
 
32
-add_action( 'admin_init', function () {
33
-	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
34
-		add_action( 'admin_notices', function () {
32
+add_action( 'admin_init', function() {
33
+	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( !is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && !is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
34
+		add_action( 'admin_notices', function() {
35 35
 			?>
36 36
             <div class="error">
37 37
                 <p><?php esc_html_e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-wp-klarna-checkout' ); ?></p>
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 } );
47 47
 
48
-if ( ! class_exists( 'EDU_KlarnaCheckout_Loader' ) ) {
48
+if ( !class_exists( 'EDU_KlarnaCheckout_Loader' ) ) {
49 49
 	final class EDU_KlarnaCheckout_Loader {
50 50
 		public function __construct() {
51 51
 			add_action( 'plugins_loaded', array( $this, 'init' ) );
52 52
 		}
53 53
 
54 54
 		public function init() {
55
-			if ( ! class_exists( 'Klarna_Checkout_Connector' ) ) {
55
+			if ( !class_exists( 'Klarna_Checkout_Connector' ) ) {
56 56
 				require_once __DIR__ . '/klarna_kco_php_4.0.0/src/Klarna/Checkout.php';
57 57
 			}
58 58
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	along with this program. If not, see <http://www.gnu.org/licenses/>.
30 30
  */
31 31
 
32
-add_action( 'admin_init', function () {
33
-	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
34
-		add_action( 'admin_notices', function () {
32
+add_action( 'admin_init', function () {
33
+	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
34
+		add_action( 'admin_notices', function () {
35 35
 			?>
36 36
             <div class="error">
37 37
                 <p><?php esc_html_e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-wp-klarna-checkout' ); ?></p>
@@ -39,24 +39,24 @@  discard block
 block discarded – undo
39 39
 			<?php
40 40
 		} );
41 41
 		deactivate_plugins( plugin_basename( __FILE__ ) );
42
-		if ( isset( $_GET['activate'] ) ) {
42
+		if ( isset( $_GET['activate'] ) ) {
43 43
 			unset( $_GET['activate'] );
44 44
 		}
45 45
 	}
46 46
 } );
47 47
 
48
-if ( ! class_exists( 'EDU_KlarnaCheckout_Loader' ) ) {
49
-	final class EDU_KlarnaCheckout_Loader {
50
-		public function __construct() {
48
+if ( ! class_exists( 'EDU_KlarnaCheckout_Loader' ) ) {
49
+	final class EDU_KlarnaCheckout_Loader {
50
+		public function __construct() {
51 51
 			add_action( 'plugins_loaded', array( $this, 'init' ) );
52 52
 		}
53 53
 
54
-		public function init() {
55
-			if ( ! class_exists( 'Klarna_Checkout_Connector' ) ) {
54
+		public function init() {
55
+			if ( ! class_exists( 'Klarna_Checkout_Connector' ) ) {
56 56
 				require_once __DIR__ . '/klarna_kco_php_4.0.0/src/Klarna/Checkout.php';
57 57
 			}
58 58
 
59
-			if ( class_exists( 'EDU_Integration' ) ) {
59
+			if ( class_exists( 'EDU_Integration' ) ) {
60 60
 
61 61
 				require_once __DIR__ . '/class-edu-klarnacheckout.php';
62 62
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			}
65 65
 		}
66 66
 
67
-		public function add_integration( $integrations ) {
67
+		public function add_integration( $integrations ) {
68 68
 			$integrations[] = 'EDU_KlarnaCheckout';
69 69
 
70 70
 			return $integrations;
Please login to merge, or discard this patch.
class-edu-klarnacheckout.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 defined( 'ABSPATH' ) || die( 'This plugin must be run within the scope of WordPress.' );
3 3
 
4
-if ( ! class_exists( 'EDU_KlarnaCheckout' ) ) {
4
+if ( !class_exists( 'EDU_KlarnaCheckout' ) ) {
5 5
 	class EDU_KlarnaCheckout extends EDU_Integration {
6 6
 		public function __construct() {
7 7
 			$this->id          = 'eduadmin-klarnacheckout';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 			$ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact );
67 67
 
68
-			if ( ! empty( EDU()->session['klarna-order-id'] ) && ! empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
68
+			if ( !empty( EDU()->session['klarna-order-id'] ) && !empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
69 69
 				do_action( 'eduadmin-bookingcompleted', $ebi );
70 70
 			} else {
71 71
 				do_action( 'eduadmin-processbooking', $ebi );
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 				return;
81 81
 			}
82 82
 
83
-			if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
83
+			if ( !empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
84 84
 				$ebi->NoRedirect = true;
85 85
 			}
86 86
 		}
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
108 108
 				return;
109 109
 			}
110
-			$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
110
+			$checkout_url  = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
111 111
 			$shared_secret = $this->get_option( 'shared_secret', '' );
112 112
 
113
-			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
113
+			if ( !empty( $_GET['klarna_order_id'] ) && !empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
114 114
 				try {
115 115
 					$connector = Klarna_Checkout_Connector::create(
116 116
 						$shared_secret,
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		 */
177 177
 		public function create_checkout( $ebi = null ) {
178 178
 
179
-			$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
179
+			$checkout_url  = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
180 180
 			$shared_secret = $this->get_option( 'shared_secret', '' );
181 181
 
182 182
 			$create = array();
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			$purchase_country = $organization["CountryCode"];
186 186
 
187 187
 			$emd_info = array(
188
-				'unique_account_identifier' => ( ! empty( $ebi->Contact['Email'] ) ? $ebi->Contact['Email'] : "uid:" . $ebi->Contact['PersonId'] ),
188
+				'unique_account_identifier' => ( !empty( $ebi->Contact['Email'] ) ? $ebi->Contact['Email'] : "uid:" . $ebi->Contact['PersonId'] ),
189 189
 				'account_registration_date' => date( 'Y-m-d\TH:i', strtotime( $ebi->Contact['Created'] ) ),
190 190
 				'account_last_modified'     => date( 'Y-m-d\TH:i' )
191 191
 			);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			$locationCountry    = '';
206 206
 			$locationPostalCode = '';
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
 
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 
214 214
 				$eventName = $_event['EventName'];
215 215
 
216
-				if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
216
+				if ( !empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
217 217
 					$locationAddress    = $_event['LocationAddress']['Address'];
218 218
 					$locationCountry    = $_event['LocationAddress']['Country'];
219 219
 					$locationPostalCode = $_event['LocationAddress']['AddressZip'];
220 220
 				}
221 221
 			}
222 222
 
223
-			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
223
+			if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
224 224
 				$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
225 225
 				$reference_id         = $programme_booking_id;
226 226
 
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
 			}
231 231
 
232 232
 			$emd_event_info = array(
233
-				'event_name'              => ( ! empty( $eventName ) ? $eventName : "" ),
233
+				'event_name'              => ( !empty( $eventName ) ? $eventName : "" ),
234 234
 				'event_company'           => $organization['OrganisationName'],
235
-				'genre_of_event'          => ( ! empty( $_event['CategoryName'] ) ? $_event['CategoryName'] : "" ),
236
-				'arena_name'              => ( ! empty( $_event['AddressName'] ) ? $_event['AddressName'] : "" ),
235
+				'genre_of_event'          => ( !empty( $_event['CategoryName'] ) ? $_event['CategoryName'] : "" ),
236
+				'arena_name'              => ( !empty( $_event['AddressName'] ) ? $_event['AddressName'] : "" ),
237 237
 				'arena_location'          => array(
238 238
 					'street_address' => $locationAddress,
239 239
 					'postal_code'    => $locationPostalCode,
240
-					'city'           => ( ! empty( $_event['City'] ) ? $_event['City'] : "" ),
240
+					'city'           => ( !empty( $_event['City'] ) ? $_event['City'] : "" ),
241 241
 					'country'        => $locationCountry
242 242
 				),
243 243
 				'start_time'              => date( 'Y-m-d\TH:i', strtotime( $_event['StartDate'] ) ),
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
 			$rowExtraInfo = "";
270 270
 
271 271
 			if ( null != $_event ) {
272
-				if ( ! empty( $_event['City'] ) ) {
272
+				if ( !empty( $_event['City'] ) ) {
273 273
 					$rowExtraInfo .= ';' . $_event['City'];
274 274
 				}
275 275
 
276
-				if ( ! empty( $_event['StartDate'] ) ) {
276
+				if ( !empty( $_event['StartDate'] ) ) {
277 277
 					$rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['StartDate'] ) );
278 278
 				}
279 279
 
280
-				if ( ! empty( $_event['EndDate'] ) ) {
280
+				if ( !empty( $_event['EndDate'] ) ) {
281 281
 					$rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['EndDate'] ) );
282 282
 				}
283 283
 			}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				$cart_item['name']      = $order_row['Description'] . $rowExtraInfo;
325 325
 				$cart_item['quantity']  = intval( $order_row['Quantity'] );
326 326
 
327
-				if ( ! $order_row['PriceIncVat'] ) {
327
+				if ( !$order_row['PriceIncVat'] ) {
328 328
 					$price_per_unit = $order_row['PricePerUnit'] * ( 1 + ( $order_row['VatPercent'] / 100 ) ) * 100;
329 329
 				} else {
330 330
 					$price_per_unit = $order_row['PricePerUnit'] * 100;
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 		}
362 362
 
363 363
 		public function process_paymentstatus() {
364
-			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) {
365
-				$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
364
+			if ( !empty( $_GET['klarna_order_id'] ) && !empty( $_GET['status'] ) ) {
365
+				$checkout_url  = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
366 366
 				$shared_secret = $this->get_option( 'shared_secret', '' );
367 367
 
368 368
 				try {
Please login to merge, or discard this patch.
Braces   +43 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 defined( 'ABSPATH' ) || die( 'This plugin must be run within the scope of WordPress.' );
3 3
 
4
-if ( ! class_exists( 'EDU_KlarnaCheckout' ) ) {
5
-	class EDU_KlarnaCheckout extends EDU_Integration {
6
-		public function __construct() {
4
+if ( ! class_exists( 'EDU_KlarnaCheckout' ) ) {
5
+	class EDU_KlarnaCheckout extends EDU_Integration {
6
+		public function __construct() {
7 7
 			$this->id          = 'eduadmin-klarnacheckout';
8 8
 			$this->displayName = __( 'Klarna Checkout', 'eduadmin-wp-klarna-checkout' );
9 9
 			$this->description = '';
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		/**
24 24
 		 * @param $attributes
25 25
 		 */
26
-		public function test_page( $attributes ) {
26
+		public function test_page( $attributes ) {
27 27
 			$attributes = shortcode_atts(
28 28
 				array(
29 29
 					'bookingid'          => 0,
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 				'test_page'
34 34
 			);
35 35
 
36
-			if ( $attributes['bookingid'] > 0 ) {
36
+			if ( $attributes['bookingid'] > 0 ) {
37 37
 				$event_booking = EDUAPI()->OData->Bookings->GetItem(
38 38
 					$attributes['bookingid'],
39 39
 					null,
40 40
 					'Customer($select=CustomerId;),ContactPerson($select=PersonId;),OrderRows',
41 41
 					false
42 42
 				);
43
-			} elseif ( $attributes['programmebookingid'] > 0 ) {
43
+			} elseif ( $attributes['programmebookingid'] > 0 ) {
44 44
 				$event_booking = EDUAPI()->OData->ProgrammeBookings->GetItem(
45 45
 					$attributes['programmebookingid'],
46 46
 					null,
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
 			$ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact );
67 67
 
68
-			if ( ! empty( EDU()->session['klarna-order-id'] ) && ! empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
68
+			if ( ! empty( EDU()->session['klarna-order-id'] ) && ! empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
69 69
 				do_action( 'eduadmin-bookingcompleted', $ebi );
70
-			} else {
70
+			} else {
71 71
 				do_action( 'eduadmin-processbooking', $ebi );
72 72
 			}
73 73
 		}
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		/**
76 76
 		 * @param EduAdmin_BookingInfo|null $ebi
77 77
 		 */
78
-		public function intercept_booking( $ebi = null ) {
79
-			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
78
+		public function intercept_booking( $ebi = null ) {
79
+			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
80 80
 				return;
81 81
 			}
82 82
 
83
-			if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
83
+			if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
84 84
 				$ebi->NoRedirect = true;
85 85
 			}
86 86
 		}
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 		/**
89 89
 		 * @param EduAdmin_BookingInfo|null $ebi
90 90
 		 */
91
-		public function process_booking( $ebi = null ) {
92
-			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
91
+		public function process_booking( $ebi = null ) {
92
+			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
93 93
 				return;
94 94
 			}
95 95
 
96 96
 			$ebi->NoRedirect = true;
97 97
 
98
-			if ( empty( $_GET['klarna_order_id'] ) || empty( EDU()->session['klarna-order-id'] ) ) {
98
+			if ( empty( $_GET['klarna_order_id'] ) || empty( EDU()->session['klarna-order-id'] ) ) {
99 99
 				$checkout = $this->create_checkout( $ebi );
100 100
 
101 101
 				$snippet = $checkout['gui']['snippet'];
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 			}
104 104
 		}
105 105
 
106
-		public function process_klarnaresponse() {
107
-			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
106
+		public function process_klarnaresponse() {
107
+			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
108 108
 				return;
109 109
 			}
110 110
 			$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
111 111
 			$shared_secret = $this->get_option( 'shared_secret', '' );
112 112
 
113
-			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
114
-				try {
113
+			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
114
+				try {
115 115
 					$connector = Klarna_Checkout_Connector::create(
116 116
 						$shared_secret,
117 117
 						$checkout_url
@@ -127,14 +127,15 @@  discard block
 block discarded – undo
127 127
 					echo "<div>{$snippet}</div>";
128 128
 					EDU()->session['klarna-order-id'] = null;
129 129
 
130
-				} catch ( Klarna_Checkout_ApiErrorException $ex ) {
130
+				}
131
+				catch ( Klarna_Checkout_ApiErrorException $ex ) {
131 132
 					EDU()->write_debug( $ex->getMessage() );
132 133
 					EDU()->write_debug( $ex->getPayload() );
133 134
 				}
134 135
 			}
135 136
 		}
136 137
 
137
-		public function init_form_fields() {
138
+		public function init_form_fields() {
138 139
 			$this->setting_fields = array(
139 140
 				'enabled'       => array(
140 141
 					'title'       => __( 'Enabled', 'edauadmin-wp-klarna-checkout' ),
@@ -174,7 +175,7 @@  discard block
 block discarded – undo
174 175
 		 *
175 176
 		 * @return Klarna_Checkout_Order|null
176 177
 		 */
177
-		public function create_checkout( $ebi = null ) {
178
+		public function create_checkout( $ebi = null ) {
178 179
 
179 180
 			$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
180 181
 			$shared_secret = $this->get_option( 'shared_secret', '' );
@@ -205,7 +206,7 @@  discard block
 block discarded – undo
205 206
 			$locationCountry    = '';
206 207
 			$locationPostalCode = '';
207 208
 
208
-			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
209
+			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
209 210
 				$booking_id   = intval( $ebi->EventBooking['BookingId'] );
210 211
 				$reference_id = $booking_id;
211 212
 
@@ -213,14 +214,14 @@  discard block
 block discarded – undo
213 214
 
214 215
 				$eventName = $_event['EventName'];
215 216
 
216
-				if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
217
+				if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
217 218
 					$locationAddress    = $_event['LocationAddress']['Address'];
218 219
 					$locationCountry    = $_event['LocationAddress']['Country'];
219 220
 					$locationPostalCode = $_event['LocationAddress']['AddressZip'];
220 221
 				}
221 222
 			}
222 223
 
223
-			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
224
+			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
224 225
 				$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
225 226
 				$reference_id         = $programme_booking_id;
226 227
 
@@ -268,16 +269,16 @@  discard block
 block discarded – undo
268 269
 
269 270
 			$rowExtraInfo = "";
270 271
 
271
-			if ( null != $_event ) {
272
-				if ( ! empty( $_event['City'] ) ) {
272
+			if ( null != $_event ) {
273
+				if ( ! empty( $_event['City'] ) ) {
273 274
 					$rowExtraInfo .= ';' . $_event['City'];
274 275
 				}
275 276
 
276
-				if ( ! empty( $_event['StartDate'] ) ) {
277
+				if ( ! empty( $_event['StartDate'] ) ) {
277 278
 					$rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['StartDate'] ) );
278 279
 				}
279 280
 
280
-				if ( ! empty( $_event['EndDate'] ) ) {
281
+				if ( ! empty( $_event['EndDate'] ) ) {
281 282
 					$rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['EndDate'] ) );
282 283
 				}
283 284
 			}
@@ -317,16 +318,16 @@  discard block
 block discarded – undo
317 318
 			$create['cart']          = array();
318 319
 			$create['cart']['items'] = array();
319 320
 
320
-			foreach ( $ebi->EventBooking['OrderRows'] as $order_row ) {
321
+			foreach ( $ebi->EventBooking['OrderRows'] as $order_row ) {
321 322
 				$cart_item = array();
322 323
 
323 324
 				$cart_item['reference'] = $order_row['ItemNumber'];
324 325
 				$cart_item['name']      = $order_row['Description'] . $rowExtraInfo;
325 326
 				$cart_item['quantity']  = intval( $order_row['Quantity'] );
326 327
 
327
-				if ( ! $order_row['PriceIncVat'] ) {
328
+				if ( ! $order_row['PriceIncVat'] ) {
328 329
 					$price_per_unit = $order_row['PricePerUnit'] * ( 1 + ( $order_row['VatPercent'] / 100 ) ) * 100;
329
-				} else {
330
+				} else {
330 331
 					$price_per_unit = $order_row['PricePerUnit'] * 100;
331 332
 				}
332 333
 
@@ -337,7 +338,7 @@  discard block
 block discarded – undo
337 338
 				$create['cart']['items'][] = $cart_item;
338 339
 			}
339 340
 
340
-			try {
341
+			try {
341 342
 				$connector = Klarna_Checkout_Connector::create(
342 343
 					$shared_secret,
343 344
 					$checkout_url
@@ -352,7 +353,8 @@  discard block
 block discarded – undo
352 353
 				EDU()->session['klarna-order-id'] = $order_id;
353 354
 
354 355
 				return $order;
355
-			} catch ( Klarna_Checkout_ApiErrorException $ex ) {
356
+			}
357
+			catch ( Klarna_Checkout_ApiErrorException $ex ) {
356 358
 				EDU()->write_debug( $ex->getMessage() );
357 359
 				EDU()->write_debug( $ex->getPayload() );
358 360
 
@@ -360,12 +362,12 @@  discard block
 block discarded – undo
360 362
 			}
361 363
 		}
362 364
 
363
-		public function process_paymentstatus() {
364
-			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) {
365
+		public function process_paymentstatus() {
366
+			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) {
365 367
 				$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
366 368
 				$shared_secret = $this->get_option( 'shared_secret', '' );
367 369
 
368
-				try {
370
+				try {
369 371
 					$connector = Klarna_Checkout_Connector::create(
370 372
 						$shared_secret,
371 373
 						$checkout_url
@@ -381,7 +383,7 @@  discard block
 block discarded – undo
381 383
 					$programme_booking_id = intval( $_GET['programme_booking_id'] );
382 384
 
383 385
 
384
-					if ( 'checkout_complete' === $order['status'] ) {
386
+					if ( 'checkout_complete' === $order['status'] ) {
385 387
 
386 388
 						$patch_booking       = new stdClass();
387 389
 						$patch_booking->Paid = true;
@@ -389,14 +391,14 @@  discard block
 block discarded – undo
389 391
 						// We're setting this as a Card Payment, so that our service in the background will remove it if it doesn't get paid in time (15 minute slot)
390 392
 						$patch_booking->PaymentMethodId = 2;
391 393
 
392
-						if ( $booking_id > 0 ) {
394
+						if ( $booking_id > 0 ) {
393 395
 							EDUAPI()->REST->Booking->PatchBooking(
394 396
 								$booking_id,
395 397
 								$patch_booking
396 398
 							);
397 399
 						}
398 400
 
399
-						if ( $programme_booking_id > 0 ) {
401
+						if ( $programme_booking_id > 0 ) {
400 402
 							EDUAPI()->REST->ProgrammeBooking->PatchBooking(
401 403
 								$programme_booking_id,
402 404
 								$patch_booking
@@ -408,7 +410,8 @@  discard block
 block discarded – undo
408 410
 						$order->update( $update );
409 411
 					}
410 412
 					exit( 0 );
411
-				} catch ( Klarna_Checkout_ApiErrorException $ex ) {
413
+				}
414
+				catch ( Klarna_Checkout_ApiErrorException $ex ) {
412 415
 					EDU()->write_debug( $ex->getMessage() );
413 416
 					EDU()->write_debug( $ex->getPayload() );
414 417
 					exit( 1 );
Please login to merge, or discard this patch.