private static decimal GetSupplementRate(DonationEventType eventType) => _eventTypeRateDictionary.ContainsKey(eventType) ? _eventTypeRateDictionary[eventType] : 0;
public DonationEventLog(string eventData, DonationEventType type, string?userId = null) { EventData = eventData; UserId = userId; Type = type; }
// would usually have this in its own class as it feels to be unrelated breaking cohesion, // but seems a bit overkill to do so in this case, perhaps even a simple static helper would be better public decimal GetGiftAidSupplementAmount(decimal giftAidAmount, DonationEventType eventType) { var supplementRate = GetSupplementRate(eventType); return(RoundToTwoPlaces(giftAidAmount * supplementRate * 0.01m)); }