@@ -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'; |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | 'Customer($select=CustomerId;),ContactPerson($select=PersonId;),OrderRows', |
38 | 38 | false |
39 | 39 | ); |
40 | - $_customer = EDUAPI()->OData->Customers->GetItem( |
|
40 | + $_customer = EDUAPI()->OData->Customers->GetItem( |
|
41 | 41 | $event_booking['Customer']['CustomerId'], |
42 | 42 | null, |
43 | 43 | null, |
44 | 44 | false |
45 | 45 | ); |
46 | - $_contact = EDUAPI()->OData->Persons->GetItem( |
|
46 | + $_contact = EDUAPI()->OData->Persons->GetItem( |
|
47 | 47 | $event_booking['ContactPerson']['PersonId'], |
48 | 48 | null, |
49 | 49 | null, |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact ); |
54 | 54 | |
55 | - if ( ! empty( EDU()->session['klarna-order-id'] ) && ! empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) { |
|
55 | + if ( !empty( EDU()->session['klarna-order-id'] ) && !empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) { |
|
56 | 56 | do_action( 'eduadmin-bookingcompleted', $ebi ); |
57 | 57 | } else { |
58 | 58 | do_action( 'eduadmin-processbooking', $ebi ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | - if ( ! empty( $_POST['act'] ) && 'bookCourse' === $_POST['act'] ) { |
|
70 | + if ( !empty( $_POST['act'] ) && 'bookCourse' === $_POST['act'] ) { |
|
71 | 71 | $ebi->NoRedirect = true; |
72 | 72 | } |
73 | 73 | } |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
95 | 95 | return; |
96 | 96 | } |
97 | - $checkout_url = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
97 | + $checkout_url = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
98 | 98 | $shared_secret = $this->get_option( 'shared_secret', '' ); |
99 | 99 | |
100 | - if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) { |
|
100 | + if ( !empty( $_GET['klarna_order_id'] ) && !empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) { |
|
101 | 101 | try { |
102 | 102 | $connector = Klarna_Checkout_Connector::create( |
103 | 103 | $shared_secret, |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function create_checkout( $ebi = null ) { |
165 | 165 | |
166 | - $checkout_url = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
166 | + $checkout_url = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
167 | 167 | $shared_secret = $this->get_option( 'shared_secret', '' ); |
168 | 168 | |
169 | 169 | $create = array(); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $cart_item['name'] = $order_row['Description']; |
215 | 215 | $cart_item['quantity'] = intval( $order_row['Quantity'] ); |
216 | 216 | |
217 | - if ( ! $order_row['PriceIncVat'] ) { |
|
217 | + if ( !$order_row['PriceIncVat'] ) { |
|
218 | 218 | $price_per_unit = $order_row['PricePerUnit'] * ( 1 + ( $order_row['VatPercent'] / 100 ) ) * 100; |
219 | 219 | } else { |
220 | 220 | $price_per_unit = $order_row['PricePerUnit'] * 100; |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | public function process_paymentstatus() { |
254 | - if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) { |
|
255 | - $checkout_url = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
254 | + if ( !empty( $_GET['klarna_order_id'] ) && !empty( $_GET['status'] ) ) { |
|
255 | + $checkout_url = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
256 | 256 | $shared_secret = $this->get_option( 'shared_secret', '' ); |
257 | 257 | |
258 | 258 | try { |