forked from bitcoin-sv/dpp-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.go
299 lines (295 loc) · 10.5 KB
/
docs.go
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "https://github.com/libsv/go-payment_protocol/blob/master/CODE_STANDARDS.md",
"contact": {},
"license": {
"name": "ISC",
"url": "https://github.com/libsv/go-payment_protocol/blob/master/LICENSE"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/payment/{paymentID}": {
"get": {
"description": "Creates a payment request based on a payment id (the identifier for an invoice).",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Payment"
],
"summary": "Request to pay an invoice and receive back outputs to use when constructing the payment transaction",
"parameters": [
{
"type": "string",
"description": "Payment ID",
"name": "paymentID",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"description": "contains the signed PaymentTerms",
"schema": {
"$ref": "#/definitions/envelope.JSONEnvelope"
}
},
"400": {
"description": "returned if the user input is invalid, usually an issue with the paymentID",
"schema": {
"$ref": "#/definitions/server.ClientError"
}
},
"404": {
"description": "returned if the paymentID has not been found",
"schema": {
"$ref": "#/definitions/server.ClientError"
}
},
"500": {
"description": "returned if there is an unexpected internal error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Creates a payment based on a payment id (the identifier for an invoice).",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Payment"
],
"summary": "A user will submit an SpvEnvelope along with other information that is validated before being broadcast to the network.",
"parameters": [
{
"type": "string",
"description": "Payment ID",
"name": "paymentID",
"in": "path",
"required": true
},
{
"description": "payment message used in BIP270",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dpp.PaymentCreateArgs"
}
}
],
"responses": {
"201": {
"description": "if success, error code will be empty, otherwise it will be filled in with reason",
"schema": {
"$ref": "#/definitions/dpp.PaymentACK"
}
},
"400": {
"description": "returned if the user input is invalid, usually an issue with the paymentID",
"schema": {
"$ref": "#/definitions/server.ClientError"
}
},
"404": {
"description": "returned if the paymentID has not been found",
"schema": {
"$ref": "#/definitions/server.ClientError"
}
},
"500": {
"description": "returned if there is an unexpected internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/proofs/{txid}": {
"post": {
"description": "Creates a json envelope proof",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Proofs"
],
"summary": "InvoiceCreate proof",
"parameters": [
{
"type": "string",
"description": "Transaction ID",
"name": "txid",
"in": "path",
"required": true
},
{
"description": "JSON Envelope",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/envelope.JSONEnvelope"
}
}
],
"responses": {
"201": {
"description": "Created"
}
}
}
}
},
"definitions": {
"dpp.PaymentACK": {
"type": "object",
"required": [
"modeId"
],
"properties": {
"error": {
"description": "A number indicating why the transaction was not accepted. 0 or undefined indicates no error.\nA 1 or any other positive integer indicates an error. The errors are left undefined for now;\nit is recommended only to use “1” and to fill the memo with a textual explanation about why\nthe transaction was not accepted until further numbers are defined and standardised.",
"type": "integer"
},
"memo": {
"description": "Memo may contain information about why there was an error. This field is poorly defined until\nerror reporting is more standardised.",
"type": "string"
},
"mode": {
"description": "Mode data required by specific payment mode",
"$ref": "#/definitions/hybridmode.PaymentACK"
},
"modeId": {
"description": "ModeID the chosen mode.",
"type": "string",
"example": "ef63d9775da5"
},
"peerChannel": {
"$ref": "#/definitions/hybridmode.PeerChannelData"
},
"redirectUrl": {
"type": "string"
}
}
},
"dpp.PaymentCreateArgs": {
"type": "object",
"properties": {
"paymentID": {
"type": "string"
}
}
},
"envelope.JSONEnvelope": {
"type": "object",
"properties": {
"encoding": {
"type": "string"
},
"mimetype": {
"type": "string"
},
"payload": {
"type": "string"
},
"publicKey": {
"type": "string"
},
"signature": {
"type": "string"
}
}
},
"hybridmode.PaymentACK": {
"type": "object",
"properties": {
"peerChannel": {
"$ref": "#/definitions/hybridmode.PeerChannelData"
},
"transactionIds": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"hybridmode.PeerChannelData": {
"type": "object",
"properties": {
"channel_id": {
"type": "string"
},
"host": {
"type": "string"
},
"path": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"server.ClientError": {
"type": "object",
"properties": {
"code": {
"type": "string",
"example": "N01"
},
"id": {
"type": "string",
"example": "e97970bf-2a88-4bc8-90e6-2f597a80b93d"
},
"message": {
"type": "string",
"example": "unable to find foo when loading bar"
},
"title": {
"type": "string",
"example": "not found"
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "0.0.1",
Host: "localhost:8445",
BasePath: "",
Schemes: []string{},
Title: "Payment Protocol Server",
Description: "Payment Protocol Server is an implementation of a Bip-270 payment flow.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}