beardon/mws-api

Issues with CreateInboundShipmentPlan

Opened this issue · 0 comments

Hi there,

I'm seeming to have some bugs with CreateInboundShipmentPlan. I believe it's an API-related bug so I'd be happy to collaborate a bit and get a fix for this one.

My request looks like:

mws.FulfillmentInboundShipment.CreateInboundShipmentPlan({
            InboundShipmentPlanRequestItems: items,
            LabelPrepPreference: "SELLER_LABEL",
            ShipFromAddressLine1: address.AddressLine1,
            ShipFromCity: address.City,
            ShipFromCountryCode: address.CountryCode,
            ShipFromName: address.Name,
            ShipFromPostalCode: address.PostalCode,
            ShipFromStateOrProvince: address.StateOrProvinceCode,
            ShipToCountryCode: "US"
        }).then(({
            result,
            metadata
        }) => {
           // ... etc

None of the address items are null; I've triple checked on that end.

Items is formatted like the following, which should be correct according to the API:

[{"SellerSKU":"(whatever SKU)","Quantity":"15","Condition":"NewItem","ASIN":"(whatever ASIN)"}]

On the module, the code looks like the following. I did modify this method a bit; "params" was "parms" prior, which I believe was a typo. Also, a few variables were left out, so I decided to add those in. Unfortunately though, I'm still getting a invalid request error from MWS and I'm not exactly sure where it is.

Thanks so much for any help you can provide! I'd be happy to send a donation for your time. Additionally, I have fixes for a couple of methods in the API - I'd be happy to provide them in this comment if needed!

CreateInboundShipmentPlan: {

        params: {
            LabelPrepPreference: {
                required
            },
            ShipFromName: {
                name: 'ShipFromAddress.Name',
                required
            },
            ShipFromAddressLine1: {
                name: 'ShipFromAddress.AddressLine1',
                required
            },
            ShipFromCity: {
                name: 'ShipFromAddress.City',
                required
            },
            ShipFromStateOrProvince: {
                name: 'ShipFromAddress.StateOrProvinceCode',
                required
            },
            ShipFromPostalCode: {
                name: 'ShipFromAddress.PostalCode',
                required
            },
            ShipFromCountryCode: {
                name: 'ShipFromAddress.CountryCode',
                required
            },
            ShipFromAddressLine2: {
                name: 'ShipFromAddress.AddressLine2'
            },
            ShipFromDistrictOrCounty: {
                name: 'ShipFromAddress.DistrictOrCounty'
            },
            ShipToCountryCode: {
                required
            },
            InboundShipmentPlanRequestItems: {
                type: Type.COMPLEX,
                required,
                construct: complex.InboundShipmentPlanRequestItems
            }
        }
    },