Skip to content

Commit

Permalink
refactor: better handling of get parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Nov 22, 2024
1 parent b5eda73 commit 1f173ca
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,17 @@ def create_charge_on_braintree(self):
status = "Error"
redirect_url = "payment-failed"

get_parameters = [
("doctype", self.data.reference_doctype),
("docname", self.data.reference_docname),
]

if redirect_to:
redirect_url += "?" + urlencode({"redirect_to": redirect_to})
get_parameters.append(("redirect_to", redirect_to))
if redirect_message:
redirect_url += "&" + urlencode({"redirect_message": redirect_message})
get_parameters.append(("redirect_message", redirect_message))

redirect_url += "?" + urlencode(get_parameters)
return {"redirect_to": redirect_url, "status": status}


Expand Down

0 comments on commit 1f173ca

Please sign in to comment.