Class: NewStoreApi::FulfillmentRequestsController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::FulfillmentRequestsController
- Defined in:
- lib/new_store_api/controllers/fulfillment_requests_controller.rb
Overview
FulfillmentRequestsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#list_fulfillment_requests_for_order(order_uuid) ⇒ OrderFulfillmentRequestsResponse
âšī¸ Rate Limit: This endpoint is rate limited to 70 requests per second.
- #show_fulfillment_request(fulfillment_request_id) ⇒ FulfillmentRequest
đ§ BETA: This endpoint is in beta and may change.- #update_fulfillment_request(fulfillment_request_id, body: nil) ⇒ void
đ§ BETA: This endpoint is in beta and may change.- #update_fulfillment_request_item_states(body, ffr_uuid) ⇒ void
Update the shipment status for items in the specified fulfillment request.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from NewStoreApi::BaseController
Instance Method Details
#list_fulfillment_requests_for_order(order_uuid) ⇒ OrderFulfillmentRequestsResponse
âšī¸ Rate Limit: This endpoint is rate limited to 70 requests per second.Returns all fulfillment requests created for an order, sorted by creation date in the ascending order (earliest first). If order wasn't found, then the empty list of fulfillment requests will be returned. If order wasn't routed yet, then the empty list of fulfillment requests will be returned. **Important:** As for now this API will return fulfillment requests even for orders without routing (like in_store_purchase) but this behavior will change soon. And this API will only work for orders where routing is needed. So, build your integrations accordingly. **Important:** Maximum number of fulfillment requests this API will return is **2000**. If there are more than **2000** fulfillment requests for the order, then the response will have 400 status code (although it is actually not a bad request) and **2000** latest (according to the creaiton date) fulfillment requests. here177 178 179 180 181 182 183 184 185 186 187 188 189 190
# File 'lib/new_store_api/controllers/fulfillment_requests_controller.rb', line 177 def list_fulfillment_requests_for_order(order_uuid) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v0/fulfillment_requests/{order_uuid}', Server::API) .template_param(new_parameter(order_uuid, key: 'order_uuid') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(OrderFulfillmentRequestsResponse.method(:from_hash))) .execute end
#show_fulfillment_request(fulfillment_request_id) ⇒ FulfillmentRequest
đ§ BETA: This endpoint is in beta and may change.fulfillment request.
See API Lifecycle Documentation for details.21 22 23 24 25 26 27 28 29 30 31 32 33 34
# File 'lib/new_store_api/controllers/fulfillment_requests_controller.rb', line 21 def show_fulfillment_request(fulfillment_request_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/fulfillment/fulfillment-requests/{fulfillmentRequestId}', Server::API) .template_param(new_parameter(fulfillment_request_id, key: 'fulfillmentRequestId') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(FulfillmentRequest.method(:from_hash))) .execute end
#update_fulfillment_request(fulfillment_request_id, body: nil) ⇒ void
This method returns an undefined value.
đ§ BETA: This endpoint is in beta and may change.Marks some or all items of a fulfillment request as shipped, rejected, or canceled. **Note:** This only applies to orders routed to a DC or warehouse for fulfillment. To mark an item as shipped, which was part of an order that is routed to a store for fulfillment, contact the [support team](https://support.newstore.com/). fulfillment request. patching item states
See API Lifecycle Documentation for details.57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
# File 'lib/new_store_api/controllers/fulfillment_requests_controller.rb', line 57 def update_fulfillment_request(fulfillment_request_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/fulfillment/fulfillment-requests/{fulfillmentRequestId}', Server::API) .template_param(new_parameter(fulfillment_request_id, key: 'fulfillmentRequestId') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('oauth'))) .response(new_response_handler .is_response_void(true)) .execute end
#update_fulfillment_request_item_states(body, ffr_uuid) ⇒ void
This method returns an undefined value.
Update the shipment status for items in the specified fulfillment request. Important: Do not confuse this API with Fulfillment Provider API. For DC orders please use the Fulfillment Provider API. Items in a fulfillment request can be marked as shipped or rejected. When you use this API you can't mix shipment and rejection actions on the same call. Important: If you are doing a partial rejection of items in a fulfillment request, the reroute attempt will not happen until all items in the fulfillment request are in a terminal state. For fulfillment requests which are routed to store fulfillment nodes, the item state update will only be accepted if the request has not been picked by a store associate. The change in status is only valid for items that are not in a final state (the fulfillment process for the item is considered as complete). The remaining items are not affected by this change. Important: When you reject items that are currently fulfilled in DC we don't notify DC about items rejection. You are responsible for communicating with DC API to ensure these items will not be shipped. Rejection reason: For fulfillment requests which are routed to store fulfillment nodes, to reject a fulfillment request you must provide the rejection reason "rescinded". This will initiate a re-routing attempt without any changes to inventory levels. Edge Cases:
- If your organization's settings allows rerouting by setting
reroute_to_rejected_fulfillment_nodes( described in this [API](https://docs.newstore.net/api/configuration/inventory-fulfillment/lo gistic_order_config#operation/set-reroute-to-rejected-fulfillment-nodes)) totrue, rejected fulfillment nodes will be downgraded in priority during the routing process. If all possible nodes for a givenlocation_groupin [routing configuration](https://docs.newstore.net/api/integration/delivery/routing_ ruleset_api#operation/get-routing-rules) are exhausted, it will take the first available fulfillment node as part of the mechanism, resulting in a potential route to the same location on further attempts. - Setting
reroute_to_rejected_fulfillment_nodestofalse, fulfillment nodes will be ignored during future routing attempts. If all fulfillment nodes are rejected and you don't want to reroute to these nodes, the rejected items will be put on hold. Important: The platform emits a separate event for each line item that is marked as shipped, and not a single event for all items. This should be considered when reconciling these events in the ERP you are using to manage such events. TODO: type description here
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
# File 'lib/new_store_api/controllers/fulfillment_requests_controller.rb', line 131 def update_fulfillment_request_item_states(body, ffr_uuid) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/v0/fulfillment_request/{ffr_uuid}/set_items_states', Server::API) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .template_param(new_parameter(ffr_uuid, key: 'ffr_uuid') .should_encode(true)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('oauth'))) .response(new_response_handler .is_response_void(true)) .execute end
- #show_fulfillment_request(fulfillment_request_id) ⇒ FulfillmentRequest