@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
185 | 185 | $purchase_country = $organization["CountryCode"]; |
186 | 186 | |
187 | 187 | $emd_info = array( |
188 | - 'unique_account_identifier' => ( ! empty( $ebi->Contact['Email'] ) ? $ebi->Contact['Email'] : $ebi->Contact['PersonId'] ), |
|
188 | + 'unique_account_identifier' => ( !empty( $ebi->Contact['Email'] ) ? $ebi->Contact['Email'] : $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 | ); |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | |
217 | 217 | $_event = null; |
218 | 218 | |
219 | - if ( ! empty( $ebi->EventBooking['BookingId'] ) ) { |
|
219 | + if ( !empty( $ebi->EventBooking['BookingId'] ) ) { |
|
220 | 220 | $booking_id = intval( $ebi->EventBooking['BookingId'] ); |
221 | 221 | $reference_id = $booking_id; |
222 | 222 | |
223 | 223 | $_event = EDUAPI()->OData->Events->GetItem( $ebi->EventBooking['EventId'] ); |
224 | 224 | } |
225 | 225 | |
226 | - if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
226 | + if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
227 | 227 | $programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] ); |
228 | 228 | $reference_id = $programme_booking_id; |
229 | 229 | |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | $rowExtraInfo = ""; |
234 | 234 | |
235 | 235 | if ( null != $_event ) { |
236 | - if ( ! empty( $_event['City'] ) ) { |
|
236 | + if ( !empty( $_event['City'] ) ) { |
|
237 | 237 | $rowExtraInfo .= ';' . $_event['City']; |
238 | 238 | } |
239 | 239 | |
240 | - if ( ! empty( $_event['StartDate'] ) ) { |
|
240 | + if ( !empty( $_event['StartDate'] ) ) { |
|
241 | 241 | $rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['StartDate'] ) ); |
242 | 242 | } |
243 | 243 | |
244 | - if ( ! empty( $_event['EndDate'] ) ) { |
|
244 | + if ( !empty( $_event['EndDate'] ) ) { |
|
245 | 245 | $rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['EndDate'] ) ); |
246 | 246 | } |
247 | 247 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $cart_item['name'] = $order_row['Description'] . $rowExtraInfo; |
289 | 289 | $cart_item['quantity'] = intval( $order_row['Quantity'] ); |
290 | 290 | |
291 | - if ( ! $order_row['PriceIncVat'] ) { |
|
291 | + if ( !$order_row['PriceIncVat'] ) { |
|
292 | 292 | $price_per_unit = $order_row['PricePerUnit'] * ( 1 + ( $order_row['VatPercent'] / 100 ) ) * 100; |
293 | 293 | } else { |
294 | 294 | $price_per_unit = $order_row['PricePerUnit'] * 100; |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | public function process_paymentstatus() { |
328 | - if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) { |
|
329 | - $checkout_url = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
328 | + if ( !empty( $_GET['klarna_order_id'] ) && !empty( $_GET['status'] ) ) { |
|
329 | + $checkout_url = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
330 | 330 | $shared_secret = $this->get_option( 'shared_secret', '' ); |
331 | 331 | |
332 | 332 | try { |