karrioapi / karrio

Programmable Shipping API (self-hosted)

Home Page:https://karrio.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weight of parcel is missing for gross weight

DarkSwoop opened this issue · comments

Describe the bug
I am not sure, but I believe that the calculation of the net and gross weight is not correct. It seems that the gross weight of the packages does not include the weight of the packaging. This could lead to incorrect figures being transmitted to customs and the carrier returning incorrect rates.

In the example below, there are 3 items, each weighing 1.55 KG, in a parcel that weighs 0.6 KG.

Rate Request

screenshot-2023-12-19-15 59 25
<p:DCTRequest xmlns:p="http://www.dhl.com" xmlns:p1="http://www.dhl.com/datatypes"
  xmlns:p2="http://www.dhl.com/DCTRequestdatatypes"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.dhl.com DCT-req.xsd" schemaVersion="3.0">
  <GetQuote>
    <Request>
      <ServiceHeader>
        <MessageTime>2023-12-19T14:11:21</MessageTime>
        <MessageReference>1234567890123456789012345678901</MessageReference>
        <SiteID>sideid</SiteID>
        <Password>password</Password>
      </ServiceHeader>
      <MetaData>
        <SoftwareName>3PV</SoftwareName>
        <SoftwareVersion>1.0</SoftwareVersion>
      </MetaData>
    </Request>
    <From>
      <CountryCode>CZ</CountryCode>
      <Postalcode>12345</Postalcode>
      <City>city</City>
    </From>
    <BkgDetails>
      <PaymentCountryCode>CZ</PaymentCountryCode>
      <Date>2023-12-19</Date>
      <ReadyTime>PT14H11M</ReadyTime>
      <DimensionUnit>CM</DimensionUnit>
      <WeightUnit>KG</WeightUnit>
      <NumberOfPieces>1</NumberOfPieces>
      <ShipmentWeight>4.64</ShipmentWeight>
      <Pieces>
        <Piece>
          <PieceID>1</PieceID>
          <Height>5</Height>
          <Depth>30</Depth>
          <Width>22</Width>
          <Weight>4.64</Weight>
        </Piece>
      </Pieces>
      <PaymentAccountNumber>1234567</PaymentAccountNumber>
      <IsDutiable>Y</IsDutiable>
      <NetworkTypeCode>AL</NetworkTypeCode>
    </BkgDetails>
    <To>
      <CountryCode>TR</CountryCode>
      <Postalcode>34130</Postalcode>
      <City>Istanbul</City>
    </To>
    <Dutiable>
      <DeclaredCurrency>EUR</DeclaredCurrency>
      <DeclaredValue>10048.770000000000437</DeclaredValue>
    </Dutiable>
  </GetQuote>
</p:DCTRequest>

Shipment Request

