getPromotionIdentifierKeyFromString static method

PromotionIdentifierKey getPromotionIdentifierKeyFromString(
  1. String string
)

The function returns a PromotionIdentifierKey based on a given string input.

Args: string (String): A string value that represents the type of promotion identifier key. It can be either "UUID" or "CODE".

Returns: The function getPromotionIdentifierKeyFromString returns a value of the PromotionIdentifierKey enum type. The returned value depends on the input string: if the string is "UUID", the function returns the uuid value of the enum, if the string is "CODE", the function returns the code value of the enum, and if the string is anything else, the

Implementation

static PromotionIdentifierKey getPromotionIdentifierKeyFromString(
    String string) {
  if (string == 'UUID') {
    return PromotionIdentifierKey.uuid;
  } else if (string == 'CODE') {
    return PromotionIdentifierKey.code;
  } else {
    return PromotionIdentifierKey.uuid;
  }
}