nazarovsa / node-qiwi-api Goto Github PK
View Code? Open in Web Editor NEWNode API to work with QIWI Wallet
License: MIT License
Node API to work with QIWI Wallet
License: MIT License
How to get balance?
Можно было бы писать без callback hell.
getAccount info returns nothing
Hello! I noticed what almost in every example given in https://www.npmjs.com/package/node-qiwi-api you forgot to close parenthesis, e. g. here:
Wallet.getAccountInfo((err, info) => {
if(err) {
/*hanle error*/
}
console.log(info);
}
Anyway, thank you very much for this module, it's useful for me and I believe not only for me.
Большое спасибо за библиотеку 👍
Здравствуйте
Подскажите, пожалуйста, как использовать со своим номером телефона и апи ключем, куда их вписать? Задача стоит - авторизация и получение последних платежей
When doing getTransactionInfo( tId ) - getting unhandled rejection:
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefined
at get (path\node_modules\node-qiwi-api\lib\asyncApi.js:724:34)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async init (path\index.js:101:13)
Which goes from this fn:
async function get(options) {
options.headers = headers;
try {
var result = await axios.get(options.url, options);
console.log(result)
if (result.data.errorCode != undefined)
throw result.data;
return result.data;
}
catch (error) {
throw error.response.data;
}
}
However if we check error object getting into catch part - it's completely normal response, with fields:
errorCode: 0,
error: null
So the error in comparing 0 with undefined, getting true here, then throwing error.
Line 718
The fix would be like this:
if (result.data.errorCode) {
//
}
When it's 0 (false) it won't trigger if.
Any other err code will.
or
if (result.data.error != null) {
//
}
Same error check method is used in lines
736
754
771
788
Also comparisons like this
error.message != undefined
on lines
703
677
May also cause problem at some point ( or at least it's senseless, because of the same reason described above )
Despite I didn't get any missthrows on these lines by now,
I recommend you to look into them more closely and probably change the same way.
Пришлось переписывать getOperationHistory в части отлова err от getAccountInfo.
TypeError: Cannot read property 'authInfo' of undefined
at /home/ubuntu/node/node_modules/node-qiwi-api/node-qiwi-api.js:75:73
at Request._callback (/home/ubuntu/node/node_modules/node-qiwi-api/node-qiwi-api.js:47:13)
at Request.self.callback (/home/ubuntu/node/node_modules/node-qiwi-api/node_modules/request/request.js:188:22)
at Request.emit (events.js:210:5)
at Request. (/home/ubuntu/node/node_modules/node-qiwi-api/node_modules/request/request.js:1171:10)
at Request.emit (events.js:210:5)
at IncomingMessage. (/home/ubuntu/node/node_modules/node-qiwi-api/node_modules/request/request.js:1091:12)
at Object.onceWrapper (events.js:299:28)
at IncomingMessage.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Russian:
Здравствуйте, ваш модуль имеет функцию, которая выводит информацию после получения средств на аккаунт?
English:
Hello, does your module have a function that displays information after receiving funds to your account?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.