Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavmene2000 committed Dec 18, 2024
1 parent 97a9e8f commit 40c74ba
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
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:
Expand Down
71 changes: 38 additions & 33 deletions raven/api/support_request.py
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"))

0 comments on commit 40c74ba

Please sign in to comment.