- 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)
40 lines
1.7 KiB
JavaScript
40 lines
1.7 KiB
JavaScript
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
|