mollie / mollie-odoo

Mollie Payments plugin for Odoo - an open source CRM and ERP
29 stars 49 forks source link

[11.0] Simultaneous payment #75

Closed rudyeezee-it closed 3 years ago

rudyeezee-it commented 4 years ago

Hello,

We found an error when there is simultaneous payment. Mollie send a list of dictionary in answer but you always take the first dictionnary.

In consequence, you write a false acquirer_reference on payment transaction.

The result can be more dramatic if we inherit your method to use the metadata because the metadata will be incorrect to.

We correct it like this:

models/mollie.py +128
- transactionId = tx['acquirer_reference']
+ transactionId = tx.acquirer_reference

This code is much more odoo new api

Biggest change is:

models/mollie +152

-mollie_reference = ''
- if len(data_list) > 0:
-     data = data_list[0]

+        for x in data_list:
+            if isinstance(x, dict) and x.get('id', False) and x['id'] == transactionId:
+                data = x
+                break

This code check the list we receive from Molli and get the right dictionary. We delete mollie_reference because there is no interest to rewrite the acquirer reference (please, confirm that point)

Other change in consequence of that

models/mollie +158
-if "id" in data:
-    mollie_reference = data["id"]
models/mollie +165
-'acquirer_reference': mollie_reference,`
models/mollie +171
-'acquirer_reference': mollie_reference,`
models/mollie +176
-'acquirer_reference': mollie_reference,`
models/mollie +181
-'acquirer_reference': mollie_reference,`

Please check if our correction is ok.

Thanks Regards

Screenshot 2020-07-09 at 14 44 23 Screenshot 2020-07-09 at 14 44 29 Screenshot 2020-07-09 at 14 44 40

odooexpertsbv commented 3 years ago

@rudyeezee-it Hello Thanks for your contribution to solving the payment issue and making changes for that. We will do the changes and will merge to 11.0 branch.