Skip to content

Commit

Permalink
Merge pull request #400 from nahall/main
Browse files Browse the repository at this point in the history
Add support for USPS Ground Advantage plus UPS SDK robustness
  • Loading branch information
danh91 authored Jul 15, 2023
2 parents 734b63d + cd853e1 commit cab11d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/extensions/ups/karrio/providers/ups/rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def rate_request(
else None
),
)
if any(options.pickup_options.state)
if options.pickup_options and options.pickup_options.state and any(options.pickup_options.state)
else None
),
DeliveryOptions=(
Expand All @@ -285,7 +285,7 @@ def rate_request(
else None
),
)
if any(options.delivery_options.state)
if options.delivery_options and options.delivery_options.state and any(options.delivery_options.state)
else None
),
RestrictedArticles=(
Expand Down
15 changes: 15 additions & 0 deletions sdk/extensions/usps/karrio/providers/usps/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ class ShipmentService(Enum):
usps_online = "Online"
usps_plus = "Plus"
usps_bpm = "BPM"
usps_ground_advantage = "Ground Advantage"
usps_ground_advantage_commercial = "Ground Advantage Commercial"
usps_ground_advantage_hfp = "Ground Advantage HFP"
usps_ground_advantage_hfp_commercial = "Ground Advantage HFP Commercial"
usps_ground_advantage_cubic = "Ground Advantage Cubic"


class ServiceClassID(Enum):
Expand Down Expand Up @@ -279,6 +284,14 @@ class ServiceClassID(Enum):
usps_bpm_flats_hold_for_pickup = "2020"
usps_parcel_select_ground_hold_for_pickup = "2071"
usps_bpm_parcels_hold_for_pickup = "2077"
usps_ground_advantage_cubic = "1096"
usps_ground_advantage_cubic_hold_for_pickup = "2096"
usps_ground_advantage_cubic_hazmat = "4096"
usps_ground_advantage_cubic_parcel_locker = "6096"
usps_ground_advantage = "1058"
usps_ground_advantage_hold_for_pickup = "2058"
usps_ground_advantage_hazmat = "4058"
usps_ground_advantage_parcel_locker = "6058"


class ServiceType(Enum):
Expand All @@ -290,6 +303,8 @@ class ServiceType(Enum):
usps_priority_mail_express = "PRIORITY EXPRESS"
usps_priority_mail_cubic = "PRIORITY MAIL CUBIC"
usps_parcel_select_ground = "PARCEL SELECT GROUND"
usps_ground_advantage = "GROUND ADVANTAGE"
usps_ground_advantage_cubic = "GROUND ADVANTAGE CUBIC"

""" ShipmentService type correspondence """
usps_first_class_mail_large_envelope = usps_first_class
Expand Down

0 comments on commit cab11d9

Please sign in to comment.