surplusBehavior property

SurplusBehavior get surplusBehavior

Determines how the split flow handles surplus payments when an explicit (order-level) tip is present.

Reads the system-split-surplus-behavior enterprise config flag. Falls back to SurplusBehavior.dialog when the flag is unset or contains an unrecognised value.

Implementation

SurplusBehavior get surplusBehavior {
  final raw = _configService.getStringValue(
    key: 'system-split-surplus-behavior',
    defaultValue: 'dialog',
  );
  final SurplusBehavior resolved;
  switch (raw.toLowerCase()) {
    case 'block':
      resolved = SurplusBehavior.block;
      break;
    case 'blockwithexplicittip':
      resolved = SurplusBehavior.blockWithExplicitTip;
      break;
    case 'silent':
      resolved = SurplusBehavior.silent;
      break;
    case 'dialog':
    default:
      resolved = SurplusBehavior.dialog;
      break;
  }
  _logger.info(
    this,
    'config resolved: system-split-surplus-behavior=$raw → ${resolved.name}',
  );
  return resolved;
}