goshippo / shippo-javascript-sdk

MIT License
5 stars 0 forks source link

zod validation issue with customs declaration: commercial_invoice -> Expected string, received boolean #32

Closed alsoscotland closed 1 month ago

alsoscotland commented 1 month ago

I am seeing another zod validation error when attempting to create customsDeclarations:

from a await client.customsDeclarations.create operation

request is

{
 "contentsType": "MERCHANDISE",
 "contentsExplanation": "<redacted> or related merchandise",
 "nonDeliveryOption": "RETURN",
 "certify": true,
 "certifySigner": "<redacted>",
 "items": [
   {
     "description": "<redacted> or related merchandise",
     "quantity": 1,
     "netWeight": "8",
     "massUnit": "oz",
     "valueAmount": "159",
     "valueCurrency": "USD",
     "originCountry": "US"
   }
 ]
}

Seems like another zod validation error with the response

{
 "status": "rejected",
 "reason": {
   "writeToLog": false,
   "originalError": {
     "name": "SDKValidationError",
     "cause": {
       "issues": [
         {
           "code": "invalid_type",
           "expected": "string",
           "received": "boolean",
           "path": [
             "commercial_invoice"
           ],
           "message": "Expected string, received boolean"
         }
       ],
       "name": "ZodError"
     },
     "rawValue": {
       "object_created": "2024-05-12T19:33:38.315Z",
       "object_updated": "2024-05-12T19:33:38.315Z",
       "object_id": "<redacted>",
       "object_owner": "<redacted>",
       "object_state": "VALID",
       "certify_signer": "<redacted>",
       "certify": true,
       "items": [
         "<redacted>"
       ],
       "non_delivery_option": "RETURN",
       "contents_type": "MERCHANDISE",
       "contents_explanation": "<redacted> or related merchandise",
       "exporter_reference": "",
       "importer_reference": "",
       "invoice": "",
       "commercial_invoice": false,
       "license": "",
       "certificate": "",
       "notes": "",
       "eel_pfc": "",
       "aes_itn": "",
       "disclaimer": "",
       "incoterm": "",
       "metadata": "",
       "test": true,
       "b13a_filing_option": "",
       "b13a_number": "",
       "is_vat_collected": false
     }
   },
   "type": "shipping_transaction_processing",
   "status": 400
 }
shippo-lueders commented 1 month ago

duplicates https://github.com/goshippo/shippo-javascript-sdk/issues/31 (which should be fixed shortly)

alsoscotland commented 1 month ago

@shippo-lueders my apologies for missing the duplicate