emspay / magento2

Deprecation EMS Pay - Magento2 plugin
https://emspay.eu
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Invoices not being auto-generated? #28

Open viniciusfabri opened 4 years ago

viniciusfabri commented 4 years ago

Hi,

It seems when the payment is confirmed the invoice is not automatically generated, can you please confirm if that's the intended behavior?

dligthart commented 4 years ago

@viniciusfabri thanks for reporting the issue. We will investigate.

dligthart commented 4 years ago

@viniciusfabri We have tested on the specified environment. The order status has successfully passed to the "processing" state and "Invoice" has been successfully generated automatically.

Can you check if “Logging” is enabled in admin panel. (Admin panel menu -> Stores -> Configuration -> Sales -> Payment Methods -> EMS Global configuration -> Logging)

And then provide these logs for investigation:

/var/log/ems_ipn.log /var/log/ems_pay_bancontact.log /var/log/ems_pay_cc.log /var/log/ems_pay_ideal.log /var/log/ems_pay_klarna.log /var/log/ems_pay_maestro.log /var/log/ems_pay_masterpass.log /var/log/ems_pay_paypal.log /var/log/ems_pay_sofort.log /var/log/ems_payment.log /var/log/payment_ems_pay_ideal.log
viniciusfabri commented 4 years ago

@dligthart sent them to the email, please confirm if you received it

dligthart commented 4 years ago

We have received the logs, thank you.

dligthart commented 4 years ago

@viniciusfabri The logs show that the IPN request was successful. In this case, the invoice should be generated automatically.

Most likely, the problem occurs at the stage of invoice creation. There may be conflicts with other extensions. And this problem is specific to the store not to the EMS module.

We could check these logs to have a better idea: var/log/exception.log var/log/system.log

viniciusfabri commented 4 years ago

Hi @dligthart , I did see an exception on my exceptions.log file, but that was introduced in magento 2.3.2, and after applying the patch to fix it, I still don't get an invoice generated The github issue for the exception issue is https://github.com/magento/magento2/issues/23411

After fixing it, I don't have anything in my logs anymore (*.log)

No exceptions, nothing

I'm working on testing this on a vanilla Magento installation, will let you know the results

Out of curiosity, on which Magento version are you testing the module? We are on enterprise 2.3.3

UPDATE: Just finished testing on a fresh 2.3.3 version, and I'm having the same behaviour as on my customer's site: I see the transaction in the order: image

No invoices: image

The payment also shows as confirmed: image

Comment history: image

Don't know what else to try here. If you are using a fresh magento install, are you able to share which tag and a DB dump if possible (you should have my email from the logs I sent earlier) so I can compare the envs?

viniciusfabri commented 4 years ago

Also, is there an easy way to test the notification locally?

viniciusfabri commented 4 years ago

Hi @dligthart , Just figured it out: it seems that the "chargeTotal" amount that comes from EMS is a string instead of a numeric type in the JSON, and it comes like this:

'chargetotal' => '281,23',

Notice the comma as the decimal separator. When Magento processes the transaction, and checks if the total amount was paid, it converts the number to a double: https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Sales/Model/Order/Payment/Operations/RegisterCaptureNotificationOperation.php#L37

And because the string has a comma instead of a dot, 281,23 becomes 281,00, therefore the total amount is not paid, and the invoice is not generated

dligthart commented 4 years ago

@viniciusfabri thanks for reporting the findings and the issue regarding the comma as a decimal separator, we are going to look into this.