taxjar / taxjar-magento2-extension

Magento 2 Sales Tax Extension by TaxJar
http://www.taxjar.com/guides/integrations/magento2/
Open Software License 3.0
22 stars 30 forks source link

fix: Order repository plugin pass object by reference #248

Closed sethobey closed 2 years ago

sethobey commented 2 years ago

Context

Encountered error while testing plugin method OrderRepository::afterGetList() in v2.3.7-p2 due to attempted overwrite of existing data array keys.

Description

We can avoid the need to retrieve/set items on collection entirely with for-loop/pass-object-by-reference to instead modify the underlying object.

Performance

N/A

Testing

Error is visible in Bulk Transaction Sync UI

Steps to recreate

  1. Deploy Luma sample data
  2. As admin, navigate to Stores->Configuration->Sales->Tax
  3. Enable transaction sync
  4. Click "Sync Transactions" button in config UI
  5. Init transaction sync over current date range (as sample data created_at dates should match date of sample data deployment)
  6. Without fix, v2.3 will emit error "Item with the same ID already exists "Magento\Sales\Model\Order\Interceptor" from Taxjar\SalesTax\Plugin\Sales\Model\OrderRepository::class.
  7. With fix, no error observed.

Versions