Skip to content

Commit

Permalink
feat: added a few missing fulfillment calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Razorsheep committed Aug 2, 2023
1 parent 5d7653c commit 57f584d
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions src/REST/Actions/ManagesFulfillments.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public function getOrderFulfillment($orderId, $fulfillmentId): ApiResource
return $this->getResource('fulfillments', $fulfillmentId, ['orders', $orderId]);
}

public function createOrderFulfillment($orderId, array $data): ApiResource
{
return $this->createResource('fulfillments', $data, ['orders', $orderId]);
}

public function createFulfillment(array $data): ApiResource
{
return $this->createResource('fulfillments', $data);
Expand Down Expand Up @@ -252,4 +247,45 @@ public function getAssignedFulfillmentOrders(string $assignmentStatus, array $lo

return $this->transformCollection($response['fulfillment_orders'], ApiResource::class);
}

public function holdFulfillmentOrder($fulfillmentOrderId, array $data): ApiResource
{
$response = $this->post("fulfillment_orders/{$fulfillmentOrderId}/hold.json", [
'fulfillment_hold' => $data,
]);

return new ApiResource($response['fulfillment_order'], $this);
}

public function openFulfillmentOrder($fulfillmentOrderId): ApiResource
{
$response = $this->post("fulfillment_orders/{$fulfillmentOrderId}/close.json");

return new ApiResource($response['fulfillment_order'], $this);
}

public function releaseHoldFulfillmentOrder($fulfillmentOrderId): ApiResource
{
$response = $this->post("fulfillment_orders/{$fulfillmentOrderId}/release_hold.json");

return new ApiResource($response['fulfillment_order'], $this);
}

public function rescheduleFulfillmentOrder($fulfillmentOrderId, $data): ApiResource
{
$response = $this->post("fulfillment_orders/{$fulfillmentOrderId}/reschedule.json", $data);

return new ApiResource($response['fulfillment_order'], $this);
}

public function setFulfillmentOrdersDeadline(array $fulfillmentOrderIds, $fulfillmentDeadline): bool
{
$response = $this->post("fulfillment_orders/set_fulfillment_orders_deadline.json", [
'fulfillment_order_ids' => $fulfillmentOrderIds,
'fulfillment_deadline' => $fulfillmentDeadline,
]);

return true;
}

}

0 comments on commit 57f584d

Please sign in to comment.