Venmo is a mobile payment service which allows friends to transfer money to each other. It also has some social features like show your friend's payment activities as feed.
This project follows the community best practices in terms of standards, security and maintainability, integrating a variety of testing and code quality tools
- Ruby version 2.7.1
- Clone this repo
- Install PostgreSQL in case you don't have it
- Create your
database.ymlandapplication.ymlfile bundle installrake db:createrake db:migraterake db:seedrspecand make sure all tests passrails s- You can now try your REST services!
With rake code_analysis you can run the code analysis tool, you can omit rules with:
- Rubocop Edit
.rubocop.yml - Reek Edit
config.reek - Rails Best Practices Edit
config/rails_best_practices.yml - Bullet You can add exceptions to a bullet initializer or in the controller
-
Users: represents a user in the system
-
PaymentAccount: represents an account of a User where the balance is stored
-
Payment: represents an event of a user transfering money to a friend
-
Firendship: represents a friendship relationship between two users
-
FeedService: Is in charge of fetching the feed for a specific user.
-
FriendshipService: Is in charge of finding friends up to second degree of a specific user.
-
PaymentAccountService: Is in charge of increase or decrease an account balance
-
PaymentService: It handles the payment transcation
-
MoneyTransferService: Is in charge of transfer money from an external source to an account (mock service)
- Namespaces
api/v1, in routes, were added to handle different versions of the application. - When a User is created, a PaymentAccount is created and associated to the User.
- If a User stop being friend with another User, User will not see previous payments of the another User in the feed section.
GET balance
GET /api/v1/user/{id}/balance
Returns user's balance
Response example:
{
"user": {
"balance": 7000.0
}
}
GET feed
GET /api/v1/user/{id}/feed
Returns user's feed. A page parameter is optional
Response example:
{
"payments": [
{
"id": 9,
"message": "Cavani paid Rashford on February 05, 2021 - bet"
},
{
"id": 4,
"message": "Martial paid Henderson on February 03, 2021 - Supermarket"
}
],
"pagy": {
"page": 1,
"last": 1,
"pages": 1,
}
}
POST payment
POST /api/v1/user/{id}/payment
Creates a payment
Parameters:
- friend_id (integer) friend user id
- amount (float) payment amount
- description (text) payment description
Body example:
{
"friend_id": "1",
"amount": "10",
"description": "bet"
}
If the payment was created successfuly, returns 200 status code
The app is deployed in Heroku. Check it out on this link: https://venmo-api.herokuapp.com/api/v1
Seeds schema was loaded.
You can get Postman collection here
Run rake db:seed to load the following inital friendships
Creates the following payments
Sender: Cavani
Receiver: Rashford
Amount: 100
Description: 'Car'
Sender: Cavani
Receiver: Fred
Amount: 5
Description: 'Dinner'
Sender: Fred
Receiver: Martial
Amount: 10
Description: 'Vacation'
Sender: Martial
Receiver: Henderson
Amount: 150
Description: 'Supermarket'
Sender: Henderson
Receiver: Xisco
Amount: 40
Description: 'Day out'
Sender: Damiani
Receiver: Ruglio
Amount: 5
Description: 'Dinner'
And updates the following balances
Cavani: 7000
Fred: 20
Martial: 500
Damiani: 10
Ruglio: 120
This branch is the main one because it reflects the work done by the whole team during the development phase in a project. It is used as the base branch until the app is released to production.
This branch’s purpose is to develop a new feature. It has all the progress until the functionality being developed is completed. Pull requests are created from these type of branches and once they have passed the code review process, they have to be merged to develop.
This branch is created in order to fix a bug during development phase.
This branch is created to add an enhancement during development phase on something that was already merged to the development branch.
It reflects the current code deployed in production, therefore, it must be stable. All the new features to be developed are going to have as origin develop and they are going to be merged to master once they are working as expected and approved.

