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

Add rake task to sync using AusPayNet API #61

Merged
merged 14 commits into from
Oct 2, 2024

Conversation

astley92
Copy link
Contributor

@astley92 astley92 commented Sep 6, 2024

Thanks for maintaining this gem!

I recently saw that Australian Payments Network have taken down the FTP server that was previously used to update the database and bank list and have released an API that can be used to update the bsb db content. So figured I'd make this PR and see if you were interested in merging.

Why

The current process to update the bsb database file is quite manual and can be made easier, especially given Australian Payments Network have introduced an API to fetch BSB data.

What

Adds a new rake task rake bsb:sync_bsb_db that uses the API to fetch latest BSB data and generate a new DB along with an outline of what changes have been made.

Splits the existing rake task into two. This is to ensure that the bank list task can still be run when required since it isn't updated in this PR and also to keep redundancy in case the API is down or something here breaks. There will still be a manual process to fall back to.

Updates README to reflect the above.

Discussion

This could be taken a step further again by using this rake task in a GHA that would create a PR if any changes are present. I'd be happy to put that together as well if it is something you'd be interested in?

@astley92 astley92 marked this pull request as draft September 6, 2024 12:09
@astley92 astley92 marked this pull request as ready for review September 6, 2024 12:44
Copy link
Contributor

@davelooi davelooi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work. Thank you @astley92.
Just a minor nitpick on the typo in the README. Otherwise, good to go.

README.md Outdated Show resolved Hide resolved
Signed-off-by: David Looi <david@coinjar.com>
Signed-off-by: David Looi <david@coinjar.com>
Copy link
Contributor

@davelooi davelooi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the rake task, and updated the bank list with it. It worked flawlessly.

Thank you @astley92 👍

@davelooi davelooi merged commit 716e1e2 into coinjar:master Oct 2, 2024
4 checks passed
@astley92
Copy link
Contributor Author

astley92 commented Oct 2, 2024

I've tested the rake task, and updated the bank list with it. It worked flawlessly.

Thank you @astley92 👍

Thanks for fixing those up and merging @davelooi I did plan to come back to this tonight haha beat me to it.

No problems, OOC would you be interested in the suggestion in the PR description on automating this a step further through a Github action that utilises this?

Was thinking an action that runs once daily that uses this new task and makes a PR if any changes are present. It would need access to an API key stored in the repo secrets so would need an admin user to make that available. Then the only thing to do when an update is due would be to review and merge a PR

Let me know, I'm happy to put something together :)

@davelooi
Copy link
Contributor

davelooi commented Oct 2, 2024

Yes, automating this process is an excellent idea.
Before AusPayNet deprecated their old FTP, we had an automated GHA that fetch and create pull request on schedule.

I have added a GHA secret AUSPAYNET_SUB_KEY to this repo.

We don't have to run this daily though. AusPayNet only pushes updates to production once a month. Having it run weekly should be sufficient.

Changes are made to BSBs throughout a month; however, these will not be promoted to
Production until the first working day of the month. For example, changes made during June
2024 were promoted to Production on Monday 1 July 2024.

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

Successfully merging this pull request may close these issues.

2 participants