We’ve introduced a new feature to our Data Factory shipOrder endpoint, which allows you to force a test order to ship in multiple cartons/boxes. You can find the detailed spec for the endpoint here: https://docs.masonhub.co/api/v1#tag/DataFactory/paths/~1data_factory~1shipOrder/post
If you’re not yet familiar with how the Data Factory can be used to test shipping orders and receiving callbacks, you can find notes on that here: https://docs.masonhub.co/releases/order_events_kitting/
This new feature is particularly useful in order to test that your system can receive and successfully process an orderEvent callback that contains multiple shipments. In real world environments, orders may ship out in multiple boxes if a single item is particularly large, so it’s necessary to be able to process multiple shipments and tracking numbers against a single order.
To trigger an order shipment with multiple boxes, you just need to make a post to the Data Factory shipOrder endpoint, and use the attribute ‘number_of_shipments’ to specify how many boxes you’d like the order to ship in. As you can guess, you can split the order into as many boxes as you have line items on the order. If you omit the ‘number_of_shipments’ or set it to 0, the Data Factory will default it to a single box shipment.
POST to https://sandbox.masonhub.co/{your-client-slug-here}/api/v1/data_factory/shipOrder with the ID of the order you want to ship, and a number of shipments:
[
{
"order_customer_id": "12345",
"number_of_shipments": 2
}
]
And then you should receive an appropriate orderEvent callback sent to your registered callback url, that contains multiple shipments for the order. Something like so:
[
{
"order_id": "3742bf4a-149e-4585-8095-d7db057e4ce7",
"customer_identifier": "12345",
"status": "fulfilled",
"shipments": [
{
"id": null,
"shipment_id": "9ymg1jo",
"customer_order_id": "testorder123",
"shipping_provider": "UPS",
"shipper_service_level": "ground",
"tracking_number": "lzkibgt",
"tracking_url": "https://www.fedex.com/apps/fedextrack/index.html?action=track\\u0026tracknumbers=lzkibgt\\u0026locale=en_US\\u0026cntry_code=en",
"shipment_date_time": "2019-03-05T23:43:26.932529784Z",
"shipment_line_items": [
{
"sku_customer_id": "testsku456",
"quantity": 2
}
]
},
{
"id": null,
"shipment_id": "rluk9fu",
"customer_order_id": "testorder123",
"shipping_provider": "UPS",
"shipper_service_level": "Ground",
"tracking_number": "ckw4oa1",
"tracking_url": "https://www.fedex.com/apps/fedextrack/index.html?action=track\\u0026tracknumbers=ckw4oa1\\u0026locale=en_US\\u0026cntry_code=en",
"shipment_date_time": "2019-03-05T23:43:26.951779594Z",
"shipment_line_items": [
{
"sku_customer_id": "testsku456",
"quantity": 2
}
]
}
]
}
]
We’ve also recently added two necessary attributes, ‘shipping_address_country_code’ and ‘billing_address_country_code’, to our orders model. So going forward, please include the country code for the order in those two fields. The full spec can be found here: https://docs.masonhub.co/api/v1#tag/Orders/paths/~1orders/post
An example:
[
{
"customer_identifier": "129374",
"order_type": "customer",
"priority": 100,
"shipping_provider": "rate_shop",
"shipper_service_level": "ground",
"special_instructions": "Triple Fold the Sleeves and wrap in Tissue Paper.",
"gift_message": "Happy Birthday Freddie!",
"shipping_address_name": "John Jacob JingleHeimer-Schmidt III",
"shipping_address_street_line_one": "234 House Lane",
"shipping_address_city": "Little Falls",
"shipping_address_locale": "NJ",
"shipping_address_postal_code": "07972",
"shipping_address_country_code": "USA",
"shipping_address_phone_number": "973-999-3333",
"shipping_address_type": "residential",
"billing_address_name": "John Jacob JingleHeimer-Schmidt III",
"billing_address_street_line_one": "234 House Lane",
"billing_address_city": "Little Falls",
"billing_address_locale": "NJ",
"billing_address_postal_code": "07972",
"billing_address_country_code": "USA",
"billing_address_phone_number": "973-999-3333",
"billing_address_type": "residential",
"submitted_at": "2018-08-01T00:00:00Z",
"line_items": [
{
"sku_customer_id": "shirts872340",
"quantity": 2,
"promised_delivery_date": "2018-08-15T17:32:28Z",
"estimated_delivery_date": "2018-08-15T17:32:28Z"
},
{
"sku_customer_id": "pants3422",
"quantity": 1,
"promised_delivery_date": "2018-08-15T17:32:28Z",
"estimated_delivery_date": "2018-08-15T17:32:28Z"
}
]
}
]