Git Product home page Git Product logo

automated-payroll's People

Contributors

manishram avatar nax3t avatar

Stargazers

 avatar

Watchers

 avatar

automated-payroll's Issues

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.

https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#scheduled-events

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

https://refactoring.guru/design-patterns/observer

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.

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 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.