-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonepay-api-swagger.yml
342 lines (331 loc) · 11.9 KB
/
onepay-api-swagger.yml
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
swagger: "2.0"
info:
version: "1.0.0"
title: "Onepay REST API doc"
description: "Input and outputs documentation of Transbank Onepay API"
schemes:
- "https"
host: "web2desa.test.transbank.cl"
basePath: "/ewallet-plugin-api-services/services/transactionservice"
paths:
/sendtransaction:
post:
summary: "Create a new transaction on Onepay system"
operationId: "createTransaction"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "jsonIn"
description: "Transaction details"
required: true
schema:
$ref: "#/definitions/SendTransactionRequest"
responses:
"200":
description: "This service does not respect any rest compliance and it return always 200 code. If there is some
error it's informed in the json response."
schema:
$ref: "#/definitions/SendTransactionResponse"
/gettransactionnumber:
post:
summary: "Confirm transaction. It's mandatory to call this service in order to charge could be commited on client
card.
If this service is never called the charge will be reversed automatically."
operationId: "commitTransation"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "jsonIn"
description: "Transaction details"
required: true
schema:
$ref: "#/definitions/GetTransactionNumberRequest"
responses:
"200":
description: "This service does not respect any rest compliance and it return always 200 code. If there is some
error it's informed in the json response."
schema:
$ref: "#/definitions/GetTransactionNumberResponse"
/nullifytransaction:
post:
summary: "Make a refund of part of entire transaction"
operationId: "reverseTransaction"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "jsonIn"
description: "ransaction details"
required: true
schema:
$ref: "#/definitions/NullifyTrnsactionRequest"
responses:
"200":
description: "This service does not respect any rest compliance and it return always 200 code. If there is some
error it's informed in the json response."
schema:
$ref: "#/definitions/NullifyTrnsactionResponse"
definitions:
SendTransactionRequest:
type: "object"
properties:
apiKey:
type: "string"
description: "Commerce public ID. It's provided by Transbank with the Sharde Secret Key."
example: "mUc0GxYGor6X8u-_oB3e-HWJulRG01WoC96-_tUA3Bg"
appKey:
type: "string"
description: "Identify the version of API. It's always same and only change in diferent versions
of SDK and that's the reason why its hidden of user interface."
example: "04533c31-fe7e-43ed-bbc4-1c8ab1538af"
externalUniqueNumber:
type: "integer"
format: "int64"
description: "Unique id number to identify the shopping cart"
example: 1530288106
total:
type: "integer"
format: "int64"
description: "Total amount of the order"
example: 27500
itemsQuantity:
type: "integer"
format: "int32"
description: "Quantity of items in the shopping cart"
example: 2
issuedAt:
type: "integer"
format: "int64"
description: "Date of transaction in seconds (Unix Time)"
example: 1530288096
items:
type: "array"
items:
$ref: "#/definitions/Item"
callbackUrl:
type: "string"
description: "Not really used becouse transbank never call this. But its necesary beacouse the sign
use this in the hash. In the SDK this field is hidden to user interface and the SDK send a
FAKE_URL_CALLBACK"
example: "http://your.host/your.callback.page"
channel:
type: "string"
description: "Payment origen channel (WEB or MOBILE). By default the service asume the WEB channel. the
SDK send alway WEB in this field and it's not present in the user interface"
example: "WEB"
signature:
type: "string"
description: "A hash made with some data of this object is encrypted with SHA256 using a shared secret between
the comerce and transbank and then encoded to base64 to be transfered in this json"
example: "2CJpn9togRYyy+MwEXaJiW1hySMGfLlgKLgARF+flJs\u003d"
generateOttQrCode:
type: "boolean"
description: "Indicate if you want to receive a base64 QR to print in your web. This field was added
later in the API and in order to be retrocompatible its optional and false by default.
The SDK is to integrate the new Onepay using QR so the SDK send it always true."
default: "true"
example: "true"
Item:
type: "object"
properties:
description:
type: "string"
description: "Description or name of item"
example: "Shoes"
amount:
type: "integer"
format: "int64"
description: "Price of item"
example: 15000
expire:
type: "integer"
format: "int64"
description: "I really dont know what is this. I'm using always -1"
example: -1
additionalData:
type: "string"
description: "I dont know the use of this. Actually I'm not sending it for test cases"
SendTransactionResponse:
type: "object"
properties:
responseCode:
type: "string"
description: "Ok when all was fine or some error in another case"
example: "OK"
description:
type: "string"
description: "A Transbank generated message to describe the result of operation"
example: "OK"
result:
type: "object"
properties:
occ:
type: "string"
description: "Buy order"
example: "1807230859739430"
ott:
type: "integer"
description: "Generated by Transbank it's related with the buy order. I have not discovered any use for this
information till now"
example: 45450003
signature:
type: "string"
description: "A hash maked with some data of this object is encrypted with SHA256 using a shared secret between
the comerce and transbank and then encoded to base64 to be transfered in this json"
example: "Gn46q+aK7GEUQdmZjQ2O3N0uhy8yKYdQVoXD7uwTKvs="
externalUniqueNumber:
type: "integer"
format: "int64"
description: "Unique id number to identify the transaction. It's the same sent in the request"
example: 1530288106
issuedAt:
type: "integer"
format: "int64"
description: "Date of transaction in seconds"
example: 1531256717
qrCodeAsBase64:
type: "string"
description: "QR in base64 format"
GetTransactionNumberRequest:
type: "object"
properties:
apiKey:
type: "string"
description: "A key provided by Transbank"
example: "mUc0GxYGor6X8u-_oB3e-HWJulRG01WoC96-_tUA3Bg"
appKey:
type: "string"
description: "A key provided by Transbank to identify the comerce"
example: "04533c31-fe7e-43ed-bbc4-1c8ab1538af"
externalUniqueNumber:
type: "integer"
format: "int64"
description: "Unique id number to identify the transaction"
example: 1530288106
occ:
type: "string"
description: "Buy order"
example: "1807230859739430"
issuedAt:
type: "integer"
format: "int64"
description: "Date of transaction in seconds"
example: 1530288096
signature:
type: "string"
description: "A hash maked with some data of this object is encrypted with SHA256 using a shared secret between
the comerce and transbank and then encoded to base64 to be transfered in this json"
example: "2CJpn9togRYyy+MwEXaJiW1hySMGfLlgKLgARF+flJs\u003d"
GetTransactionNumberResponse:
type: "object"
properties:
responseCode:
type: "string"
description: "Ok when all was fine or some error in another case"
example: "OK"
description:
type: "string"
description: "A Transbank generated message to describe the result of operation"
example: "OK"
result:
type: "object"
properties:
occ:
type: "string"
description: "Buy order"
example: "1807230859739430"
authorizationCode:
type: "string"
description: "Self explanatory"
example: "368575"
issuedAt:
type: "integer"
format: "int64"
description: "Date of transaction in seconds"
example: 1530288096
signature:
type: "string"
description: "A hash maked with some data of this object is encrypted with SHA256 using a shared secret between
the comerce and transbank and then encoded to base64 to be transfered in this json"
example: "Gn46q+aK7GEUQdmZjQ2O3N0uhy8yKYdQVoXD7uwTKvs="
amount:
type: "integer"
format: "int64"
description: "Amount charged on client card in this transaction"
example: 52000
transactionDesc:
type: "string"
description: "Transaction description"
example: "Venta Normal: Sin cuotas"
installmentsAmount:
type: "integer"
format: "int64"
description: "Total amount charged on client card"
example: 52000
installmentsNumber:
type: "integer"
format: "int64"
description: "Number of charges"
example: 1
buyOrder:
type: "string"
description: "Buy order. It's not the same of occ"
example: "20180704152042696"
NullifyTrnsactionRequest:
type: "object"
properties:
apiKey:
type: "string"
description: "A key provided by Transbank"
example: "mUc0GxYGor6X8u-_oB3e-HWJulRG01WoC96-_tUA3Bg"
appKey:
type: "string"
description: "A key provided by Transbank to identify the comerce"
example: "04533c31-fe7e-43ed-bbc4-1c8ab1538af"
nullifyAmount:
type: integer
format: int64
description: "Amount to reverse"
example: 2490
occ:
type: "string"
description: "Buy order"
example: "1807230859739430"
externalUniqueNumber:
type: "integer"
format: "int64"
description: "Unique id number to identify the transaction"
example: 1530288106
authorizationCode:
type: "string"
description: "Self explanatory"
example: "906637"
issuedAt:
type: "integer"
format: "int64"
description: "Date of transaction in seconds"
example: 1530288096
signature:
type: "string"
description: "A hash maked with some data of this object is encrypted with SHA256 using a shared secret between
the comerce and transbank and then encoded to base64 to be transfered in this json"
example: "2CJpn9togRYyy+MwEXaJiW1hySMGfLlgKLgARF+flJs\u003d"
NullifyTrnsactionResponse:
type: "object"
properties:
responseCode:
type: "string"
description: "Ok when all was fine or some error in another case"
example: "OK"
description:
type: "string"
description: "A Transbank generated message to describe the result of operation"
example: "OK"