Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Query for retrieving shopping cart information #266

Merged
merged 5 commits into from
Feb 1, 2019

Conversation

rogyar
Copy link
Contributor

@rogyar rogyar commented Nov 28, 2018

Description (*)

This PR introduces the possibility to retrieve shopping cart information for guests and registered users by cart_id.

Fixed Issues (if relevant)

  1. [Cart Operations] Fetch guest shopper cart #8: [Query] Fetch guest shopper cart
  2. [Cart Operations] Fetch registered shopper cart #66: [Query] Fetch registered shopper cart

Manual testing scenarios (*)

  1. Create a shopping cart (optionally add items, set shipping method) and retrieve the shopping cart id (hashed)
  2. Use the cart id to retrieve shopping cart information
{
  Cart(cart_id: "fda39cfe15aabde6d3c362cb3878de5s") {
    applied_coupon {
    	  code
    }
    items {
      id
    }
    addresses {
      firstname,
      lastname,
      address_type
    }
  }
}

@@ -9,3 +9,11 @@
->setIsMultiShipping(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add rollback for this fixture

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rollback for the mentioned fixture exists (active_quote_rollback.php). As for masked id - the corresponding database entry is being removed when the quote is removed, so the current rollback works for masked ids as well (have just double checked this behavior)

@@ -0,0 +1,171 @@
<?php /** @noinspection SpellCheckingInspection */
Copy link
Contributor

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 remove this string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it's PHPStorm stuff. Removed :)

public function testGetCartForGuest()
{
$reservedOrderId = 'test_order_1';
$this->quoteResource->load(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to load Quote?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me shed some light here.
I use this fixture because we perform tests for this quote. I use this fixture since it assigns maskedQuoteId to the quote. Also, this fixture provides a guest quote (it's not assigned to a customer)
So, the flow is: we load the guest quote, we perform tests for the guest quote.

As for the model loading, we need to get maskedQuoteId somehow but we don't have a quoteId that can be used for quoteIdToMaskedId service (only reservedOrderId). So, I load the model for retrieving quoteId.

@ghost
Copy link

ghost commented Feb 1, 2019

Hi @rogyar, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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

Successfully merging this pull request may close these issues.

4 participants