Technical Description

Cashbook service technical description

The cashbook service main functionality is to serve as a financial newspaper which tracks all retail transactions including different payment methods in cash registers and vault of a retail store, it includes the tracking of expenditures and other sources of income or bank deposits and withdrawals for vaults. All the data is tracked through sessions in either cash registers of vaults called settlements.

Cash register settlements are created when a cash register starts operating at the start of working day, from there all the retail transactions are tracked using the settlement ID, expenditures and income are also tracked with it. At the end of the working day before the settlement is closed, the total amount of cash and other payment methods are calculated by adding up all the tracked data by the settlement ID, is then when the cashier performing this operation can check if the cash counted manually matches the total cash calculated by the service, if it matches, the settlement is closed, if not, the cashier can try again up to three times. On the third try, the settlement is closed with the amount provided. After the settlement is closed, the difference between the total amount of cash provided by the cashier and the service is calculated. All the data related to the totals of different payment methods and cash difference is then sent to tlogcreator service through asynchronous messaging using Rabbitmq where is then transformed to a data format for SAP processing.

Vault settlements are created manually when a store starts operations with a defined amount of cash. From there whenever a cash register is opened, the cash used to open it is tracked to be retrieved from the vault settlement, in the same way, whenever a cash register settlement is closed, the cash gathered from it is tracked to vault settlement. Other cash movements of from a vault settlement can be tracked when some of it is retrieved from vault and deposited in a bank, among other operations. At the end of a working day, the staff in the retail store can close the vault settlement by counting cash manually in it and check if it matches with the total amount of cash calculated by the service, if the amount provided matches the amount of the service, the settlement is closed, if not, the process can be repeated as many times as needed until the staff is satisfied with amount counted. After a vault settlement is closed a new one is automatically opened with the amount counted by staff. All the data related to the totals of cash and cash difference is then sent to tlogcreator service through asynchronous messaging using Rabbitmq where is then transformed to a data format for SAP processing.

The different records of currency from retail transactions and other operations tracked in a settlement are know as cashbook entries. They all belong to a specific settlement ID and are added together when the totals for different payment methods are calculated. They can also be created through API requests to track expenditures and income in cash register settlements or bank deposits and withdrawals for vault settlements. These type of cashbook entries are tracked with a cashbook account which is represented by an arbitrary defined number, these accounts represent the reason of cash movement done internally in a retail store defined by internal business rules. Whenever any of these type of cashbook entries are created, the data related to it is also sent to tlogcreator service through asynchronous messaging using Rabbitmq where is then transformed to a data format for SAP processing.

Endpoints

Details of the endpoints provided by the settlement API can be found here.
Cashbook entry API here.
Cashbook account API here.

Dependencies

  • spring-boot-starter-data-jpa: Starter for using Spring Data JPA with Hibernate.
  • querydsl-jpa: JPA support for Querydsl.
  • querydsl-apt: Annotation processing tool based source code generation for Querydsl.
  • postgresql: PostgreSQL JDBC Driver Postgresql.
  • spring-data-commons: Spring Data Core.
  • liquibase-core: Liquibase is a tool for managing and executing database changes.
  • h2: H2 Database Engine.
  • json-path: JSONPath is used for selecting and extracting a JSON document's property values.
  • spring-boot-starter-amqp: Starter for using Spring AMQP and Rabbit MQ.
  • authjwt: OneX dependency to access custom data in JWTs.
  • spring-cloud-starter-openfeign: A declarative REST client for Spring Boot apps.
  • spring-cloud-starter-netflix-ribbon: Ribbon is a client-side load balancer that gives you a lot of control over the behavior of HTTP and TCP clients.
  • springfox-swagger2: JSON API documentation for spring based applications.
  • springfox-swagger-ui: Javascript based user interface for JSON API documentation for spring based applications.
  • gson: Gson is a Java library that can be used to convert Java Objects into their JSON representation.
  • DbSetup: Helps you setup your database with test data.
  • spring-boot-starter-test: Starter for testing Spring Boot applications with libraries including JUnit Jupiter, Hamcrest and Mockito.
  • validation-api: Bean Validation API.