[6.2 Prototype] Transparent Payment Distribution - FEUP-MEIC-DS-2025-26/madeinportugal.store GitHub Wiki
Overview
The Transparent Payment Distribution feature aims to support the store's fair-trade positioning by making the financial journey of a customer's payment visible. The core feature is to display a cost breakdown for every product and order, showing exactly how the payment is split among all stakeholders: producers, logistics, taxes, and platform fees. Additionally, the seller will be able to edit the breakdown fields of their products, so they can better communicate the reasoning behind their price.
This feature relates to issues #112 and #273.
Repository: https://github.com/FEUP-MEIC-DS-2025-26/prototype-transparent-payment-distribution
Features
-
Product Cost Breakdown: From the buyer's perspective, each product displays a pricing breakdown divided by categories. The breakdown includes a pie chart and a percentage for each category. This breakdown can be included in pages such as the product page, the shopping cart, and the order history.
-
Edit Breakdown: This feature is oriented for sellers, and allows them to customize the breakdown fields of their products, except for those outside of their control, such as taxes and the platform fee. It's intended to be used in the product configuration page, when submitting a product to the store.
Technologies and Development Tools
This service is being built with the following technologies:
- Rust for the backend and middleware.
- React for the frontend.
- gRPC requests -> currently migrating to Google Pub Sub
- Docker for containerization for production environments.
- Google Cloud Platform for hosting.
- Terraform for infrastructure management and provisioning.
Architecture
Middleware
The middleware was designed to communicate with the web frontend using RESTful HTTP requests. So far the available routes are:
GET '/api/price/{id}' -> returns a JSON response with the price breakdown of item with specified id.
POST '/api/price' -> Upon receiving a valid JSON POST request, stores the item
Request format for POST:
curl -X POST http://localhost:3001/api/price \
-H "Content-Type: application/json" \
-d '{
"item_id": "item_3",
"seller_id": "seller_3",
"item_name": "ceramic mug",
"total_price": 3,"expenses": [
{ "type": "materials", "amount": 3 }
]
}'
Backend
The backend communicates with the middleware and possibly with other microservice backends using gRPC. It specifies the following prototype:
syntax = "proto3";
package price;
import "google/protobuf/timestamp.proto";
enum StorageStatus {
STORAGE_OK = 0;
STORAGE_ERROR = 1;
}
message Expense {
string type = 1;
double amount = 2;
}
message PriceBreakdownStorageRequest {
string item_id = 1;
string seller_id = 2;
string item_name = 3;
double total_price = 4;
repeated Expense expenses = 5;
google.protobuf.Timestamp created_at = 6;
}
message PriceBreakdownStorageResponse {
StorageStatus status = 1;
string message = 2;
}
message PriceBreakdownRequest {
string item_id = 1;
}
message PriceBreakdownResponse {
string item_id = 1;
string seller_id = 2;
string item_name = 3;
double total_price = 4;
repeated Expense expenses = 5;
}
service PriceService {
rpc GetPriceBreakdown (PriceBreakdownRequest)
returns (PriceBreakdownResponse);
rpc StorePriceBreakdown (PriceBreakdownStorageRequest)
returns (PriceBreakdownStorageResponse);
}
It is responsible for any computation involving the data and actual interaction with the lightweight DB.
Additional information
Group: 62
Members:
- Bianca Oliveira (up202000139)
- Diogo Maria Santos Venade (up202207805)
- Ismael Medeiros Moniz (up202206871)
- Rodrigo Pinto Pesqueira Gaspar Pombo (up202105374)
- Vasco Monteiro Costa (up202109923)