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.48k stars 9.29k forks source link

Place order with disabled Payment method working #37983

Open dimitriBouteille opened 1 year ago

dimitriBouteille commented 1 year ago

Preconditions and environment

The bug is testable in graphQl with checkmo. However :

Steps to reproduce

{
    "data": {
        "cart": {
            "available_payment_methods": [
                {
                    "code": "adyen_cc",
                    "title": "Credit or Debit Card"
                },
                {
                    "code": "affirm_gateway",
                    "title": "Affirm"
                }
            ]
        }
    }
}

this mutation return The requested Payment Method is not available. error, but quote_payment.method column is updated with checkmo.

Expected result

When saving the payment method and placeOrder, the following error should be reported: The requested Payment Method is not available.

Capture d’écran du 2023-09-12 12-26-53

When the setPaymentMethodOnCart mutation is called, there is an error, the quote_payment table should not be updated.

\Magento\Quote\Model\Quote\Payment::importData()

Actual result

The order is created :(

Additional information

mutation setPaymentMethodAndPlaceOrder(
  $cartId: String!
  $paymentMethod: PaymentMethodInput!
) {
  setPaymentMethodOnCart(
    input: { cart_id: $cartId, payment_method: $paymentMethod }
  ) {
    cart {
      selected_payment_method {
        code
        title
      }
    }
  }

  placeOrder(input: { cart_id: $cartId }) {
    order {
      order_number
    }
  }
}
{
    "cartId": "CART_TOKEN",
    "paymentMethod": {
        "code": "checkmo"
    }
}

Capture d’écran du 2023-09-12 15-19-05

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @dimitriBouteille. 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 1 year 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:

dimitriBouteille commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @dimitriBouteille. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @dimitriBouteille, here is your Magento Instance: https://a1fe3ae8511747381cac27ce90793387.instances-prod.magento-community.engineering Admin access: https://a1fe3ae8511747381cac27ce90793387.instances-prod.magento-community.engineering/admin_028a Login: ef78aade Password: a4c76a83165f

engcom-Bravo commented 1 year ago

Hi @dimitriBouteille,

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

this mutation return The requested Payment Method is not available. error, but quote_payment.method column is updated with checkmo.

We have disabled checkmo method and checkmo method is not available

Screenshot 2023-09-13 at 2 34 13 PM

While Set payment method with setPaymentMethodOnCart mutation we are getting error The requested Payment Method is not available

Screenshot 2023-09-13 at 2 26 57 PM

We are not able to place the order with the Place order with placeOrder mutation.

Screenshot 2023-09-13 at 2 33 48 PM

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

Thanks.

dimitriBouteille commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @dimitriBouteille. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @dimitriBouteille, here is your Magento Instance: https://a1fe3ae8511747381cac27ce90793387.instances-prod.magento-community.engineering Admin access: https://a1fe3ae8511747381cac27ce90793387.instances-prod.magento-community.engineering/admin_d02e Login: 2ab30941 Password: 93001eca67fc

dimitriBouteille commented 1 year ago

Hi @engcom-Bravo

I just regaled the code a bit and actually I found this error message here \Magento\AsyncOrderGraphQl\Model\Cart\PlaceOrderAsync::execute() which comes from the Magento_AsyncOrderGraphQl module.

In my case, this module is not activated because no need. If you test disabled this module, you will reproduce the bug.

dimitriBouteille commented 1 year ago

Hello @engcom-Bravo

Any news ?

engcom-Bravo commented 12 months ago

Hi @dimitriBouteille,

Thanks for your update.

In our local instance also we don't have Magento_AsyncOrderGraphQl module.

Screenshot 2023-09-25 at 11 58 29 AM

We are not able to reproduce the issue.Is there any other way to reproduce the issue could you please elaborate the steps.

Screenshot 2023-09-25 at 12 16 48 PM Screenshot 2023-09-25 at 12 18 25 PM

it might be possible the issue is resolved in the latest 2.4-develop branch. I request you to please try to reproduce the issue in the latest development branch.

Thanks.

dimitriBouteille commented 12 months ago

@magento give me 2.4-develop instance

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

Hi @dimitriBouteille. Thank you for your request. I'm working on Magento instance for you.

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

Hi @dimitriBouteille, here is your Magento Instance: https://a1fe3ae8511747381cac27ce90793387.instances-prod.magento-community.engineering Admin access: https://a1fe3ae8511747381cac27ce90793387.instances-prod.magento-community.engineering/admin_2d05 Login: dd553271 Password: 40d8bb6926ea

dimitriBouteille commented 12 months ago

Hi @engcom-Bravo,

I tried to reproduce the bug directly on the test env (https://github.com/magento/magento2/issues/37983#issuecomment-1733733696) and I managed to reproduce the bug again.

To reproduce the bug, you must execute the mutations setPaymentMethodOnCart and placeOrder at the same time! Here is an example of a graphql mutation that reproduces the bug:

mutation setPaymentMethodAndPlaceOrder(
  $cartId: String!
  $paymentMethod: PaymentMethodInput!
) {
  setPaymentMethodOnCart(
    input: { cart_id: $cartId, payment_method: $paymentMethod }
  ) {
    cart {
      selected_payment_method {
        code
        title
      }
    }
  }

  placeOrder(input: { cart_id: $cartId }) {
    order {
      order_number
    }
  }
}
{
    "cartId": "{{cart_token}}",
    "paymentMethod": {
        "code": "checkmo"
    }
}

Capture d’écran du 2023-09-25 15-51-15

engcom-Bravo commented 12 months ago

Hi @dimitriBouteille,

Thanks for your update.

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

Screenshot 2023-09-26 at 1 09 00 PM

Even though the payment method checkmo is not available for setting up the payment method but when we execute mutations setPaymentMethodOnCart and placeOrder at the same time the order is placed successfully without setting the payment method.

Hence confirming the issue.

Thanks.

github-jira-sync-bot commented 12 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9605 is successfully created for this GitHub issue.

m2-assistant[bot] commented 12 months ago

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

dimitriBouteille commented 11 months ago

Hi @engcom-Bravo

Some news ?

rogerdz commented 11 months ago

can't duplicate in 2.4-develop: image

dimitriBouteille commented 3 weeks ago

can't duplicate in 2.4-develop: image

The bug is reproducible again. Line 23 I can see the order_number with good increment ID. The placeOrder request should be return The requested Payment Method is not available.