Cập nhật Subscription Package
# Subscription Packages API — Cập nhật gói (v1.0)
Đối tượng: Agency F1 (Parent) & Agency F10 (Child)
Trạng thái: Stable
Ngôn ngữ: VI
# 1. Tổng quan
# 1.1 Định nghĩa
Subscription Packages API cho phép các Agency update gói dịch vụ cụ thể dựa vào id trong hệ thống.
- F1 (Parent Agency): Cập nhật toàn bộ subscriptions.
agencyType = F1, parentAgencyId = null - Owner (người tạo): Chỉ cập nhật subscription do chính mình tạo
- F10 (Child Agency): Không được cập nhật (trừ khi là Owner).
# 2. Endpoint & Method
Method:
POST
# 3. Headers bắt buộc
| Header | Mô tả |
|---|---|
x-api-account | Tài khoản API của Agency F1 |
x-api-password | Mật khẩu API của Agency F1 |
x-api-token | Token API của Agency F1 |
# 4. Request Body
- Phải truyền
idcủa subscription cần cập nhật. - Các trường dịch vụ dạng
has...Accessbật lên sẽ yêu cầu gửi kèm giới hạn tương ứng (...Limit...).
# 4.1 Ví dụ (Request body)
{
"name": "Basic Travel Package",
"description": "Gói cơ bản cho các agency du lịch",
"avatarUrl": "https://example.com/avatar.jpg",
"coverUrl": "https://example.com/cover.jpg",
"price": 1000000,
"currency": "VND",
"billingCycle": "monthly",
"duration": 12,
"startsAt": "2024-01-01",
"expiresAt": "2024-12-31",
"bambooLimitSearch": 1000,
"bambooLimitHold": 100,
"bambooLimitIssues": 50,
"vietjetLimitSearch": 1000,
"vietjetLimitHold": 100,
"vietjetLimitIssues": 50,
"amadeusLimitSearch": 1000,
"amadeusLimitHold": 100,
"amadeusLimitIssues": 50,
"vnaLimitSearch": 1000,
"vnaLimitHold": 100,
"vnaLimitIssues": 50,
"sabreLimitSearch": 1000,
"sabreLimitHold": 100,
"sabreLimitIssues": 50,
"amadeusRestLimitSearch": 1000,
"amadeusRestLimitHold": 100,
"amadeusRestLimitIssues": 50,
"hasAmadeusAccess": true,
"hasAmadeusRestAccess": true,
"hasVietnamAirlineAccess": true,
"hasSabreAccess": false,
"hasBambooAirwaysAccess": false,
"hasVietjetAirAccess": false,
"hasTourAccess": false,
"hasEsimAccess": false,
"hasHotelAccess": false,
"hasAttractionAccess": false,
"tourLimitSearch": 100,
"tourLimitBooking": 50,
"esimLimitSearch": 200,
"esimLimitActivation": 100,
"hotelLimitSearch": 500,
"hotelLimitBooking": 100,
"attractionLimitSearch": 300,
"attractionLimitBooking": 80,
"hasPrioritySupport": false,
"hasAdvancedAnalytics": false,
"hasCustomBranding": false,
"hasMultiUserAccess": false,
"maxUsers": 1,
"features": "[\"Flight Search\", \"Booking\", \"Ticketing\"]",
"terms": "Điều khoản sử dụng gói Basic",
"notes": "Gói dành cho agency mới",
"subscribedAgencies": [],
"id": "uuid-string",
"status": "active"
}
# 4.2 Trường quan trọng
| Trường | Type | Bắt buộc | Mô tả |
|---|---|---|---|
id | string | Yes | ID subscription cần cập nhật |
name | string | Yes | Tên gói |
price | number | Yes | Giá gói |
currency | string | No | Đơn vị tiền tệ |
billingCycle | string | Yes | monthly/quarterly/yearly/one_time |
duration | number | No | Thời hạn theo chu kỳ |
startsAt | string | Yes | YYYY-MM-DD |
expiresAt | string | Yes | YYYY-MM-DD |
has...Access | boolean | No | Bật quyền dịch vụ (nên gửi kèm ...Limit...) |
...Limit... | number | No | Giới hạn khi quyền dịch vụ tương ứng bật |
status | string | No | Trạng thái gói |
subscribedAgencies | array | Yes | Danh sách agency cần sửa |
maxUsers | number | No | Số người dùng tối đa |
terms | string | No | Điều khoản sử dụng |
notes | string | No | Ghi chú |
features | string | No | Danh sách tính năng (JSON string) |
hasPrioritySupport | boolean | No | Quyền truy cập Priority Support |
hasAdvancedAnalytics | boolean | No | Quyền truy cập Advanced Analytics |
hasCustomBranding | boolean | No | Quyền truy cập Custom Branding |
hasMultiUserAccess | boolean | No | Quyền truy cập Multi User Access |
# 5. Response
# 5.1 Ví dụ (Response)
{
"id": "string",
"name": "string",
"description": "string",
"avatarUrl": "string",
"coverUrl": "string",
"price": 0,
"currency": "string",
"billingCycle": "monthly",
"duration": 0,
"startsAt": "2025-09-22T09:52:24.431Z",
"expiresAt": "2025-09-22T09:52:24.431Z",
"status": "active",
"agencyName": "string",
"remainingDays": 0,
"isActive": true,
"agencyId": "string",
"activeSubscribersCount": 5,
"activeSubscribers": ["agency1", "agency2", "agency3"],
"createdAt": "2025-09-22T09:52:24.431Z",
"updatedAt": "2025-09-22T09:52:24.431Z",
"hasAmadeusAccess": true,
"hasAmadeusRestAccess": true,
"hasVietnamAirlineAccess": true,
"hasSabreAccess": true,
"hasBambooAirwaysAccess": true,
"hasVietjetAirAccess": true,
"hasTourAccess": true,
"hasEsimAccess": true,
"hasHotelAccess": true,
"hasAttractionAccess": true,
"tourLimitSearch": 0,
"tourLimitBooking": 0,
"esimLimitSearch": 0,
"esimLimitActivation": 0,
"hotelLimitSearch": 0,
"hotelLimitBooking": 0,
"attractionLimitSearch": 0,
"attractionLimitBooking": 0,
"bambooLimitSearch": 0,
"bambooLimitHold": 0,
"bambooLimitIssues": 0,
"vietjetLimitSearch": 0,
"vietjetLimitHold": 0,
"vietjetLimitIssues": 0,
"amadeusRestLimitSearch": 0,
"amadeusRestLimitHold": 0,
"amadeusRestLimitIssues": 0,
"maxUsers": 0,
"subscribedAgencies": [],
"terms": "string",
"notes": "string",
"features": "[\"Flight Search\", \"Booking\", \"Ticketing\"]",
"hasPrioritySupport": true,
"hasAdvancedAnalytics": true,
"hasCustomBranding": true,
"hasMultiUserAccess": true
}
# 5.2 Mã phản hồi
| HTTP | Mô tả |
|---|---|
| 200 | Subscription package được cập nhật thành công |
| 400 | Dữ liệu không hợp lệ |
| 401 | Không có quyền cập nhật subscription |
| 403 | Chỉ F1 agency mới có quyền cập nhật subscription |
| 404 | Không tìm thấy subscription |
| 409 | Tên subscription đã tồn tại |
| 500 | Lỗi hệ thống |
Last Updated: 9/24/2025, 10:14:36 AM
← Danh sách Subscription Packages Bật/tắt Subscription Package→