-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add addOrderFulfillmentGroup mutation #5027
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
Conversation
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
01ac097 to
3142561
Compare
Signed-off-by: Eric Dobbertin <[email protected]>
|
@kieckhafer This is now top priority of the order mutation PRs. After this is merged, it should be quick to use these same util functions to fix the issues in the other two PRs. |
|
Could you add an example query here? I'm having some trouble trying to figure out what's exactly required, especially with all the This is what I'm using as my mutation query: I'm getting this error: Aside from maybe having the IDs wrong (which I think woudl give me a different error), any idea what it might be? It is using / trying to use |
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
|
@kieckhafer I think this was due to the new group having no items, which I hadn't tested but is supposed to work. I've added a test and pushed some fixes now. Despite the name, |
|
@aldeed made it past the error I was seeing before, at this point now: Returns the error: Seems to be stemming from Seems like there is a lot of data needed to pass to this GQL query in order to make it work. It'll probably be easily accessible in the context of make the query in the Admin, but trying to figure out what's needed without having it available is a bit tough. Do you have an example of a query you used with all the needed data? |
in addShipmentMethodToGroup Signed-off-by: Eric Dobbertin <[email protected]>
items from fulfillment group Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
|
Updated the description with more specific steps and mutation example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am able to continuously add Fulfillment groups, with no limit, just by running the mutation over and over.
I started out with an order with 1 fulfillment group containing 2 items, each with a quantity of 5 (10 quantity overall).
I created a new fulfillmentGroup using this mutation and moved 1 item of 1 quantity over, and then had 2 fulfillmentGroups, one with the original items, now quantiies 5& 4, and one with the new item, quantity 1. This worked as expected.
Now the problem started. I just kept running the mutation over and over, without changing any of the input, and was able to create unlimited new fulfillmentGroups with the single item, quantity 1.
So after clicking it 16 times, I ended up with 17 fulfillmentGroups:
- The original group, now with two items, one quantity
5and onequantity4`. - 16 new
fulfillmentGroups, each with one item, quantity1.
The good news is that the order in general updated as it should when we split it up, so all those functions are working. I now had an order with 24 items in it:
https://gist.github.com/kieckhafer/4f7eb122cee4b744e72f3134c5cbdafc
This is the mutation I ran:
mutation {
addOrderFulfillmentGroup(
input: {
orderId: "cmVhY3Rpb24vb3JkZXI6UGJnZUc1NnZodHVvTWF3NFI=",
moveItemIds: ["cmVhY3Rpb24vb3JkZXJJdGVtOkEzN01BaWpNTG5hN0VpOFFl"],
fulfillmentGroup: {
data: {
shippingAddress: {
fullName: "Eric Dobbertin",
address1: "2110 Main St",
address2: "Suite 207",
city: "Santa Monica",
region: "CA",
postal: "90405",
country: "US",
phone: "6083209547",
isCommercial: false
}
}
selectedFulfillmentMethodId: "cmVhY3Rpb24vZnVsZmlsbG1lbnRNZXRob2Q6Skg1NGFOY2tvOEhwZTRzZFg=",
shopId: "cmVhY3Rpb24vc2hvcDpKOEJocTN1VHRkZ3daeDNyeg==",
type: shipping,
items: {
price: 2500.00,
quantity: 1,
productConfiguration: {
productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==",
productVariantId: "cmVhY3Rpb24vcHJvZHVjdDpDSm9SQm05dlJyb3JjOW14Wg=="
}
}
}
}
){
order {
_id
fulfillmentGroups {
_id
items {
edges {
node {
_id
}
}
}
}
}
}
}
|
See above... one big issue, but if that gets resolved, unless it triggers something else, it should be good to go. |
|
@kieckhafer This was confusing to me at first, but I think it's actually working as expected. Since you keep sending the same mutation, with the same order item ID in Can you confirm that's what's happening? If so, it sounds correct. |
|
If you were to remove the |
|
Keeping my original comment for posterity, but what was happening below is what is supposed to happen. For clarification, I was moving an item from one group to another, PLUS adding an additional item. I was basically doing both functions of this mutation at once. Makes sense what you said above, but something is still off... either that, or I'm not completely understanding what this mutation should be doing. My thought it splitting an item quantity off a group should move a certain quantity that item to a new group, but keep the original item in the original group, with a decremented quantity. ... I created an order that was What should happen is I have one fulfillment group with What happened was I now have a fulfillment group that has 1 item of quantity MUTATION: |
| * items array before calculating shipping, tax, surcharges, and totals. | ||
| * @param {Object} [billingAddress] The primary billing address for the order, if known | ||
| * @param {String|null} [cartId] ID of the cart from which the order is being placed, if applicable | ||
| * @param {Object} currencyCode Currency code for all money values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @@ -0,0 +1,52 @@ | |||
| import xformOrderGroupToCommonOrder from "./xformOrderGroupToCommonOrder"; | |||
|
|
|||
| /** | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mention we don't do surcharges per group in other changes here: https://github.com/reactioncommerce/reaction/pull/5027/files#diff-8ce970cbd524f077298082ab81660a4bR107
Is this still the case even with this new code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment should be clearer. We calculate them per group but they're only stored on the whole order, so we merge them all into one array. That's still true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible that's not correct, but I'd have to add surcharges to fulfillment group schema if we want to change it. Seems like something we can figure out later, when surcharges are more in use.
Part of #4999
Impact: minor
Type: feature
Changes
A new
addOrderFulfillmentGroupmutation allows you to add a fulfillment group to an existing order. You can provide new items for it and/or move items that are in another existing group.The operator UI does not yet implement this.
addOrderFulfillmentGroupcan be called internally to synchronize from an external system by settingcontext.isInternalCalltotrueaddOrderFulfillmentGroupcan be called through GraphQL by any user with "orders" permission for the shop that owns the orderBreaking changes
None
Testing
Specific Instructions
localStorage.getItem("Meteor.loginToken"). Copy the printed token."meteor-login-token": "JW6NV92VfuqlrhD1M1IbBovf2ELktkhGBPeMxW6y4bj"(the token you copied) propertyprimaryShopquery to get the primary shop IDBe sure to copy all of the IDs from your
orderByReferenceIdquery. Use apricethat is the correct price for the product+variant combination. Use the sameselectedFulfillmentOption.fulfillmentMethod._idas the existing group.