automated-payroll's People
automated-payroll's Issues
There is limited number of requests allowed on Github API without auth keys
Create a Webhook For Crons
Reference: https://github.com/nax3t/automated-payroll/blob/main/app.js#L181-L186
We should receive a web hook to trigger the action to run the service, and setup https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#scheduled-events to be responsible for running the crons.
Add Service Layer
In order to make the code more readable, and testable we should introduce a service layer to the project. Basically a service is just a function or class that does some work. It just does 1 thing and 1 thing only. GetAccountsPayableService for example.
AC:
- Start moving logic to services. ( GetAccountsPayableService as an example )
Depends on:
Some ideas to make this more readable
I have a few ideas to help make this a little more readable, and wonder if I worked on this would you accept the pull request.
API Client
We can create an instance of axios client with the base URL, any credentials thats needed. When we call the API we would do so with our instance.
Add Service Layer
Basically a service is just a function or class that does some work. It just does 1 thing and 1 thing only. GetAccountsPayableService for example.
Personal preferences
https://github.com/nax3t/automated-payroll/blob/main/app.js#L72-L73
We can do something like this instead: action.label?.name === 'Ready to pay'
Create a Webhook instead?
At the end of the day we have an interval when we need to do work.
https://github.com/nax3t/automated-payroll/blob/main/app.js#L181-L186
Consider having some other service, like GitHub, handling the cron to send it to our webhook.
Track payment ledgers
What happens if a payment failed? why? where are we logging it? what would you do right now if payment failed and someone asked you to look into it? When you do track it in a database this is a secondary action so I would take a instance of eventemitter with something like this pattern
Only use the GitHub username to find the member from API
Let's only use the GitHub username to find the member from API to get hourly rates.
Problem:
This line of code is creating a problem because we have led76marx
and toledit
in our team with led
as part of their name.
Due to this reason, toledit
was receiving the payment with an hourly rate of led76marx
.
Also, we should get rid of this code there are possible edge cases for this too.
Track payment ledgers - [Discussion]
What happens if a payment failed? why? where are we logging it? what would you do right now if payment failed and someone asked you to look into it?
Consider:
When you do track it in a database this is a secondary action so I would take a instance of eventemitter with something like this pattern https://refactoring.guru/design-patterns/observer
Create an API Client
We can create an instance of axios client with the base URL, any credentials thats needed to make API request. When we call the API we would do so with our instance.
AC:
- Create a Custom Axios Instance
- In at least 1 place call the API with our custom Axios Instance
Low balance case
Expected
When the sender account balance is lower than amount + fees
then it should show payment failed.
Actually
Shows payment succeeded but there is no transaction.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.