Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Flexible pricing endpoints #1301
Flexible pricing endpoints #1301
Changes from all commits
d97155c
9836416
5f54e73
3f1e1c2
80e6346
65c7c55
cc0d322
c6594db
02462f0
6e32d77
a4f9432
480b77b
46b2173
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Because we are using this endpoint directly in FTW I added the lineItem validation here in estimated transaction branch (b9ba586) but now I noticed that this is also used in the other endpoints internally so I'm thinking should we add some flag (e.g. validateLineItems true/false) to the API call or do something else. Anyway, I think it might be clearer to move these changes to this PR.
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.
Hmm, is there any harm in always validating the line items? Then it could be inside the
transactionLineItems
helper.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 don't think there should be any harm but it's just extra step that is not always needed. If I understood correctly Marketplace API should anyway calculate the lineTotal even if the total is already passed in the API request and check that these values match.
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.
Ok, now I understand. It doesn't make sense to add the totals if the line items are sent to the Marketplace API that also adds them. It would be just confusing. But the UI needs those for the line items endpoint.
I think a separate function is cleaner than an option, so your changes in the commit you linked seem good IMO. The other places that use line items are sending those to the Marketplace API, and shouldn't add the line totals. Or am I missing something?
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.
Now I checked the code again and realized that I got little confused. Somehow I thought that we are calling the transaction line items endpoint in initiate transaction endpoint too but obviously we are just using the transactionLineItems helper function there. So my bad... (but makes me wonder if we should think about the name of the function again).
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.
Yeah, I understand the confusion. Maybe you were confused as the API helper name for the endpoint is the same as the line item util function? I wouldn't rename the functions, most customizers will only have to deal with the util function...