1
0
forked from Yara724/api

fanavaran parsian done

This commit is contained in:
2026-06-17 16:57:21 +03:30
parent b008eda11b
commit 1ef17ce337
5 changed files with 838 additions and 97 deletions

View File

@@ -10,3 +10,27 @@ export const REPAIR_LINE_AMOUNT_TOMAN = {
/** Max sum of all priced + factor lines in one expert reply / validation (Toman). */
export const CLAIM_V2_TOTAL_PAYMENT_CAP_TOMAN = REPAIR_LINE_AMOUNT_TOMAN.MAX;
const ENABLED_VALUES = new Set(["1", "true", "yes", "on", "enabled"]);
/**
* Returns null when the claim v2 total cap is disabled.
*
* Set CLAIM_V2_TOTAL_PAYMENT_CAP_ENABLED=true to enforce the cap again.
* Optionally set CLAIM_V2_TOTAL_PAYMENT_CAP_TOMAN to override the amount.
*/
export function getClaimV2TotalPaymentCapToman(): number | null {
const capEnabled = ENABLED_VALUES.has(
String(process.env.CLAIM_V2_TOTAL_PAYMENT_CAP_ENABLED ?? "")
.trim()
.toLowerCase(),
);
if (!capEnabled) return null;
const configuredCap = Number(process.env.CLAIM_V2_TOTAL_PAYMENT_CAP_TOMAN);
return Number.isFinite(configuredCap) && configuredCap > 0
? configuredCap
: CLAIM_V2_TOTAL_PAYMENT_CAP_TOMAN;
}