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
Carlos Ramos Carreño
slapos.core
Commits
ce45a47b
Commit
ce45a47b
authored
Jan 29, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Submit payment only if the amount is not null.
parent
0bf6ae0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
4 deletions
+63
-4
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_startPayzenPayment.xml
...s/slapos_payzen/PaymentTransaction_startPayzenPayment.xml
+2
-1
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenAlarm.py
...5/slapos_payzen/TestTemplateItem/testSlapOSPayzenAlarm.py
+60
-2
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_startPayzenPayment.xml
View file @
ce45a47b
...
@@ -54,7 +54,8 @@
...
@@ -54,7 +54,8 @@
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
state = context.getSimulationState()\n
state = context.getSimulationState()\n
if (state != \'confirmed\') or (context.getPaymentMode() != \'payzen\'):\n
transaction_amount = int(round((context.PaymentTransaction_getTotalPayablePrice() * -100), 2))\n
if (state != \'confirmed\') or (context.getPaymentMode() != \'payzen\') or (transaction_amount == 0):\n
return\n
return\n
else:\n
else:\n
# Request manual payment\n
# Request manual payment\n
...
...
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenAlarm.py
View file @
ce45a47b
...
@@ -117,6 +117,34 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -117,6 +117,34 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
'Visited by PaymentTransaction_startPayzenPayment'
,
'Visited by PaymentTransaction_startPayzenPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulatePaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 1"""
)
transaction
.
commit
()
def
_simulatePaymentTransaction_getZeroTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 0"""
)
transaction
.
commit
()
def
_dropPaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_not_confirmed_payment
(
self
):
def
test_not_confirmed_payment
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
...
@@ -127,7 +155,11 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -127,7 +155,11 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
)
)
simulation_state
=
transaction
.
getSimulationState
()
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
modification_date
=
transaction
.
getModificationDate
()
transaction
.
PaymentTransaction_startPayzenPayment
()
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEquals
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
transaction
.
getModificationDate
(),
modification_date
)
self
.
assertEquals
(
transaction
.
getModificationDate
(),
modification_date
)
...
@@ -141,7 +173,31 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -141,7 +173,31 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
simulation_state
=
transaction
.
getSimulationState
()
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
modification_date
=
transaction
.
getModificationDate
()
transaction
.
PaymentTransaction_startPayzenPayment
()
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEquals
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
transaction
.
getModificationDate
(),
modification_date
)
def
test_zero_amount_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
self
.
_simulatePaymentTransaction_getZeroTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEquals
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
transaction
.
getModificationDate
(),
modification_date
)
self
.
assertEquals
(
transaction
.
getModificationDate
(),
modification_date
)
...
@@ -174,10 +230,12 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -174,10 +230,12 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
_simulatePaymentTransaction_sendManualPayzenPaymentUrl
()
self
.
_simulatePaymentTransaction_sendManualPayzenPaymentUrl
()
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
finally
:
self
.
_dropPaymentTransaction_sendManualPayzenPaymentUrl
()
self
.
_dropPaymentTransaction_sendManualPayzenPaymentUrl
()
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEquals
(
transaction
.
getSimulationState
(),
'started'
)
self
.
assertEquals
(
transaction
.
getSimulationState
(),
'started'
)
self
.
assertEqual
(
self
.
assertEqual
(
'Visited by PaymentTransaction_sendManualPayzenPaymentUrl'
,
'Visited by PaymentTransaction_sendManualPayzenPaymentUrl'
,
...
...
master/bt5/slapos_payzen/bt/revision
View file @
ce45a47b
100
101
\ 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