Code Monkey home page Code Monkey logo

node-qiwi-api's Issues

Non-closed parenthesis

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.

Использование

Здравствуйте
Подскажите, пожалуйста, как использовать со своим номером телефона и апи ключем, куда их вписать? Задача стоит - авторизация и получение последних платежей

Wrong error catching method

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.

нет обработки ошибок node js падает с TypeError

Пришлось переписывать 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)

payment

Russian:
Здравствуйте, ваш модуль имеет функцию, которая выводит информацию после получения средств на аккаунт?

English:
Hello, does your module have a function that displays information after receiving funds to your account?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.