spree_boxnow 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f62d5fc8bf2894744140e90eba7aa7c6eeeda3b45f5d2002631196747ab663e7
4
- data.tar.gz: 87466f19dc78f545ec26bc3e140f53c9759fecb9a57f811853362b91b4000b69
3
+ metadata.gz: f2d41407623bfa230792f076a2d78c6d96ef2e998788c70a77b07de658e16bbd
4
+ data.tar.gz: faa457db0331f12a0dd8d0dd0bafa68983780caeafeafe3a7510b9ae8684f6af
5
5
  SHA512:
6
- metadata.gz: 0d1b9a5368eef166ef932bb2b53e93930f57ddc911618efbd97acaec6154004fa7f870dedb86fa1a05b0fcb3e97521ab3858fd5fbcdb03ef1002d7d73d531e69
7
- data.tar.gz: e641fb1f659b9c27d2275127f17144472e109c42762291aad553f49d34d0e04d9eda07be8cade5d1e126f066c4d161e1c1d8b372a6d16ef10b2d82b73f296f08
6
+ metadata.gz: 309dca79c54d03342f73cf22d3ae5d283703d9e0abd53c7e8a39f28caceda90d93f7e9bbc209b4826bc6d1603e68456cd86b45abe02783781e58d5683cd9f3ff
7
+ data.tar.gz: 0a19c635ffcd28d4f9abf7d1c22eae65c5b96d8b70fcd689d1efc8ddf09ed9b64b2da340ffb92326d87b5598462a037bfadd47cb9037f043089a850e8b918e7f
@@ -45,7 +45,7 @@ module SpreeBoxnow
45
45
  name: 'voucher',
46
46
  value: '0.00',
47
47
  compartmentSize: parcel_size,
48
- weight: shipment.item_weight.to_f.round
48
+ weight: shipment_weight.round
49
49
  }]
50
50
  }
51
51
 
@@ -64,6 +64,13 @@ module SpreeBoxnow
64
64
 
65
65
  private
66
66
 
67
+ # Reads weight from the manifest's variant rather than Shipment#item_weight,
68
+ # which relies on inventory_unit.line_item and blows up when a line item was
69
+ # swapped out from under an already-fulfilled shipment (orphaned line_item_id).
70
+ def shipment_weight
71
+ shipment.manifest.sum { |item| item.variant.weight.to_f * item.quantity }
72
+ end
73
+
67
74
  # Returns BoxNow compartment size: 1=small, 2=medium, 3=large
68
75
  # Mirrors the height thresholds in BoxnowRate calculator
69
76
  def parcel_size
@@ -1,5 +1,5 @@
1
1
  module SpreeBoxnow
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.2.1'.freeze
3
3
 
4
4
  def gem_version
5
5
  Gem::Version.new(VERSION)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_boxnow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OlympusOne
@@ -182,10 +182,10 @@ licenses:
182
182
  - MIT
183
183
  metadata:
184
184
  bug_tracker_uri: https://github.com/olympusone/spree_boxnow/issues
185
- changelog_uri: https://github.com/olympusone/spree_boxnow/releases/tag/v1.2.0
185
+ changelog_uri: https://github.com/olympusone/spree_boxnow/releases/tag/v1.2.1
186
186
  documentation_uri: https://github.com/olympusone/spree_boxnow
187
187
  homepage_uri: https://github.com/olympusone/spree_boxnow
188
- source_code_uri: https://github.com/olympusone/spree_boxnow/tree/v1.2.0
188
+ source_code_uri: https://github.com/olympusone/spree_boxnow/tree/v1.2.1
189
189
  rdoc_options: []
190
190
  require_paths:
191
191
  - lib