Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
cd55e725
Commit
cd55e725
authored
Jun 27, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel: Render payment list as table
Use a small page template to mimic the Listbox layout (minimally)
parent
b9229561
Pipeline
#35610
passed with stage
in 0 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
27 deletions
+141
-27
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/AccountingTransactionModule_getCreateExternalPaymentTransactionOnSlaposPanelHTML.py
...e_getCreateExternalPaymentTransactionOnSlaposPanelHTML.py
+23
-14
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_renderOutstandingAmountTable.xml
..._skins/slapos_panel/Base_renderOutstandingAmountTable.xml
+62
-0
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_renderOutstandingAmountTable.zpt
..._skins/slapos_panel/Base_renderOutstandingAmountTable.zpt
+37
-0
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/InstanceTree_viewCreateDirectDepositPaymentTransactionOnSlaposPanelHTML.py
...CreateDirectDepositPaymentTransactionOnSlaposPanelHTML.py
+19
-13
No files found.
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/AccountingTransactionModule_getCreateExternalPaymentTransactionOnSlaposPanelHTML.py
View file @
cd55e725
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
if
REQUEST
is
not
None
:
raise
Unauthorized
...
...
@@ -10,12 +11,12 @@ ledger_uid = portal.portal_categories.ledger.automated.getUid()
# This script will be used to generate the payment
# compatible with external providers
html_content
=
''
entity
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
if
entity
is
None
:
return
'<p>Nothing to pay with your account</p>'
payment_dict_list
=
[]
for
currency_uid
,
secure_service_relative_url
in
[
(
portal
.
currency_module
.
EUR
.
getUid
(),
portal
.
Base_getPayzenServiceRelativeUrl
()),
# (portal.currency_module.CNY.getUid(), portal.Base_getWechatServiceRelativeUrl())
...
...
@@ -32,15 +33,23 @@ for currency_uid, secure_service_relative_url in [
if
not
is_payment_configured
:
return
'<p>Please contact us to handle your payment</p>'
html_content
+=
"""
<p><a href="%(payment_url)s">%(total_price)s %(currency)s</a></p>
"""
%
{
'total_price'
:
outstanding_amount
.
total_price
,
'currency'
:
outstanding_amount
.
getPriceCurrencyReference
(),
'payment_url'
:
'%s/Base_createExternalPaymentTransactionFromOutstandingAmountAndRedirect'
%
outstanding_amount
.
absolute_url
()
}
if
not
html_content
:
html_content
=
'<p>Nothing to pay</p>'
return
html_content
reference
=
outstanding_amount
.
getReference
()
stop_date
=
outstanding_amount
.
getStopDate
()
if
outstanding_amount
.
getPortalType
()
==
"Subscription Request"
:
reference
=
"Subscriptions pre-payment"
stop_date
=
DateTime
()
payment_dict_list
.
append
({
"reference"
:
reference
,
# Format by hand is not a good idea probably
"date"
:
stop_date
.
strftime
(
'%d/%m/%Y'
),
"url"
:
'%s/Base_createExternalPaymentTransactionFromOutstandingAmountAndRedirect'
%
outstanding_amount
.
absolute_url
(),
"total_price"
:
outstanding_amount
.
total_price
,
"currency"
:
outstanding_amount
.
getPriceCurrencyReference
()
})
if
not
payment_dict_list
:
return
'<p>Nothing to pay</p>'
# Pass argument via request.
context
.
REQUEST
.
set
(
"payment_dict_list"
,
payment_dict_list
)
return
context
.
Base_renderOutstandingAmountTable
()
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_renderOutstandingAmountTable.xml
0 → 100644
View file @
cd55e725
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_renderOutstandingAmountTable
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_renderOutstandingAmountTable.zpt
0 → 100644
View file @
cd55e725
<tal:block tal:define="payment_dict_list python: request.get('payment_dict_list', [])">
<tal:block tal:condition='payment_dict_list'>
<div class="document_table">
<div class="ui-table-header ui-header">
<h1>Pending Payments (<span tal:content="python: len(payment_dict_list)">0</span>)</h1>
</div>
<table>
<thead class="thead">
<tr>
<th>Reference</th>
<th>Date</th>
<th>Price</th>
<th>Currency</th>
</tr>
</thead>
<tbody>
<tal:block tal:repeat='payment_dict payment_dict_list'>
<tr tal:define="payment_url python: payment_dict['url']">
<td><a tal:attributes="href payment_url"
tal:content="python:payment_dict['reference']">Reference</a></td>
<td><a tal:attributes="href payment_url"
tal:content="python:payment_dict['date']">Date</a></td>
<td><a tal:attributes="href payment_url"
tal:content="python:payment_dict['total_price']">Price</a></td>
<td><a tal:attributes="href payment_url"
tal:content="python:payment_dict['currency']">Currency</a></td>
</tr>
</tal:block>
</tbody>
<tfoot></tfoot>
</table>
<nav>
<span class="ui-disabled" tal:content="python: '%s records' % len(payment_dict_list)">No records</span>
</nav>
</div>
</tal:block>
</tal:block>
\ No newline at end of file
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/InstanceTree_viewCreateDirectDepositPaymentTransactionOnSlaposPanelHTML.py
View file @
cd55e725
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
if
REQUEST
is
not
None
:
raise
Unauthorized
...
...
@@ -9,7 +10,8 @@ assert web_site is not None
# This script will be used to generate the payment
# compatible with external providers
html_content
=
''
payment_dict_list
=
[]
entity
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
if
entity
is
None
:
return
'<p>Nothing to pay with your account</p>'
...
...
@@ -70,6 +72,7 @@ if subscription_request is not None:
outstanting_total_price
=
sum
([
i
.
total_price
for
i
in
outstanding_amount_list
])
outstanting_total_price
+=
price
if
outstanting_total_price
>
0
:
if
not
isPaymentConfigured
(
currency_uid
):
return
'<p>Please contact us to handle your payment</p>'
...
...
@@ -78,15 +81,18 @@ if subscription_request is not None:
if
subscription_request
.
isTempObject
():
payment_url
=
context
.
absolute_url
()
+
"/InstanceTree_redirectToManualDepositPayment"
html_content
+=
"""
<p><a href="%(payment_url)s">%(total_price)s %(currency)s</a></p>
"""
%
{
'total_price'
:
outstanting_total_price
,
'currency'
:
subscription_request
.
getPriceCurrencyReference
(),
'payment_url'
:
payment_url
}
if
not
html_content
:
html_content
=
'<p>Nothing to pay</p>'
return
html_content
payment_dict_list
.
append
({
"reference"
:
"Subscriptions pre-payment"
,
# Format by hand is not a good idea probably
"date"
:
DateTime
().
strftime
(
'%d/%m/%Y'
),
"url"
:
payment_url
,
"total_price"
:
outstanting_total_price
,
"currency"
:
subscription_request
.
getPriceCurrencyReference
()
})
if
not
payment_dict_list
:
return
'<p>Nothing to pay</p>'
# Pass argument via request.
context
.
REQUEST
.
set
(
"payment_dict_list"
,
payment_dict_list
)
return
context
.
Base_renderOutstandingAmountTable
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment