Git Product home page Git Product logo

authorizer's Introduction

Transaction Authorizer

Java Spring Docker MariaDB Gradle Swagger

About the project ๐Ÿ“‹

This is an API for authorize credit card transactions. The project was built with the purpose of solve a technical challenge.

This API allows you to:

  • View the benefits balance of an account
  • Authorize transactions

Built With ๐Ÿ”จ

  • Java 21
  • Spring Boot 3
  • Gradle
  • Docker Compose
  • Lombok
  • JUnit 5
  • RestAssured
  • OpenAPI 3 (Swagger)

Getting Started ๐Ÿš€

โš™๏ธ Prerequisites

  • Java 21
  • Gradle
  • Docker

You can download Java 21 here.
Follow the instructions in the official Gradle documentation for installation here.

The project uses Docker Compose for containerization of the database. You'll need to install docker compose in your local machine to run the database locally. You can access the docker documentation for installation and configuration instructions here.

โ€โœ…๏ธ Rules

Example Request

This is an example of request for authorize a transaction. (All the fields are required)

{
  "account": "123",
  "totalAmount": 100.00,
  "mcc": 5411,
  "merchant": "Supermarket XYZ"
}

Transaction Authorization Rules

  • If mcc is "5411" or "5412", the FOOD balance will be used.
  • If mcc is "5811" or "5812", the MEAL balance will be used.
  • For any other mcc values, the CASH balance will be used as fallback.
  • If the benefit balance has insufficient amount then CASH balance will be used as fallback.
  • Sometimes, the mcc are incorrect and a transaction must be processed taking into account the merchant's data as well. Register merchants using the import.sql file located at src/main/resources/ to make sure that the name will be considered.

Default Merchants

Merchant Name             Type
-------------------------------
UBER EATS                 MEAL
PADARIA DO ZE             FOOD
RESTAURANTE DA MARIA      MEAL
SUPERMERCADOS BH          FOOD
  • Remember: For more merchants just add them in the insert query on import.sql

Possible Responses

  • { "code": "00" } if the transaction is approved
  • { "code": "51" } if the transaction is declined due to insufficient funds
  • { "code": "07" } for any other issue preventing the transaction

API Docs ๐Ÿ“ƒ

Once you have the application running, you can access the documentation of the API in the URL:

http://localhost:8080/authorizer/api/swagger-ui/index.html

authorizer's People

Contributors

mathmferreira avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.