def test_not_payzen_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, ) self.portal.portal_workflow._jumpToStateFor(transaction, 'started') simulation_state = transaction.getSimulationState() modification_date = transaction.getModificationDate() transaction.PaymentTransaction_updateStatus() self.assertEquals(transaction.getSimulationState(), simulation_state) self.assertEquals(transaction.getModificationDate(), modification_date)
def test_not_confirmed_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", ) simulation_state = transaction.getSimulationState() modification_date = transaction.getModificationDate() transaction.PaymentTransaction_startPayzenPayment() self.assertEquals(transaction.getSimulationState(), simulation_state) self.assertEquals(transaction.getModificationDate(), modification_date)
def test_paid_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", start_date=DateTime(), ) self.portal.portal_workflow._jumpToStateFor(transaction, 'started') # Manually generate mapping transaction.PaymentTransaction_generatePayzenId() self._simulatePaymentTransaction_createPaidPayzenEvent() try: transaction.PaymentTransaction_updateStatus() finally: self._dropPaymentTransaction_createPayzenEvent() self.assertEqual( 'Visited by PaymentTransaction_createPayzenEvent', transaction.workflow_history['edit_workflow'][-1]['comment']) self.assertEqual( None, transaction.workflow_history['edit_workflow'][-2]['comment']) self.assertEquals(transaction.getSimulationState(), 'stopped')
def test_not_payzen_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, ) self.portal.portal_workflow._jumpToStateFor(transaction, 'confirmed') simulation_state = transaction.getSimulationState() modification_date = transaction.getModificationDate() 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_not_registered_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, 'started') self._simulatePaymentTransaction_addPayzenTicket() try: transaction.PaymentTransaction_updateStatus() finally: self._dropPaymentTransaction_addPayzenTicket() self.assertEquals(transaction.getSimulationState(), 'started') self.assertEqual( 'Visited by PaymentTransaction_addPayzenTicket', transaction.workflow_history['edit_workflow'][-1]['comment'])