コード例 #1
0
df = pd.read_csv('duplicate_companies (exact).csv')
df = df.dropna()

company_fields = FIELDS['Company'][:]
company_cfs = get_table(ifs, 'DataFormField', {'FormId': -6}, ['Name'])
company_fields += list(map(lambda x: "_" + x.get('Name'), company_cfs))

deleted_companies = []

start = datetime.datetime.now()

for index, row in df.iterrows():
    orig_id = int(row.orig_id)
    dupe_id = int(row.dupe_id)
    print("\nMerging {} with {}".format(orig_id, dupe_id))
    orig_comp = ifs.DataService('load', 'Company', orig_id, company_fields)
    dupe_comp = ifs.DataService('load', 'Company', dupe_id, company_fields)

    if isinstance(orig_comp, tuple) or isinstance(dupe_comp, tuple):
        print(f"{orig_id} or {dupe_id} already merged.")
        continue

    if orig_id in deleted_companies or dupe_id in deleted_companies:
        print("{} already merged.".format(orig_id))
        continue

    orig_name = orig_comp.get('Company')

    # Reassign contacts
    contacts = []
    for contact in get_table(ifs,
コード例 #2
0
print infusionsoft.ContactService('add', contact)

# Example 2: Merge two duplicate contacts
#----------------------------------------------------------------------------------------
contactId = 56
duplicateContactId = 57
print infusionsoft.ContactService('merge', contactId, duplicateContactId)

# Example 3: Query a contact using data service
#----------------------------------------------------------------------------------------
table = 'Contact'
returnFields = ['Id', 'FirstName']
query = {'FirstName' : 'John'}
limit = 10
page = 0
print infusionsoft.DataService('query', table, limit, page, query, returnFields)

# Example 4: Return a products inventory using product service
#----------------------------------------------------------------------------------------
productId = 1
print infusionsoft.ProductService('getInventory', productId)

# Example 5: Charge an invoice using the invoice service
#----------------------------------------------------------------------------------------
invoiceId = 16
notes = 'API Upsell Payment'
creditCardId = 2
merchantAccountId = 1
bypassCommissions = False
print infusionsoft.InvoiceService('chargeInvoice', invoiceId, notes, creditCardId, merchantAccountId, bypassCommissions)
コード例 #3
0
        existing_tasks += [int(task[src_action_id])]

    existing_appts = []
    for appt in get_table(src_infusionsoft,
                          'ContactAction',
                          {src_action_id: "_%",
                           'ObjectType': 'Appointment'},
                          [src_action_id]):
        if appt == 'ERROR':
            break
        existing_tasks += [int(appt[src_action_id])]

    existing_actions = existing_tasks + existing_appts

    default_user_id = dest_infusionsoft.DataService(
        'getAppSetting',
        'Templates',
        'defuserid')
    default_user = get_table(
        dest_infusionsoft,
        'User',
        {'Id': default_user_id})[0]
    default_user_name = "{} {}".format(
        default_user['FirstName'],
        default_user['LastName'])

    with open("{}tasks_appointments.csv".format(dir_path),
              'w',
              newline='') as csvfile:
        fieldnames = list(set().union(*(d.keys() for d in actions)))
        fieldnames += [src_action_id]
        writer = csv.DictWriter(csvfile,
コード例 #4
0
                    dest_infusionsoft, custom_field['Label'], 'Contact',
                    DATATYPES[custom_field['DataType']],
                    custom_field.get('Values'))
                rename_mapping["_" + custom_field['Name']] = field['Name']

    # Checks for contacts that already exist by FKID in Source App Contact Id
    # custom field
    existing_contacts = {}
    for contact_id in get_table(dest_infusionsoft, 'Contact',
                                {src_contact_id: "_%"},
                                ['Id', src_contact_id]):
        existing_contacts[int(contact_id[src_contact_id])] = contact_id['Id']

    # Create tag for indicating contacts have been transferred
    dest_category_id = dest_infusionsoft.DataService(
        'query', 'ContactGroupCategory', 1000, 0,
        {'CategoryName': 'Application Transfer'}, ['Id'])
    dest_tag_id = None
    if dest_category_id:
        dest_tag_id = dest_infusionsoft.DataService(
            'query', 'ContactGroup', 1000, 0, {
                'GroupCategoryId': dest_category_id[0]['Id'],
                'GroupName': "Data from {}".format(config.SOURCE_APPNAME)
            }, ['Id'])
    if dest_category_id:
        tag_cat_id = dest_category_id[0]['Id']
    else:
        tag_cat_id = dest_infusionsoft.DataService(
            'add', 'ContactGroupCategory',
            {'CategoryName': 'Application Transfer'})
    if not dest_tag_id: