Skip to content

Commit feaec24

Browse files
authored
Merge pull request #46 from Zenfulcode/development
Development
2 parents 8f60dfa + 26de45f commit feaec24

15 files changed

Lines changed: 3412 additions & 1023 deletions

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Push Docker Image to GHCR
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+
tags: |
35+
type=ref,event=tag
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=semver,pattern={{major}}
39+
type=raw,value=latest,enable={{is_default_branch}}
40+
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
44+
- name: Build and push Docker image
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: .
48+
push: true
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}
51+
platforms: linux/amd64,linux/arm64
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max

docs/API_ENDPOINTS_SUMMARY.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# API Endpoints Summary
2+
3+
This document provides a quick overview of all available API endpoints in the Commercify system.
4+
5+
## Base URL
6+
7+
```
8+
/api
9+
```
10+
11+
## Public Endpoints
12+
13+
### Health Check
14+
15+
- `GET /health` - Health check endpoint
16+
17+
### Authentication
18+
19+
- `POST /api/auth/register` - Register new user
20+
- `POST /api/auth/signin` - User login
21+
22+
### Products
23+
24+
- `GET /api/products/{productId}` - Get product by ID
25+
- `GET /api/products/search` - Search products
26+
27+
### Categories
28+
29+
- `GET /api/categories` - List all categories
30+
- `GET /api/categories/{id}` - Get category by ID
31+
- `GET /api/categories/{id}/children` - Get child categories
32+
33+
### Payment Providers
34+
35+
- `GET /api/payment/providers` - Get available payment providers
36+
37+
### Discounts
38+
39+
- `POST /api/discounts/validate` - Validate discount code
40+
41+
### Currencies
42+
43+
- `GET /api/currencies` - List enabled currencies
44+
- `GET /api/currencies/default` - Get default currency
45+
- `POST /api/currencies/convert` - Convert amount between currencies
46+
47+
### Shipping
48+
49+
- `POST /api/shipping/options` - Calculate shipping options
50+
51+
### Checkout (Guest)
52+
53+
- `GET /api/checkout` - Get current checkout
54+
- `POST /api/checkout/items` - Add item to checkout
55+
- `PUT /api/checkout/items/{sku}` - Update checkout item
56+
- `DELETE /api/checkout/items/{sku}` - Remove item from checkout
57+
- `DELETE /api/checkout` - Clear checkout
58+
- `PUT /api/checkout/shipping-address` - Set shipping address
59+
- `PUT /api/checkout/billing-address` - Set billing address
60+
- `PUT /api/checkout/customer-details` - Set customer details
61+
- `PUT /api/checkout/shipping-method` - Set shipping method
62+
- `PUT /api/checkout/currency` - Set checkout currency
63+
- `POST /api/checkout/discount` - Apply discount
64+
- `DELETE /api/checkout/discount` - Remove discount
65+
- `POST /api/checkout/complete` - Complete checkout
66+
67+
## Authenticated User Endpoints
68+
69+
### User Profile
70+
71+
- `GET /api/users/me` - Get user profile
72+
- `PUT /api/users/me` - Update user profile
73+
- `PUT /api/users/me/password` - Change password
74+
75+
### Orders
76+
77+
- `GET /api/orders` - List user orders
78+
- `GET /api/orders/{orderId}` - Get order by ID (also accessible via checkout session)
79+
80+
## Admin Endpoints
81+
82+
All admin endpoints require authentication and admin role.
83+
84+
### User Management
85+
86+
- `GET /api/admin/users` - List all users
87+
88+
### Order Management
89+
90+
- `GET /api/admin/orders` - List all orders
91+
- `PUT /api/admin/orders/{orderId}/status` - Update order status
92+
93+
### Checkout Management
94+
95+
- `GET /api/admin/checkouts` - List all checkouts
96+
- `GET /api/admin/checkouts/{checkoutId}` - Get checkout by ID
97+
- `DELETE /api/admin/checkouts/{checkoutId}` - Delete checkout
98+
99+
### Currency Management
100+
101+
- `GET /api/admin/currencies/all` - List all currencies
102+
- `POST /api/admin/currencies` - Create currency
103+
- `PUT /api/admin/currencies` - Update currency
104+
- `DELETE /api/admin/currencies` - Delete currency
105+
- `PUT /api/admin/currencies/default` - Set default currency
106+
107+
### Category Management
108+
109+
- `POST /api/admin/categories` - Create category
110+
- `PUT /api/admin/categories/{id}` - Update category
111+
- `DELETE /api/admin/categories/{id}` - Delete category
112+
113+
### Product Management
114+
115+
- `GET /api/admin/products` - List all products
116+
- `POST /api/admin/products` - Create product
117+
- `PUT /api/admin/products/{productId}` - Update product
118+
- `DELETE /api/admin/products/{productId}` - Delete product
119+
120+
### Product Variant Management
121+
122+
- `POST /api/admin/products/{productId}/variants` - Add product variant
123+
- `PUT /api/admin/products/{productId}/variants/{variantId}` - Update variant
124+
- `DELETE /api/admin/products/{productId}/variants/{variantId}` - Delete variant
125+
126+
### Shipping Management
127+
128+
- `POST /api/admin/shipping/methods` - Create shipping method
129+
- `POST /api/admin/shipping/zones` - Create shipping zone
130+
- `POST /api/admin/shipping/rates` - Create shipping rate
131+
- `POST /api/admin/shipping/rates/weight` - Create weight-based rate
132+
- `POST /api/admin/shipping/rates/value` - Create value-based rate
133+
134+
### Discount Management
135+
136+
- `POST /api/admin/discounts` - Create discount
137+
- `GET /api/admin/discounts/{discountId}` - Get discount
138+
- `PUT /api/admin/discounts/{discountId}` - Update discount
139+
- `DELETE /api/admin/discounts/{discountId}` - Delete discount
140+
- `GET /api/admin/discounts` - List all discounts
141+
- `GET /api/admin/discounts/active` - List active discounts
142+
- `POST /api/admin/discounts/apply/{orderId}` - Apply discount to order
143+
- `DELETE /api/admin/discounts/remove/{orderId}` - Remove discount from order
144+
145+
### Payment Management
146+
147+
- `POST /api/admin/payments/{paymentId}/capture` - Capture payment
148+
- `POST /api/admin/payments/{paymentId}/cancel` - Cancel payment
149+
- `POST /api/admin/payments/{paymentId}/refund` - Refund payment
150+
- `POST /api/admin/payments/{paymentId}/force-approve` - Force approve MobilePay payment
151+
152+
### Payment Provider Management
153+
154+
- `GET /api/admin/payment-providers` - Get all payment providers
155+
- `GET /api/admin/payment-providers/enabled` - Get enabled providers
156+
- `PUT /api/admin/payment-providers/{providerType}/enable` - Enable/disable provider
157+
- `PUT /api/admin/payment-providers/{providerType}/configuration` - Update configuration
158+
- `POST /api/admin/payment-providers/{providerType}/webhook` - Register webhook
159+
- `DELETE /api/admin/payment-providers/{providerType}/webhook` - Delete webhook
160+
- `GET /api/admin/payment-providers/{providerType}/webhook` - Get webhook info
161+
162+
### Email Testing
163+
164+
- `POST /api/admin/test/email` - Send test email
165+
166+
## Webhook Endpoints
167+
168+
Server-to-server communication endpoints (no authentication required):
169+
170+
- `POST /api/webhooks/stripe` - Stripe webhook
171+
- `POST /api/webhooks/mobilepay` - MobilePay webhook
172+
173+
## Authentication
174+
175+
Most endpoints require authentication via JWT token in the Authorization header:
176+
177+
```
178+
Authorization: Bearer <your-jwt-token>
179+
```
180+
181+
## Permission Levels
182+
183+
1. **Public** - No authentication required
184+
2. **Authenticated** - Valid JWT token required
185+
3. **Admin** - JWT token with admin role required
186+
4. **Webhook** - Server-to-server, signature verification
187+
188+
## Status Codes
189+
190+
- `200 OK` - Request successful
191+
- `201 Created` - Resource created successfully
192+
- `400 Bad Request` - Invalid request data
193+
- `401 Unauthorized` - Authentication required
194+
- `403 Forbidden` - Insufficient permissions
195+
- `404 Not Found` - Resource not found
196+
- `409 Conflict` - Resource already exists or conflict
197+
- `500 Internal Server Error` - Server error

0 commit comments

Comments
 (0)