screenshot-2023-12-19-15 52 59
<req:ShipmentRequest
  xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd" xmlns:req="http://www.dhl.com"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="10.0">
  <Request>
    <ServiceHeader>
      <MessageTime>2023-12-19T14:11:22</MessageTime>
      <MessageReference>1234567890123456789012345678901</MessageReference>
      <SiteID>sideid</SiteID>
      <Password>password</Password>
    </ServiceHeader>
    <MetaData>
      <SoftwareName>3PV</SoftwareName>
      <SoftwareVersion>10.0</SoftwareVersion>
    </MetaData>
  </Request>
  <RegionCode>EU</RegionCode>
  <LanguageCode>en</LanguageCode>
  <Billing>
    <ShipperAccountNumber>123456</ShipperAccountNumber>
    <ShippingPaymentType>S</ShippingPaymentType>
  </Billing>
  <Consignee>
    <CompanyName>N/A</CompanyName>
    <AddressLine1>36 Hayriye Tüccari Cd</AddressLine1>
    <City>Istanbul</City>
    <PostalCode>34130</PostalCode>
    <CountryCode>TR</CountryCode>
    <CountryName>Turkey</CountryName>
    <Contact>
      <PersonName>person</PersonName>
      <PhoneNumber>0000</PhoneNumber>
      <Email>email@example.com</Email>
    </Contact>
    <StreetName>Hayriye Tüccari Cd</StreetName>
    <StreetNumber>36</StreetNumber>
  </Consignee>
  <Commodity>
    <CommodityCode>commodity_code</CommodityCode>
    <CommodityName>commodity_name</CommodityName>
  </Commodity>
  <Dutiable>
    <DeclaredValue>10048.77</DeclaredValue>
    <DeclaredCurrency>EUR</DeclaredCurrency>
    <TermsOfTrade>DDP</TermsOfTrade>
  </Dutiable>
  <UseDHLInvoice>Y</UseDHLInvoice>
  <ExportDeclaration>
    <ExportReason>merchandise</ExportReason>
    <ExportReasonCode>C</ExportReasonCode>
    <InvoiceNumber>sr_D4AwE657kM86NiQgYzpdbqRJ</InvoiceNumber>
    <InvoiceDate>2023-12-19</InvoiceDate>
    <ExportLineItem>
      <LineNumber>1</LineNumber>
      <Quantity>3</Quantity>
      <QuantityUnit>PCS</QuantityUnit>
      <Description>commodity_name</Description>
      <Value>3349.59</Value>
      <CommodityCode>commodity_code</CommodityCode>
      <Weight>
        <Weight>1.55</Weight>
        <WeightUnit>K</WeightUnit>
      </Weight>
      <GrossWeight>
        <Weight>1.55</Weight>
        <WeightUnit>K</WeightUnit>
      </GrossWeight>
      <ManufactureCountryCode>CZ</ManufactureCountryCode>
      <ManufactureCountryName>Czech Republic</ManufactureCountryName>
      <ImportCommodityCode>1234567</ImportCommodityCode>
    </ExportLineItem>
    <PlaceOfIncoterm>N/A</PlaceOfIncoterm>
    <ShipmentPurpose>COMMERCIAL</ShipmentPurpose>
  </ExportDeclaration>
  <ShipmentDetails>
    <Pieces>
      <Piece>
        <PieceID>1</PieceID>
        <PackageType>JJ</PackageType>
        <Weight>4.64</Weight>
        <Width>22</Width>
        <Height>5</Height>
        <Depth>30</Depth>
        <PieceReference>
          <ReferenceID>pcl_63009c4cecaa47cb8e30839e83</ReferenceID>
        </PieceReference>
      </Piece>
    </Pieces>
    <WeightUnit>K</WeightUnit>
    <GlobalProductCode>P</GlobalProductCode>
    <LocalProductCode>P</LocalProductCode>
    <Date>2023-12-19</Date>
    <Contents>N/A</Contents>
    <DimensionUnit>C</DimensionUnit>
    <PackageType>JJ</PackageType>
    <IsDutiable>Y</IsDutiable>
    <CurrencyCode>EUR</CurrencyCode>
  </ShipmentDetails>
  <Shipper>
    <ShipperID>1234456778</ShipperID>
    <CompanyName>N/A</CompanyName>
    <RegisteredAccount>12345678</RegisteredAccount>
    <AddressLine1>AddressLine1</AddressLine1>
    <City>CITY</City>
    <PostalCode>12345</PostalCode>
    <CountryCode>CZ</CountryCode>
    <CountryName>Czech Republic</CountryName>
    <Contact>
      <PersonName>PERSON_NAME</PersonName>
      <PhoneNumber>0000</PhoneNumber>
    </Contact>
    <StreetName>STREET_NAME</StreetName>
    <StreetNumber>NUMBER</StreetNumber>
  </Shipper>
  <Notification>
    <EmailAddress>email@example.com</EmailAddress>
  </Notification>
  <LabelImageFormat>PDF</LabelImageFormat>
  <Label>
    <LabelTemplate>6X4_PDF</LabelTemplate>
  </Label>
</req:ShipmentRequest>
commented

Hi @DarkSwoop,

🤔 I am not sure I fully understand the issue or the fix that might be required. 😅
One of the users that ships often with DHL Express out of Jamaica hasn't had any issues with an overcharged or invalid rate cost.

I've also been through the DHL request validation and certification process a couple of times with users doing international shipments and it hasn't been flagged.

While I understand that there is a difference between gross and net weight, I assumed in this case that when we are defining the customs commodities, we are already dealing with the smallest unit contained in the box (piece/parcel) so it was okay to define both gross and net weight the same value.

Also if I understand correctly, the piece weight in this case is not just the packaging but the total of the box with the items inside. 🤔

Unless the customs.commodities are missing but parcel.items are provided and can be used to identify the commodities, I try not to do much magical calculation aside from sums for totals to keep the API dumb as we discussed on the other issue.

🤔 or is the issue originating from the frontend calculations? Or do you think the commodities should offer the possibility to provide net weight? (like commodity.net_weight)

If you can illustrate with a sample of input > expected output. Or if it's a calculation that should be done, can you show an example of the formula 😅.

Also, if by any chance you have contact with a DHL representative that you can validate the situation with. It would greatly help.

Thank you.

There should be a possibility to enter a shipping gross weight independently of the commodity net/gross weights.
There should only be a validation that the sum of commodity gross weights needs to be smaller or equal to the shipping gross weight.

Isn't it handled this way by karrio already?

I use the shipment_purchased webhook event to update the order status in the order system that I maintain and develop, and to create the necessary documents for the shipment. This includes the Proforma or the Commercial Invoice. On both the Proforma and the Commercial Invoice, the gross weight (including the weight of the packaging) and the net weight must be correctly stated. In the shipment_purchased webhook event, I only receive the net weight of the individual item and the net weight of the items in the parcel (net weight * quantity). For my application, it would probably be sufficient if the weight of the packaging were simply included at the parcel level in this event. Then I could easily calculate the gross weight.

Does the certification process by DHL include the correct provision of data? I suspect that DHL does not check whether the data makes sense. These are probably just simple checks, such as 'Net weight must be less than or equal to gross weight.' Net weight < gross weight: packaging has weight. Net weight == gross weight: item is shipped simply without additional packaging. Currently, karrio only transmits net weight * quantity to DHL and does not include the packaging weight in the calculation. DHL probably implicitly assumes that the delivery takes place without additional packaging. What do you think?