Commit 68e44818 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_payzen: Allow the a Superuser/Manager invoke redirect to pay

This allow us to produce links to third parties pay someones invoices (if they have Manager account).
parent 48ee3f8b
from zExceptions import Unauthorized
portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()
if getattr(context, "PaymentTransaction_getVADSUrlDict", None) is None:
raise ValueError("PaymentTransaction_getVADSUrlDict is missing on this site")
if person is None:
raise Unauthorized("Error")
def wrapWithShadow(payment_transaction, person_relative_url):
vads_url_dict = payment_transaction.PaymentTransaction_getVADSUrlDict()
......@@ -30,6 +25,9 @@ def wrapWithShadow(payment_transaction, person_relative_url):
return system_event.contentValues(
portal_type="Payzen Event Message")[0].getTextContent()
if person is None:
return wrapWithShadow(context, context.getDestinationSection())
return person.Person_restrictMethodAsShadowUser(
shadow_document=person,
callable_object=wrapWithShadow,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment