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

Skip to content

Conversation

@aldeed
Copy link
Contributor

@aldeed aldeed commented Feb 14, 2019

Impact: minor
Type: bugfix

Issue

#4955 and #4965 added the ability for tax services to return customFields in the response. A couple bugs were found after merging.

  • When calculating for a cart, customFields on cart items and on taxSummary were not saved to the database
  • When calculating for an order, customFields on cart items were not saved to the database

Solution

All customFields returned by a tax service at any level are now saved in the database, for both cart and order.

On cart and order items, the field name in the database is customTaxFields as opposed to customFields because otherwise it would be unclear that they're related to taxes since they're saved directly on the item object. The tax service should still return them as customFields; the field name change is only in the database.

Breaking changes

None

Testing

  1. Temporarily update the calculateOrderTaxes function in the taxes-rates plugin to include customFields objects in the taxSummary, in one of the itemTaxes objects, and in one of the taxes objects.
  2. Add items to a cart and begin checking out, using a destination address for which the shop collects taxes.
  3. Once you see a tax amount on the checkout page, look in MongoDB to verify that all three expected customFields objects were saved in the Cart document.
  4. Finish checking out. Look in MongoDB to verify that all three expected customFields objects were saved in the Order document.

@aldeed aldeed requested a review from Akarshit February 14, 2019 17:39
@aldeed aldeed self-assigned this Feb 14, 2019
@aldeed aldeed added this to the πŸ” Torreys milestone Feb 14, 2019
@aldeed
Copy link
Contributor Author

aldeed commented Feb 14, 2019

@Akarshit This should fix the remaining issues with saving customFields for taxes. I have unit tests to prove it this time! πŸ˜„

@Akarshit Akarshit merged commit 504262b into develop Feb 14, 2019
@aldeed aldeed deleted the fix-aldeed-custom-fields branch February 15, 2019 21:33
@jeffcorpuz jeffcorpuz mentioned this pull request Mar 1, 2019
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