Compare commits
No commits in common. "11197bf3c78be3ff4bb9cccb54549fcfd47bd6f6" and "33df1b326cc3ec9d18d800f5c1bce3de8ca7ef0b" have entirely different histories.
11197bf3c7
...
33df1b326c
|
|
@ -443,11 +443,10 @@ function postJson(url, data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function computeErpSignature(mercantId, statusCode, nominal, clientId) {
|
function computeErpSignature(mercantId, statusCode, nominal, clientId) {
|
||||||
try {
|
try {
|
||||||
const raw = String(mercantId) + String(statusCode) + String(nominal) + String(clientId)
|
const raw = String(mercantId) + String(statusCode) + String(nominal) + String(clientId)
|
||||||
const sign = crypto.createHash('sha512').update(raw).digest('hex')
|
return crypto.createHash('sha512').update(raw).digest('hex')
|
||||||
return sign;
|
|
||||||
} catch {
|
} catch {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
@ -484,13 +483,13 @@ async function notifyERP({ orderId, nominal, mercantId }) {
|
||||||
logWarn('erp.notify.skip', { orderId, reason: 'missing_mercant_id' })
|
logWarn('erp.notify.skip', { orderId, reason: 'missing_mercant_id' })
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const signature = await computeErpSignature(mId, statusCode, nominal, ERP_CLIENT_ID)
|
const signature = computeErpSignature(mId, statusCode, nominal, ERP_CLIENT_ID)
|
||||||
|
// Payload ERP harus flat: { mercant_id, nominal, status_code, signature }
|
||||||
const payload = {
|
const payload = {
|
||||||
mercant_id: mId,
|
mercant_id: mId,
|
||||||
status_code: statusCode,
|
status_code: statusCode,
|
||||||
nominal: nominal,
|
nominal: nominal,
|
||||||
signature: signature,
|
signature,
|
||||||
}
|
}
|
||||||
logInfo('erp.notify.start', { orderId, url: ERP_NOTIFICATION_URL })
|
logInfo('erp.notify.start', { orderId, url: ERP_NOTIFICATION_URL })
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue