Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into gift-utils
Browse files Browse the repository at this point in the history
Conflicts:
	README.md
  • Loading branch information
LukaszWiktor committed Dec 6, 2016
2 parents 9495e6c + 9913ab1 commit db5e6cf
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 72 deletions.
198 changes: 127 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,48 +58,66 @@ 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": {
"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": 10000,
"balance": 5000

},
"start_date": "2016-03-01T10:00:00Z",
"expiration_date": null,
"redemption": {
},
"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 @@ -122,18 +140,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 @@ -186,8 +215,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 @@ -296,7 +333,9 @@ result = voucherify.redemption("Testing7fjWdr")
Result:
```json
{
"object": "list",
"quantity": 3,
"data_ref": "redemption_entries",
"redeemed_quantity": 1,
"redemption_entries": [
{
Expand Down Expand Up @@ -329,11 +368,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 @@ -344,31 +394,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 @@ -821,7 +876,8 @@ new_price = utils.calculate_price(base_price, voucher, unit_price)

### Changelog

- **2016-12-02** - `1.4.1` - Support gift vouchers in utils
- **2016-12-02** - `1.4.2` - Support gift vouchers in utils
- **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.1'
__version__ = '1.4.2'
__pypi_username__ = 'voucherify'
__pypi_packagename__ = 'voucherify'
__github_username__ = 'voucherifyio'
Expand Down

0 comments on commit db5e6cf

Please sign in to comment.