const crypto = require('crypto');
const { URLSearchParams } = require('url');
function VerifySignature(responseObj, secretKey) {
const params = new URLSearchParams();
params.append('order_ref', responseObj.order_ref);
params.append('channel_order_ref', responseObj.channel_order_ref);
params.append('merchant_order_ref', responseObj.merchant_order_ref);
params.append('status', responseObj.status);
params.sort();
const message = params.toString();
const hashValue = crypto.createHmac('sha256', secretKey).update(message).digest('base64');
if(hash_value !== requestObj.signature_hash){
// 취소처리 및 위변조에 대한 결과저장
}
}
const crypto = require('crypto');
const { URLSearchParams } = require('url');
function VerifySignature(webhookResponseObj, secretKey) {
const params = new URLSearchParams();
params.append('currency', webhookResponseObj.currency);
params.append('amount', webhookResponseObj.amount);
params.append('merchant_order_ref', webhookResponseObj.merchant_order_ref);
params.append('link_ref', webhookResponseObj.link_ref);
params.append('country_code', webhookResponseObj.country_code);
params.append('status', webhookResponseObj.status);
params.sort();
const message = params.toString();
const hashValue = crypto.createHmac('sha256', secretKey).update(message).digest('base64');
if(hash_value !== webhookResponseObj.signature_hash){
// 취소처리 및 위변조에 대한 결과저장
}
}
const crypto = require('crypto');
const { URLSearchParams } = require('url');
function VerifySignature(webhookResponseObj, secretKey) {
const params = new URLSearchParams();
params.append('currency', webhookResponseObj.currency);
params.append('amount', webhookResponseObj.amount);
params.append('order_ref', webhookResponseObj.order_ref);
params.append('merchant_order_ref', webhookResponseObj.merchant_order_ref);
params.append('channel_order_ref', webhookResponseObj.channel_order_ref);
params.append('country_code', webhookResponseObj.country_code);
params.append('status', webhookResponseObj.status);
params.append('channel_key', webhookResponseObj.channel_key);
params.append('method_name', webhookResponseObj.method_name);
params.sort();
const message = params.toString();
const hashValue = crypto.createHmac('sha256', secretKey).update(message).digest('base64');
if(hash_value !== webhookResponseObj.signature_hash){
// 취소처리 및 위변조에 대한 결과저장
}
}
const crypto = require('crypto');
const { URLSearchParams } = require('url');
function VerifySignature(webhookResponseObj, secretKey) {
const params = new URLSearchParams();
params.append('currency', webhookResponseObj.currency);
params.append('order_ref', webhookResponseObj.order_ref);
params.append('merchant_order_ref', webhookResponseObj.merchant_order_ref);
params.append('status', webhookResponseObj.status);
params.sort();
const message = params.toString();
const hashValue = crypto.createHmac('sha256', secretKey).update(message).digest('base64');
if(hash_value !== webhookResponseObj.signature_hash){
// 취소처리 및 위변조에 대한 결과저장
}
}