Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Rate returns nothing when creating multi-pieces parcel #48

Open
bizcasso opened this issue May 11, 2019 · 1 comment
Open

Rate returns nothing when creating multi-pieces parcel #48

bizcasso opened this issue May 11, 2019 · 1 comment

Comments

@bizcasso
Copy link

There is no rate return when creating multi-pieces parcel. Here is an example provided from its document.

        APIResource resource = new APIResource(token);

        Hashtable toAddressTable = new Hashtable();
        toAddressTable.Add("name", "Mr. Hippo");
        toAddressTable.Add("company", "Shippo");
        toAddressTable.Add("street1", "215 Clayton St.");
        toAddressTable.Add("city", "San Francisco");
        toAddressTable.Add("state", "CA");
        toAddressTable.Add("zip", "94117");
        toAddressTable.Add("country", "US");
        toAddressTable.Add("phone", "+1 555 341 9393");
        toAddressTable.Add("email", "[email protected]");

        Hashtable fromAddressTable = new Hashtable();
        fromAddressTable.Add("name", "Ms Hippo");
        fromAddressTable.Add("company", "San Diego Zoo");
        fromAddressTable.Add("street1", "2920 Zoo Drive");
        fromAddressTable.Add("city", "San Diego");
        fromAddressTable.Add("state", "CA");
        fromAddressTable.Add("zip", "92101");
        fromAddressTable.Add("country", "US");
        fromAddressTable.Add("email", "[email protected]");
        fromAddressTable.Add("phone", "+1 619 231 1515");
        fromAddressTable.Add("metadata", "Customer ID 123456");

        List<Hashtable> parcelsList = new List<Hashtable>();

        Hashtable parcelTable = new Hashtable();
        parcelTable.Add("length", "5");
        parcelTable.Add("width", "5");
        parcelTable.Add("height", "5");
        parcelTable.Add("distance_unit", "in");
        parcelTable.Add("weight", "2");
        parcelTable.Add("mass_unit", "lb");

        Hashtable parcelTableTwo = new Hashtable();
        parcelTableTwo.Add("length", "1");
        parcelTableTwo.Add("width", "1");
        parcelTableTwo.Add("height", "1");
        parcelTableTwo.Add("distance_unit", "in");
        parcelTableTwo.Add("weight", "2");
        parcelTableTwo.Add("mass_unit", "lb");

        parcelsList.Add(parcelTable);
        parcelsList.Add(parcelTableTwo);


        Hashtable shipmentTable = new Hashtable();
        shipmentTable.Add("address_to", toAddressTable);
        shipmentTable.Add("address_from", fromAddressTable);
        shipmentTable.Add("parcels", parcelsList);
        shipmentTable.Add("async", false);

       Shipment shipment = resource.CreateShipment(shipmentTable);

       Response.Write(shipment.Rates.Count().ToString()); // **output 0**
@bizcasso bizcasso changed the title Rate return nothing when creating multi-pieces parcel Rate returns nothing when creating multi-pieces parcel May 11, 2019
@brunoniconeves
Copy link

brunoniconeves commented Jul 8, 2019

Same problem here...

pacotes.ForEach(x =>
{
parcels.Add(new Hashtable() {
{ "length", x.Profundidade },
{ "width", x.Largura },
{ "height", x.Altura },
{ "distance_unit", "cm" },
{ "weight", x.Peso },
{ "mass_unit", "lb" },
});
});
`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants