Skip to content

Instantly share code, notes, and snippets.

@rodrigm
Last active January 30, 2019 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrigm/bf42bf2aa0f1d17381b412a3ffec7fd9 to your computer and use it in GitHub Desktop.
Save rodrigm/bf42bf2aa0f1d17381b412a3ffec7fd9 to your computer and use it in GitHub Desktop.
Payslips Exercise
00000000000197084172E201812310024860005000001243012000002983200206337
00000000039745201136H201812310025280005000001264010000002528000214879
00000000052396433625F201812310022170004000000886816000003547200177360
00000000252358914324P201812310015060004000000602411000001656600128010
00000000020924093908M201812310014020001000000140213000001822600120572
00000000031519633248B201812310010570001000000105712000001268400091959
00000000042760016472L201812310026130005000001306513000003396900214266
00000000042892428750F201812310019300001000000193016000003088000160190
00000000146823749703H201812310018630003000000558919000003539700145314
00000000147874920733G201812310017630001000000176319000003349700141040

Starting with the amazing world of payslips!

In this exercise we will evaluate:

  • How do you usually code: style, consistency, etc.
  • Efficiency and suitability of the idea
  • Software architecture and maintainability

Exercise

The company "Helados PΓ©rez" is using an old software called "NominaPro" to calculate its payslips. They have a big problem, it is that, they can not modify the IRPF of their payroll.

They are beginning to integrate with Rollbox and we have decided to develop an independent software that can recover and simulate your payslips.

So, from Rollbox we want to develop a public API to report a list of payslips. In addition, we can modify the IRPF of these payslips.

For this, we have a data file, which is hosted on a remote server and contains a payslip report.

The composition of the file is:Β 

  • The name of the file will follow a pattern payslips.YYYYMM.txt where Y's represent the year (i.e: 2018) and M's represent the month (Example: 01)
  • Each line represents a payslip
  • Each line will keep the following structure:
    • 12 chars πŸ‘‰ ID
    • 9 chars πŸ‘‰ Vat
    • 8 chars πŸ‘‰ Date (Format: YYYYMMDD)
    • 8 chars πŸ‘‰ Gross (6 integers + 2 decimals)
    • 4 chars πŸ‘‰ % Deductions (2 integers + 2 decimals)
    • 8 chars πŸ‘‰ Amount of deductions (6 integers + 2 decimals)
    • 4 chars πŸ‘‰ % IRPF (2 integers + 2 decimals)
    • 8 chars πŸ‘‰ Amount IRPF (6 integers + 2 decimals)
    • 8 chars πŸ‘‰ Net (6 integers + 2 decimals)

The file should be retrieved from: https://gist.githubusercontent.com/rodrigm/bf42bf2aa0f1d17381b412a3ffec7fd9/raw/201abd5ec86f60ec63025c885751ba55cdceb720/payslips.201812.txt. This is the unique file that we have in the server at this moment.

Tasks

  1. We require a GET endpoint that allows us to recover all the payroll extracted for a month and year.
  2. We need a PUT endpoint that allows us to modify the % of IRPF for the payrolls of a month and year. Further, all fields of the payslips should be correctly calculated/updated.

Technology

To solve the exercise, you can use the most comfortable language and framework for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment