Partial Fulfillments
(ms.fulfillments)

Fulfillments allows the user to split an order into multiple fulfillments. The main purpose of splitting an order is to enable to user to ship different items (and their varying quantity) independently.

All fulfillments created by a store are stores in Fulfillments

Fields

oid
Type: string
OID of the associated order
Add POST /api/1/entity/ms.fuflillments

This API adds a new fulfillment

Example

creating a fulfillment using item id
POST /api/1/entity/ms.fuflillments

Example Request Json

{
  "order_id": "583ff1f3c662a22250caba9f",
  "items": [
    {
      "_id": "583ff1004002e3e23e48e906",
      "quantity": 1
    }
  ]
}

Example Response

The fulfillment has been successfully created

Example Response Json

{
  "_id": "592cebff5d934d2c41a0a701"
}
creating a fulfillment using product sku
POST /api/1/entity/ms.fulfillments

Example Request Json

{
  "order_id": "583ff1f3c662a22250caba9f",
  "items": [
    {
      "sku": "sku123",
      "quantity": 1
    }
  ]
}

Example Response

The fulfillment has been successfully created

Example Response Json

{
  "_id": "592cebff5d934d2c41a0a701"
}

Message

CodeMessage
ms.msg.fulfillments.addData added successfully
ms.entity.fulfillments.invalid_itemInvalid item in fulfillment
ms.entity.fulfillments.invalid_item_quantityInvalid item quantity
ms.msg.invalid_orderOrder does not exists
ms.msg.invalid_requestInvalid request
ms.msg.order_fulfilledThis order is already fulfilled
Cancel PUT /api/1/entity/ms.fulfillments/:id/_/cancel

This API cancels a shipments i.e. updates its status to "cancelled".
If the fulfillment has a shipment associated with it then  it calls the "cancel" command of ms.shipment to cancel the corresponding shipment as well

Example

Cancelling a fulfillment
PUT /api/1/entity/ms.fuflillments/572b569a942eb2d8312c7351/_/cancel

Message

CodeMessage
ms.entity.fulfillments.cancelThe fulfillment has been successfully cancelled
ms.msg.invalid_requestInvalid request
ms.msg.fulfillments.fulfillment_fulfilledThis fulfillment has been fulfilled
ms.msg.fulfillments.fulfillment_cancelledThis fulfillment has been cancelled
MarkAsDelivered PUT /api/1/entity/ms.fulfillments/:_id/_/markAsDelivered

This API updates the tracking status of a fulfillment with given value

Example

Marking a fulfillment as delivered
PUT /api/1/entity/ms.fuflillments/572b569a942eb2d8312c7351/_/markAsDelivered

Example Request Json

{ order_id: '593e926361497b4e31126bc3',
     tracking_status: 'Delivered' }

Message

CodeMessage
ms.entity.ms.fulfillments.markAsDeliveredFulfillment is successfully marked as delivered
ms.msg.fulfillments.invalid_requestInvalid request
MarkAsShipped PUT /api/1/entity/ms.fuflillments/:_id/_/markAsShipped

This method updates the tracking status of a fulfillment as "Shipped" and also generates a shipping label with the details provided to the command, such as tracking number and logistics company name.

Example

Marking a fulfillment as shipped
PUT /api/1/entity/ms.fuflillments/572b569a942eb2d8312c7351/_/markAsShipped

Example Request Json

{
  "tracking_number": "test12345",
  "tracking_status": "shipped",
  "tracking_company": "testCompany",
  "email": "test@test.com",
  "generate_shipping_label": true,
  "send_mail": true
}

Example Response Json

{ shipment_id: '593e88a7d0c2e9763baa339d',
     shipping_label: '//cdn.storehippo.com/s/57aaca10964eb5eb1362cb19/ms.shipping/593e88a56c52db2d22b40e3apackagingSlip.pdf' }

Message

CodeMessage
ms.entity.ms.fulfillments.markAsShippedThis fulfillment has been successfully marked as shipped
ms.msg.fulfillments.fulfillment_fulfilledThis fulfillment has been fulfilled
ms.msg.fulfillments.fulfillment_cancelledThis fulfillment has been cancelled
Ship PUT /api/1/entity/ms.fuflillments/:id/_/ship

This function creates a new shipment for given fulfillment and changes its status to Shipped.

This function internally calls create on shipping_providers

Example

Shipping a fulfillment
PUT /api/1/entity/ms.fuflillments/572b569a942eb2d8312c7351/_/ship

Example Request Json

{
  "level": "level1",
  "method": "ecomexpress",
  "pickupAddress": {
    "address": "House Number, Street, Locality",
    "city": "New Delhi",
    "country": "India",
    "email": "test@gmail.com",
    "phone": "9411548977",
    "state": "Delhi",
    "title": "Store Address",
    "zip_code": "110085"
  },
  "provider_id": "584123f083e573d70f6f59c6",
  "selected_date": {
    "readyPickup": "2016/11/10"
  },
  "selected_service": {
    "name": "ecomexpress",
    "title": "Ecom Express",
    "method": "regular",
    "rate": "standard"
  },
  "selected_time": "12:00"
}

Example Response

The fulfillment is successfully shipped