api
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Fastcheck Backend — требования к серверу
|
# Fastcheck Backend — требования к серверу
|
||||||
|
|
||||||
Документ для команды бэкенда. Описывает, что должен реализовать сервер `api.fastcheck.store`, чтобы веб-фронт (этот репозиторий) полностью заработал.
|
Документ для команды бэкенда. Описывает, что должен реализовать сервер `fastcheck.store/api`, чтобы веб-фронт (этот репозиторий) полностью заработал.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
### 1.1 Транспорт
|
### 1.1 Транспорт
|
||||||
- **Протокол**: HTTPS обязателен (валидный TLS-сертификат, Let's Encrypt или иной).
|
- **Протокол**: HTTPS обязателен (валидный TLS-сертификат, Let's Encrypt или иной).
|
||||||
- **Хост**: `api.fastcheck.store` (или другой — тогда поправить `FASTCHECK_API` в `src/app/api.ts`).
|
- **Хост**: `fastcheck.store/api` (или другой — тогда поправить `FASTCHECK_API` в `src/app/api.ts`).
|
||||||
- **Формат тел запроса/ответа**: `application/json; charset=utf-8`.
|
- **Формат тел запроса/ответа**: `application/json; charset=utf-8`.
|
||||||
|
|
||||||
### 1.2 CORS — **критично**
|
### 1.2 CORS — **критично**
|
||||||
@@ -44,7 +44,7 @@ Authorization: {"sessionID":"1AF3781BF6B94604B771AEA1D44FA63A"}
|
|||||||
|
|
||||||
## 2. Эндпоинты
|
## 2. Эндпоинты
|
||||||
|
|
||||||
База: `https://api.fastcheck.store`
|
База: `https://fastcheck.store/api`
|
||||||
|
|
||||||
### 2.1 `GET /ping`
|
### 2.1 `GET /ping`
|
||||||
Healthcheck. Ответ: `200 { "message": "pong" }`. Без авторизации.
|
Healthcheck. Ответ: `200 { "message": "pong" }`. Без авторизации.
|
||||||
@@ -192,7 +192,7 @@ Logout / закрытие попапа.
|
|||||||
|
|
||||||
## 4. Чеклист «готово к проду»
|
## 4. Чеклист «готово к проду»
|
||||||
|
|
||||||
- [ ] HTTPS с валидным сертификатом на `api.fastcheck.store`.
|
- [ ] HTTPS с валидным сертификатом на `fastcheck.store/api`.
|
||||||
- [ ] CORS разрешает домен фронта на всех 6 эндпоинтах + OPTIONS.
|
- [ ] CORS разрешает домен фронта на всех 6 эндпоинтах + OPTIONS.
|
||||||
- [ ] `GET /ping` отвечает.
|
- [ ] `GET /ping` отвечает.
|
||||||
- [ ] Полный цикл: `GET /websession` → бот ставит `Status:true` → `GET /websession/:id` это видит.
|
- [ ] Полный цикл: `GET /websession` → бот ставит `Status:true` → `GET /websession/:id` это видит.
|
||||||
|
|||||||
@@ -137,11 +137,11 @@ Body:
|
|||||||
|
|
||||||
## 6. CORS + HTTPS + DNS (блокер)
|
## 6. CORS + HTTPS + DNS (блокер)
|
||||||
|
|
||||||
Сейчас `https://api.fastcheck.store` даёт `ERR_NAME_NOT_RESOLVED` —
|
Сейчас `https://fastcheck.store/api` даёт `ERR_NAME_NOT_RESOLVED` —
|
||||||
домен не резолвится. Без этого тестировать нечего.
|
домен не резолвится. Без этого тестировать нечего.
|
||||||
|
|
||||||
Минимально:
|
Минимально:
|
||||||
- Поднять DNS A-запись на `api.fastcheck.store`.
|
- Поднять DNS A-запись на `fastcheck.store`.
|
||||||
- Валидный TLS-сертификат (Let's Encrypt подойдёт).
|
- Валидный TLS-сертификат (Let's Encrypt подойдёт).
|
||||||
- На все эндпоинты + `OPTIONS` отвечать заголовками:
|
- На все эндпоинты + `OPTIONS` отвечать заголовками:
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ npm run build # production-сборка
|
|||||||
|
|
||||||
Эндпоинты заданы в `src/app/api.ts`:
|
Эндпоинты заданы в `src/app/api.ts`:
|
||||||
|
|
||||||
- `FASTCHECK_API` — `https://api.fastcheck.store`
|
- `FASTCHECK_API` — `https://fastcheck.store/api`
|
||||||
- `QR_API` — `https://qr.vitanova.network:567/qr` (legacy, на текущих страницах не используется)
|
- `QR_API` — `https://qr.vitanova.network:567/qr` (legacy, на текущих страницах не используется)
|
||||||
|
|
||||||
Имя Telegram-бота — в `src/app/pages/fastcheck-page/fastcheck-page.ts` (поле `telegramBot`, сейчас `DexarSupport_bot`).
|
Имя Telegram-бота — в `src/app/pages/fastcheck-page/fastcheck-page.ts` (поле `telegramBot`, сейчас `DexarSupport_bot`).
|
||||||
@@ -104,7 +104,7 @@ RewriteRule . /index.html [L]
|
|||||||
|
|
||||||
## 5. CORS на backend
|
## 5. CORS на backend
|
||||||
|
|
||||||
`api.fastcheck.store` должен возвращать заголовки CORS, разрешающие домен фронта:
|
`fastcheck.store/api` должен возвращать заголовки CORS, разрешающие домен фронта:
|
||||||
|
|
||||||
```
|
```
|
||||||
Access-Control-Allow-Origin: https://pay.example.com
|
Access-Control-Allow-Origin: https://pay.example.com
|
||||||
@@ -149,5 +149,5 @@ EXPOSE 80
|
|||||||
|
|
||||||
1. Открой `https://pay.example.com/` — должна быть форма фастчека.
|
1. Открой `https://pay.example.com/` — должна быть форма фастчека.
|
||||||
2. Открой `https://pay.example.com/new` напрямую — должна открыться страница создания (не 404).
|
2. Открой `https://pay.example.com/new` напрямую — должна открыться страница создания (не 404).
|
||||||
3. В DevTools → Network проверь, что запросы к `https://api.fastcheck.store/...` идут без CORS-ошибок.
|
3. В DevTools → Network проверь, что запросы к `https://fastcheck.store/api/...` идут без CORS-ошибок.
|
||||||
4. Нажми «Оплатить» с заполненными полями — должен открыться popup с QR Telegram (`@DexarSupport_bot`).
|
4. Нажми «Оплатить» с заполненными полями — должен открыться popup с QR Telegram (`@DexarSupport_bot`).
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"/proxy/fastcheck": {
|
"/proxy/fastcheck-store": {
|
||||||
"target": "https://api.fastcheck.store",
|
"target": "https://fastcheck.store",
|
||||||
"secure": true,
|
"secure": true,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
"pathRewrite": { "^/proxy/fastcheck": "" },
|
"pathRewrite": { "^/proxy/fastcheck-store": "" },
|
||||||
"logLevel": "debug"
|
"logLevel": "debug"
|
||||||
},
|
},
|
||||||
"/proxy/qr-vitanova": {
|
"/proxy/qr-vitanova": {
|
||||||
@@ -12,12 +12,5 @@
|
|||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
"pathRewrite": { "^/proxy/qr-vitanova": "" },
|
"pathRewrite": { "^/proxy/qr-vitanova": "" },
|
||||||
"logLevel": "debug"
|
"logLevel": "debug"
|
||||||
},
|
|
||||||
"/proxy/fastcheck-store": {
|
|
||||||
"target": "https://fastcheck.store",
|
|
||||||
"secure": true,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"pathRewrite": { "^/proxy/fastcheck-store": "" },
|
|
||||||
"logLevel": "debug"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
eFastcheck.store
|
eFastcheck.store
|
||||||
General Information
|
General Information
|
||||||
Information exchange with the Fastcheck server is realized via RESTful API. All requests to the server must be executed via HTTPS using GET||POST||PUT||DELETE requests to the given ROOT address. Body of requests must be in JSON format. All not public requests must be signed by the client and the public key must be sent to the server for client identification and sign checking.
|
Information exchange with the Fastcheck server is realized via RESTful API. All requests to the server must be executed via HTTPS using GET||POST||PUT||DELETE requests to the given ROOT address. Body of requests must be in JSON format. All not public requests must be signed by the client and the public key must be sent to the server for client identification and sign checking.
|
||||||
|
|
||||||
@@ -6,9 +6,9 @@ Information exchange with the Fastcheck server is realized via RESTful API. All
|
|||||||
|
|
||||||
|
|
||||||
Check if server is available
|
Check if server is available
|
||||||
Client needs to periodically check if the server is available by sending “ping” to the client. On error corresponding message must be shown.
|
Client needs to periodically check if the server is available by sending “ping” to the client. On error corresponding message must be shown.
|
||||||
Protocol: https
|
Protocol: https
|
||||||
Root Path: api.Fastcheck.store
|
Root Path: fastcheck.store/api
|
||||||
Type GET
|
Type GET
|
||||||
Path /ping
|
Path /ping
|
||||||
Request Parameters:
|
Request Parameters:
|
||||||
@@ -26,7 +26,7 @@ ________________
|
|||||||
Create new websession
|
Create new websession
|
||||||
Creates a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr).
|
Creates a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr).
|
||||||
Protocol: https
|
Protocol: https
|
||||||
Root Path: api.Fastcheck.store
|
Root Path: fastcheck.store/api
|
||||||
Type GET
|
Type GET
|
||||||
Path /websession
|
Path /websession
|
||||||
Request Parameters:
|
Request Parameters:
|
||||||
@@ -36,7 +36,7 @@ Request Parameters:
|
|||||||
}
|
}
|
||||||
Response (OK):
|
Response (OK):
|
||||||
{
|
{
|
||||||
"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”
|
"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”
|
||||||
"userId" : "",
|
"userId" : "",
|
||||||
"expires" : "sessionId",
|
"expires" : "sessionId",
|
||||||
"userSessionId": "",
|
"userSessionId": "",
|
||||||
@@ -48,7 +48,7 @@ ________________
|
|||||||
Check websession status
|
Check websession status
|
||||||
Check if the user is already logged in. a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr).
|
Check if the user is already logged in. a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr).
|
||||||
Protocol: https
|
Protocol: https
|
||||||
Root Path: api.Fastcheck.store
|
Root Path: fastcheck.store/api
|
||||||
Type GET
|
Type GET
|
||||||
Path /websession/:webSessionID
|
Path /websession/:webSessionID
|
||||||
Request Parameters:
|
Request Parameters:
|
||||||
@@ -58,7 +58,7 @@ Request Parameters:
|
|||||||
}
|
}
|
||||||
Response (OK):
|
Response (OK):
|
||||||
{
|
{
|
||||||
"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”,
|
"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”,
|
||||||
"userId" : "kHaAe9roaC2uq63AKGE/8+Ti/t/iFro68QhEZ1dRGLo",
|
"userId" : "kHaAe9roaC2uq63AKGE/8+Ti/t/iFro68QhEZ1dRGLo",
|
||||||
"expires" : "sessionId",
|
"expires" : "sessionId",
|
||||||
"userSessionId": "8A94EFEFD003426A9B456C48CAC99BE6",
|
"userSessionId": "8A94EFEFD003426A9B456C48CAC99BE6",
|
||||||
@@ -68,12 +68,12 @@ ________________
|
|||||||
Delete websession status
|
Delete websession status
|
||||||
Delete the session to log out from the system.
|
Delete the session to log out from the system.
|
||||||
Protocol: https
|
Protocol: https
|
||||||
Root Path: api.Fastcheck.store
|
Root Path: fastcheck.store/api
|
||||||
Type DELETE
|
Type DELETE
|
||||||
Path /websession/:webSessionID
|
Path /websession/:webSessionID
|
||||||
Request Parameters:
|
Request Parameters:
|
||||||
{
|
{
|
||||||
"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”
|
"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”
|
||||||
}
|
}
|
||||||
Response (OK):
|
Response (OK):
|
||||||
{
|
{
|
||||||
@@ -84,14 +84,14 @@ ________________
|
|||||||
Check Fastcheck status
|
Check Fastcheck status
|
||||||
Check if fastcheck exists and get the amount assigned to check.
|
Check if fastcheck exists and get the amount assigned to check.
|
||||||
Protocol: https
|
Protocol: https
|
||||||
Root Path: api.Fastcheck.store
|
Root Path: fastcheck.store/api
|
||||||
Type GET
|
Type GET
|
||||||
Path /fastcheck
|
Path /fastcheck
|
||||||
|
|
||||||
|
|
||||||
Request Parameters:
|
Request Parameters:
|
||||||
{
|
{
|
||||||
"fastcheck": “1234-5678-0001”,
|
"fastcheck": “1234-5678-0001”,
|
||||||
}
|
}
|
||||||
Response (OK):
|
Response (OK):
|
||||||
{
|
{
|
||||||
@@ -103,7 +103,7 @@ ________________
|
|||||||
New Fastcheck
|
New Fastcheck
|
||||||
Create a fastcheck for a given amount. The Users must have a sufficient amount on the balance.
|
Create a fastcheck for a given amount. The Users must have a sufficient amount on the balance.
|
||||||
Protocol: https
|
Protocol: https
|
||||||
Root Path: api.Fastcheck.store
|
Root Path: fastcheck.store/api
|
||||||
Type POST
|
Type POST
|
||||||
Path /fastcheck
|
Path /fastcheck
|
||||||
HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"}
|
HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"}
|
||||||
@@ -123,7 +123,7 @@ ________________
|
|||||||
Accept Fastcheck
|
Accept Fastcheck
|
||||||
Accept fastcheck to the user balance.
|
Accept fastcheck to the user balance.
|
||||||
Protocol: https
|
Protocol: https
|
||||||
Root Path: api.Fastcheck.store
|
Root Path: fastcheck.store/api
|
||||||
Type POST
|
Type POST
|
||||||
Path /fastcheck
|
Path /fastcheck
|
||||||
HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"}
|
HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"}
|
||||||
|
|||||||
Reference in New Issue
Block a user