custom_ui/custom_ui/www/payment_success.py
2026-02-06 08:07:18 -06:00

18 lines
No EOL
978 B
Python

import frappe
def get_context(context):
context.no_cache = 1
context.title = "Payment Received"
context.message = "Thank you for your payment! Your transaction was successful."
context.session_id = frappe.form_dict.get("session_id")
payment_entry = frappe.get_value("Payment Entry", {"reference_no": context.session_id}, "name")
payment_entry_doc = frappe.get_doc("Payment Entry", payment_entry) if payment_entry else None
reference = payment_entry_doc.references[0] if payment_entry_doc and payment_entry_doc.references else None
reference_doc = frappe.get_doc(reference.reference_doctype, reference.reference_name) if reference else None
company_doc = frappe.get_doc("Company", reference_doc.company) if reference_doc and reference_doc.company else None
context.reference_doc = reference_doc.as_dict() if reference_doc else None
context.company_doc = company_doc.as_dict() if company_doc else None
return context