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.53k stars 9.31k forks source link

We are not getting the product_type and parent_item_id inside refund #38328

Open webgility-amazonapi opened 9 months ago

webgility-amazonapi commented 9 months ago

Preconditions and environment

API Url: http://php72.webgility.com/magento230_test/index.php/rest/V1/creditmemos?searchCriteria[filter_groups][0][filters][0][field]=order_id&searchCriteria[filter_groups][0][filters][0][value]=410

Response { "items": [ { "adjustment": 0, "adjustment_negative": 0, "adjustment_positive": 0, "base_adjustment": 0, "base_adjustment_negative": 0, "base_adjustment_positive": 0, "base_currency_code": "USD", "base_discount_amount": 0, "base_grand_total": 5009, "base_discount_tax_compensation_amount": 0, "base_shipping_amount": 5.24, "base_shipping_incl_tax": 5.5, "base_shipping_tax_amount": 0.26, "base_subtotal": 4979.51, "base_subtotal_incl_tax": 5003.5, "base_tax_amount": 24.25, "base_to_global_rate": 1, "base_to_order_rate": 1, "billing_address_id": 809, "created_at": "2023-12-29 11:30:20", "discount_amount": 0, "entity_id": 64, "global_currency_code": "USD", "grand_total": 5009, "discount_tax_compensation_amount": 0, "increment_id": "000000058", "order_currency_code": "USD", "order_id": 410, "shipping_address_id": 808, "shipping_amount": 5.24, "shipping_incl_tax": 5.5, "shipping_tax_amount": 0.26, "state": 2, "store_currency_code": "USD", "store_id": 1, "store_to_base_rate": 0, "store_to_order_rate": 0, "subtotal": 4979.51, "subtotal_incl_tax": 5003.5, "tax_amount": 24.25, "updated_at": "2023-12-29 11:30:20", "items": [ { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 35.24, "base_price_incl_tax": 37, "base_row_total": 35.24, "base_row_total_incl_tax": 37, "base_tax_amount": 1.76, "base_weee_tax_row_disposition": 0, "entity_id": 105, "discount_tax_compensation_amount": 0, "name": "Dennis Lingo Shirt", "order_item_id": 547, "parent_id": 64, "price": 35.24, "price_incl_tax": 37, "product_id": 171, "qty": 1, "row_total": 35.24, "row_total_incl_tax": 37, "sku": "SKU_DennisLingoShirt", "tax_amount": 1.76, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 30, "base_price_incl_tax": 31.5, "base_row_total": 30, "base_row_total_incl_tax": 31.5, "base_tax_amount": 1.5, "base_weee_tax_row_disposition": 0, "entity_id": 106, "discount_tax_compensation_amount": 0, "name": "Puma Shoes", "order_item_id": 548, "parent_id": 64, "price": 30, "price_incl_tax": 31.5, "product_id": 170, "qty": 1, "row_total": 30, "row_total_incl_tax": 31.5, "sku": "SKU_Puma Shoes-Red", "tax_amount": 1.5, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_price": 0, "entity_id": 107, "name": "Puma Shoes-Red_U", "order_item_id": 549, "parent_id": 64, "price": 0, "product_id": 168, "qty": 1, "sku": "SKU_Puma Shoes-Red" }, { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 0.95, "base_price_incl_tax": 1, "base_row_total": 9.52, "base_row_total_incl_tax": 10, "base_tax_amount": 0.48, "base_weee_tax_row_disposition": 0, "entity_id": 108, "discount_tax_compensation_amount": 0, "name": "Apsara pencil", "order_item_id": 550, "parent_id": 64, "price": 0.95, "price_incl_tax": 1, "product_id": 235, "qty": 10, "row_total": 9.52, "row_total_incl_tax": 10, "sku": "Apsara pencil", "tax_amount": 0.48, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_price": 30, "base_price_incl_tax": 30, "base_row_total": 4500, "base_row_total_incl_tax": 4500, "base_weee_tax_row_disposition": 0, "entity_id": 109, "name": "Pikachu Soft toy", "order_item_id": 551, "parent_id": 64, "price": 30, "price_incl_tax": 30, "product_id": 130, "qty": 150, "row_total": 4500, "row_total_incl_tax": 4500, "sku": "Pikachu Soft toy", "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_price": 9.52, "base_price_incl_tax": 10, "entity_id": 110, "name": "Sprite Yoga Strap Dynamic Bundle", "order_item_id": 552, "parent_id": 64, "price": 9.52, "price_incl_tax": 10, "product_id": 5, "qty": 1, "sku": "24-WG085-bundle-dynamic-24-WG085" }, { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 9.52, "base_price_incl_tax": 10, "base_row_total": 9.52, "base_row_total_incl_tax": 10, "base_tax_amount": 0.48, "base_weee_tax_row_disposition": 0, "entity_id": 111, "discount_tax_compensation_amount": 0, "name": "Sprite Yoga Strap 6 foot", "order_item_id": 553, "parent_id": 64, "price": 9.52, "price_incl_tax": 10, "product_id": 1, "qty": 1, "row_total": 9.52, "row_total_incl_tax": 10, "sku": "24-WG085", "tax_amount": 0.48, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 23.81, "base_price_incl_tax": 25, "base_row_total": 23.81, "base_row_total_incl_tax": 25, "base_tax_amount": 1.19, "base_weee_tax_row_disposition": 0, "entity_id": 112, "discount_tax_compensation_amount": 0, "name": "Sprite Yoga Strap Fixed Bundle", "order_item_id": 554, "parent_id": 64, "price": 23.81, "price_incl_tax": 25, "product_id": 6, "qty": 1, "row_total": 23.81, "row_total_incl_tax": 25, "sku": "24-WG085-bundle-fixed", "tax_amount": 1.19, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_price": 0, "entity_id": 113, "name": "Sprite Yoga Strap 8 foot", "order_item_id": 555, "parent_id": 64, "price": 0, "product_id": 2, "qty": 1, "sku": "24-WG086" }, { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 176.19, "base_price_incl_tax": 185, "base_row_total": 176.19, "base_row_total_incl_tax": 185, "base_tax_amount": 8.81, "base_weee_tax_row_disposition": 0, "entity_id": 114, "discount_tax_compensation_amount": 0, "name": "Bags-Green", "order_item_id": 556, "parent_id": 64, "price": 176.19, "price_incl_tax": 185, "product_id": 182, "qty": 1, "row_total": 176.19, "row_total_incl_tax": 185, "sku": "SKU_Bags-Green", "tax_amount": 8.81, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 185.71, "base_price_incl_tax": 195, "base_row_total": 185.71, "base_row_total_incl_tax": 195, "base_tax_amount": 9.29, "base_weee_tax_row_disposition": 0, "entity_id": 115, "discount_tax_compensation_amount": 0, "name": "Bags-Pink", "order_item_id": 557, "parent_id": 64, "price": 185.71, "price_incl_tax": 195, "product_id": 183, "qty": 1, "row_total": 185.71, "row_total_incl_tax": 195, "sku": "SKU_Bags-Pink", "tax_amount": 9.29, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 }, { "base_cost": null, "base_discount_tax_compensation_amount": 0, "base_price": 9.52, "base_price_incl_tax": 10, "base_row_total": 9.52, "base_row_total_incl_tax": 10, "base_tax_amount": 0.48, "base_weee_tax_row_disposition": 0, "entity_id": 116, "discount_tax_compensation_amount": 0, "name": "GOOGLE", "order_item_id": 558, "parent_id": 64, "price": 9.52, "price_incl_tax": 10, "product_id": 281, "qty": 1, "row_total": 9.52, "row_total_incl_tax": 10, "sku": "GOOGLE", "tax_amount": 0.48, "weee_tax_applied": "[]", "weee_tax_applied_row_amount": 0, "weee_tax_row_disposition": 0 } ], "comments": [] } ], "search_criteria": { "filter_groups": [ { "filters": [ { "field": "order_id", "value": "410", "condition_type": "eq" } ] } ] }, "total_count": 1 }

Steps to reproduce

We hit the API http://php72.webgility.com/magento230_test/index.php/rest/V1/creditmemos?searchCriteria[filter_groups][0][filters][0][field]=order_id&searchCriteria[filter_groups][0][filters][0][value]=410

We found in the response we are not getting the product_type and parent_item_id inside the refund response, while we are getting that in the order response

Expected result

product_type and parent_item_id should return in the refund response

Actual result

Not getting the product_type and parent_item_id inside refund

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 9 months ago

Hi @webgility-amazonapi. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 9 months ago

Hi @engcom-Bravo. 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:

engcom-Bravo commented 9 months ago

Hi @webgility-amazonapi,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.

Steps to reproduce

We hit the API http://php72.webgility.com/magento230_test/index.php/rest/V1/creditmemos?searchCriteria[filter_groups][0][filters][0][field]=order_id&searchCriteria[filter_groups][0][filters][0][value]=410

Screenshot from 2024-01-04 15-08-36

product_type and parent_item_id is returned in the refund response.

Kindly recheck the behaviour on Magento 2.4-develop instance and elaborate steps to reproduce if the issue is still reproducible.

Thanks.

webgility-amazonapi commented 9 months ago

Hello @engcom-Bravo

Thanks for your reply.

Let us refresh our question again, we want the product_type and parent_item_id in the refund response not parent_id.

So we request you to please check this.

Thanks & BR Webgility

engcom-Bravo commented 9 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 9 months ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 9 months ago

Hi @engcom-Bravo, here is your Magento Instance: https://0e504a2db8e6a26b766fa26a77ba2c6c.instances-prod.magento-community.engineering Admin access: https://0e504a2db8e6a26b766fa26a77ba2c6c.instances-prod.magento-community.engineering/admin_3144 Login: b66d6d0b Password: 24bbd90fdd00

engcom-Bravo commented 9 months ago

Hi @webgility-amazonapi,

Thanks for your update.

Screenshot from 2024-01-05 14-55-49

Screenshot from 2024-01-05 14-56-06

We are getting parent_id in the response.

As per the document https://developer.adobe.com/commerce/webapi/rest/quick-reference/ there is no such field product_type mentioned in the document Kindly refer the document.

Thanks

webgility-amazonapi commented 9 months ago

Could you provide clarification on the purpose of the "parent_id" field? In our previous correspondence, we observed that the "parent_id" value is consistently set to 64 for all items. Could you shed light on the significance of this value?

In the context of Magento responses, when dealing with bundle items, Magento includes both the bundle item and its associated simple items. However, during total calculations, Magento internally considers only one item. To address this, we require the inclusion of "product_type" and "parent_item_id" fields. This is especially crucial in cases of bundle item refunds, as distinguishing between the bundle product and its associated items becomes challenging without these fields.

We hope this clarifies the necessity of having the "product_type" and "parent_item_id" fields for our specific use case involving bundle item refunds.

engcom-Bravo commented 9 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 9 months ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 9 months ago

Hi @engcom-Bravo, here is your Magento Instance: https://0e504a2db8e6a26b766fa26a77ba2c6c.instances-prod.magento-community.engineering Admin access: https://0e504a2db8e6a26b766fa26a77ba2c6c.instances-prod.magento-community.engineering/admin_f05c Login: 441262f8 Password: 3e88be8a6f5a

engcom-Bravo commented 9 months ago

Hi @webgility-amazonapi,

Thanks for your update.

Regarding parent_id it might be possible all related child products are related to same parent product so in that case the value will be same.

As per Document https://developer.adobe.com/commerce/webapi/rest/quick-reference/ the product_type is not mentioned in the responses.

Hence we are considering this as Feature Request because it will be a good feature to have while creditmemo having different types of products.

Thanks.

webgility-amazonapi commented 9 months ago

Thanks for considering this as feature request , could you provide the estimated time when can we expect this from your end so that we can plan our deliveries accordingly? Also for parent_id, if you check the order of this refund , its incorrect. In order response the parent_id for the same item is different , I would request to check your parent_id logic inside refund, as it is working absolutely fine in case of order.

webgility-amazonapi commented 9 months ago

Any update on this issue?