예제 #1
0
    def update_branding_logo(self, branding_id, file_path):
        """
        Update the logo of a branding
        """
        params = {'files': file_path}

        parser = Parser(self.TOUCH_BRANDING_PARAMS, [])
        params, files = parser.parse_data(params)

        connection = Connection(self.token)

        connection.add_files(files)
        connection.set_url(self.production, self.BRANDINGS_LOGO_URL % (branding_id, 'logo'))

        return connection.put_request()
예제 #2
0
    def update_branding_email(self, branding_id, template, file_path):
        """
        Update the template of a branding
        """
        params = {'files': file_path}

        parser = Parser(self.TOUCH_BRANDING_PARAMS, [])
        params, files = parser.parse_data(params)

        connection = Connection(self.token)

        connection.add_files(files)
        connection.set_url(self.production, self.BRANDINGS_TEMPLATES_URL % (branding_id, 'emails', template))

        return connection.put_request()
예제 #3
0
    def create_signature(self, files, recipients, params):
        """
        Create a new Signature request.
        @files
            Files to send
                ex: ['/documents/internet_contract.pdf', ... ]
        @recipients
            A dictionary with the email and fullname of the person you want to sign.
            If you wanna send only to one person:
               - [{"email": "*****@*****.**", "fullname": "John"}]
            For multiple recipients, yo need to submit a list of dicts:
               - [{"email": "*****@*****.**", "fullname": "John"}, {"email":"*****@*****.**", "fullname": "Bob"}]
            You can attach a phone number to each recipient, and then, the user will receive a security code in his smartphone.
               - [{"email": "*****@*****.**", "fullname": "John", "phone": "XXXX"}]
        @params: An array of params
            - subject: Subject of the email (optional)
            - body: Body of the email (optional)
            - in_person_sign: If you want to do an in person sign (system will not send an email to the user, but return the
                         sign url instead) (optional)
            - sequential: If you want to do a sequential sign (for multiple recipients, the sign goes in sequential way)
                          (optional)
            - mandatory_photo: A list of booleans that tell if photo capture will be asked to finish the signature process. (optional)
            The index of array references the document number, so first value will apply to first document.
            - mandatory_voice: A list of booleans that tell if audio recording will be asked to finish the signature process. (optional)
            The index of array references the document number, so first value will apply to first document.
            - mandatory_pages: A list of list of pages the signer must sign (optional)
            The index of array references the document number, so first value will apply to first document.
                ex: [[1, 2, 5], [1]]
            - branding_id: The id of the branding you want to use. If no branding_id, system use the account default
                           branding. (optional)
        """
        params['files'] = files
        params['recipients'] = recipients

        parser = Parser(self.CREATE_SIGN_PARAMS, [])
        params, files = parser.parse_data(params)

        connection = Connection(self.token)
        connection.set_url(self.production, self.SIGNS_URL)
        connection.add_params(params)
        connection.add_files(files)

        return connection.post_request()
예제 #4
0
    def create_email(self, files, recipients, subject, body, params):
        """
        Create a new certified email

        @files
             Files to send
                ex: ['/documents/internet_contract.pdf', ... ]
        @recipients
            A dictionary with the email and fullname of the person you want to sign.
            If you wanna send only to one person:
               - [{"email": "*****@*****.**", "fullname": "John"}]
            For multiple recipients, yo need to submit a list of dicts:
               - [{"email": "*****@*****.**", "fullname": "John"}, {"email":"*****@*****.**", "fullname": "Bob"}]
        @subject
            Email subject
        @body
            Email body
        @params
            Optional parameters
            send_email_event: Chooses the event that will trigger the audit trail generation
                - delivered: When email is delivered
                - seen: When app is opened (only emails with pdfs attached)
                - opened: When document is opened (only emails with pdfs attached)
        """
        params['files'] = files
        params['recipients'] = recipients
        params['subject'] = subject
        params['body'] = body

        parser = Parser(self.CREATE_EMAIL_PARAMS, [])
        params, files = parser.parse_data(params)

        connection = Connection(self.token)
        connection.set_url(self.production, self.EMAILS_URL)
        connection.add_params(params)
        connection.add_files(files)

        return connection.post_request()