/eCar

Primary LanguageJava

Build Status codecov Codacy Badge Requirements Status

eCar

eCar company is going to introduce new way pricing in their new, successful backoffice supporting electric vehicles charging network.

Requirements

  • Ability to define and calculate a price via API.
  • A price definition will contain price per minute and can be defined for specific duration, e.g. one price before noon and different one afternoon
  • A calculation input will contain start and end datetime of charging process and customer id
  • For VIP customers we will grant 10% discount
  • An application should be able to be launched from command line with single command like "java –jar...."
  • A solution should require no additional software to be installed except for JRE 8

Assumptions

  • Price definition can have a time range, but it is not required.
  • If price definition does not have a time specified, it is assumed it applies all day long 00:00 - 23:59:59 and becomes default price
  • Only one default price can be defined
  • If price definition is fully defined (has time range) then it has priority before default one
  • System rejects a price definition if there is already price in the system which overlaps with the new one
  • We always want to earn money, so if there is no customer in our repository we treat him as standard one
  • System is in the same time zone than the customer

Algorithms

There are two types of charge computation algorithms. One creates a daily map with prices. The other one computes a charge using joda overlaps method. Default is the second one. You can easily change it using Togglz console

Additional methods

  • Price and customers can be deleted
  • Price and customers can be listed

Deployment

System is continually delivered to Azure. It can be reached at eCar It has SwaggerUI for a user friendly testing and Togglz console to easily change calculation algorithm.