#5174 Hotfix
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-01-30 19:51:01 +01:00
parent b20194b6d0
commit d6794cb4c8
1 changed files with 3 additions and 15 deletions

View File

@ -44,13 +44,6 @@ module.exports = Self => {
for (const param in decodedParams) for (const param in decodedParams)
params[param] = decodeURIComponent(decodedParams[param]); params[param] = decodeURIComponent(decodedParams[param]);
console.debug('Payment confirmation received:', {
signatureVersion,
merchantParameters,
signature,
params
});
const orderId = params['Ds_Order']; const orderId = params['Ds_Order'];
const merchantId = parseInt(params['Ds_MerchantCode']); const merchantId = parseInt(params['Ds_MerchantCode']);
@ -69,20 +62,15 @@ module.exports = Self => {
const cipher = crypto.createDecipheriv('des-ede3-cbc', secretKey, iv); const cipher = crypto.createDecipheriv('des-ede3-cbc', secretKey, iv);
cipher.setAutoPadding(false); cipher.setAutoPadding(false);
const orderKey = cipher.update(zeroPad(orderId, 8), 'utf8', 'base64') const orderKey = cipher.update(zeroPad(orderId, 8), 'utf8', 'base64')
+ cipher.final('utf8'); + cipher.final();
const res = crypto.createHmac('sha256', Buffer.from(orderKey, 'base64')) const res = crypto.createHmac('sha256', Buffer.from(orderKey, 'base64'))
.update(merchantParameters) .update(merchantParameters)
.digest('base64'); .digest('base64');
const base64Res = base64url.encode(res, 'base64'); const base64Res = base64url.encode(res, 'base64');
// if (base64Res !== signature) if (base64Res !== signature)
// throw new UserError('Invalid signature'); throw new UserError('Invalid signature');
console.debug('Payment signature:', {
res,
base64Res
});
await Self.rawSql( await Self.rawSql(
'CALL hedera.tpvTransaction_confirm(?, ?, ?, ?, ?, ?)', [ 'CALL hedera.tpvTransaction_confirm(?, ?, ?, ?, ?, ?)', [