Skip to content

Commit

Permalink
voucher code pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaszWiktor committed Jul 20, 2016
1 parent b663fe5 commit d31e36b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,23 @@ Result:

`voucherify.create(voucher)`

You can create a voucher with a specified code or let Voucherify generate one.
By default a generated code is a 8 characters long alphanumeric string, however,
you can define how to create the random code passing a `code_config` dict:
- `length` - Number of characters in a generated code (excluding prefix and postfix).
- `charset` - Characters that can appear in the code.
- `prefix` - A text appended before the code.
- `postfix` - A text appended after the code.
- `pattern` - A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`.

Example:

```python
payload = {
"code_cofig": {
"charset": "01234567890",
"pattern": "TEST-#####"
},
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
Expand Down

0 comments on commit d31e36b

Please sign in to comment.