Skip to content

inensus/test

Repository files navigation

Inensus - Transaction Handling

Hi! Are you ready to join our team working on an innovative and exciting project?

For the test assignment, we would like you to create a basic transaction processing unit that is responsible to cover different types of debts and generating energy.

How to prioritize payments?

The transaction processor prioritizes different types of payments as following; 1- Covering appliance rate debts 2- Covering tariff fixed costs 3- Generating electricty with the rest amount

Helpful notes:

We love the Service Layer and testing, so don't hesitate to use it :) .

  • If the sent amount can not cover the debts, just pay as much as you can.
  • The energy could be sold as chunks. That means, if the amount can not cover the whole unit; 0.x ( 1<=x<=9 with only one decimal) units could be generated.
  • When the rest amount (after all debts are paid) can not fit 0.x; Please topup the amount to the next 0.x.

Request Sample

POST /api/transactions

{
    "amount": 1000,
    "unpaid_appliance_rates": 2,
    "appliance_rate_cost": 200,
    "tariff_fixed_costs": 160,
    "price_per_kwh": 700
}

Expected Response

{
    "data": 
    {
        "paid_for_appliance_rates": 400,
        "fully_covered_appliance_rate":2,
        "paid_for_fixed_tariff" : 160,
        "paid_for_energy": 490,
        "topup_for_energy": 50,
        "sold_energy":0.7
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published