Skip to content

Commit

Permalink
Merge pull request #655 from karrioapi/patch-2024.6-rc31
Browse files Browse the repository at this point in the history
[patch] 2024.6 rc31
  • Loading branch information
danh91 authored Aug 23, 2024
2 parents ac76dfb + b160713 commit 353cbe0
Show file tree
Hide file tree
Showing 24 changed files with 1,488 additions and 225 deletions.
109 changes: 31 additions & 78 deletions apps/api/karrio/server/static/karrio/js/karrio.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/api/karrio/server/static/karrio/js/karrio.js.map

Large diffs are not rendered by default.

86 changes: 85 additions & 1 deletion apps/www/docs/reference/api/rates.api.mdx

Large diffs are not rendered by default.

27 changes: 24 additions & 3 deletions apps/www/docs/reference/api/update-shipment.api.mdx

Large diffs are not rendered by default.

45 changes: 40 additions & 5 deletions apps/www/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9525,6 +9525,29 @@ components:
description: "The list of configured carriers you wish to get rates from.<br/>\n\
\ **Note that the request will be sent to all carriers in nothing\
\ is specified**\n "
options:
type: object
additionalProperties: {}
default: {}
description: "<details>\n <summary>The options available for the\
\ shipment.</summary>\n\n {\n \"currency\": \"USD\"\
,\n \"insurance\": 100.00,\n \"cash_on_delivery\"\
: 30.00,\n \"dangerous_good\": true,\n \"declared_value\"\
: 150.00,\n \"sms_notification\": true,\n \"email_notification\"\
: true,\n \"email_notification_to\": \"[email protected]\",\n\
\ \"hold_at_location\": true,\n \"paperless_trade\"\
: true,\n \"preferred_service\": \"fedex_express_saver\",\n\
\ \"shipment_date\": \"2020-01-01\",\n \"shipment_note\"\
: \"This is a shipment note\",\n \"signature_confirmation\"\
: true,\n \"saturday_delivery\": true,\n \"is_return\"\
: true,\n \"doc_files\": [\n {\n \
\ \"doc_type\": \"commercial_invoice\",\n \"\
doc_file\": \"base64 encoded file\",\n \"doc_name\"\
: \"commercial_invoice.pdf\",\n \"doc_format\": \"\
pdf\",\n }\n ],\n \"doc_references\"\
: [\n {\n \"doc_id\": \"123456789\"\
,\n \"doc_type\": \"commercial_invoice\",\n \
\ }\n ],\n }\n </details>\n "
reference:
type: string
nullable: true
Expand Down Expand Up @@ -9552,14 +9575,26 @@ components:
options:
type: object
additionalProperties: {}
default: {}
description: "<details>\n <summary>The options available for the\
\ shipment.</summary>\n\n {\n \"currency\": \"USD\"\
,\n \"insurance\": 100.00,\n \"cash_on_delivery\"\
: 30.00,\n \"shipment_date\": \"2020-01-01\",\n \
\ \"dangerous_good\": true,\n \"declared_value\": 150.00,\n\
\ \"email_notification\": true,\n \"email_notification_to\"\
: \"[email protected]\",\n \"signature_confirmation\": true,\n\
\ }\n </details>\n "
: 30.00,\n \"dangerous_good\": true,\n \"declared_value\"\
: 150.00,\n \"sms_notification\": true,\n \"email_notification\"\
: true,\n \"email_notification_to\": \"[email protected]\",\n\
\ \"hold_at_location\": true,\n \"paperless_trade\"\
: true,\n \"preferred_service\": \"fedex_express_saver\",\n\
\ \"shipment_date\": \"2020-01-01\",\n \"shipment_note\"\
: \"This is a shipment note\",\n \"signature_confirmation\"\
: true,\n \"saturday_delivery\": true,\n \"is_return\"\
: true,\n \"doc_files\": [\n {\n \
\ \"doc_type\": \"commercial_invoice\",\n \"\
doc_file\": \"base64 encoded file\",\n \"doc_name\"\
: \"commercial_invoice.pdf\",\n \"doc_format\": \"\
pdf\",\n }\n ],\n \"doc_references\"\
: [\n {\n \"doc_id\": \"123456789\"\
,\n \"doc_type\": \"commercial_invoice\",\n \
\ }\n ],\n }\n </details>\n "
reference:
type: string
nullable: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def shipment_request(
)
else None
),
groupPackageCount=package_index,
groupPackageCount=1,
itemDescriptionForClearance=None,
contentRecord=[],
itemDescription=package.parcel.description,
Expand All @@ -673,7 +673,7 @@ def shipment_request(
),
trackingNumber=None,
)
for package_index, package in enumerate(packages, start=1)
for package in packages
],
),
labelResponseOptions="LABEL",
Expand Down
13 changes: 7 additions & 6 deletions modules/connectors/fedex/karrio/providers/fedex/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import karrio.providers.fedex.utils as provider_utils
import karrio.providers.fedex.units as provider_units

DATETIME_FORMATS = ["%Y-%m-%dT%H:%M:%S%z", "%Y-%m-%dT%H:%M:%S"]


def parse_tracking_response(
_response: lib.Deserializable[dict],
Expand Down Expand Up @@ -45,7 +47,8 @@ def _extract_details(
detail = max(
package.trackResults,
key=lambda item: max(
lib.to_date(event.date, "%Y-%m-%dT%H:%M:%S%z") for event in item.scanEvents
lib.to_date(event.date, try_formats=DATETIME_FORMATS).replace(tzinfo=None)
for event in item.scanEvents
),
default=None,
)
Expand Down Expand Up @@ -78,8 +81,8 @@ def _extract_details(
tracking_number=package.trackingNumber,
events=[
models.TrackingEvent(
date=lib.fdate(e.date, "%Y-%m-%dT%H:%M:%S%z"),
time=lib.flocaltime(e.date, "%Y-%m-%dT%H:%M:%S%z"),
date=lib.fdate(e.date, try_formats=DATETIME_FORMATS),
time=lib.flocaltime(e.date, try_formats=DATETIME_FORMATS),
code=e.eventType,
location=lib.identity(
lib.join(
Expand Down Expand Up @@ -118,9 +121,7 @@ def _extract_details(
shipment_origin_country=lib.failsafe(
lambda: detail.originLocation.locationContactAndAddress.address.countryCode
),
signed_by=lib.failsafe(
lambda: detail.deliveryDetails.signedByName
),
signed_by=lib.failsafe(lambda: detail.deliveryDetails.signedByName),
),
images=lib.identity(models.Images(signature_image=img) if img else None),
estimated_delivery=lib.fdate(estimated_delivery, "%Y-%m-%dT%H:%M:%S"),
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/fedex/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="karrio.fedex",
version="2024.6-rc9",
version="2024.6-rc31",
description="Karrio - FedEx Shipping Extension",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/fedex/tests/fedex/test_shipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def test_parse_cancel_shipment_response(self):
"units": "IN",
"width": 11.0,
},
"groupPackageCount": 2,
"groupPackageCount": 1,
"packageSpecialServices": {
"signatureOptionType": "SERVICE_DEFAULT",
"specialServiceTypes": ["SIGNATURE_OPTION"],
Expand Down
Loading

0 comments on commit 353cbe0

Please sign in to comment.