Skip to content

Commit

Permalink
Merge pull request #33 from wuunder/development
Browse files Browse the repository at this point in the history
add booking token import
  • Loading branch information
TimD90 authored Oct 7, 2019
2 parents 8d1ce2b + 0dda67c commit 4b4f761
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Released

## [2.7.5](https://github.com/kabisa/wuunder-webshopplugin-woocommerce/tag/2.7.4) - 2019-09-30
## [2.7.6](https://github.com/kabisa/wuunder-webshopplugin-woocommerce/tag/2.7.6) - 2019-10-07

### Added
- Booking token support for imported orders via REST API


## [2.7.5](https://github.com/kabisa/wuunder-webshopplugin-woocommerce/tag/2.7.5) - 2019-09-30

### Fixed
- Parcelshop locator wuunder production settings
Expand Down
11 changes: 11 additions & 0 deletions includes/checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ function prefix_wc_rest_prepare_order_object( $response, $object, $request ) {
}
$response->data['wuunder_preferred_service_level'] = $shipping_method_id;

$bookingTokenData = get_post_meta( $object->get_id(), '_wuunder_label_booking_token' );

if (count($bookingTokenData)) {
$bookingToken = $bookingTokenData[0];
} else {
$bookingToken = uniqid();
update_post_meta( $object->get_id(), '_wuunder_label_booking_token', $bookingToken );
}

$response->data['wuunder_booking_token'] = $bookingToken;

return $response;
}
add_filter( 'woocommerce_rest_prepare_shop_order_object', 'prefix_wc_rest_prepare_order_object', 10, 3 );
Expand Down
12 changes: 9 additions & 3 deletions includes/wcwuunder-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct() {
$this->version_obj = array(
'product' => 'Woocommerce extension',
'version' => array(
'build' => '2.7.4',
'build' => '2.7.6 ',
'plugin' => '2.0' ),
'platform' => array(
'name' => 'Woocommerce',
Expand Down Expand Up @@ -109,9 +109,15 @@ private function wcwp_setBookingConfig($orderId ) {
}

$value = intval(($order->get_total() + $order->get_total_discount() - $order->get_shipping_total()) * 100);
$bookingTokenData = get_post_meta( $orderId, '_wuunder_label_booking_token' );

if (count($bookingTokenData)) {
$bookingToken = $bookingTokenData[0];
} else {
$bookingToken = uniqid();
update_post_meta( $orderId, '_wuunder_label_booking_token', $bookingToken );
}

$bookingToken = uniqid();
update_post_meta( $orderId, '_wuunder_label_booking_token', $bookingToken );
$redirectUrl = get_site_url( null, '/wp-admin/edit.php?post_type=shop_order' );
$webhookUrl = get_site_url( null, 'index.php/wuunder/webhook?order=' . $orderId . '&token=' . $bookingToken );

Expand Down
4 changes: 2 additions & 2 deletions woocommerce-wuunder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Wuunder
* Plugin URI: https://wearewuunder.com/wuunder-voor-webshops/
* Description: Wuunder shipping plugin
* Version: 2.7.5
* Version: 2.7.6
* Author: Wuunder
* Author URI: http://wearewuunder.com
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ class Woocommerce_Wuunder {
public static $plugin_path;
public static $plugin_basename;

const VERSION = '2.7.5';
const VERSION = '2.7.6';

public function __construct() {

Expand Down

0 comments on commit 4b4f761

Please sign in to comment.