chitchats/chitchats-api-doc

Create a shipment on staging responding with a 400 when using certain postage_types

Braedencraig opened this issue · 6 comments

On production, when I make the same calls, everything is solid gold, but on staging i'm experiencing some issues!

When creating a shipment with country_code: "US", I am using postage_type: "usps_media_mail"
and with country_code: "CA" I am using postage_type: "chit_chats_canada_tracked"

postage_type: "chit_chats_canada_tracked" is responding with {"error":{"message":"Unable to fetch postage rate"}}. I received this error previously when I was attempting to use a postage_type that was no longer offered for intl. shipping.

postage_type: "usps_media_mail" is responding with {"error":{"message":"is_media_mail field not supported for Parcel"}}

For postage_type chit_chats_canada_tracked, it can be replicated by the following:

curl --request POST \
  --url https://staging.chitchats.com/api/v1/clients/xxxxxx/shipments \
  --header 'Authorization: xxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
        "name": "braeden craig",
        "address_1": "1 bellwoods park",
        "address_2": "",
        "city": "Toronto",
        "province_code": "ON",
        "postal_code": "M6J1S4",
        "phone": "9056014498",
        "country_code": "CA",
        "description": "Phonographic record",
        "value": "20",
        "value_currency": "cad",
        "package_type": "parcel",
        "package_contents": "merchandise",
        "size_unit": "cm",
        "size_x": 12,
        "size_y": 5,
        "size_z": 12,
        "weight_unit": "g",
        "weight": 200,
        "ship_date": "today",
        "postage_type": "chit_chats_canada_tracked"
}'

Thank you for looking into this! Sorry to bother again on the weekend!

gshaw commented

@Braedencraig when this happens try using postage_type unknown. That will return a shipment with a list of postage types available for the shipment.

I'm pretty sure this was caused by an setting left enabled on staging but reverted on production when were using two different services to deal with Canada Post cap. That service was done with a different partner and was called chit_chats_canada_domestic. I disabled the setting on staging so your curl request should work on. If not reply here and I'll look at it on Monday.

@gshaw I used postage_type: unknown and I get a successful response, except in the response rates: [] is an empty array. Even when I go into the staging dashboard, and try to add postage that way, for Canada there are no postage rates available.

As well, when using postage_type: "usps_media_mail"for USA, it also gives me a 400, but unknown works, and the only available rate I see in rates is chit_chats_us_tracked. Is that to be expected?

Hope you're having a good weekend!!

@Braedencraig I tried the cURL request you posted and it is working as expected, it is returning chit_chats_canada_tracked in rates.

I have also updated your staging account to be same as on production so usps_media_mail should be working fine as well.

Please retry and let me know.

@rajbirverma Thanks for looking into this for me! usps_media_mail is working for me on staging now for creating US shipments, which is great, thank you!

However, on production, for CA shipments, chit_chats_canada_tracked is working, but on staging, when I use either that or unknown rates is still an empty array.

Thanks again for the help!

@Braedencraig This should be working for you now

@rajbirverma It's working now! Thank you! I'll close this up!