Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

erwinw/antaeus

Repository files navigation

Antaeus

Antaeus (/ænˈtiːəs/), in Greek mythology, a giant of Libya, the son of the sea god Poseidon and the Earth goddess Gaia. He compelled all strangers who were passing through the country to wrestle with him. Whenever Antaeus touched the Earth (his mother), his strength was renewed, so that even if thrown to the ground, he was invincible. Heracles, in combat with him, discovered the source of his strength and, lifting him up from Earth, crushed him to death.

Welcome to our challenge.

The challenge

As most "Software as a Service" (SaaS) companies, Pleo needs to charge a subscription fee every month. Our database contains a few invoices for the different markets in which we operate. Your task is to build the logic that will pay those invoices on the first of the month. While this may seem simple, there is space for some decisions to be taken and you will be expected to justify them.

Structure

The code given is structured as follows. Feel free however to modify the structure to fit your needs.

├── pleo-antaeus-app
|
|       Packages containing the main() application.
|       This is where all the dependencies are instantiated.
|
├── pleo-antaeus-core
|
|       This is where you will introduce most of your new code.
|       Pay attention to the PaymentProvider and BillingService class.
|
├── pleo-antaeus-data
|
|       Module interfacing with the database. Contains the models, mappings and access layer.
|
├── pleo-antaeus-models
|
|       Definition of models used throughout the application.
|
├── pleo-antaeus-rest
|
|        Entry point for REST API. This is where the routes are defined.
└──

Instructions

Fork this repo with your solution. We want to see your progression through commits (don’t commit the entire solution in 1 step) and don't forget to create a README.md to explain your thought process.

Please let us know how long the challenge takes you. We're not looking for how speedy or lengthy you are. It's just really to give us a clearer idea of what you've produced in the time you decided to take. Feel free to go as big or as small as you want.

Happy hacking 😁!

How to run

./docker-start.sh

Libraries currently in use

Invoice charging development notes

It is unclear how monthly invoice charging is to be triggered. For the purpose of this exercise I will assume that it is triggered by calling a specific API end point (/rest/v1/charge_invoices). This has the following advantages:

  1. Simplicity of implementation;
  2. Simplicity of testing;
  3. With most of the code present, refactoring to a more advanced triggering mechanism should be easier.

This approach has the following disadvantages:

  1. If the API endpoint gets called multiple times, invoices might end up being "paid" twice (since listing the invoices and charging them is not atomic);
  2. I don't know if there is a duration limitation for API calls; if there are many invoices to be paid we might hit that timeout.

Time spent

Roughly 6 hours coding, a few hours getting the right JVM version (11)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •