Exemplo n.º 1
0
    def process_mti_req(self, msg):
        # Check time to live against opened since
        now = datetime.datetime.now()
       
        try: 
            assert self._logged, True
            assert now - self._opened_since < self._ttl
        except:
            raise

        hub_handler = HubHandler()
        response_unproc = hub_handler.process_hub_request(msg)
        response_hub = hub_handler.parse_xml_hub_response(response_unproc)

        result_transaction, importeOut = self.translate_to_ISO8583(response_hub)
        
        # Send message parameters based on result_transaction

        return ISO8583Parser.ensamble_response_req(msg, importeOut, result_transaction)
    def test_ensamble_response_req(self):
        expected = MOCK_MESSAGE_RESPONSE_REQ
        result = ISO8583Parser.ensamble_response_req(MOCK_MESSAGE_REQ, '0', 
                                                    OK_TRANSACTION)

        self.assertEquals(result, expected)