diff --git a/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py b/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py index 5600acbd..c5c971bd 100644 --- a/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py +++ b/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py @@ -262,20 +262,18 @@ def create_charge_on_braintree(self): if custom_redirect_to: redirect_to = custom_redirect_to - redirect_url = ( - f"payment-success?doctype={self.data.reference_doctype}&docname={self.data.reference_docname}" - ) + redirect_url = "payment-success" else: status = "Error" - redirect_url = ( - f"payment-failed?doctype={self.data.reference_doctype}&docname={self.data.reference_docname}" - ) + 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}