As a cooperation admin I want to set and change cooperation taxes so that i need a functionality to set and change this data
Description
Every member of cooperation pays cooperation taxes. This taxes evaluation due to statute and this price decided by services which every cooperation consumes. This payments is unique for every cooperation and evaluates for every property by it's area in relation to all house area which consumes concrete service.
Acceptance Criteria
I want to have an ability to set and change tax prices in my cooperation. The price paid by the cooperation must be divided between all property holders equally. So, we need a tool which will calculate price per meter for every service cooperation consumes. By this price-per-meter we should have an ability to calculate total price of every service for every property depends on it's area and type (apartment/non-living property/service rooms).
Tasks
Create an endopint cooperations/settings/taxes which will give a CRUD functionality for setting and updating taxes information. Required fields:
Create :
cooperation id
taxes (array). Fields:
service name
total amount (price which cooperation pays for current service)
start date (the date this rate will take effect)
Read:
cooperation id: to get all cooperation services
service id (optional) to get concrete service
Update:
cooperation id
service id: id of service we need to update
service name (optional): if service name needs to be changed
total amount (optional): if price needs to be changed
start date (optional): if total amount will be changed to set the date when new rate will take effect
Delete:
cooperation id
service id (which should be deleted)
create following tables into Database:
services (stores services in relation to cooperation). Required fields:
As a cooperation admin I want to set and change cooperation taxes so that i need a functionality to set and change this data
Description Every member of cooperation pays cooperation taxes. This taxes evaluation due to statute and this price decided by services which every cooperation consumes. This payments is unique for every cooperation and evaluates for every property by it's area in relation to all house area which consumes concrete service.
Acceptance Criteria
I want to have an ability to set and change tax prices in my cooperation. The price paid by the cooperation must be divided between all property holders equally. So, we need a tool which will calculate price per meter for every service cooperation consumes. By this price-per-meter we should have an ability to calculate total price of every service for every property depends on it's area and type (apartment/non-living property/service rooms).
Tasks
cooperations/settings/taxes
which will give a CRUD functionality for setting and updating taxes information. Required fields:Create
:Read
:Update
:Delete
:services
(stores services in relation to cooperation). Required fields:id
(PK)service_name
(varchar(255))cooperation_id
(integer/FK) referencescooperations
(id)rates
(stores current rate for concrete service). Required fields:id
(PK)service_id
(integer/FK) referencesservices
(id)total_amount
(numeric (10,2)) total amount which cooperation pays for the current service per monthrate_start_date
(date) the date when this rate will take effectrate_end_date
(date) date of establishment of the new rate. Can store nulls-
price_per_meter
(stores price per meter for every established rate)id
(PK)rates_id
(integer/FK) referencesrates
(id)price_per_square_meter
(numeric(7,2)) price for current rate (total amount divided by house area)creation_date
(date) date when this price was calculated (manually or automatically)active
(boolean) flag whether this rate is active or not. Should be only one rate is active for one rate in the same timeenabled
(boolean) flag which indicates is this rate was ever applied to calculate the bills (for tax history display)cooperation_id
(integer/FK) referencescooperations
(id). Optimized data access.Implement API layer in
CooperationApiImpl
for functionality described above with following methods:createServices(Long cooperationId, CreateSettings settings)
to add new services with it's properties into Database. Returns:HTTP 201
if service createdHTTP 401
if client is unauthorizedHTTP 403
if we try to access not allowed cooperationHTTP 500
in other casesqueryServices(Long cooperationId)
get all cooperation services. Returns:HTTP 200
and list of Services if it exist or empty list if notHTTP 401
if client is unauthorizedHTTP 403
if we try to access not allowed cooperationHTTP 500
in other casesgetServiceById(Long cooperationId, Long serviceId)
. Returns:HTTP 200
and Service if existHTTP 401
if client is unauthorizedHTTP 403
if we try to access not allowed cooperationHTTP 404
if current service was not foundHTTP 500
in other casesupdateService(Long cooperationId, Long serviceId, UpdateService updatedService)
updates service by it's ID. Returns:HTTP 200
if service was updatedHTTP 401
if client is unauthorizedHTTP 403
if we try to access not allowed cooperationHTTP 404
if current service was not foundHTTP 500
in other casesdeactivateServiceById(Long cooperationId, Long serviceId)
set service as disabledHTTP 200
if service was deactivatedHTTP 401
if client is unauthorizedHTTP 403
if we try to access not allowed cooperationHTTP 404
if current service was not foundHTTP 500
in other casesImplement service layer. Constraints:
Cover all logic with Api tests