Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not returning transactions #8

Open
dwdickens opened this issue Jul 18, 2017 · 9 comments
Open

Not returning transactions #8

dwdickens opened this issue Jul 18, 2017 · 9 comments

Comments

@dwdickens
Copy link

Hi, the script doesn't return any of the transactions. (The list of accounts works great.)

parseTransactions is rejected with the message 'Cannot find transactions in the resp'

I have had a look at the html file that is returned in the log folder. It doesn't have any of the transaction data within it, and if I open the static page in a browser it just shows the spinners.

Please let me know if I can help trouble shoot in any way

@twang2218
Copy link
Owner

Thanks for your report. Here are some ways to debug the problem.

DEBUG=node-cba-netbank

The debug information can be printed via DEBUG=node-cba-netbank, so you can try:

DEBUG=node-cba-netbank cba-netbank download -a smart

or if it's not installed globally, and you currently inside the project directory, then you can

DEBUG=node-cba-netbank node src/cli.js download -a smart

Which will download the transactions for account with smart in its name, and will output the debug information, which might contain some exceptions or errors.

Run test case

First, set the username/password in the environment variables:

export NETBANK_USERNAME=12345678
export NETBANK_PASSWORD=YOUR_PASSWORD

then, just run npm run test-debug api. This will run a series test, and will try to login to the netbank, fetch the account list, and retrieve the transactions for the first account. There might have some errors/exceptions in the output, which might help the debug.

The content of ./log/ folder

For the transactions parsing, you can have a look on the <number>-3-response-body.html file with the <title>NetBank - Transactions</title> in it.

If you cannot find the file with Transactions title, then there might be some error happened during access the transaction page.

In that file if you find the transaction page, the regular expression, /({"Transactions":(?:[^;]+))\);/ is
used to match the transactions. You can manually search for {"Transactions" in the file to see whether there is any transactions data. If you can find the transactions, then maybe there are some cases not covered by the regex. https://regex101.com/ is very helpful for adjust the regex.

If you cannot find any transactions, then there might be some errors in the pages.

You can check the last -response-body.html file, it might be a partial html file, which might contains the transactions as well, like above, just search {"Transactions" to see whether it contains transactions or not.

I hope these information will help you identify the problem, and I will happy to fix it.

@dwdickens
Copy link
Author

Hi, thanks for the helpful debugging instructions.

I have looked at the last -response-body.html file.

It doesn't have {"Transactions" in it. The file is complete (it has the final </html tag), and when I view it is has the spinners and says 'Please wait' in the transaction list. There are no error messages in the page.

I am guessing that the page loads the Transactions data using ajax and this isn't being run.

It worked great in previous version of node-cba-netbank - is there something that has changed in how this page is processed?

@cmcnamara87
Copy link

having the same problem, got this from DEBUG=node-cba-netbank cba-netbank download -a smart

(node:18562) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): Error: ENOENT: no such file or directory, open 'log/1502003489950-1-request.json'
(node:18562) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): Error: ENOENT: no such file or directory, open 'log/1502003489950-2-response.json'
(node:18562) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): Error: ENOENT: no such file or directory, open 'log/1502003489950-3-response-body.html'
  node-cba-netbank parseTitle(): found title => 'Transactions' +780ms
Unhandled rejection Cannot find transactions in the resp

@dwdickens
Copy link
Author

dwdickens commented Aug 6, 2017 via email

@davidmcgregor
Copy link

@dwdickens Have you found a solution to this issue yet? I've got the same issue.

@durranitech
Copy link

Me too. Account list working but transaction list not working

@sebszocinski
Copy link

Any updates on this?
Getting the same issue here

@davidmcgregor
Copy link

I found the issue is with the parser.parseTransactionPage function.
If I remove it and replace it with:
.then(parser.parseForm).then(parser.parseAccountListWithKeys)
Then it works.

@sebszocinski
Copy link

Thanks @davidmcgregor that did the trick 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants