Skip to content

Commit

Permalink
Merge pull request #45 from michalklym/2.2.2
Browse files Browse the repository at this point in the history
v2.2.2
  • Loading branch information
tpindel authored Apr 6, 2022
2 parents a871399 + 505fdf1 commit 090ad70
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Methods are provided within `client.vouchers.*` namespace.
- [List Vouchers](#list-vouchers)
- [Enable Voucher](#enable-voucher)
- [Disable Voucher](#disable-voucher)
- [Release Validation Session](#release-validation-session)

#### [Create Voucher]
```python
Expand Down Expand Up @@ -102,6 +103,10 @@ client.vouchers.enable(code)
```python
client.vouchers.disable(code)
```
#### [Release Validation Session]
```python
client.vouchers.releaseValidationSession(code, sessionKey)
```

---

Expand All @@ -120,18 +125,24 @@ client.distributions.publish(params)
Methods are provided within `client.validations.*` namespace.

- [Validate Voucher](#validate-voucher)
- [Validate Stackable](#validate-stackable)

#### [Validate Voucher]
```python
client.validations.validateVoucher(code, params)
```
#### [Validate Stackable]
```python
client.validations.validateStackable(params)
```

---

### Redemptions API
Methods are provided within `client.redemptions.*` namespace.

- [Redeem Voucher](#redeem-voucher)
- [Redeem Stackable](#redeem-stackable)
- [List Redemptions](#list-redemptions)
- [Get Voucher's Redemptions](#get-vouchers-redemptions)
- [Rollback Redemption](#rollback-redemption)
Expand All @@ -140,6 +151,10 @@ Methods are provided within `client.redemptions.*` namespace.
```python
client.redemptions.redeem(code, tracking_id)
```
#### [Redeem Stackable]
```python
client.redemptions.redeemStackable(params)
```
#### [List Redemptions]
```python
client.redemptions.list(params)
Expand Down Expand Up @@ -206,6 +221,10 @@ Bug reports and pull requests are welcome through [GitHub Issues](https://github

## Changelog

- **2022-04-06** - `2.2.2`
- Added `client.vouchers.releaseValidationSession` method
- Added `client.redemptions.redeemStackable` method
- Added `client.validations.validateStackable` method
- **2021-05-26** - `2.2.1`
- Upload new version to pypi.org. No changes compared to `2.2.0`
- **2021-05-20** - `2.2.0`
Expand Down Expand Up @@ -241,12 +260,15 @@ Bug reports and pull requests are welcome through [GitHub Issues](https://github
[List Vouchers]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-vouchers
[Enable Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#enable-voucher
[Disable Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#disable-voucher
[Release Validation Session]: https://docs.voucherify.io/reference/release-validation-session

[Publish Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-publication

[Validate Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#validate-voucher
[Validate Stackable]: https://docs.voucherify.io/reference/validate-stacked-discounts-1

[Redeem Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#redeem-voucher
[Redeem Stackable]: https://docs.voucherify.io/reference/redeem-stacked-discounts
[List Redemptions]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-redemptions
[Get Voucher's Redemptions]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#vouchers-redemptions
[Rollback Redemption]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#rollback-redemption
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__ = '2.2.1'
__version__ = '2.2.2'
__pypi_username__ = 'voucherify'
__pypi_packagename__ = 'voucherify'
__github_username__ = 'voucherifyio'
Expand Down
26 changes: 26 additions & 0 deletions voucherify/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ def disable(self, code):
method='POST'
)

def releaseValidationSession(self, code, sessionKey):
path = '/vouchers/' + quote(code) + '/sessions/' + quote(sessionKey)

return self.request(
path,
method='DELETE'
)


class Redemptions(VoucherifyRequest):
def __init__(self, *args, **kwargs):
Expand All @@ -124,6 +132,15 @@ def redeem(self, code, tracking_id=None):
data=json.dumps(context),
)

def redeemStackable(self, params):
path = '/redemptions'

return self.request(
path,
method='POST',
data=json.dumps(params)
)

def getForVoucher(self, code):
path = '/vouchers/' + quote(code) + '/redemption'

Expand Down Expand Up @@ -164,6 +181,15 @@ def validateVoucher(self, code, params):
data=json.dumps(params),
)

def validateStackable(self, params):
path = '/validations'

return self.request(
path,
method='POST',
data=json.dumps(params)
)


class Distributions(VoucherifyRequest):
def __init__(self, *args, **kwargs):
Expand Down

0 comments on commit 090ad70

Please sign in to comment.