inventory icon indicating copy to clipboard operation
inventory copied to clipboard

REST API rest/all/V1/orders/create does not trigger "inventory_reservations_placement" plugin

Open atwixfirster opened this issue 5 years ago • 13 comments

REST API rest/all/V1/orders/create does not trigger inventory_reservations_placement plugin.

Preconditions (*)

Magento 2.3.3 with sample data

  1. Create OAuth tokens with access to create order resource
2787-01
  1. End point: https://INSTANCE/rest/all/V1/orders/create
  2. Method: PUT
  3. Content-Type: application/json
  4. JSON data to verify:
{
  "entity": {
    "base_currency_code": "USD",
    "base_discount_amount": 0,
    "base_discount_tax_compensation_amount": 0,
    "base_grand_total": 53.71,
    "base_shipping_amount": 5,
    "base_shipping_discount_amount": null,
    "base_shipping_incl_tax": null,
    "base_shipping_tax_amount": null,
    "base_subtotal": 45,
    "base_subtotal_incl_tax": 48.71,
    "base_tax_amount": 3.71,
    "base_to_global_rate": 1,
    "base_to_order_rate": 1,
    "base_total_due": 53.71,
    "base_total_paid": 0,
    "billing_address": {
      "address_type": "billing",
      "city": "Calder",
      "company": "",
      "country_id": "US",
      "customer_address_id": null,
      "email": "[email protected]",
      "entity_id": null,
      "firstname": "Veronica",
      "lastname": "Costello",
      "parent_id": null,
      "postcode": "49628-7978",
      "region": "MI",
      "region_code": null,
      "street": [
        "6146 Honey Bluff Parkway", ""
      ],
      "telephone": "0000000000"
    },
    "billing_address_id": null,
    "created_at": null,
    "customer_email": "[email protected]",
    "customer_firstname": "Veronica",
    "customer_group_id": 1,
    "customer_id": 1,
    "customer_is_guest": 0,
    "customer_lastname": "Costello",
    "customer_note_notify": null,
    "discount_amount": 0,
    "discount_tax_compensation_amount": 0,
    "email_sent": null,
    "entity_id": null,
    "extension_attributes": {
      "applied_taxes": null,
      "converting_from_quote": false,
      "item_applied_taxes": null,
      "shipping_assignments": [
        {
          "items": [
            {
              "additional_data": "",
              "base_cost": 45,
              "base_original_price": 45,
              "base_price": 45,
              "base_price_incl_tax": null,
              "base_row_total": 45,
              "base_row_total_incl_tax": 48.71,
              "base_tax_amount": 3.71,
              "created_at": null,
              "item_id": null,
              "name": "Push It Messenger Bag",
              "order_id": null,
              "original_price": 45,
              "price": 45,
              "price_incl_tax": 48.71,
              "product_id": 14,
              "product_type": "simple",
              "qty_ordered": 1,
              "row_total": 45.51,
              "row_total_incl_tax": 48.71,
              "sku": "24-MB06",
              "store_id": 1,
              "tax_amount": 3.71,
              "updated_at": null
            } ],
          "shipping": {
            "address": {
              "address_type": "shipping",
              "city": "Lynnwood,",
              "company": "",
              "country_id": "US",
              "customer_address_id": null,
              "email": "[email protected]",
              "entity_id": null,
              "firstname": "Veronica",
              "lastname": "Costello",
              "parent_id": null,
              "postcode": "98087-6266",
              "region": "WA",
              "region_code": null,
              "street": [
                "13724 39th Pl W",
                ""
              ],
              "telephone": "0000000000"
            },
            "method": "flatrate_flatrate",
            "total": {
              "base_shipping_amount": 5,
              "base_shipping_discount_amount": 0,
              "base_shipping_discount_tax_compensation_amnt": 0,
              "base_shipping_incl_tax": 5,
              "base_shipping_tax_amount": 0,
              "shipping_amount": 5,
              "shipping_discount_amount": 0,
              "shipping_discount_tax_compensation_amount": 0,
              "shipping_incl_tax": 5,
              "shipping_tax_amount": 0
            } }
        } ]
    },
    "global_currency_code": "USD",
    "grand_total": 49.90,
    "increment_id": null,
    "items": [
      {
        "additional_data": "232",
        "base_cost": 45,
        "base_original_price": 45,
        "base_price": 45,
        "base_price_incl_tax": null,
        "base_row_total": 45,
        "base_row_total_incl_tax": 48.71,
        "base_tax_amount": 3.71,
        "created_at": null,
        "item_id": null,
        "name": "Push It Messenger Bag",
        "order_id": null,
        "original_price": 45,
        "price": 45,
        "price_incl_tax": null,
        "product_id": 14,
        "product_type": "simple",
        "qty_ordered": 1,
        "row_total": 45,
        "row_total_incl_tax": 48.71,
        "sku": "24-WB04",
        "store_id": 1,
        "tax_amount": 3.71,
        "updated_at": null
      } ],
    "order_currency_code": "USD",
    "payment": {
      "account_status": null,
      "additional_information": null,
      "amount_ordered": 53.71,
      "amount_paid": 0,
      "base_amount_ordered": 53.71,
      "base_amount_paid": 0,
      "base_shipping_amount": 5.00,
      "cc_last4": null,
      "entity_id": null,
      "method": "checkmo",
      "parent_id": null,
      "shipping_amount": 5.00
    },
    "protect_code": null,
    "shipping_amount": 5.00,
    "shipping_description": "Ground - 4-7 Business Days",
    "shipping_discount_amount": null,
    "shipping_discount_tax_compensation_amount": 0,
    "shipping_incl_tax": 5.00,
    "shipping_tax_amount": null,
    "state": "new",
    "status": "pending",
    "status_histories": null,
    "store_currency_code": "USD",
    "store_id": 1,
    "store_name": null,
    "store_to_base_rate": 0,
    "store_to_order_rate": 0,
    "subtotal": 45.00,
    "subtotal_incl_tax": 48.71,
    "tax_amount": 3.71,
    "total_due": null,
    "total_item_count": 1,
    "total_paid": null,
    "total_qty_ordered": 1,
    "updated_at": null
  }
}
2787

