karrio-eshipper 2025.5.7__py3-none-any.whl → 2026.1.1__py3-none-any.whl
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.
- karrio/providers/eshipper/rate.py +14 -1
- karrio/providers/eshipper/shipment/create.py +16 -0
- karrio/providers/eshipper/units.py +55 -15
- {karrio_eshipper-2025.5.7.dist-info → karrio_eshipper-2026.1.1.dist-info}/METADATA +1 -1
- {karrio_eshipper-2025.5.7.dist-info → karrio_eshipper-2026.1.1.dist-info}/RECORD +8 -8
- {karrio_eshipper-2025.5.7.dist-info → karrio_eshipper-2026.1.1.dist-info}/WHEEL +0 -0
- {karrio_eshipper-2025.5.7.dist-info → karrio_eshipper-2026.1.1.dist-info}/entry_points.txt +0 -0
- {karrio_eshipper-2025.5.7.dist-info → karrio_eshipper-2026.1.1.dist-info}/top_level.txt +0 -0
|
@@ -30,18 +30,21 @@ def _extract_details(
|
|
|
30
30
|
rate.serviceName,
|
|
31
31
|
service_id=rate.serviceId,
|
|
32
32
|
test_mode=settings.test_mode,
|
|
33
|
+
carrier_name=rate.carrierName,
|
|
33
34
|
)
|
|
34
35
|
carrier_id = provider_units.ShippingService.carrier_id(
|
|
35
36
|
rate.carrierName,
|
|
36
37
|
test_mode=settings.test_mode,
|
|
37
38
|
service_search=service.name_or_key,
|
|
38
39
|
service_id=rate.serviceId,
|
|
40
|
+
carrier_name=rate.carrierName,
|
|
39
41
|
)
|
|
40
42
|
rate_provider = provider_units.RateProvider.find(
|
|
41
43
|
rate.carrierName,
|
|
42
44
|
test_mode=settings.test_mode,
|
|
43
45
|
service_search=service.name_or_key,
|
|
44
46
|
service_id=rate.serviceId,
|
|
47
|
+
carrier_name=rate.carrierName,
|
|
45
48
|
)
|
|
46
49
|
|
|
47
50
|
charges = [
|
|
@@ -93,6 +96,16 @@ def rate_request(
|
|
|
93
96
|
package_options=packages.options,
|
|
94
97
|
)
|
|
95
98
|
services = lib.to_services(payload.services, provider_units.ShippingService)
|
|
99
|
+
customs = lib.to_customs_info(
|
|
100
|
+
payload.customs,
|
|
101
|
+
shipper=payload.shipper,
|
|
102
|
+
recipient=payload.recipient,
|
|
103
|
+
weight_unit=packages.weight_unit,
|
|
104
|
+
)
|
|
105
|
+
declared_value = (
|
|
106
|
+
lib.to_money(customs.duty.declared_value if customs.duty else None)
|
|
107
|
+
or options.declared_value.state
|
|
108
|
+
)
|
|
96
109
|
|
|
97
110
|
service_id = lib.identity(
|
|
98
111
|
options.eshipper_service_id.state
|
|
@@ -158,7 +171,7 @@ def rate_request(
|
|
|
158
171
|
type=provider_units.PackagingType.map(package.packaging_type).value,
|
|
159
172
|
freightClass=None,
|
|
160
173
|
nmfcCode=None,
|
|
161
|
-
insuranceAmount=
|
|
174
|
+
insuranceAmount=declared_value,
|
|
162
175
|
codAmount=None,
|
|
163
176
|
description=package.description,
|
|
164
177
|
harmonizedCode=None,
|
|
@@ -34,10 +34,12 @@ def _extract_details(
|
|
|
34
34
|
service = provider_units.ShippingService.find(
|
|
35
35
|
shipment.carrier.serviceName,
|
|
36
36
|
test_mode=settings.test_mode,
|
|
37
|
+
carrier_name=shipment.carrier.carrierName,
|
|
37
38
|
)
|
|
38
39
|
rate_provider = provider_units.RateProvider.find(
|
|
39
40
|
shipment.carrier.carrierName,
|
|
40
41
|
test_mode=settings.test_mode,
|
|
42
|
+
carrier_name=shipment.carrier.carrierName,
|
|
41
43
|
)
|
|
42
44
|
|
|
43
45
|
return models.ShipmentDetails(
|
|
@@ -89,11 +91,24 @@ def shipment_request(
|
|
|
89
91
|
initializer=provider_units.shipping_options_initializer,
|
|
90
92
|
)
|
|
91
93
|
service = provider_units.ShippingService.map(payload.service)
|
|
94
|
+
|
|
95
|
+
# Extract carrier from service code if available
|
|
96
|
+
carrier_name_from_service = None
|
|
97
|
+
if "_" in service.name_or_key:
|
|
98
|
+
parts = service.name_or_key.split("_")
|
|
99
|
+
# Carrier is always at index 1 after "eshipper" prefix
|
|
100
|
+
if len(parts) >= 2 and parts[0] == "eshipper":
|
|
101
|
+
potential_carrier = parts[1] # e.g., "canadapost" from "eshipper_canadapost_expedited"
|
|
102
|
+
# Validate it's a known carrier
|
|
103
|
+
if provider_units.RateProvider.map(potential_carrier).name:
|
|
104
|
+
carrier_name_from_service = potential_carrier
|
|
105
|
+
|
|
92
106
|
service_id = lib.identity(
|
|
93
107
|
options.eshipper_service_id.state
|
|
94
108
|
or provider_units.ShippingService.service_id(
|
|
95
109
|
service.name_or_key,
|
|
96
110
|
test_mode=settings.test_mode,
|
|
111
|
+
carrier_name=carrier_name_from_service,
|
|
97
112
|
)
|
|
98
113
|
)
|
|
99
114
|
carrier_id = lib.identity(
|
|
@@ -103,6 +118,7 @@ def shipment_request(
|
|
|
103
118
|
service_id=service_id,
|
|
104
119
|
test_mode=settings.test_mode,
|
|
105
120
|
service_search=service.name_or_key,
|
|
121
|
+
carrier_name=carrier_name_from_service,
|
|
106
122
|
)
|
|
107
123
|
)
|
|
108
124
|
|
|
@@ -140,7 +140,12 @@ def to_service_code(service: typing.Dict[str, str]) -> str:
|
|
|
140
140
|
return output
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
def get_service(
|
|
143
|
+
def get_service(
|
|
144
|
+
search: str,
|
|
145
|
+
test_mode: bool = False,
|
|
146
|
+
service_id: str = None,
|
|
147
|
+
carrier_name: str = None,
|
|
148
|
+
):
|
|
144
149
|
prod_metadata = METADATA_JSON["PROD_SERVICES"]
|
|
145
150
|
test_metadata = METADATA_JSON["DEV_SERVICES"]
|
|
146
151
|
metadata = lib.identity(
|
|
@@ -152,27 +157,53 @@ def get_service(search: str, test_mode: bool = False, service_id: str = None):
|
|
|
152
157
|
service
|
|
153
158
|
for service in metadata
|
|
154
159
|
if to_service_code(service) == search
|
|
155
|
-
or service.get("name") == search
|
|
156
160
|
or str(service.get("id")) == search
|
|
157
161
|
or (service_id and service_id == str(service.get("id")))
|
|
162
|
+
or (
|
|
163
|
+
service.get("name") == search
|
|
164
|
+
and (
|
|
165
|
+
not carrier_name
|
|
166
|
+
or service.get("carrierDTO", {}).get("name") == carrier_name
|
|
167
|
+
)
|
|
168
|
+
)
|
|
158
169
|
),
|
|
159
170
|
{},
|
|
160
171
|
)
|
|
161
172
|
|
|
162
173
|
|
|
163
|
-
def get_service_id(
|
|
174
|
+
def get_service_id(
|
|
175
|
+
search: str,
|
|
176
|
+
test_mode: bool = False,
|
|
177
|
+
service_id: str = None,
|
|
178
|
+
carrier_name: str = None,
|
|
179
|
+
):
|
|
164
180
|
return (
|
|
165
|
-
get_service(
|
|
181
|
+
get_service(
|
|
182
|
+
search,
|
|
183
|
+
test_mode=test_mode,
|
|
184
|
+
service_id=service_id,
|
|
185
|
+
carrier_name=carrier_name,
|
|
186
|
+
).get("id")
|
|
166
187
|
or service_id
|
|
167
188
|
)
|
|
168
189
|
|
|
169
190
|
|
|
170
|
-
def find_service(
|
|
191
|
+
def find_service(
|
|
192
|
+
search: str,
|
|
193
|
+
test_mode: bool = False,
|
|
194
|
+
service_id: str = None,
|
|
195
|
+
carrier_name: str = None,
|
|
196
|
+
):
|
|
171
197
|
|
|
172
198
|
if ShippingService.map(search).name:
|
|
173
199
|
return ShippingService.map(search)
|
|
174
200
|
|
|
175
|
-
service = get_service(
|
|
201
|
+
service = get_service(
|
|
202
|
+
search,
|
|
203
|
+
test_mode=test_mode,
|
|
204
|
+
service_id=service_id,
|
|
205
|
+
carrier_name=carrier_name,
|
|
206
|
+
)
|
|
176
207
|
|
|
177
208
|
if service:
|
|
178
209
|
return ShippingService.map(to_service_code(service))
|
|
@@ -185,10 +216,16 @@ def get_carrier(
|
|
|
185
216
|
test_mode: bool = False,
|
|
186
217
|
service_search: str = None,
|
|
187
218
|
service_id: str = None,
|
|
219
|
+
carrier_name: str = None,
|
|
188
220
|
):
|
|
189
221
|
id_key = "test_id" if test_mode else "prod_id"
|
|
190
222
|
alternate_key = "prod_id" if not test_mode else "test_id"
|
|
191
|
-
service = get_service(
|
|
223
|
+
service = get_service(
|
|
224
|
+
service_search,
|
|
225
|
+
test_mode=test_mode,
|
|
226
|
+
service_id=service_id,
|
|
227
|
+
carrier_name=carrier_name or search,
|
|
228
|
+
)
|
|
192
229
|
|
|
193
230
|
return service.get("carrierDTO") or next(
|
|
194
231
|
(
|
|
@@ -212,12 +249,14 @@ def get_carrier_id(
|
|
|
212
249
|
test_mode: bool = False,
|
|
213
250
|
service_search: str = None,
|
|
214
251
|
service_id: str = None,
|
|
252
|
+
carrier_name: str = None,
|
|
215
253
|
):
|
|
216
254
|
return get_carrier(
|
|
217
255
|
search,
|
|
218
256
|
test_mode=test_mode,
|
|
219
257
|
service_search=service_search,
|
|
220
258
|
service_id=service_id,
|
|
259
|
+
carrier_name=carrier_name,
|
|
221
260
|
).get("id")
|
|
222
261
|
|
|
223
262
|
|
|
@@ -226,6 +265,7 @@ def find_rate_provider(
|
|
|
226
265
|
test_mode: bool = False,
|
|
227
266
|
service_search: str = None,
|
|
228
267
|
service_id: str = None,
|
|
268
|
+
carrier_name: str = None,
|
|
229
269
|
):
|
|
230
270
|
|
|
231
271
|
if RateProvider.map(lib.to_snake_case(search)).name:
|
|
@@ -236,6 +276,7 @@ def find_rate_provider(
|
|
|
236
276
|
test_mode=test_mode,
|
|
237
277
|
service_search=service_search,
|
|
238
278
|
service_id=service_id,
|
|
279
|
+
carrier_name=carrier_name,
|
|
239
280
|
)
|
|
240
281
|
|
|
241
282
|
if carrier and RateProvider.map(to_carrier_code(carrier)).name:
|
|
@@ -281,7 +322,7 @@ ESHIPPER_CARRIER_METADATA = {
|
|
|
281
322
|
}
|
|
282
323
|
|
|
283
324
|
ESHIPPER_SERVICE_METADATA = {
|
|
284
|
-
|
|
325
|
+
to_service_code(service): {
|
|
285
326
|
**service,
|
|
286
327
|
"ids": list(
|
|
287
328
|
set(
|
|
@@ -289,8 +330,7 @@ ESHIPPER_SERVICE_METADATA = {
|
|
|
289
330
|
s["id"]
|
|
290
331
|
for s in METADATA_JSON["PROD_SERVICES"]
|
|
291
332
|
+ METADATA_JSON["DEV_SERVICES"]
|
|
292
|
-
if
|
|
293
|
-
== lib.to_snake_case(service["name"])
|
|
333
|
+
if to_service_code(s) == to_service_code(service)
|
|
294
334
|
]
|
|
295
335
|
)
|
|
296
336
|
),
|
|
@@ -298,7 +338,7 @@ ESHIPPER_SERVICE_METADATA = {
|
|
|
298
338
|
(
|
|
299
339
|
s["id"]
|
|
300
340
|
for s in METADATA_JSON["PROD_SERVICES"]
|
|
301
|
-
if s
|
|
341
|
+
if to_service_code(s) == to_service_code(service)
|
|
302
342
|
),
|
|
303
343
|
None,
|
|
304
344
|
),
|
|
@@ -306,15 +346,15 @@ ESHIPPER_SERVICE_METADATA = {
|
|
|
306
346
|
(
|
|
307
347
|
s["id"]
|
|
308
348
|
for s in METADATA_JSON["DEV_SERVICES"]
|
|
309
|
-
if s
|
|
349
|
+
if to_service_code(s) == to_service_code(service)
|
|
310
350
|
),
|
|
311
351
|
None,
|
|
312
352
|
),
|
|
313
353
|
"carrier": lib.to_snake_case(service["carrierDTO"]["name"]),
|
|
314
354
|
}
|
|
315
355
|
for service in {
|
|
316
|
-
s
|
|
317
|
-
for s in METADATA_JSON["
|
|
356
|
+
to_service_code(s): s
|
|
357
|
+
for s in METADATA_JSON["DEV_SERVICES"] + METADATA_JSON["PROD_SERVICES"]
|
|
318
358
|
}.values()
|
|
319
359
|
}
|
|
320
360
|
|
|
@@ -322,7 +362,7 @@ ESHIPPER_SERVICE_METADATA = {
|
|
|
322
362
|
ShippingService = lib.StrEnum(
|
|
323
363
|
"ShippingService",
|
|
324
364
|
{
|
|
325
|
-
to_service_code(service): service
|
|
365
|
+
to_service_code(service): to_service_code(service)
|
|
326
366
|
for service in ESHIPPER_SERVICE_METADATA.values()
|
|
327
367
|
},
|
|
328
368
|
)
|
|
@@ -6,13 +6,13 @@ karrio/plugins/eshipper/__init__.py,sha256=v5cNriCwL5R2QR5x6Iki23CcBGPmGmH8zEL5j
|
|
|
6
6
|
karrio/providers/eshipper/__init__.py,sha256=Y9vKPYScbmFvM17L-x52m_yLLiG6WsX9j6o4NIERBMU,400
|
|
7
7
|
karrio/providers/eshipper/error.py,sha256=uroZ2dW7OHEIrhi3HKnsd8EntmXaLpZisSDyJ2HLKOY,2038
|
|
8
8
|
karrio/providers/eshipper/metadata.json,sha256=KBae69ntmCIkZ0dKrAX0vjkm1CyE9UwvIstt7mLrq4M,369526
|
|
9
|
-
karrio/providers/eshipper/rate.py,sha256=
|
|
9
|
+
karrio/providers/eshipper/rate.py,sha256=P7QI-HXqiM2ShUjYA1CGcQ6swduBGpkT9yUmm7KcOFo,7634
|
|
10
10
|
karrio/providers/eshipper/tracking.py,sha256=wIYItHY_aQ1Cnth6c9Wqdjfr4fn9fALTBiWSB-FhjLs,3137
|
|
11
|
-
karrio/providers/eshipper/units.py,sha256=
|
|
11
|
+
karrio/providers/eshipper/units.py,sha256=rY8zN9DewnwcyFGcI_zsxdtq40MyIc9vBGM-mRSIzac,10563
|
|
12
12
|
karrio/providers/eshipper/utils.py,sha256=LOHTEHMgoLpYIPMuCRxcyGwVp3UsMC7DZ3h36YtXwvQ,403
|
|
13
13
|
karrio/providers/eshipper/shipment/__init__.py,sha256=oPCX3bykNDVeczan1tbmSpuOtFYTtd6h8J9otYVDQqQ,233
|
|
14
14
|
karrio/providers/eshipper/shipment/cancel.py,sha256=vdxMmK7AmI-xOn62NlaMzCCKQ8CBql8QBVPft0VQWn0,1317
|
|
15
|
-
karrio/providers/eshipper/shipment/create.py,sha256=
|
|
15
|
+
karrio/providers/eshipper/shipment/create.py,sha256=4Y_t011XNIaFXqEsuEahAp2kQviCVMYUgfI2ccn9BmM,12408
|
|
16
16
|
karrio/schemas/eshipper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
karrio/schemas/eshipper/cancel_request.py,sha256=mGMmVxCEwUhWyw-XkK4wsHZ4OQ34e6Dnc0JxBU1CixQ,334
|
|
18
18
|
karrio/schemas/eshipper/cancel_response.py,sha256=yLJe8qk71gy6GVGZ07ylBIomYFLUChZx9GDyJ3XzEsA,346
|
|
@@ -26,8 +26,8 @@ karrio/schemas/eshipper/shipping_request.py,sha256=OrqSutwyzTj-iau3LDPJUEGBRzzV9
|
|
|
26
26
|
karrio/schemas/eshipper/shipping_response.py,sha256=RdMXh9goyTrH2qdU_5KMDIAWAEDzMchy_e5f45k-zxs,3892
|
|
27
27
|
karrio/schemas/eshipper/tracking_request.py,sha256=EAE7PJFp2rTYCXMQJ6Kg-hMs3vL-GSTFjhHvzSmMzPg,252
|
|
28
28
|
karrio/schemas/eshipper/tracking_response.py,sha256=2m9doy3y5f6zdA-gbNfsw8rp0oqs3eYrgw8Por_1fjE,2219
|
|
29
|
-
karrio_eshipper-
|
|
30
|
-
karrio_eshipper-
|
|
31
|
-
karrio_eshipper-
|
|
32
|
-
karrio_eshipper-
|
|
33
|
-
karrio_eshipper-
|
|
29
|
+
karrio_eshipper-2026.1.1.dist-info/METADATA,sha256=4SEIi_s9-esC8BnnwY5JSfJJHXqaKi7SqcaiilQnWgo,997
|
|
30
|
+
karrio_eshipper-2026.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
31
|
+
karrio_eshipper-2026.1.1.dist-info/entry_points.txt,sha256=u9RQVmPE2uC3-aL85DnlIHdsHAWYkOnwTAfJvi2--DY,61
|
|
32
|
+
karrio_eshipper-2026.1.1.dist-info/top_level.txt,sha256=FZCY8Nwft8oEGHdl--xku8P3TrnOxu5dETEU_fWpRSM,20
|
|
33
|
+
karrio_eshipper-2026.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|