Skip to content

Commit

Permalink
Merge pull request #547 from karrioapi/patch-2024.2.7
Browse files Browse the repository at this point in the history
[patch] 2024.2.7
  • Loading branch information
danh91 authored Mar 27, 2024
2 parents 9a6290a + 160da59 commit 4b9c65c
Show file tree
Hide file tree
Showing 24 changed files with 350 additions and 318 deletions.
2 changes: 1 addition & 1 deletion apps/api/karrio/server/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.2.6
2024.2.7
6 changes: 4 additions & 2 deletions apps/dashboard/src/modules/Orders/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ export default function OrdersPage(pageProps: any) {
<>

<header className="px-0 pb-0 pt-4 is-flex is-justify-content-space-between">
<span className="title is-4">Orders</span>
<div>
<div className="column">
<span className="title is-4">Orders</span>
</div>
<div className="column has-text-right">
<AppLink href="/draft_orders/new" className="button is-primary is-small mx-1">
<span>Create order</span>
</AppLink>
Expand Down
8 changes: 5 additions & 3 deletions apps/dashboard/src/modules/Shipments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ export default function ShipmentsPage(pageProps: any) {
return (
<>

<header className="px-0 pb-0 pt-4 is-flex is-justify-content-space-between">
<span className="title is-4">Shipments</span>
<div>
<header className="columns px-0 pb-0 pt-4">
<div className="column">
<span className="title is-4">Shipments</span>
</div>
<div className="column has-text-right">
<AppLink href="/create_label?shipment_id=new" className="button is-primary is-small mx-1">
<span>Create Label</span>
</AppLink>
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.2.6}"
export KARRIO_TAG="${KARRIO_TAG:-2024.2.7}"
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.2.6')"
echo "What version of Karrio would you like to install? (We default to '2024.2.7')"
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
29 changes: 16 additions & 13 deletions bin/generate-openapi-types
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/usr/bin/env bash

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i "/local/schemas/openapi.yml" \
-g typescript-axios \
-o /local/packages/types/rest \
--additional-properties=typescriptThreePlus=true \
--additional-properties=modelPropertyNaming=snake_case \
--additional-properties=useSingleRequestParameter=true

rm -rf packages/types/rest/.openapi-generator/ \
packages/types/rest/.openapi-generator-ignore \
packages/types/rest/.gitignore \
packages/types/rest/.npmignore \
packages/types/rest/git_push.sh
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli bash -c '
./usr/local/bin/docker-entrypoint.sh generate \
-i "/local/schemas/openapi.yml" \
-g typescript-axios \
-o /local/packages/types/rest \
--additional-properties=typescriptThreePlus=true \
--additional-properties=modelPropertyNaming=snake_case \
--additional-properties=useSingleRequestParameter=true && \
rm -rf /local/packages/types/rest/.openapi-generator/ \
/local/packages/types/rest/.openapi-generator-ignore \
/local/packages/types/rest/.gitignore \
/local/packages/types/rest/.npmignore \
/local/packages/types/rest/git_push.sh && \
sed -i -e 's/RawAxiosRequestConfig/AxiosRequestConfig/g' \
/local/packages/types/rest/api.ts
'
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.2.6}"
export KARRIO_TAG="${KARRIO_TAG:-2024.2.7}"

# get karrio scripts
mkdir -p ./karrio
Expand Down
6 changes: 3 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:
api:
container_name: karrio.api
image: karrio.docker.scarf.sh/karrio/server:2024.2.6
image: karrio.docker.scarf.sh/karrio/server:2024.2.7
restart: unless-stopped
ports:
- ${KARRIO_HTTP_PORT}:${KARRIO_HTTP_PORT}
Expand All @@ -25,7 +25,7 @@ services:

worker:
container_name: karrio.worker
image: karrio.docker.scarf.sh/karrio/server:2024.2.6
image: karrio.docker.scarf.sh/karrio/server:2024.2.7
restart: unless-stopped
depends_on:
- db
Expand All @@ -46,7 +46,7 @@ services:

dashboard:
container_name: karrio.dashboard
image: karrio.docker.scarf.sh/karrio/dashboard:2024.2.6
image: karrio.docker.scarf.sh/karrio/dashboard:2024.2.7
restart: unless-stopped
ports:
- ${DASHBOARD_PORT}:3000/tcp
Expand Down
22 changes: 14 additions & 8 deletions modules/connectors/fedex/karrio/providers/fedex/rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ def rate_request(
package_options=packages.options,
initializer=provider_units.shipping_options_initializer,
)
request_types = ["LIST"] + ([] if "currency" not in options else ["PREFERRED"])

request_types = lib.identity(
settings.connection_config.rate_request_types.state
if any(settings.connection_config.rate_request_types.state or [])
else ["LIST", "ACCOUNT", *([] if "currency" not in options else ["PREFERRED"])]
)
shipment_date = lib.to_date(options.shipment_date.state or datetime.datetime.now())
hub_id = lib.identity(
lib.text(options.fedex_smart_post_hub_id.state)
or lib.text(settings.connection_config.smart_post_hub_id.state)
)
rate_options = lambda _options: [
option
for _, option in _options.items()
Expand All @@ -115,9 +124,6 @@ def rate_request(
if _options.state is not False
and option.code in provider_units.SHIPMENT_OPTIONS
]
hub_id = lib.text(options.fedex_smart_post_hub_id.state) or lib.text(
settings.connection_config.smart_post_hub_id.state
)

request = fedex.RatingRequestType(
accountNumber=fedex.RatingRequestAccountNumberType(
Expand All @@ -131,7 +137,7 @@ def rate_request(
if any(rate_options(options))
else []
),
rateSortOrder="COMMITASCENDING",
rateSortOrder=(options.fedex_rate_sort_order.state or "COMMITASCENDING"),
),
requestedShipment=fedex.RequestedShipmentType(
shipper=fedex.ShipperClassType(
Expand Down Expand Up @@ -207,7 +213,7 @@ def rate_request(
packages.package_type or "your_packaging"
).value,
totalWeight=packages.weight.LB,
shipmentSpecialServices=(
shipmentSpecialServices=lib.identity(
fedex.ShipmentSpecialServicesType(
returnShipmentDetail=None,
deliveryOnInvoiceAcceptanceDetail=None,
Expand All @@ -230,7 +236,7 @@ def rate_request(
customsClearanceDetail=None,
groupShipment=None,
serviceTypeDetail=None,
smartPostInfoDetail=(
smartPostInfoDetail=lib.identity(
fedex.SmartPostInfoDetailType(
ancillaryEndorsement=None,
hubId=hub_id,
Expand All @@ -246,7 +252,7 @@ def rate_request(
expressFreightDetail=None,
groundShipment=None,
),
carrierCodes=None,
carrierCodes=options.fedex_carrier_codes.state,
)

return lib.Serializable(
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.2.6",
version="2024.2.7",
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_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_parse_rate_response(self):
"packagingType": "YOUR_PACKAGING",
"pickupType": "DROPOFF_AT_FEDEX_LOCATION",
"preferredCurrency": "USD",
"rateRequestType": ["LIST", "PREFERRED"],
"rateRequestType": ["LIST", "ACCOUNT", "PREFERRED"],
"recipient": {
"address": {
"city": "Lome",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class ConnectionConfig(utils.Enum):
smart_post_hub_id = utils.OptionEnum("smart_post_hub_id")
shipping_options = utils.OptionEnum("shipping_options", list)
shipping_services = utils.OptionEnum("shipping_services", list)
rate_request_types = utils.OptionEnum("rate_request_types", list)


class ServiceType(utils.Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def shipment_request(
or "BAG"
),
),
Description=package.description,
Description=(package.description or "N/A"),
Dimensions=tge.DimensionsType(
Height=package.height.map(
provider_units.MeasurementOptions
Expand Down
16 changes: 8 additions & 8 deletions modules/connectors/tge/karrio/providers/tge/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
class PackagingType(lib.StrEnum):
"""Carrier specific packaging type"""

PACKAGE = "PACKAGE"
BAG = "BG"

""" Unified Packaging type mapping """
envelope = PACKAGE
pak = PACKAGE
tube = PACKAGE
pallet = PACKAGE
small_box = PACKAGE
medium_box = PACKAGE
your_packaging = PACKAGE
envelope = BAG
pak = BAG
tube = BAG
pallet = BAG
small_box = BAG
medium_box = BAG
your_packaging = BAG


class ConnectionConfig(lib.Enum):
Expand Down
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsconfig": "*",
"turbo": "^1.12.5"
"turbo": "^1.13.0"
},
"name": "karrio",
"packageManager": "[email protected]",
Expand Down
Loading

0 comments on commit 4b9c65c

Please sign in to comment.