mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 04:53:11 +00:00
Auto-approval now uses the WO-scoped $500/$5,000 Emergency cap instead of dispatch NTE, rejects a second open request across dispatches, and cancelling a WO withdraws pending uplifts with audit.
19 lines
640 B
C#
19 lines
640 B
C#
using Data.SeaHavenIndustries.Enums;
|
|
|
|
namespace SeaHaven.Services.Helpers
|
|
{
|
|
public static class WorkOrderUpliftAllowance
|
|
{
|
|
public const decimal StandardCapUsd = 500m;
|
|
public const decimal EmergencyCapUsd = 5000m;
|
|
|
|
public static decimal CapFor(WorkOrderType? type) =>
|
|
type == WorkOrderType.Emergency ? EmergencyCapUsd : StandardCapUsd;
|
|
|
|
public static decimal Remaining(decimal cap, decimal consumedAutoApproved) =>
|
|
Math.Max(0m, cap - consumedAutoApproved);
|
|
|
|
public static bool AutoApproves(decimal amount, decimal remaining) =>
|
|
amount <= remaining;
|
|
}
|
|
}
|