Skip to content

Commit 5214dd8

Browse files
author
Chris Gårdenberg
committed
1.1.0
1 parent 9226188 commit 5214dd8

3 files changed

Lines changed: 32 additions & 8 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: mnchga
33
Tags: booking, participants, courses, events, eduadmin, lega online, klarna
44
Requires at least: 4.7
55
Tested up to: 5.1
6-
Stable tag: 1.0.5
6+
Stable tag: 1.1.0
77
Requires PHP: 5.2
88
License: GPL3
99
License-URI: https://www.gnu.org/licenses/gpl-3.0.en.html
@@ -28,6 +28,9 @@ Stats
2828

2929
== Changelog ==
3030

31+
### 1.1.0
32+
- feat: Added event location (If applicable) and start/enddate (If applicable) to order rows
33+
3134
### 1.0.5
3235
- add: Set `BookingId` in `merchant_reference1` for tracing ability between Klarna and EduAdmin.
3336

class-edu-klarnacheckout.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public function test_page( $attributes ) {
6262
false
6363
);
6464

65-
6665
$ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact );
6766

6867
if ( ! empty( EDU()->session['klarna-order-id'] ) && ! empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
@@ -196,14 +195,36 @@ public function create_checkout( $ebi = null ) {
196195

197196
$reference_id = 0;
198197

198+
$_event = null;
199+
199200
if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
200-
$booking_id = intval( $ebi->EventBooking['BookingId'] );
201+
$booking_id = intval( $ebi->EventBooking['BookingId'] );
201202
$reference_id = $booking_id;
203+
204+
$_event = EDUAPI()->OData->Events->GetItem( $ebi->EventBooking['EventId'] );
202205
}
203206

204207
if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
205208
$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
206-
$reference_id = $programme_booking_id;
209+
$reference_id = $programme_booking_id;
210+
211+
$_event = EDUAPI()->OData->ProgrammeStarts->GetItem( $ebi->EventBooking['ProgrammeStartId'] );
212+
}
213+
214+
$rowExtraInfo = "";
215+
216+
if ( null != $_event ) {
217+
if ( ! empty( $_event['City'] ) ) {
218+
$rowExtraInfo .= ';' . $_event['City'];
219+
}
220+
221+
if ( ! empty( $_event['StartDate'] ) ) {
222+
$rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['StartDate'] ) );
223+
}
224+
225+
if ( ! empty( $_event['EndDate'] ) ) {
226+
$rowExtraInfo .= ';' . date( "Y-m-d", strtotime( $_event['EndDate'] ) );
227+
}
207228
}
208229

209230
$confirmation_url = add_query_arg(
@@ -233,7 +254,7 @@ public function create_checkout( $ebi = null ) {
233254

234255
$create['merchant'] = $merchant;
235256

236-
$create['merchant_reference'] = array();
257+
$create['merchant_reference'] = array();
237258
$create['merchant_reference']['orderid1'] = $reference_id;
238259
$create['merchant_reference']['orderid2'] = $reference_id;
239260

@@ -244,7 +265,7 @@ public function create_checkout( $ebi = null ) {
244265
$cart_item = array();
245266

246267
$cart_item['reference'] = $order_row['ItemNumber'];
247-
$cart_item['name'] = $order_row['Description'];
268+
$cart_item['name'] = $order_row['Description'] . $rowExtraInfo;
248269
$cart_item['quantity'] = intval( $order_row['Quantity'] );
249270

250271
if ( ! $order_row['PriceIncVat'] ) {

eduadmin-wp-klarna-checkout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* Plugin Name: EduAdmin Booking - Klarna Checkout-plugin
66
* Plugin URI: https://www.eduadmin.se
77
* Description: Plugin to EduAdmin Booking to enable Klarna Checkout-integration
8-
* Version: 1.0.5
8+
* Version: 1.1.0
99
* GitHub Plugin Uri: https://github.com/MultinetInteractive/eduadmin-wp-klarna-checkout
1010
* Requires at least: 4.7
11-
* Tested up to: 4.9
11+
* Tested up to: 5.2
1212
* Author: Chris Gårdenberg, MultiNet Interactive AB
1313
* Author URI: https://www.multinet.com
1414
* License: GPL3

0 commit comments

Comments
 (0)