WEB-506 feat: add Remittance Module with 7-step payout wizard (#3200)
WEB-506 fix: address CodeRabbit review (security, validation) WEB-506 fix: make API gateway header name configurable (MIFOS_REMITTANCE_API_HEADER) WEB-506 fix: remove duplicate translation keys (Personal Information, Transaction Details)
This commit is contained in:
+37
-5
@@ -51,12 +51,12 @@ const proxyConfig = [
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
logLevel: 'debug',
|
||||
headers: {
|
||||
...(process.env.EXTERNAL_NATIONAL_ID_SYSTEM_API_KEY
|
||||
? { 'X-Gravitee-Api-Key': process.env.EXTERNAL_NATIONAL_ID_SYSTEM_API_KEY }
|
||||
: {})
|
||||
},
|
||||
onProxyReq: function (proxyReq, req, res) {
|
||||
// Inject API key server-side (same as nginx proxy_set_header in production)
|
||||
const apiKey = process.env.EXTERNAL_NATIONAL_ID_SYSTEM_API_KEY || '';
|
||||
if (apiKey) {
|
||||
proxyReq.setHeader('X-Gravitee-Api-Key', apiKey);
|
||||
}
|
||||
const rewrittenPath = (req.url || '').replace(/^\/external-nationalid/, '/1.0/nationalid');
|
||||
console.log('[Proxy] Proxying:', req.method, req.url, '->', this.target + rewrittenPath);
|
||||
},
|
||||
@@ -75,6 +75,38 @@ const proxyConfig = [
|
||||
res.end('Proxy error: ' + (err && err.message ? err.message : 'Unknown error'));
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
context: ['/remittance-api'],
|
||||
target: 'https://apis.mifos.community',
|
||||
pathRewrite: { '^/remittance-api': '/1.0/remittance' },
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
logLevel: 'debug',
|
||||
headers: {
|
||||
...(process.env.MIFOS_REMITTANCE_API_KEY
|
||||
? { [process.env.MIFOS_REMITTANCE_API_HEADER || 'X-Gravitee-Api-Key']: process.env.MIFOS_REMITTANCE_API_KEY }
|
||||
: {})
|
||||
},
|
||||
onProxyReq: function (proxyReq, req, res) {
|
||||
const rewrittenPath = (req.url || '').replace(/^\/remittance-api/, '/1.0/remittance');
|
||||
console.log('[Proxy] Proxying:', req.method, req.url, '->', this.target + rewrittenPath);
|
||||
},
|
||||
onError: function (err, req, res) {
|
||||
console.error(
|
||||
'[Proxy] Error while proxying request:',
|
||||
req && req.method,
|
||||
req && req.url,
|
||||
'->',
|
||||
this.target,
|
||||
'-',
|
||||
err && err.message
|
||||
);
|
||||
if (res && !res.headersSent) {
|
||||
res.writeHead(502, { 'Content-Type': 'text/plain' });
|
||||
res.end('Proxy error: ' + (err && err.message ? err.message : 'Unknown error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
// For local development use `proxy.localhost.conf js` .
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user