cloudcommerce 0.0.32 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/action.yml +4 -0
  3. package/package.json +6 -6
  4. package/packages/__skeleton/package.json +4 -1
  5. package/packages/__skeleton/src/{index.js → index.ts} +0 -0
  6. package/packages/__skeleton/tsconfig.json +3 -0
  7. package/packages/api/{tests/fetch-polyfill.js → fetch-polyfill.js} +0 -0
  8. package/packages/api/lib/index.d.ts +2 -112
  9. package/packages/api/lib/types.d.ts +1 -1
  10. package/packages/api/package.json +1 -1
  11. package/packages/api/src/types.ts +4 -0
  12. package/packages/api/tests/index.test.ts +1 -1
  13. package/packages/apps/discounts/lib/index.js +4 -0
  14. package/packages/apps/discounts/lib/index.js.map +1 -0
  15. package/packages/apps/discounts/package.json +4 -1
  16. package/packages/apps/discounts/src/index.ts +7 -0
  17. package/packages/apps/discounts/tsconfig.json +3 -0
  18. package/packages/cli/lib/index.js +11 -2
  19. package/packages/cli/package.json +1 -1
  20. package/packages/cli/src/index.ts +12 -3
  21. package/packages/firebase/lib/config.d.ts +15 -0
  22. package/packages/firebase/lib/config.js +3 -0
  23. package/packages/firebase/lib/config.js.map +1 -1
  24. package/packages/firebase/lib/defaults.d.ts +4 -0
  25. package/packages/firebase/lib/env.d.ts +8 -0
  26. package/packages/firebase/lib/handlers/check-store-events.d.ts +2 -0
  27. package/packages/firebase/lib/{methods → handlers}/check-store-events.js +10 -0
  28. package/packages/firebase/lib/handlers/check-store-events.js.map +1 -0
  29. package/packages/firebase/lib/index.d.ts +5 -0
  30. package/packages/firebase/lib/index.js +5 -4
  31. package/packages/firebase/lib/index.js.map +1 -1
  32. package/packages/firebase/lib/types.d.ts +6 -0
  33. package/packages/firebase/lib/types.js +2 -0
  34. package/packages/firebase/lib/types.js.map +1 -0
  35. package/packages/firebase/package.json +4 -1
  36. package/packages/firebase/src/config.ts +3 -0
  37. package/packages/firebase/src/{methods → handlers}/check-store-events.ts +11 -0
  38. package/packages/firebase/src/index.ts +5 -5
  39. package/packages/firebase/src/types.ts +11 -0
  40. package/packages/firebase/tsconfig.json +4 -1
  41. package/packages/modules/CHANGELOG.md +1 -0
  42. package/packages/modules/README.md +1 -0
  43. package/packages/modules/lib/firebase/index.js +15 -0
  44. package/packages/modules/lib/firebase/index.js.map +1 -0
  45. package/packages/modules/lib/index.js +21 -0
  46. package/packages/modules/lib/index.js.map +1 -0
  47. package/packages/modules/package.json +33 -0
  48. package/packages/modules/schemas/@checkout.cjs +1015 -0
  49. package/packages/modules/schemas/apply_discount.cjs +324 -0
  50. package/packages/modules/schemas/calculate_shipping.cjs +666 -0
  51. package/packages/modules/schemas/create_transaction.cjs +1001 -0
  52. package/packages/modules/schemas/list_payments.cjs +852 -0
  53. package/packages/modules/scripts/build-types.sh +33 -0
  54. package/packages/modules/src/firebase/index.ts +15 -0
  55. package/packages/modules/src/index.ts +21 -0
  56. package/packages/modules/tsconfig.json +3 -0
  57. package/packages/storefront/package.json +2 -2
  58. package/packages/types/CHANGELOG.md +1 -0
  59. package/packages/types/README.md +1 -0
  60. package/packages/types/index.ts +66 -0
  61. package/packages/types/modules/@checkout:params.d.ts +920 -0
  62. package/packages/types/modules/apply_discount:params.d.ts +154 -0
  63. package/packages/types/modules/apply_discount:response.d.ts +71 -0
  64. package/packages/types/modules/calculate_shipping:params.d.ts +275 -0
  65. package/packages/types/modules/calculate_shipping:response.d.ts +402 -0
  66. package/packages/types/modules/create_transaction:params.d.ts +515 -0
  67. package/packages/types/modules/create_transaction:response.d.ts +261 -0
  68. package/packages/types/modules/list_payments:params.d.ts +323 -0
  69. package/packages/types/modules/list_payments:response.d.ts +266 -0
  70. package/packages/types/package.json +21 -0
  71. package/pnpm-lock.yaml +505 -274
  72. package/packages/firebase/lib/methods/check-store-events.js.map +0 -1
