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
Boxiang Sun
slapos.core
Commits
db3a5a39
Commit
db3a5a39
authored
Jan 30, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically close not needed support request.
parent
1a8cea16
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
488 additions
and
1 deletion
+488
-1
master/bt5/slapos_payzen/PathTemplateItem/portal_alarms/slapos_payzen_update_suspended_support_request.xml
...alarms/slapos_payzen_update_suspended_support_request.xml
+103
-0
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenSuspendedSupportRequest.xml
...apos_payzen/Alarm_updatePayzenSuspendedSupportRequest.xml
+75
-0
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/SupportRequest_updateStatus.xml
...ortal_skins/slapos_payzen/SupportRequest_updateStatus.xml
+78
-0
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenAlarm.py
...5/slapos_payzen/TestTemplateItem/testSlapOSPayzenAlarm.py
+230
-0
master/bt5/slapos_payzen/bt/revision
master/bt5/slapos_payzen/bt/revision
+1
-1
master/bt5/slapos_payzen/bt/template_path_list
master/bt5/slapos_payzen/bt/template_path_list
+1
-0
No files found.
master/bt5/slapos_payzen/PathTemplateItem/portal_alarms/slapos_payzen_update_suspended_support_request.xml
0 → 100644
View file @
db3a5a39
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Alarm"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_updatePayzenSuspendedSupportRequest
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_payzen_update_suspended_support_request
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_hour_frequency
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1288051200.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
sense_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Handles suspended Support Request
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenSuspendedSupportRequest.xml
0 → 100644
View file @
db3a5a39
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type="Support Request", \n
simulation_state=["suspended"],\n
method_id=\'SupportRequest_updateStatus\',\n
default_source_project_portal_type="Payment Transaction",\n
activate_kw={\'tag\': tag}\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_updatePayzenSuspendedSupportRequest
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/SupportRequest_updateStatus.xml
0 → 100644
View file @
db3a5a39
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_body
</string>
</key>
<value>
<string>
# from DateTime import DateTime\n
portal = context.getPortalObject()\n
\n
state = context.getSimulationState()\n
payment = context.getSourceProjectValue(portal_type="Payment Transaction")\n
if (state != \'suspended\') or \\\n
(payment is None) or \\\n
(payment.getPaymentMode() != \'payzen\') or \\\n
(payment.getSimulationState() not in ("cancelled", "stopped", "delivered")):\n
return\n
else:\n
context.invalidate(comment="Payzen payment state is %s" % payment.getSimulationState())\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SupportRequest_updateStatus
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenAlarm.py
View file @
db3a5a39
...
...
@@ -517,3 +517,233 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
self
.
assertNotEqual
(
'Visited by PaymentTransaction_updateStatus'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSPayzenUpdateSuspendedSupportRequest
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
test_not_suspended_support_request
(
self
):
new_id
=
self
.
generateNewId
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
payment
.
cancel
()
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
source_project_value
=
payment
,
)
simulation_state
=
ticket
.
getSimulationState
()
modification_date
=
ticket
.
getModificationDate
()
ticket
.
SupportRequest_updateStatus
()
self
.
assertEquals
(
ticket
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
ticket
.
getModificationDate
(),
modification_date
)
def
test_not_payzen_payment_support_request
(
self
):
new_id
=
self
.
generateNewId
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
)
payment
.
cancel
()
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
source_project_value
=
payment
,
)
ticket
.
validate
()
ticket
.
suspend
()
simulation_state
=
ticket
.
getSimulationState
()
modification_date
=
ticket
.
getModificationDate
()
ticket
.
SupportRequest_updateStatus
()
self
.
assertEquals
(
ticket
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
ticket
.
getModificationDate
(),
modification_date
)
def
test_not_finalyzed_payment_support_request
(
self
):
new_id
=
self
.
generateNewId
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
payment
.
start
()
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
source_project_value
=
payment
,
)
ticket
.
validate
()
ticket
.
suspend
()
simulation_state
=
ticket
.
getSimulationState
()
modification_date
=
ticket
.
getModificationDate
()
ticket
.
SupportRequest_updateStatus
()
self
.
assertEquals
(
ticket
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
ticket
.
getModificationDate
(),
modification_date
)
def
test_no_payment_support_request
(
self
):
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
)
ticket
.
validate
()
ticket
.
suspend
()
simulation_state
=
ticket
.
getSimulationState
()
modification_date
=
ticket
.
getModificationDate
()
ticket
.
SupportRequest_updateStatus
()
self
.
assertEquals
(
ticket
.
getSimulationState
(),
simulation_state
)
self
.
assertEquals
(
ticket
.
getModificationDate
(),
modification_date
)
def
test_cancel_payment_support_request
(
self
):
new_id
=
self
.
generateNewId
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
payment
.
cancel
()
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
source_project_value
=
payment
,
)
ticket
.
validate
()
ticket
.
suspend
()
ticket
.
SupportRequest_updateStatus
()
self
.
assertEquals
(
ticket
.
getSimulationState
(),
"invalidated"
)
def
test_closed_payment_support_request
(
self
):
new_id
=
self
.
generateNewId
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
_jumpToStateFor
=
self
.
portal
.
portal_workflow
.
_jumpToStateFor
_jumpToStateFor
(
payment
,
"stopped"
)
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
source_project_value
=
payment
,
)
ticket
.
validate
()
ticket
.
suspend
()
ticket
.
SupportRequest_updateStatus
()
self
.
assertEquals
(
ticket
.
getSimulationState
(),
"invalidated"
)
def
_simulateSupportRequest_updateStatus
(
self
):
script_name
=
'SupportRequest_updateStatus'
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
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by SupportRequest_updateStatus') """
)
transaction
.
commit
()
def
_dropSupportRequest_updateStatus
(
self
):
script_name
=
'SupportRequest_updateStatus'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_alarm_no_payment_support_request
(
self
):
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
self
.
_simulateSupportRequest_updateStatus
()
try
:
self
.
portal
.
portal_alarms
.
\
slapos_payzen_update_suspended_support_request
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropSupportRequest_updateStatus
()
self
.
assertNotEqual
(
'Visited by SupportRequest_updateStatus'
,
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_suspended_support_request
(
self
):
new_id
=
self
.
generateNewId
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
)
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
source_project_value
=
payment
,
)
ticket
.
validate
()
self
.
tic
()
self
.
_simulateSupportRequest_updateStatus
()
try
:
self
.
portal
.
portal_alarms
.
\
slapos_payzen_update_suspended_support_request
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropSupportRequest_updateStatus
()
self
.
assertNotEqual
(
'Visited by SupportRequest_updateStatus'
,
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_suspended_support_request
(
self
):
new_id
=
self
.
generateNewId
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment %s"
%
new_id
,
reference
=
"TESTPAY-%s"
%
new_id
,
)
new_id
=
self
.
generateNewId
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
"Ticket %s"
%
new_id
,
reference
=
"TESTSUPREQ-%s"
%
new_id
,
source_project_value
=
payment
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
self
.
_simulateSupportRequest_updateStatus
()
try
:
self
.
portal
.
portal_alarms
.
\
slapos_payzen_update_suspended_support_request
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropSupportRequest_updateStatus
()
self
.
assertEqual
(
'Visited by SupportRequest_updateStatus'
,
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
master/bt5/slapos_payzen/bt/revision
View file @
db3a5a39
102
\ No newline at end of file
103
\ No newline at end of file
master/bt5/slapos_payzen/bt/template_path_list
View file @
db3a5a39
portal_alarms/slapos_payzen_update_confirmed_payment
portal_alarms/slapos_payzen_update_started_payment
portal_alarms/slapos_payzen_update_suspended_support_request
portal_integrations/slapos_payzen_test_integration
portal_integrations/slapos_payzen_test_integration/Causality
portal_integrations/slapos_payzen_test_integration/Resource
...
...
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