Upgraded the autopay functions and finished up the iframe.

This commit is contained in:
Ty Reynolds
2026-02-02 08:08:00 -05:00
parent 22d514aa7b
commit a636cdd9fa
2 changed files with 122 additions and 62 deletions

View File

@@ -97,6 +97,31 @@ def get_collect_checkout_url(invoice):
)
@frappe.whitelist(allow_guest=True)
def crystalclear_webhook():
data = frappe.local.form_dict
# Validate success
if data.get("response") != "1":
return "ignored"
invoice = data.get("orderid")
amount = data.get("amount")
transaction_id = data.get("transactionid")
# Prevent duplicates
if frappe.db.exists("Payment Entry", {"reference_no": transaction_id}):
return "duplicate"
create_payment_entry(
invoice=invoice,
amount=amount,
transaction_id=transaction_id
)
return "ok"
def create_payment_entry(invoice, amount, transaction_id=None):
inv = frappe.get_doc("Sales Invoice", invoice)