Skip to content

Commit

Permalink
Merge pull request #50 from wuunder/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
timoj authored Dec 21, 2020
2 parents 53359f8 + 5b12b09 commit 2ff1bcd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Released

## [2.7.20](https://github.com/wuunder/wuunder-webshopplugin-woocommerce/tag/2.7.20) - 2020-12-11

### Fixed

- Fix hook used for webhook processing

## [2.7.19](https://github.com/wuunder/wuunder-webshopplugin-woocommerce/tag/2.7.19) - 2020-07-02

### Added
Expand Down
8 changes: 5 additions & 3 deletions includes/wcwuunder-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct()
$this->version_obj = array(
'product' => 'Woocommerce extension',
'version' => array(
'build' => '2.7.19',
'build' => '2.7.20',
'plugin' => '2.0'),
'platform' => array(
'name' => 'Woocommerce',
Expand Down Expand Up @@ -137,7 +137,9 @@ private function wcwp_setBookingConfig($orderId)
$bookingConfig->setHeight($this->wcwp_roundButNull($dimensions[2]));
$bookingConfig->setWeight($totalWeight ? $totalWeight : null);
$bookingConfig->setCustomerReference($orderId);
$bookingConfig->setPreferredServiceLevel((count($order->get_items('shipping')) > 0) ? $this->wcwp_get_filter_from_shippingmethod(reset($order->get_items('shipping'))->get_method_id()) : '');

$order_items = $order->get_items('shipping');
$bookingConfig->setPreferredServiceLevel((count($order->get_items('shipping')) > 0) ? $this->wcwp_get_filter_from_shippingmethod(reset($order_items)->get_method_id()) : '');
$bookingConfig->setSource($this->version_obj);

$orderMeta = get_post_meta($orderId);
Expand Down Expand Up @@ -410,7 +412,7 @@ public function wcwp_add_listing_actions($order)
<a
<?php
echo $target; ?>href=" <?php echo $data['url']; ?>"
class="<?php echo $data['action']; ?> button tips <?php echo $action; ?>"
class="<?php echo $action; ?> button tips <?php echo $action; ?>"
style="background:#8dcc00; height:2em; width:2em; padding:3px;"
alt="<?php echo $data['title']; ?>" data-tip="<?php echo $data['title']; ?>">
<img src="<?php echo $data['img']; ?>" style="width:18px; margin: 4px 3px;"
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ You can best contact us via [email protected]
7. Eenvoudig labels printen

== Changelog ==
= 2.7.20 =
* Fix hook used for webhook processing
= 2.7.19 =
* Fix rparcelshop error
* Added support for multi-site Wordpress
Expand Down
20 changes: 12 additions & 8 deletions woocommerce-wuunder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Wuunder for-woocommerce
* Plugin URI: https://wearewuunder.com/wuunder-voor-webshops/
* Description: Wuunder shipping plugin
* Version: 2.7.19
* Version: 2.7.20
* 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.19';
const VERSION = '2.7.20';

public function __construct() {

Expand All @@ -81,12 +81,12 @@ public function __construct() {
add_action('wp_ajax_wuunder_parcelshoplocator_get_selected_parcelshop', 'wcwp_getSelectedParcelshop');
add_action('wp_ajax_nopriv_wuunder_parcelshoplocator_get_selected_parcelshop', 'wcwp_getSelectedParcelshop');

add_action( 'wp_loaded', function () {
add_action( 'init', function () {
if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wuunder/webhook' ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
$this->wcwp_webhook();
exit;
}
} );
}, 20 );
if ( version_compare( WOOCOMMERCE_VERSION, '3.7', '>=' )) {
add_action( 'wp_loaded', array(WC_Wuunder_Settings::class, 'wcwp_save_action_for_update_settings' ) );
}
Expand Down Expand Up @@ -130,10 +130,14 @@ public function wcwp_webhook() {
} elseif ( 'track_and_trace_updated' === $data['action'] ) {
// This is the 2nd webhook
$order = wc_get_order( $orderId );
$note = __( 'Het pakket is aangemeld bij: ' . $data['carrier_name'] . '\n De track and trace code is: ' . $data['track_and_trace_code'] );
$order->add_order_note( $note );
$order->save();
$errorRedirect = false;
if ($order) {
$note = __( 'Het pakket is aangemeld bij: ' . $data['carrier_name'] . '\n De track and trace code is: ' . $data['track_and_trace_code'] );
$order->add_order_note( $note );
$order->save();
$errorRedirect = false;
} else {
wcwp_log( 'error', 'T&T webhook for unknown order with id: ' . $orderId );
}
}

if ( $errorRedirect ) {
Expand Down

0 comments on commit 2ff1bcd

Please sign in to comment.