Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aldeed
Copy link
Contributor

@aldeed aldeed commented Sep 20, 2018

Resolves #4630
Impact: minor
Type: feature

Changes

Migrate existing data for cart and orders after an upgrade

Breaking changes

No, quite the opposite hopefully

Testing

  1. Check out master
  2. Run Reaction and do complete checkout flow for anonymous and logged in. Also add some more items to carts that you do not check out. With at least one of the carts, do the checkout flow but don't click the final place order button. The goal is to have some carts in various stages of data collection, and some orders for different types of users.
    • It can be good to also enable taxes and add some taxes for your shipping postal code, since some of the conversions are related to taxes.
    • I recommend having at least one order paid for with "example" method and at least one paid for with a credit card through Stripe package.
  3. Stop Reaction and check out this branch.
  4. In the Migrations collection in MongoDB, make sure that the control document has locked === false and a version at or less than 38.
  5. Run Reaction and verify that you see a message on startup that it ran the migrations up to version 40.
  6. Smoke test in the app, including running the existing converted orders through all possible statuses.

@aldeed aldeed self-assigned this Sep 20, 2018
@aldeed aldeed added this to the North Maroon milestone Sep 20, 2018
@aldeed aldeed changed the title [WIP] 2.0 migrations 2.0 migrations Sep 20, 2018
@aldeed aldeed requested a review from brent-hoover September 20, 2018 23:10
@brent-hoover
Copy link
Collaborator

brent-hoover commented Sep 20, 2018

Started on 1.16, created some orders. Migrated to 2.0. If I try to capture an order placed before migration I see this error:

   { Error: Tax rate is required (shipping.0.items.0.taxRate) in Orders update [400]
    at getErrorObject (packages/aldeed:collection2/collection2.js:504:28)
    at doValidate (packages/aldeed:collection2/collection2.js:470:13)
Exception while invoking method 'orders/capturePayments' { Error: Tax rate is required (shipping.0.items.0.taxRate) in Orders update
    at getErrorObject (packages/aldeed:collection2/collection2.js:498:17)
    at doValidate (packages/aldeed:collection2/collection2.js:470:13)

@brent-hoover
Copy link
Collaborator

I created an account in previous version, then tried to checkout with that account and got a blank block for shipping until I edited and resaved the address. Only happened the first time. Not sure it's necessarily related to this PR.

@brent-hoover
Copy link
Collaborator

Trying to check out with Example payment enabled there a problem with the payment form;

2018-09-21_08-04-55

Copy link
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

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

A couple of bugs and one question


// Set `cart.billingAddress`
if (!cart.billingAddress && Array.isArray(cart.billing) && cart.billing[0]) {
convertedCart.billingAddress = cart.billing[0].address;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it going to cause a problem if they have more than one billing address and that doesn't get converted? Or are we throwing those addresses away? If so should we use the "default" rather than just the first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do we define default? I believe billing address was previously set on either all items in billing array, or just the first, which either way should work for this approach. But I agree it smells bad, so maybe I'll have it use the first item in billing array where address is set.

The worst case here is that someone halfway through checkout out will have to re-enter their billing address, so this part is low risk.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I might be getting cart and addressbook mixed up but the address that has the blue checkmark during checkout. It's true that at worst they would need to re-enter/re-select an address.

@aldeed
Copy link
Contributor Author

aldeed commented Sep 21, 2018

@zenweasel

  • taxRate error I can fix. Any chance you saved off the order document from the DB before you migrated?
  • I think I've seen that address issue on 1.x before. Not sure exactly how it happens.
  • That's what the payment form looks like now. It's Example IOU payment type and requires only that you enter a name, to avoid confusing it with a payment package that they should actually use.

@brent-hoover
Copy link
Collaborator

@aldeed I didn't save it but i just created an order with no tax method enabled. Just realized I didn't test marketplace orders. Should I do it again to test it?

@aldeed
Copy link
Contributor Author

aldeed commented Sep 21, 2018

That's fine, I figured out the tax rate thing. I don't think we're testing marketplace anymore, although I did write it in a way that should handle marketplace orders.

@aldeed
Copy link
Contributor Author

aldeed commented Sep 21, 2018

@zenweasel Pushed fixes for those two issues.

@brent-hoover
Copy link
Collaborator

@aldeed Starting to test now

@brent-hoover
Copy link
Collaborator

Again not sure if this is related to this PR and will try to test but I see this weird thing (notice that tax was not enabled)

http://g.recordit.co/z6VsMIn97w.gif

@aldeed
Copy link
Contributor Author

aldeed commented Sep 21, 2018

@zenweasel I don't think it's related but I saw that, too, and @jeffcorpuz reproduced it. I believe he made a separate issue for it.

@aldeed
Copy link
Contributor Author

aldeed commented Sep 21, 2018

If you close the panel and then click >, it updates correctly. Just does not switch the open panel state.

@aldeed aldeed merged commit 43d5b9e into release-2.0.0 Sep 21, 2018
@aldeed aldeed deleted the feat-4630-aldeed-2.0-migration branch September 21, 2018 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants