-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstakepass_openapi.yaml
More file actions
256 lines (256 loc) · 6.93 KB
/
Copy pathstakepass_openapi.yaml
File metadata and controls
256 lines (256 loc) · 6.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
openapi: 3.0.3
info:
title: StakePass API
version: 1.0.0
servers:
- url: https://api.stakepass.example.com
description: Production
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
oauth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://auth.stakepass.example.com/oauth/authorize
tokenUrl: https://auth.stakepass.example.com/oauth/token
scopes:
profile: 사용자 프로필 정보 접근
subscribe: 구독 API 접근 권한
schemas:
SubscribeRequest:
type: object
required: [userAddress, planId, amount]
properties:
userAddress: { type: string }
planId: { type: integer }
amount: { type: string }
SubscribeResponse:
type: object
required: [txHash, tokenId]
properties:
txHash: { type: string }
tokenId: { type: integer }
VerifyResponse:
type: object
required: [valid, expiry]
properties:
valid: { type: boolean }
expiry: { type: integer }
UnsubscribeRequest:
type: object
required: [userAddress, tokenId, amount]
properties:
userAddress: { type: string }
tokenId: { type: integer }
amount: { type: string }
UnsubscribeResponse:
type: object
required: [txHash]
properties:
txHash: { type: string }
PlanInfo:
type: object
required: [planId, amountRequired, duration, active]
properties:
planId: { type: integer }
amountRequired: { type: string }
duration: { type: integer }
active: { type: boolean }
QuoteRequest:
type: object
required: [serviceId, term]
properties:
serviceId: { type: string }
term: { type: integer, enum: [3,6,12] }
QuoteResponse:
type: object
required: [requiredDeposit, ltv, expiry]
properties:
requiredDeposit: { type: string }
ltv: { type: number, format: float }
expiry: { type: integer }
feeSchedule:
type: object
additionalProperties: { type: string }
RenewRequest:
type: object
required: [orderId]
properties:
orderId: { type: string }
RenewResponse:
type: object
required: [renewed, newExpiry]
properties:
renewed: { type: boolean }
newExpiry: { type: integer }
CancelEarlyRequest:
type: object
required: [orderId]
properties:
orderId: { type: string }
reason: { type: string }
CancelEarlyResponse:
type: object
required: [refundAmount, penalty]
properties:
refundAmount: { type: string }
penalty: { type: string }
security:
- bearerAuth: []
paths:
/api/subscribe:
post:
summary: 사용자 예치 및 구독 시작
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SubscribeRequest'
responses:
'200':
description: 성공
content:
application/json:
schema:
$ref: '#/components/schemas/SubscribeResponse'
/api/verify:
get:
summary: SBT 검증 및 서비스 접근 권한 확인
parameters:
- in: query
name: userAddress
required: true
schema: { type: string }
- in: query
name: tokenId
required: true
schema: { type: integer }
responses:
'200':
description: 검증 결과
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyResponse'
/api/unsubscribe:
post:
summary: 예치금 회수 및 구독 종료
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UnsubscribeRequest'
responses:
'200':
description: 성공
content:
application/json:
schema:
$ref: '#/components/schemas/UnsubscribeResponse'
/api/plans:
get:
summary: 구독 플랜 목록 조회
responses:
'200':
description: 플랜 배열
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/PlanInfo'
/api/quote:
post:
summary: 담보 견적 조회
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/QuoteRequest'
responses:
'200':
description: 견적
content:
application/json:
schema:
$ref: '#/components/schemas/QuoteResponse'
/api/renew:
post:
summary: 자동/수동 갱신 트리거
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RenewRequest'
responses:
'200':
description: 갱신 결과
content:
application/json:
schema:
$ref: '#/components/schemas/RenewResponse'
/api/cancel-early:
post:
summary: 조기 해지 요청
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CancelEarlyRequest'
responses:
'200':
description: 환급/페널티 계산 결과
content:
application/json:
schema:
$ref: '#/components/schemas/CancelEarlyResponse'
/api/admin/provider:
post:
summary: Provider 등록 (Admin)
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [providerName, payoutWallet]
properties:
providerName: { type: string }
payoutWallet: { type: string }
responses:
'200':
description: 생성됨
/api/admin/plan:
post:
summary: 신규 구독 플랜 생성 (Admin)
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [serviceId, currency, monthlyFee, terms, minCollateral]
properties:
serviceId: { type: string }
currency: { type: string, enum: [USDT, KRWT] }
monthlyFee: { type: string }
terms:
type: array
items: { type: integer, enum: [3,6,12] }
minCollateral: { type: string }
responses:
'200':
description: 생성됨