diff --git a/examples/voucherify_test.py b/examples/voucherify_test.py index 6fef7a22..5082f426 100644 --- a/examples/voucherify_test.py +++ b/examples/voucherify_test.py @@ -1,10 +1,11 @@ -import voucherify +from voucherify import Client as voucherifyClient +from voucherify import utils import pprint ''' Initialization ''' -client = voucherify.Client( +voucherify = voucherifyClient( application_id='c70a6f00-cf91-4756-9df5-47628850002b', client_secret_key='3266b9f8-e246-4f79-bdf0-833929b1380c' ) @@ -25,17 +26,25 @@ ''' pprint.pprint('=== Create voucher ===') -result = client.create(voucher) -pprint.pprint(result) +new_voucher = voucherify.create(voucher) +pprint.pprint(new_voucher) ''' Get voucher ''' pprint.pprint('=== Get voucher ===') -voucher = client.get(voucher['code']) +voucher = voucherify.get(voucher['code']) pprint.pprint(voucher) +''' +List vouchers from category +''' + +pprint.pprint('=== List vouchers from category ===') +vouchers_list = voucherify.list({'category': voucher['category']}) +pprint.pprint(vouchers_list) + ''' Utils ''' @@ -46,8 +55,8 @@ items_count = 13 base_price = unit_price * items_count -discount = voucherify.utils.calculate_discount(base_price, voucher, unit_price) -new_price = voucherify.utils.calculate_price(base_price, voucher, unit_price) +discount = utils.calculate_discount(base_price, voucher, unit_price) +new_price = utils.calculate_price(base_price, voucher, unit_price) pprint.pprint(unit_price) pprint.pprint(items_count) pprint.pprint(base_price)