[API][Checkout] Cover scenarios for checking promotions#11749
Merged
Conversation
Member
GSadee
commented
Aug 19, 2020
| Q | A |
|---|---|
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Related tickets | |
| License | MIT |
d0048f7 to
0f3f5f5
Compare
AdamKasp
approved these changes
Aug 20, 2020
lchrusciel
approved these changes
Aug 20, 2020
| public function shouldBeAppliedToMyOrder(string $promotionName): void | ||
| { | ||
| $response = $this->client->show($this->sharedStorage->get('cart_token')); | ||
| Assert::notFalse(array_search($promotionName, array_column($this->getAdjustmentsForOrder(), 'label'))); |
Contributor
There was a problem hiding this comment.
This extraction logic seems like a good candidate for placing it in separate private method
| /** | ||
| * @Then :promotionName should be applied to my order shipping | ||
| */ | ||
| public function shouldBeAppliedToMyOrderShipping(string $promotionName): void |
Contributor
There was a problem hiding this comment.
Can we merge it with the previous step?
| } | ||
|
|
||
| /** | ||
| * @Then /^the ("[^"]+" product) should have unit price discounted by ("\$\d+")$/ |
Contributor
There was a problem hiding this comment.
Why didn't you use our price transformation here?
| { | ||
| $response = $this->client->customAction( | ||
| sprintf('/new-api/orders/%s/items/%s/adjustments', $this->sharedStorage->get('cart_token'), $itemId), | ||
| HttpRequest::METHOD_GET); |
Contributor
There was a problem hiding this comment.
Suggested change
| HttpRequest::METHOD_GET); | |
| HttpRequest::METHOD_GET) | |
| ; |
| </itemOperations> | ||
|
|
||
| <subresourceOperations> | ||
| <subresourceOperation name="api_order_items_adjustments_get_subresource"> |
Contributor
There was a problem hiding this comment.
What is the difference between these two operations?
Member
Author
| ->shouldReturn(false) | ||
| ; | ||
|
|
||
| $context['subresource_identifiers'] = ['id' => 'TOKEN']; |
Contributor
There was a problem hiding this comment.
We should test the version with items as well
Contributor
|
Thank you, Grzegorz! 🎉 |
arti0090
reviewed
Aug 20, 2020
|
|
||
| return | ||
| is_a($resourceClass, AdjustmentInterface::class, true) && | ||
| isset($subresourceIdentifiers['id']) && |
Contributor
There was a problem hiding this comment.
It is possible to merge it to isset($subresourceIdentifiers['id'], $subresourceIdentifiers['items']) 🚀
lchrusciel
added a commit
that referenced
this pull request
Aug 20, 2020
This PR was merged into the 1.8-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | fixes for review from #11749 | License | MIT Commits ------- 2b41ca9 [API] Minor fixes for adjustments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
