magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Magento\Tax\Model\Quote\ToOrderConverter uses wrong type for extension attribute #6092

Open fooman opened 8 years ago

fooman commented 8 years ago

Preconditions (*)

  1. Magento 2.4-develop

Steps to reproduce (*)

  1. Look at code https://github.com/magento/magento2/blob/2.1/app/code/Magento/Tax/Model/Quote/ToOrderConverter.php

    $itemAppliedTaxesModified = [];
    if (!empty($itemAppliedTaxes)) {
       foreach ($itemAppliedTaxes as $key => $itemAppliedTaxItem) {
           if (is_array($itemAppliedTaxItem) && !empty($itemAppliedTaxItem)) {
               foreach ($itemAppliedTaxItem as $itemAppliedTax) {
                   $itemAppliedTaxesModified[$key]['type'] = $itemAppliedTax['item_type'];
                   $itemAppliedTaxesModified[$key]['item_id'] = $itemAppliedTax['item_id'];
                   $itemAppliedTaxesModified[$key]['associated_item_id'] = $itemAppliedTax['associated_item_id'];
                   $itemAppliedTax['extension_attributes']['rates'] = $itemAppliedTax['rates'];
                   unset($itemAppliedTax['rates']);
                   $itemAppliedTaxesModified[$key]['applied_taxes'][] = $itemAppliedTax;
               }
           }
       }
       $extensionAttributes->setItemAppliedTaxes($itemAppliedTaxesModified);

vs

https://github.com/magento/magento2/blob/2.1/app/code/Magento/Tax/etc/extension_attributes.xml#L14

<extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
    <attribute code="applied_taxes" type="Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxInterface[]" />

resulting in Magento\Sales\Api\Data\OrderExtensionInterface (in generated folder)

/**
 * @return \Magento\Tax\Api\Data\OrderTaxDetailsItemInterface[]|null
 */
public function getItemAppliedTaxes();

/**
 * @param \Magento\Tax\Api\Data\OrderTaxDetailsItemInterface[] $itemAppliedTaxes
 * @return $this
 */
public function setItemAppliedTaxes($itemAppliedTaxes);

Expected result (*)

  1. ExtensionAttributes should be used with the defined interface: array of Magento\Tax\Api\Data\OrderTaxDetailsItemInterface
  2. A developer can trust the stated defined return value

    Actual result (*)

  3. a standard php array is used
fooman commented 8 years ago

@andimov thanks for looking into this - I'd currently would label this a bug rather than an improvement

magento-engcom-team commented 7 years ago

@fooman, thank you for your report. We've created internal ticket(s) MAGETWO-83472 to track progress on the issue.

magento-engcom-team commented 6 years ago

Hi @fooman

This ticket has been marked as "Triage Wanted" due to low user involvement over time. Over the next 2 weeks we are looking for additional community feedback to decide if it should be archived or not. More information on this is available on the GitHub wiki.

Thank you for collaboration.

fooman commented 6 years ago

Still an issue on 2.3-develop

magento-engcom-team commented 6 years ago

Hi @vasilii-b. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

vasilii-b commented 6 years ago

Hi @magento-engcom-team, I'll have a look into this one. Thank you!

magento-engcom-team commented 5 years ago

Hi @routbiplab. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

m2-assistant[bot] commented 4 years ago

Hi @engcom-Echo. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


m2-assistant[bot] commented 4 years ago

Hi @engcom-Charlie. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

magento-engcom-team commented 4 years ago

:white_check_mark: Confirmed by @engcom-Charlie Thank you for verifying the issue. Based on the provided information internal tickets MC-30055 were created

Issue Available: @engcom-Charlie, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

sergey-solo commented 4 years ago

@magento I am working on this

KrasnoshchokBohdan commented 2 years ago

@magento I am working on this

yogesh-valiya commented 1 year ago

@magento I am working on this

Zaahed commented 1 year ago

@magento I'm working on this