feat: SolaceNet gateway rails, IRU marketplace hardening, and docs
- Gateway adapter registry, rails routes, optional SOLACENET_GATEWAY_RAILS_ENFORCE; HTTP integration tests. - IRU marketplace: rate limits, public routes, notifications/SMTP env docs; marketplace UI constants and flows. - Quantum proxy legacy protocol types; debank/tezos/GSDS touch-ups; .env.example operator notes. - SolaceNet doc set (gaps, runbooks, telecom schema example). Tests: npm run test:iru-marketplace, npm run test:gateway (pass). Note: full-repo tsc still reports unrelated legacy errors outside this change set. Made-with: Cursor
This commit is contained in:
46
src/infrastructure/quantum/proxy/legacy-protocol-types.ts
Normal file
46
src/infrastructure/quantum/proxy/legacy-protocol-types.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Legacy / rail protocols visible to the quantum translation & compatibility layer.
|
||||
* Aligns with SolaceNet gateway rails where applicable (see gateway-adapter-registry).
|
||||
*/
|
||||
export type LegacyProtocol =
|
||||
| 'SWIFT'
|
||||
| 'ISO20022'
|
||||
| 'ACH'
|
||||
| 'SEPA'
|
||||
| 'PRIVATE_BANK'
|
||||
| 'KTT_EVIDENCE'
|
||||
| 'TT_ROUTE'
|
||||
| 'DTC_SETTLEMENT'
|
||||
| 'DTCC_NSCC'
|
||||
| 'DTCC_FICC'
|
||||
| 'SWIFT_GPI'
|
||||
| 'MOJALOOP'
|
||||
| 'RTGS'
|
||||
| 'CARD_NETWORK';
|
||||
|
||||
/** Subset used for SolaceNet-aligned scaffolds (non-SWIFT/ACH core banking). */
|
||||
export const SOLACENET_EXTENDED_PROTOCOLS: readonly LegacyProtocol[] = [
|
||||
'KTT_EVIDENCE',
|
||||
'TT_ROUTE',
|
||||
'DTC_SETTLEMENT',
|
||||
'DTCC_NSCC',
|
||||
'DTCC_FICC',
|
||||
'SWIFT_GPI',
|
||||
'MOJALOOP',
|
||||
'RTGS',
|
||||
'CARD_NETWORK',
|
||||
] as const;
|
||||
|
||||
export function isSolaceNetExtendedProtocol(p: string): p is LegacyProtocol {
|
||||
return (SOLACENET_EXTENDED_PROTOCOLS as readonly string[]).includes(p);
|
||||
}
|
||||
|
||||
/** All values accepted by quantum translation / compatibility services. */
|
||||
export const ALL_LEGACY_PROTOCOLS: readonly LegacyProtocol[] = [
|
||||
'SWIFT',
|
||||
'ISO20022',
|
||||
'ACH',
|
||||
'SEPA',
|
||||
'PRIVATE_BANK',
|
||||
...SOLACENET_EXTENDED_PROTOCOLS,
|
||||
] as const;
|
||||
@@ -4,10 +4,10 @@
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
|
||||
import { ALL_LEGACY_PROTOCOLS, type LegacyProtocol } from './legacy-protocol-types';
|
||||
|
||||
export interface CompatibilityCheckRequest {
|
||||
legacyProtocol: 'SWIFT' | 'ISO20022' | 'ACH' | 'SEPA' | 'PRIVATE_BANK';
|
||||
legacyProtocol: LegacyProtocol;
|
||||
transactionData: any;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,22 @@ export class QuantumCompatibilityService {
|
||||
);
|
||||
break;
|
||||
|
||||
case 'KTT_EVIDENCE':
|
||||
case 'TT_ROUTE':
|
||||
case 'DTC_SETTLEMENT':
|
||||
case 'DTCC_NSCC':
|
||||
case 'DTCC_FICC':
|
||||
case 'SWIFT_GPI':
|
||||
case 'MOJALOOP':
|
||||
case 'RTGS':
|
||||
case 'CARD_NETWORK':
|
||||
compatibilityScore = this.checkSolaceNetRailScaffoldCompatibility(
|
||||
request.legacyProtocol,
|
||||
issues,
|
||||
recommendations
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
issues.push(`Unknown protocol: ${request.legacyProtocol}`);
|
||||
compatibilityScore = 0;
|
||||
@@ -90,6 +106,21 @@ export class QuantumCompatibilityService {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* SolaceNet-aligned rail scaffolds: neutral score until real field contracts exist.
|
||||
*/
|
||||
private checkSolaceNetRailScaffoldCompatibility(
|
||||
protocol: LegacyProtocol,
|
||||
issues: string[],
|
||||
recommendations: string[]
|
||||
): number {
|
||||
issues.push(`Scaffold protocol mapping for ${protocol}; validate against live rail contract before production.`);
|
||||
recommendations.push(
|
||||
'See dbis_core/docs/solacenet/PROTOCOL_GAPS_CHECKLIST.md and gateway-adapter-registry for adapter status.'
|
||||
);
|
||||
return 72;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check SWIFT compatibility
|
||||
*/
|
||||
@@ -255,7 +286,7 @@ export class QuantumCompatibilityService {
|
||||
* List all supported protocols
|
||||
*/
|
||||
async listSupportedProtocols(): Promise<string[]> {
|
||||
return ['SWIFT', 'ISO20022', 'ACH', 'SEPA', 'PRIVATE_BANK'];
|
||||
return [...ALL_LEGACY_PROTOCOLS];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ import prisma from '@/shared/database/prisma';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
|
||||
import type { LegacyProtocol } from './legacy-protocol-types';
|
||||
|
||||
export interface QuantumTranslationRequest {
|
||||
legacyProtocol: 'SWIFT' | 'ISO20022' | 'ACH' | 'SEPA' | 'PRIVATE_BANK';
|
||||
legacyProtocol: LegacyProtocol;
|
||||
transactionData: any;
|
||||
amount: string;
|
||||
currencyCode: string;
|
||||
@@ -158,6 +158,15 @@ export class QuantumTranslationService {
|
||||
currency: 'currencyCode',
|
||||
},
|
||||
},
|
||||
KTT_EVIDENCE: { messageType: 'KTT', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
TT_ROUTE: { messageType: 'TT', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
DTC_SETTLEMENT: { messageType: 'DTC', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
DTCC_NSCC: { messageType: 'DTCC_NSCC', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
DTCC_FICC: { messageType: 'DTCC_FICC', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
SWIFT_GPI: { messageType: 'SWIFT_GPI', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
MOJALOOP: { messageType: 'MOJALOOP', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
RTGS: { messageType: 'RTGS', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
CARD_NETWORK: { messageType: 'CARD', quantumFormat: 'ISO20022', fieldMapping: {} },
|
||||
};
|
||||
|
||||
return defaultMappings[legacyProtocol] || {};
|
||||
@@ -205,6 +214,17 @@ export class QuantumTranslationService {
|
||||
fxRate = new Decimal(0.85); // Example EUR rate
|
||||
}
|
||||
break;
|
||||
case 'KTT_EVIDENCE':
|
||||
case 'TT_ROUTE':
|
||||
case 'DTC_SETTLEMENT':
|
||||
case 'DTCC_NSCC':
|
||||
case 'DTCC_FICC':
|
||||
case 'SWIFT_GPI':
|
||||
case 'MOJALOOP':
|
||||
case 'RTGS':
|
||||
case 'CARD_NETWORK':
|
||||
fxRate = new Decimal(1);
|
||||
break;
|
||||
default:
|
||||
fxRate = new Decimal(1);
|
||||
}
|
||||
@@ -250,6 +270,17 @@ export class QuantumTranslationService {
|
||||
// Private bank has higher risk
|
||||
riskScore = new Decimal(0.15);
|
||||
break;
|
||||
case 'KTT_EVIDENCE':
|
||||
case 'TT_ROUTE':
|
||||
case 'DTC_SETTLEMENT':
|
||||
case 'DTCC_NSCC':
|
||||
case 'DTCC_FICC':
|
||||
case 'SWIFT_GPI':
|
||||
case 'MOJALOOP':
|
||||
case 'RTGS':
|
||||
case 'CARD_NETWORK':
|
||||
riskScore = new Decimal(0.1);
|
||||
break;
|
||||
}
|
||||
|
||||
// Additional risk factors from transaction data
|
||||
|
||||
Reference in New Issue
Block a user