-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample_query_for_customers.py
More file actions
76 lines (62 loc) · 1.27 KB
/
example_query_for_customers.py
File metadata and controls
76 lines (62 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import sys
import chargeover
import pprint
''' AVAILABLE QUERY PARAMETERS
customer_id
bill_state
ship_state
bill_country
ship_country
external_key
token
company
superuser_id
superuser_email
'''
# For authentication, fill in these values from your ChargeOver
# server information under "Configuraion->API and Webhooks"
endpoint =
username =
password =
# Set this to True to use "COv1 Signature" authorization
key_auth = False
co = chargeover.ChargeOver(
endpoint,
username,
password,
key_auth = key_auth)
# Our user/contact data
cdata0 = {
"name": "john",
"email": "john@john.com",
"id": "c-01"
}
# Our user/contact data
cdata1 = {
"name": "ron",
"email": "ron@aol.com",
"id": "c-02"
}
# Our user/contact data
cdata2 = {
"name": "ron",
"email": "ron@ron.com",
"id": "c-03"
}
# create a new card
id0 = co.create('customer', cdata0)
if id0 is None:
pprint.pprint(co.get_last_response())
id1 = co.create('customer', cdata1)
if id1 is None:
pprint.pprint(co.get_last_response())
exit()
id2 = co.create('customer', cdata2)
if id2 is None:
pprint.pprint(co.get_last_response())
exit()
# Find a customer by query
where {'name': 'ron'}
customer = co.find("customer", where)
print "All customers matching search (in list)"
pprint.pprint(customer)