Commit 1e0677c8 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_panel: Jump into instance tree payment if possible

   Prefer use payment page related to the instance tree rather them the generic one, so it reduces confusion.
parent 49e1a4b6
......@@ -12,7 +12,7 @@ portal = context.getPortalObject()
NOTHING_TO_PAY = context.Base_translateString('Nothing to pay')
NOTHING_TO_PAY_NO_PERSON = context.Base_translateString('Nothing to pay with your account')
PLEASE_CONTACT_US = context.Base_transalteString('Please contact us to handle your payment')
PLEASE_CONTACT_US = context.Base_translateString('Please contact us to handle your payment')
# This script will be used to generate the payment
# compatible with external providers
......@@ -36,7 +36,7 @@ for currency_uid, secure_service_relative_url in context.Base_getSupportedExtern
for outstanding_amount in method(**kw):
if 0 < outstanding_amount.total_price:
if return_message:
assert secure_service_relative_url is not None, \
assert secure_service_relative_url, \
"Payment is configured (and should not)"
return PLEASE_CONTACT_US
return True
......
......@@ -3,6 +3,6 @@ if REQUEST is not None:
raise Unauthorized
for uid, secure_service_relative_url in context.Base_getSupportedExternalPaymentList():
if currency_uid == uid and secure_service_relative_url is not None:
if currency_uid == uid and secure_service_relative_url:
return 1
return 0
......@@ -4,7 +4,7 @@ if REQUEST is not None:
NOTHING_TO_PAY = context.Base_translateString('Nothing to pay')
NOTHING_TO_PAY_NO_PERSON = context.Base_translateString('Nothing to pay with your account')
PLEASE_CONTACT_US = context.Base_transalteString('Please contact us to handle your payment')
PLEASE_CONTACT_US = context.Base_translateString('Please contact us to handle your payment')
portal = context.getPortalObject()
entity = portal.portal_membership.getAuthenticatedMember().getUserValue()
......@@ -60,7 +60,7 @@ outstanting_total_price += price
if outstanting_total_price > 0:
if return_message:
assert context.Base_isExternalPaymentConfigured(currency_uid), \
assert not context.Base_isExternalPaymentConfigured(currency_uid), \
"Payment is configured (and should not)"
return PLEASE_CONTACT_US
return True
......
aggregate_value = context.getAggregateValue()
if aggregate_value.getPortalType() == "Instance Tree":
return aggregate_value.Base_redirect(
'InstanceTree_viewCreateDirectDepositPaymentTransactionOnSlaposPanelDialog'
)
return context.getPortalObject().accounting_module.Base_redirect(
"AccountingTransactionModule_viewCreateExternalPaymentTransactionOnSlaposPanelDialog")
......@@ -330,12 +330,12 @@
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='field_your_pay_action_html']//p[contains(text(), 'Please contact us to handle your payment')]</td>
<td>//div[@data-gadget-scope='field_your_message']//p[contains(text(), 'Please contact us to handle your payment')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='field_your_pay_action_html']//p[contains(text(), 'Please contact us to handle your payment')]</td>
<td>//div[@data-gadget-scope='field_your_message']//p[contains(text(), 'Please contact us to handle your payment')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
......
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