Steps to reproduce (*)

  1. Place order with product which has the enabled "Manage Stock" option. In this example, I've used - 24-WB04

Expected result (*)

  1. Order is created via REST API call. Ordered item is reserved and exists in the inventory_reservation table
2787-02

Actual result (*)

  1. Order is created but ordered item is not reserved and does not exist in the inventory_reservation table

atwixfirster avatar Jan 29 '20 12:01 atwixfirster

Hi @atwixfirster. Thank you for your report. To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@atwixfirster do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

m2-assistant[bot] avatar Jan 29 '20 12:01 m2-assistant[bot]

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

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!


m2-assistant[bot] avatar Jan 29 '20 12:01 m2-assistant[bot]

@magento give me 2.4-develop instance

atwixfirster avatar Feb 14 '20 08:02 atwixfirster

Hi @atwixfirster. Thank you for your request. I'm working on Magento 2.4-develop instance for you

magento-engcom-team avatar Feb 14 '20 08:02 magento-engcom-team

Hi @atwixfirster, here is your Magento instance. Admin access: https://i-26575-2-4-develop.instances.magento-community.engineering/admin_227f Login: 76bc96ea Password: ed680f8f794c Instance will be terminated in up to 3 hours.

magento-engcom-team avatar Feb 14 '20 08:02 magento-engcom-team

Hi @dmytro-ch. 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:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [x] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [x] 5. Add label Issue: Confirmed once verification is complete.

  • [x] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Apr 10 '20 12:04 m2-assistant[bot]

:white_check_mark: Confirmed by @dmytro-ch Thank you for verifying the issue. Based on the provided information internal tickets MC-33287 were created

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

magento-engcom-team avatar Apr 10 '20 12:04 magento-engcom-team

Hi @atwixfirster. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Sep 15 '20 16:09 m2-assistant[bot]

Thank you!

lucenarenato avatar Sep 22 '20 12:09 lucenarenato

any update?

jonaschen623 avatar Apr 08 '21 23:04 jonaschen623

Hi, jonaschen623 !

any update?

I think you may create a patch from my fix - https://github.com/atwixfirster/magento2/commit/fd0058414d0f826539e7e43f3ba375cdbc6df7f4 and use it on your project.

Thanks

atwixfirster avatar Apr 09 '21 06:04 atwixfirster

Hi, jonaschen623 !

any update?

I think you may create a patch from my fix - atwixfirster/magento2@fd00584 and use it on your project.

Thanks

Is there a similar patch for Magento 2.4.5? Doesn't work with latest Magento.

javmage avatar Oct 31 '22 16:10 javmage

same issue here!

alex254 avatar Jan 24 '23 11:01 alex254