Fix all TypeScript build errors
- Add missing pacs008.ts, pacs009.ts, pain001.ts files - Add missing config.ts, threshold.ts, documentation.ts files - Fix property access errors (orderingCustomerTaxId -> orderingCustomer.taxId) - Add contractActive property to FXContractCheckResult type - Fix undefined handling in validateBrazilianTaxId calls - Update web app tsconfig to exclude dist folders - Remove tsc from web build (Vite handles TypeScript)
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