示例#1
0
    def get_notification(self, notification_id):
        response = requests.get(
            self.notification_url + '/{}'.format(notification_id),
            params={
                'email': self.base_params['email'],
                'token': self.base_params['token']
            }
        )

        if response.status_code == 200:
            root = xmltodict.parse(response.text)
            transaction = root['transaction']
            notificacao_recebida.send(
                sender=self, transaction=transaction
            )

            status = transaction['status']
            if status in NOTIFICATION_STATUS:
                signal = NOTIFICATION_STATUS[status]
                signal.send(
                    sender=self, transaction=transaction
                )

        logger.debug(
            'operation=api_get_notification, '
            'notification_id={}, '
            'response_body={}, '
            'response_status={}'.format(
                notification_id, response.text, response.status_code
            )
        )
        return response
示例#2
0
    def get_notification(self, notification_id):
        response = requests.get(
            self.notification_url + "/{}".format(notification_id),
            params={
                "email": self.base_params["email"],
                "token": self.base_params["token"]
            },
        )

        if response.status_code == 200:
            root = xmltodict.parse(response.text)
            transaction = root["transaction"]
            notificacao_recebida.send(sender=self, transaction=transaction)

            status = transaction["status"]
            if status in NOTIFICATION_STATUS:
                signal = NOTIFICATION_STATUS[status]
                signal.send(sender=self, transaction=transaction)

        logger.debug("operation=api_get_notification, "
                     "notification_id={}, "
                     "response_body={}, "
                     "response_status={}".format(notification_id,
                                                 response.text,
                                                 response.status_code))
        return response
示例#3
0
    def get_notification(self, notification_id):
        response = requests.get(
            self.notification_url + '/{0}'.format(notification_id),
            params={
                'email': self.base_params['email'],
                'token': self.base_params['token']
            }
        )

        if response.status_code == 200:
            root = xmltodict.parse(response.text)
            transaction = root['transaction']
            notificacao_recebida.send(
                sender=self, transaction=transaction
            )

            status = transaction['status']
            if status in NOTIFICATION_STATUS:
                signal = NOTIFICATION_STATUS[status]
                signal.send(
                    sender=self, transaction=transaction
                )

        return response