classyllama / ClassyLlama_AvaTax

This extension has been deprecated in favor of https://github.com/avadev/Avalara-AvaTax-for-Magento2
Open Software License 3.0
23 stars 15 forks source link

AVS-421_116 - Start structure and functionality for AssociatedTaxables #213

Closed sjb9774 closed 5 years ago

sjb9774 commented 5 years ago

Summary

Associated Taxables are used by Gift Wrapping, WEEE Tax, and some 3rd party extension to allow calculcating tax for orders on items that are not technically "items" in the Magento sense. This commit begins the basic functionality of persisting the Associated Taxable information from the order step so it can be re-transmitted to Avalara at the time of invoice processing.

Description

  1. The Associated Taxable persistence begins at in the QuoteSubmitSuccessObserver
    1. Each item in the quote is iterated over and the associated taxables saved each in their own row within the avatax_associated_taxables table. An example of an Associated Taxable at the item level is gift wrapping.
    2. The quote is checked for Associated Taxables, if they exist then they are also saved to the avatax_associated_taxables table with the associated_item_code of 'quote' and a NULL order_item_id to distinguish them from item-level taxables. An example of a quote-level associated taxable is a printed gift card
  2. We don't care about these Associated Taxables again until an invoice is created for the order, I've added code to the existing Invoice aroundSave plugin that gets the associated taxables tied to each item invoiced and all the quote level items if they've not yet been invoiced and fills their invoice_id column with the invoice's id to indicate they are now associated with that invoice and should be used when the AvaTax queue is processed.
  3. I added code to the getTaxRequestForSalesObject (which is used to build the request that will be sent to Avalara for a given invoice or credit memo when the queue is processed) that pulls in all Associated Taxables associated with that invoice or creditmemo and builds them into lines that will be sent to Avalara.

Associated Taxables Example Data

avatax_associated_taxables 2019-01-29 10-08-10

Things that need to be tested

rsisco commented 5 years ago

@sjb9774 - Is the "Note" in your PR comment still applicable?

sjb9774 commented 5 years ago

@rsisco Yes, there are still a few specific scenarios I'd like to test that could impact a few places in the code but I think the bulk of the code review would not be affected.

erikhansen commented 5 years ago

For the record, future work on this PR was put on hold, awaiting approval from Avalara to move forward on it.

Internal task link: AVS-421_116

erikhansen commented 5 years ago

Closing this PR, per my comment in the related issue.