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

ERPNext Payment Error #121

Closed
Nandani-20 opened this issue Nov 20, 2024 · 12 comments · Fixed by #122
Closed

ERPNext Payment Error #121

Nandani-20 opened this issue Nov 20, 2024 · 12 comments · Fixed by #122
Assignees
Labels
bug Something isn't working

Comments

@Nandani-20
Copy link

Information about bug

i'm using the erpnext v14 manual installation and facing this issue. After the successful payment, when redirecting to the payment success page, I'm facing this error.

After Looking into the code, I knew that in the payment_success.py file, frappe is trying to get the docname and doctype but unable to get this

image

i'm getting doctype and docname as none because form_dict only contains "redirect_to" field and due to this, error is occuring here

doc = frappe.get_doc(doctype, docname)

In the documentation, the only thing mentioned is to put the keys into the braintree settings to setup payment gateway and the payment is working successfully but not building the payment_success page only due to this error.

Module

accounts, ecommerce

Version

ERPNext: v14.76.0 (version-14)
Frappe Framework: v14.85.1 (version-14)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

Traceback (most recent call last):
File "apps/frappe/frappe/website/serve.py", line 20, in get_response
response = renderer_instance.render()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/page_renderers/template_page.py", line 84, in render
html = self.get_html()
^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/utils.py", line 529, in cache_html_decorator
html = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/page_renderers/template_page.py", line 95, in get_html
self.update_context()
File "apps/frappe/frappe/website/page_renderers/template_page.py", line 163, in update_context
data = self.run_pymodule_method("get_context")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/page_renderers/template_page.py", line 223, in run_pymodule_method
return method(self.context)
^^^^^^^^^^^^^^^^^^^^
File "apps/payments/payments/templates/pages/payment_success.py", line 10, in get_context
doc = frappe.get_doc(frappe.local.form_dict.doctype, frappe.local.form_dict.docname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/init.py", line 1346, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 75, in get_doc
raise ValueError("First non keyword argument must be a string or dict")
ValueError: First non keyword argument must be a string or dict
@Nandani-20 Nandani-20 added the bug Something isn't working label Nov 20, 2024
@ruthra-kumar ruthra-kumar self-assigned this Nov 20, 2024
@Nandani-20
Copy link
Author

If possible, fix it fast. I tried to modify the code, but things not worked.

@ruthra-kumar
Copy link
Member

@Nandani-20

The code in the screenshot doesn't look like the standard Payments app. Also which version of the Payments app are you using.

@Nandani-20
Copy link
Author

Nandani-20 commented Nov 20, 2024

Payments: v0.0.1 (develop)

I was trying to debug the code, that's why I have add some print statements

@ruthra-kumar
Copy link
Member

Can you post the full replication steps

@Nandani-20
Copy link
Author

image

Braintree Settings

image

This is payment gateway acccount

image

Here is payment gateway

The, I have added this payment gateway to ecommerce settings

image

This is the checkout page, till here things are going fine, when I will click on pay button then then payment will complete and also its logs will be shown to the braintree transaction but after its completion, when I get redirected to the payment _success page then error occured.

Behind the scene, payment request, sales order and other things are created

image

image

This is the error in payment success page

image

@Nandani-20
Copy link
Author

Nandani-20 commented Nov 21, 2024

@ruthra-kumar Can you post the full replication steps

I have shared all the steps, can you please try to solve it quickly, or let me know why this error is coming

@ruthra-kumar
Copy link
Member

Since when did this issue started to occur?

@Nandani-20
Copy link
Author

3 days ago

@ruthra-kumar ruthra-kumar transferred this issue from frappe/erpnext Nov 21, 2024
@ruthra-kumar ruthra-kumar linked a pull request Nov 21, 2024 that will close this issue
@ruthra-kumar
Copy link
Member

@Nandani-20

#122 should fix it

@Nandani-20
Copy link
Author

image

Another error arises

@Nandani-20
Copy link
Author

I have resolved the issue.
I have changed the line

image

to

image

in braintree_settings.py file

@Nandani-20
Copy link
Author

Nandani-20 commented Nov 21, 2024

Please include it in the original code after testing it at your end.
Thank you for your support.

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

Successfully merging a pull request may close this issue.

2 participants