mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
98 stars 49 forks source link

Missing Webhook status 'completed' #781

Closed mikerooijackers closed 2 weeks ago

mikerooijackers commented 1 month ago

Describe the bug The webhook status returned from Mollie to the webshop does not exist in the module. As a result, the success page is never displayed when a completed status is sent by the webhook.

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Place an order using a Mollie payment method.
  2. Select 'Paid' in Mollie.
  3. You will be redirected back to the webshop.
  4. You are redirected back to the shopping cart.

Expected behavior It is expected that you will be redirected to the success page.

Actual behavior You are redirected back to the shopping cart. not to the succes page

Additional context Webhook: [2024-05-30T12:03:39.996222+00:00] Mollie.INFO: info: Locking: mollie.order.26425 [] [] [2024-05-30T12:03:40.197318+00:00] Mollie.INFO: webhook: {"resource":"order","id":"xxxx","profileId":"xxxx","mode":"test","amount":{"value":"746.94","currency":"EUR"},"amountCaptured":{"value":"746.94","currency":"EUR"},"amountRefunded":null,"status":"completed","billingAddress":{"organizationName":"xxxx","streetAndNumber":"xxxx","postalCode":"xxx","city":"xxx","region":"xxx","country":"NL","givenName":"xxxx","familyName":"xxxx","email":"xxxxx"},"consumerDateOfBirth":null,"orderNumber":"xxxx","shippingAddress":{"organizationName":"X-Com","streetAndNumber":"xxxxx","postalCode":"xxxx","city":"Maasbree","region":"Limburg","country":"NL","givenName":"xxx","familyName":"xxxx","email":"xxxx@xxxx"},"method":"creditcard","locale":"nl_NL","metadata":{"order_id":"xxxxx","store_id":"1","payment_token":"xxxxx"},"isCancelable":false,"webhookUrl":"https:\/\/xxxxxx\/mollie\/checkout\/webhook\/?isAjax=1&orderId[]=xxxxx","redirectUrl":"https:\/\/xxxxxx\/mollie\/checkout\/process\/?order_id=xxxxx&payment_token=xxxxx&utm_nooverride=1","cancelUrl":null,"createdAt":"2024-05-30T12:02:21+00:00","expiresAt":null,"expiredAt":null,"paidAt":"2024-05-30T12:02:38+00:00","authorizedAt":null,"canceledAt":null,"completedAt":"2024-05-30T12:02:40+00:00","lines":[{"resource":"orderline","id":"xxxxx","orderId":"xxxxx","name":"Kunstgras Orlando - 35mm","sku":"100139","type":"digital","status":"completed","metadata":{"item_id":"36553"},"isCancelable":false,"quantity":2080,"quantityShipped":2080,"amountShipped":{"value":"622.96","currency":"EUR"},"quantityRefunded":0,"amountRefunded":{"value":"0.00","currency":"EUR"},"quantityCanceled":0,"amountCanceled":{"value":"0.00","currency":"EUR"},"shippableQuantity":0,"refundableQuantity":2080,"cancelableQuantity":0,"unitPrice":{"value":"0.30","currency":"EUR"},"vatRate":"21.00","vatAmount":{"value":"108.12","currency":"EUR"},"totalAmount":{"value":"622.96","currency":"EUR"},"createdAt":"2024-05-30T12:02:21+00:00","_links":{"productUrl":{"href":"https:\/\/xxxxxx\/xxxxx","type":"text\/html"}}},{"resource":"orderline","id":"xxxxx","orderId":"xxxxx","name":"Stabilisatiedoek per m2","sku":"200101","type":"digital","status":"completed","metadata":{"item_id":"36554"},"isCancelable":false,"quantity":1500,"quantityShipped":1500,"amountShipped":{"value":"29.70","currency":"EUR"},"quantityRefunded":0,"amountRefunded":{"value":"0.00","currency":"EUR"},"quantityCanceled":0,"amountCanceled":{"value":"0.00","currency":"EUR"},"shippableQuantity":0,"refundableQuantity":1500,"cancelableQuantity":0,"unitPrice":{"value":"0.02","currency":"EUR"},"vatRate":"21.00","vatAmount":{"value":"5.15","currency":"EUR"},"totalAmount":{"value":"29.70","currency":"EUR"},"createdAt":"2024-05-30T12:02:21+00:00","_links":{"productUrl":{"href":"https:\/\/xxxxx\/geotextiel-stabilisatiedoek","type":"text\/html"}}},{"resource":"orderline","id":"xxxxx","orderId":"xxxxx","name":"Zelfklevende lijmband rol 5m","sku":"200137","type":"digital","status":"completed","metadata":{"item_id":"36555"},"isCancelable":false,"quantity":100,"quantityShipped":100,"amountShipped":{"value":"10.00","currency":"EUR"},"quantityRefunded":0,"amountRefunded":{"value":"0.00","currency":"EUR"},"quantityCanceled":0,"amountCanceled":{"value":"0.00","currency":"EUR"},"shippableQuantity":0,"refundableQuantity":100,"cancelableQuantity":0,"unitPrice":{"value":"0.10","currency":"EUR"},"vatRate":"21.00","vatAmount":{"value":"1.74","currency":"EUR"},"totalAmount":{"value":"10.00","currency":"EUR"},"createdAt":"2024-05-30T12:02:21+00:00","_links":{"productUrl":{"href":"https:\/\/xxxxx\/zelfklevende-lijmband","type":"text\/html"}}},{"resource":"orderline","id":"xxxxx","orderId":"xxxxx","name":"Bevestigingshaken per stuk","sku":"200102","type":"digital","status":"completed","metadata":{"item_id":"36556"},"isCancelable":false,"quantity":3100,"quantityShipped":3100,"amountShipped":{"value":"19.53","currency":"EUR"},"quantityRefunded":0,"amountRefunded":{"value":"0.00","currency":"EUR"},"quantityCanceled":0,"amountCanceled":{"value":"0.00","currency":"EUR"},"shippableQuantity":0,"refundableQuantity":3100,"cancelableQuantity":0,"unitPrice":{"value":"0.01","currency":"EUR"},"vatRate":"21.00","vatAmount":{"value":"3.39","currency":"EUR"},"totalAmount":{"value":"19.53","currency":"EUR"},"createdAt":"2024-05-30T12:02:21+00:00","_links":{"productUrl":{"href":"https:\/\/xxxxx\/catalog\/product\/view\/id\/23","type":"text\/html"}}},{"resource":"orderline","id":"xxxxx","orderId":"xxxxx","name":"Top Kunstgras Instrooizand","sku":"200105","type":"digital","status":"completed","metadata":{"item_id":"36557"},"isCancelable":false,"quantity":500,"quantityShipped":500,"amountShipped":{"value":"64.75","currency":"EUR"},"quantityRefunded":0,"amountRefunded":{"value":"0.00","currency":"EUR"},"quantityCanceled":0,"amountCanceled":{"value":"0.00","currency":"EUR"},"shippableQuantity":0,"refundableQuantity":500,"cancelableQuantity":0,"unitPrice":{"value":"0.13","currency":"EUR"},"vatRate":"21.00","vatAmount":{"value":"11.24","currency":"EUR"},"totalAmount":{"value":"64.75","currency":"EUR"},"createdAt":"2024-05-30T12:02:21+00:00","_links":{"productUrl":{"href":"https:\/\/xxxxx\/catalog\/product\/view\/id\/xxxxx","type":"text\/html"}}}],"shopperCountryMustMatchBillingCountry":false,"_links":{"self":{"href":"https:\/\/api.mollie.com\/v2\/orders\/xxxxx?embed=payments","type":"application\/hal+json"},"dashboard":{"href":"https:\/\/my.mollie.com\/dashboard\/xxxxx\/orders\/xxxx","type":"text\/html"},"documentation":{"href":"https:\/\/docs.mollie.com\/reference\/v2\/orders-api\/get-order","type":"text\/html"}},"_embedded":{"payments":[{"resource":"payment","id":"xxxx","mode":"test","createdAt":"2024-05-30T12:02:21+00:00","amount":{"value":"746.94","currency":"EUR"},"description":"Order xxxxx","method":"creditcard","metadata":null,"status":"paid","paidAt":"2024-05-30T12:02:38+00:00","amountRefunded":{"value":"0.00","currency":"EUR"},"amountRemaining":{"value":"746.94","currency":"EUR"},"locale":"nl_NL","countryCode":"NL","profileId":"xxxxx","orderId":"xxxx","sequenceType":"oneoff","redirectUrl":"https:\/\/xxxxx\/mollie\/checkout\/process\/?order_id=xxxxx&payment_token=xxxxx&utm_nooverride=1","settlementAmount":{"value":"746.94","currency":"EUR"},"details":{"cardToken":"xxxxx","cardNumber":"0005","cardHolder":"T. TEST","cardAudience":"consumer","cardLabel":"Mastercard","cardCountryCode":"NL","cardSecurity":"3dsecure","feeRegion":"other"},"_links":{"self":{"href":"https:\/\/api.mollie.com\/v2\/payments\/xxxxx","type":"application\/hal+json"},"dashboard":{"href":"https:\/\/my.mollie.com\/dashboard\/xxxxxx\/payments\/xxxxx","type":"text\/html"},"changePaymentState":{"href":"https:\/\/www.mollie.com\/checkout\/test-mode?method=creditcard&token=xxxxx","type":"text\/html"},"order":{"href":"https:\/\/api.mollie.com\/v2\/orders\/xxxxx","type":"application\/hal+json"}}}]}} [] [] [2024-05-30T12:03:40.198582+00:00] Mollie.INFO: success: {"success":true,"status":"completed","order_id":"26425","type":"webhook"} [] [] [2024-05-30T12:03:40.198686+00:00] Mollie.INFO: success: {"success":true,"status":"completed","order_id":"26425","type":"webhook"} [] [] [2024-05-30T12:03:40.233620+00:00] Mollie.INFO: info: Unlocking: mollie.order.26425 [] [] [2024-05-30T12:03:40.234022+00:00] Mollie.INFO: info: Key "mollie.order.26425" unlocked [] []

