Skip to content
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

CIF-1329 - Reset the context data between checking out and showing the receipt #255

Merged
merged 8 commits into from
May 8, 2020

Conversation

herzog31
Copy link
Member

@herzog31 herzog31 commented Apr 20, 2020

Description

  • Reset the cart automatically after submitting a new order. For anonymous users this will not automatically create a new cart, but only after they add an item to the cart.
  • Checkout state is only reset after a user clicks on "Continue shopping" or reloads the page. Otherwise order information would not be available to be displayed on the order confirmation page.

How Has This Been Tested?

  • Added unit tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@herzog31 herzog31 added the bug Something isn't working label Apr 20, 2020
@codecov
Copy link

codecov bot commented Apr 20, 2020

Codecov Report

Merging #255 into master will increase coverage by 0.27%.
The diff coverage is 73.91%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #255      +/-   ##
============================================
+ Coverage     62.92%   63.20%   +0.27%     
  Complexity      752      752              
============================================
  Files           171      172       +1     
  Lines          5352     5360       +8     
  Branches        838      840       +2     
============================================
+ Hits           3368     3388      +20     
+ Misses         1868     1856      -12     
  Partials        116      116              
Flag Coverage Δ Complexity Δ
#jest 40.82% <73.91%> (+0.60%) 0.00 <0.00> (ø)
#karma 94.88% <ø> (ø) 0.00 <ø> (ø)
#unittests 85.15% <ø> (ø) 752.00 <ø> (ø)
Impacted Files Coverage Δ Complexity Δ
...-components/src/components/Checkout/useOverview.js 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...-components/src/components/Minicart/cartContext.js 73.91% <ø> (ø) 0.00 <0.00> (ø)
react-components/src/actions/user/actions.js 100.00% <100.00%> (ø) 0.00 <0.00> (?)
...t-components/src/components/Checkout/useReceipt.js 100.00% <100.00%> (+100.00%) 0.00 <0.00> (ø)
react-components/src/components/Minicart/footer.js 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...act-components/src/components/Minicart/minicart.js 93.75% <100.00%> (+0.41%) 0.00 <0.00> (ø)
react-components/src/context/UserContext.js 89.65% <100.00%> (+0.36%) 0.00 <0.00> (ø)
...ponents/src/components/Checkout/checkoutContext.js 35.29% <0.00%> (+8.82%) 0.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c927862...e284c6f. Read the comment docs.

@@ -144,6 +147,10 @@ const UserContextProvider = props => {
}
};

const resetCustomerCart = async () => {
await resetCustomerCartAction({ fetchCustomerCartQuery, dispatch });
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we should proxy this call. The components can bring their own query (in case of customizations) so maybe we should get that as an argument.

Copy link
Member Author

@herzog31 herzog31 Apr 23, 2020

Choose a reason for hiding this comment

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

I added the query as a argument to the exposed function.

@herzog31
Copy link
Member Author

herzog31 commented May 6, 2020

@dplaton can you have a look again please?

@laurentiumagureanu laurentiumagureanu merged commit d4f4d5b into master May 8, 2020
@laurentiumagureanu laurentiumagureanu deleted the issue/CIF-1329 branch May 8, 2020 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants