getPromotionByCode method

Future<void> getPromotionByCode(
  1. String code, {
  2. required void onSuccess(
    1. Promotion
    ),
  3. required void onError(
    1. SyneriseError error
    ),
})

This function returns a promotion object by its code.

Args: code (String): The parameter "code" is a string that represents the code of a promotion.

Implementation

Future<void> getPromotionByCode(String code,
    {required void Function(Promotion) onSuccess,
    required void Function(SyneriseError error) onError}) async {
  SyneriseResult<Promotion> result = await _methods.getPromotionByCode(code);

  result.onSuccess((result) {
    onSuccess(result);
  }).onError((error) {
    onError(error);
  });
}