Commit fefb8caa authored by Romain Courteaud's avatar Romain Courteaud

Handle refused payzen payment.

parent 3de0ab52
......@@ -106,6 +106,7 @@ elif error_code == \'0\':\n
}\n
mark_transaction_id_list = [\'0\', \'1\', \'3\', \'4\', \'5\', \'10\', \'11\', \'12\']\n
continue_transaction_id_list = [\'6\']\n
cancel_transaction_id_list = [\'8\']\n
\n
transaction_status = data_kw[\'transactionStatus\']\n
\n
......@@ -153,6 +154,12 @@ elif error_code == \'0\':\n
else:\n
payzen_event.confirm(comment=\'Expected to put transaction in stopped state, but achieved only %s state\' % transaction.getSimulationState())\n
\n
elif transaction_status in cancel_transaction_id_list:\n
payzen_event.confirm()\n
payzen_event.acknowledge(comment=\'Refused payzen payment.\')\n
if isTransitionPossible(transaction, \'cancel\'):\n
transaction.cancel(comment=\'Aborting refused payzen payment.\')\n
return\n
else:\n
payzen_event.confirm(comment=\'Transaction status %r (%r) is not supported\' \\\n
% (transaction_status, transaction_status_description))\n
......
......@@ -585,6 +585,27 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
'Aborting unknown payzen payment.',
payment.workflow_history['accounting_workflow'][-1]['comment'])
def test_processUpdate_refusedPayzenPayment(self):
event = self.createPayzenEvent()
payment = self.createPaymentTransaction()
event.edit(destination_value=payment)
data_kw = {
'errorCode': '0',
'transactionStatus': '8',
}
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "acknowledged")
self.assertEqual(
'Refused payzen payment.',
event.workflow_history['system_event_workflow'][-1]['comment'])
self.assertEquals(payment.getSimulationState(), "cancelled")
self.assertEqual(
'Aborting refused payzen payment.',
payment.workflow_history['accounting_workflow'][-1]['comment'])
class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(testSlapOSMixin):
def beforeTearDown(self):
......
115
\ No newline at end of file
116
\ 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