magento / inventory

Magento Inventory Project (a.k.a MSI)
Open Software License 3.0
337 stars 248 forks source link

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

Open atwixfirster opened 4 years ago

atwixfirster commented 4 years ago

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": "roni_cost@example.com",
      "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": "roni_cost@example.com",
    "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": "roni_cost@example.com",
              "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
m2-assistant[bot] commented 4 years ago

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

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?


m2-assistant[bot] commented 4 years ago

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:


atwixfirster commented 4 years ago

@magento give me 2.4-develop instance

magento-engcom-team commented 4 years ago

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

magento-engcom-team commented 4 years ago

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.

m2-assistant[bot] commented 4 years ago

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:

magento-engcom-team commented 4 years ago

: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.

m2-assistant[bot] commented 4 years ago

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


lucenarenato commented 4 years ago

Thank you!

jonaschen623 commented 3 years ago

any update?

atwixfirster commented 3 years ago

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

javmage commented 2 years ago

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.

alex254 commented 1 year ago

same issue here!