Commit 0e76d9fb authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request:

* drop not needed condition
* factorize some code
parent 291cfdaa
......@@ -20,6 +20,8 @@ if email in ["", None]:
)
return context.REQUEST.RESPONSE.redirect(redirect_url)
if token:
error = ""
try:
......@@ -99,24 +101,15 @@ if batch_mode:
return {'subscription' : subscription_request.getRelativeUrl(),
'payment': payment.getRelativeUrl() }
if target_language == "zh": # Wechat payment
def wrapRedirectWithShadow(payment_transaction, web_site):
# getTotalPayble returns a negative value
if payment_transaction.PaymentTransaction_getTotalPayablePrice() < 0:
if payment_transaction.Base_getWechatServiceRelativeUrl():
return payment_transaction.PaymentTransaction_redirectToManualWechatPayment(web_site)
return payment_transaction.PaymentTransaction_redirectToManualContactUsPayment(web_site)
return payment_transaction.PaymentTransaction_redirectToManualFreePayment(web_site)
else: # Payzen payment
def wrapRedirectWithShadow(payment_transaction, web_site):
# getTotalPayble returns a negative value
if payment_transaction.PaymentTransaction_getTotalPayablePrice() < 0:
if payment_transaction.Base_getPayzenServiceRelativeUrl():
return payment_transaction.PaymentTransaction_redirectToManualPayzenPayment(web_site)
return payment_transaction.PaymentTransaction_redirectToManualContactUsPayment(web_site)
return payment_transaction.PaymentTransaction_redirectToManualFreePayment(web_site)
def wrapRedirectWithShadow(payment_transaction, web_site):
# getTotalPayble returns a negative value
if payment_transaction.PaymentTransaction_getTotalPayablePrice() < 0:
if target_language == "zh":
return payment_transaction.PaymentTransaction_redirectToManualWechatPayment(web_site)
else:
return payment_transaction.PaymentTransaction_redirectToManualPayzenPayment(web_site)
return payment_transaction.PaymentTransaction_redirectToManualFreePayment(web_site)
return person.Person_restrictMethodAsShadowUser(
shadow_document=person,
callable_object=wrapRedirectWithShadow,
......
......@@ -9,12 +9,12 @@ if contract is None:
return
if context.SubscriptionRequest_getTransactionalUser() is not None:
if contract is not None and contract.getMaximumInvoiceDelay() > 0:
if contract.getMaximumInvoiceDelay() > 0:
return True
else:
person = context.getDestinationSectionValue()
if person.Entity_statSlapOSOutstandingAmount() > 0:
return
if contract is not None and contract.getMaximumInvoiceDelay() > 0:
if contract.getMaximumInvoiceDelay() > 0:
return True
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