Skip to content

Commit

Permalink
Merge pull request #744 from karrioapi/karrio-2024.12rc10
Browse files Browse the repository at this point in the history
[rc] Karrio 2024.12rc10
  • Loading branch information
danh91 authored Dec 31, 2024
2 parents 00aef36 + 89db6a4 commit d51a1f5
Show file tree
Hide file tree
Showing 19 changed files with 454 additions and 251 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Karrio 2024.12.rc10

## Changes

### Fix

- fix: seko tracking event parsing

# Karrio 2024.12.rc9

## Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/api/karrio/server/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.12rc9
2024.12rc10
4 changes: 2 additions & 2 deletions apps/www/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ info:
## Versioning
When backwards-incompatible changes are made to the API, a new, dated version is released.
The current version is `2024.12rc9`.
The current version is `2024.12rc10`.
Read our API changelog to learn more about backwards compatibility.
Expand Down Expand Up @@ -84,7 +84,7 @@ info:
All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure).
API requests without authentication will also fail.
title: Karrio API
version: 2024.12rc9
version: 2024.12rc10
paths:
/:
get:
Expand Down
4 changes: 2 additions & 2 deletions bin/deploy-hobby
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

export KARRIO_TAG="${KARRIO_TAG:-2024.12rc9}"
export KARRIO_TAG="${KARRIO_TAG:-2024.12rc10}"
export SENTRY_DSN="${SENTRY_DSN:-'https://[email protected]/1'}"

SECRET_KEY=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
Expand All @@ -23,7 +23,7 @@ if ! [ -z "$1" ]
then
export KARRIO_TAG=$1
else
echo "What version of Karrio would you like to install? (We default to '2024.12rc9')"
echo "What version of Karrio would you like to install? (We default to '2024.12rc10')"
echo "You can check out available versions here: https://hub.docker.com/r/karrio/server/tags"
read -r KARRIO_TAG_READ
if [ -z "$KARRIO_TAG_READ" ]
Expand Down
2 changes: 1 addition & 1 deletion bin/upgrade-hobby
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ else
fi

[[ -f ".env" ]] && export $(cat .env | xargs) || ( echo "No .env file found. Please create it with SECRET_KEY and DOMAIN set." && exit 1)
export KARRIO_TAG="${KARRIO_TAG:-2024.12rc9}"
export KARRIO_TAG="${KARRIO_TAG:-2024.12rc10}"

# get karrio scripts
mkdir -p ./karrio
Expand Down
2 changes: 1 addition & 1 deletion docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ REDIS_PORT=6379
# API - Configuration for the Nginx Reverse proxy.
############

KARRIO_TAG=2024.12rc9
KARRIO_TAG=2024.12rc10
KARRIO_HTTP_PORT=5002

############
Expand Down
2 changes: 1 addition & 1 deletion ee/insiders
20 changes: 18 additions & 2 deletions modules/connectors/seko/karrio/providers/seko/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ def _extract_details(
settings: provider_utils.Settings,
) -> models.TrackingDetails:
details = lib.to_object(tracking.TrackingResponseElementType, data)
events = list(reversed(details.Events))
latest_status = lib.identity(
events[0].OmniCode if any(events) else getattr(details, "Status", None)
)
status = next(
(
status.name
for status in list(provider_units.TrackingStatus)
if getattr(details, "Status", None) in status.value
if latest_status in status.value
),
provider_units.TrackingStatus.in_transit.name,
)
Expand All @@ -61,10 +65,22 @@ def _extract_details(
),
location=event.Location,
)
for event in reversed(details.Events)
for event in events
],
delivered=status == "delivered",
status=status,
info=models.TrackingInfo(
carrier_tracking_link=details.Tracking,
expected_delivery=lib.fdate(
details.Delivered,
try_formats=["%Y-%m-%dT%H:%M:%S.%f", "%Y-%m-%dT%H:%M:%S"],
),
shipping_date=lib.fdate(
details.Picked,
try_formats=["%Y-%m-%dT%H:%M:%S.%f", "%Y-%m-%dT%H:%M:%S"],
),
),
meta=dict(reference=details.Reference1),
)


Expand Down
67 changes: 60 additions & 7 deletions modules/connectors/seko/karrio/providers/seko/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,63 @@ class CustomsOption(lib.Enum):


class TrackingStatus(lib.Enum):
on_hold = ["on_hold"]
delivered = ["delivered"]
in_transit = ["in_transit"]
delivery_failed = ["delivery_failed"]
delivery_delayed = ["delivery_delayed"]
out_for_delivery = ["out_for_delivery"]
ready_for_pickup = ["ready_for_pickup"]
on_hold = [
"OP-26", # Held by carrier
"OP-2", # Held at Export Hub
"OP-6", # Customs held for inspection and clearance
"OP-49", # Held by Delivery Courier
"OP-70", # Parcel Blocked
"OP-87", # Aged Parcel - High Value Unpaid
"OP-88", # Held at Export Hub - Additional Payment Required
]
delivered = [
"OP-71", # Delivered in part
"OP-72", # Delivered
"OP-73", # Delivered to neighbour
"OP-74", # Delivered - Authority to Leave / Safe Drop
"OP-75", # Delivered - Parcel Collected
"OP-76", # Delivered to locker/collection point
"OP-77", # Delivered to alternate delivery point
]
in_transit = [
"OP-18", # In transit
"OP-20", # Sub-contractor update
"OP-22", # Received by Sub-contractor
"OP-3", # Processed through Export Hub
"OP-4", # International transit to destination country
"OP-47", # Processed through Sorting Facility
"OP-50", # Parcel arrived to courier processing facility
"OP-51", # Parcel departed courier processing facility
"OP-78", # Flight Arrived
"OP-79", # InTransit
"OP-80", # Reshipped
"OP-81", # Flight Departed
]
delivery_failed = [
"OP-24", # Attempted Delivery - Receiver carded
"OP-27", # Attempted Delivery - Customer not known at address
"OP-28", # Attempted Delivery - Refused by customer
"OP-29", # Return to sender
"OP-30", # Non delivery
"OP-37", # Attempted Delivery - No access to receivers address
"OP-38", # Attempted Delivery - Customer Identification failed
"OP-45", # Attempted delivery
"OP-55", # Attempted Delivery - Returned to Sender
"OP-15", # Parcel lost
"OP-17", # Parcel Damaged
"OP-23", # Invalid / Insufficient Address
"OP-86", # Attempted delivery
]
delivery_delayed = [
"OP-16", # Parcel Delayed
"OP-13", # Misdirected
"OP-35", # Mis sorted by carrier
]
out_for_delivery = [
"OP-21", # Out for delivery
]
ready_for_pickup = [
"OP-19", # Awaiting Collection
"OP-25", # Customer to collect from carrier
"OP-42", # Awaiting collection
]
2 changes: 1 addition & 1 deletion modules/connectors/seko/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="karrio.seko",
version="2024.12rc9",
version="2024.12rc10",
description="Karrio - SEKO Logistics Shipping Extension",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
Loading

0 comments on commit d51a1f5

Please sign in to comment.