Skip to content

Commit

Permalink
Documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Reczko committed Oct 4, 2016
1 parent 79101d9 commit 06ed473
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 71 deletions.
197 changes: 127 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,46 +58,65 @@ vouchers_list = voucherify.list(filter_params)
Result:
```json
[{
"code": "9mYBpIk",
"campaign": null,
"category": "API Test",
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 400
},
"start_date": "2016-03-01T12:00:00Z",
"expiration_date": null,
"redemption": {
"quantity": 1,
"redeemed_quantity": 0,
"redemption_entries": []
},
"active": true,
"additional_info": null,
"metadata": null
},
{
"code": "AzTsIH",
"campaign": null,
"category": "API Test",
"type": "GIFT_VOUCHER",
"gift": {
"amount": 5000
},
"start_date": "2016-03-01T10:00:00Z",
"expiration_date": null,
"redemption": {
"code": "9mYBpIk",
"campaign": null,
"category": "API Test",
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 400
},
"start_date": "2016-03-01T12:00:00Z",
"expiration_date": null,
"publish": {
"object": "list",
"count": 1,
"data_ref": "entries",
"entries": [{
"channel": "Email",
"published_at": "2016-04-10T12:00:00Z",
"customer": "[email protected]",
"customer_id": "cust_1fnSUBno3iimKTPNDCkjg4xV"
}]
},
"redemption": {
"object": "list",
"quantity": 1,
"data_ref": "redemption_entries",
"redeemed_quantity": 0,
"redemption_entries": []
},
"active": true,
"additional_info": null,
"metadata": null
},{
"code": "AzTsIH",
"campaign": null,
"category": "API Test",
"type": "GIFT_VOUCHER",
"gift": {
"amount": 5000
},
"start_date": "2016-03-01T10:00:00Z",
"expiration_date": null,
"publish": {
"object": "list",
"count": 0,
"data_ref": "entries",
"entries": []
},
"redemption": {
"object": "list",
"quantity": 1,
"data_ref": "redemption_entries",
"redeemed_quantity": 0,
"redeemed_amount": 0,
"redemption_entries": []
},
"active": true,
"additional_info": null,
"metadata": null
},
...
]
},
"active": true,
"additional_info": null,
"metadata": null
}]
```

#### Getting voucher details
Expand All @@ -120,18 +139,29 @@ Result:
"type": "PERCENT"
},
"expiration_date": "2016-12-31T23:59:59Z",
"publish": {
"object": "list",
"count": 1,
"data_ref": "entries",
"entries": [{
"channel": "Email",
"published_at": "2016-04-10T12:00:00Z",
"customer": "[email protected]",
"customer_id": "cust_1fnSUBno3iimKTPNDCkjg4xV"
}]
},
"redemption": {
"quantity": 3,
"redeemed_quantity": 1,
"redemption_entries": [
{
"id": "r_gQzOnTwmhn2nTLwW4sZslNKY",
"object": "redemption",
"date": "2016-04-24T06:03:35Z",
"customer_id": "GENERATED-CUSTOMER-ID",
"tracking_id": "GENERATED-OR-PROVIDED-TRACKING-ID"
}
]
"object": "list",
"quantity": 1,
"data_ref": "redemption_entries",
"redeemed_quantity": 0,
"redemption_entries": [{
"id": "r_gQzOnTwmhn2nTLwW4sZslNKY",
"object": "redemption",
"date": "2016-04-24T06:03:35Z",
"customer_id": "GENERATED-CUSTOMER-ID",
"tracking_id": "GENERATED-OR-PROVIDED-TRACKING-ID"
}]
},
"additional_info": ""
}
Expand Down Expand Up @@ -184,8 +214,16 @@ Result:
},
"start_date": "2016-01-01T00:00:00Z",
"expiration_date": "2016-12-31T23:59:59Z",
"publish": {
"object": "list",
"count": 0,
"data_ref": "entries",
"entries": []
},
"redemption": {
"quantity": 1,
"object": "list",
"quantity": 0,
"data_ref": "redemption_entries",
"redeemed_quantity": 0,
"redemption_entries": []
},
Expand Down Expand Up @@ -294,7 +332,9 @@ result = voucherify.redemption("Testing7fjWdr")
Result:
```json
{
"object": "list",
"quantity": 3,
"data_ref": "redemption_entries",
"redeemed_quantity": 1,
"redemption_entries": [
{
Expand Down Expand Up @@ -327,11 +367,22 @@ result = voucherify.publish("First Ride")

`voucherify.publish(params)`

Example:
Using campaign name:

```python
payload = {
"campaign": "First Ride",
"channel": "SDK Test",
"customer": "[email protected]"
}
result = voucherify.publish(payload)
```

Using voucher code:

```python
payload = {
"voucher": "FR-zT-u9I7zG",
"channel": "Email",
"customer": "[email protected]"
}
Expand All @@ -342,31 +393,36 @@ Result *(for both)*:

```json
{
"code": "FR-zT-u9I7zG",
"campaign": "First Ride",
"category": null,
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "PERCENT",
"amount_off": 50
},
"start_date": "2015-01-01T00:00:00Z",
"expiration_date": "2016-12-31T23:59:59Z",
"publish": {
"count": 1,
"code": "FR-zT-u9I7zG",
"campaign": "First Ride",
"category": null,
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "PERCENT",
"amount_off": 50
},
"start_date": "2015-01-01T00:00:00Z",
"expiration_date": "2016-12-31T23:59:59Z",
"publish": {
"object": "list",
"count": 0,
"data_ref": "entries",
"entries": [{
"channel": "Email",
"customer": "[email protected]",
"customer_id": "cust_84LPwcHJ1jVEpxV1uF9nLLBB",
"published_at": "2016-01-22T09:25:07Z"
}]
},
"redemption": {
"quantity": 1,
"redeemed_quantity": 0,
"redemption_entries": []
},
"active": true,
"additional_info": null
},
"redemption": {
"object": "list",
"quantity": 0,
"data_ref": "redemption_entries",
"redeemed_quantity": 0,
"redemption_entries": []
},
"active": true,
"additional_info": null
}
```

Expand Down Expand Up @@ -819,6 +875,7 @@ new_price = utils.calculate_price(base_price, voucher, unit_price)

### Changelog

- **2016-10-04** - `1.4.1` - Publish update
- **2016-07-18** - `1.4.0` - Voucher code pattern
- **2016-07-18** - `1.3.0` - Update voucher
- **2016-06-23** - `1.2.1` - Gift vouchers
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'voucherify'))

__version__ = '1.4.0'
__version__ = '1.4.1'
__pypi_username__ = 'voucherify'
__pypi_packagename__ = 'voucherify'
__github_username__ = 'voucherifyio'
Expand Down

0 comments on commit 06ed473

Please sign in to comment.