Promotions and Vouchers
Promotions
Get all promotions of a customer
This method retrieves all available promotions that are defined for a customer.
PROMOTIONS_DETAILS_FOR_CLIENT_READ
permission from the Client group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
PromotionResponse
Class:
PromotionsImpl
Declaration:
Future<void> getAllPromotions(
{required void Function(PromotionResponse promotionResponse) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess | Function(PromotionResponse promotionResponse) | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.getAllPromotions(onSuccess: (PromotionResponse promotionResponse) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Get promotions with query parameters
This method retrieves promotions that match the parameters defined in an API query.
PROMOTIONS_DETAILS_FOR_CLIENT_READ
permission from the Client group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
PromotionsApiQuery
PromotionResponse
Class:
PromotionsImpl
Declaration:
Future<void> getPromotions(PromotionsApiQuery apiQuery,
{required void Function(PromotionResponse promotionResponse) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
apiQuery | PromotionsApiQuery | yes | - | Object that stores all query parameters |
onSuccess | Function(PromotionResponse promotionResponse) | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.getPromotions(promotionsApiQuery, onSuccess: (PromotionResponse promotionResponse) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Get promotion by UUID
This method retrieves the promotion with the specified UUID.
PROMOTIONS_DETAILS_FOR_CLIENT_READ
permission from the Client group.Declared In:
lib/modules/promotions/promotions_impl.dart
Class:
PromotionsImpl
Declaration:
Future<void> getPromotionByUUID(String uuid,
{required void Function(Promotion promotion) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
uuid | String | yes | - | UUID of the promotion |
onSuccess | Function(Promotion promotion) | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.getPromotionByUUID(uuid, onSuccess: (Promotion promotion) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Get promotion by code
This method retrieves the promotion with the specified code.
PROMOTIONS_DETAILS_FOR_CLIENT_READ
permission from the Client group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
Promotion
Class:
PromotionsImpl
Declaration:
Future<void> getPromotionByCode(String code,
{required void Function(Promotion promotion) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
code | String | yes | - | Code of the promotion |
onSuccess | Function(Promotion promotion) | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.getPromotionByCode(code, onSuccess: (Promotion promotion) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Activate promotion by UUID
This method activates the promotion with the specified UUID.
PROMOTIONS_ACTIVATE_PROMOTIONS_UPDATE
permission from the Promotions group.Declared In:
lib/modules/promotions/promotions_impl.dart
Class:
PromotionsImpl
Declaration:
Future<void> activatePromotionByUUID(String uuid,
{required void Function() onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
uuid | String | yes | - | UUID of the promotion |
onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.activatePromotionByUUID(uuid, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Activate promotion by code
This method activates the promotion with the specified code.
PROMOTIONS_ACTIVATE_PROMOTIONS_UPDATE
permission from the Promotions group.Declared In:
lib/modules/promotions/promotions_impl.dart
Class:
PromotionsImpl
Declaration:
Future<void> activatePromotionByCode(String code,
{required void Function() onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
code | String | yes | - | Code of the promotion |
onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.activatePromotionByCode(code, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Activate promotions in a batch
This method activates promotions with a code or with UUID in a batch.
PROMOTIONS_ACTIVATE_PROMOTIONS_UPDATE
permission from the Promotions group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
PromotionIdentifier
Class:
PromotionsImpl
Declaration:
Future<void> activatePromotionsBatch(List<PromotionIdentifier> promotionsToActivate,
{required void Function() onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
promotionsToActivate | List<PromotionIdentifier> | yes | - | List of promotion identifiers |
onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.activatePromotionsBatch(promotionIdentifierList, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Deactivate promotion by UUID
This method deactivates the promotion with the specified UUID.
PROMOTIONS_DEACTIVATE_PROMOTIONS_UPDATE
permission from the Promotions group.Declared In:
lib/modules/promotions/promotions_impl.dart
Class:
PromotionsImpl
Declaration:
Future<void> deactivatePromotionByUUID(String uuid,
{required void Function() onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
uuid | String | yes | - | UUID of the promotion |
onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.deactivatePromotionByUUID(uuid, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Deactivate promotion by code
This method deactivates the promotion with the specified code.
PROMOTIONS_DEACTIVATE_PROMOTIONS_UPDATE
permission from the Promotions group.Declared In:
lib/modules/promotions/promotions_impl.dart
Class:
PromotionsImpl
Declaration:
Future<void> deactivatePromotionByCode(String code,
{required void Function() onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
code | String | yes | - | Code of the promotion |
onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.deactivatePromotionByCode(code, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Deactivate promotions in a batch
This method deactivates promotions with a code or with UUID in a batch.
PROMOTIONS_DEACTIVATE_PROMOTIONS_UPDATE
permission from the Promotions group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
PromotionIdentifier
Class:
PromotionsImpl
Declaration:
Future<void> deactivatePromotionsBatch(List<PromotionIdentifier> promotionsToDeactivate,
{required void Function() onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
promotionsIdentifiers | List<PromotionIdentifier> | yes | - | List of promotion identifiers |
onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.deactivatePromotionsBatch(promotionIdentifierList, onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Vouchers
Get or assign voucher from pool
This method retrieves an assigned voucher code or assigns a voucher from a pool identified by UUID to the customer.
Once a voucher is assigned using this method, the same voucher is returned for the profile every time the method is called.
When the voucher is assigned for the first time, a voucherCode.assigned event is produced.
VOUCHERS_ITEM_ASSIGN_CREATE
and VOUCHERS_ITEM_ASSIGN_READ
permission from the Assign group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
AssignVoucherResponse
Class:
PromotionsImpl
Declaration:
Future<void> getOrAssignVoucher(String poolUuid,
{required void Function(AssignVoucherResponse assignVoucherResponse) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
poolUuid | String | yes | - | Unique identifier of a code pool |
onSuccess | Function(AssignVoucherResponse assignVoucherResponse) | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.getOrAssignVoucher(poolUuid, onSuccess: (AssignVoucherResponse assignVoucherResponse) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Assign voucher code from pool
This method assigns a voucher from a pool identified by UUID to the profile.
Every request returns a different code until the pool is empty.
A voucherCode.assigned event is produced.
VOUCHERS_ITEM_ASSIGN_CREATE
and VOUCHERS_ITEM_ASSIGN_READ
permission from the Assign group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
AssignVoucherResponse
Class:
PromotionsImpl
Declaration:
Future<void> assignVoucherCode(String poolUuid,
{required void Function(AssignVoucherResponse response) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
poolUuid | String | yes | - | Unique identifier of a code pool |
onSuccess | Function(AssignVoucherResponse assignVoucherResponse) | yes | - | Function to be executed when the operation is completed successfully, returning the AssignVoucherResponse |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.assignVoucherCode(poolUuid, onSuccess: (AssignVoucherResponse assignVoucherResponse) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Get voucher codes assigned to customer
This method retrieves voucher codes for a customer.
VOUCHERS_ITEM_ASSIGN_READ
permission from the Assign group.Declared In:
lib/modules/promotions/promotions_impl.dart
Related To:
VoucherCodesResponse
Class:
PromotionsImpl
Declaration:
Future<void> getAssignedVoucherCodes(
{required void Function(VoucherCodesResponse voucherCodesResponse) onSuccess,
required void Function(SyneriseError error) onError}) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess | Function(VoucherCodesResponse voucherCodesResponse) | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.promotions.getAssignedVoucherCodes(onSuccess: (VoucherCodesResponse voucherCodesResponse) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});