Exemple #1
0
    def create_synapse_user(slack_id, request):
        """Creates a new user with Synapse."""
        # 'options' actually required until pending API update or lib change
        options = {
            'note': 'created by Synapse Slackbot',
            'supp_id': slack_id,
            'is_business': False,
            'cip_tag': 1
        }

        return SynapseUser.create(client=synapse_client,
                                  email=request.form['email'],
                                  phone_number=request.form['phone'],
                                  legal_name=request.form['name'].title(),
                                  **options)
Exemple #2
0
def createSynapseUser(srn, data):
    try:
        name = pinyin.get(
            data.get("nameCn"), format="strip", delimiter=" ") if (
                data.get('nameCn', None) != ''
                and data.get('nameCn', None) != None) else data.get("nameEn")
        args = {
            'email': data.get('email'),
            'phone_number': data.get('phoneNumber'),
            'legal_name': name,
            'supp_id': srn,
            'is_business': data.get('isBusiness'),  # default False first
            'cip_tag': 1
        }
        return None, User.create(client, **args)
    except Exception as e:
        logger.debug(traceback.format_exc())
        return {'error': str(e)}, None