Skip to content

Commit

Permalink
Fix: set shipping date to current if it is in the past
Browse files Browse the repository at this point in the history
Ensures that shipping date isn't set to a past date, correcting to the current date if necessary. Eshipper Skip Carrier was complaining that date is before now, because they don't like when its pest time
  • Loading branch information
jacobshilitz committed Aug 22, 2024
1 parent f558a00 commit 330a6b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/connectors/eshipper/karrio/providers/eshipper/rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def rate_request(
)
shipping_date = lib.to_date(options.shipment_date.state or datetime.datetime.now())

if shipping_date < datetime.datetime.now():
shipping_date = datetime.datetime.now()

request = eshipper.RateRequestType(
scheduledShipDate=lib.fdatetime(shipping_date, output_format="%Y-%m-%d %H:%M"),
raterequestfrom=eshipper.FromType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def shipment_request(
)
shipping_date = lib.to_date(options.shipment_date.state or datetime.datetime.now())

if shipping_date < datetime.datetime.now():
shipping_date = datetime.datetime.now()

request = eshipper.ShippingRequestType(
scheduledShipDate=lib.fdatetime(shipping_date, output_format="%Y-%m-%d %H:%M"),
shippingrequestfrom=eshipper.FromType(
Expand Down

0 comments on commit 330a6b9

Please sign in to comment.