Beispiel #1
0
    def sign(self, user_visible_data, personal_number=None, **kwargs):
        """Request an signing order. The :py:mod:`collect` method
        is used to query the status of the order.

        :param user_visible_data: The information that the end user is requested to sign.
        :type user_visible_data: unicode
        :param personal_number: The Swedish personal number in format YYYYMMDDXXXX.
        :type personal_number: unicode
        :return: The OrderResponse parsed to a dictionary.
        :rtype: dict
        :raises BankIDError: raises a subclass of this error
                     when error has been returned from server.

        """
        if 'requirementAlternatives' in kwargs:
            warnings.warn("Requirement Alternatives option is not tested.", BankIDWarning)

        try:
            out = self.client.service.Sign(
                userVisibleData=base64.b64encode(user_visible_data),
                personalNumber=personal_number, **kwargs)
        except WebFault as e:
            raise get_error_class(e)("Could not complete Sign order.")

        return self._dictify(out)
Beispiel #2
0
    def sign(self, user_visible_data, personal_number=None, **kwargs):
        """Request an signing order. The :py:meth:`collect` method
        is used to query the status of the order.

        :param user_visible_data: The information that the end user is
            requested to sign.
        :type user_visible_data: str
        :param personal_number: The Swedish personal number in
            format YYYYMMDDXXXX.
        :type personal_number: str
        :return: The OrderResponse parsed to a dictionary.
        :rtype: dict
        :raises BankIDError: raises a subclass of this error
                     when error has been returned from server.

        """
        if 'requirementAlternatives' in kwargs:
            warnings.warn("Requirement Alternatives option is not tested.",
                          BankIDWarning)

        if isinstance(user_visible_data, six.text_type):
            data = base64.b64encode(
                user_visible_data.encode('utf-8')).decode('ascii')
        else:
            data = base64.b64encode(user_visible_data).decode('ascii')

        try:
            out = self.client.service.Sign(userVisibleData=data,
                                           personalNumber=personal_number,
                                           **kwargs)
        except Error as e:
            raise get_error_class(e, "Could not complete Sign order.")

        return self._dictify(out)
Beispiel #3
0
    def collect(self, order_ref):
        """Collect the progress status of the order with the specified
        order reference.

        :param order_ref: The UUID string specifying which order to collect status from.
        :type order_ref: unicode
        :return: The CollectResponse parsed to a dictionary.
        :rtype: dict
        :raises BankIDError: raises a subclass of this error
                             when error has been returned from server.

        """
        try:
            out = self.client.service.Collect(orderRef=order_ref)
        except WebFault as e:
            raise get_error_class(e)("Could not complete Collect call.")

        return self._dictify(out)
Beispiel #4
0
    def collect(self, order_ref):
        """Collect the progress status of the order with the specified
        order reference.

        :param order_ref: The UUID string specifying which order to
            collect status from.
        :type order_ref: str
        :return: The CollectResponse parsed to a dictionary.
        :rtype: dict
        :raises BankIDError: raises a subclass of this error
                             when error has been returned from server.

        """
        try:
            out = self.client.service.Collect(order_ref)
        except Error as e:
            raise get_error_class(e, "Could not complete Collect call.")

        return self._dictify(out)
Beispiel #5
0
    def authenticate(self, personal_number, **kwargs):
        """Request an authentication order. The :py:mod:`collect` method
        is used to query the status of the order.

        :param personal_number: The Swedish personal number in format YYYYMMDDXXXX.
        :type personal_number: unicode
        :return: The OrderResponse parsed to a dictionary.
        :rtype: dict
        :raises BankIDError: raises a subclass of this error
                             when error has been returned from server.

        """
        if 'requirementAlternatives' in kwargs:
            warnings.warn("Requirement Alternatives option is not tested.", BankIDWarning)

        try:
            out = self.client.service.Authenticate(
                personalNumber=personal_number, **kwargs)
        except WebFault as e:
            raise get_error_class(e)("Could not complete Authenticate order.")

        return self._dictify(out)
Beispiel #6
0
    def authenticate(self, personal_number, **kwargs):
        """Request an authentication order. The :py:meth:`collect` method
        is used to query the status of the order.

        :param personal_number: The Swedish personal number
            in format YYYYMMDDXXXX.
        :type personal_number: str
        :return: The OrderResponse parsed to a dictionary.
        :rtype: dict
        :raises BankIDError: raises a subclass of this error
                             when error has been returned from server.

        """
        if 'requirementAlternatives' in kwargs:
            warnings.warn("Requirement Alternatives "
                          "option is not tested.", BankIDWarning)

        try:
            out = self.client.service.Authenticate(
                personalNumber=personal_number, **kwargs)
        except Error as e:
            raise get_error_class(e, "Could not complete Authenticate order.")

        return self._dictify(out)