Skip to content

Commit

Permalink
fix: Invalid eshipper packaging Unit
Browse files Browse the repository at this point in the history
  • Loading branch information
danh91 committed Aug 12, 2024
1 parent d7071c1 commit c1ae6cb
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def rate_request(
confirmDelivery=None,
notifyRecipient=None,
),
packagingUnit="Imperial",
packagingUnit="Metric",
packages=eshipper.PackagesType(
type="Package",
packages=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def shipment_request(
confirmDelivery=None,
notifyRecipient=None,
),
packagingUnit="Imperial",
packagingUnit="Metric",
packages=eshipper.PackagesType(
type="Package",
quantity=len(packages),
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/eshipper/tests/eshipper/test_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def test_parse_rate_response(self):
"country": "CA",
},
"scheduledShipDate": "2024-07-16 00:00",
"packagingUnit": "Imperial",
"packagingUnit": "Metric",
"packages": {
"type": "Package",
"packages": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_parse_cancel_shipment_response(self):
"type": "Package",
"weightUnit": "KG",
},
"packagingUnit": "Imperial",
"packagingUnit": "Metric",
"scheduledShipDate": "2024-07-16 00:00",
"serviceId": "5000184",
"from": {
Expand Down
4 changes: 3 additions & 1 deletion modules/connectors/usps/karrio/providers/usps/rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def rate_request(
package.options.shipment_date.state or time.strftime("%Y-%m-%d")
),
accountType=settings.account_type or "EPS",
accountNumber=settings.account_number,
accountNumber=lib.identity(
settings.account_number or settings.connection_config.mailer_id.state
),
itemValue=lib.identity(
package.items.value_amount if len(package.items) > 0 else None
),
Expand Down
2 changes: 2 additions & 0 deletions modules/connectors/usps/karrio/providers/usps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,7 @@ def login(settings: Settings, client_id: str = None, client_secret: str = None):


class ConnectionConfig(lib.Enum):
mailer_id = lib.OptionEnum("mailer_id")
customer_registration_id = lib.OptionEnum("customer_registration_id")
shipping_options = lib.OptionEnum("shipping_options", list)
shipping_services = lib.OptionEnum("shipping_services", list)
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def rate_request(
package.options.shipment_date.state or time.strftime("%Y-%m-%d")
),
accountType=settings.account_type or "EPS",
accountNumber=settings.account_number,
accountNumber=lib.identity(
settings.account_number or settings.connection_config.mailer_id.state
),
itemValue=package.items.value_amount,
extraServices=[
lib.to_int(_.code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,7 @@ def login(settings: Settings, client_id: str = None, client_secret: str = None):


class ConnectionConfig(lib.Enum):
mailer_id = lib.OptionEnum("mailer_id")
customer_registration_id = lib.OptionEnum("customer_registration_id")
shipping_options = lib.OptionEnum("shipping_options", list)
shipping_services = lib.OptionEnum("shipping_services", list)

0 comments on commit c1ae6cb

Please sign in to comment.