Promotions and Vouchers


Promotions


Get all promotions of a customer


This method retrieves all available promotions that are defined for a customer.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/modules/promotions/promotions_impl.dart

Class:
PromotionsImpl

Declaration:

Future<PromotionResponse> getAllPromotions(
      {required void Function(PromotionResponse promotionResponse) onSuccess,
      required void Function(SyneriseError error) onError}) async 

Parameters:

Parameter Type Mandatory Default Description
onSuccess void yes - Function to be executed when the operation is completed successfully
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
PromotionResponse

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.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/modules/promotions/promotions_impl.dart

Related To:
PromotionsApiQuery

Class:
PromotionsImpl

Declaration:

Future<PromotionResponse> 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
PromotionResponse

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.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/modules/promotions/promotions_impl.dart

Class:
PromotionsImpl

Declaration:

Future<Promotion> 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
Promotion

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.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/modules/promotions/promotions_impl.dart

Class:
PromotionsImpl

Declaration:

Future<Promotion> 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
Promotion

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.

Note: The API key must have the 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError 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.

Note: The API key must have the 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError 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.

Note: The API key must have the 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError 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.

Note: The API key must have the 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError 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.

Note: The API key must have the 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError 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.

Note: The API key must have the 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError 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.

Note: The API key must have the VOUCHERS_ITEM_ASSIGN_CREATE and VOUCHERS_ITEM_ASSIGN_READ permission from the Assign group.

Declared In:
lib/modules/promotions/promotions_impl.dart

Class:
PromotionsImpl

Declaration:

Future<AssignVoucherResponse> 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
AssignVoucherResponse

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.

Note: Returns the HTTP 416 status code when the pool is empty.
Note: The API key must have the VOUCHERS_ITEM_ASSIGN_CREATE and VOUCHERS_ITEM_ASSIGN_READ permission from the Assign group.

Declared In:
lib/modules/promotions/promotions_impl.dart

Class:
PromotionsImpl

Declaration:

Future<AssignVoucherResponse> 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 void yes - Function to be executed when the operation is completed successfully, returning the AssignVoucherResponse
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
AssignVoucherResponse

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.

Note: The API key must have the VOUCHERS_ITEM_ASSIGN_READ permission from the Assign group.

Declared In:
lib/modules/promotions/promotions_impl.dart

Class:
PromotionsImpl

Declaration:

Future<VoucherCodesResponse> getAssignedVoucherCodes(
      {required void Function(VoucherCodesResponse voucherCodesResponse) onSuccess,
      required void Function(SyneriseError error) onError}) async

Parameters:

Parameter Type Mandatory Default Description
onSuccess void yes - Function to be executed when the operation is completed successfully
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
VoucherCodesResponse

Example:

    await Synerise.promotions.getAssignedVoucherCodes(onSuccess: (VoucherCodesResponse voucherCodesResponse) {
      //onSuccess handling
    }, onError: (SyneriseError error) {
      //onError handling
    });
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker