Beispiel #1
0
 def post(self):
     if check_creds(tornado.escape.native_str(self.get_argument('creds'))):
         database = 'data/records.sql'
         try:
             email = tornado.escape.native_str(self.get_argument("email"))
             split = email.split("\n")
             for s in split:
                 if s.startswith("https"):
                     oppID = s.strip()[-15:]
         except:
             oppID = tornado.escape.native_str(self.get_argument("opp"))
             if oppID.startswith("https"):
                 oppID = oppID[-15:].strip()
         if oppID:
             # Status change of se request
             jira, rep, se, account = createJIRA(oppID)
             resources.sfdc_details(oppID, status="In Progress")
             response = {
                 'jira': jira,
                 'oppID': oppID,
                 'rep': rep,
                 'owner': se,
                 'account': account
             }
             self.write(response)
             rowid = db_manage.create_record(
                 db_manage.create_connection(database),
                 (account, oppID, jira, '', se, rep, 'Open'))
         else:
             self.write("Error")
     else:
         self.write('Invalid Credentials.')
Beispiel #2
0
def createJIRA(oppID):
    account, opp, req, rep, se = sfdc_details(oppID, status='In Progress')
    task_list, parent_issue = clone_template_ticket(account, opp, req, rep, se)
    # org_list = new_task(e, task_list, parent_issue)
    # parent_issues.append(parent_issue)
    sfdc_details(
        oppID,
        jira='https://estalea.atlassian.net/browse/{}'.format(parent_issue))
    return parent_issue, rep, se, req['Account_Name__c']
Beispiel #3
0
 def get(self):
     if check_creds(tornado.escape.native_str(self.get_argument('creds'))):
         oppID = tornado.escape.native_str(self.get_argument('oppID'))
         account, opp, req, rep, se = resources.sfdc_details(oppID)
         sf = resources.sfdc_login()
         res_dictionary = {
             'contacts': {},
             'type': req['Implementation_Type__c']
         }
         print(req['Tech_Contact__c'])
         try:
             contact = sf.Contact.get(req['Tech_Contact__c'])
             res_dictionary['contacts']['tech'] = [
                 contact['Name'], contact['Email']
             ]
         except:
             print('No tech contact')
         if req['Business_Contact__c'] != req['Tech_Contact__c']:
             try:
                 contact = sf.Contact.get(req['Business_Contact__c'])
                 res_dictionary['contacts']['business'] = [
                     contact['Name'], contact['Email']
                 ]
             except:
                 print('No business contact')
         self.write(res_dictionary)
     else:
         self.write('Invalid Credentials.')
Beispiel #4
0
def resolve_issue(jira, oppID, task_type):
    database = 'data/records.sql'
    j = login()
    if task_type == 'parent':
        conn = db_manage.create_connection(database)
        db_manage.resolve_record(conn, jira)
        account, opp, req, rep, se = sfdc_details(oppID, status='Completed')
    return 'DB updated - status == Completed'
Beispiel #5
0
def compile_email(oppID,
                  orgID,
                  tags,
                  custom_params={},
                  tech=None,
                  ck='CLIENTKEY'):
    account, opp, req, rep, se = resources.sfdc_details(oppID)
    print(tech)
    opener, need_tag = compile_opener(opp, orgID, custom_params, tech, req)
    if need_tag:
        tags = open_stock_tags(orgID, need_tag, ck)
    sig = ''
    with open('snippets/sig.txt', 'r') as f:
        sig = f.read()
    email = '{}\n{}\n{}\n'.format(opener, tags, sig)
    return email
Beispiel #6
0
def updateJIRA(oppID, jira, param_dict, traffic_dict, s, orgID):
    account, opp, req, rep, se = sfdc_details(oppID, orgID=orgID)
    server = req['Implementation_Platform__c']
    tech = req['Detection_Technology__c']
    param_string = ''
    traffic_string = ''
    for p, v in param_dict.items():
        param_string += '{}: {}\n'.format(p, v)
    for t, v in traffic_dict.items():
        traffic_string += '{}: {}\n'.format(t, v)
    with open('snippets/display_survey.txt', 'r') as f:
        update = f.read().format(server, tech, param_string, s, traffic_string)
    j = login()
    issue = j.issue(jira)
    description = issue.fields.description
    update = description + '\n\n' + update
    issue.update(fields={
        'description': update,
        'labels': [orgID, 'freetrial']
    })

    return update, server, tech