Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Update fulfillment endpoints #563

Merged
merged 2 commits into from
Dec 27, 2022
Merged

[api] Update fulfillment endpoints #563

merged 2 commits into from
Dec 27, 2022

Conversation

tkalliom
Copy link
Contributor

  • Add fulfillment.cancelV2 and fulfillment.listV2
  • Document old cancel, complete, create, open, and update as deprecated

resources/fulfillment.js Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Dec 21, 2022

Coverage Status

Coverage: 100.0%. Remained the same when pulling 34bd5de on tkalliom:fulfillment-api-changes into 6c2a086 on MONEI:master.

@FlavioAandres
Copy link

FlavioAandres commented Dec 22, 2022

@tkalliom
Hey guys, I'm trying to migrate the use cases for the new 2023-01 API update, and I just noticed we need to use the following:

  • POST /admin/api/2022-10/fulfillments.json instead of
  • POST /orders/{order_id}/fulfillments.json

Do you know if this library is supporting this change?? Thanks!!!
Ref: https://shopify.dev/api/release-notes/2022-07

index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
resources/fulfillment.js Outdated Show resolved Hide resolved
resources/fulfillment.js Outdated Show resolved Hide resolved
resources/fulfillment.js Outdated Show resolved Hide resolved
test/fulfillment.test.js Outdated Show resolved Hide resolved
test/fulfillment.test.js Outdated Show resolved Hide resolved
@lpinca
Copy link
Collaborator

lpinca commented Dec 23, 2022

@FlavioAandres the /orders/{order_id}/fulfillments.json seems to be still supported. See https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder#get-orders-order-id-fulfillment-orders.

Can you test it?

const shopify = new Shopify({
  shopName: 'xxx',
  apiVersion: '2023-01',
  accessToken: 'xxx'
});

const fulfillments = await shopify.fulfillment.list(orderId);

@lpinca
Copy link
Collaborator

lpinca commented Dec 23, 2022

@FlavioAandres I misread your comment, sorry. You can use:

const fulfillment = await shopify.fulfillment.createV2(params);

@lpinca
Copy link
Collaborator

lpinca commented Dec 27, 2022

Can you please split the commit in two?

  • [api] Add cancelV2 action to Fulfillment resource
  • [api] Add fulfillments action to FulfillmentOrder

@lpinca lpinca merged commit 8b39d87 into MONEI:master Dec 27, 2022
@lpinca
Copy link
Collaborator

lpinca commented Dec 27, 2022

Thank you.

@FlavioAandres
Copy link

@tkalliom Thanks for adding those changes, are really useful.
@lpinca Do you have an idea when these changes can be released to NPM?

@lpinca
Copy link
Collaborator

lpinca commented Dec 27, 2022

@FlavioAandres soon. I would also like to include #560 and #564 in the next release.

@tkalliom tkalliom deleted the fulfillment-api-changes branch January 2, 2023 11:28
@kristiandm
Copy link

kristiandm commented Mar 8, 2023

Hello, I'm kinda new to using this library so I apologize if my question is a bit weird. Can someone explain to me how to use createV2? we've been using create for a while but because of the 2023-01 change were trying to make createV2 work. What is the difference in using create and createV2 regarding the params? and how does createV2 know which order is for fulfillment without the orderId parameter like the create function has?

edit: I tried using it this way

const shopify = new Shopify({
shopName: merchant.domain,
apiVersion: '2023-01',
accessToken: merchant.shopifyToken,
});

    shopify.fulfillment.createV2({
              notify_customer: false,
              location_id: inventoryLocation?.id,
              order_id: order.orderId,
              line_items_by_fulfillment_order: [
                {
                  fulfillment_order_id: order.id,                    
                    ...(targetMerchant.serviceType === ServiceType.MARKETPLACE
                      ? {
                        fulfillment_order_line_items:  order.items.map((item: OrderItems) => {
                            return { id: toNumber(item.id) };
                          }),
                        }
                      : null) 
                }
              ]
            })
            
            but I received this error: "Shopify Open Fulfillment: {"errors":"The api_client does not have the required permission(s)."} , Order ID: 5b1707b0-5908-49a4-9372-9343c163715c , Merchant ID: 55530553543 , Error Message: Response code 403 (Forbidden)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants