Skip to content

Latest commit

 

History

History
155 lines (135 loc) · 7.57 KB

README.md

File metadata and controls

155 lines (135 loc) · 7.57 KB

Fabrik Rest API

Overview

This documentation outlines the endpoints available in the Fabrik REST API built with Spring Boot 3 and Java 17.

Dependencies

The following report links work once the api is compiled in local

Resource Documentation Report
Java https://openjdk.org/projects/jdk/17/ No
Gradle https://gradle.org/ No
Spring Boot https://spring.io/projects/spring-boot/ No
Feign https://github.com/OpenFeign/feign/ No
MapStruct https://mapstruct.org/ No
JUnit https://junit.org/junit5/ Report
Pitest https://pitest.org/ Report
ArchUnit https://www.archunit.org/ Yes
SpotsBugs https://github.com/spotbugs/spotbugs/ Yes
Checkstyle https://checkstyle.sourceforge.io/ Report
PMD https://pmd.github.io/ Report
Open API https://springdoc.org/ URL

Project Structure

fabrik-api/
│
├── config                                              // api main config src
├── gradle/                                             // Gradle configurations file
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── com.fabrik.api/
│   │   │      ├── client/                              // Api feign client interfaces
│   │   │      ├── common/
│   │   │      │   ├── config/                          // General configurations
│   │   │      │   ├── exception/                       // Global custom exceptions
│   │   │      │   └── Util/                            // Util
│   │   │      ├── controller/                          // REST API controllers
│   │   │      ├── data/                                       
│   │   │      │   ├── dao/                             // DAO transaction implementation
│   │   │      │   ├── entities/                        // Data Entities
│   │   │      │   ├── mapper/                          // Transaction Mapper interface
│   │   │      │   └── repository/                      // Repository implementation
│   │   │      ├── domain/                              // General API POJO
│   │   │      ├── service/                             // Service layer
│   │   │      └── Application.java                     // Main application class
│   │   │
│   │   └── resources/                                  // Project Resources
│   │
│   └── test/                                           // Project Test sources
│
├── .gitignore                                          // git ignore configuration file
├── build.gradle                                        // Gradle build configuration file
└── README.md                                           // Project MD documentation

Base URL

The base URL for all endpoints is http://localhost:8080/api/fabrik/v1.

API Endpoints

The following endpoints are available:

  • GET /fabrik/api/v1/accounts: Retrieves all accounts.
curl --location 'http://localhost:8080/fabrik/api/v1/accounts' \
--header 'Content-Type: application/json'
  • GET /fabrik/api/v1/{accountId}/balance: Retrieves a balance resource by its account ID.
curl --location 'http://localhost:8080/fabrik/api/v1/14537780/balance' \
--header 'Content-Type: application/json'
  • GET /fabrik/api/v1/{accountId}/transactions?fromAccountingDate=2020-01-01&toAccountingDate=2020-12-01: Retrieves a Transaccion by an account ID and a specific date.
curl --location 'http://localhost:8080/fabrik/api/v1/14537780/transactions?fromAccountingDate=2020-01-01&toAccountingDate=2020-12-01' \
--header 'Content-Type: application/json'
  • POST /fabrik/api/v1/{accountId}/transfer: Creates a new money transfer.
curl --location 'http://localhost:8080/fabrik/api/v1/14537780/transfer' \
--header 'Content-Type: application/json' \
--data '{
    "creditor": {
        "name": "John Doe",
        "account": {
            "accountCode": "IT23A0336844430152923804660",
            "bicCode": "SELBIT2BXXX"
        },
        "address": {
            "address": null,
            "city": "Rome",
            "countryCode": "39"
        }
    },
    "executionDate": "2019-04-01",
    "uri": "REMITTANCE_INFORMATION",
    "description": "Payment invoice 75/2017",
    "amount": 800,
    "currency": "EUR",
    "isUrgent": false,
    "isInstant": false,
    "feeType": "SHA",
    "feeAccountId": "45685475",
    "taxRelief": {
        "taxReliefId": "L449",
        "isCondoUpgrade": false,
        "creditorFiscalCode": "56258745832",
        "beneficiaryType": "NATURAL_PERSON",
        "naturalPersonBeneficiary": {
            "fiscalCode1": "MRLFNC81L04A859L",
            "fiscalCode2": null,
            "fiscalCode3": null,
            "fiscalCode4": null,
            "fiscalCode5": null
        },
        "legalPersonBeneficiary": {
            "fiscalCode": null,
            "legalRepresentativeFiscalCode": null
        }
    }
}'

Endpoint Documentation

This is the swagger documentation URL.

Important gradle tasks

- `clean`  - clean build results
- `build`  - build public artifact
- `test`   - run unit tests and arch unit tests
- `pitest` - run pitest mutation test

Build

./gradlew clean build test pitest

Run

./gradlew bootRun -Dspring.profiles.active=local

License

This Api is distributed under the terms of the GPL-3.0 license. See the license for details.