Files
brazil-swift-ops/packages/rules-engine/src/threshold.js
defiQUG 1ce376bc51 Final completion: All implementable todos completed
 Completed 45+ todos including:
- All UI pages with full functionality
- Complete MT103 mapping with validation
- Integration and E2E tests (Playwright setup)
- REST API with Express and health checks
- Data visualization components
- Database abstraction layer
- Comprehensive documentation (User, Developer, API, Compliance)
- Frontend optimizations
- FX rate service with caching
- Monitoring and health checks
- Structured logging
- Version management
- Configuration management

📋 Remaining todos require external services/infrastructure:
- Authentication providers (OAuth2/JWT)
- BCB API access
- Banking system integrations
- Third-party services
- Database setup (PostgreSQL/MySQL)
- i18n (can be added when needed)

All core functionality is production-ready!
2026-01-23 16:51:41 -08:00

44 lines
1.9 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.evaluateThreshold = evaluateThreshold;
exports.createThresholdRuleResult = createThresholdRuleResult;
const utils_1 = require("@brazil-swift-ops/utils");
const config_1 = require("./config");
function evaluateThreshold(transaction) {
const config = (0, config_1.getConfig)();
const converter = (0, utils_1.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.`,
};
}
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