Skip to content

Commit

Permalink
fix: more permission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NagariaHussain committed Nov 9, 2023
1 parent 1098169 commit 972b1d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions printrov_merch_store/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def handle_payment_success(order_id, payment_id, signature):
except RazorpaySignatureVerificationError:
frappe.throw("Invalid Payment Signature")

current_user = frappe.session.user

# set the user as Administrator
# to prevent permission errors
frappe.set_user("Administrator")
so = frappe.get_doc(
"Store Order", {"razorpay_order_id": order_id}
)
Expand All @@ -74,6 +79,9 @@ def handle_payment_success(order_id, payment_id, signature):
)
so.save()

# set the user back
frappe.set_user(current_user)

return so.name


Expand Down

0 comments on commit 972b1d0

Please sign in to comment.