-
Notifications
You must be signed in to change notification settings - Fork 154
Conversation
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.
Looks like we need to add new module to
composer.json
(and regenerate composer.lock
)
@rogyar I have modified requirements slightly. We need to return cart ID hash for registered customers as well. Please let me know if you could do that change in current task, otherwise we will create a separate one. Sorry for the change, but this decision was made after the task was created. |
composer.json and composer.json added. Review is dismissed to unblock merge
*/ | ||
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) : Value | ||
{ | ||
$customerId = $context->getUserId(); |
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.
We should avoid working with global $context
object, it is possible to inject UserContextInterface
via constructor instead.
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.
That was my previous approach. But I saw that we already have UserContextInterface
within a scope of $context and it doesn't make sense to inject it once again.
Thank you for the tip, I will roll back the changes
# Conflicts: # composer.lock
-- Slight fixes
Description
Implementation of mutation for empty cart creation by the guest/customer user.
createEmptyCart
mutation is declared which accepts no arguments. It returns a hashed cart ID for guest customers and therealhashed quote ID for logged in customers. The customer status (logged in/guest) is performed by checking authorization headers of the request.Fixed Issues (if relevant)
Manual testing scenarios
Use the following query to create an empty shopping cart:
To test with logged in customer, obtain the customer token and provide it in the request headers.