Comparing version 0.0.4 to 0.0.5
@@ -55,3 +55,3 @@ const path = require('path'); | ||
if (callback) callback(err, res); | ||
if (err) reject(err); | ||
@@ -64,2 +64,23 @@ else resolve(res); | ||
authenticateAndCollect(pno, refreshInterval=1000) { | ||
return new Promise((resolve, reject) => { | ||
this.authenticate(pno) | ||
.then(({ orderRef }) => { | ||
const timer = setInterval(() => { | ||
this.collect(orderRef) | ||
.then(res => { | ||
if (res.progressStatus === 'COMPLETE') { | ||
clearInterval(timer); | ||
resolve(res.userInfo); | ||
} | ||
}) | ||
.catch(err => { | ||
clearInterval(timer); | ||
reject(err); | ||
}); | ||
}, refreshInterval); | ||
}, reject); | ||
}); | ||
} | ||
_createClient() { | ||
@@ -74,3 +95,2 @@ const pfx = fs.readFileSync(path.resolve(__dirname, 'FPTestcert2_20150818_102329.pfx')); | ||
return new Promise((resolve, reject) => { | ||
console.log('creating client'); | ||
soap.createClient(wsdlUrl, { wsdl_options: wsdlOptions }, (err, client) => { | ||
@@ -77,0 +97,0 @@ if (err) { |
42
index.js
@@ -6,22 +6,30 @@ const BankId = require('./bankid'); | ||
bankid.authenticate(pno).then(res => { | ||
bankid.authenticateAndCollect(pno) | ||
.then(res => { | ||
console.log(res); | ||
}) | ||
.catch(err => { | ||
console.log(res); | ||
}); | ||
// bankid.authenticate(pno).then(res => { | ||
// console.log(res); | ||
const timer = setInterval(() => { | ||
const done = () => clearInterval(timer); | ||
// const timer = setInterval(() => { | ||
// const done = () => clearInterval(timer); | ||
bankid.collect(res.orderRef) | ||
.then(res => { | ||
console.log(res.progressStatus); | ||
// bankid.collect(res.orderRef) | ||
// .then(res => { | ||
// console.log(res.progressStatus); | ||
if (res.progressStatus === 'COMPLETE') { | ||
console.log(res.userInfo); | ||
done(); | ||
} | ||
}) | ||
.catch(err => { | ||
console.log(err.toString()); | ||
done(); | ||
}) | ||
}, 1000); | ||
}); | ||
// if (res.progressStatus === 'COMPLETE') { | ||
// console.log(res.userInfo); | ||
// done(); | ||
// } | ||
// }) | ||
// .catch(err => { | ||
// console.log(err.toString()); | ||
// done(); | ||
// }) | ||
// }, 1000); | ||
// }); |
{ | ||
"name": "bankid", | ||
"description": "", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "bankid.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30313
127