-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97a9e8f
commit 40c74ba
Showing
2 changed files
with
39 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
exclude: "node_modules|.git" | ||
default_stages: [commit] | ||
default_stages: [pre-commit] | ||
fail_fast: false | ||
|
||
repos: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,45 @@ | ||
import json | ||
|
||
import frappe | ||
import requests | ||
import json | ||
from frappe import _ | ||
|
||
|
||
@frappe.whitelist(methods=["POST"]) | ||
def submit_support_request( | ||
email, | ||
ticket_type, | ||
subject, | ||
description, | ||
status = "Open", | ||
email, | ||
ticket_type, | ||
subject, | ||
description, | ||
status="Open", | ||
): | ||
""" | ||
Submit a support ticket using Frappe's web form API. | ||
""" | ||
|
||
payload = { | ||
"data": json.dumps({ | ||
"raised_by": email, | ||
"subject": subject, | ||
"ticket_type": ticket_type, | ||
"description": description, | ||
"status": status, | ||
"doctype": "HD Ticket", | ||
"web_form_name": "support-ticket", | ||
"via_customer_portal" : 1 | ||
}), | ||
"web_form": "support-ticket", | ||
} | ||
""" | ||
Submit a support ticket using Frappe's web form API. | ||
""" | ||
|
||
payload = { | ||
"data": json.dumps( | ||
{ | ||
"raised_by": email, | ||
"subject": subject, | ||
"ticket_type": ticket_type, | ||
"description": description, | ||
"status": status, | ||
"doctype": "HD Ticket", | ||
"web_form_name": "support-ticket", | ||
"via_customer_portal": 1, | ||
} | ||
), | ||
"web_form": "support-ticket", | ||
} | ||
|
||
response = requests.post( | ||
"https://community.ravenapp.cloud/api/method/frappe.website.doctype.web_form.web_form.accept", | ||
data=payload, | ||
headers={"Content-Type": "application/x-www-form-urlencoded"}, | ||
) | ||
|
||
response = requests.post( | ||
"https://community.ravenapp.cloud/api/method/frappe.website.doctype.web_form.web_form.accept", | ||
data=payload, | ||
headers={'Content-Type': 'application/x-www-form-urlencoded'} | ||
) | ||
|
||
if response.status_code == 200: | ||
return "Ticket submitted successfully" | ||
else: | ||
frappe.throw(_("Failed to submit the ticket")) | ||
if response.status_code == 200: | ||
return "Ticket submitted successfully" | ||
else: | ||
frappe.throw(_("Failed to submit the ticket")) |