Commit 089c8a92 authored by Jérome Perrin's avatar Jérome Perrin

payment_mean: add an interaction workflow to deliver directly

payment transaction group workflow's deliver action is a two step delivery,
which "start delivery" and wait for an interaction to finish the delivery.

Add a default interaction workflow which finishes the delivery immediately,
otherwise the payment transaction group stay in delivering state when user
use the Deliver workflow action.
parent 926e00a5
<workflow_chain> <workflow_chain>
<chain> <chain>
<type>Payment Transaction Group</type> <type>Payment Transaction Group</type>
<workflow>edit_workflow, payment_transaction_group_validation_workflow</workflow> <workflow>edit_workflow, payment_transaction_group_delivering_interaction_workflow, payment_transaction_group_validation_workflow</workflow>
</chain> </chain>
</workflow_chain> </workflow_chain>
\ No newline at end of file
...@@ -48,6 +48,19 @@ class TestPaymentTransactionGroupReferences(ERP5TypeTestCase): ...@@ -48,6 +48,19 @@ class TestPaymentTransactionGroupReferences(ERP5TypeTestCase):
ptg.getSourceReference(), cloned_ptg.getSourceReference()) ptg.getSourceReference(), cloned_ptg.getSourceReference())
class TestPaymentTransactionGroupWorkflow(ERP5TypeTestCase):
def test_workflow_transitions(self):
ptg = self.portal.payment_transaction_group_module.newContent(
portal_type='Payment Transaction Group')
self.assertEqual(ptg.getValidationState(), 'draft')
self.portal.portal_workflow.doActionFor(ptg, 'open_action')
self.assertEqual(ptg.getValidationState(), 'open')
self.portal.portal_workflow.doActionFor(ptg, 'close_action')
self.assertEqual(ptg.getValidationState(), 'closed')
self.portal.portal_workflow.doActionFor(ptg, 'deliver_action')
self.assertEqual(ptg.getValidationState(), 'delivered')
class TestPaymentTransactionGroupConstraint(ERP5TypeTestCase): class TestPaymentTransactionGroupConstraint(ERP5TypeTestCase):
def afterSetUp(self): def afterSetUp(self):
ti = self.portal.portal_types['Payment Transaction Group'] ti = self.portal.portal_types['Payment Transaction Group']
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction Workflow" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Directly deliver the payment transaction groups at the beginning of delivery.\n
\n
This workflow is meant to be replaced by interaction workflow doing more complex interactions, like using a banking interface.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>payment_transaction_group_delivering_interaction_workflow</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interaction Workflow</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>payment_transaction_group_delivering_interaction_workflow</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction Workflow Interaction" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>after_script/portal_workflow/payment_transaction_group_delivering_interaction_workflow/script_Workflow_deliver</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interaction_beginDelivery</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interaction Workflow Interaction</string> </value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Begin Delivery</string> </value>
</item>
<item>
<key> <string>trigger_method_id</string> </key>
<value>
<tuple>
<string>beginDelivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>trigger_once_per_transaction</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Workflow Script" module="erp5.portal_type"/>
</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>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>script_Workflow_deliver</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Workflow Script</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Payment Transaction Group | edit_workflow Payment Transaction Group | edit_workflow
Payment Transaction Group | payment_transaction_group_delivering_interaction_workflow
Payment Transaction Group | payment_transaction_group_validation_workflow Payment Transaction Group | payment_transaction_group_validation_workflow
\ No newline at end of file
payment_transaction_group_delivering_interaction_workflow
payment_transaction_group_validation_workflow payment_transaction_group_validation_workflow
\ No newline at end of file
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