Skip to content

Commit 3a574a3

Browse files
author
Jakub Reczko
committed
Added examples of using Customers SDK methods
1 parent 6a6a27e commit 3a574a3

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

examples/customer_test.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import pprint
2+
3+
from voucherify import Client as voucherifyClient
4+
5+
"""
6+
Initialization
7+
"""
8+
voucherify = voucherifyClient(
9+
application_id="c70a6f00-cf91-4756-9df5-47628850002b",
10+
client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c"
11+
)
12+
13+
"""
14+
Create Customer
15+
"""
16+
payload = {
17+
"name": "John Doe",
18+
"email": "[email protected]",
19+
"description": "Sample description of customer",
20+
"metadata": {
21+
"lang": "en"
22+
}
23+
}
24+
25+
result = voucherify.customer.create(payload)
26+
pprint.pprint("--- Create ---")
27+
pprint.pprint(result)
28+
29+
"""
30+
Fetch Customer
31+
"""
32+
result = voucherify.customer.fetch(result.get("id"))
33+
pprint.pprint("--- Fetch ---")
34+
pprint.pprint(result)
35+
36+
"""
37+
Update Customer
38+
"""
39+
payload = result
40+
payload['description'] = "Sample description of customer with changes"
41+
42+
result = voucherify.customer.update(payload)
43+
pprint.pprint("--- Update ---")
44+
pprint.pprint(result)
45+
46+
"""
47+
Delete Customer
48+
"""
49+
result = voucherify.customer.delete(result["id"])
50+
pprint.pprint("--- Delete ---")
51+
pprint.pprint(result)

0 commit comments

Comments
 (0)