{"id":15731750,"url":"https://github.com/sofiacordoba/walletapi","last_synced_at":"2026-02-23T04:06:09.096Z","repository":{"id":256957381,"uuid":"856914322","full_name":"sofiacordoba/WalletAPI","owner":"sofiacordoba","description":"A .NET Core 6 API for managing wallets and processing wallet-to-wallet transfers. Implements RESTful endpoints with validation, supports filters for listing wallets, and ensures transaction integrity. Includes unit and integration tests, with coverage reports. Key technologies: C#, Entity Framework Core, AutoMapper, xUnit, Swagger, InMemoryDatabase","archived":false,"fork":false,"pushed_at":"2024-09-13T14:27:34.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T18:24:43.359Z","etag":null,"topics":["api","cleanarchitecture","coverlet","csharp","entityframeworkcore","net","rest","unittesting","xunit"],"latest_commit_sha":null,"homepage":"","language":"C#","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/sofiacordoba.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}},"created_at":"2024-09-13T12:57:36.000Z","updated_at":"2024-09-13T14:50:30.000Z","dependencies_parsed_at":"2024-09-14T04:38:14.134Z","dependency_job_id":null,"html_url":"https://github.com/sofiacordoba/WalletAPI","commit_stats":null,"previous_names":["sofiacordoba/walletapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofiacordoba%2FWalletAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofiacordoba%2FWalletAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofiacordoba%2FWalletAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofiacordoba%2FWalletAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofiacordoba","download_url":"https://codeload.github.com/sofiacordoba/WalletAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243341406,"owners_count":20275866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","cleanarchitecture","coverlet","csharp","entityframeworkcore","net","rest","unittesting","xunit"],"created_at":"2024-10-04T00:05:01.870Z","updated_at":"2025-10-18T15:34:16.475Z","avatar_url":"https://github.com/sofiacordoba.png","language":"C#","readme":"# Wallet API Documentation\n\n**Author:** Sofia Cordoba  \n**Date:** September 2024  \n**Version:** 1.0  \n\n## Table of Contents\n\n1. [Introduction](#introduction)\n2. [Project Structure](#project-structure)\n3. [Requirements](#requirements)\n4. [Design Patterns](#design-patterns)\n5. [Data Flow](#data-flow)\n6. [API Endpoints](#api-endpoints)\n    - Create Wallet\n    - List Wallets\n    - Transfer\n    - Get Transactions\n7. [Validations](#validations)\n8. [Unit and Integration Tests](#unit-and-integration-tests)\n9. [Test Coverage](#test-coverage)\n10. [Technologies Used](#technologies-used)\n11. [Future Improvements](#future-improvements)\n\n---\n\n## 1. Introduction\n\nThis project is a Wallet API that allows account management and wallet-to-wallet transactions. It provides endpoints to create accounts, list wallets with optional filters, process transfers with validation, and retrieve transaction histories. The implementation adheres to Clean Architecture principles, ensuring maintainability, modularity, and robust automated testing.\n\n---\n\n## 2. Project Structure\n\nThe project is structured into multiple layers to maintain separation of concerns and allow scalability:\n\n/Kata.Wallet.Api\n- Controllers (WalletController.cs, TransactionController.cs)\n- Program.cs\n\n/Kata.Wallet.Services\n- Interfaces (IWalletService.cs, ITransactionService.cs)\n- Implementations (WalletService.cs, TransactionService.cs)\n\n/Kata.Wallet.Domain\n- Entities (Wallet.cs, Transaction.cs)\n\n/Kata.Wallet.Persistence\n- Repositories (WalletRepository.cs, TransactionRepository.cs)\n\n/Kata.Wallet.Tests\n- Unit and Integration Tests\n  Each layer has a specific responsibility and is decoupled from the others to promote scalability and easy maintenance.\n\n---\n\n## 3. Requirements\n\n- **Framework:** .NET Core 6.0  \n- **ORM:** Entity Framework Core (with in-memory database for testing)  \n- **Language:** C#  \n- **Testing Framework:** xUnit  \n- **Additional Tools:** AutoMapper, Swagger, InMemoryDatabase  \n\n---\n\n## 4. Design Patterns\n\nThe project uses the following design patterns:\n- **Repository Pattern:** For data access and database operations.\n- **Service Layer Pattern:** To encapsulate business logic and orchestrate interactions between repositories and controllers.\n- **Dependency Injection:** For injecting services and repositories into controllers and other components.\n- **DTOs (Data Transfer Objects):** To transfer data between layers without exposing domain entities directly.\n\n---\n\n## 5. Data Flow\n\nThe flow of data through the system is as follows:\n\n1. **API Request:** A request is made to an endpoint (e.g., create a wallet or make a transfer).\n2. **Controller Layer:** The controller processes the request and calls the appropriate service.\n3. **Service Layer:** The service validates the request, performs business logic, and interacts with repositories for data access.\n4. **Repository Layer:** The repository accesses the database (or in-memory database for testing) to perform CRUD operations.\n5. **Response:** The service returns the result to the controller, which then sends the response back to the client.\n\n---\n\n## 6. API Endpoints\n\n### Create Wallet\n**POST /api/wallet**\n\nThis endpoint creates a new wallet.\n\n### List Wallets\n**GET /api/wallet**\n\nThis endpoint retrieves a list of wallets with optional filters for currency and user document.\n\n### Transfer\n**POST /api/transaction/transfer**\n\nThis endpoint processes a wallet-to-wallet transfer.\n\n### Get Transactions\n**GET /api/transaction/{walletId}/transactions**\n\nThis endpoint retrieves transaction history for a specific wallet.\n\n---\n\n## 7. Validations\n\nThe API implements the following validations:\n- **Balance Validation:** Ensures that transfers are only processed if the source wallet has sufficient balance.\n- **Currency Validation:** Transfers are only allowed between wallets that share the same currency.\n- **Amount Validation:** Transfers must have a positive amount greater than zero.\n\n---\n\n## 8. Unit and Integration Tests\n\nThe project includes both unit tests and integration tests to ensure the correctness of the API:\n\n- **Unit Tests:** Test individual components such as services and repositories in isolation.\n- **Integration Tests:** Test the interaction between multiple components (e.g., controllers, services, repositories).\n\n---\n\n## 9. Test Coverage\n\nCoverage results for the project:\n\n| Module                  | Line   | Branch | Method |\n|-------------------------|--------|--------|--------|\n| Kata.Wallet.Api         | 70.22% | 58.33% | 87.5%  |\n| Kata.Wallet.Database    | 100%   | 100%   | 100%   |\n| Kata.Wallet.Domain      | 76.92% | 100%   | 76.92% |\n| Kata.Wallet.Dtos        | 55%    | 0%     | 78.57% |\n| Kata.Wallet.Persistence | 0%     | 0%     | 0%     |\n| Kata.Wallet.Services    | 87.87% | 70.83% | 85.71% |\n| **Total**               | 64.5%  | 50%    | 69.64% |\n\n---\n\n## 10. Technologies Used\n\n- **ASP.NET Core 6.0:** For building the RESTful API.\n- **Entity Framework Core:** For data access and ORM.\n- **AutoMapper:** For mapping between entities and DTOs.\n- **xUnit:** For unit and integration testing.\n- **Coverlet:** For measuring code coverage.\n- **Swagger:** For API documentation and testing.\n\n---\n\n## 11. Future Improvements\n\nPossible future improvements to the Wallet API:\n- **Logging Enhancements:** Integrate more advanced logging mechanisms for better traceability.\n- **Additional Validations:** Add more robust input validations, such as checking for duplicate wallets.\n- **Optimizations:** Refactor services for improved performance in high-volume environments.\n- **Authentication and Authorization:** Implement user authentication and role-based access control.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofiacordoba%2Fwalletapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofiacordoba%2Fwalletapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofiacordoba%2Fwalletapi/lists"}