adyen-magento2: [PW-6382] GraphQL PlaceOrder dont work
Describe the bug
- it is not possible to check out via
adyen_cc
via GraphQLResolver
Magento\QuoteGraphQl\Model\Resolver\PlaceOrder::resolve
To Reproduce
Execute Query setPaymentMethodOnCart
mutation setPaymentMethodOnCart(
$cart_id: String!
$payment_method: String!
$additional_data: AdyenAdditionalDataCc
) {
setPaymentMethodOnCart(
input: {
cart_id: $cart_id
payment_method: {
code: $payment_method
adyen_additional_data_cc: $additional_data
}
}
) {
cart {
id
selected_payment_method {
code
title
}
}
}
}
Variables:
{
cart_id: 'my_cart_id',
payment_method: 'adyen_cc',
additional_data: {
cc_type: 'mc',
stateData: JSON.stringify(onChangeData)
}
}
Execute Query placeOrder
mutation placeOrder($cartId: String!) {
placeOrder(input: { cart_id: $cartId }) @connection(key: "placeOrder") {
order {
order_number
}
}
}
Variables:
{
cartId: 'my_cart_id'
}
Error
AdyenLoggerTest.INFO: JSON Response to Adyen:{"status":422,"errorCode":"14_006","message":"Required object 'paymentMethod' is not provided.","errorType":"validation","pspReference":"851638437550915E"} {"is_exception":false} []
I started with debugging session at Magento\QuoteGraphQl\Model\Resolver\PlaceOrder::resolve
he loads the payment correct and pushes it correct to Adyen logic looks like the module lost this information a plugin observer etc.
Expected behavior
Should be possible to place an order with adyen_cc
Magento version 2.4.3
Plugin version
dev-feature/graphql-reapply
Screenshots
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (13 by maintainers)
It’s a must-have to be documented somewhere. An insane amount of time and effort has been wasted before I found the reason for the error and its workaround…
Hi @jesse-deboer,
Apologies for the late reply. This issue was fixed on v8.2.2.
Best, Jean
So, this would mean that you need to save the stateData to something like localStorage if there is a step after the payment method like a review step right?
Also, I can’t find any documentation on
Payload JSON String with orderId, details, paymentData and threeDSAuthenticationOnly.
What is
details
and what ispaymentData
, where can I get this information? This is also not documented anywhere in the Headless Magento intergration docs.Hi @larsroettig and @Bartlomiejsz,
This issue will occur when the setPaymentMethodOnCart and the placeOrder calls are done separately.
However, if both the mutation calls are done in the same request (which essentially is the alternative to this deprecated mutation), this issue should not occur. Example request:
Thanks, Jean Adyen
We are running into this same issue and the proposed fix does not seem to solve the issue, using version 8 of the module on Magento 2.4.3-p1 with PHP 7.4
I’m also confused as to the
adyen_additional_data_cc
being used in the mutation as that is reported to not exist.Hi @acampos1916 @larsroettig Since I don’t have possibility these days to submit PR with changes that I’m making to make
placeOrder
work I will share it here, so you could use it if you need it quickly: I’m adding following plugin ingraphql/di.xml
:with following content:
@acampos1916 if you have possibility, feel free to adjust it if needed and add to graphql PR