NodeJS 无法创建完成请求并接受订单请求

uqcuzwp8  于 2023-06-22  发布在  Node.js
关注(0)|答案(1)|浏览(100)

我正在尝试使用shopify-api-node库完成shopify订单。首先,我使用const test = await shopify.order.fulfillmentOrders(5333711388952)获取一个订单履行列表,它给出了

[
   {
    id: 6278164939032,
    shop_id: 75510251800,
     order_id: 5333711388952,
     assigned_location_id: 82896257304,
     request_status: 'unsubmitted',
     status: 'open',
     supported_actions: [ 'create_fulfillment', 'hold' ],
     destination: {
      id: 5902918746392,
       address1: '567 CBE street',
       address2: 'D',
       city: 'San Jose',
       company: null,
       country: 'United States',
       email: 'sharma@hotmail.com',
       first_name: null,
       last_name: 'Sharma',
       phone: null,
       province: 'California',
       zip: '43210'
     },
     line_items: [ [Object], [Object] ],
     fulfill_at: '2023-06-14T13:00:00-04:00',
    fulfill_by: null,
     international_duties: null,
     fulfillment_holds: [],
     delivery_method: {
       id: 500168786200,
       method_type: 'shipping',
      min_delivery_date_time: null,
       max_delivery_date_time: null
     },
     assigned_location: {
       address1: '1010 B Street',
      address2: null,
       city: 'San Rafael',
    country_code: 'US',
      location_id: 82896257304,
      name: '1010 B Street',
    phone: null,
      province: 'California',
      zip: '94901'
   },
    merchant_requests: []
  }
]

现在,我尝试使用以下命令创建履行请求

const test = await shopify.fulfillmentRequest.create(6278164939032,{
                 "fulfillment_order_id": 6278164939032,
                 "message":"Please fulfill this"
             })

但我得到HTTPError: Response code 422 (Unprocessable Entity)
当我尝试接受请求时,我得到相同的错误const test = await shopify.fulfillmentRequest.accept(6278164939032)
我知道422意味着我没有提供无效数据,但我不确定还需要提供什么数据。我将我的输入与www.example.com进行了比较https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillmentrequest#post-fulfillment-orders-fulfillment-order-id-fulfillment-request-accept,文档也给出了相同的输入。

nr7wwzry

nr7wwzry1#

解决了这个问题,并解释了如何将订单的Fulfillment Status设置为fulfilled这里是https://github.com/MONEI/Shopify-api-node/issues/609

相关问题