spree_easypost 6.0.0.beta4 → 6.0.0.rc2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: db366c88856e4dad00f83849b98fabd7c8d3b6ae2553c2474754f18e83e9d84d
|
|
4
|
+
data.tar.gz: c172d842c0c61fafc97ebb3b16c0acbdabb491b718167c7df5b8d4153e76b13c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4643290362b67f76703e8ca07aca53bb232c6bae786166e7719a865dd190d5b569a72a14704554ec4ba1af2b5921a82dd1cf4da0dbb7fe2882189925d726b5a5
|
|
7
|
+
data.tar.gz: a8034d92da6b90efe5088ef81148bdf6af04bb4486d7b7de06a64a679eb849b1fad12373b23a43e32fda30337093fa944ec7e16fdd84e31b70a324cd782e9a94
|
|
@@ -117,11 +117,16 @@ module SpreeEasyPost
|
|
|
117
117
|
|
|
118
118
|
# One shipment-create returns rates for every carrier and service, so all
|
|
119
119
|
# delivery methods sharing this provider within a request reuse it.
|
|
120
|
+
#
|
|
121
|
+
# Keyed by a digest of the exact payload sent: an order split into
|
|
122
|
+
# several packages from one stock location must quote each package's own
|
|
123
|
+
# parcel and customs contents, never the first package's cached rates.
|
|
124
|
+
# Anything that changes the request changes the key; identical requests
|
|
125
|
+
# still cost one API call.
|
|
120
126
|
def easypost_shipment(package)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
)
|
|
127
|
+
params = shipment_params(package)
|
|
128
|
+
cache_key = [:easypost_shipment, store.id, integration.id, Digest::SHA256.hexdigest(params.to_json)]
|
|
129
|
+
Spree::Current.provider_cache[cache_key] ||= integration.client.shipment.create(**params)
|
|
125
130
|
end
|
|
126
131
|
|
|
127
132
|
# Built by the shared helper so a label bought against this quote carries
|
|
@@ -166,10 +166,10 @@ module SpreeEasyPost
|
|
|
166
166
|
|
|
167
167
|
# Each of these is the merchant's to fix, so each says so rather than
|
|
168
168
|
# failing as "check the carrier connection".
|
|
169
|
-
raise Spree::Core::LabelPurchaseRefused,
|
|
169
|
+
raise Spree::Core::LabelPurchaseRefused, I18n.t('spree.easypost.errors.no_destination') if address.nil?
|
|
170
170
|
|
|
171
171
|
if selected&.carrier.blank? || selected.service_level.blank?
|
|
172
|
-
raise Spree::Core::LabelPurchaseRefused,
|
|
172
|
+
raise Spree::Core::LabelPurchaseRefused, I18n.t('spree.easypost.errors.rate_not_quoted')
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
shipment = integration.client.shipment.create(
|
|
@@ -185,7 +185,7 @@ module SpreeEasyPost
|
|
|
185
185
|
# worse than no label, so this refuses and names the service.
|
|
186
186
|
if rate.nil?
|
|
187
187
|
raise Spree::Core::LabelPurchaseRefused,
|
|
188
|
-
|
|
188
|
+
I18n.t('spree.easypost.errors.service_unavailable', service: "#{selected.carrier} #{selected.service_level}")
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
buy(integration, fulfillment.stock_location, fulfillment.store, shipment.id, rate.id)
|
|
@@ -234,7 +234,7 @@ module SpreeEasyPost
|
|
|
234
234
|
rescue EasyPost::Errors::EasyPostError => e
|
|
235
235
|
report(e, stock_location)
|
|
236
236
|
raise Spree::Core::LabelPurchaseRefused,
|
|
237
|
-
|
|
237
|
+
I18n.t('spree.easypost.errors.origin_address_refused',
|
|
238
238
|
location: location_name(stock_location), reason: carrier_reason(e))
|
|
239
239
|
end
|
|
240
240
|
|
|
@@ -22,12 +22,12 @@ module SpreeEasyPost
|
|
|
22
22
|
# signer takes legal responsibility for the declared contents, so it names
|
|
23
23
|
# a person at the merchant rather than the store.
|
|
24
24
|
preference :customs_signer, :string
|
|
25
|
-
preference :customs_contents_type, :string, default: 'merchandise',
|
|
25
|
+
preference :customs_contents_type, :string, default: 'merchandise', choices: CUSTOMS_CONTENTS_TYPES
|
|
26
26
|
# Who pays duties and taxes on arrival. Defaults to DAP — the recipient is
|
|
27
27
|
# billed by the carrier. DDP bills the merchant instead, so only choose it
|
|
28
28
|
# once duties are actually collected from the customer at checkout;
|
|
29
29
|
# otherwise the merchant absorbs them silently.
|
|
30
|
-
preference :incoterm, :string, default: 'DAP',
|
|
30
|
+
preference :incoterm, :string, default: 'DAP', choices: INCOTERMS
|
|
31
31
|
|
|
32
32
|
validates :preferred_incoterm, inclusion: { in: INCOTERMS }, allow_blank: true
|
|
33
33
|
validates :preferred_customs_contents_type, inclusion: { in: CUSTOMS_CONTENTS_TYPES }, allow_blank: true
|
|
@@ -67,6 +67,10 @@ module SpreeEasyPost
|
|
|
67
67
|
'https://www.easypost.com/wp-content/uploads/2026/03/EasyPost-Logo.svg'
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
def self.docs_url
|
|
71
|
+
'https://spreecommerce.org/docs/integrations/shipping/easypost'
|
|
72
|
+
end
|
|
73
|
+
|
|
70
74
|
# Fallback for hosts without the gem's translations; the localized
|
|
71
75
|
# description in config/locales wins.
|
|
72
76
|
def self.description
|
data/lib/spree_easypost.rb
CHANGED
|
@@ -176,7 +176,7 @@ module SpreeEasyPost
|
|
|
176
176
|
return unless origin&.country_code == 'US'
|
|
177
177
|
return unless items.all? { |item| item[:currency].to_s.upcase == 'USD' }
|
|
178
178
|
|
|
179
|
-
declared_value = items.sum { |item| item[:value].
|
|
179
|
+
declared_value = items.sum { |item| BigDecimal(item[:value].to_s) }
|
|
180
180
|
'NOEEI 30.37(a)' if declared_value < EEI_EXEMPTION_LIMIT_USD
|
|
181
181
|
end
|
|
182
182
|
|
|
@@ -195,7 +195,7 @@ module SpreeEasyPost
|
|
|
195
195
|
{
|
|
196
196
|
description: variant.customs_description_for_declaration,
|
|
197
197
|
quantity: item.quantity,
|
|
198
|
-
value: (item.price
|
|
198
|
+
value: Spree::Money::Rounding.to_currency(item.price * item.quantity, package.currency).to_f, # EasyPost reads customs values as JSON numbers
|
|
199
199
|
weight: ounces(item.weight, store),
|
|
200
200
|
origin_country: variant.country_of_origin.presence,
|
|
201
201
|
hs_tariff_number: variant.hs_code.presence,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_easypost
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.0.
|
|
4
|
+
version: 6.0.0.rc2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vendo Connect Inc.
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-10-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: easypost
|
|
@@ -31,14 +31,14 @@ dependencies:
|
|
|
31
31
|
requirements:
|
|
32
32
|
- - '='
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: 6.0.0.
|
|
34
|
+
version: 6.0.0.rc2
|
|
35
35
|
type: :runtime
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
39
|
- - '='
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: 6.0.0.
|
|
41
|
+
version: 6.0.0.rc2
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: vcr
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -75,9 +75,9 @@ licenses:
|
|
|
75
75
|
- MIT
|
|
76
76
|
metadata:
|
|
77
77
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
78
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.0.
|
|
78
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.0.rc2
|
|
79
79
|
documentation_uri: https://docs.spreecommerce.org/
|
|
80
|
-
source_code_uri: https://github.com/spree/spree/tree/v6.0.0.
|
|
80
|
+
source_code_uri: https://github.com/spree/spree/tree/v6.0.0.rc2
|
|
81
81
|
post_install_message:
|
|
82
82
|
rdoc_options: []
|
|
83
83
|
require_paths:
|