@@ -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(); |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | $organization = EDUAPIHelper()->GetOrganization(); |
| 185 | 185 | $purchase_country = $organization["CountryCode"]; |
| 186 | 186 | |
| 187 | - if ( ! empty( $ebi->Customer["CountryCode"] ) ) { |
|
| 187 | + if ( !empty( $ebi->Customer["CountryCode"] ) ) { |
|
| 188 | 188 | $purchase_country = $ebi->Customer["CountryCode"]; |
| 189 | 189 | |
| 190 | - if ( ! empty( $ebi->Customer["BillingInfo"]["CountryCode"] ) ) { |
|
| 190 | + if ( !empty( $ebi->Customer["BillingInfo"]["CountryCode"] ) ) { |
|
| 191 | 191 | $purchase_country = $ebi->Customer["BillingInfo"]["CountryCode"]; |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -209,14 +209,14 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $_event = null; |
| 211 | 211 | |
| 212 | - if ( ! empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 212 | + if ( !empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 213 | 213 | $booking_id = intval( $ebi->EventBooking['BookingId'] ); |
| 214 | 214 | $reference_id = $booking_id; |
| 215 | 215 | |
| 216 | 216 | $_event = EDUAPI()->OData->Events->GetItem( $ebi->EventBooking['EventId'] ); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 219 | + if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 220 | 220 | $programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] ); |
| 221 | 221 | $reference_id = $programme_booking_id; |
| 222 | 222 | |
@@ -226,15 +226,15 @@ discard block |
||
| 226 | 226 | $rowExtraInfo = ""; |
| 227 | 227 | |
| 228 | 228 | if ( null != $_event ) { |
| 229 | - if ( ! empty( $_event['City'] ) ) { |
|
| 229 | + if ( !empty( $_event['City'] ) ) { |
|
| 230 | 230 | $rowExtraInfo .= ';' . $_event['City']; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if ( ! empty( $_event['StartDate'] ) ) { |
|
| 233 | + if ( !empty( $_event['StartDate'] ) ) { |
|
| 234 | 234 | $rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['StartDate'] ) ); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - if ( ! empty( $_event['EndDate'] ) ) { |
|
| 237 | + if ( !empty( $_event['EndDate'] ) ) { |
|
| 238 | 238 | $rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['EndDate'] ) ); |
| 239 | 239 | } |
| 240 | 240 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $cart_item['name'] = $order_row['Description'] . $rowExtraInfo; |
| 282 | 282 | $cart_item['quantity'] = intval( $order_row['Quantity'] ); |
| 283 | 283 | |
| 284 | - if ( ! $order_row['PriceIncVat'] ) { |
|
| 284 | + if ( !$order_row['PriceIncVat'] ) { |
|
| 285 | 285 | $price_per_unit = $order_row['PricePerUnit'] * ( 1 + ( $order_row['VatPercent'] / 100 ) ) * 100; |
| 286 | 286 | } else { |
| 287 | 287 | $price_per_unit = $order_row['PricePerUnit'] * 100; |
@@ -318,8 +318,8 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | public function process_paymentstatus() { |
| 321 | - if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) { |
|
| 322 | - $checkout_url = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
| 321 | + if ( !empty( $_GET['klarna_order_id'] ) && !empty( $_GET['status'] ) ) { |
|
| 322 | + $checkout_url = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
|
| 323 | 323 | $shared_secret = $this->get_option( 'shared_secret', '' ); |
| 324 | 324 | |
| 325 | 325 | try { |
@@ -1,9 +1,9 @@ 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' ) ) { |
|
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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', '' ); |
@@ -184,10 +185,10 @@ discard block |
||
| 184 | 185 | $organization = EDUAPIHelper()->GetOrganization(); |
| 185 | 186 | $purchase_country = $organization["CountryCode"]; |
| 186 | 187 | |
| 187 | - if ( ! empty( $ebi->Customer["CountryCode"] ) ) { |
|
| 188 | + if ( ! empty( $ebi->Customer["CountryCode"] ) ) {
|
|
| 188 | 189 | $purchase_country = $ebi->Customer["CountryCode"]; |
| 189 | 190 | |
| 190 | - if ( ! empty( $ebi->Customer["BillingInfo"]["CountryCode"] ) ) { |
|
| 191 | + if ( ! empty( $ebi->Customer["BillingInfo"]["CountryCode"] ) ) {
|
|
| 191 | 192 | $purchase_country = $ebi->Customer["BillingInfo"]["CountryCode"]; |
| 192 | 193 | } |
| 193 | 194 | } |
@@ -209,14 +210,14 @@ discard block |
||
| 209 | 210 | |
| 210 | 211 | $_event = null; |
| 211 | 212 | |
| 212 | - if ( ! empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 213 | + if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
|
|
| 213 | 214 | $booking_id = intval( $ebi->EventBooking['BookingId'] ); |
| 214 | 215 | $reference_id = $booking_id; |
| 215 | 216 | |
| 216 | 217 | $_event = EDUAPI()->OData->Events->GetItem( $ebi->EventBooking['EventId'] ); |
| 217 | 218 | } |
| 218 | 219 | |
| 219 | - if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 220 | + if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
|
|
| 220 | 221 | $programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] ); |
| 221 | 222 | $reference_id = $programme_booking_id; |
| 222 | 223 | |
@@ -225,16 +226,16 @@ discard block |
||
| 225 | 226 | |
| 226 | 227 | $rowExtraInfo = ""; |
| 227 | 228 | |
| 228 | - if ( null != $_event ) { |
|
| 229 | - if ( ! empty( $_event['City'] ) ) { |
|
| 229 | + if ( null != $_event ) {
|
|
| 230 | + if ( ! empty( $_event['City'] ) ) {
|
|
| 230 | 231 | $rowExtraInfo .= ';' . $_event['City']; |
| 231 | 232 | } |
| 232 | 233 | |
| 233 | - if ( ! empty( $_event['StartDate'] ) ) { |
|
| 234 | + if ( ! empty( $_event['StartDate'] ) ) {
|
|
| 234 | 235 | $rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['StartDate'] ) ); |
| 235 | 236 | } |
| 236 | 237 | |
| 237 | - if ( ! empty( $_event['EndDate'] ) ) { |
|
| 238 | + if ( ! empty( $_event['EndDate'] ) ) {
|
|
| 238 | 239 | $rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['EndDate'] ) ); |
| 239 | 240 | } |
| 240 | 241 | } |
@@ -274,16 +275,16 @@ discard block |
||
| 274 | 275 | $create['cart'] = array(); |
| 275 | 276 | $create['cart']['items'] = array(); |
| 276 | 277 | |
| 277 | - foreach ( $ebi->EventBooking['OrderRows'] as $order_row ) { |
|
| 278 | + foreach ( $ebi->EventBooking['OrderRows'] as $order_row ) {
|
|
| 278 | 279 | $cart_item = array(); |
| 279 | 280 | |
| 280 | 281 | $cart_item['reference'] = $order_row['ItemNumber']; |
| 281 | 282 | $cart_item['name'] = $order_row['Description'] . $rowExtraInfo; |
| 282 | 283 | $cart_item['quantity'] = intval( $order_row['Quantity'] ); |
| 283 | 284 | |
| 284 | - if ( ! $order_row['PriceIncVat'] ) { |
|
| 285 | + if ( ! $order_row['PriceIncVat'] ) {
|
|
| 285 | 286 | $price_per_unit = $order_row['PricePerUnit'] * ( 1 + ( $order_row['VatPercent'] / 100 ) ) * 100; |
| 286 | - } else { |
|
| 287 | + } else {
|
|
| 287 | 288 | $price_per_unit = $order_row['PricePerUnit'] * 100; |
| 288 | 289 | } |
| 289 | 290 | |
@@ -294,7 +295,7 @@ discard block |
||
| 294 | 295 | $create['cart']['items'][] = $cart_item; |
| 295 | 296 | } |
| 296 | 297 | |
| 297 | - try { |
|
| 298 | + try {
|
|
| 298 | 299 | $connector = Klarna_Checkout_Connector::create( |
| 299 | 300 | $shared_secret, |
| 300 | 301 | $checkout_url |
@@ -309,7 +310,8 @@ discard block |
||
| 309 | 310 | EDU()->session['klarna-order-id'] = $order_id; |
| 310 | 311 | |
| 311 | 312 | return $order; |
| 312 | - } catch ( Klarna_Checkout_ApiErrorException $ex ) { |
|
| 313 | + } |
|
| 314 | + catch ( Klarna_Checkout_ApiErrorException $ex ) {
|
|
| 313 | 315 | EDU()->write_debug( $ex->getMessage() ); |
| 314 | 316 | EDU()->write_debug( $ex->getPayload() ); |
| 315 | 317 | |
@@ -317,12 +319,12 @@ discard block |
||
| 317 | 319 | } |
| 318 | 320 | } |
| 319 | 321 | |
| 320 | - public function process_paymentstatus() { |
|
| 321 | - if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) { |
|
| 322 | + public function process_paymentstatus() {
|
|
| 323 | + if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) {
|
|
| 322 | 324 | $checkout_url = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL; |
| 323 | 325 | $shared_secret = $this->get_option( 'shared_secret', '' ); |
| 324 | 326 | |
| 325 | - try { |
|
| 327 | + try {
|
|
| 326 | 328 | $connector = Klarna_Checkout_Connector::create( |
| 327 | 329 | $shared_secret, |
| 328 | 330 | $checkout_url |
@@ -338,7 +340,7 @@ discard block |
||
| 338 | 340 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
| 339 | 341 | |
| 340 | 342 | |
| 341 | - if ( 'checkout_complete' === $order['status'] ) { |
|
| 343 | + if ( 'checkout_complete' === $order['status'] ) {
|
|
| 342 | 344 | |
| 343 | 345 | $patch_booking = new stdClass(); |
| 344 | 346 | $patch_booking->Paid = true; |
@@ -346,14 +348,14 @@ discard block |
||
| 346 | 348 | // 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) |
| 347 | 349 | $patch_booking->PaymentMethodId = 2; |
| 348 | 350 | |
| 349 | - if ( $booking_id > 0 ) { |
|
| 351 | + if ( $booking_id > 0 ) {
|
|
| 350 | 352 | EDUAPI()->REST->Booking->PatchBooking( |
| 351 | 353 | $booking_id, |
| 352 | 354 | $patch_booking |
| 353 | 355 | ); |
| 354 | 356 | } |
| 355 | 357 | |
| 356 | - if ( $programme_booking_id > 0 ) { |
|
| 358 | + if ( $programme_booking_id > 0 ) {
|
|
| 357 | 359 | EDUAPI()->REST->ProgrammeBooking->PatchBooking( |
| 358 | 360 | $programme_booking_id, |
| 359 | 361 | $patch_booking |
@@ -365,7 +367,8 @@ discard block |
||
| 365 | 367 | $order->update( $update ); |
| 366 | 368 | } |
| 367 | 369 | exit( 0 ); |
| 368 | - } catch ( Klarna_Checkout_ApiErrorException $ex ) { |
|
| 370 | + } |
|
| 371 | + catch ( Klarna_Checkout_ApiErrorException $ex ) {
|
|
| 369 | 372 | EDU()->write_debug( $ex->getMessage() ); |
| 370 | 373 | EDU()->write_debug( $ex->getPayload() ); |
| 371 | 374 | exit( 1 ); |