WooCommerce ShipStation Gateway - Version 4.1.43

Version Description

  • 2021-07-27 =
  • Fix - API returns status code 200 even when errors exist.
  • Tweak - Add version compare for deprecated Order::get_product_from_item().
Download this release

Release Info

Developer frosso1
Plugin Icon 128x128 WooCommerce ShipStation Gateway
Version 4.1.43
Comparing to
See all releases

Code changes from version 4.1.42 to 4.1.43

changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  *** ShipStation for WooCommerce ***
2
 
 
 
 
 
3
  = 4.1.42 - 2021-04-20 =
4
  * Fix - Use order currency code instead of store currency.
5
 
1
  *** ShipStation for WooCommerce ***
2
 
3
+ = 4.1.43 - 2021-07-27 =
4
+ * Fix - API returns status code 200 even when errors exist.
5
+ * Tweak - Add version compare for deprecated Order::get_product_from_item().
6
+
7
  = 4.1.42 - 2021-04-20 =
8
  * Fix - Use order currency code instead of store currency.
9
 
includes/api-requests/class-wc-shipstation-api-request.php CHANGED
@@ -49,11 +49,12 @@ abstract class WC_Shipstation_API_Request {
49
 
50
  /**
51
  * Trigger and log an error
52
- * @param string $message
 
53
  */
54
- public function trigger_error( $message ) {
55
  $this->log( $message );
56
- wp_send_json_error( $message );
57
  }
58
  }
59
 
49
 
50
  /**
51
  * Trigger and log an error
52
+ *
53
+ * @param string $message
54
  */
55
+ public function trigger_error( $message, $status_code = 400 ) {
56
  $this->log( $message );
57
+ wp_send_json_error( $message, $status_code );
58
  }
59
  }
60
 
