Last active
October 8, 2015 10:03
-
-
Save jeonghwan-kim/89a9153b14f217911239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
var iconv = require('iconv-lite'); | |
function (req, reply) { | |
// 인증결과 확인 | |
if (req.payload.P_STATUS !== '00') { | |
// 에러 처리 | |
} | |
// TID 체크 | |
checkTid(req.payload.P_TID).then(function () { | |
// 승인 요청 | |
var P_MID = 'INIpayTest'; | |
var params = '?P_TID=' + req.payload.P_TID + '&P_MID=' + P_MID; | |
var url = req.payload.P_REQ_URL + params; | |
https.get(url, function (res) { | |
res.pipe(iconv.decodeStream('euckr')).collect(function (err, decodedBody) { | |
if (err) { | |
// 에러처리 | |
} | |
// 데이터 베이스에 결재 정보 저장 | |
saveTransaction(decodedBody); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment