{"id":21361035,"url":"https://github.com/stiebo/openapi-generator-sample","last_synced_at":"2026-05-06T17:33:52.144Z","repository":{"id":263572818,"uuid":"890822245","full_name":"stiebo/openapi-generator-sample","owner":"stiebo","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-24T12:13:04.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T18:42:02.314Z","etag":null,"topics":["jpa","openapi","openapi-generator","spring-boot","spring-security"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stiebo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-19T08:40:54.000Z","updated_at":"2024-12-03T19:56:09.000Z","dependencies_parsed_at":"2024-11-19T09:49:09.056Z","dependency_job_id":"b6c57686-edec-445b-86ec-662eb4dd093e","html_url":"https://github.com/stiebo/openapi-generator-sample","commit_stats":null,"previous_names":["stiebo/openapi-generator-sample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stiebo/openapi-generator-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stiebo%2Fopenapi-generator-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stiebo%2Fopenapi-generator-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stiebo%2Fopenapi-generator-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stiebo%2Fopenapi-generator-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stiebo","download_url":"https://codeload.github.com/stiebo/openapi-generator-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stiebo%2Fopenapi-generator-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32704437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jpa","openapi","openapi-generator","spring-boot","spring-security"],"created_at":"2024-11-22T06:08:09.719Z","updated_at":"2026-05-06T17:33:52.126Z","avatar_url":"https://github.com/stiebo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringBoot API generated with OpenAPI Generator Maven Plugin\n\n## Code generation\n\nOpenAPI definition is under resources/openapi/antifraudsystem.yaml\n\nRun\n\n\u003e mvn\n\nand you'll fine the code under:\n\n* target/generated-sources/openapi/index.adoc =\u003e Generated AsciiDoc\n* target/generated-sources/openapi/src/main/java/dev/stiebo/openapi_generator_sample =\u003e Generated Java Code using delegate pattern\n\nRun\n\n\u003e mvn spring-boot:start \n\nand you'll find Swagger under:\n\n* [http://localhost:28859/swagger-ui.html](http://localhost:28859/swagger-ui.html)\n\n\n## Background\n\nFrauds carry significant financial costs and risks for all stakeholders. So, the presence of an anti-fraud system is a necessity for any serious e-commerce platform.\n\nThe Anti-Fraud System project provides a comprehensive framework for detecting and preventing fraudulent financial transactions. By integrating role-based access control, RESTful APIs, heuristic validation rules, and adaptive feedback mechanisms, the system offers a robust solution for financial institutions to safeguard against fraud. Leveraging Spring Boot and its associated technologies, the project demonstrates best practices in building secure, scalable, and maintainable applications in the financial sector.\n\nLink to Github repository: [https://github.com/stiebo/Anti-Fraud-System](https://github.com/stiebo/Anti-Fraud-System)\n\nCheck out my Github profile: [https://github.com/stiebo](https://github.com/stiebo)\n\nLink to the learning project: [https://hyperskill.org/projects/232](https://hyperskill.org/projects/232)\n\nCheck out my learning profile: [https://hyperskill.org/profile/500961738](https://hyperskill.org/profile/500961738)\n\n## Key Components of the Anti-Fraud System\n\n1. **Role-Based Access Control**:\n\n    - **User Roles**: The system defines specific roles, including **Administrator**, **Merchant**, and **Support**.\n\n    - **Permissions**:\n\n        - **Administrator**: Manages user roles and access rights.\n\n        - **Merchant**: Submits transactions for validation.\n\n        - **Support**: Reviews and provides feedback on transactions.\n\n    - This structure ensures that users have access only to functionalities pertinent to their roles, enhancing security and operational efficiency.\n\n\n2. **RESTful API Endpoints**:\n\n    - The system offers a set of REST endpoints for user interactions and transaction management:\n\n        - **User Management**: Endpoints for registering users, assigning roles, and managing access.\n\n        - **Transaction Processing**: Endpoints for submitting transactions and retrieving their statuses.\n\n        - **Feedback Mechanism**: Allows fraud analysts to provide feedback on transaction validations.\n\n    - These endpoints facilitate seamless communication between clients and the server, adhering to REST principles.\n\n\n3. **Transaction Validation with Heuristic Rules**:\n\n    - The system employs heuristic rules to assess transactions:\n\n        - **Amount-Based Validation**: Transactions are categorized as ALLOWED, MANUAL_PROCESSING, or PROHIBITED based on their amounts.\n\n        - **IP and Card Monitoring**: Identifies and blocks transactions from suspicious IP addresses or using stolen card numbers.\n\n        - **Regional Analysis**: Evaluates transactions based on geographic regions to detect anomalies.\n\n    - These rules help in identifying potentially fraudulent activities by analyzing transaction patterns and attributes.\n\n\n4. **Feedback Mechanism**:\n\n    - Support users (Fraud analysts) can provide feedback on transaction validations, indicating whether a transaction was correctly categorized.\n\n    - The system adjusts its heuristic thresholds based on this feedback, improving its accuracy over time.\n\n    - This adaptive approach ensures the system evolves with changing fraud patterns and reduces false positives or negatives.\n\n\n5. **Authentication and Authorization**:\n\n    - Utilizes Spring Security to implement authentication and authorization mechanisms.\n\n    - Ensures that only authenticated users can access the system, with permissions tailored to their roles.\n\n    - This setup protects sensitive operations and data from unauthorized access.\n\n\n6. **Data Persistence**:\n\n    - Employs Spring Data JPA for database interactions, managing user information, transaction records, and feedback data.\n\n    - Ensures data integrity and supports efficient querying and storage operations.\n\n## Tests\nIntegration tests were performed as part of the Hyperskill project with 150+ tests passed. See https://hyperskill.org/projects/232\n\n## Users, Roles and Authorization\n\nOur service supports the following roles:\n\n| Endpoint / Role                               | Anonymous | MERCHANT | ADMINISTRATOR | SUPPORT |\n|-----------------------------------------------|-----------|----------|---------------|---------|\n| POST /api/antifraud/transaction               | -         | +        | -             | -       |\n| POST /api/auth/user                           | +         | +        | +             | +       |\n| GET /api/auth/list                            | -         | -        | +             | +       |\n| DELETE /api/auth/user                         | -         | -        | +             | -       |\n| PUT /api/auth/access                          | -         | -        | +             | -       |\n| PUT /api/auth/role                            | -         | -        | +             | -       |\n| POST, DELETE, GET api/antifraud/suspicious-ip | -         | -        | -             | +       |\n| POST, DELETE, GET api/antifraud/stolencard    | -         | -        | -             | +       |\n| GET /api/antifraud/history                    | -         | -        | -             | +       |\n| PUT /api/antifraud/transaction                | -         | -        | -             | +       |\n\nThe service requires Http Basic authentication for all endpoints except for user signup.\nUsers can sign up themselves via *POST /api/auth/user*. The Administrator is the user who registered first, all subsequent registrations automatically receive the MERCHANT role and their account is locked by default. Users can be unlocked and roles changed by the Administrator (see below).\n\n## Transaction validation\nAs the central entry point to the API, transactions can be posted by customers (merchants).\n\nTransactions are checked based on\n1. Transaction amount:\n- Transactions with a sum of lower or equal to \u003callowed-threshold\u003e are ALLOWED (default threshold: 200)\n- Transactions with a sum of greater than 200 but lower or equal than \u003cmanual_processing-threshold\u003e require MANUAL_PROCESSING (default threshold: 1500)\n- Transactions with a sum of greater than \u003cmanual_processing-threshold\u003e are PROHIBITED.\n2. Stolen cards (checked also using the Luhn algorithm) are PROHIBITED\n3. Suspicious IP Addresses (must be valid IPv4 address) are PROHIBITED\n4. unique regions and IP addresses (correlation):\n- Transaction is PROHIBITED if there are transactions with the same number within the last hour from more than 2 regions or more than 2 unique IP addresses of the world other than the region or IP address of the transaction that is currently being verified;\n- Transaction is sent for MANUAL_PROCESSING if there are transactions with the same number within the last hour from 2 regions or 2 unique IP addresses of the world other than the region or IP address of the transaction that is currently being verified;\n\nPossible regions (Code, Description):\n- EAP\tEast Asia and Pacific\n- ECA\tEurope and Central Asia\n- HIC\tHigh-Income countries\n- LAC\tLatin America and the Caribbean\n- MENA  The Middle East and North Africa\n- SA\tSouth Asia\n- SSA\tSub-Saharan Africa\n\n## Threshold adjustment\nFraud analysts provide feedback on transaction validations, indicating whether a transaction was correctly categorized.\nThe system then adjusts its heuristic thresholds based on this feedback, improving its accuracy over time:\n\n| Transaction Validity / Feedback | ALLOWED                 | MANUAL_PROCESSING                  | PROHIBITED                    |\n|---------------------------------|-------------------------|------------------------------------|-------------------------------|\n| ALLOWED                         | exception               | decrease `\u003callowed-threshold\u003e`     | decrease `\u003callowed-threshold\u003e` |\n| MANUAL_PROCESSING               | increase `\u003callowed-threshold\u003e` | exception                        | decrease `\u003cmanual-threshold\u003e`  |\n| PROHIBITED                      | increase `\u003callowed-threshold\u003e` | increase `\u003cmanual-threshold\u003e`    | exception                      |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstiebo%2Fopenapi-generator-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstiebo%2Fopenapi-generator-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstiebo%2Fopenapi-generator-sample/lists"}