Promotions and vouchers
Promotions
Get all promotions of a customer
Use this method to get all available promotions that are defined for this Customer.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.getAllPromotions(onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.getAllPromotions(function(promotionResponse) {
//success
}, function(error) {
//failure
});
Get promotions with query parameters
Use this method to get promotions that match the parameters defined in an API query.
Declared In
lib/main/modules/PromotionsModule.js
Related
lib/classes/api_queries/PromotionsApiQuery.js
Method
Synerise.Promotions.getPromotions(apiQuery, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
apiQuery |
PromotionsApiQuery |
yes | - | Object that stores all query parameters |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
let apiQuery = new PromotionsApiQuery();
apiQuery.statuses = [
PromotionStatus.Active
];
apiQuery.types = [
PromotionType.General
]
apiQuery.sorting = [
{ property: PromotionSortingKey.CreatedAt, order: ApiQuerySortingOrder.Ascending }
];
apiQuery.limit = 120;
apiQuery.page = 2;
apiQuery.includeMeta = true;
Synerise.Promotions.getPromotions(apiQuery, function(promotionResponse) {
//success
}, function(error) {
//failure
});
Get promotion by UUID
Use this method to get the promotion with the specified UUID.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.getPromotionByUUID(uuid, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
uuid |
String |
yes | - | UUID of the promotion |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.getPromotionByUUID("UUID", function(promotion) {
//success
}, function(error) {
//failure
});
Get promotion by code
Use this method to get the promotion with the specified code.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.getPromotionByCode(code, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
code |
String |
true | - | Code of the promotion |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.getPromotionByCode("CODE", function(promotion) {
//success
}, function(error) {
//failure
});
Activate promotion by UUID
Use this method to activate the promotion with the specified UUID.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.activatePromotionByUUID(uuid, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
uuid |
String |
yes | - | UUID of the promotion |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.activatePromotionByUUID("UUID", function() {
//success
}, function(error) {
//failure
});
Activate promotion by code
Use this method to activate the promotion with the specified code.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.activatePromotionByCode(code, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
code |
String |
yes | - | Code of the promotion |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.activatePromotionByCode("CODE", function() {
//success
}, function(error) {
//failure
});
Activate promotions in a batch
Use this method to activate promotions in a batch.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.activatePromotionsBatch(promotionsIdentifiers, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
promotionsIdentifiers |
Array<PromotionIdentifier> |
yes | - | List of promotion identifiers |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.activatePromotionsBatch(promotionsIdentifiers, function() {
//success
}, function(error) {
//failure
});
Deactivate promotion by UUID
Use this method to de-activate the promotion with the specified UUID.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.deactivatePromotionByUUID(uuid, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
uuid |
String |
yes | - | UUID of the promotion |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.deactivatePromotionByUUID("UUID", function() {
//success
}, function(error) {
//failure
});
Deactivate promotion by code
Use this method to de-activate the promotion with the specified code.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.deactivatePromotionByCode(code, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
code |
String |
yes | - | Code of the promotion |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.deactivatePromotionByCode("CODE", function() {
//success
}, function(error) {
//failure
});
Deactivate promotions in a batch
Use this method to deactivate promotions in a batch.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.deactivatePromotionsBatch(promotionsIdentifiers, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
promotionsIdentifiers |
Array<PromotionIdentifier> |
yes | - | List of promotion identifiers |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.deactivatePromotionsBatch(promotionsIdentifiers, function() {
//success
}, function(error) {
//failure
});
Vouchers
Get or assign voucher
Use this method to get an assigned voucher code or assign to the customer a voucher from a pool identified by UUID. Once a voucher is assigned using this method, the same voucher is returned fir the client every time the method is called.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.getOrAssignVoucher(poolUuid, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
poolUuid |
string |
yes | - | Pool’s universally unique identifier |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.getOrAssignVoucher(poolUuid, function(voucherResponse) {
// success
}, function(error) {
// failure
})
Assign voucher code
Use this method to assign a voucher from a pool identified by UUID to the customer.
Every request returns a different code until the pool is empty.
HTTP 416 status code is returned when the pool is empty.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.assignVoucherCode(poolUuid, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
poolUuid |
string |
yes | - | Pool’s universally unique identifier |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.assignVoucherCode(poolUuid, function(voucherResponse) {
// success
}, function(error) {
// failure
})
Get assigned voucher codes
Use this method to get a customer’s voucher codes.
Declared In
lib/main/modules/PromotionsModule.js
Method
Synerise.Promotions.getAssignedVoucherCodes(onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Promotions.getAssignedVoucherCodes(function(voucherCodesResponse) {
// success
}, function(error) {
// failure
})