@@ -5,8 +5,6 @@ |
||
| 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 | |
@@ -354,6 +354,11 @@ |
||
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | + /** |
|
| 358 | + * @param integer $ecl_id |
|
| 359 | + * @param integer $booking_id |
|
| 360 | + * @param integer $programme_booking_id |
|
| 361 | + */ |
|
| 357 | 362 | private function update_booking( $ecl_id, $booking_id, $programme_booking_id ) { |
| 358 | 363 | if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) { |
| 359 | 364 | $wpConfig = new EduSveaWebPayTestConfig( $this ); |
@@ -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']}" ); |
@@ -8,7 +8,7 @@ discard block |
||
| 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 |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact ); |
| 80 | 80 | |
| 81 | - if ( ! empty( EDU()->session['svea-order-id'] ) && ! empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) { |
|
| 81 | + if ( !empty( EDU()->session['svea-order-id'] ) && !empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) { |
|
| 82 | 82 | do_action( 'eduadmin-bookingcompleted', $ebi ); |
| 83 | 83 | } else { |
| 84 | 84 | do_action( 'eduadmin-processbooking', $ebi ); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) { |
|
| 97 | + if ( !empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) { |
|
| 98 | 98 | $ebi->NoRedirect = true; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | foreach ( $countries as $country ) { |
| 187 | 187 | if ( $invoiceCountry == $country['CountryName'] ) { |
| 188 | 188 | $selectedCountry = $country['CountryCode']; |
| 189 | - if ( ! empty( $country['CultureName'] ) ) { |
|
| 189 | + if ( !empty( $country['CultureName'] ) ) { |
|
| 190 | 190 | $selectedLocale = $country['CultureName']; |
| 191 | 191 | } |
| 192 | 192 | break; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $locationCountry = ''; |
| 207 | 207 | $locationPostalCode = ''; |
| 208 | 208 | |
| 209 | - if ( ! empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 209 | + if ( !empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 210 | 210 | $booking_id = intval( $ebi->EventBooking['BookingId'] ); |
| 211 | 211 | $reference_id = $booking_id; |
| 212 | 212 | |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | $eventName = $_event['EventName']; |
| 216 | 216 | |
| 217 | - if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) { |
|
| 217 | + if ( !empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) { |
|
| 218 | 218 | $locationAddress = $_event['LocationAddress']['Address']; |
| 219 | 219 | $locationCountry = $_event['LocationAddress']['Country']; |
| 220 | 220 | $locationPostalCode = $_event['LocationAddress']['AddressZip']; |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 224 | + if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 225 | 225 | $programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] ); |
| 226 | 226 | $reference_id = $programme_booking_id; |
| 227 | 227 | |
@@ -250,19 +250,19 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | $customer = WebPayItem::companyCustomer(); |
| 252 | 252 | |
| 253 | - $customerName = ! empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName']; |
|
| 254 | - $streetAddress = ! empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address']; |
|
| 255 | - $zipCode = ! empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip']; |
|
| 253 | + $customerName = !empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName']; |
|
| 254 | + $streetAddress = !empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address']; |
|
| 255 | + $zipCode = !empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip']; |
|
| 256 | 256 | $city = $ebi->Customer['BillingInfo']['City'] ? $ebi->Customer['BillingInfo']['City'] : $ebi->Customer['City']; |
| 257 | 257 | $phone = $ebi->Customer['Phone']; |
| 258 | - $email = ! empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email']; |
|
| 258 | + $email = !empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email']; |
|
| 259 | 259 | |
| 260 | 260 | $customer->setCompanyName( $customerName ); |
| 261 | 261 | $customer->setStreetAddress( $streetAddress ); |
| 262 | 262 | $customer->setZipCode( $zipCode ); |
| 263 | 263 | $customer->setLocality( $city ); |
| 264 | 264 | |
| 265 | - if ( ! empty( $phone ) ) { |
|
| 265 | + if ( !empty( $phone ) ) { |
|
| 266 | 266 | $customer->setPhoneNumber( $phone ); |
| 267 | 267 | $phonePreset = WebPayItem::presetValue() |
| 268 | 268 | ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER ) |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | ->setConfirmationUri( $defaultThankYou ) |
| 336 | 336 | ->setPushUri( $defaultPushUrl ) |
| 337 | 337 | ->setCheckoutUri( $defaultCancel ); // We have no "checkout"-url.. So we just cancel the booking instead. |
| 338 | - $wpForm = $wpBuild->createOrder(); |
|
| 338 | + $wpForm = $wpBuild->createOrder(); |
|
| 339 | 339 | |
| 340 | 340 | EDU()->session['svea-order-id'] = $wpForm['OrderId']; |
| 341 | 341 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | public function process_paymentstatus() { |
| 346 | - if ( ! empty( $_GET['svea_order_id'] ) && ! empty( $_GET['status'] ) ) { |
|
| 346 | + if ( !empty( $_GET['svea_order_id'] ) && !empty( $_GET['status'] ) ) { |
|
| 347 | 347 | |
| 348 | 348 | $booking_id = intval( $_GET['booking_id'] ); |
| 349 | 349 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
@@ -13,11 +13,11 @@ discard block |
||
| 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 = ''; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * @param $attributes |
| 38 | 38 | */ |
| 39 | - public function test_page( $attributes ) { |
|
| 39 | + public function test_page( $attributes ) {
|
|
| 40 | 40 | $attributes = shortcode_atts( |
| 41 | 41 | array( |
| 42 | 42 | 'bookingid' => 0, |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | 'test_page' |
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | - if ( $attributes['bookingid'] > 0 ) { |
|
| 49 | + if ( $attributes['bookingid'] > 0 ) {
|
|
| 50 | 50 | $event_booking = EDUAPI()->OData->Bookings->GetItem( |
| 51 | 51 | $attributes['bookingid'], |
| 52 | 52 | null, |
| 53 | 53 | 'Customer($select=CustomerId;),ContactPerson($select=PersonId;),OrderRows', |
| 54 | 54 | false |
| 55 | 55 | ); |
| 56 | - } elseif ( $attributes['programmebookingid'] > 0 ) { |
|
| 56 | + } elseif ( $attributes['programmebookingid'] > 0 ) {
|
|
| 57 | 57 | $event_booking = EDUAPI()->OData->ProgrammeBookings->GetItem( |
| 58 | 58 | $attributes['programmebookingid'], |
| 59 | 59 | null, |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact ); |
| 80 | 80 | |
| 81 | - if ( ! empty( EDU()->session['svea-order-id'] ) && ! empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) { |
|
| 81 | + if ( ! empty( EDU()->session['svea-order-id'] ) && ! empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) {
|
|
| 82 | 82 | do_action( 'eduadmin-bookingcompleted', $ebi ); |
| 83 | - } else { |
|
| 83 | + } else {
|
|
| 84 | 84 | do_action( 'eduadmin-processbooking', $ebi ); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @param EduAdmin_BookingInfo|null $ebi |
| 91 | 91 | */ |
| 92 | - public function intercept_booking( $ebi = null ) { |
|
| 93 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
| 92 | + public function intercept_booking( $ebi = null ) {
|
|
| 93 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
|
|
| 94 | 94 | return; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) { |
|
| 97 | + if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
|
|
| 98 | 98 | $ebi->NoRedirect = true; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Initializes the settingsfields |
| 104 | 104 | */ |
| 105 | - public function init_form_fields() { |
|
| 105 | + public function init_form_fields() {
|
|
| 106 | 106 | $this->setting_fields = array( |
| 107 | 107 | 'enabled' => array( |
| 108 | 108 | 'title' => __( 'Enabled', 'eduadmin-sveawebpay' ), |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | /** |
| 135 | 135 | * |
| 136 | 136 | */ |
| 137 | - public function process_svearesponse() { |
|
| 138 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
| 137 | + public function process_svearesponse() {
|
|
| 138 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
|
|
| 139 | 139 | return; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) ) { |
|
| 142 | + if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) ) {
|
|
| 143 | 143 | $booking_id = intval( $_GET['booking_id'] ); |
| 144 | 144 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
| 145 | 145 | |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * @param $ebi EduAdmin_BookingInfo|null $bookingInfo |
| 154 | 154 | */ |
| 155 | - public function process_booking( $ebi = null ) { |
|
| 156 | - if ( 'no' === $this->get_option( 'enabled', 'no' ) ) { |
|
| 155 | + public function process_booking( $ebi = null ) {
|
|
| 156 | + if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
|
|
| 157 | 157 | return; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $ebi->NoRedirect = true; |
| 161 | 161 | |
| 162 | - if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) { |
|
| 162 | + if ( empty( $_GET['svea_order_id'] ) || empty( EDU()->session['svea-order-id'] ) ) {
|
|
| 163 | 163 | $checkout = $this->create_checkout( $ebi ); |
| 164 | 164 | |
| 165 | 165 | $snippet = $checkout['Gui']['Snippet']; |
@@ -172,21 +172,21 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @returns array |
| 174 | 174 | */ |
| 175 | - public function create_checkout( $ebi ) { |
|
| 175 | + public function create_checkout( $ebi ) {
|
|
| 176 | 176 | $countries = EDUAPI()->OData->Countries->Search()['value']; |
| 177 | 177 | |
| 178 | 178 | $selectedCountry = 'SE'; |
| 179 | 179 | $selectedLocale = 'sv-SE'; |
| 180 | 180 | |
| 181 | 181 | $invoiceCountry = $ebi->Customer['BillingInfo']['Country']; |
| 182 | - if ( empty( $invoiceCountry ) ) { |
|
| 182 | + if ( empty( $invoiceCountry ) ) {
|
|
| 183 | 183 | $invoiceCountry = $ebi->Customer['Country']; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - foreach ( $countries as $country ) { |
|
| 187 | - if ( $invoiceCountry == $country['CountryName'] ) { |
|
| 186 | + foreach ( $countries as $country ) {
|
|
| 187 | + if ( $invoiceCountry == $country['CountryName'] ) {
|
|
| 188 | 188 | $selectedCountry = $country['CountryCode']; |
| 189 | - if ( ! empty( $country['CultureName'] ) ) { |
|
| 189 | + if ( ! empty( $country['CultureName'] ) ) {
|
|
| 190 | 190 | $selectedLocale = $country['CultureName']; |
| 191 | 191 | } |
| 192 | 192 | break; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $locationCountry = ''; |
| 207 | 207 | $locationPostalCode = ''; |
| 208 | 208 | |
| 209 | - if ( ! empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 209 | + if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
|
|
| 210 | 210 | $booking_id = intval( $ebi->EventBooking['BookingId'] ); |
| 211 | 211 | $reference_id = $booking_id; |
| 212 | 212 | |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | $eventName = $_event['EventName']; |
| 216 | 216 | |
| 217 | - if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) { |
|
| 217 | + if ( ! empty( $_event['LocationAddress'] ) && $_event['LocationAdress'] != null ) {
|
|
| 218 | 218 | $locationAddress = $_event['LocationAddress']['Address']; |
| 219 | 219 | $locationCountry = $_event['LocationAddress']['Country']; |
| 220 | 220 | $locationPostalCode = $_event['LocationAddress']['AddressZip']; |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 224 | + if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
|
|
| 225 | 225 | $programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] ); |
| 226 | 226 | $reference_id = $programme_booking_id; |
| 227 | 227 | |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $currency = EDU()->get_option( 'eduadmin-currency', 'SEK' ); |
| 234 | 234 | |
| 235 | - if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) { |
|
| 235 | + if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
|
|
| 236 | 236 | $wpConfig = new EduSveaWebPayTestConfig( $this ); |
| 237 | - } else { |
|
| 237 | + } else {
|
|
| 238 | 238 | $wpConfig = new EduSveaWebPayProductionConfig( $this ); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $customer->setZipCode( $zipCode ); |
| 263 | 263 | $customer->setLocality( $city ); |
| 264 | 264 | |
| 265 | - if ( ! empty( $phone ) ) { |
|
| 265 | + if ( ! empty( $phone ) ) {
|
|
| 266 | 266 | $customer->setPhoneNumber( $phone ); |
| 267 | 267 | $phonePreset = WebPayItem::presetValue() |
| 268 | 268 | ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER ) |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | return $wpForm; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - public function process_paymentstatus() { |
|
| 346 | - if ( ! empty( $_GET['svea_order_id'] ) && ! empty( $_GET['status'] ) ) { |
|
| 345 | + public function process_paymentstatus() {
|
|
| 346 | + if ( ! empty( $_GET['svea_order_id'] ) && ! empty( $_GET['status'] ) ) {
|
|
| 347 | 347 | |
| 348 | 348 | $booking_id = intval( $_GET['booking_id'] ); |
| 349 | 349 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - private function update_booking( $ecl_id, $booking_id, $programme_booking_id ) { |
|
| 358 | - if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) { |
|
| 357 | + private function update_booking( $ecl_id, $booking_id, $programme_booking_id ) {
|
|
| 358 | + if ( 'no' !== $this->get_option( 'testrun', 'no' ) ) {
|
|
| 359 | 359 | $wpConfig = new EduSveaWebPayTestConfig( $this ); |
| 360 | - } else { |
|
| 360 | + } else {
|
|
| 361 | 361 | $wpConfig = new EduSveaWebPayProductionConfig( $this ); |
| 362 | 362 | } |
| 363 | 363 | |
@@ -369,22 +369,22 @@ discard block |
||
| 369 | 369 | $patch_booking = new stdClass(); |
| 370 | 370 | $patch_booking->PaymentMethodId = 2; |
| 371 | 371 | |
| 372 | - if ( 'Cancelled' === $order['Status'] ) { |
|
| 372 | + if ( 'Cancelled' === $order['Status'] ) {
|
|
| 373 | 373 | $patch_booking->Paid = false; |
| 374 | - } else if ( 'Final' === $order['Status'] ) { |
|
| 374 | + } else if ( 'Final' === $order['Status'] ) {
|
|
| 375 | 375 | $patch_booking->Paid = true; |
| 376 | - } else if ( 'Created' === $order['Status'] ) { |
|
| 376 | + } else if ( 'Created' === $order['Status'] ) {
|
|
| 377 | 377 | $patch_booking->Paid = false; |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - if ( $booking_id > 0 ) { |
|
| 380 | + if ( $booking_id > 0 ) {
|
|
| 381 | 381 | EDUAPI()->REST->Booking->PatchBooking( |
| 382 | 382 | $booking_id, |
| 383 | 383 | $patch_booking |
| 384 | 384 | ); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if ( $programme_booking_id > 0 ) { |
|
| 387 | + if ( $programme_booking_id > 0 ) {
|
|
| 388 | 388 | EDUAPI()->REST->ProgrammeBooking->PatchBooking( |
| 389 | 389 | $programme_booking_id, |
| 390 | 390 | $patch_booking |
@@ -1,6 +1,6 @@ discard block |
||
| 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 |
||
| 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; |
@@ -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; |