@@ -0,0 +1,1015 @@
1
+ /* eslint-disable quote-props, comma-dangle, array-bracket-spacing */
2
+
3
+ exports.params = {
4
+ '$schema': 'http://json-schema.org/draft-06/schema#',
5
+ 'title': 'Checkout body',
6
+ 'description': 'Triggered to handle checkout with billing and shipping and create new order',
7
+ 'type': 'object',
8
+ 'required': [ 'items', 'shipping', 'transaction' ],
9
+ 'additionalProperties': false,
10
+ 'definitions': {
11
+ 'address': {
12
+ 'type': 'object',
13
+ 'additionalProperties': false,
14
+ 'required': [ 'zip' ],
15
+ 'properties': {
16
+ 'zip': {
17
+ 'type': 'string',
18
+ 'maxLength': 30,
19
+ 'description': 'ZIP (CEP, postal...) code'
20
+ },
21
+ 'street': {
22
+ 'type': 'string',
23
+ 'maxLength': 200,
24
+ 'description': 'Street or public place name'
25
+ },
26
+ 'number': {
27
+ 'type': 'integer',
28
+ 'min': 1,
29
+ 'max': 9999999,
30
+ 'description': 'House or building street number'
31
+ },
32
+ 'complement': {
33
+ 'type': 'string',
34
+ 'maxLength': 100,
35
+ 'description': 'Address complement or second line, such as apartment number'
36
+ },
37
+ 'borough': {
38
+ 'type': 'string',
39
+ 'maxLength': 100,
40
+ 'description': 'Borough name'
41
+ },
42
+ 'near_to': {
43
+ 'type': 'string',
44
+ 'maxLength': 100,
45
+ 'description': 'Some optional other reference for this address'
46
+ },
47
+ 'line_address': {
48
+ 'type': 'string',
49
+ 'maxLength': 255,
50
+ 'description': 'Full in line mailing address, should include street, number and borough'
51
+ },
52
+ 'city': {
53
+ 'type': 'string',
54
+ 'maxLength': 100,
55
+ 'description': 'City name'
56
+ },
57
+ 'country': {
58
+ 'type': 'string',
59
+ 'maxLength': 50,
60
+ 'description': 'Country name'
61
+ },
62
+ 'country_code': {
63
+ 'type': 'string',
64
+ 'minLength': 2,
65
+ 'maxLength': 2,
66
+ 'pattern': '^[A-Z]+$',
67
+ 'description': 'An ISO 3166-2 country code'
68
+ },
69
+ 'province': {
70
+ 'type': 'string',
71
+ 'maxLength': 100,
72
+ 'description': 'Province or state name'
73
+ },
74
+ 'province_code': {
75
+ 'type': 'string',
76
+ 'minLength': 2,
77
+ 'maxLength': 2,
78
+ 'pattern': '^[A-Z]+$',
79
+ 'description': 'The two-letter code for the province or state'
80
+ },
81
+ 'name': {
82
+ 'type': 'string',
83
+ 'maxLength': 70,
84
+ 'description': 'The name of recipient, generally is the customer\'s name'
85
+ },
86
+ 'last_name': {
87
+ 'type': 'string',
88
+ 'maxLength': 70,
89
+ 'description': 'The recipient\'s last name'
90
+ },
91
+ 'phone': {
92
+ 'type': 'object',
93
+ 'additionalProperties': false,
94
+ 'required': [ 'number' ],
95
+ 'properties': {
96
+ 'country_code': {
97
+ 'type': 'integer',
98
+ 'min': 1,
99
+ 'max': 999,
100
+ 'description': 'Country calling code (without +), defined by standards E.123 and E.164'
101
+ },
102
+ 'number': {
103
+ 'type': 'string',
104
+ 'maxLength': 19,
105
+ 'pattern': '^[0-9]+$',
106
+ 'description': 'The actual phone number, digits only'
107
+ }
108
+ },
109
+ 'description': 'Customer phone number for this mailing address'
110
+ }
111
+ },
112
+ 'description': 'Address object'
113
+ },
114
+ 'transaction': {
115
+ 'type': 'object',
116
+ 'additionalProperties': false,
117
+ 'required': [ 'app_id', 'buyer', 'payment_method' ],
118
+ 'properties': {
119
+ 'app_id': {
120
+ 'type': 'integer',
121
+ 'minimum': 1000,
122
+ 'maximum': 16777215,
123
+ 'description': 'ID of application chosen for transaction'
124
+ },
125
+ 'type': {
126
+ 'type': 'string',
127
+ 'enum': [ 'payment', 'recurrence' ],
128
+ 'default': 'payment',
129
+ 'description': 'Transaction type'
130
+ },
131
+ 'payment_method': {
132
+ 'type': 'object',
133
+ 'required': [ 'code' ],
134
+ 'additionalProperties': false,
135
+ 'properties': {
136
+ 'code': {
137
+ 'type': 'string',
138
+ 'enum': [
139
+ 'credit_card',
140
+ 'banking_billet',
141
+ 'online_debit',
142
+ 'account_deposit',
143
+ 'debit_card',
144
+ 'balance_on_intermediary',
145
+ 'loyalty_points',
146
+ 'other'
147
+ ],
148
+ 'description': 'Standardized payment method code'
149
+ },
150
+ 'name': {
151
+ 'type': 'string',
152
+ 'maxLength': 200,
153
+ 'description': 'Short description for payment method'
154
+ }
155
+ },
156
+ 'description': 'Chosen payment method object'
157
+ },
158
+ 'label': {
159
+ 'type': 'string',
160
+ 'maxLength': 50,
161
+ 'description': 'Name of payment method shown to customers'
162
+ },
163
+ 'icon': {
164
+ 'type': 'string',
165
+ 'maxLength': 255,
166
+ 'format': 'uri',
167
+ 'description': 'Payment icon image URI'
168
+ },
169
+ 'intermediator': {
170
+ 'type': 'object',
171
+ 'additionalProperties': false,
172
+ 'required': [ 'code' ],
173
+ 'properties': {
174
+ 'name': {
175
+ 'type': 'string',
176
+ 'maxLength': 255,
177
+ 'description': 'Name of payment intermediator'
178
+ },
179
+ 'link': {
180
+ 'type': 'string',
181
+ 'maxLength': 255,
182
+ 'format': 'uri',
183
+ 'description': 'URI to intermediator website'
184
+ },
185
+ 'code': {
186
+ 'type': 'string',
187
+ 'minLength': 6,
188
+ 'maxLength': 70,
189
+ 'pattern': '^[a-z0-9_]+$',
190
+ 'description': 'Gateway name standardized as identification code'
191
+ }
192
+ },
193
+ 'description': 'Payment intermediator'
194
+ },
195
+ 'payment_url': {
196
+ 'type': 'string',
197
+ 'maxLength': 255,
198
+ 'format': 'uri',
199
+ 'description': 'Base URI to payments'
200
+ },
201
+ 'buyer': {
202
+ 'type': 'object',
203
+ 'additionalProperties': false,
204
+ 'required': [ 'email', 'fullname', 'birth_date', 'phone', 'registry_type', 'doc_number' ],
205
+ 'properties': {
206
+ 'customer_id': {
207
+ 'type': 'string',
208
+ 'pattern': '^[a-f0-9]{24}$',
209
+ 'description': 'Customer ID in the store'
210
+ },
211
+ 'email': {
212
+ 'type': 'string',
213
+ 'maxLength': 200,
214
+ 'format': 'email',
215
+ 'description': 'Buyer email address'
216
+ },
217
+ 'fullname': {
218
+ 'type': 'string',
219
+ 'maxLength': 255,
220
+ 'description': 'Customer full name or company corporate name'
221
+ },
222
+ 'gender': {
223
+ 'type': 'string',
224
+ 'enum': [ 'f', 'm', 'x' ],
225
+ 'description': 'Customer gender, female, male or third gender (X)'
226
+ },
227
+ 'birth_date': {
228
+ 'type': 'object',
229
+ 'additionalProperties': false,
230
+ 'properties': {
231
+ 'day': {
232
+ 'type': 'integer',
233
+ 'min': 1,
234
+ 'max': 31,
235
+ 'description': 'Day of birth'
236
+ },
237
+ 'month': {
238
+ 'type': 'integer',
239
+ 'min': 1,
240
+ 'max': 12,
241
+ 'description': 'Number of month of birth'
242
+ },
243
+ 'year': {
244
+ 'type': 'integer',
245
+ 'min': 1800,
246
+ 'max': 2200,
247
+ 'description': 'Year of birth'
248
+ }
249
+ },
250
+ 'description': 'Date of customer birth'
251
+ },
252
+ 'phone': {
253
+ 'type': 'object',
254
+ 'additionalProperties': false,
255
+ 'required': [ 'number' ],
256
+ 'properties': {
257
+ 'country_code': {
258
+ 'type': 'integer',
259
+ 'min': 1,
260
+ 'max': 999,
261
+ 'description': 'Country calling code (without +), defined by standards E.123 and E.164'
262
+ },
263
+ 'number': {
264
+ 'type': 'string',
265
+ 'maxLength': 19,
266
+ 'pattern': '^[0-9]+$',
267
+ 'description': 'The actual phone number, digits only'
268
+ },
269
+ 'type': {
270
+ 'type': 'string',
271
+ 'enum': [ 'home', 'personal', 'work', 'other' ],
272
+ 'description': 'The type of phone'
273
+ }
274
+ },
275
+ 'description': 'Buyer contact phone'
276
+ },
277
+ 'registry_type': {
278
+ 'type': 'string',
279
+ 'enum': [ 'p', 'j' ],
280
+ 'description': 'Physical or juridical (company) person'
281
+ },
282
+ 'doc_country': {
283
+ 'type': 'string',
284
+ 'minLength': 2,
285
+ 'maxLength': 2,
286
+ 'pattern': '^[A-Z]+$',
287
+ 'description': 'Country of document origin, an ISO 3166-2 code'
288
+ },
289
+ 'doc_number': {
290
+ 'type': 'string',
291
+ 'maxLength': 19,
292
+ 'pattern': '^[0-9]+$',
293
+ 'description': 'Responsible person or organization document number (only numbers)'
294
+ },
295
+ 'inscription_type': {
296
+ 'type': 'string',
297
+ 'enum': [ 'State', 'Municipal' ],
298
+ 'description': 'Municipal or state registration if exists'
299
+ },
300
+ 'inscription_number': {
301
+ 'type': 'string',
302
+ 'maxLength': 50,
303
+ 'description': 'Municipal or state registration number (with characters) if exists'
304
+ }
305
+ },
306
+ 'description': 'Order buyer info'
307
+ },
308
+ 'payer': {
309
+ 'type': 'object',
310
+ 'additionalProperties': false,
311
+ 'properties': {
312
+ 'fullname': {
313
+ 'type': 'string',
314
+ 'maxLength': 255,
315
+ 'description': 'Payer full name or company corporate name'
316
+ },
317
+ 'birth_date': {
318
+ 'type': 'object',
319
+ 'additionalProperties': false,
320
+ 'properties': {
321
+ 'day': {
322
+ 'type': 'integer',
323
+ 'min': 1,
324
+ 'max': 31,
325
+ 'description': 'Day of birth'
326
+ },
327
+ 'month': {
328
+ 'type': 'integer',
329
+ 'min': 1,
330
+ 'max': 12,
331
+ 'description': 'Number of month of birth'
332
+ },
333
+ 'year': {
334
+ 'type': 'integer',
335
+ 'min': 1800,
336
+ 'max': 2200,
337
+ 'description': 'Year of birth'
338
+ }
339
+ },
340
+ 'description': 'Date of payer birth'
341
+ },
342
+ 'phone': {
343
+ 'type': 'object',
344
+ 'additionalProperties': false,
345
+ 'required': [ 'number' ],
346
+ 'properties': {
347
+ 'country_code': {
348
+ 'type': 'integer',
349
+ 'min': 1,
350
+ 'max': 999,
351
+ 'description': 'Country calling code (without +), defined by standards E.123 and E.164'
352
+ },
353
+ 'number': {
354
+ 'type': 'string',
355
+ 'maxLength': 19,
356
+ 'pattern': '^[0-9]+$',
357
+ 'description': 'The actual phone number, digits only'
358
+ },
359
+ 'type': {
360
+ 'type': 'string',
361
+ 'enum': [ 'home', 'personal', 'work', 'other' ],
362
+ 'description': 'The type of phone'
363
+ }
364
+ },
365
+ 'description': 'Payer contact phone'
366
+ },
367
+ 'registry_type': {
368
+ 'type': 'string',
369
+ 'enum': [ 'p', 'j' ],
370
+ 'description': 'Physical or juridical (company) person'
371
+ },
372
+ 'doc_country': {
373
+ 'type': 'string',
374
+ 'minLength': 2,
375
+ 'maxLength': 2,
376
+ 'pattern': '^[A-Z]+$',
377
+ 'description': 'Country of document origin, an ISO 3166-2 code'
378
+ },
379
+ 'doc_number': {
380
+ 'type': 'string',
381
+ 'maxLength': 19,
382
+ 'pattern': '^[0-9]+$',
383
+ 'description': 'Responsible person or organization document number (only numbers)'
384
+ }
385
+ },
386
+ 'description': 'Transation payer info'
387
+ },
388
+ 'intermediator_buyer_id': {
389
+ 'type': 'string',
390
+ 'maxLength': 255,
391
+ 'description': 'ID of customer account in the intermediator'
392
+ },
393
+ 'billing_address': {
394
+ '$ref': '#/definitions/address',
395
+ 'description': 'The mailing address associated with the payment method'
396
+ },
397
+ 'to': {
398
+ '$ref': '#/definitions/address',
399
+ 'description': 'Shipping address (recipient)'
400
+ },
401
+ 'credit_card': {
402
+ 'type': 'object',
403
+ 'additionalProperties': false,
404
+ 'properties': {
405
+ 'holder_name': {
406
+ 'type': 'string',
407
+ 'maxLength': 100,
408
+ 'description': 'Full name of the holder, as it is on the credit card'
409
+ },
410
+ 'bin': {
411
+ 'type': 'integer',
412
+ 'min': 1,
413
+ 'max': 9999999,
414
+ 'description': 'Issuer identification number (IIN), known as bank identification number (BIN)'
415
+ },
416
+ 'company': {
417
+ 'type': 'string',
418
+ 'maxLength': 100,
419
+ 'description': 'Credit card issuer name, eg.: Visa, American Express, MasterCard'
420
+ },
421
+ 'last_digits': {
422
+ 'type': 'string',
423
+ 'maxLength': 4,
424
+ 'pattern': '^[0-9]+$',
425
+ 'description': 'Last digits (up to 4) of credit card number'
426
+ },
427
+ 'token': {
428
+ 'type': 'string',
429
+ 'maxLength': 255,
430
+ 'description': 'Unique credit card token'
431
+ },
432
+ 'cvv': {
433
+ 'type': 'integer',
434
+ 'min': 99,
435
+ 'max': 99999,
436
+ 'description': 'Credit card CVV number (Card Verification Value)'
437
+ },
438
+ 'hash': {
439
+ 'type': 'string',
440
+ 'maxLength': 6000,
441
+ 'description': 'Credit card encrypted hash'
442
+ },
443
+ 'save': {
444
+ 'type': 'boolean',
445
+ 'default': true,
446
+ 'description': 'Whether the hashed credit card should be saved for further use'
447
+ }
448
+ },
449
+ 'description': 'Credit card data, if payment will be done with credit card'
450
+ },
451
+ 'installments_number': {
452
+ 'type': 'integer',
453
+ 'minimum': 1,
454
+ 'maximum': 199,
455
+ 'description': 'Number of installments chosen'
456
+ },
457
+ 'loyalty_points_applied': {
458
+ 'type': 'object',
459
+ 'additionalProperties': false,
460
+ 'maxProperties': 30,
461
+ 'patternProperties': {
462
+ '^[a-z0-9_]{2,30}$': {
463
+ 'type': 'number',
464
+ // 'multipleOf': 0.00001,
465
+ 'minimum': 0,
466
+ 'maximum': 999999999,
467
+ 'description': 'Number of loyalty points used'
468
+ }
469
+ },
470
+ 'description': 'Customer\'s loyalty points used, program ID as property'
471
+ },
472
+ 'open_payment_id': {
473
+ 'type': 'string',
474
+ 'maxLength': 255,
475
+ 'description': 'Payment or order ID if pre committed on gateway (authorization/capture)'
476
+ },
477
+ 'amount_part': {
478
+ 'type': 'number',
479
+ // 'multipleOf': 0.01,
480
+ 'minimum': 0,
481
+ 'maximum': 1,
482
+ 'default': 1,
483
+ 'description': 'Numeric part (multiplier) for final amount when ordering with 2+ transactions'
484
+ }
485
+ },
486
+ 'description': 'Transaction options object'
487
+ }
488
+ },
489
+ 'properties': {
490
+ 'items': {
491
+ 'type': 'array',
492
+ 'maxItems': 3000,
493
+ 'items': {
494
+ 'type': 'object',
495
+ 'additionalProperties': false,
496
+ 'required': [ 'product_id', 'quantity' ],
497
+ 'properties': {
498
+ 'product_id': {
499
+ 'type': 'string',
500
+ 'pattern': '^[a-f0-9]{24}$',
501
+ 'description': 'Product ID'
502
+ },
503
+ 'variation_id': {
504
+ 'type': 'string',
505
+ 'pattern': '^[a-f0-9]{24}$',
506
+ 'description': 'ID to specify the variation added to cart, if product has variations'
507
+ },
508
+ 'quantity': {
509
+ 'type': 'number',
510
+ // 'multipleOf': 0.0001,
511
+ 'minimum': 0,
512
+ 'maximum': 9999999,
513
+ 'description': 'Item quantity in cart'
514
+ },
515
+ 'inventory': {
516
+ 'type': 'object',
517
+ 'additionalProperties': false,
518
+ 'maxProperties': 100,
519
+ 'patternProperties': {
520
+ '^[A-Za-z0-9-_]{2,30}$': {
521
+ 'type': 'number',
522
+ // 'multipleOf': 0.0001,
523
+ 'minimum': 0,
524
+ 'maximum': 9999999,
525
+ 'description': 'Product quantity available for sale from current warehouse'
526
+ }
527
+ },
528
+ 'description': 'Warehouses by code and respective product stock'
529
+ },
530
+ 'picture': {
531
+ 'type': 'object',
532
+ 'additionalProperties': false,
533
+ 'patternProperties': {
534
+ '^small|normal|big|zoom|custom$': {
535
+ 'type': 'object',
536
+ 'required': [ 'url' ],
537
+ 'additionalProperties': false,
538
+ 'properties': {
539
+ 'url': {
540
+ 'type': 'string',
541
+ 'maxLength': 255,
542
+ 'format': 'uri',
543
+ 'description': 'Image link'
544
+ },
545
+ 'size': {
546
+ 'type': 'string',
547
+ 'maxLength': 11,
548
+ 'pattern': '^[1-9]([0-9]+)?x[1-9]([0-9]+)?$',
549
+ 'description': 'Image size (width x height) in px, such as 100x50 (100px width, 50px height)'
550
+ },
551
+ 'alt': {
552
+ 'type': 'string',
553
+ 'maxLength': 255,
554
+ 'description': 'Alternative text, HTML alt tag (important for SEO)'
555
+ }
556
+ },
557
+ 'description': 'Image size variation'
558
+ }
559
+ },
560
+ 'description': 'Product or variation picture for this cart item'
561
+ },
562
+ 'customizations': {
563
+ 'type': 'array',
564
+ 'maxItems': 100,
565
+ 'items': {
566
+ 'type': 'object',
567
+ 'required': [ '_id', 'option' ],
568
+ 'additionalProperties': false,
569
+ 'properties': {
570
+ '_id': {
571
+ 'type': 'string',
572
+ 'pattern': '^[a-f0-9]{24}$',
573
+ 'description': 'Customization field ID'
574
+ },
575
+ 'label': {
576
+ 'type': 'string',
577
+ 'maxLength': 70,
578
+ 'description': 'Title for this customization field, can be the grid title'
579
+ },
580
+ 'option': {
581
+ 'type': 'object',
582
+ 'required': [ 'text' ],
583
+ 'additionalProperties': false,
584
+ 'properties': {
585
+ 'option_id': {
586
+ 'type': 'string',
587
+ 'pattern': '^[a-z0-9_]{2,30}$',
588
+ 'description': 'Identify option if it was predefined (not custom value created by customer)'
589
+ },
590
+ 'text': {
591
+ 'type': 'string',
592
+ 'maxLength': 70,
593
+ 'description': 'Option text value displayed for the client'
594
+ },
595
+ 'colors': {
596
+ 'type': 'array',
597
+ 'maxItems': 6,
598
+ 'items': {
599
+ 'type': 'string',
600
+ 'pattern': '^#[a-f0-9]{6}$',
601
+ 'description': 'RGB code with #'
602
+ },
603
+ 'description': 'Option color palette (if the field involves colors), starting by main color'
604
+ }
605
+ },
606
+ 'description': 'Option chosen or created by customer'
607
+ },
608
+ 'attachment': {
609
+ 'type': 'string',
610
+ 'maxLength': 255,
611
+ 'format': 'uri',
612
+ 'description': 'URL of file attached by customer to this field'
613
+ },
614
+ 'add_to_price': {
615
+ 'type': 'object',
616
+ 'required': [ 'addition' ],
617
+ 'additionalProperties': false,
618
+ 'properties': {
619
+ 'type': {
620
+ 'type': 'string',
621
+ 'enum': [ 'percentage', 'fixed' ],
622
+ 'default': 'percentage',
623
+ 'description': 'Type of price addition'
624
+ },
625
+ 'addition': {
626
+ 'type': 'number',
627
+ // 'multipleOf': 0.0001,
628
+ 'minimum': -99999999,
629
+ 'maximum': 99999999,
630
+ 'description': 'Additional value, could be negative'
631
+ }
632
+ },
633
+ 'description': 'Price alteration due to this customization'
634
+ }
635
+ },
636
+ 'description': 'Customization field'
637
+ },
638
+ 'description': 'Item customization fields'
639
+ },
640
+ 'kit_product': {
641
+ 'type': 'object',
642
+ 'additionalProperties': false,
643
+ 'required': [ '_id' ],
644
+ 'properties': {
645
+ '_id': {
646
+ 'type': 'string',
647
+ 'pattern': '^[a-f0-9]{24}$',
648
+ 'description': 'Kit product ID'
649
+ },
650
+ 'name': {
651
+ 'type': 'string',
652
+ 'maxLength': 255,
653
+ 'description': 'Kit product full name'
654
+ },
655
+ 'pack_quantity': {
656
+ 'type': 'number',
657
+ // 'multipleOf': 0.0001,
658
+ 'minimum': 0,
659
+ 'maximum': 9999999,
660
+ 'description': 'Total quantity of items to close a kit unit'
661
+ },
662
+ 'price': {
663
+ 'type': 'number',
664
+ // 'multipleOf': 0.00001,
665
+ 'minimum': 0,
666
+ 'maximum': 999999999,
667
+ 'description': 'Kit total price'
668
+ }
669
+ },
670
+ 'description': 'Parent kit product for this item'
671
+ },
672
+ 'gift_wrap': {
673
+ 'type': 'object',
674
+ 'required': [ 'label' ],
675
+ 'additionalProperties': false,
676
+ 'properties': {
677
+ 'tag': {
678
+ 'type': 'string',
679
+ 'maxLength': 20,
680
+ 'pattern': '^[a-z0-9_]+$',
681
+ 'description': 'Tag to identify object, use only lowercase letters, digits and underscore'
682
+ },
683
+ 'label': {
684
+ 'type': 'string',
685
+ 'maxLength': 70,
686
+ 'description': 'Title describing this gift wrap'
687
+ },
688
+ 'add_to_price': {
689
+ 'type': 'number',
690
+ // 'multipleOf': 0.0001,
691
+ 'minimum': 0,
692
+ 'maximum': 99999999,
693
+ 'description': 'Additional value due to this gift wrap'
694
+ }
695
+ },
696
+ 'description': 'Gift wrap chosen by customer'
697
+ },
698
+ 'flags': {
699
+ 'type': 'array',
700
+ 'uniqueItems': true,
701
+ 'maxItems': 10,
702
+ 'items': {
703
+ 'type': 'string',
704
+ 'maxLength': 20,
705
+ 'description': 'Flag title'
706
+ },
707
+ 'description': 'Flags to associate additional info'
708
+ }
709
+ }
710
+ }
711
+ },
712
+ 'shipping': {
713
+ 'type': 'object',
714
+ 'additionalProperties': false,
715
+ 'required': [ 'app_id', 'to' ],
716
+ 'properties': {
717
+ 'app_id': {
718
+ 'type': 'integer',
719
+ 'minimum': 1000,
720
+ 'maximum': 16777215,
721
+ 'description': 'ID of application chosen for shipping'
722
+ },
723
+ 'from': {
724
+ '$ref': '#/definitions/address',
725
+ 'description': 'Sender\'s address'
726
+ },
727
+ 'to': {
728
+ '$ref': '#/definitions/address',
729
+ 'description': 'Shipping address (recipient)'
730
+ },
731
+ 'own_hand': {
732
+ 'type': 'boolean',
733
+ 'default': false,
734
+ 'description': 'Whether the package must be delivered with additional service "own hand"'
735
+ },
736
+ 'receipt': {
737
+ 'type': 'boolean',
738
+ 'default': false,
739
+ 'description': 'If the package will be delivered with acknowledgment of receipt'
740
+ },
741
+ 'service_code': {
742
+ 'type': 'string',
743
+ 'maxLength': 70,
744
+ 'description': 'Code of service defined by carrier, if shipping method is already defined'
745
+ }
746
+ },
747
+ 'description': 'Shipping options to calculate freight and deadline'
748
+ },
749
+ 'transaction': {
750
+ 'oneOf': [
751
+ {
752
+ '$ref': '#/definitions/transaction'
753
+ },
754
+ {
755
+ 'type': 'array',
756
+ 'maxItems': 5,
757
+ 'items': {
758
+ '$ref': '#/definitions/transaction'
759
+ }
760
+ }
761
+ ],
762
+ 'description': 'Payment options to create transaction(s)'
763
+ },
764
+ 'discount': {
765
+ 'type': 'object',
766
+ 'required': [ 'app_id' ],
767
+ 'additionalProperties': false,
768
+ 'properties': {
769
+ 'app_id': {
770
+ 'type': 'integer',
771
+ 'minimum': 1000,
772
+ 'maximum': 16777215,
773
+ 'description': 'ID of application chosen for extra discount'
774
+ },
775
+ 'discount_coupon': {
776
+ 'type': 'string',
777
+ 'maxLength': 255,
778
+ 'description': 'Text of discount coupon applied by customer'
779
+ }
780
+ },
781
+ 'description': 'Extra discount to apply by coupon or UTM campaign'
782
+ },
783
+ 'lang': {
784
+ 'type': 'string',
785
+ 'pattern': '^[a-z]{2}(_[a-z]{2})?$',
786
+ 'description': 'Language two letters code, sometimes with region, eg.: pt_br, fr, en_us'
787
+ },
788
+ 'utm': {
789
+ 'type': 'object',
790
+ 'additionalProperties': false,
791
+ 'properties': {
792
+ 'source': {
793
+ 'type': 'string',
794
+ 'maxLength': 100,
795
+ 'description': 'Parameter "utm_source", the referrer: (e.g. google, newsletter)'
796
+ },
797
+ 'medium': {
798
+ 'type': 'string',
799
+ 'maxLength': 100,
800
+ 'description': 'Parameter "utm_medium", the marketing medium: (e.g. cpc, banner, email)'
801
+ },
802
+ 'campaign': {
803
+ 'type': 'string',
804
+ 'maxLength': 200,
805
+ 'description': 'Parameter "utm_campaign", the product, promo code, or slogan (e.g. spring_sale)'
806
+ },
807
+ 'term': {
808
+ 'type': 'string',
809
+ 'maxLength': 100,
810
+ 'description': 'Parameter "utm_term", identifies the paid keywords'
811
+ },
812
+ 'content': {
813
+ 'type': 'string',
814
+ 'maxLength': 255,
815
+ 'description': 'Parameter "utm_content", used to differentiate ads'
816
+ }
817
+ },
818
+ 'description': 'UTM campaign HTTP parameters'
819
+ },
820
+ 'affiliate_code': {
821
+ 'type': 'string',
822
+ 'maxLength': 200,
823
+ 'description': 'Code to identify the affiliate that referred the customer'
824
+ },
825
+ 'browser_ip': {
826
+ 'type': 'string',
827
+ 'maxLength': 50,
828
+ 'description': 'IP address of the browser used by the customer when placing the order'
829
+ },
830
+ 'channel_id': {
831
+ 'type': 'integer',
832
+ 'min': 10000,
833
+ 'max': 4294967295,
834
+ 'description': 'Channel unique identificator'
835
+ },
836
+ 'channel_type': {
837
+ 'type': 'string',
838
+ 'maxLength': 20,
839
+ 'enum': [ 'ecommerce', 'mobile', 'pdv', 'button', 'facebook', 'chatbot' ],
840
+ 'default': 'ecommerce',
841
+ 'description': 'Channel type or source'
842
+ },
843
+ 'domain': {
844
+ 'type': 'string',
845
+ 'minLength': 4,
846
+ 'maxLength': 100,
847
+ 'pattern': '^[0-9a-z-.]+$',
848
+ 'description': 'Store domain name (numbers and lowercase letters, eg.: www.myshop.sample)'
849
+ },
850
+ 'notes': {
851
+ 'type': 'string',
852
+ 'maxLength': 255,
853
+ 'description': 'Optional notes with additional info about this order'
854
+ },
855
+ 'customer': {
856
+ 'type': 'object',
857
+ 'additionalProperties': false,
858
+ 'required': [ 'main_email', 'name' ],
859
+ 'properties': {
860
+ '_id': {
861
+ 'type': [ 'null', 'string' ],
862
+ 'pattern': '^[a-f0-9]{24}$',
863
+ 'description': 'Customer ID'
864
+ },
865
+ 'locale': {
866
+ 'type': 'string',
867
+ 'pattern': '^[a-z]{2}(_[a-z]{2})?$',
868
+ 'description': 'Customer language two letter code, sometimes with region, eg.: pt_br, fr, en_us'
869
+ },
870
+ 'main_email': {
871
+ 'type': 'string',
872
+ 'maxLength': 200,
873
+ 'format': 'email',
874
+ 'description': 'Customer main email address'
875
+ },
876
+ 'emails': {
877
+ 'type': 'array',
878
+ 'maxItems': 20,
879
+ 'items': {
880
+ 'type': 'object',
881
+ 'additionalProperties': false,
882
+ 'required': [ 'address' ],
883
+ 'properties': {
884
+ 'address': {
885
+ 'type': 'string',
886
+ 'maxLength': 200,
887
+ 'format': 'email',
888
+ 'description': 'The actual email address'
889
+ },
890
+ 'type': {
891
+ 'type': 'string',
892
+ 'enum': [ 'work', 'home', 'other' ],
893
+ 'description': 'The type of email'
894
+ },
895
+ 'verified': {
896
+ 'type': 'boolean',
897
+ 'default': false,
898
+ 'description': 'States whether or not the email address has been verified'
899
+ }
900
+ },
901
+ 'description': 'Email object'
902
+ },
903
+ 'description': 'List of customer email addresses'
904
+ },
905
+ 'display_name': {
906
+ 'type': 'string',
907
+ 'maxLength': 50,
908
+ 'description': 'The name of this Customer, suitable for display'
909
+ },
910
+ 'name': {
911
+ 'type': 'object',
912
+ 'additionalProperties': false,
913
+ 'properties': {
914
+ 'family_name': {
915
+ 'type': 'string',
916
+ 'maxLength': 70,
917
+ 'description': 'The family name of this user, or "last name"'
918
+ },
919
+ 'given_name': {
920
+ 'type': 'string',
921
+ 'maxLength': 70,
922
+ 'description': 'The "first name" of this user'
923
+ },
924
+ 'middle_name': {
925
+ 'type': 'string',
926
+ 'maxLength': 255,
927
+ 'description': 'The middle name(s) of this user'
928
+ }
929
+ },
930
+ 'description': 'Customer name object'
931
+ },
932
+ 'gender': {
933
+ 'type': 'string',
934
+ 'enum': [ 'f', 'm', 'x' ],
935
+ 'description': 'Customer gender, female, male or third gender (X)'
936
+ },
937
+ 'photos': {
938
+ 'type': 'array',
939
+ 'uniqueItems': true,
940
+ 'maxItems': 20,
941
+ 'items': {
942
+ 'type': 'string',
943
+ 'maxLength': 255,
944
+ 'description': 'Image URL'
945
+ },
946
+ 'description': 'User profile pictures'
947
+ },
948
+ 'phones': {
949
+ 'type': 'array',
950
+ 'maxItems': 20,
951
+ 'items': {
952
+ 'type': 'object',
953
+ 'additionalProperties': false,
954
+ 'required': [ 'number' ],
955
+ 'properties': {
956
+ 'country_code': {
957
+ 'type': 'integer',
958
+ 'min': 1,
959
+ 'max': 999,
960
+ 'description': 'Country calling code (without +), defined by standards E.123 and E.164'
961
+ },
962
+ 'number': {
963
+ 'type': 'string',
964
+ 'maxLength': 19,
965
+ 'pattern': '^[0-9]+$',
966
+ 'description': 'The actual phone number, digits only'
967
+ },
968
+ 'type': {
969
+ 'type': 'string',
970
+ 'enum': [ 'home', 'personal', 'work', 'other' ],
971
+ 'description': 'The type of phone'
972
+ }
973
+ },
974
+ 'description': 'Phone object'
975
+ },
976
+ 'description': 'List of customer phone numbers'
977
+ },
978
+ 'registry_type': {
979
+ 'type': 'string',
980
+ 'enum': [ 'p', 'j' ],
981
+ 'description': 'Physical or juridical (company) person'
982
+ },
983
+ 'doc_country': {
984
+ 'type': 'string',
985
+ 'minLength': 2,
986
+ 'maxLength': 2,
987
+ 'pattern': '^[A-Z]+$',
988
+ 'description': 'Country of document origin, an ISO 3166-2 code'
989
+ },
990
+ 'doc_number': {
991
+ 'type': 'string',
992
+ 'maxLength': 19,
993
+ 'pattern': '^[0-9]+$',
994
+ 'description': 'Responsible person or organization document number (only numbers)'
995
+ },
996
+ 'inscription_type': {
997
+ 'type': 'string',
998
+ 'enum': [ 'State', 'Municipal' ],
999
+ 'description': 'Municipal or state registration if exists'
1000
+ },
1001
+ 'inscription_number': {
1002
+ 'type': 'string',
1003
+ 'maxLength': 50,
1004
+ 'description': 'Municipal or state registration number (with characters) if exists'
1005
+ },
1006
+ 'corporate_name': {
1007
+ 'type': 'string',
1008
+ 'maxLength': 255,
1009
+ 'description': 'Registered company name or responsible fullname'
1010
+ }
1011
+ },
1012
+ 'description': 'Customer object'
1013
+ }
1014
+ }
1015
+ };