Fix all placeholders and hardcoded values
- Make transactionId and batchId required parameters in E&O uplift functions - Move BIC code to configurable institution-config in utils package - Update effective dates to use current date instead of hardcoded 2024-01-01 - Add placeholder review documentation - Comment out console.log in retention policy (production TODO) - All critical placeholders resolved
This commit is contained in:
40
packages/rules-engine/src/threshold.js
Normal file
40
packages/rules-engine/src/threshold.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { getDefaultConverter } from '@brazil-swift-ops/utils';
|
||||
import { getConfig } from './config';
|
||||
export function evaluateThreshold(transaction) {
|
||||
const config = getConfig();
|
||||
const converter = getDefaultConverter();
|
||||
const usdEquivalent = converter.getUSDEquivalent(transaction.amount, transaction.currency);
|
||||
const threshold = config.threshold.usdReportingThreshold;
|
||||
const requiresReporting = usdEquivalent >= threshold;
|
||||
return {
|
||||
passed: true,
|
||||
transactionAmount: transaction.amount,
|
||||
currency: transaction.currency,
|
||||
usdEquivalent,
|
||||
threshold,
|
||||
requiresReporting,
|
||||
rationale: requiresReporting
|
||||
? `Transaction amount (${transaction.amount} ${transaction.currency} = ${usdEquivalent.toFixed(2)} USD) exceeds reporting threshold of ${threshold} USD. Reporting to Banco Central required.`
|
||||
: `Transaction amount (${transaction.amount} ${transaction.currency} = ${usdEquivalent.toFixed(2)} USD) is below reporting threshold of ${threshold} USD.`,
|
||||
};
|
||||
}
|
||||
export function createThresholdRuleResult(check) {
|
||||
const severity = check.requiresReporting ? 'Warning' : 'Info';
|
||||
const decision = check.requiresReporting ? 'Hold' : 'Allow';
|
||||
return {
|
||||
ruleId: 'threshold-check',
|
||||
ruleName: 'USD Equivalent Threshold Check',
|
||||
passed: true,
|
||||
severity,
|
||||
decision,
|
||||
rationale: check.rationale,
|
||||
details: {
|
||||
transactionAmount: check.transactionAmount,
|
||||
currency: check.currency,
|
||||
usdEquivalent: check.usdEquivalent,
|
||||
threshold: check.threshold,
|
||||
requiresReporting: check.requiresReporting,
|
||||
},
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=threshold.js.map
|
||||
Reference in New Issue
Block a user