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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
slapos.core
Commits
e08a7f43
Commit
e08a7f43
authored
Mar 01, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send an email when creating a Payment Transaction
parent
36368395
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
17 deletions
+63
-17
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_sendManualPayzenPaymentUrl.xml
..._payzen/PaymentTransaction_sendManualPayzenPaymentUrl.xml
+38
-10
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenSkins.py
...5/slapos_payzen/TestTemplateItem/testSlapOSPayzenSkins.py
+24
-6
master/bt5/slapos_payzen/bt/revision
master/bt5/slapos_payzen/bt/revision
+1
-1
No files found.
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_sendManualPayzenPaymentUrl.xml
View file @
e08a7f43
...
@@ -58,21 +58,49 @@ if (context.getPaymentMode() != \'payzen\'):\n
...
@@ -58,21 +58,49 @@ if (context.getPaymentMode() != \'payzen\'):\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
ticket = context.PaymentTransaction_addPayzenTicket()\n
ticket = context.PaymentTransaction_addPayzenTicket()\n
\n
\n
site_message = portal.event_module.newContent(\n
# site_message = portal.event_module.newContent(\n
portal_type=\'Site Message\',\n
# portal_type=\'Site Message\',\n
# start_date=DateTime(),\n
# destination_value=context.getDestinationSectionValue(),\n
# follow_up=ticket.getRelativeUrl(),\n
# source_value=context.getSourceSectionValue(),\n
# resource=ticket.getResource(),\n
# title="Payment requested",\n
# # XXX Hardcoded script provided by another bt5\n
# text_content=\'Please pay your payment by clicking <a \'\\\n
# \'href="%s/PaymentTransaction_redirectToManualPayzenPayment">
here
</a>
.\' % \\\n
# context.getRelativeUrl(),\n
# )\n
# site_message.start(comment=\'Requested manual payment.\')\n
\n
mail_message = portal.event_module.newContent(\n
portal_type=\'Mail Message\',\n
start_date=DateTime(),\n
start_date=DateTime(),\n
destination_value=context.getDestinationSectionValue(),\n
destination_value=context.getDestinationSectionValue(),\n
follow_up=ticket.getRelativeUrl(),\n
follow_up=ticket.getRelativeUrl(),\n
source_value=context.getSourceSectionValue(),\n
source_value=context.getSourceSectionValue(),\n
title=\'Invoice payment requested\',\n
resource=ticket.getResource(),\n
resource=ticket.getResource(),\n
title="Payment requested",\n
# # XXX Hardcoded script provided by another bt5\n
# XXX Hardcoded script provided by another bt5\n
# text_content=\'Please pay your payment by clicking
<a
\'\\\n
text_content=\'Please pay your payment by clicking <a \'\\\n
#
\'
href=
"%s/PaymentTransaction_redirectToManualPayzenPayment"
>
here
</a>
.\' % \\\n
\'href="%s/PaymentTransaction_redirectToManualPayzenPayment">
here
</a>
.\' % \\\n
# context.getRelativeUrl(),\n
context.getRelativeUrl(),\n
text_content="""\n
)\n
Dear user,\n
site_message.start(comment=\'Requested manual payment.\')\n
\n
return site_message\n
A new invoice has been generated. \n
You can access it in your invoice section at %s.\n
\n
Do not hesitate to visit the web forum (http://community.slapos.org/forum) in case of question.\n
\n
Regards,\n
The slapos team\n
""" % portal.portal_preferences.getPreferredSlaposWebSiteUrl())\n
mail_message.start(comment=\'Requested manual payment.\')\n
mail_message.stop(comment=\'Requested manual payment.\')\n
mail_message.deliver(comment=\'Requested manual payment.\')\n
\n
return mail_message\n
]]>
</string>
</value>
]]>
</string>
</value>
...
...
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenSkins.py
View file @
e08a7f43
...
@@ -5,6 +5,7 @@ from Products.SlapOS.tests.testSlapOSMixin import \
...
@@ -5,6 +5,7 @@ from Products.SlapOS.tests.testSlapOSMixin import \
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
difflib
class
TestSlapOSPaymentTransaction_sendManualPayzenPaymentUrl
(
testSlapOSMixin
):
class
TestSlapOSPaymentTransaction_sendManualPayzenPaymentUrl
(
testSlapOSMixin
):
...
@@ -25,6 +26,11 @@ class TestSlapOSPaymentTransaction_sendManualPayzenPaymentUrl(testSlapOSMixin):
...
@@ -25,6 +26,11 @@ class TestSlapOSPaymentTransaction_sendManualPayzenPaymentUrl(testSlapOSMixin):
None
)
None
)
def
test_sendManualPayzenPaymentUrl_payzen_payment
(
self
):
def
test_sendManualPayzenPaymentUrl_payzen_payment
(
self
):
for
preference
in
\
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
preference
=
preference
.
getObject
()
if
preference
.
getPreferenceState
()
==
'global'
:
preference
.
setPreferredSlaposWebSiteUrl
(
'http://foobar.org/'
)
person1
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
)
person1
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
)
person2
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
)
person2
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
)
transaction
=
self
.
createPaymentTransaction
()
transaction
=
self
.
createPaymentTransaction
()
...
@@ -36,18 +42,30 @@ class TestSlapOSPaymentTransaction_sendManualPayzenPaymentUrl(testSlapOSMixin):
...
@@ -36,18 +42,30 @@ class TestSlapOSPaymentTransaction_sendManualPayzenPaymentUrl(testSlapOSMixin):
event
=
transaction
.
PaymentTransaction_sendManualPayzenPaymentUrl
()
event
=
transaction
.
PaymentTransaction_sendManualPayzenPaymentUrl
()
after_date
=
DateTime
()
after_date
=
DateTime
()
ticket
=
transaction
.
PaymentTransaction_addPayzenTicket
()
ticket
=
transaction
.
PaymentTransaction_addPayzenTicket
()
self
.
assertEquals
(
event
.
getPortalType
(),
'
Site
Message'
)
self
.
assertEquals
(
event
.
getPortalType
(),
'
Mail
Message'
)
self
.
assertTrue
(
event
.
getStartDate
()
>=
before_date
)
self
.
assertTrue
(
event
.
getStartDate
()
>=
before_date
)
self
.
assertTrue
(
event
.
getStopDate
()
<=
after_date
)
self
.
assertTrue
(
event
.
getStopDate
()
<=
after_date
)
self
.
assertEquals
(
event
.
getTitle
(),
"Invoice payment requested"
)
self
.
assertEquals
(
event
.
getDestination
(),
self
.
assertEquals
(
event
.
getDestination
(),
transaction
.
getDestinationSection
())
transaction
.
getDestinationSection
())
self
.
assertEquals
(
event
.
getSourceSection
(),
self
.
assertEquals
(
event
.
getSourceSection
(),
transaction
.
getSource
())
transaction
.
getSource
())
self
.
assertEquals
(
event
.
getTextContent
(),
expected_text_content
=
"""
'Please pay your payment by clicking <a href="'
+
\
Dear user,
transaction
.
getRelativeUrl
()
+
\
'/PaymentTransaction_redirectToManualPayzenPayment">here</a>.'
)
A new invoice has been generated.
self
.
assertEquals
(
event
.
getSimulationState
(),
'started'
)
You can access it in your invoice section at http://foobar.org/.
Do not hesitate to visit the web forum (http://community.slapos.org/forum) in case of question.
Regards,
The slapos team
"""
self
.
assertEquals
(
event
.
getTextContent
(),
expected_text_content
,
'
\
n
'
.
join
([
x
for
x
in
difflib
.
unified_diff
(
event
.
getTextContent
().
splitlines
(),
expected_text_content
.
splitlines
())]))
self
.
assertEquals
(
event
.
getSimulationState
(),
'delivered'
)
self
.
assertEquals
(
event
.
getFollowUp
(),
self
.
assertEquals
(
event
.
getFollowUp
(),
ticket
.
getRelativeUrl
())
ticket
.
getRelativeUrl
())
...
...
master/bt5/slapos_payzen/bt/revision
View file @
e08a7f43
110
111
\ No newline at end of file
\ No newline at end of file
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