EasyPost / easypost-node

EasyPost Shipping API Client Library for Node
https://easypost.com/docs/api
MIT License
139 stars 54 forks source link

[Bug]: can't pass in endshipperId parameter when buying a shipment #478

Closed stevensecreti closed 1 month ago

stevensecreti commented 1 month ago

Software Version

7.5.2

Language Version

Typescript 5.6.2, NodeJS 20.11.0, npm 10.8.1

Operating System

N/A, issue recreated on Windows 11, latest MacOS

What happened?

  1. Began following endshipper guide here while building peer-to-peer platform https://docs.easypost.com/guides/endshipper-guide
  2. Followed setup instructions, went to pass endshipperId to EasyPost Node.js module, Shipment.buy call 3.Typescript error: Expected 2-3 arguments, but got 4.ts(2554)

Our Code:

image image

EasyPost Node.JS Module Code:

What was expected?

According to this guide, we should be able to pass the endshipper id (received from EasyPost) here, when buying a shipment.

Sample Code

const client = new EasyPost(process.env.EASYPOST_API_KEY as string);
client.addRequestHook(logOutgoingRequest);
client.addResponseHook(logResponse);
return client;

const boughtShipment: Shipment = await client.Shipment.buy(
    shipment.id,
    rate,
    insurance,
    endshipperId,
    //TODO: Contact EasyPost and Figure out how to pass in endshipperId here
);

Relevant logs

None, typescript error.
HottieHotton commented 1 month ago

Hey Eng, Braxton here from Technical Support! The customer originally reached out to Support about this, and it looks like this should work but we may not be mapping it correctly somehow.

I can confirm the user is on the latest version of the NodeJS library as well! Let me know if you have any questions on my end!

nwithan8 commented 1 month ago

The function is set up to accept an optional EndShipper ID, but the TypeScript documentation is outdated. Functionally, it should work, unless TypeScript violations are halting your application from compiling.

We are patching the TypeScript definition currently.

stevensecreti commented 1 month ago

@nwithan8 do you have an ETA on when a release with these changes is created?

nwithan8 commented 1 month ago

@nwithan8 do you have an ETA on when a release with these changes is created?

We are drafting up a release currently, hope to get it out either today or tomorrow.

nwithan8 commented 1 month ago

@stevensecreti v7.5.3 is now available and features the fixed TypeScript definition.