From 749760fe519fd0d5655fe08f22dd42c60d1f37ca Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 20 Aug 2024 11:23:59 +0200 Subject: [PATCH] fixup! Apply suggestions from code review --- README.md | 3 ++- resources/fulfillment-order.js | 6 +++--- test/fixtures/fulfillment-order/req/index.js | 2 +- test/fulfillment-order.test.js | 8 +++++--- types/index.d.ts | 12 ++++++------ 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index cefc3e20..ffca94c4 100644 --- a/README.md +++ b/README.md @@ -482,12 +482,13 @@ default. - fulfillmentOrder - `cancel(id, params)` - `close(id[, message])` + - `fulfillments(id)` - `get(id)` + - `hold(id, params)` - `list([params])` - `locationsForMove(id)` - `move(id, locationId)` - `setFulfillmentOrdersDeadline(params)` - - `fulfillments(id)` - fulfillmentRequest - `accept(fulfillmentOrderId[, message])` - `create(fulfillmentOrderId, params)` diff --git a/resources/fulfillment-order.js b/resources/fulfillment-order.js index 1e73b798..04a5a8ff 100644 --- a/resources/fulfillment-order.js +++ b/resources/fulfillment-order.js @@ -131,9 +131,9 @@ FulfillmentOrder.prototype.fulfillments = function fulfillments(id) { * Halts all fulfillment work on a fulfillment order with * status OPEN and changes the status of the fulfillment order to ON_HOLD. * - * @param {Number} id Fulfillment Order id (fulfillment_order_id). -* @param {Object} params An object containing the reason for the fulfillment - hold and additional optional information + * @param {Number} id Fulfillment Order ID + * @param {Object} params An object containing the reason for the fulfillment + hold and additional optional information * @return {Promise} Promise that resolves with the result * @public */ diff --git a/test/fixtures/fulfillment-order/req/index.js b/test/fixtures/fulfillment-order/req/index.js index 3aed5fa6..6ed476d7 100644 --- a/test/fixtures/fulfillment-order/req/index.js +++ b/test/fixtures/fulfillment-order/req/index.js @@ -2,6 +2,6 @@ exports.cancel = require('./cancel'); exports.close = require('./close'); +exports.hold = require('./hold'); exports.move = require('./move'); exports.setFulfillmentOrdersDeadline = require('./set-fulfillment-orders-deadline'); -exports.hold = require('./hold'); diff --git a/test/fulfillment-order.test.js b/test/fulfillment-order.test.js index a0f8d82e..dfef4e40 100644 --- a/test/fulfillment-order.test.js +++ b/test/fulfillment-order.test.js @@ -143,8 +143,10 @@ describe('Shopify#fulfillmentOrder', () => { .post('/admin/fulfillment_orders/1046000789/hold.json', input) .reply(200, output); - return shopify.fulfillmentOrder.hold(1046000789).then((data) => { - expect(data).to.deep.equal(output.fulfillment_order); - }); + return shopify.fulfillmentOrder + .hold(1046000789, input.fulfillment_hold) + .then((data) => { + expect(data).to.deep.equal(output.fulfillment_order); + }); }); }); diff --git a/types/index.d.ts b/types/index.d.ts index 4d88ca88..e1677ed2 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -3572,6 +3572,11 @@ declare namespace Shopify { updated_at: string; } + interface IFulfillmentHoldFulfillmentOrderLineItem { + id: number; + quantity: number; + } + interface IFulfillmentHold { reason: | 'awaiting_payment' @@ -3581,11 +3586,6 @@ declare namespace Shopify { | 'other'; reason_notes?: string; notify_merchant?: boolean; - fulfillment_order_line_items?: IUpdateFulfillmentOrderLineItem[]; - } - - interface IUpdateFulfillmentOrderLineItem { - id: number; - quantity: number; + fulfillment_order_line_items?: IFulfillmentHoldFulfillmentOrderLineItem[]; } }