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,852 @@
1
+ /* eslint-disable quote-props, comma-dangle, array-bracket-spacing */
2
+
3
+ const schema = {
4
+ 'description': 'Triggered when listing payments, must return available methods',
5
+ 'type': 'object',
6
+ 'additionalProperties': false,
7
+ 'properties': {
8
+ 'items': {
9
+ 'type': 'array',
10
+ 'maxItems': 3000,
11
+ 'items': {
12
+ 'type': 'object',
13
+ 'additionalProperties': false,
14
+ 'required': [ 'product_id', 'quantity', 'price' ],
15
+ 'properties': {
16
+ 'product_id': {
17
+ 'type': 'string',
18
+ 'pattern': '^[a-f0-9]{24}$',
19
+ 'description': 'Product ID'
20
+ },
21
+ 'variation_id': {
22
+ 'type': 'string',
23
+ 'pattern': '^[a-f0-9]{24}$',
24
+ 'description': 'ID to specify the variation added to cart, if product has variations'
25
+ },
26
+ 'sku': {
27
+ 'type': 'string',
28
+ 'minLength': 2,
29
+ 'maxLength': 100,
30
+ 'pattern': '^[A-Za-z0-9-_.]+$',
31
+ 'description': 'Product or variation unique reference code'
32
+ },
33
+ 'name': {
34
+ 'type': 'string',
35
+ 'maxLength': 255,
36
+ 'description': 'Product or variation full name, or other label for this cart item'
37
+ },
38
+ 'quantity': {
39
+ 'type': 'number',
40
+ // 'multipleOf': 0.0001,
41
+ 'minimum': 0,
42
+ 'maximum': 9999999,
43
+ 'description': 'Item quantity in cart'
44
+ },
45
+ 'currency_id': {
46
+ 'type': 'string',
47
+ 'pattern': '^[A-Z]{3}$',
48
+ 'default': 'BRL',
49
+ 'description': 'Designator of currency according to ISO 4217 (3 uppercase letters)'
50
+ },
51
+ 'currency_symbol': {
52
+ 'type': 'string',
53
+ 'maxLength': 20,
54
+ 'default': 'R$',
55
+ 'description': 'Graphic symbol used as a shorthand for currency\'s name'
56
+ },
57
+ 'price': {
58
+ 'type': 'number',
59
+ // 'multipleOf': 0.00001,
60
+ 'minimum': 0,
61
+ 'maximum': 999999999,
62
+ 'description': 'Product sale price specifically for this cart'
63
+ },
64
+ 'final_price': {
65
+ 'type': 'number',
66
+ // 'multipleOf': 0.00001,
67
+ 'minimum': 0,
68
+ 'maximum': 999999999,
69
+ 'description': 'Final item price including additions due to customizations and gift wrap'
70
+ }
71
+ },
72
+ 'description': 'One of the cart items'
73
+ },
74
+ 'description': 'Products composing the cart'
75
+ },
76
+ 'currency_id': {
77
+ 'type': 'string',
78
+ 'pattern': '^[A-Z]{3}$',
79
+ 'default': 'BRL',
80
+ 'description': 'Designator of currency according to ISO 4217 (3 uppercase letters)'
81
+ },
82
+ 'currency_symbol': {
83
+ 'type': 'string',
84
+ 'maxLength': 20,
85
+ 'default': 'R$',
86
+ 'description': 'Graphic symbol used as a shorthand for currency\'s name'
87
+ },
88
+ 'amount': {
89
+ 'type': 'object',
90
+ 'additionalProperties': false,
91
+ 'required': [ 'total' ],
92
+ 'properties': {
93
+ 'total': {
94
+ 'type': 'number',
95
+ // 'multipleOf': 0.00001,
96
+ 'minimum': 0,
97
+ 'maximum': 9999999999,
98
+ 'description': 'Order total amount'
99
+ },
100
+ 'subtotal': {
101
+ 'type': 'number',
102
+ // 'multipleOf': 0.00001,
103
+ 'minimum': 0,
104
+ 'maximum': 9999999999,
105
+ 'description': 'The sum of all items prices'
106
+ },
107
+ 'freight': {
108
+ 'type': 'number',
109
+ // 'multipleOf': 0.00001,
110
+ 'minimum': 0,
111
+ 'maximum': 9999999999,
112
+ 'description': 'Order freight cost'
113
+ },
114
+ 'discount': {
115
+ 'type': 'number',
116
+ // 'multipleOf': 0.00001,
117
+ 'minimum': 0,
118
+ 'maximum': 9999999999,
119
+ 'description': 'Applied discount value'
120
+ },
121
+ 'tax': {
122
+ 'type': 'number',
123
+ // 'multipleOf': 0.00001,
124
+ 'minimum': 0,
125
+ 'maximum': 9999999999,
126
+ 'description': 'The sum of all the taxes applied to the order'
127
+ },
128
+ 'extra': {
129
+ 'type': 'number',
130
+ // 'multipleOf': 0.00001,
131
+ 'minimum': 0,
132
+ 'maximum': 9999999999,
133
+ 'description': 'Sum of optional extra costs applied'
134
+ }
135
+ },
136
+ 'description': 'Object with sums of values'
137
+ },
138
+ 'lang': {
139
+ 'type': 'string',
140
+ 'pattern': '^[a-z]{2}(_[a-z]{2})?$',
141
+ 'description': 'Language two letters code, sometimes with region, eg.: pt_br, fr, en_us'
142
+ },
143
+ 'domain': {
144
+ 'type': 'string',
145
+ 'minLength': 4,
146
+ 'maxLength': 100,
147
+ 'pattern': '^[0-9a-z-.]+$',
148
+ 'description': 'Store domain name (numbers and lowercase letters, eg.: www.myshop.sample)'
149
+ },
150
+ 'customer': {
151
+ 'type': 'object',
152
+ 'additionalProperties': false,
153
+ 'required': [ 'main_email', 'name' ],
154
+ 'properties': {
155
+ '_id': {
156
+ 'type': [ 'null', 'string' ],
157
+ 'pattern': '^[a-f0-9]{24}$',
158
+ 'description': 'Customer ID'
159
+ },
160
+ 'locale': {
161
+ 'type': 'string',
162
+ 'pattern': '^[a-z]{2}(_[a-z]{2})?$',
163
+ 'description': 'Customer language two letter code, sometimes with region, eg.: pt_br, fr, en_us'
164
+ },
165
+ 'main_email': {
166
+ 'type': 'string',
167
+ 'maxLength': 200,
168
+ 'format': 'email',
169
+ 'description': 'Customer main email address'
170
+ },
171
+ 'emails': {
172
+ 'type': 'array',
173
+ 'maxItems': 20,
174
+ 'items': {
175
+ 'type': 'object',
176
+ 'additionalProperties': false,
177
+ 'required': [ 'address' ],
178
+ 'properties': {
179
+ 'address': {
180
+ 'type': 'string',
181
+ 'maxLength': 200,
182
+ 'format': 'email',
183
+ 'description': 'The actual email address'
184
+ },
185
+ 'type': {
186
+ 'type': 'string',
187
+ 'enum': [ 'work', 'home', 'other' ],
188
+ 'description': 'The type of email'
189
+ },
190
+ 'verified': {
191
+ 'type': 'boolean',
192
+ 'default': false,
193
+ 'description': 'States whether or not the email address has been verified'
194
+ }
195
+ },
196
+ 'description': 'Email object'
197
+ },
198
+ 'description': 'List of customer email addresses'
199
+ },
200
+ 'display_name': {
201
+ 'type': 'string',
202
+ 'maxLength': 50,
203
+ 'description': 'The name of this Customer, suitable for display'
204
+ },
205
+ 'name': {
206
+ 'type': 'object',
207
+ 'additionalProperties': false,
208
+ 'properties': {
209
+ 'family_name': {
210
+ 'type': 'string',
211
+ 'maxLength': 70,
212
+ 'description': 'The family name of this user, or "last name"'
213
+ },
214
+ 'given_name': {
215
+ 'type': 'string',
216
+ 'maxLength': 70,
217
+ 'description': 'The "first name" of this user'
218
+ },
219
+ 'middle_name': {
220
+ 'type': 'string',
221
+ 'maxLength': 255,
222
+ 'description': 'The middle name(s) of this user'
223
+ }
224
+ },
225
+ 'description': 'Customer name object'
226
+ },
227
+ 'gender': {
228
+ 'type': 'string',
229
+ 'enum': [ 'f', 'm', 'x' ],
230
+ 'description': 'Customer gender, female, male or third gender (X)'
231
+ },
232
+ 'photos': {
233
+ 'type': 'array',
234
+ 'uniqueItems': true,
235
+ 'maxItems': 20,
236
+ 'items': {
237
+ 'type': 'string',
238
+ 'maxLength': 255,
239
+ 'description': 'Image URL'
240
+ },
241
+ 'description': 'User profile pictures'
242
+ },
243
+ 'phones': {
244
+ 'type': 'array',
245
+ 'maxItems': 20,
246
+ 'items': {
247
+ 'type': 'object',
248
+ 'additionalProperties': false,
249
+ 'required': [ 'number' ],
250
+ 'properties': {
251
+ 'country_code': {
252
+ 'type': 'integer',
253
+ 'min': 1,
254
+ 'max': 999,
255
+ 'description': 'Country calling code (without +), defined by standards E.123 and E.164'
256
+ },
257
+ 'number': {
258
+ 'type': 'string',
259
+ 'maxLength': 19,
260
+ 'pattern': '^[0-9]+$',
261
+ 'description': 'The actual phone number, digits only'
262
+ },
263
+ 'type': {
264
+ 'type': 'string',
265
+ 'enum': [ 'home', 'personal', 'work', 'other' ],
266
+ 'description': 'The type of phone'
267
+ }
268
+ },
269
+ 'description': 'Phone object'
270
+ },
271
+ 'description': 'List of customer phone numbers'
272
+ },
273
+ 'registry_type': {
274
+ 'type': 'string',
275
+ 'enum': [ 'p', 'j' ],
276
+ 'description': 'Physical or juridical (company) person'
277
+ },
278
+ 'doc_country': {
279
+ 'type': 'string',
280
+ 'minLength': 2,
281
+ 'maxLength': 2,
282
+ 'pattern': '^[A-Z]+$',
283
+ 'description': 'Country of document origin, an ISO 3166-2 code'
284
+ },
285
+ 'doc_number': {
286
+ 'type': 'string',
287
+ 'maxLength': 19,
288
+ 'pattern': '^[0-9]+$',
289
+ 'description': 'Responsible person or organization document number (only numbers)'
290
+ },
291
+ 'inscription_type': {
292
+ 'type': 'string',
293
+ 'enum': [ 'State', 'Municipal' ],
294
+ 'description': 'Municipal or state registration if exists'
295
+ },
296
+ 'inscription_number': {
297
+ 'type': 'string',
298
+ 'maxLength': 50,
299
+ 'description': 'Municipal or state registration number (with characters) if exists'
300
+ },
301
+ 'corporate_name': {
302
+ 'type': 'string',
303
+ 'maxLength': 255,
304
+ 'description': 'Registered company name or responsible fullname'
305
+ },
306
+ 'addresses': {
307
+ 'type': 'array',
308
+ 'maxItems': 40,
309
+ 'items': {
310
+ 'type': 'object',
311
+ 'additionalProperties': false,
312
+ 'required': [ '_id', 'zip' ],
313
+ 'properties': {
314
+ '_id': {
315
+ 'type': 'string',
316
+ 'pattern': '^[a-f0-9]{24}$',
317
+ 'description': 'Unique ID (ObjectID)'
318
+ },
319
+ 'zip': {
320
+ 'type': 'string',
321
+ 'maxLength': 30,
322
+ 'description': 'ZIP (CEP, postal...) code'
323
+ },
324
+ 'street': {
325
+ 'type': 'string',
326
+ 'maxLength': 200,
327
+ 'description': 'Street or public place name'
328
+ },
329
+ 'number': {
330
+ 'type': 'integer',
331
+ 'min': 1,
332
+ 'max': 9999999,
333
+ 'description': 'House or building street number'
334
+ },
335
+ 'complement': {
336
+ 'type': 'string',
337
+ 'maxLength': 100,
338
+ 'description': 'Address complement or second line, such as apartment number'
339
+ },
340
+ 'borough': {
341
+ 'type': 'string',
342
+ 'maxLength': 100,
343
+ 'description': 'Borough name'
344
+ },
345
+ 'near_to': {
346
+ 'type': 'string',
347
+ 'maxLength': 100,
348
+ 'description': 'Some optional other reference for this address'
349
+ },
350
+ 'line_address': {
351
+ 'type': 'string',
352
+ 'maxLength': 255,
353
+ 'description': 'Full in line mailing address, should include street, number and borough'
354
+ },
355
+ 'city': {
356
+ 'type': 'string',
357
+ 'maxLength': 100,
358
+ 'description': 'City name'
359
+ },
360
+ 'country': {
361
+ 'type': 'string',
362
+ 'maxLength': 50,
363
+ 'description': 'Country name'
364
+ },
365
+ 'country_code': {
366
+ 'type': 'string',
367
+ 'minLength': 2,
368
+ 'maxLength': 2,
369
+ 'pattern': '^[A-Z]+$',
370
+ 'description': 'An ISO 3166-2 country code'
371
+ },
372
+ 'province': {
373
+ 'type': 'string',
374
+ 'maxLength': 100,
375
+ 'description': 'Province or state name'
376
+ },
377
+ 'province_code': {
378
+ 'type': 'string',
379
+ 'minLength': 2,
380
+ 'maxLength': 2,
381
+ 'pattern': '^[A-Z]+$',
382
+ 'description': 'The two-letter code for the province or state'
383
+ },
384
+ 'name': {
385
+ 'type': 'string',
386
+ 'maxLength': 70,
387
+ 'description': 'The name of recipient, generally is the customer\'s name'
388
+ },
389
+ 'last_name': {
390
+ 'type': 'string',
391
+ 'maxLength': 70,
392
+ 'description': 'The recipient\'s last name'
393
+ },
394
+ 'phone': {
395
+ 'type': 'object',
396
+ 'additionalProperties': false,
397
+ 'required': [ 'number' ],
398
+ 'properties': {
399
+ 'country_code': {
400
+ 'type': 'integer',
401
+ 'min': 1,
402
+ 'max': 999,
403
+ 'description': 'Country calling code (without +), defined by standards E.123 and E.164'
404
+ },
405
+ 'number': {
406
+ 'type': 'string',
407
+ 'maxLength': 19,
408
+ 'pattern': '^[0-9]+$',
409
+ 'description': 'The actual phone number, digits only'
410
+ }
411
+ },
412
+ 'description': 'Customer phone number for this mailing address'
413
+ },
414
+ 'default': {
415
+ 'type': 'boolean',
416
+ 'default': false,
417
+ 'description': 'Indicates whether this address is the default address for the customer'
418
+ }
419
+ },
420
+ 'description': 'Address object'
421
+ },
422
+ 'description': 'List of customer addresses'
423
+ }
424
+ },
425
+ 'description': 'Customer object'
426
+ },
427
+ 'payment_method': {
428
+ 'type': 'object',
429
+ 'required': [ 'code' ],
430
+ 'additionalProperties': false,
431
+ 'properties': {
432
+ 'code': {
433
+ 'type': 'string',
434
+ 'enum': [
435
+ 'credit_card',
436
+ 'banking_billet',
437
+ 'online_debit',
438
+ 'account_deposit',
439
+ 'debit_card',
440
+ 'balance_on_intermediary',
441
+ 'loyalty_points',
442
+ 'other'
443
+ ],
444
+ 'description': 'Standardized payment method code'
445
+ },
446
+ 'name': {
447
+ 'type': 'string',
448
+ 'maxLength': 200,
449
+ 'description': 'Short description for payment method'
450
+ }
451
+ },
452
+ 'description': 'Optional payment method selected by customer (if already selected)'
453
+ },
454
+ 'can_fetch_when_selected': {
455
+ 'type': 'boolean',
456
+ 'default': false,
457
+ 'description': 'Whether list payments can be refetched on client when payment selected'
458
+ },
459
+ 'is_checkout_confirmation': {
460
+ 'type': 'boolean',
461
+ 'default': false,
462
+ 'description': 'Whether payment were already chosen and is just being confirmed to complete checkout'
463
+ }
464
+ }
465
+ };
466
+
467
+ exports.params = schema;
468
+
469
+ exports.response = {
470
+ 'description': schema.description,
471
+ 'type': 'object',
472
+ 'required': [ 'payment_gateways' ],
473
+ 'additionalProperties': false,
474
+ 'properties': {
475
+ 'installments_option': {
476
+ 'type': 'object',
477
+ 'required': [ 'max_number' ],
478
+ 'additionalProperties': false,
479
+ 'properties': {
480
+ 'min_installment': {
481
+ 'type': 'number',
482
+ // 'multipleOf': 0.0001,
483
+ 'minimum': -99999999,
484
+ 'maximum': 99999999,
485
+ 'description': 'Minimum installment value'
486
+ },
487
+ 'max_number': {
488
+ 'type': 'integer',
489
+ 'minimum': 2,
490
+ 'maximum': 999,
491
+ 'description': 'Maximum number of installments'
492
+ },
493
+ 'monthly_interest': {
494
+ 'type': 'number',
495
+ // 'multipleOf': 0.0001,
496
+ 'minimum': 0,
497
+ 'maximum': 9999,
498
+ 'default': 0,
499
+ 'description': 'Monthly tax applied, 0 means interest free'
500
+ }
501
+ },
502
+ 'description': 'Optional default installments option'
503
+ },
504
+ 'discount_option': {
505
+ 'type': 'object',
506
+ 'additionalProperties': false,
507
+ 'properties': {
508
+ 'min_amount': {
509
+ 'type': 'integer',
510
+ 'minimum': 1,
511
+ 'maximum': 999999999,
512
+ 'description': 'Minimum amount to apply the discount'
513
+ },
514
+ 'label': {
515
+ 'type': 'string',
516
+ 'maxLength': 50,
517
+ 'description': 'Name of payment method that handle the discount'
518
+ },
519
+ 'apply_at': {
520
+ 'type': 'string',
521
+ 'enum': [ 'total', 'subtotal' ],
522
+ 'default': 'subtotal',
523
+ 'description': 'In which value the discount will be applied at checkout'
524
+ },
525
+ 'type': {
526
+ 'type': 'string',
527
+ 'enum': [ 'percentage', 'fixed' ],
528
+ 'default': 'percentage',
529
+ 'description': 'Discount type'
530
+ },
531
+ 'value': {
532
+ 'type': 'number',
533
+ // 'multipleOf': 0.0001,
534
+ 'default': 0,
535
+ 'minimum': -99999999,
536
+ 'maximum': 99999999,
537
+ 'description': 'Discount value, percentage or fixed'
538
+ }
539
+ },
540
+ 'description': 'Optional default discount option by payment method'
541
+ },
542
+ 'loyalty_points_programs': {
543
+ 'type': 'object',
544
+ 'additionalProperties': false,
545
+ 'maxProperties': 30,
546
+ 'patternProperties': {
547
+ '^[a-z0-9_]{2,30}$': {
548
+ 'type': 'object',
549
+ 'required': [ 'ratio' ],
550
+ 'additionalProperties': false,
551
+ 'properties': {
552
+ 'name': {
553
+ 'type': 'string',
554
+ 'maxLength': 50,
555
+ 'description': 'The name of the loyalty points program'
556
+ },
557
+ 'ratio': {
558
+ 'type': 'number',
559
+ // 'multipleOf': 0.001,
560
+ 'minimum': 0,
561
+ 'maximum': 9999,
562
+ 'description': 'The ratio of a point when converted to currency'
563
+ },
564
+ 'max_points': {
565
+ 'type': 'number',
566
+ // 'multipleOf': 0.00001,
567
+ 'minimum': 0,
568
+ 'maximum': 999999999,
569
+ 'description': 'Maximum number of points to apply'
570
+ },
571
+ 'min_subtotal_to_earn': {
572
+ 'type': 'integer',
573
+ 'minimum': 1,
574
+ 'maximum': 999999999,
575
+ 'description': 'Minimum cart subtotal to earn new points'
576
+ },
577
+ 'earn_percentage': {
578
+ 'type': 'integer',
579
+ 'minimum': 0,
580
+ 'maximum': 100,
581
+ 'description': 'Subtotal percentage that will be converted into new points on purchase'
582
+ }
583
+ },
584
+ 'description': 'Available loyalty points program object'
585
+ }
586
+ },
587
+ 'description': 'Available loyalty point programs, program ID as property'
588
+ },
589
+ 'payment_gateways': {
590
+ 'type': 'array',
591
+ 'maxItems': 30,
592
+ 'items': {
593
+ 'type': 'object',
594
+ 'additionalProperties': false,
595
+ 'required': [ 'label', 'payment_method' ],
596
+ 'properties': {
597
+ 'label': {
598
+ 'type': 'string',
599
+ 'maxLength': 50,
600
+ 'description': 'Name of payment method shown to customers'
601
+ },
602
+ 'text': {
603
+ 'type': 'string',
604
+ 'maxLength': 1000,
605
+ 'description': 'Auxiliary text about the payment method, can contain HTML tags'
606
+ },
607
+ 'icon': {
608
+ 'type': 'string',
609
+ 'maxLength': 255,
610
+ 'format': 'uri',
611
+ 'description': 'Payment icon image URI'
612
+ },
613
+ 'intermediator': {
614
+ 'type': 'object',
615
+ 'additionalProperties': false,
616
+ 'required': [ 'code' ],
617
+ 'properties': {
618
+ 'name': {
619
+ 'type': 'string',
620
+ 'maxLength': 255,
621
+ 'description': 'Name of payment intermediator'
622
+ },
623
+ 'link': {
624
+ 'type': 'string',
625
+ 'maxLength': 255,
626
+ 'format': 'uri',
627
+ 'description': 'URI to intermediator website'
628
+ },
629
+ 'code': {
630
+ 'type': 'string',
631
+ 'minLength': 6,
632
+ 'maxLength': 70,
633
+ 'pattern': '^[a-z0-9_]+$',
634
+ 'description': 'Gateway name standardized as identification code'
635
+ }
636
+ },
637
+ 'description': 'Payment intermediator'
638
+ },
639
+ 'payment_url': {
640
+ 'type': 'string',
641
+ 'maxLength': 255,
642
+ 'format': 'uri',
643
+ 'description': 'Base URI to payments'
644
+ },
645
+ 'type': {
646
+ 'type': 'string',
647
+ 'enum': [ 'payment', 'recurrence' ],
648
+ 'default': 'payment',
649
+ 'description': 'Transaction type'
650
+ },
651
+ 'payment_method': {
652
+ 'type': 'object',
653
+ 'required': [ 'code' ],
654
+ 'additionalProperties': false,
655
+ 'properties': {
656
+ 'code': {
657
+ 'type': 'string',
658
+ 'enum': [
659
+ 'credit_card',
660
+ 'banking_billet',
661
+ 'online_debit',
662
+ 'account_deposit',
663
+ 'debit_card',
664
+ 'balance_on_intermediary',
665
+ 'loyalty_points',
666
+ 'other'
667
+ ],
668
+ 'description': 'Standardized payment method code'
669
+ },
670
+ 'name': {
671
+ 'type': 'string',
672
+ 'maxLength': 200,
673
+ 'description': 'Short description for payment method'
674
+ }
675
+ },
676
+ 'description': 'Payment method object'
677
+ },
678
+ 'discount': {
679
+ 'type': 'object',
680
+ 'additionalProperties': false,
681
+ 'properties': {
682
+ 'apply_at': {
683
+ 'type': 'string',
684
+ 'enum': [ 'total', 'subtotal', 'freight' ],
685
+ 'default': 'subtotal',
686
+ 'description': 'In which value the discount will be applied at checkout'
687
+ },
688
+ 'type': {
689
+ 'type': 'string',
690
+ 'enum': [ 'percentage', 'fixed' ],
691
+ 'default': 'percentage',
692
+ 'description': 'Discount type'
693
+ },
694
+ 'value': {
695
+ 'type': 'number',
696
+ // 'multipleOf': 0.0001,
697
+ 'default': 0,
698
+ 'minimum': -99999999,
699
+ 'maximum': 99999999,
700
+ 'description': 'Discount value, percentage or fixed'
701
+ }
702
+ },
703
+ 'description': 'Discount to be applied by payment method'
704
+ },
705
+ 'card_companies': {
706
+ 'type': 'array',
707
+ 'maxItems': 30,
708
+ 'items': {
709
+ 'type': 'string',
710
+ 'maxLength': 100,
711
+ 'description': 'Credit card issuer name, eg.: Visa, American Express, MasterCard'
712
+ },
713
+ 'description': 'List of accepted card brands'
714
+ },
715
+ 'installment_options': {
716
+ 'type': 'array',
717
+ 'maxItems': 30,
718
+ 'items': {
719
+ 'type': 'object',
720
+ 'required': [ 'number', 'value' ],
721
+ 'additionalProperties': false,
722
+ 'properties': {
723
+ 'number': {
724
+ 'type': 'integer',
725
+ 'minimum': 2,
726
+ 'maximum': 999,
727
+ 'description': 'Number of installments'
728
+ },
729
+ 'value': {
730
+ 'type': 'number',
731
+ // 'multipleOf': 0.00001,
732
+ 'minimum': 0,
733
+ 'maximum': 999999999,
734
+ 'description': 'Installment value'
735
+ },
736
+ 'tax': {
737
+ 'type': 'boolean',
738
+ 'default': false,
739
+ 'description': 'Tax applied'
740
+ }
741
+ },
742
+ 'description': 'Installment option'
743
+ },
744
+ 'description': 'List of options for installment'
745
+ },
746
+ 'js_client': {
747
+ 'type': 'object',
748
+ 'required': [ 'script_uri' ],
749
+ 'additionalProperties': false,
750
+ 'properties': {
751
+ 'script_uri': {
752
+ 'type': 'string',
753
+ 'maxLength': 1000,
754
+ 'format': 'uri',
755
+ 'description': 'Script (JS) link'
756
+ },
757
+ 'fallback_script_uri': {
758
+ 'type': 'string',
759
+ 'maxLength': 1000,
760
+ 'format': 'uri',
761
+ 'description': 'Optional script link to try if the first URI goes offline'
762
+ },
763
+ 'onload_expression': {
764
+ 'type': 'string',
765
+ 'maxLength': 3000,
766
+ 'description': 'JS expression to run (with `eval`) after script load'
767
+ },
768
+ 'container_html': {
769
+ 'type': 'string',
770
+ 'maxLength': 1000,
771
+ 'description': 'Append HTML to render payment iframe/components on checkout'
772
+ },
773
+ 'transaction_promise': {
774
+ 'type': 'string',
775
+ 'maxLength': 50,
776
+ 'description': 'Checkout promise variable (on `window`) resolved with transaction-like object'
777
+ },
778
+ 'cc_hash': {
779
+ 'type': 'object',
780
+ 'required': [ 'function' ],
781
+ 'additionalProperties': false,
782
+ 'properties': {
783
+ 'function': {
784
+ 'type': 'string',
785
+ 'maxLength': 50,
786
+ 'description': 'Func name, receives obj with `name`, `doc`, `number`, `cvc`, `month`, `year`'
787
+ },
788
+ 'is_promise': {
789
+ 'type': 'boolean',
790
+ 'default': false,
791
+ 'description': 'If it is a Promise, use for async process'
792
+ }
793
+ },
794
+ 'description': 'Function to call for credit card hash generation, must return hash string'
795
+ },
796
+ 'cc_installments': {
797
+ 'type': 'object',
798
+ 'required': [ 'function' ],
799
+ 'additionalProperties': false,
800
+ 'properties': {
801
+ 'function': {
802
+ 'type': 'string',
803
+ 'maxLength': 50,
804
+ 'description': 'Func name, receives obj with `number` and `amount` (total)'
805
+ },
806
+ 'is_promise': {
807
+ 'type': 'boolean',
808
+ 'default': false,
809
+ 'description': 'If it is a Promise, use for async process'
810
+ }
811
+ },
812
+ 'description': 'Optional function to get `installment_options` array from card number'
813
+ },
814
+ 'cc_brand': {
815
+ 'type': 'object',
816
+ 'required': [ 'function' ],
817
+ 'additionalProperties': false,
818
+ 'properties': {
819
+ 'function': {
820
+ 'type': 'string',
821
+ 'maxLength': 50,
822
+ 'description': 'Func name, receives obj with `number`'
823
+ },
824
+ 'is_promise': {
825
+ 'type': 'boolean',
826
+ 'default': false,
827
+ 'description': 'If it is a Promise, use for async process'
828
+ }
829
+ },
830
+ 'description': 'Optional function to call for card validation, returns brand name or false'
831
+ }
832
+ },
833
+ 'description': 'Gateway web JS SDK, usually to handle credit cards with encryption'
834
+ },
835
+ 'fetch_when_selected': {
836
+ 'type': 'boolean',
837
+ 'default': false,
838
+ 'description': 'Resend list payments request if this payment gateway is selected'
839
+ }
840
+ },
841
+ 'description': 'Payment option (gateway)'
842
+ },
843
+ 'description': 'Payment gateway options list'
844
+ },
845
+ 'interest_free_installments': {
846
+ 'type': 'integer',
847
+ 'minimum': 2,
848
+ 'maximum': 999,
849
+ 'description': '[DEPRECATED] => use `installments_option` instead'
850
+ }
851
+ }
852
+ };