@@ -265,23 +265,23 @@ |
||
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']}" ); |
@@ -6,7 +6,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | |
@@ -235,19 +235,19 @@ discard block |
||
235 | 235 | |
236 | 236 | $customer = WebPayItem::companyCustomer(); |
237 | 237 | |
238 | - $customerName = ! empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName']; |
|
239 | - $streetAddress = ! empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address']; |
|
240 | - $zipCode = ! empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip']; |
|
241 | - $city = ! empty ( $ebi->Customer['BillingInfo']['City'] ) ? $ebi->Customer['BillingInfo']['City'] : $ebi->Customer['City']; |
|
238 | + $customerName = !empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName']; |
|
239 | + $streetAddress = !empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address']; |
|
240 | + $zipCode = !empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip']; |
|
241 | + $city = !empty ( $ebi->Customer['BillingInfo']['City'] ) ? $ebi->Customer['BillingInfo']['City'] : $ebi->Customer['City']; |
|
242 | 242 | $phone = $ebi->Customer['Phone']; |
243 | - $email = ! empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email']; |
|
243 | + $email = !empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email']; |
|
244 | 244 | |
245 | 245 | $customer->setCompanyName( $customerName ); |
246 | 246 | $customer->setStreetAddress( $streetAddress ); |
247 | 247 | $customer->setZipCode( $zipCode ); |
248 | 248 | $customer->setLocality( $city ); |
249 | 249 | |
250 | - if ( ! empty( $phone ) ) { |
|
250 | + if ( !empty( $phone ) ) { |
|
251 | 251 | $customer->setPhoneNumber( $phone ); |
252 | 252 | $phonePreset = WebPayItem::presetValue() |
253 | 253 | ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER ) |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | public function process_paymentstatus() { |
376 | - if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) { |
|
376 | + if ( !empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && !empty( $_GET['status'] ) ) { |
|
377 | 377 | |
378 | 378 | $booking_id = intval( $_GET['booking_id'] ); |
379 | 379 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | exit( 0 ); |
384 | 384 | } |
385 | 385 | |
386 | - if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) { |
|
386 | + if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && !empty( $_GET['status'] ) ) { |
|
387 | 387 | $booking_id = intval( $_GET['booking_id'] ); |
388 | 388 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
389 | 389 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * EDU_SveaWebPay integrates EduAdmin-WordPress plugin with SveaWebPay as payment gateway |
13 | 13 | */ |
14 | - class EDU_SveaWebPay extends EDU_Integration { |
|
14 | + class EDU_SveaWebPay extends EDU_Integration { |
|
15 | 15 | /** |
16 | 16 | * Constructor |
17 | 17 | */ |
18 | - public function __construct() { |
|
18 | + public function __construct() { |
|
19 | 19 | $this->id = 'eduadmin-sveawebpay'; |
20 | 20 | $this->displayName = __( 'Svea Webpay (Checkout)', 'eduadmin-sveawebpay' ); |
21 | 21 | $this->description = ''; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @param $attributes |
37 | 37 | */ |
38 | - public function test_page( $attributes ) { |
|
38 | + public function test_page( $attributes ) { |
|
39 | 39 | $attributes = shortcode_atts( |
40 | 40 | array( |
41 | 41 | 'bookingid' => 0, |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | 'test_page' |
46 | 46 | ); |
47 | 47 | |
48 | - if ( $attributes['bookingid'] > 0 ) { |
|
48 | + if ( $attributes['bookingid'] > 0 ) { |
|
49 | 49 | $event_booking = EDUAPI()->OData->Bookings->GetItem( |
50 | 50 | $attributes['bookingid'], |
51 | 51 | null, |
52 | 52 | 'Customer($select=CustomerId;),ContactPerson($select=PersonId;),OrderRows', |
53 | 53 | false |
54 | 54 | ); |
55 | - } elseif ( $attributes['programmebookingid'] > 0 ) { |
|
55 | + } elseif ( $attributes['programmebookingid'] > 0 ) { |
|
56 | 56 | $event_booking = EDUAPI()->OData->ProgrammeBookings->GetItem( |
57 | 57 | $attributes['programmebookingid'], |
58 | 58 | null, |
@@ -77,9 +77,9 @@ discard block |
||
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 | - } else { |
|
82 | + } else { |
|
83 | 83 | do_action( 'eduadmin-processbooking', $ebi ); |
84 | 84 | } |
85 | 85 | } |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @param EduAdmin_BookingInfo|null $ebi |
90 | 90 | */ |
91 | - public function intercept_booking( $ebi = null ) { |
|
92 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
91 | + public function intercept_booking( $ebi = null ) { |
|
92 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
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 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * Initializes the settingsfields |
103 | 103 | */ |
104 | - public function init_form_fields() { |
|
104 | + public function init_form_fields() { |
|
105 | 105 | $this->setting_fields = array( |
106 | 106 | 'enabled' => array( |
107 | 107 | 'title' => __( 'Enabled', 'eduadmin-sveawebpay' ), |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | /** |
134 | 134 | * |
135 | 135 | */ |
136 | - public function process_svearesponse() { |
|
137 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
136 | + public function process_svearesponse() { |
|
137 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) ) { |
|
141 | + if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) ) { |
|
142 | 142 | $booking_id = intval( $_GET['booking_id'] ); |
143 | 143 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
144 | 144 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | EDU()->session['svea-order-id'] = null; |
148 | 148 | |
149 | - if ( $deleted ) { |
|
149 | + if ( $deleted ) { |
|
150 | 150 | $this->handle_cancelled_payment(); |
151 | 151 | } |
152 | 152 | } |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @param $ebi EduAdmin_BookingInfo|null $bookingInfo |
157 | 157 | */ |
158 | - public function process_booking( $ebi = null ) { |
|
159 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
158 | + public function process_booking( $ebi = null ) { |
|
159 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | $ebi->NoRedirect = true; |
164 | 164 | |
165 | - if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) { |
|
165 | + if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) { |
|
166 | 166 | $checkout = $this->create_checkout( $ebi ); |
167 | 167 | |
168 | 168 | $snippet = $checkout['Gui']['Snippet']; |
@@ -175,21 +175,21 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @returns array |
177 | 177 | */ |
178 | - public function create_checkout( $ebi ) { |
|
178 | + public function create_checkout( $ebi ) { |
|
179 | 179 | $countries = EDUAPI()->OData->Countries->Search()['value']; |
180 | 180 | |
181 | 181 | $selectedCountry = 'SE'; |
182 | 182 | $selectedLocale = 'sv-SE'; |
183 | 183 | |
184 | 184 | $invoiceCountry = $ebi->Customer['BillingInfo']['Country']; |
185 | - if ( empty( $invoiceCountry ) ) { |
|
185 | + if ( empty( $invoiceCountry ) ) { |
|
186 | 186 | $invoiceCountry = $ebi->Customer['Country']; |
187 | 187 | } |
188 | 188 | |
189 | - foreach ( $countries as $country ) { |
|
190 | - if ( $invoiceCountry == $country['CountryName'] ) { |
|
189 | + foreach ( $countries as $country ) { |
|
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 |
||
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 |
||
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 | |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | |
226 | 226 | $currency = EDU()->get_option( 'eduadmin-currency', 'SEK' ); |
227 | 227 | |
228 | - if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) { |
|
228 | + if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) { |
|
229 | 229 | $wpConfig = new EduSveaWebPayTestConfig( $this ); |
230 | - } else { |
|
230 | + } else { |
|
231 | 231 | $wpConfig = new EduSveaWebPayProductionConfig( $this ); |
232 | 232 | } |
233 | 233 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $customer->setZipCode( $zipCode ); |
248 | 248 | $customer->setLocality( $city ); |
249 | 249 | |
250 | - if ( ! empty( $phone ) ) { |
|
250 | + if ( ! empty( $phone ) ) { |
|
251 | 251 | $customer->setPhoneNumber( $phone ); |
252 | 252 | $phonePreset = WebPayItem::presetValue() |
253 | 253 | ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER ) |
@@ -343,18 +343,18 @@ discard block |
||
343 | 343 | |
344 | 344 | $wpBuild->addOrderRow( $orderRow ); |
345 | 345 | |
346 | - foreach ( $ebi->EventBooking['OrderRows'] as $eduOrderRow ) { |
|
346 | + foreach ( $ebi->EventBooking['OrderRows'] as $eduOrderRow ) { |
|
347 | 347 | $orderRow = WebPayItem::orderRow(); |
348 | 348 | $orderRow->setName( substr( $eduOrderRow['Description'], 0, 40 ) ); |
349 | 349 | $orderRow->setQuantity( $eduOrderRow['Quantity'] ); |
350 | 350 | |
351 | 351 | $orderRow->setVatPercent( $eduOrderRow['VatPercent'] ); |
352 | 352 | |
353 | - if ( $eduOrderRow['PriceIncVat'] ) { |
|
353 | + if ( $eduOrderRow['PriceIncVat'] ) { |
|
354 | 354 | $orderRow->setAmountIncVat( $eduOrderRow['TotalPrice'] ); |
355 | - } else { |
|
355 | + } else { |
|
356 | 356 | $priceInclVat = $eduOrderRow['TotalPrice']; |
357 | - if ( $eduOrderRow['VatPercent'] > 0 ) { |
|
357 | + if ( $eduOrderRow['VatPercent'] > 0 ) { |
|
358 | 358 | $priceInclVat = $eduOrderRow['TotalPrice'] * ( 1 + ( $eduOrderRow['VatPercent'] / 100 ) ); |
359 | 359 | } |
360 | 360 | $orderRow->setAmountIncVat( $priceInclVat ); |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | return $wpForm; |
373 | 373 | } |
374 | 374 | |
375 | - public function process_paymentstatus() { |
|
376 | - if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) { |
|
375 | + public function process_paymentstatus() { |
|
376 | + if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) { |
|
377 | 377 | |
378 | 378 | $booking_id = intval( $_GET['booking_id'] ); |
379 | 379 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | exit( 0 ); |
384 | 384 | } |
385 | 385 | |
386 | - if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) { |
|
386 | + if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) { |
|
387 | 387 | $booking_id = intval( $_GET['booking_id'] ); |
388 | 388 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
389 | 389 | |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | |
392 | 392 | EDU()->session['svea-order-id'] = null; |
393 | 393 | |
394 | - if ( $deleted ) { |
|
394 | + if ( $deleted ) { |
|
395 | 395 | $this->handle_cancelled_payment(); |
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
400 | - private function handle_cancelled_payment() { |
|
400 | + private function handle_cancelled_payment() { |
|
401 | 401 | $url = EDU()->session['svea-cancel-url']; |
402 | 402 | |
403 | 403 | EDU()->session['svea-cancel-url'] = null; |
@@ -417,10 +417,10 @@ discard block |
||
417 | 417 | * @return bool If the booking was deleted, due to cancellation |
418 | 418 | * @throws \Svea\WebPay\BuildOrder\Validator\ValidationException |
419 | 419 | */ |
420 | - private function update_booking( $order_id, $booking_id, $programme_booking_id ) { |
|
421 | - if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) { |
|
420 | + private function update_booking( $order_id, $booking_id, $programme_booking_id ) { |
|
421 | + if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) { |
|
422 | 422 | $wpConfig = new EduSveaWebPayTestConfig( $this ); |
423 | - } else { |
|
423 | + } else { |
|
424 | 424 | $wpConfig = new EduSveaWebPayProductionConfig( $this ); |
425 | 425 | } |
426 | 426 | |
@@ -434,39 +434,39 @@ discard block |
||
434 | 434 | $patch_booking = new stdClass(); |
435 | 435 | $patch_booking->PaymentMethodId = 2; |
436 | 436 | |
437 | - if ( 'Cancelled' === $order['Status'] ) { |
|
437 | + if ( 'Cancelled' === $order['Status'] ) { |
|
438 | 438 | $patch_booking->Paid = false; |
439 | 439 | $delete_booking = true; |
440 | - } else if ( 'Final' === $order['Status'] ) { |
|
440 | + } else if ( 'Final' === $order['Status'] ) { |
|
441 | 441 | $patch_booking->Paid = true; |
442 | - } else if ( 'Created' === $order['Status'] ) { |
|
442 | + } else if ( 'Created' === $order['Status'] ) { |
|
443 | 443 | $patch_booking->Paid = false; |
444 | 444 | } |
445 | 445 | |
446 | - if ( isset( $_GET['status'] ) && 'cancel' === $_GET['status'] ) { |
|
446 | + if ( isset( $_GET['status'] ) && 'cancel' === $_GET['status'] ) { |
|
447 | 447 | $patch_booking->Paid = false; |
448 | 448 | $delete_booking = true; |
449 | 449 | } |
450 | 450 | |
451 | - if ( $booking_id > 0 ) { |
|
451 | + if ( $booking_id > 0 ) { |
|
452 | 452 | EDUAPI()->REST->Booking->PatchBooking( |
453 | 453 | $booking_id, |
454 | 454 | $patch_booking |
455 | 455 | ); |
456 | 456 | |
457 | - if ( $delete_booking ) { |
|
457 | + if ( $delete_booking ) { |
|
458 | 458 | EDUAPI()->REST->Booking->DeleteBooking( $booking_id ); |
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - if ( $programme_booking_id > 0 ) { |
|
462 | + if ( $programme_booking_id > 0 ) { |
|
463 | 463 | |
464 | 464 | EDUAPI()->REST->ProgrammeBooking->PatchBooking( |
465 | 465 | $programme_booking_id, |
466 | 466 | $patch_booking |
467 | 467 | ); |
468 | 468 | |
469 | - if ( $delete_booking ) { |
|
469 | + if ( $delete_booking ) { |
|
470 | 470 | EDUAPI()->REST->ProgrammeBooking->DeleteBooking( $programme_booking_id ); |
471 | 471 | } |
472 | 472 | } |
@@ -37,8 +37,8 @@ discard block |
||
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 |
||
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() { |
@@ -36,9 +36,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -37,8 +37,8 @@ discard block |
||
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 |
||
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() { |
@@ -36,9 +36,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -11,7 +11,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |