Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gocardless payment request issue (broken after update) #89

Open
vcavel opened this issue Jun 19, 2024 · 4 comments
Open

Gocardless payment request issue (broken after update) #89

vcavel opened this issue Jun 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@vcavel
Copy link

vcavel commented Jun 19, 2024

Information about bug

There is an issue when creating a gocardless payment request after the custumer subscribed to the service.

What should happen :

- Gocardless payment request is created for this customer for the 1st time
- A gocardless subscription email is sent to the customer because no mandate exists
- Customer subscribes to gocardless, a mandate is created, payment is made
- Gocardless payment request is created for this customer for the 2nd time
- Payment is made automatically because a mandate exists, no subscription email is send

What happens :

- Gocardless payment request is created for this customer for the 1st time
- A gocardless subscription email is sent to the customer because no mandate exists
- Customer subscribes to gocardless, a mandate is created, payment is made
- Gocardless payment request is created for this customer for the 2nd time
- Payment is not made, a subscription email is sent again to the customer even though the mandate already exists

This bug only happens on new customers who subscribed after an ERPNext v15.xxx update (i don't know which one), there are no issues for the customers who's mandates are older than the update who broke this integration.

Module

integrations

Version

Ecommerce Integrations: v1.20.1 (main)
ERPNext: v15.27.1 (version-15)
Frappe Framework: v15.29.1 (version-15)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

@vcavel vcavel added the bug Something isn't working label Jun 19, 2024
@Nihantra-Patel Nihantra-Patel transferred this issue from frappe/erpnext Jun 20, 2024
@vcavel
Copy link
Author

vcavel commented Jun 27, 2024

Thanks @Nihantra-Patel, how can I help you to find a solution for this ?

@vcavel
Copy link
Author

vcavel commented Jul 3, 2024

After further investigation, here is what I found :

The difference between a customer created before the update and a customer created after the update is is in the check_mandate_validity() function.

Line 66 of file payments/payment_gateways/doctype/gocardless_settings/gocardless_settings.py, the frappe.db.exists() exits without errors when checking if the mandate exists when it one of the new mandates.

It keeps going and finds the mandate when it's an older one ...

I still have not found the difference between the mandates though ...

@vcavel
Copy link
Author

vcavel commented Jul 3, 2024

I checked directly in the database and the "customer" field is NULL for the new mandates. There must be something wrong when creating the mandate.

@vcavel
Copy link
Author

vcavel commented Jul 3, 2024

FYI, I updated the records in my database manually and the payment requests are working perfectly. There is definitely an issue when creating the mandates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant