Skip to content

Commit

Permalink
Merge pull request #558 from karrioapi/patch-2024.2.15
Browse files Browse the repository at this point in the history
[patch] 2024.2.15
  • Loading branch information
danh91 committed Apr 9, 2024
2 parents f0744d4 + 1482574 commit 92ed178
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 30 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.14
2024.2.15
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.14}"
export KARRIO_TAG="${KARRIO_TAG:-2024.2.15}"
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.14')"
echo "What version of Karrio would you like to install? (We default to '2024.2.15')"
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.2.14}"
export KARRIO_TAG="${KARRIO_TAG:-2024.2.15}"

# 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.14
image: karrio.docker.scarf.sh/karrio/server:2024.2.15
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.14
image: karrio.docker.scarf.sh/karrio/server:2024.2.15
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.14
image: karrio.docker.scarf.sh/karrio/dashboard:2024.2.15
restart: unless-stopped
ports:
- ${DASHBOARD_PORT}:3000/tcp
Expand Down
16 changes: 13 additions & 3 deletions modules/connectors/fedex/karrio/providers/fedex/rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ def rate_request(
commodities=[
fedex.CommodityType(
description=lib.text(
item.title or item.description or "N/A", max=35
item.description or item.title or "N/A", max=35
),
weight=fedex.WeightType(
units=packages.weight_unit,
value=item.weight,
),
unitPrice=(
unitPrice=lib.identity(
fedex.FixedValueType(
amount=lib.to_money(item.value_amount),
currency=(
Expand All @@ -287,11 +287,21 @@ def rate_request(
if item.value_amount
else None
),
customsValue=fedex.FixedValueType(
amount=lib.identity(
lib.to_money(item.value_amount or 1.0 * item.quantity)
),
currency=lib.identity(
item.value_currency
or packages.options.currency.state
or "USD"
),
),
quantity=item.quantity,
numberOfPieces=item.quantity,
quantityUnits="PCS",
harmonizedCode=item.hs_code,
name=None,
name=item.title,
partNumber=item.sku,
)
for item in commodities
Expand Down
49 changes: 40 additions & 9 deletions modules/connectors/fedex/karrio/providers/fedex/shipment/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,12 @@ def shipment_request(
),
commodities=[
fedex.CommodityType(
unitPrice=(
unitPrice=lib.identity(
fedex.TotalDeclaredValueType(
amount=lib.to_money(item.value_amount),
currency=(
item.value_currency
or packages.options.currency.state
or customs.duty.currency
),
)
if item.value_amount
Expand All @@ -430,16 +429,27 @@ def shipment_request(
numberOfPieces=item.quantity,
quantity=item.quantity,
quantityUnits="PCS",
customsValue=None,
customsValue=fedex.CustomsValueType(
amount=lib.identity(
lib.to_money(
item.value_amount or 1.0 * item.quantity
)
),
currency=lib.identity(
item.value_currency
or packages.options.currency.state
or "USD"
),
),
countryOfManufacture=(
item.origin_country or shipper.country_code
),
cIMarksAndNumbers=None,
harmonizedCode=item.hs_code,
description=lib.text(
item.title or item.description or "N/A", max=35
item.description or item.title or "N/A", max=35
),
name=None,
name=lib.text(item.title, max=35),
weight=fedex.WeightType(
units=weight_unit.value,
value=item.weight,
Expand All @@ -458,7 +468,19 @@ def shipment_request(
importerOfRecord=None,
generatedDocumentLocale=None,
exportDetail=None,
totalCustomsValue=None,
totalCustomsValue=lib.identity(
fedex.TotalDeclaredValueType(
amount=lib.to_money(
packages.options.declared_value.state
),
currency=lib.identity(
packages.options.currency.state or "USD"
),
)
if lib.to_money(packages.options.declared_value.state)
is not None
else None
),
partiesToTransactionAreRelated=None,
declarationStatementDetail=None,
insuranceCharge=None,
Expand All @@ -479,7 +501,7 @@ def shipment_request(
if hub_id and service == "SMART_POST"
else None
),
blockInsightVisibility=None,
blockInsightVisibility=False,
labelSpecification=fedex.LabelSpecificationType(
labelFormatType="COMMON2D",
labelOrder="SHIPPING_LABEL_FIRST",
Expand Down Expand Up @@ -530,7 +552,16 @@ def shipment_request(
).value
),
customerReferences=[],
declaredValue=None,
declaredValue=fedex.TotalDeclaredValueType(
amount=lib.identity(
lib.to_money(package.total_value)
or lib.to_money(packages.options.declared_value.state)
or 1.0
),
currency=lib.identity(
packages.options.currency.state or "USD"
),
),
weight=fedex.WeightType(
units=package.weight.unit,
value=package.weight.value,
Expand All @@ -552,7 +583,7 @@ def shipment_request(
)
else None
),
groupPackageCount=None,
groupPackageCount=1,
itemDescriptionForClearance=None,
contentRecord=[],
itemDescription=package.parcel.description,
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.10",
version="2024.2.15",
description="Karrio - FedEx Shipping Extension",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 2 additions & 0 deletions modules/connectors/fedex/tests/fedex/test_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ def test_parse_rate_response(self):
"customsClearanceDetail": {
"commodities": [
{
"name": "test",
"description": "test",
"harmonizedCode": "00339BB",
"numberOfPieces": 1,
"quantity": 1,
"quantityUnits": "PCS",
"weight": {"units": "LB", "value": 10.0},
"customsValue": {"amount": 1.0, "currency": "USD"},
}
],
"dutiesPayment": {
Expand Down
15 changes: 15 additions & 0 deletions modules/connectors/fedex/tests/fedex/test_shipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def test_parse_cancel_shipment_response(self):
"accountNumber": {"value": "2349857"},
"labelResponseOptions": "LABEL",
"requestedShipment": {
"blockInsightVisibility": False,
"customsClearanceDetail": {
"commercialInvoice": {
"customerReferences": [
Expand All @@ -229,11 +230,13 @@ def test_parse_cancel_shipment_response(self):
{
"countryOfManufacture": "US",
"description": "test",
"name": "test",
"harmonizedCode": "00339BB",
"numberOfPieces": 1,
"quantity": 1,
"quantityUnits": "PCS",
"weight": {"units": "LB", "value": 10.0},
"customsValue": {"amount": 1.0, "currency": "USD"},
}
],
"dutiesPayment": {
Expand Down Expand Up @@ -294,12 +297,14 @@ def test_parse_cancel_shipment_response(self):
],
"requestedPackageLineItems": [
{
"declaredValue": {"amount": 1.0, "currency": "USD"},
"dimensions": {
"height": 12.0,
"length": 12.0,
"units": "IN",
"width": 12.0,
},
"groupPackageCount": 1,
"packageSpecialServices": {
"signatureOptionType": "SERVICE_DEFAULT",
"specialServiceTypes": ["SIGNATURE_OPTION"],
Expand Down Expand Up @@ -346,6 +351,7 @@ def test_parse_cancel_shipment_response(self):
"accountNumber": {"value": "2349857"},
"labelResponseOptions": "LABEL",
"requestedShipment": {
"blockInsightVisibility": False,
"customsClearanceDetail": {
"commercialInvoice": {
"customerReferences": [
Expand All @@ -361,11 +367,13 @@ def test_parse_cancel_shipment_response(self):
{
"countryOfManufacture": "US",
"description": "test",
"name": "test",
"harmonizedCode": "00339BB",
"numberOfPieces": 1,
"quantity": 1,
"quantityUnits": "PCS",
"weight": {"units": "LB", "value": 10.0},
"customsValue": {"amount": 1.0, "currency": "USD"},
}
],
"dutiesPayment": {
Expand Down Expand Up @@ -426,12 +434,14 @@ def test_parse_cancel_shipment_response(self):
],
"requestedPackageLineItems": [
{
"declaredValue": {"amount": 1.0, "currency": "USD"},
"dimensions": {
"height": 12.0,
"length": 12.0,
"units": "IN",
"width": 12.0,
},
"groupPackageCount": 1,
"packageSpecialServices": {
"signatureOptionType": "SERVICE_DEFAULT",
"specialServiceTypes": ["SIGNATURE_OPTION"],
Expand Down Expand Up @@ -482,6 +492,7 @@ def test_parse_cancel_shipment_response(self):
"accountNumber": {"value": "2349857"},
"labelResponseOptions": "LABEL",
"requestedShipment": {
"blockInsightVisibility": False,
"customsClearanceDetail": {
"commercialInvoice": {
"customerReferences": [
Expand All @@ -497,11 +508,13 @@ def test_parse_cancel_shipment_response(self):
{
"countryOfManufacture": "US",
"description": "test",
"name": "test",
"harmonizedCode": "00339BB",
"numberOfPieces": 1,
"quantity": 1,
"quantityUnits": "PCS",
"weight": {"units": "LB", "value": 10.0},
"customsValue": {"amount": 1.0, "currency": "USD"},
}
],
"dutiesPayment": {
Expand Down Expand Up @@ -566,12 +579,14 @@ def test_parse_cancel_shipment_response(self):
],
"requestedPackageLineItems": [
{
"declaredValue": {"amount": 1.0, "currency": "USD"},
"dimensions": {
"height": 11.0,
"length": 11.0,
"units": "IN",
"width": 11.0,
},
"groupPackageCount": 1,
"packageSpecialServices": {
"signatureOptionType": "SERVICE_DEFAULT",
"specialServiceTypes": ["SIGNATURE_OPTION"],
Expand Down
Loading

0 comments on commit 92ed178

Please sign in to comment.