mikerooijackers commented 1 month ago

mollie-status.patch

Frank-Magmodules commented 1 month ago

Hi @mikerooijackers, thank you for sharing your patch. We'll review it and ensure that this state is included in our next release. I will inform you once it's there. Thanks!

fjbender commented 4 weeks ago

What confuses me here is that the order shouldn't be in completed state at this point in time. Can you maybe share an ord_ ID of an order that shows this behavior?

michielgerritsen commented 4 weeks ago

@fjbender When placing an order with Components or Apple Pay that is paid it will go to completed. At least, in test mode that is. Not sure how live mode reacts to this.

mikerooijackers commented 4 weeks ago

@fjbender

Wat mij hier verwart, is dat de bestelling completedop dit moment niet in orde zou moeten zijn. Kunt u misschien een ord_ID delen van een bestelling die dit gedrag vertoont?

ord_1.2ujz6e

fjbender commented 4 weeks ago

Thanks, this helps - we apparently didn't take into account that products marked as digital in Magento auto-ship. If combined with the Orders API, this leads to the result you're experiencing. Your patch should fix this indeed.

Frank-Magmodules commented 4 weeks ago

Absolutely, thanks @mikerooijackers! We will include this in our next release as well!

Frank-Magmodules commented 2 weeks ago

Hi There @mikerooijackers ,

Thank you once again for bringing up this issue. We have just released version 2.39.0, which resolves this problem. This update contains the same patch you mentioned and is only applicable to orders containing digital products. I'm closing this issue for now, but please feel free to leave a comment at any time, even now it's closed.