includes/api-requests/class-wc-shipstation-api-shipnotify.php CHANGED
@@ -29,7 +29,12 @@ class WC_Shipstation_API_Shipnotify extends WC_Shipstation_API_Request {
29
  $needs_shipping = 0;
30
 
31
  foreach ( $order->get_items() as $item_id => $item ) {
32
- $product = $order->get_product_from_item( $item );
 
 
 
 
 
33
 
34
  if ( is_a( $product, 'WC_Product' ) && $product->needs_shipping() ) {
35
  $needs_shipping += $item['qty'];
@@ -230,6 +235,7 @@ class WC_Shipstation_API_Shipnotify extends WC_Shipstation_API_Request {
230
  if ( false === $order || ! is_object( $order ) ) {
231
  /* translators: 1: order id */
232
  $this->log( sprintf( __( 'Order %s can not be found.', 'woocommerce-shipstation' ), $order_id ) );
 
233
  exit;
234
  }
235
 
@@ -238,6 +244,7 @@ class WC_Shipstation_API_Shipnotify extends WC_Shipstation_API_Request {
238
  if ( empty( $order_id ) ) {
239
  /* translators: 1: order id */
240
  $this->log( sprintf( __( 'Invalid order ID: %s', 'woocommerce-shipstation' ), $order_id ) );
 
241
  exit;
242
  }
243
 
29
  $needs_shipping = 0;
30
 
31
  foreach ( $order->get_items() as $item_id => $item ) {
32
+
33
+ if ( version_compare( WC_VERSION, '3.0', '>=' ) ) {
34
+ $product = is_callable( array( $item, 'get_product' ) ) ? $item->get_product() : false;
35
+ } else {
36
+ $product = $order->get_product_from_item( $item );
37
+ }
38
 
39
  if ( is_a( $product, 'WC_Product' ) && $product->needs_shipping() ) {
40
  $needs_shipping += $item['qty'];
235
  if ( false === $order || ! is_object( $order ) ) {
236
  /* translators: 1: order id */
237
  $this->log( sprintf( __( 'Order %s can not be found.', 'woocommerce-shipstation' ), $order_id ) );
238
+ status_header( 400 );
239
  exit;
240
  }
241
 
244
  if ( empty( $order_id ) ) {
245
  /* translators: 1: order id */
246
  $this->log( sprintf( __( 'Invalid order ID: %s', 'woocommerce-shipstation' ), $order_id ) );
247
+ status_header( 400 );
248
  exit;
249
  }
250
 
languages/woocommerce-shipstation.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the WooCommerce - ShipStation Integration package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce - ShipStation Integration 4.1.42\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-shipstation\n"
8
- "POT-Creation-Date: 2021-04-20 20:29:19+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -32,63 +32,63 @@ msgstr ""
32
  msgid "Missing required param: %s"
33
  msgstr ""
34
 
35
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:181
36
  msgid "Missing ShipNotify XML input."
37
  msgstr ""
38
 
39
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:201
40
  msgid "Missing SimpleXML extension for parsing ShipStation XML."
41
  msgstr ""
42
 
43
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:206
44
  msgid "ShipNotify XML: "
45
  msgstr ""
46
 
47
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:211
48
  msgid "Cannot parse XML"
49
  msgstr ""
50
 
51
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:232
52
  #. translators: 1: order id
53
  msgid "Order %s can not be found."
54
  msgstr ""
55
 
56
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:240
57
  #. translators: 1: order id
58
  msgid "Invalid order ID: %s"
59
  msgstr ""
60
 
61
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:249
62
  msgid "ShipNotify Item: "
63
  msgstr ""
64
 
65
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:262
66
  #. translators: 1: item name
67
  msgid "Item %s is not shippable product. Skipping."
68
  msgstr ""
69
 
70
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:280
71
  #. translators: 1) shipped items 2) carrier's name 3) shipped date, 4) tracking
72
  #. number
73
  msgid "%1$s shipped via %2$s on %3$s with tracking number %4$s."
74
  msgstr ""
75
 
76
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:296
77
  #. translators: 1) number of shipped items 2) total shipped items 3) order ID
78
  msgid "Shipped %1$d out of %2$d items in order %3$s"
79
  msgstr ""
80
 
81
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:312
82
  #. translators: 1) carrier's name 2) shipped date, 3) tracking number
83
  msgid "Items shipped via %1$s on %2$s with tracking number %3$s (Shipstation)."
84
  msgstr ""
85
 
86
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:319
87
  #. translators: 1: order id
88
  msgid "No items found - shipping entire order %d."
89
  msgstr ""
90
 
91
- #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:345
92
  #. translators: 1) order ID 2) shipment status
93
  msgid "Updated order %1$s to status %2$s"
94
  msgstr ""
2
  # This file is distributed under the same license as the WooCommerce - ShipStation Integration package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce - ShipStation Integration 4.1.43\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-shipstation\n"
8
+ "POT-Creation-Date: 2021-07-27 18:13:39+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
32
  msgid "Missing required param: %s"
33
  msgstr ""
34
 
35
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:186
36
  msgid "Missing ShipNotify XML input."
37
  msgstr ""
38
 
39
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:206
40
  msgid "Missing SimpleXML extension for parsing ShipStation XML."
41
  msgstr ""
42
 
43
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:211
44
  msgid "ShipNotify XML: "
45
  msgstr ""
46
 
47
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:216
48
  msgid "Cannot parse XML"
49
  msgstr ""
50
 
51
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:237
52
  #. translators: 1: order id
53
  msgid "Order %s can not be found."
54
  msgstr ""
55
 
56
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:246
57
  #. translators: 1: order id
58
  msgid "Invalid order ID: %s"
59
  msgstr ""
60
 
61
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:256
62
  msgid "ShipNotify Item: "
63
  msgstr ""
64
 
65
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:269
66
  #. translators: 1: item name
67
  msgid "Item %s is not shippable product. Skipping."
68
  msgstr ""
69
 
70
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:287
71
  #. translators: 1) shipped items 2) carrier's name 3) shipped date, 4) tracking
72
  #. number
73
  msgid "%1$s shipped via %2$s on %3$s with tracking number %4$s."
74
  msgstr ""
75
 
76
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:303
77
  #. translators: 1) number of shipped items 2) total shipped items 3) order ID
78
  msgid "Shipped %1$d out of %2$d items in order %3$s"
79
  msgstr ""
80
 
81
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:319
82
  #. translators: 1) carrier's name 2) shipped date, 3) tracking number
83
  msgid "Items shipped via %1$s on %2$s with tracking number %3$s (Shipstation)."
84
  msgstr ""
85
 
86
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:326
87
  #. translators: 1: order id
88
  msgid "No items found - shipping entire order %d."
89
  msgstr ""
90
 
91
+ #: includes/api-requests/class-wc-shipstation-api-shipnotify.php:352
92
  #. translators: 1) order ID 2) shipment status
93
  msgid "Updated order %1$s to status %2$s"
94
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: shipping, woocommerce, automattic
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 4.1.42
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -46,6 +46,10 @@ If you get stuck, you can ask for help in the Plugin Forum.
46
 
47
  == Changelog ==
48
 
 
 
 
 
49
  = 4.1.42 - 2021-04-20 =
50
  * Fix - Use order currency code instead of store currency.
51
 
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 4.1.43
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
46
 
47
  == Changelog ==
48
 
49
+ = 4.1.43 - 2021-07-27 =
50
+ * Fix - API returns status code 200 even when errors exist.
51
+ * Tweak - Add version compare for deprecated Order::get_product_from_item().
52
+
53
  = 4.1.42 - 2021-04-20 =
54
  * Fix - Use order currency code instead of store currency.
55
 
woocommerce-shipstation.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: WooCommerce - ShipStation Integration
4
  * Plugin URI: https://woocommerce.com/products/shipstation-integration/
5
- * Version: 4.1.42
6
  * Description: Adds ShipStation label printing support to WooCommerce. Requires server DomDocument support.
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
@@ -41,7 +41,7 @@ function woocommerce_shipstation_init() {
41
  return;
42
  }
43
 
44
- define( 'WC_SHIPSTATION_VERSION', '4.1.42' ); // WRCS: DEFINED_VERSION.
45
  define( 'WC_SHIPSTATION_FILE', __FILE__ );
46
 
47
  if ( ! defined( 'WC_SHIPSTATION_EXPORT_LIMIT' ) ) {
2
  /**
3
  * Plugin Name: WooCommerce - ShipStation Integration
4
  * Plugin URI: https://woocommerce.com/products/shipstation-integration/
5
+ * Version: 4.1.43
6
  * Description: Adds ShipStation label printing support to WooCommerce. Requires server DomDocument support.
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
41
  return;
42
  }
43
 
44
+ define( 'WC_SHIPSTATION_VERSION', '4.1.43' ); // WRCS: DEFINED_VERSION.
45
  define( 'WC_SHIPSTATION_FILE', __FILE__ );
46
 
47
  if ( ! defined( 'WC_SHIPSTATION_EXPORT_LIMIT' ) ) {