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.53k stars 9.31k forks source link

Payment Failed Email not working as intended #11347

Closed ebaschiera closed 3 years ago

ebaschiera commented 7 years ago

According to documentation, an email should be sent "if the payment method that is chosen during checkout fails to complete the transaction."

Looking at the code, the sendPaymentFailedEmail() method is called only in Magento\Multishipping\Controller\Checkout\OverviewPost class and in Magento\Checkout\Controller\Onepage\SaveOrder class.

I made a couple of tests and in my environment, trying a couple of different payment methods, Magento never run those controllers. So, even if the payment fails, the email notification is not sent.

This behaviour is very different from Magento 1, where the merchant receives effective notifications and can monitor checkout/payment problems.

Preconditions

  1. Magento CE 2.1.8
  2. PHP 7.0.22-2+ubuntu16.04.1+deb.sury.org+4
  3. MySQL 5.7.19-0ubuntu0.16.04.1

Steps to reproduce

  1. Enable Cybersource payment method (or any other that require configuration) without configuring it
  2. Add a product to cart and proceed to checkout
  3. select Cybersource and input fake credit card information
  4. get the "An error occurred on the server. Please try to place the order again." error message at checkout

Expected result

  1. the merchant should receive a failed payment email notification

Actual result

  1. no emails are sent
magento-engcom-team commented 7 years ago

@ebaschiera, thank you for your report. We've created internal ticket(s) MAGETWO-81571 to track progress on the issue.

adrian-martinez-interactiv4 commented 7 years ago

I'm working on this

gx2g commented 6 years ago

please fix this, my company is having the same issue and we are live taking orders.

okorshenko commented 6 years ago

hi @gx2g feel free to join code review and testing of proposed solutions (see linked Pull Requests) Please let us know if the proposed solution works for you Thank you

ebaschiera commented 6 years ago

I confirm that https://github.com/magento/magento2/pull/11602 works fine.

gx2g commented 6 years ago

@ebaschiera @okobchenko what files to I update I don't understand when look at the linked pull requests I am not seeing a solution to the problem can you guide me on what files I need to update or where I can copy and paste them into my site files. I don't see any solution I may not be understanding pull requests.

ebaschiera commented 6 years ago

@gx2g if you installed Magento with Composer, you can apply the PR as a patch into your Magento project. Please see this link for more information. The patch from the PR would be this: https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/11602.patch You will have to rename the paths inside the patch to make it work with cweagans/composer-patches.

digvijay2017 commented 6 years ago

@ebaschiera I have tried to install the patch from the PR. But i am getting error : magento2

I think, there is some mistake in the patch file : https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/11602.patch

Is someone else install the patch from the PR ?

iivashchenko commented 6 years ago

Pull request for M2.1 with MAGETWO-80324 ticket which resolves payment failed email issue has been merged recently: https://github.com/magento/magento2ce/pull/2118.

ishakhsuvarov commented 6 years ago

@ebaschiera I am closing this ticket for now as the fix seems to be delivered to the appropriate branches and will be released soon.

victortodoran commented 6 years ago

@ishakhsuvarov 2 months after, this is still not working. Yet the issue is closed. What's the strategy behind this?

ebaschiera commented 6 years ago

I agree. The fix did NOT reach the appropriate branches due to rejection.

magento-engcom-team commented 6 years ago

@ebaschiera Reopening. Thank you for pointing out.

ebaschiera commented 6 years ago

You're welcome. Please take a look at my comment about rejection. Thanks!

adrian-martinez-interactiv4 commented 6 years ago

@ebaschiera @magento-engcom-team May I reopen related PR https://github.com/magento/magento2/pull/11602, as rejection reasons are being discussed?

ebaschiera commented 6 years ago

@adrian-martinez-interactiv4 yes please :+1:

duckchip commented 5 years ago

Is there any progress on this issue? :) thx!

myselfgaurav commented 5 years ago

i am still having issue in magento 2.2.6

Technogeek2312 commented 5 years ago

Kurl.zip try this module, i hope the issue will get resolved. Its working.

11347 @adrian-martinez-interactiv4 @ebaschiera @magento-engcom-team Kindly check this out

magento-engcom-team commented 5 years ago

Hi @ebaschiera.

Thank you for your report and collaboration!

The issue was fixed by Magento team. The fix was delivered into magento/magento2:2.1-develop branch(es). Related commit(s):

killday commented 4 years ago

How come this fix is not in the 2.2 I'm facing the same problem.

ghost commented 4 years ago

This issue is still apparent in 2.3.3-p1. the latest PR, https://github.com/magento/magento2/pull/23106, was closed due to inactivity. Can we get it re-opened and fixed?

gwharton commented 4 years ago

I receive payment failed emails on 2.3.4

ghost commented 4 years ago

I receive payment failed emails on 2.3.4

Odd, the bug fix is not in 2.3.4, eg. https://github.com/magento/magento2/blob/2.3.4/app/code/Magento/Checkout/Model/PaymentInformationManagement.php

gwharton commented 4 years ago

I don't know why that is. I just reran a failed cc payment test and got the failure email.

magent-harsh commented 4 years ago

we try to place order with insufficient funds but did not getting any mail for payment fail .This issue is still apparent in 2.3.4. please provide solution for this bug.

nadroj467 commented 4 years ago

Experiencing this issue in 2.3.5-p1 with native PayPal payments pro hosted

grazianodimaio commented 4 years ago

I'm having this issue on Magento 2.3.5-p1 with Adyen Credit Card payment gateway. Anyone found a solution to this?

gwharton commented 4 years ago

I wonder if this is module specific. I got failure emails under Braintree but since switching to Stripe I haven't seen any.

Update : Scrub that. I received two payment failed emails today. I notice the Stripe module has a setting to turn the feature on/off so there must be some control of the feature from the module (unless that just triggers a global setting).

gwharton commented 4 years ago

Just had a thought today. The payment failed, sitemap generation failed and currency update failed emails are all dispatched from the AREA_ADMINHTML, whereas all other emails are dispatched from the AREA_FRONTEND regardless of how they are triggered. This means if you have modified the stock email templates for these emails and included the standard headers and footers to make them look better, the email generation will fail, as the standard backend theme does not have any email.css and email-inline.css files at all. Any emails sent from ADMINHTML with the standard theme need to have no email.css or email-inline.css included. The default email templates are unstyled for this reason. You can ofcourse style them with the style box underneath the template if you include the relevant template_style | raw tag in the template.

Just brain dumping this here.

magento-engcom-team commented 3 years ago

The report related to technology or functionality that was removed(or not supported) from the Magento code-base. Or cannot be fixed and delivered in the scope of this public repository.

Examples: