easypost-java icon indicating copy to clipboard operation
easypost-java copied to clipboard

[Bug]: USPS buy Pickup API call throwing error "Invalid name. Please check for any special characters."

Open k0m09dx opened this issue 11 months ago • 3 comments

Software Version

7.1.0

Language Version

17

Operating System

Ubuntu Linux

What happened?

  1. Create Pickup Request for USPS.
  2. From the response object select the respective Carrier and Service name to make buy Pickup api call.
  3. Getting error as "Invalid name. Please check for any special characters." ...

What was expected?

Expected that Error objects should specify that the error property name for that the API call is failing instead of the generic fallback of "Invalid name. Please check for any special characters."

Sample Code

Map<String, Object> requestPayload =  new HashMap<>();
requestPayload.put("carrier", "USPS");
requestPayload.put("service", "NextDay");

client.pickup.buy(pickupId, requestPayload);

Relevant logs

CODE = PICKUP.BUY.FAILED
MESSAGE = Invalid name. Please check for any special characters.

StackTrace:
com.easypost.exception.API.BadRequestError: Invalid name. Please check for any special characters.
	at com.easypost.http.Requestor.handleAPIError(Requestor.java:676)
	at com.easypost.http.Requestor.httpRequest(Requestor.java:610)
	at com.easypost.http.Requestor.request(Requestor.java:504)
	at com.easypost.http.Requestor.request(Requestor.java:448)
	at com.easypost.service.PickupService.buy(PickupService.java:121)

k0m09dx avatar Mar 09 '24 12:03 k0m09dx

Hey @k0m09dx, thanks for writing in. Is the carrier and service provided above the only thing present in the requestPayload? What is the pickupId you are using? Are there any additional pieces of sample code you could share that hasn't been yet that may help us in reproducing this issue?

Justintime50 avatar Mar 11 '24 16:03 Justintime50

Hi @Justintime50 I followed the steps mentioned in the Doc .FYR: https://www.easypost.com/docs/api/java#buy-a-pickup. Language: Java(17). you can try the same with below Id Environment: test Pickup Id: pickup_2861e54ae5ba413baa9ce785f4ca634b Shipment Id: shp_9e76a9a04e234b4a8248d6f61da3c55b

k0m09dx avatar Mar 11 '24 20:03 k0m09dx

What happens if you try with a new shipment that has a corrected address "name" field? It appears there is a 2 in the name field which may be leading to this error with USPS? See Koushik2 Mondal in the response. Let me know if that works as expected once corrected.

Justintime50 avatar Mar 11 '24 20:03 Justintime50

Sorry for the delayed response. the above issue fixed.

k0m09dx avatar May 02 '24 11:05 k0m09dx