Merchant Service .NET 10
Service for managing Merchants (Shop Owners), Shops, and Merchant Staff for the GoodGo ecosystem.
Overview
Merchant Service provides management capabilities for:
- Merchant Management - Registration, verification, merchant (shop owner) management
- Shop Management - Create and manage stores (Online, Physical, Hybrid)
- Staff Management - Employee management, permissions for POS System
- Branch Management - Shop branch/location management
- POS Authentication - PIN authentication for POS devices
- Multi-category Support - Support for multiple business categories
Requirements
| Requirement |
Version |
| .NET SDK |
10.0.101+ |
| Docker |
24.0+ |
| PostgreSQL |
15+ |
Quick Start
Run with Docker
Run Local
Database Migrations
Requirements
Create Migration
Apply Migration
API Endpoints
Merchant Endpoints (/api/v1/merchants)
| Method |
Endpoint |
Description |
Auth |
POST |
/api/v1/merchants/register |
Register as a Merchant |
✅ User |
GET |
/api/v1/merchants/me |
Get current Merchant info |
✅ Merchant |
PUT |
/api/v1/merchants/me |
Update Merchant info |
✅ Merchant |
POST |
/api/v1/merchants/me/verify |
Submit verification documents |
✅ Merchant |
Shop Endpoints (/api/v1/shops)
| Method |
Endpoint |
Description |
Auth |
GET |
/api/v1/shops |
List Merchant's shops |
✅ Merchant |
POST |
/api/v1/shops |
Create new shop |
✅ Merchant |
GET |
/api/v1/shops/{id} |
Get shop by ID |
✅ Merchant |
PUT |
/api/v1/shops/{id} |
Update shop |
✅ Merchant |
DELETE |
/api/v1/shops/{id} |
Close shop |
✅ Merchant |
POST |
/api/v1/shops/{id}/publish |
Publish shop (visible to customers) |
✅ Merchant |
POST |
/api/v1/shops/{id}/deactivate |
Set shop inactive |
✅ Merchant |
GET |
/api/v1/shops/slug/{slug} |
Get shop by slug (public) |
❌ |
Shop Branch Endpoints
| Method |
Endpoint |
Description |
Auth |
GET |
/api/v1/shops/{shopId}/branches |
List branches |
✅ |
POST |
/api/v1/shops/{shopId}/branches |
Create new branch |
✅ Merchant |
PUT |
/api/v1/shops/{shopId}/branches/{id} |
Update branch |
✅ Merchant |
DELETE |
/api/v1/shops/{shopId}/branches/{id} |
Delete branch |
✅ Merchant |
GET |
/api/v1/shops/nearby |
Find nearby shops |
❌ |
Merchant Staff Endpoints
| Method |
Endpoint |
Description |
Auth |
GET |
/api/v1/merchants/me/staff |
List staff |
✅ Merchant |
POST |
/api/v1/merchants/me/staff/invite |
Invite staff |
✅ Merchant |
PUT |
/api/v1/merchants/me/staff/{id} |
Update staff |
✅ Merchant |
DELETE |
/api/v1/merchants/me/staff/{id} |
Remove staff |
✅ Merchant |
POST |
/api/v1/staff/accept-invite |
Accept invitation |
✅ User |
POS Endpoints (/api/v1/pos)
| Method |
Endpoint |
Description |
Auth |
POST |
/api/v1/pos/auth/pin |
POS login with PIN |
✅ Staff |
POST |
/api/v1/pos/devices/register |
Register POS device |
✅ Staff |
GET |
/api/v1/pos/me |
Get current Staff info |
✅ Staff |
Admin Merchant Endpoints (/api/v1/admin/merchants)
| Method |
Endpoint |
Description |
Auth |
GET |
/api/v1/admin/merchants |
List all merchants (paginated) |
✅ Admin |
GET |
/api/v1/admin/merchants/statistics |
Merchant statistics |
✅ Admin |
GET |
/api/v1/admin/merchants/{id} |
Merchant details |
✅ Admin |
POST |
/api/v1/admin/merchants/{id}/approve |
Approve merchant |
✅ Admin |
POST |
/api/v1/admin/merchants/{id}/reject |
Reject merchant |
✅ Admin |
POST |
/api/v1/admin/merchants/{id}/suspend |
Suspend merchant |
✅ Admin |
POST |
/api/v1/admin/merchants/{id}/reactivate |
Reactivate merchant |
✅ Admin |
POST |
/api/v1/admin/merchants/{id}/ban |
Permanently ban merchant |
✅ Admin |
Admin Shop Endpoints (/api/v1/admin/shops)
| Method |
Endpoint |
Description |
Auth |
GET |
/api/v1/admin/shops |
List all shops (paginated) |
✅ Admin |
GET |
/api/v1/admin/shops/{id} |
Shop details |
✅ Admin |
POST |
/api/v1/admin/shops/{id}/suspend |
Suspend shop |
✅ Admin |
POST |
/api/v1/admin/shops/{id}/reactivate |
Reactivate shop |
✅ Admin |
POST |
/api/v1/admin/shops/{id}/close |
Permanently close shop |
✅ Admin |
Health Checks
| Endpoint |
Purpose |
/health |
Full health status |
/health/live |
Liveness check |
/health/ready |
Readiness check |
Merchant Registration Flow
Step 1: Register as Merchant
Response:
Step 2: Wait for Admin Approval
Admin will review and approve the merchant. After approval:
- Role
Merchant will be assigned to the user in IAM Service
- Status changes to
Active
Step 3: Create Shop
Step 4: Add Branch (For physical stores)
Step 5: Invite Staff
Configuration
Environment Variables
| Variable |
Description |
Default |
ASPNETCORE_ENVIRONMENT |
Environment |
Development |
DATABASE_URL |
PostgreSQL connection |
- |
Jwt__Authority |
IAM Service URL |
http://iam-service-net:8080 |
IamService__BaseUrl |
IAM Service base URL |
- |
WalletService__BaseUrl |
Wallet Service base URL |
- |
appsettings.json
Integration with Other Services
IAM Service
- Validate User token
- Assign Merchant/MerchantStaff roles
- Get Organization hierarchy
Wallet Service
- Merchant settlement
- Commission calculation
- Balance check
Membership Service
- Customer visit tracking → Add EXP
- Member level → Special discount at shop
Chat Service
- Shop support channel
- Staff-Customer conversation
Gift Voucher Service (Planned)
- Create voucher campaigns
- Voucher redemption at shop
Testing
Deployment
Docker Build
Kubernetes
See deployments/kubernetes/merchant-service.yaml
Swagger UI
After running the service, access Swagger UI at:
Resources