forked from voucherifyio/voucherify-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request voucherifyio#29 from rspective/publish-update
Publish update
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,7 +379,7 @@ You can change some properties of a voucher that has been already created: | |
- start date | ||
- expiration date | ||
- active | ||
- additinal info | ||
- additional info | ||
- metadata | ||
|
||
Other fields than listed above won't be modified. Even if provided they will be silently skipped. | ||
|
@@ -397,6 +397,44 @@ $voucher_update = (object) array( | |
$updated_voucher = $voucherify->update($voucher_update); | ||
``` | ||
|
||
#### Publishing voucher | ||
|
||
This method selects a voucher that is suitable for publication, adds a publish entry and returns the voucher. | ||
A voucher is suitable for publication when it's active and has not been published more times than the redemption limit. | ||
|
||
Example: | ||
|
||
Using campaign name: | ||
|
||
```php | ||
$published_voucher = $voucherify->publish("First Ride"); | ||
``` | ||
|
||
Using object with campaign name: | ||
|
||
```php | ||
$payload = (object) array( | ||
"campaign" => "First Ride", | ||
"channel" => "SDK Test", | ||
"customer" => "[email protected]" | ||
); | ||
|
||
$published_voucher = $voucherify->publish($payload); | ||
``` | ||
|
||
Using object with specific voucher code: | ||
|
||
```php | ||
$payload = (object) array( | ||
"voucher" => "Summer-2016", | ||
"channel" => "SDK Test", | ||
"customer" => "[email protected]" | ||
); | ||
|
||
$published_voucher = $voucherify->publish($payload); | ||
``` | ||
|
||
|
||
#### Disabling voucher | ||
|
||
You can make a voucher inactive by calling `VoucherifyClient->disable` with a voucher code: | ||
|
@@ -691,6 +729,7 @@ Result: | |
`This endpoint does not return result` | ||
|
||
### Changelog | ||
- **2016-09-13** - `0.11.0` - Added new API method for voucher - publish | ||
- **2016-09-13** - `0.10.0` - Added new API method for voucher - delete | ||
- **2016-09-13** - `0.9.1` - Fix to maintain builder pattern. | ||
- **2016-07-20** - `0.9.0` - Voucher code pattern. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters