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

feat/integration log references #324

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@
"title",
"integration",
"status",
"method",
"column_break_fhrq",
"psl",
"payment_status",
"is_retry",
"reference_doctype",
"reference_docname",
"section_break_swkt",
"message",
"method",
"traceback",
"request_data",
"response_data"
Expand Down Expand Up @@ -66,11 +73,55 @@
"fieldtype": "Code",
"label": "Response Data",
"read_only": 1
},
{
"default": "0",
"description": "Use to exclude reties from notifications",
"fieldname": "is_retry",
"fieldtype": "Check",
"label": "Is Retry",
"read_only": 1
},
{
"fieldname": "payment_status",
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Payment Status",
"read_only": 1
},
{
"fieldname": "psl",
"fieldtype": "Link",
"label": "Payment Session Log",
"options": "Payment Session Log",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires frappe/payments#53

"read_only": 1
},
{
"fieldname": "column_break_fhrq",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_swkt",
"fieldtype": "Section Break"
},
{
"fieldname": "reference_doctype",
"fieldtype": "Link",
"label": "Reference Doctype",
"options": "DocType",
"read_only": 1
},
{
"fieldname": "reference_docname",
"fieldtype": "Dynamic Link",
"label": "Reference Docname",
"options": "reference_doctype"
}
],
"in_create": 1,
"links": [],
"modified": "2021-05-28 16:06:49.008875",
"modified": "2024-06-23 13:51:52.650162",
"modified_by": "Administrator",
"module": "Ecommerce Integrations",
"name": "Ecommerce Integration Log",
Expand Down Expand Up @@ -104,4 +155,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "title"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def create_log(
method=None,
message=None,
make_new=False,
payment_status=None,
reference_doctype=None,
reference_docname=None,
):
make_new = make_new or not bool(frappe.flags.request_id)

Expand All @@ -65,6 +68,13 @@ def create_log(
if request_data and not isinstance(request_data, str):
request_data = json.dumps(request_data, sort_keys=True, indent=4)

if payment_status:
log.payment_status = payment_status
if reference_doctype:
log.reference_doctype = reference_doctype
if reference_docname:
log.reference_docname = reference_docname

log.message = message or _get_message(exception)
log.method = log.method or method
log.response_data = response_data or log.response_data
Expand Down
6 changes: 6 additions & 0 deletions ecommerce_integrations/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
app_email = "[email protected]"
app_license = "GNU GPL v3.0"

required_apps = ["payments", "erpnext"]

# Includes in <head>
# ------------------

Expand Down Expand Up @@ -166,6 +168,10 @@
# bootinfo - hide old doctypes
extend_bootinfo = "ecommerce_integrations.boot.boot_session"

ignore_links_on_delete = [
"Ecommerce Integration Log",
]

# Testing
# -------

Expand Down
Loading