forked from vtex/openapi-schemas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VTEX - Pricing Hub.json
489 lines (489 loc) · 20.8 KB
/
VTEX - Pricing Hub.json
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
{
"openapi": "3.0.0",
"info": {
"title": "Pricing Hub",
"description": "",
"contact": {},
"version": "1.0"
},
"servers": [
{
"url": "https://prchub.{environment}.com.br",
"description": "VTEX server url",
"variables": {
"environment": {
"description": "Environment to use. Used as part of the URL.",
"default": "{environment}"
}
}
}
],
"paths": {
"/api/pricing-hub/prices": {
"post": {
"tags": [
"Pricing Hub Prices"
],
"summary": "Get Prices",
"description": "This route retrieves and applies prices for the items that are passed in the request. Pricing Hub will select the pricing method that will be used for each item and will fetch their respective price from the selected pricing method.",
"parameters": [
{
"name": "accountName",
"in": "query",
"required": true,
"description": "Name of the VTEX account. Used as part of the URL",
"schema": {
"type": "string",
"default": "apiexamples"
}
},
{
"name": "Accept",
"in": "header",
"required": true,
"description": "HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand",
"style": "simple",
"schema": {
"type": "string",
"default": "application/json"
}
},
{
"name": "Content-Type",
"in": "header",
"description": "Describes the type of the content being sent",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"default": "application/json"
}
},
{
"name": "X-VTEX-API-AppKey",
"in": "header",
"description": "The AppKey configured by the merchant",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"default": "{{X-VTEX-API-AppKey}}"
}
},
{
"name": "X-VTEX-API-AppToken",
"in": "header",
"description": "The AppToken configured by the merchant",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"default": "{{X-VTEX-API-AppToken}}"
}
}
],
"requestBody": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetPricesRequestObject"
},
"example": {
"items": [
{
"index": 0,
"skuId": "13",
"quantity": 1,
"brandId": "2000000",
"sellerId": "1",
"priceTableIds": [],
"categoriesIds": [
"1"
]
}
],
"UtmSource": "facebook",
"UtmMedium": "social",
"UtmCampaign": "summer",
"UtmInternalCampaign": "sale",
"salesChannel": "1",
"email": "customer@email.com"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/response2"
},
"example": {
"items": [
{
"index": 0,
"skuId": "14",
"price": 1875,
"costPrice": 750,
"listPrice": 2500,
"priceTable": "1",
"priceValidUntil": "2022-03-24T14:57:19Z"
},
{
"index": 0,
"skuId": "14",
"price": 200,
"costPrice": 200,
"listPrice": 200,
"priceTable": "1",
"priceValidUntil": "2022-03-04T20:00:18Z"
}
]
}
}
}
}
},
"deprecated": false
}
},
"/config": {
"put": {
"tags": [
"Pricing Hub Prices"
],
"summary": "Configure External Price Source",
"description": "This route facilitates setting up an external price source in Pricing Hub. It also allows you to activate or deactivate that source in a given account.",
"operationId": "ConfigExternalPriceSource",
"parameters": [
{
"name": "an",
"in": "query",
"description": "Name of the VTEX account",
"required": false,
"schema": {
"type": "string",
"example": "apiexamples"
}
},
{
"name": "Accept",
"in": "header",
"required": true,
"description": "HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand",
"style": "simple",
"schema": {
"type": "string",
"default": "application/json"
}
},
{
"name": "Content-Type",
"in": "header",
"description": "Describes the type of the content being sent",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"default": "application/json"
}
},
{
"name": "X-VTEX-API-AppKey",
"in": "header",
"description": "The AppKey configured by the merchant",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"default": "{{X-VTEX-API-AppKey}}"
}
},
{
"name": "X-VTEX-API-AppToken",
"in": "header",
"description": "The AppToken configured by the merchant",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"default": "{{X-VTEX-API-AppToken}}"
}
}
],
"requestBody": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConfigExternalPriceSourceRequest"
},
"example": {
"active": true,
"appName": "apiexamples_app_name"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"components": {
"schemas": {
"GetPricesRequestObject": {
"required": [
"items",
"salesChannel",
"email"
],
"type": "object",
"properties": {
"items": {
"$ref": "#/components/schemas/items"
},
"UtmSource": {
"type": "string",
"default": "facebook",
"description": "Traffic source, indicates where the traffic originated from according to the `utm_source` value in the URL that led to the order. If there is no value, use `null`"
},
"UtmMedium": {
"type": "string",
"default": "social",
"description": "Medium that indicates what type of traffic the customer originated from, represented by the `utm_medium` value in the URL that led to the order. If there is no value, use `null`"
},
"UtmCampaign": {
"type": "string",
"default": "summer",
"description": "Campaign name, represented by the `utm_campaign` value in the URL that led to the order. If there is no value, use `null`"
},
"UtmInternalCampaign": {
"type": "string",
"default": "sale",
"description": "Internal campaign name, represented by the `utmi_cp` value in the URL that led to the order. If there is no value, use `null`"
},
"salesChannel": {
"type": "string",
"default": "1",
"description": "Represents Checkout's sales channel"
},
"email": {
"type": "string",
"default": "customer@email.com",
"description": "The customer's email address. If there is no value, use an empty string"
}
},
"example": {
"items": [
{
"index": 0,
"skuId": "13",
"quantity": 1,
"brandId": "2000000",
"sellerId": "1",
"priceTableIds": [],
"categoriesIds": [
"1"
]
}
],
"UtmSource": "facebook",
"UtmMedium": "social",
"UtmCampaign": "summer",
"UtmInternalCampaign": "sale",
"salesChannel": "1",
"email": "customer@email.com"
}
},
"items": {
"title": "items",
"required": [
"itemsObject"
],
"type": "array",
"description": "The list of items that are to be priced by Pricing Hub",
"items": {
"type": "object",
"title": "",
"description": "Each item to be priced by Pricing Hub",
"required": [
"index",
"skuId",
"quantity",
"brandId",
"sellerId",
"priceTableIds",
"categoriesIds"
],
"properties": {
"index": {
"description": "This is the index of the item at Checkout's cart. It has to be unique in the items array",
"type": "integer",
"title": "index",
"default": 0
},
"skuId": {
"description": "This is the sku id of the item that will be priced",
"type": "string",
"title": "skuId",
"default": "13"
},
"quantity": {
"description": "This is the amount of items that will be priced. It is possible to have a volume discount for many repeated items. Hence, the price may not be the quantity of the item multiplied by the unitary price",
"type": "integer",
"title": "quantity",
"default": 1
},
"brandId": {
"description": "This is the brand ID for the item",
"type": "string",
"title": "brandId",
"default": "2000000"
},
"sellerId": {
"description": "This is the seller ID for the item",
"type": "string",
"title": "sellerId",
"default": "1"
},
"priceTableIds": {
"description": "IDs of the price tables that will be used to compute the price. More than one price table might be passed to the array. The final price rule might be more complex than the lowest or the highest price",
"type": "array",
"title": "priceTableIds",
"items": {
"type": "string",
"default": "1",
"description": "ID of a price table that will be used to compute the price"
},
"default": ["1"]
},
"categoriesIds": {
"description": "ID of the categories that will be used to compute the price",
"type": "array",
"items": {
"type": "string",
"default": "1",
"description": "ID of a category that will be used to compute the price"
},
"title": "categoriesIds",
"default": ["1"]
}
}
}
},
"response2": {
"title": "response2",
"required": [
"items"
],
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Item1"
},
"description": "List of items and their respective prices applied by Pricing Hub"
}
}
},
"Item1": {
"title": "Item1",
"required": [
"index",
"skuId",
"price",
"costPrice",
"listPrice",
"priceTable",
"priceValidUntil"
],
"type": "object",
"properties": {
"index": {
"type": "integer",
"description": "The same index referring to Checkout's cart that was passed to the API"
},
"skuId": {
"type": "string",
"description": "The same skuId that was passed to the API"
},
"price": {
"type": "number",
"description": "The price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency"
},
"costPrice": {
"type": "number",
"description": "The cost price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency."
},
"listPrice": {
"type": "number",
"description": "The list price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency"
},
"priceTable": {
"type": "string",
"description": "The price table that was used to price the item"
},
"priceValidUntil": {
"type": "string",
"description": "The moment up until the price is valid. After that moment, it will be necessary to call the pricing API again. The format of the string is in RFC3339"
}
}
},
"ConfigExternalPriceSourceRequest": {
"title": "ConfigExternalPriceSourceRequest",
"required": [
"appName"
],
"type": "object",
"properties": {
"active": {
"type": "boolean",
"description": "Defines if the external price source is active (`true`) or not (`false`). If not set, the default value will be `false`.",
"default": false
},
"appName": {
"type": "string",
"description": "Name of the app that communicates with the external pricing source"
}
},
"example": {
"active": true,
"appName": "apiexamples_app_name"
}
}
},
"securitySchemes": {
"appKey": {
"type": "apiKey",
"in": "header",
"name": "X-VTEX-API-AppKey"
},
"appToken": {
"type": "apiKey",
"in": "header",
"name": "X-VTEX-API-AppToken"
}
}
},
"tags": [
{
"name": "Pricing Hub Prices"
}
],
"security": [
{
"appKey": [],
"appToken": []
}
]
}