digital-tools 2.0.2 → 2.1.1

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 (93) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/package.json +3 -4
  3. package/src/define.js +267 -0
  4. package/src/entities/advertising.js +999 -0
  5. package/src/entities/ai.js +756 -0
  6. package/src/entities/analytics.js +1588 -0
  7. package/src/entities/automation.js +601 -0
  8. package/src/entities/communication.js +1150 -0
  9. package/src/entities/crm.js +1386 -0
  10. package/src/entities/design.js +546 -0
  11. package/src/entities/development.js +2212 -0
  12. package/src/entities/document.js +874 -0
  13. package/src/entities/ecommerce.js +1429 -0
  14. package/src/entities/experiment.js +1039 -0
  15. package/src/entities/finance.js +3478 -0
  16. package/src/entities/forms.js +1892 -0
  17. package/src/entities/hr.js +661 -0
  18. package/src/entities/identity.js +997 -0
  19. package/src/entities/index.js +282 -0
  20. package/src/entities/infrastructure.js +1153 -0
  21. package/src/entities/knowledge.js +1438 -0
  22. package/src/entities/marketing.js +1610 -0
  23. package/src/entities/media.js +1634 -0
  24. package/src/entities/notification.js +1199 -0
  25. package/src/entities/presentation.js +1274 -0
  26. package/src/entities/productivity.js +1317 -0
  27. package/src/entities/project-management.js +1136 -0
  28. package/src/entities/recruiting.js +736 -0
  29. package/src/entities/shipping.js +509 -0
  30. package/src/entities/signature.js +1102 -0
  31. package/src/entities/site.js +222 -0
  32. package/src/entities/spreadsheet.js +1341 -0
  33. package/src/entities/storage.js +1198 -0
  34. package/src/entities/support.js +1166 -0
  35. package/src/entities/video-conferencing.js +1750 -0
  36. package/src/entities/video.js +950 -0
  37. package/src/entities.js +1663 -0
  38. package/src/index.js +74 -0
  39. package/src/providers/analytics/index.js +17 -0
  40. package/src/providers/analytics/mixpanel.js +255 -0
  41. package/src/providers/calendar/cal-com.js +303 -0
  42. package/src/providers/calendar/google-calendar.js +335 -0
  43. package/src/providers/calendar/index.js +20 -0
  44. package/src/providers/crm/hubspot.js +566 -0
  45. package/src/providers/crm/index.js +17 -0
  46. package/src/providers/development/github.js +472 -0
  47. package/src/providers/development/index.js +17 -0
  48. package/src/providers/ecommerce/index.js +17 -0
  49. package/src/providers/ecommerce/shopify.js +378 -0
  50. package/src/providers/email/index.js +20 -0
  51. package/src/providers/email/resend.js +258 -0
  52. package/src/providers/email/sendgrid.js +161 -0
  53. package/src/providers/finance/index.js +17 -0
  54. package/src/providers/finance/stripe.js +549 -0
  55. package/src/providers/forms/index.js +17 -0
  56. package/src/providers/forms/typeform.js +500 -0
  57. package/src/providers/index.js +123 -0
  58. package/src/providers/knowledge/index.js +17 -0
  59. package/src/providers/knowledge/notion.js +389 -0
  60. package/src/providers/marketing/index.js +17 -0
  61. package/src/providers/marketing/mailchimp.js +443 -0
  62. package/src/providers/media/cloudinary.js +318 -0
  63. package/src/providers/media/index.js +17 -0
  64. package/src/providers/messaging/index.js +20 -0
  65. package/src/providers/messaging/slack.js +393 -0
  66. package/src/providers/messaging/twilio-sms.js +249 -0
  67. package/src/providers/project-management/index.js +17 -0
  68. package/src/providers/project-management/linear.js +575 -0
  69. package/src/providers/registry.js +86 -0
  70. package/src/providers/spreadsheet/google-sheets.js +375 -0
  71. package/src/providers/spreadsheet/index.js +20 -0
  72. package/src/providers/spreadsheet/xlsx.js +423 -0
  73. package/src/providers/storage/index.js +24 -0
  74. package/src/providers/storage/s3.js +419 -0
  75. package/src/providers/support/index.js +17 -0
  76. package/src/providers/support/zendesk.js +373 -0
  77. package/src/providers/tasks/index.js +17 -0
  78. package/src/providers/tasks/todoist.js +286 -0
  79. package/src/providers/types.js +9 -0
  80. package/src/providers/video-conferencing/google-meet.js +286 -0
  81. package/src/providers/video-conferencing/index.js +31 -0
  82. package/src/providers/video-conferencing/jitsi.js +254 -0
  83. package/src/providers/video-conferencing/teams.js +270 -0
  84. package/src/providers/video-conferencing/zoom.js +332 -0
  85. package/src/registry.js +128 -0
  86. package/src/tools/communication.js +184 -0
  87. package/src/tools/data.js +205 -0
  88. package/src/tools/index.js +11 -0
  89. package/src/tools/web.js +137 -0
  90. package/src/types.js +10 -0
  91. package/test/define.test.js +306 -0
  92. package/test/registry.test.js +357 -0
  93. package/test/tools.test.js +363 -0
@@ -0,0 +1,3478 @@
1
+ /**
2
+ * Finance Entity Types (Nouns) - Stripe API Inspired
3
+ *
4
+ * Semantic type definitions for financial digital tools that can be used by
5
+ * both remote human workers AND AI agents. Each entity defines:
6
+ * - Properties: The data fields
7
+ * - Actions: Operations that can be performed (Verbs)
8
+ * - Events: State changes that occur
9
+ *
10
+ * Heavily influenced by Stripe's API structure and nomenclature.
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ // =============================================================================
15
+ // CORE
16
+ // =============================================================================
17
+ /**
18
+ * Customer entity
19
+ *
20
+ * Represents a customer - person or business making purchases
21
+ */
22
+ export const Customer = {
23
+ singular: 'customer',
24
+ plural: 'customers',
25
+ description: 'A person or business making purchases',
26
+ properties: {
27
+ // Identity
28
+ customerId: {
29
+ type: 'string',
30
+ description: 'Unique customer identifier',
31
+ },
32
+ email: {
33
+ type: 'string',
34
+ optional: true,
35
+ description: 'Customer email address',
36
+ },
37
+ phone: {
38
+ type: 'string',
39
+ optional: true,
40
+ description: 'Customer phone number',
41
+ },
42
+ // Name
43
+ name: {
44
+ type: 'string',
45
+ optional: true,
46
+ description: 'Customer full name',
47
+ },
48
+ description: {
49
+ type: 'string',
50
+ optional: true,
51
+ description: 'Description of the customer',
52
+ },
53
+ // Address
54
+ address: {
55
+ type: 'json',
56
+ optional: true,
57
+ description: 'Customer address',
58
+ },
59
+ shippingAddress: {
60
+ type: 'json',
61
+ optional: true,
62
+ description: 'Shipping address',
63
+ },
64
+ // Balance & Credit
65
+ balance: {
66
+ type: 'number',
67
+ optional: true,
68
+ description: 'Current balance in cents (positive = customer owes, negative = credit)',
69
+ },
70
+ currency: {
71
+ type: 'string',
72
+ optional: true,
73
+ description: 'Currency code (ISO 4217)',
74
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
75
+ },
76
+ // Tax
77
+ taxExempt: {
78
+ type: 'string',
79
+ optional: true,
80
+ description: 'Tax exemption status: none, exempt, reverse',
81
+ examples: ['none', 'exempt', 'reverse'],
82
+ },
83
+ taxIds: {
84
+ type: 'json',
85
+ array: true,
86
+ optional: true,
87
+ description: 'Tax IDs for the customer',
88
+ },
89
+ // Preferences
90
+ preferredLocales: {
91
+ type: 'string',
92
+ array: true,
93
+ optional: true,
94
+ description: 'Preferred locales',
95
+ },
96
+ invoicePrefix: {
97
+ type: 'string',
98
+ optional: true,
99
+ description: 'Prefix for invoice numbers',
100
+ },
101
+ // Status
102
+ delinquent: {
103
+ type: 'boolean',
104
+ optional: true,
105
+ description: 'Whether customer has overdue invoices',
106
+ },
107
+ // Metadata
108
+ metadata: {
109
+ type: 'json',
110
+ optional: true,
111
+ description: 'Additional metadata',
112
+ },
113
+ // Timestamps
114
+ created: {
115
+ type: 'datetime',
116
+ description: 'Time at which the customer was created',
117
+ },
118
+ },
119
+ relationships: {
120
+ defaultPaymentMethod: {
121
+ type: 'PaymentMethod',
122
+ required: false,
123
+ description: 'Default payment method',
124
+ },
125
+ paymentMethods: {
126
+ type: 'PaymentMethod[]',
127
+ description: 'Payment methods on file',
128
+ },
129
+ invoices: {
130
+ type: 'Invoice[]',
131
+ backref: 'customer',
132
+ description: 'Customer invoices',
133
+ },
134
+ subscriptions: {
135
+ type: 'Subscription[]',
136
+ backref: 'customer',
137
+ description: 'Customer subscriptions',
138
+ },
139
+ charges: {
140
+ type: 'Charge[]',
141
+ description: 'Charges for this customer',
142
+ },
143
+ balanceTransactions: {
144
+ type: 'BalanceTransaction[]',
145
+ description: 'Balance transactions',
146
+ },
147
+ },
148
+ actions: [
149
+ 'create',
150
+ 'update',
151
+ 'delete',
152
+ 'list',
153
+ 'retrieve',
154
+ 'search',
155
+ 'createBalanceTransaction',
156
+ 'listBalanceTransactions',
157
+ 'updateBalance',
158
+ ],
159
+ events: [
160
+ 'customer.created',
161
+ 'customer.updated',
162
+ 'customer.deleted',
163
+ 'customer.balance.updated',
164
+ ],
165
+ };
166
+ /**
167
+ * Product entity
168
+ *
169
+ * Represents goods or services for sale
170
+ */
171
+ export const Product = {
172
+ singular: 'product',
173
+ plural: 'products',
174
+ description: 'Goods or services for sale',
175
+ properties: {
176
+ // Identity
177
+ productId: {
178
+ type: 'string',
179
+ description: 'Unique product identifier',
180
+ },
181
+ name: {
182
+ type: 'string',
183
+ description: 'Product name',
184
+ },
185
+ description: {
186
+ type: 'string',
187
+ optional: true,
188
+ description: 'Product description',
189
+ },
190
+ // Status
191
+ active: {
192
+ type: 'boolean',
193
+ description: 'Whether product is available for purchase',
194
+ },
195
+ // Classification
196
+ type: {
197
+ type: 'string',
198
+ optional: true,
199
+ description: 'Product type: service or good',
200
+ examples: ['service', 'good'],
201
+ },
202
+ unitLabel: {
203
+ type: 'string',
204
+ optional: true,
205
+ description: 'Unit label (e.g., "per seat", "per GB")',
206
+ },
207
+ // Display
208
+ images: {
209
+ type: 'url',
210
+ array: true,
211
+ optional: true,
212
+ description: 'Product images',
213
+ },
214
+ url: {
215
+ type: 'url',
216
+ optional: true,
217
+ description: 'Product URL',
218
+ },
219
+ // Features
220
+ features: {
221
+ type: 'json',
222
+ array: true,
223
+ optional: true,
224
+ description: 'Product features',
225
+ },
226
+ // Tax
227
+ taxCode: {
228
+ type: 'string',
229
+ optional: true,
230
+ description: 'Tax code for product',
231
+ },
232
+ // Metadata
233
+ metadata: {
234
+ type: 'json',
235
+ optional: true,
236
+ description: 'Additional metadata',
237
+ },
238
+ // Timestamps
239
+ created: {
240
+ type: 'datetime',
241
+ description: 'Time at which the product was created',
242
+ },
243
+ updated: {
244
+ type: 'datetime',
245
+ optional: true,
246
+ description: 'Time at which the product was last updated',
247
+ },
248
+ },
249
+ relationships: {
250
+ prices: {
251
+ type: 'Price[]',
252
+ backref: 'product',
253
+ description: 'Prices for this product',
254
+ },
255
+ defaultPrice: {
256
+ type: 'Price',
257
+ required: false,
258
+ description: 'Default price',
259
+ },
260
+ },
261
+ actions: [
262
+ 'create',
263
+ 'update',
264
+ 'delete',
265
+ 'list',
266
+ 'retrieve',
267
+ 'search',
268
+ ],
269
+ events: [
270
+ 'product.created',
271
+ 'product.updated',
272
+ 'product.deleted',
273
+ ],
274
+ };
275
+ /**
276
+ * Price entity
277
+ *
278
+ * Represents pricing configuration (one-time or recurring)
279
+ */
280
+ export const Price = {
281
+ singular: 'price',
282
+ plural: 'prices',
283
+ description: 'Pricing configuration for a product',
284
+ properties: {
285
+ // Identity
286
+ priceId: {
287
+ type: 'string',
288
+ description: 'Unique price identifier',
289
+ },
290
+ nickname: {
291
+ type: 'string',
292
+ optional: true,
293
+ description: 'Price nickname',
294
+ },
295
+ // Status
296
+ active: {
297
+ type: 'boolean',
298
+ description: 'Whether price is available for new purchases',
299
+ },
300
+ // Type
301
+ type: {
302
+ type: 'string',
303
+ description: 'Pricing type: one_time or recurring',
304
+ examples: ['one_time', 'recurring'],
305
+ },
306
+ // Amount
307
+ unitAmount: {
308
+ type: 'number',
309
+ optional: true,
310
+ description: 'Unit price in cents',
311
+ },
312
+ unitAmountDecimal: {
313
+ type: 'string',
314
+ optional: true,
315
+ description: 'Unit price as decimal string for precision',
316
+ },
317
+ currency: {
318
+ type: 'string',
319
+ description: 'Currency code (ISO 4217)',
320
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
321
+ },
322
+ // Billing Scheme
323
+ billingScheme: {
324
+ type: 'string',
325
+ optional: true,
326
+ description: 'Billing scheme: per_unit or tiered',
327
+ examples: ['per_unit', 'tiered'],
328
+ },
329
+ tiers: {
330
+ type: 'json',
331
+ array: true,
332
+ optional: true,
333
+ description: 'Pricing tiers (for tiered billing)',
334
+ },
335
+ tiersMode: {
336
+ type: 'string',
337
+ optional: true,
338
+ description: 'Tiers mode: graduated or volume',
339
+ examples: ['graduated', 'volume'],
340
+ },
341
+ // Recurring Details
342
+ recurring: {
343
+ type: 'json',
344
+ optional: true,
345
+ description: 'Recurring pricing details (interval, interval_count, usage_type, aggregate_usage)',
346
+ },
347
+ // Transform Quantity
348
+ transformQuantity: {
349
+ type: 'json',
350
+ optional: true,
351
+ description: 'Transform quantity settings',
352
+ },
353
+ // Tax
354
+ taxBehavior: {
355
+ type: 'string',
356
+ optional: true,
357
+ description: 'Tax behavior: inclusive, exclusive, unspecified',
358
+ examples: ['inclusive', 'exclusive', 'unspecified'],
359
+ },
360
+ // Metadata
361
+ metadata: {
362
+ type: 'json',
363
+ optional: true,
364
+ description: 'Additional metadata',
365
+ },
366
+ // Timestamps
367
+ created: {
368
+ type: 'datetime',
369
+ description: 'Time at which the price was created',
370
+ },
371
+ },
372
+ relationships: {
373
+ product: {
374
+ type: 'Product',
375
+ backref: 'prices',
376
+ description: 'Product this price belongs to',
377
+ },
378
+ },
379
+ actions: [
380
+ 'create',
381
+ 'update',
382
+ 'list',
383
+ 'retrieve',
384
+ 'search',
385
+ ],
386
+ events: [
387
+ 'price.created',
388
+ 'price.updated',
389
+ 'price.deleted',
390
+ ],
391
+ };
392
+ // =============================================================================
393
+ // PAYMENTS
394
+ // =============================================================================
395
+ /**
396
+ * PaymentMethod entity
397
+ *
398
+ * Represents a payment method (card, bank account, etc.)
399
+ */
400
+ export const PaymentMethod = {
401
+ singular: 'payment method',
402
+ plural: 'payment methods',
403
+ description: 'A payment method such as card or bank account',
404
+ properties: {
405
+ // Identity
406
+ paymentMethodId: {
407
+ type: 'string',
408
+ description: 'Unique payment method identifier',
409
+ },
410
+ // Type
411
+ type: {
412
+ type: 'string',
413
+ description: 'Payment method type: card, us_bank_account, sepa_debit, etc.',
414
+ examples: ['card', 'us_bank_account', 'sepa_debit', 'acss_debit', 'alipay', 'wechat_pay'],
415
+ },
416
+ // Card Details
417
+ card: {
418
+ type: 'json',
419
+ optional: true,
420
+ description: 'Card details (brand, last4, exp_month, exp_year, etc.)',
421
+ },
422
+ // Bank Account Details
423
+ usBankAccount: {
424
+ type: 'json',
425
+ optional: true,
426
+ description: 'US bank account details',
427
+ },
428
+ sepaDebit: {
429
+ type: 'json',
430
+ optional: true,
431
+ description: 'SEPA debit details',
432
+ },
433
+ // Billing Details
434
+ billingDetails: {
435
+ type: 'json',
436
+ optional: true,
437
+ description: 'Billing details (name, email, phone, address)',
438
+ },
439
+ // Metadata
440
+ metadata: {
441
+ type: 'json',
442
+ optional: true,
443
+ description: 'Additional metadata',
444
+ },
445
+ // Timestamps
446
+ created: {
447
+ type: 'datetime',
448
+ description: 'Time at which the payment method was created',
449
+ },
450
+ },
451
+ relationships: {
452
+ customer: {
453
+ type: 'Customer',
454
+ required: false,
455
+ description: 'Customer this payment method belongs to',
456
+ },
457
+ },
458
+ actions: [
459
+ 'create',
460
+ 'update',
461
+ 'attach',
462
+ 'detach',
463
+ 'list',
464
+ 'retrieve',
465
+ ],
466
+ events: [
467
+ 'payment_method.attached',
468
+ 'payment_method.detached',
469
+ 'payment_method.updated',
470
+ 'payment_method.automatically_updated',
471
+ ],
472
+ };
473
+ /**
474
+ * PaymentIntent entity
475
+ *
476
+ * Represents an intent to collect payment
477
+ */
478
+ export const PaymentIntent = {
479
+ singular: 'payment intent',
480
+ plural: 'payment intents',
481
+ description: 'An intent to collect payment from a customer',
482
+ properties: {
483
+ // Identity
484
+ paymentIntentId: {
485
+ type: 'string',
486
+ description: 'Unique payment intent identifier',
487
+ },
488
+ clientSecret: {
489
+ type: 'string',
490
+ optional: true,
491
+ description: 'Client secret for completing payment',
492
+ },
493
+ // Amount
494
+ amount: {
495
+ type: 'number',
496
+ description: 'Amount in cents',
497
+ },
498
+ amountCapturable: {
499
+ type: 'number',
500
+ optional: true,
501
+ description: 'Amount capturable in cents',
502
+ },
503
+ amountReceived: {
504
+ type: 'number',
505
+ optional: true,
506
+ description: 'Amount received in cents',
507
+ },
508
+ currency: {
509
+ type: 'string',
510
+ description: 'Currency code (ISO 4217)',
511
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
512
+ },
513
+ // Status
514
+ status: {
515
+ type: 'string',
516
+ description: 'Status: requires_payment_method, requires_confirmation, requires_action, processing, succeeded, canceled',
517
+ examples: ['requires_payment_method', 'requires_confirmation', 'requires_action', 'processing', 'succeeded', 'canceled'],
518
+ },
519
+ cancellationReason: {
520
+ type: 'string',
521
+ optional: true,
522
+ description: 'Cancellation reason',
523
+ },
524
+ // Capture
525
+ captureMethod: {
526
+ type: 'string',
527
+ optional: true,
528
+ description: 'Capture method: automatic or manual',
529
+ examples: ['automatic', 'manual'],
530
+ },
531
+ // Confirmation
532
+ confirmationMethod: {
533
+ type: 'string',
534
+ optional: true,
535
+ description: 'Confirmation method: automatic or manual',
536
+ examples: ['automatic', 'manual'],
537
+ },
538
+ // Description
539
+ description: {
540
+ type: 'string',
541
+ optional: true,
542
+ description: 'Description of payment',
543
+ },
544
+ statementDescriptor: {
545
+ type: 'string',
546
+ optional: true,
547
+ description: 'Statement descriptor',
548
+ },
549
+ // Receipt
550
+ receiptEmail: {
551
+ type: 'string',
552
+ optional: true,
553
+ description: 'Email to send receipt to',
554
+ },
555
+ // Setup Future Usage
556
+ setupFutureUsage: {
557
+ type: 'string',
558
+ optional: true,
559
+ description: 'Setup for future usage: on_session or off_session',
560
+ examples: ['on_session', 'off_session'],
561
+ },
562
+ // Metadata
563
+ metadata: {
564
+ type: 'json',
565
+ optional: true,
566
+ description: 'Additional metadata',
567
+ },
568
+ // Timestamps
569
+ created: {
570
+ type: 'datetime',
571
+ description: 'Time at which the payment intent was created',
572
+ },
573
+ canceledAt: {
574
+ type: 'datetime',
575
+ optional: true,
576
+ description: 'Time at which the payment intent was canceled',
577
+ },
578
+ },
579
+ relationships: {
580
+ customer: {
581
+ type: 'Customer',
582
+ required: false,
583
+ description: 'Customer making the payment',
584
+ },
585
+ paymentMethod: {
586
+ type: 'PaymentMethod',
587
+ required: false,
588
+ description: 'Payment method used',
589
+ },
590
+ invoice: {
591
+ type: 'Invoice',
592
+ required: false,
593
+ description: 'Invoice this payment is for',
594
+ },
595
+ charges: {
596
+ type: 'Charge[]',
597
+ description: 'Charges created by this payment intent',
598
+ },
599
+ },
600
+ actions: [
601
+ 'create',
602
+ 'update',
603
+ 'confirm',
604
+ 'capture',
605
+ 'cancel',
606
+ 'list',
607
+ 'retrieve',
608
+ ],
609
+ events: [
610
+ 'payment_intent.created',
611
+ 'payment_intent.succeeded',
612
+ 'payment_intent.canceled',
613
+ 'payment_intent.processing',
614
+ 'payment_intent.payment_failed',
615
+ 'payment_intent.amount_capturable_updated',
616
+ ],
617
+ };
618
+ /**
619
+ * Charge entity
620
+ *
621
+ * Represents a charge attempt
622
+ */
623
+ export const Charge = {
624
+ singular: 'charge',
625
+ plural: 'charges',
626
+ description: 'A charge attempt on a payment source',
627
+ properties: {
628
+ // Identity
629
+ chargeId: {
630
+ type: 'string',
631
+ description: 'Unique charge identifier',
632
+ },
633
+ // Amount
634
+ amount: {
635
+ type: 'number',
636
+ description: 'Amount charged in cents',
637
+ },
638
+ amountCaptured: {
639
+ type: 'number',
640
+ optional: true,
641
+ description: 'Amount captured in cents',
642
+ },
643
+ amountRefunded: {
644
+ type: 'number',
645
+ optional: true,
646
+ description: 'Amount refunded in cents',
647
+ },
648
+ currency: {
649
+ type: 'string',
650
+ description: 'Currency code (ISO 4217)',
651
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
652
+ },
653
+ // Status
654
+ status: {
655
+ type: 'string',
656
+ description: 'Status: succeeded, pending, failed',
657
+ examples: ['succeeded', 'pending', 'failed'],
658
+ },
659
+ paid: {
660
+ type: 'boolean',
661
+ description: 'Whether charge was paid',
662
+ },
663
+ refunded: {
664
+ type: 'boolean',
665
+ optional: true,
666
+ description: 'Whether charge was refunded',
667
+ },
668
+ captured: {
669
+ type: 'boolean',
670
+ optional: true,
671
+ description: 'Whether charge was captured',
672
+ },
673
+ // Description
674
+ description: {
675
+ type: 'string',
676
+ optional: true,
677
+ description: 'Charge description',
678
+ },
679
+ statementDescriptor: {
680
+ type: 'string',
681
+ optional: true,
682
+ description: 'Statement descriptor',
683
+ },
684
+ // Receipt
685
+ receiptEmail: {
686
+ type: 'string',
687
+ optional: true,
688
+ description: 'Email receipt was sent to',
689
+ },
690
+ receiptNumber: {
691
+ type: 'string',
692
+ optional: true,
693
+ description: 'Receipt number',
694
+ },
695
+ receiptUrl: {
696
+ type: 'url',
697
+ optional: true,
698
+ description: 'Receipt URL',
699
+ },
700
+ // Failure
701
+ failureCode: {
702
+ type: 'string',
703
+ optional: true,
704
+ description: 'Failure code',
705
+ },
706
+ failureMessage: {
707
+ type: 'string',
708
+ optional: true,
709
+ description: 'Failure message',
710
+ },
711
+ // Payment Details
712
+ paymentMethodDetails: {
713
+ type: 'json',
714
+ optional: true,
715
+ description: 'Payment method details',
716
+ },
717
+ // Fraud Detection
718
+ fraudDetails: {
719
+ type: 'json',
720
+ optional: true,
721
+ description: 'Fraud detection details',
722
+ },
723
+ // Metadata
724
+ metadata: {
725
+ type: 'json',
726
+ optional: true,
727
+ description: 'Additional metadata',
728
+ },
729
+ // Timestamps
730
+ created: {
731
+ type: 'datetime',
732
+ description: 'Time at which the charge was created',
733
+ },
734
+ },
735
+ relationships: {
736
+ customer: {
737
+ type: 'Customer',
738
+ required: false,
739
+ description: 'Customer charged',
740
+ },
741
+ paymentIntent: {
742
+ type: 'PaymentIntent',
743
+ required: false,
744
+ description: 'Payment intent that created this charge',
745
+ },
746
+ paymentMethod: {
747
+ type: 'PaymentMethod',
748
+ required: false,
749
+ description: 'Payment method used',
750
+ },
751
+ invoice: {
752
+ type: 'Invoice',
753
+ required: false,
754
+ description: 'Invoice this charge is for',
755
+ },
756
+ refunds: {
757
+ type: 'Refund[]',
758
+ backref: 'charge',
759
+ description: 'Refunds for this charge',
760
+ },
761
+ balanceTransaction: {
762
+ type: 'BalanceTransaction',
763
+ required: false,
764
+ description: 'Balance transaction',
765
+ },
766
+ },
767
+ actions: [
768
+ 'create',
769
+ 'update',
770
+ 'capture',
771
+ 'list',
772
+ 'retrieve',
773
+ ],
774
+ events: [
775
+ 'charge.succeeded',
776
+ 'charge.failed',
777
+ 'charge.pending',
778
+ 'charge.captured',
779
+ 'charge.updated',
780
+ 'charge.refunded',
781
+ 'charge.dispute.created',
782
+ 'charge.dispute.updated',
783
+ 'charge.dispute.closed',
784
+ ],
785
+ };
786
+ /**
787
+ * Refund entity
788
+ *
789
+ * Represents a refund of a charge
790
+ */
791
+ export const Refund = {
792
+ singular: 'refund',
793
+ plural: 'refunds',
794
+ description: 'A refund of a charge',
795
+ properties: {
796
+ // Identity
797
+ refundId: {
798
+ type: 'string',
799
+ description: 'Unique refund identifier',
800
+ },
801
+ // Amount
802
+ amount: {
803
+ type: 'number',
804
+ description: 'Amount refunded in cents',
805
+ },
806
+ currency: {
807
+ type: 'string',
808
+ description: 'Currency code (ISO 4217)',
809
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
810
+ },
811
+ // Status
812
+ status: {
813
+ type: 'string',
814
+ optional: true,
815
+ description: 'Status: succeeded, failed, pending, canceled',
816
+ examples: ['succeeded', 'failed', 'pending', 'canceled'],
817
+ },
818
+ // Reason
819
+ reason: {
820
+ type: 'string',
821
+ optional: true,
822
+ description: 'Reason: duplicate, fraudulent, requested_by_customer',
823
+ examples: ['duplicate', 'fraudulent', 'requested_by_customer'],
824
+ },
825
+ // Receipt
826
+ receiptNumber: {
827
+ type: 'string',
828
+ optional: true,
829
+ description: 'Receipt number',
830
+ },
831
+ // Failure
832
+ failureReason: {
833
+ type: 'string',
834
+ optional: true,
835
+ description: 'Failure reason',
836
+ },
837
+ // Metadata
838
+ metadata: {
839
+ type: 'json',
840
+ optional: true,
841
+ description: 'Additional metadata',
842
+ },
843
+ // Timestamps
844
+ created: {
845
+ type: 'datetime',
846
+ description: 'Time at which the refund was created',
847
+ },
848
+ },
849
+ relationships: {
850
+ charge: {
851
+ type: 'Charge',
852
+ backref: 'refunds',
853
+ description: 'Charge that was refunded',
854
+ },
855
+ paymentIntent: {
856
+ type: 'PaymentIntent',
857
+ required: false,
858
+ description: 'Payment intent that was refunded',
859
+ },
860
+ balanceTransaction: {
861
+ type: 'BalanceTransaction',
862
+ required: false,
863
+ description: 'Balance transaction',
864
+ },
865
+ },
866
+ actions: [
867
+ 'create',
868
+ 'update',
869
+ 'cancel',
870
+ 'list',
871
+ 'retrieve',
872
+ ],
873
+ events: [
874
+ 'charge.refund.updated',
875
+ ],
876
+ };
877
+ // =============================================================================
878
+ // BILLING
879
+ // =============================================================================
880
+ /**
881
+ * Invoice entity
882
+ *
883
+ * Represents a statement of amounts owed
884
+ */
885
+ export const Invoice = {
886
+ singular: 'invoice',
887
+ plural: 'invoices',
888
+ description: 'A statement of amounts owed by a customer',
889
+ properties: {
890
+ // Identity
891
+ invoiceId: {
892
+ type: 'string',
893
+ description: 'Unique invoice identifier',
894
+ },
895
+ number: {
896
+ type: 'string',
897
+ optional: true,
898
+ description: 'Invoice number',
899
+ },
900
+ // Status
901
+ status: {
902
+ type: 'string',
903
+ optional: true,
904
+ description: 'Status: draft, open, paid, void, uncollectible',
905
+ examples: ['draft', 'open', 'paid', 'void', 'uncollectible'],
906
+ },
907
+ // Amount
908
+ amountDue: {
909
+ type: 'number',
910
+ optional: true,
911
+ description: 'Amount due in cents',
912
+ },
913
+ amountPaid: {
914
+ type: 'number',
915
+ optional: true,
916
+ description: 'Amount paid in cents',
917
+ },
918
+ amountRemaining: {
919
+ type: 'number',
920
+ optional: true,
921
+ description: 'Amount remaining in cents',
922
+ },
923
+ subtotal: {
924
+ type: 'number',
925
+ optional: true,
926
+ description: 'Subtotal before discounts and tax',
927
+ },
928
+ total: {
929
+ type: 'number',
930
+ optional: true,
931
+ description: 'Total amount',
932
+ },
933
+ tax: {
934
+ type: 'number',
935
+ optional: true,
936
+ description: 'Tax amount',
937
+ },
938
+ currency: {
939
+ type: 'string',
940
+ description: 'Currency code (ISO 4217)',
941
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
942
+ },
943
+ // Description
944
+ description: {
945
+ type: 'string',
946
+ optional: true,
947
+ description: 'Invoice description',
948
+ },
949
+ footer: {
950
+ type: 'string',
951
+ optional: true,
952
+ description: 'Invoice footer',
953
+ },
954
+ // Collection
955
+ collectionMethod: {
956
+ type: 'string',
957
+ optional: true,
958
+ description: 'Collection method: charge_automatically or send_invoice',
959
+ examples: ['charge_automatically', 'send_invoice'],
960
+ },
961
+ attemptCount: {
962
+ type: 'number',
963
+ optional: true,
964
+ description: 'Number of payment attempts',
965
+ },
966
+ attempted: {
967
+ type: 'boolean',
968
+ optional: true,
969
+ description: 'Whether payment was attempted',
970
+ },
971
+ // Dates
972
+ created: {
973
+ type: 'datetime',
974
+ description: 'Time at which the invoice was created',
975
+ },
976
+ dueDate: {
977
+ type: 'datetime',
978
+ optional: true,
979
+ description: 'Date payment is due',
980
+ },
981
+ periodStart: {
982
+ type: 'datetime',
983
+ optional: true,
984
+ description: 'Start of billing period',
985
+ },
986
+ periodEnd: {
987
+ type: 'datetime',
988
+ optional: true,
989
+ description: 'End of billing period',
990
+ },
991
+ // Payment
992
+ paid: {
993
+ type: 'boolean',
994
+ optional: true,
995
+ description: 'Whether invoice has been paid',
996
+ },
997
+ paidAt: {
998
+ type: 'datetime',
999
+ optional: true,
1000
+ description: 'Time at which payment occurred',
1001
+ },
1002
+ // Invoice PDF
1003
+ invoicePdf: {
1004
+ type: 'url',
1005
+ optional: true,
1006
+ description: 'URL to invoice PDF',
1007
+ },
1008
+ hostedInvoiceUrl: {
1009
+ type: 'url',
1010
+ optional: true,
1011
+ description: 'URL to hosted invoice page',
1012
+ },
1013
+ // Auto Advance
1014
+ autoAdvance: {
1015
+ type: 'boolean',
1016
+ optional: true,
1017
+ description: 'Whether to auto-finalize draft after period end',
1018
+ },
1019
+ // Metadata
1020
+ metadata: {
1021
+ type: 'json',
1022
+ optional: true,
1023
+ description: 'Additional metadata',
1024
+ },
1025
+ },
1026
+ relationships: {
1027
+ customer: {
1028
+ type: 'Customer',
1029
+ backref: 'invoices',
1030
+ description: 'Customer being invoiced',
1031
+ },
1032
+ subscription: {
1033
+ type: 'Subscription',
1034
+ required: false,
1035
+ description: 'Subscription this invoice is for',
1036
+ },
1037
+ lines: {
1038
+ type: 'InvoiceLineItem[]',
1039
+ backref: 'invoice',
1040
+ description: 'Line items',
1041
+ },
1042
+ charge: {
1043
+ type: 'Charge',
1044
+ required: false,
1045
+ description: 'Latest charge for this invoice',
1046
+ },
1047
+ paymentIntent: {
1048
+ type: 'PaymentIntent',
1049
+ required: false,
1050
+ description: 'Payment intent for this invoice',
1051
+ },
1052
+ defaultPaymentMethod: {
1053
+ type: 'PaymentMethod',
1054
+ required: false,
1055
+ description: 'Default payment method',
1056
+ },
1057
+ quote: {
1058
+ type: 'Quote',
1059
+ required: false,
1060
+ description: 'Quote this invoice was created from',
1061
+ },
1062
+ },
1063
+ actions: [
1064
+ 'create',
1065
+ 'update',
1066
+ 'delete',
1067
+ 'finalize',
1068
+ 'pay',
1069
+ 'send',
1070
+ 'voidInvoice',
1071
+ 'markUncollectible',
1072
+ 'list',
1073
+ 'retrieve',
1074
+ 'upcomingInvoice',
1075
+ ],
1076
+ events: [
1077
+ 'invoice.created',
1078
+ 'invoice.updated',
1079
+ 'invoice.deleted',
1080
+ 'invoice.finalized',
1081
+ 'invoice.paid',
1082
+ 'invoice.payment_failed',
1083
+ 'invoice.payment_action_required',
1084
+ 'invoice.sent',
1085
+ 'invoice.voided',
1086
+ 'invoice.marked_uncollectible',
1087
+ ],
1088
+ };
1089
+ /**
1090
+ * InvoiceLineItem entity
1091
+ *
1092
+ * Represents a line item on an invoice
1093
+ */
1094
+ export const InvoiceLineItem = {
1095
+ singular: 'invoice line item',
1096
+ plural: 'invoice line items',
1097
+ description: 'A line item on an invoice',
1098
+ properties: {
1099
+ // Identity
1100
+ lineItemId: {
1101
+ type: 'string',
1102
+ description: 'Unique line item identifier',
1103
+ },
1104
+ // Type
1105
+ type: {
1106
+ type: 'string',
1107
+ optional: true,
1108
+ description: 'Type: invoiceitem or subscription',
1109
+ examples: ['invoiceitem', 'subscription'],
1110
+ },
1111
+ // Amount
1112
+ amount: {
1113
+ type: 'number',
1114
+ description: 'Amount in cents',
1115
+ },
1116
+ currency: {
1117
+ type: 'string',
1118
+ description: 'Currency code (ISO 4217)',
1119
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
1120
+ },
1121
+ // Description
1122
+ description: {
1123
+ type: 'string',
1124
+ optional: true,
1125
+ description: 'Line item description',
1126
+ },
1127
+ // Quantity
1128
+ quantity: {
1129
+ type: 'number',
1130
+ optional: true,
1131
+ description: 'Quantity',
1132
+ },
1133
+ // Unit Amount
1134
+ unitAmount: {
1135
+ type: 'number',
1136
+ optional: true,
1137
+ description: 'Unit amount in cents',
1138
+ },
1139
+ unitAmountExcludingTax: {
1140
+ type: 'number',
1141
+ optional: true,
1142
+ description: 'Unit amount excluding tax',
1143
+ },
1144
+ // Period
1145
+ period: {
1146
+ type: 'json',
1147
+ optional: true,
1148
+ description: 'Period this line item covers',
1149
+ },
1150
+ // Proration
1151
+ proration: {
1152
+ type: 'boolean',
1153
+ optional: true,
1154
+ description: 'Whether this is a proration',
1155
+ },
1156
+ // Metadata
1157
+ metadata: {
1158
+ type: 'json',
1159
+ optional: true,
1160
+ description: 'Additional metadata',
1161
+ },
1162
+ },
1163
+ relationships: {
1164
+ invoice: {
1165
+ type: 'Invoice',
1166
+ backref: 'lines',
1167
+ description: 'Invoice this line item belongs to',
1168
+ },
1169
+ price: {
1170
+ type: 'Price',
1171
+ required: false,
1172
+ description: 'Price for this line item',
1173
+ },
1174
+ subscription: {
1175
+ type: 'Subscription',
1176
+ required: false,
1177
+ description: 'Subscription this line item is for',
1178
+ },
1179
+ subscriptionItem: {
1180
+ type: 'SubscriptionItem',
1181
+ required: false,
1182
+ description: 'Subscription item',
1183
+ },
1184
+ },
1185
+ actions: [
1186
+ 'create',
1187
+ 'update',
1188
+ 'delete',
1189
+ 'list',
1190
+ 'retrieve',
1191
+ ],
1192
+ events: [],
1193
+ };
1194
+ /**
1195
+ * Subscription entity
1196
+ *
1197
+ * Represents a recurring payment arrangement
1198
+ */
1199
+ export const Subscription = {
1200
+ singular: 'subscription',
1201
+ plural: 'subscriptions',
1202
+ description: 'A recurring payment arrangement',
1203
+ properties: {
1204
+ // Identity
1205
+ subscriptionId: {
1206
+ type: 'string',
1207
+ description: 'Unique subscription identifier',
1208
+ },
1209
+ // Status
1210
+ status: {
1211
+ type: 'string',
1212
+ description: 'Status: incomplete, incomplete_expired, trialing, active, past_due, canceled, unpaid, paused',
1213
+ examples: ['incomplete', 'incomplete_expired', 'trialing', 'active', 'past_due', 'canceled', 'unpaid', 'paused'],
1214
+ },
1215
+ // Collection
1216
+ collectionMethod: {
1217
+ type: 'string',
1218
+ optional: true,
1219
+ description: 'Collection method: charge_automatically or send_invoice',
1220
+ examples: ['charge_automatically', 'send_invoice'],
1221
+ },
1222
+ // Billing
1223
+ billingCycleAnchor: {
1224
+ type: 'datetime',
1225
+ optional: true,
1226
+ description: 'Billing cycle anchor',
1227
+ },
1228
+ currentPeriodStart: {
1229
+ type: 'datetime',
1230
+ optional: true,
1231
+ description: 'Start of current period',
1232
+ },
1233
+ currentPeriodEnd: {
1234
+ type: 'datetime',
1235
+ optional: true,
1236
+ description: 'End of current period',
1237
+ },
1238
+ // Cancellation
1239
+ cancelAtPeriodEnd: {
1240
+ type: 'boolean',
1241
+ optional: true,
1242
+ description: 'Whether to cancel at period end',
1243
+ },
1244
+ canceledAt: {
1245
+ type: 'datetime',
1246
+ optional: true,
1247
+ description: 'Time subscription was canceled',
1248
+ },
1249
+ cancelAt: {
1250
+ type: 'datetime',
1251
+ optional: true,
1252
+ description: 'Time to cancel subscription',
1253
+ },
1254
+ // Trial
1255
+ trialStart: {
1256
+ type: 'datetime',
1257
+ optional: true,
1258
+ description: 'Start of trial period',
1259
+ },
1260
+ trialEnd: {
1261
+ type: 'datetime',
1262
+ optional: true,
1263
+ description: 'End of trial period',
1264
+ },
1265
+ // Dates
1266
+ created: {
1267
+ type: 'datetime',
1268
+ description: 'Time at which the subscription was created',
1269
+ },
1270
+ startDate: {
1271
+ type: 'datetime',
1272
+ optional: true,
1273
+ description: 'Subscription start date',
1274
+ },
1275
+ endedAt: {
1276
+ type: 'datetime',
1277
+ optional: true,
1278
+ description: 'Time subscription ended',
1279
+ },
1280
+ // Days Until Due
1281
+ daysUntilDue: {
1282
+ type: 'number',
1283
+ optional: true,
1284
+ description: 'Days until payment is due',
1285
+ },
1286
+ // Discount
1287
+ discount: {
1288
+ type: 'json',
1289
+ optional: true,
1290
+ description: 'Discount applied to subscription',
1291
+ },
1292
+ // Description
1293
+ description: {
1294
+ type: 'string',
1295
+ optional: true,
1296
+ description: 'Subscription description',
1297
+ },
1298
+ // Metadata
1299
+ metadata: {
1300
+ type: 'json',
1301
+ optional: true,
1302
+ description: 'Additional metadata',
1303
+ },
1304
+ },
1305
+ relationships: {
1306
+ customer: {
1307
+ type: 'Customer',
1308
+ backref: 'subscriptions',
1309
+ description: 'Customer subscribed',
1310
+ },
1311
+ items: {
1312
+ type: 'SubscriptionItem[]',
1313
+ backref: 'subscription',
1314
+ description: 'Subscription items',
1315
+ },
1316
+ defaultPaymentMethod: {
1317
+ type: 'PaymentMethod',
1318
+ required: false,
1319
+ description: 'Default payment method',
1320
+ },
1321
+ latestInvoice: {
1322
+ type: 'Invoice',
1323
+ required: false,
1324
+ description: 'Latest invoice',
1325
+ },
1326
+ },
1327
+ actions: [
1328
+ 'create',
1329
+ 'update',
1330
+ 'cancel',
1331
+ 'resume',
1332
+ 'pause',
1333
+ 'list',
1334
+ 'retrieve',
1335
+ 'search',
1336
+ ],
1337
+ events: [
1338
+ 'customer.subscription.created',
1339
+ 'customer.subscription.updated',
1340
+ 'customer.subscription.deleted',
1341
+ 'customer.subscription.paused',
1342
+ 'customer.subscription.resumed',
1343
+ 'customer.subscription.trial_will_end',
1344
+ ],
1345
+ };
1346
+ /**
1347
+ * SubscriptionItem entity
1348
+ *
1349
+ * Represents an item in a subscription
1350
+ */
1351
+ export const SubscriptionItem = {
1352
+ singular: 'subscription item',
1353
+ plural: 'subscription items',
1354
+ description: 'An item in a subscription',
1355
+ properties: {
1356
+ // Identity
1357
+ subscriptionItemId: {
1358
+ type: 'string',
1359
+ description: 'Unique subscription item identifier',
1360
+ },
1361
+ // Billing Thresholds
1362
+ billingThresholds: {
1363
+ type: 'json',
1364
+ optional: true,
1365
+ description: 'Billing thresholds',
1366
+ },
1367
+ // Quantity
1368
+ quantity: {
1369
+ type: 'number',
1370
+ optional: true,
1371
+ description: 'Quantity',
1372
+ },
1373
+ // Tax Rates
1374
+ taxRates: {
1375
+ type: 'json',
1376
+ array: true,
1377
+ optional: true,
1378
+ description: 'Tax rates',
1379
+ },
1380
+ // Metadata
1381
+ metadata: {
1382
+ type: 'json',
1383
+ optional: true,
1384
+ description: 'Additional metadata',
1385
+ },
1386
+ // Timestamps
1387
+ created: {
1388
+ type: 'datetime',
1389
+ description: 'Time at which the subscription item was created',
1390
+ },
1391
+ },
1392
+ relationships: {
1393
+ subscription: {
1394
+ type: 'Subscription',
1395
+ backref: 'items',
1396
+ description: 'Subscription this item belongs to',
1397
+ },
1398
+ price: {
1399
+ type: 'Price',
1400
+ description: 'Price for this item',
1401
+ },
1402
+ },
1403
+ actions: [
1404
+ 'create',
1405
+ 'update',
1406
+ 'delete',
1407
+ 'list',
1408
+ 'retrieve',
1409
+ ],
1410
+ events: [],
1411
+ };
1412
+ /**
1413
+ * Quote entity
1414
+ *
1415
+ * Represents proposed pricing for a customer
1416
+ */
1417
+ export const Quote = {
1418
+ singular: 'quote',
1419
+ plural: 'quotes',
1420
+ description: 'Proposed pricing for a customer',
1421
+ properties: {
1422
+ // Identity
1423
+ quoteId: {
1424
+ type: 'string',
1425
+ description: 'Unique quote identifier',
1426
+ },
1427
+ number: {
1428
+ type: 'string',
1429
+ optional: true,
1430
+ description: 'Quote number',
1431
+ },
1432
+ // Status
1433
+ status: {
1434
+ type: 'string',
1435
+ description: 'Status: draft, open, accepted, canceled',
1436
+ examples: ['draft', 'open', 'accepted', 'canceled'],
1437
+ },
1438
+ // Amount
1439
+ amountSubtotal: {
1440
+ type: 'number',
1441
+ optional: true,
1442
+ description: 'Subtotal amount in cents',
1443
+ },
1444
+ amountTotal: {
1445
+ type: 'number',
1446
+ optional: true,
1447
+ description: 'Total amount in cents',
1448
+ },
1449
+ currency: {
1450
+ type: 'string',
1451
+ description: 'Currency code (ISO 4217)',
1452
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
1453
+ },
1454
+ // Description
1455
+ description: {
1456
+ type: 'string',
1457
+ optional: true,
1458
+ description: 'Quote description',
1459
+ },
1460
+ header: {
1461
+ type: 'string',
1462
+ optional: true,
1463
+ description: 'Quote header',
1464
+ },
1465
+ footer: {
1466
+ type: 'string',
1467
+ optional: true,
1468
+ description: 'Quote footer',
1469
+ },
1470
+ // Expiration
1471
+ expiresAt: {
1472
+ type: 'datetime',
1473
+ optional: true,
1474
+ description: 'Quote expiration time',
1475
+ },
1476
+ // Collection
1477
+ collectionMethod: {
1478
+ type: 'string',
1479
+ optional: true,
1480
+ description: 'Collection method: charge_automatically or send_invoice',
1481
+ examples: ['charge_automatically', 'send_invoice'],
1482
+ },
1483
+ // Metadata
1484
+ metadata: {
1485
+ type: 'json',
1486
+ optional: true,
1487
+ description: 'Additional metadata',
1488
+ },
1489
+ // Timestamps
1490
+ created: {
1491
+ type: 'datetime',
1492
+ description: 'Time at which the quote was created',
1493
+ },
1494
+ },
1495
+ relationships: {
1496
+ customer: {
1497
+ type: 'Customer',
1498
+ description: 'Customer being quoted',
1499
+ },
1500
+ invoice: {
1501
+ type: 'Invoice',
1502
+ required: false,
1503
+ description: 'Invoice created from quote',
1504
+ },
1505
+ subscription: {
1506
+ type: 'Subscription',
1507
+ required: false,
1508
+ description: 'Subscription created from quote',
1509
+ },
1510
+ },
1511
+ actions: [
1512
+ 'create',
1513
+ 'update',
1514
+ 'finalize',
1515
+ 'accept',
1516
+ 'cancel',
1517
+ 'list',
1518
+ 'retrieve',
1519
+ 'pdf',
1520
+ ],
1521
+ events: [
1522
+ 'quote.created',
1523
+ 'quote.finalized',
1524
+ 'quote.accepted',
1525
+ 'quote.canceled',
1526
+ ],
1527
+ };
1528
+ // =============================================================================
1529
+ // BALANCE
1530
+ // =============================================================================
1531
+ /**
1532
+ * Balance entity
1533
+ *
1534
+ * Represents the Stripe account balance
1535
+ */
1536
+ export const Balance = {
1537
+ singular: 'balance',
1538
+ plural: 'balances',
1539
+ description: 'The balance of a Stripe account',
1540
+ properties: {
1541
+ // Available
1542
+ available: {
1543
+ type: 'json',
1544
+ array: true,
1545
+ description: 'Available balance by currency',
1546
+ },
1547
+ // Pending
1548
+ pending: {
1549
+ type: 'json',
1550
+ array: true,
1551
+ description: 'Pending balance by currency',
1552
+ },
1553
+ // Livemode
1554
+ livemode: {
1555
+ type: 'boolean',
1556
+ description: 'Whether in live mode',
1557
+ },
1558
+ },
1559
+ relationships: {},
1560
+ actions: [
1561
+ 'retrieve',
1562
+ ],
1563
+ events: [],
1564
+ };
1565
+ /**
1566
+ * BalanceTransaction entity
1567
+ *
1568
+ * Represents a transaction affecting the account balance
1569
+ */
1570
+ export const BalanceTransaction = {
1571
+ singular: 'balance transaction',
1572
+ plural: 'balance transactions',
1573
+ description: 'A transaction affecting the account balance',
1574
+ properties: {
1575
+ // Identity
1576
+ balanceTransactionId: {
1577
+ type: 'string',
1578
+ description: 'Unique balance transaction identifier',
1579
+ },
1580
+ // Amount
1581
+ amount: {
1582
+ type: 'number',
1583
+ description: 'Gross amount in cents',
1584
+ },
1585
+ net: {
1586
+ type: 'number',
1587
+ description: 'Net amount in cents',
1588
+ },
1589
+ fee: {
1590
+ type: 'number',
1591
+ optional: true,
1592
+ description: 'Fee amount in cents',
1593
+ },
1594
+ currency: {
1595
+ type: 'string',
1596
+ description: 'Currency code (ISO 4217)',
1597
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
1598
+ },
1599
+ // Type
1600
+ type: {
1601
+ type: 'string',
1602
+ description: 'Transaction type: charge, refund, adjustment, application_fee, etc.',
1603
+ examples: ['charge', 'refund', 'adjustment', 'application_fee', 'application_fee_refund', 'transfer', 'payment', 'payout'],
1604
+ },
1605
+ // Description
1606
+ description: {
1607
+ type: 'string',
1608
+ optional: true,
1609
+ description: 'Transaction description',
1610
+ },
1611
+ // Status
1612
+ status: {
1613
+ type: 'string',
1614
+ description: 'Status: available or pending',
1615
+ examples: ['available', 'pending'],
1616
+ },
1617
+ // Reporting Category
1618
+ reportingCategory: {
1619
+ type: 'string',
1620
+ optional: true,
1621
+ description: 'Reporting category',
1622
+ },
1623
+ // Fee Details
1624
+ feeDetails: {
1625
+ type: 'json',
1626
+ array: true,
1627
+ optional: true,
1628
+ description: 'Breakdown of fees',
1629
+ },
1630
+ // Dates
1631
+ created: {
1632
+ type: 'datetime',
1633
+ description: 'Time at which the transaction was created',
1634
+ },
1635
+ availableOn: {
1636
+ type: 'datetime',
1637
+ optional: true,
1638
+ description: 'Time funds become available',
1639
+ },
1640
+ },
1641
+ relationships: {
1642
+ source: {
1643
+ type: 'json',
1644
+ required: false,
1645
+ description: 'Source object (Charge, Refund, Transfer, etc.)',
1646
+ },
1647
+ },
1648
+ actions: [
1649
+ 'list',
1650
+ 'retrieve',
1651
+ ],
1652
+ events: [],
1653
+ };
1654
+ // =============================================================================
1655
+ // CONNECT (for platforms)
1656
+ // =============================================================================
1657
+ /**
1658
+ * Account entity (Stripe Connect)
1659
+ *
1660
+ * Represents a connected Stripe account
1661
+ */
1662
+ export const Account = {
1663
+ singular: 'account',
1664
+ plural: 'accounts',
1665
+ description: 'A connected Stripe account',
1666
+ properties: {
1667
+ // Identity
1668
+ accountId: {
1669
+ type: 'string',
1670
+ description: 'Unique account identifier',
1671
+ },
1672
+ email: {
1673
+ type: 'string',
1674
+ optional: true,
1675
+ description: 'Account email',
1676
+ },
1677
+ // Type
1678
+ type: {
1679
+ type: 'string',
1680
+ optional: true,
1681
+ description: 'Account type: standard, express, custom',
1682
+ examples: ['standard', 'express', 'custom'],
1683
+ },
1684
+ // Business
1685
+ businessType: {
1686
+ type: 'string',
1687
+ optional: true,
1688
+ description: 'Business type: individual, company, non_profit, government_entity',
1689
+ examples: ['individual', 'company', 'non_profit', 'government_entity'],
1690
+ },
1691
+ businessProfile: {
1692
+ type: 'json',
1693
+ optional: true,
1694
+ description: 'Business profile information',
1695
+ },
1696
+ company: {
1697
+ type: 'json',
1698
+ optional: true,
1699
+ description: 'Company information',
1700
+ },
1701
+ individual: {
1702
+ type: 'json',
1703
+ optional: true,
1704
+ description: 'Individual information',
1705
+ },
1706
+ // Capabilities
1707
+ capabilities: {
1708
+ type: 'json',
1709
+ optional: true,
1710
+ description: 'Account capabilities',
1711
+ },
1712
+ // Requirements
1713
+ requirements: {
1714
+ type: 'json',
1715
+ optional: true,
1716
+ description: 'Account requirements',
1717
+ },
1718
+ // Settings
1719
+ settings: {
1720
+ type: 'json',
1721
+ optional: true,
1722
+ description: 'Account settings',
1723
+ },
1724
+ // Charges
1725
+ chargesEnabled: {
1726
+ type: 'boolean',
1727
+ optional: true,
1728
+ description: 'Whether charges are enabled',
1729
+ },
1730
+ payoutsEnabled: {
1731
+ type: 'boolean',
1732
+ optional: true,
1733
+ description: 'Whether payouts are enabled',
1734
+ },
1735
+ detailsSubmitted: {
1736
+ type: 'boolean',
1737
+ optional: true,
1738
+ description: 'Whether account details have been submitted',
1739
+ },
1740
+ // Country
1741
+ country: {
1742
+ type: 'string',
1743
+ optional: true,
1744
+ description: 'Country code',
1745
+ },
1746
+ defaultCurrency: {
1747
+ type: 'string',
1748
+ optional: true,
1749
+ description: 'Default currency',
1750
+ },
1751
+ // Metadata
1752
+ metadata: {
1753
+ type: 'json',
1754
+ optional: true,
1755
+ description: 'Additional metadata',
1756
+ },
1757
+ // Timestamps
1758
+ created: {
1759
+ type: 'datetime',
1760
+ description: 'Time at which the account was created',
1761
+ },
1762
+ },
1763
+ relationships: {
1764
+ externalAccounts: {
1765
+ type: 'BankAccount[]',
1766
+ description: 'External accounts (bank accounts, cards)',
1767
+ },
1768
+ },
1769
+ actions: [
1770
+ 'create',
1771
+ 'update',
1772
+ 'delete',
1773
+ 'reject',
1774
+ 'list',
1775
+ 'retrieve',
1776
+ ],
1777
+ events: [
1778
+ 'account.updated',
1779
+ 'account.application.authorized',
1780
+ 'account.application.deauthorized',
1781
+ 'account.external_account.created',
1782
+ 'account.external_account.deleted',
1783
+ 'account.external_account.updated',
1784
+ ],
1785
+ };
1786
+ /**
1787
+ * AccountLink entity
1788
+ *
1789
+ * Represents an onboarding link for a connected account
1790
+ */
1791
+ export const AccountLink = {
1792
+ singular: 'account link',
1793
+ plural: 'account links',
1794
+ description: 'An onboarding link for a connected account',
1795
+ properties: {
1796
+ // URL
1797
+ url: {
1798
+ type: 'url',
1799
+ description: 'URL for account onboarding',
1800
+ },
1801
+ // Expiration
1802
+ expiresAt: {
1803
+ type: 'datetime',
1804
+ description: 'Time at which the link expires',
1805
+ },
1806
+ // Created
1807
+ created: {
1808
+ type: 'datetime',
1809
+ description: 'Time at which the link was created',
1810
+ },
1811
+ },
1812
+ relationships: {
1813
+ account: {
1814
+ type: 'Account',
1815
+ description: 'Account this link is for',
1816
+ },
1817
+ },
1818
+ actions: [
1819
+ 'create',
1820
+ ],
1821
+ events: [],
1822
+ };
1823
+ /**
1824
+ * Transfer entity
1825
+ *
1826
+ * Represents a transfer to a connected account
1827
+ */
1828
+ export const Transfer = {
1829
+ singular: 'transfer',
1830
+ plural: 'transfers',
1831
+ description: 'A transfer to a connected Stripe account',
1832
+ properties: {
1833
+ // Identity
1834
+ transferId: {
1835
+ type: 'string',
1836
+ description: 'Unique transfer identifier',
1837
+ },
1838
+ // Amount
1839
+ amount: {
1840
+ type: 'number',
1841
+ description: 'Amount transferred in cents',
1842
+ },
1843
+ amountReversed: {
1844
+ type: 'number',
1845
+ optional: true,
1846
+ description: 'Amount reversed in cents',
1847
+ },
1848
+ currency: {
1849
+ type: 'string',
1850
+ description: 'Currency code (ISO 4217)',
1851
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
1852
+ },
1853
+ // Description
1854
+ description: {
1855
+ type: 'string',
1856
+ optional: true,
1857
+ description: 'Transfer description',
1858
+ },
1859
+ // Status
1860
+ reversed: {
1861
+ type: 'boolean',
1862
+ optional: true,
1863
+ description: 'Whether transfer has been reversed',
1864
+ },
1865
+ // Source Transaction
1866
+ sourceType: {
1867
+ type: 'string',
1868
+ optional: true,
1869
+ description: 'Source type: card, bank_account, etc.',
1870
+ },
1871
+ // Metadata
1872
+ metadata: {
1873
+ type: 'json',
1874
+ optional: true,
1875
+ description: 'Additional metadata',
1876
+ },
1877
+ // Timestamps
1878
+ created: {
1879
+ type: 'datetime',
1880
+ description: 'Time at which the transfer was created',
1881
+ },
1882
+ },
1883
+ relationships: {
1884
+ destination: {
1885
+ type: 'Account',
1886
+ description: 'Destination account',
1887
+ },
1888
+ sourceTransaction: {
1889
+ type: 'Charge',
1890
+ required: false,
1891
+ description: 'Source transaction',
1892
+ },
1893
+ balanceTransaction: {
1894
+ type: 'BalanceTransaction',
1895
+ required: false,
1896
+ description: 'Balance transaction',
1897
+ },
1898
+ reversals: {
1899
+ type: 'json[]',
1900
+ description: 'Transfer reversals',
1901
+ },
1902
+ },
1903
+ actions: [
1904
+ 'create',
1905
+ 'update',
1906
+ 'list',
1907
+ 'retrieve',
1908
+ 'reverse',
1909
+ ],
1910
+ events: [
1911
+ 'transfer.created',
1912
+ 'transfer.updated',
1913
+ 'transfer.reversed',
1914
+ ],
1915
+ };
1916
+ /**
1917
+ * Payout entity
1918
+ *
1919
+ * Represents a payout to an external account
1920
+ */
1921
+ export const Payout = {
1922
+ singular: 'payout',
1923
+ plural: 'payouts',
1924
+ description: 'A payout to an external bank account or debit card',
1925
+ properties: {
1926
+ // Identity
1927
+ payoutId: {
1928
+ type: 'string',
1929
+ description: 'Unique payout identifier',
1930
+ },
1931
+ // Amount
1932
+ amount: {
1933
+ type: 'number',
1934
+ description: 'Amount paid out in cents',
1935
+ },
1936
+ currency: {
1937
+ type: 'string',
1938
+ description: 'Currency code (ISO 4217)',
1939
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
1940
+ },
1941
+ // Status
1942
+ status: {
1943
+ type: 'string',
1944
+ description: 'Status: pending, paid, failed, canceled',
1945
+ examples: ['pending', 'paid', 'failed', 'canceled'],
1946
+ },
1947
+ // Type
1948
+ type: {
1949
+ type: 'string',
1950
+ optional: true,
1951
+ description: 'Payout type: bank_account or card',
1952
+ examples: ['bank_account', 'card'],
1953
+ },
1954
+ method: {
1955
+ type: 'string',
1956
+ optional: true,
1957
+ description: 'Payout method: standard or instant',
1958
+ examples: ['standard', 'instant'],
1959
+ },
1960
+ // Description
1961
+ description: {
1962
+ type: 'string',
1963
+ optional: true,
1964
+ description: 'Payout description',
1965
+ },
1966
+ statementDescriptor: {
1967
+ type: 'string',
1968
+ optional: true,
1969
+ description: 'Statement descriptor',
1970
+ },
1971
+ // Failure
1972
+ failureCode: {
1973
+ type: 'string',
1974
+ optional: true,
1975
+ description: 'Failure code',
1976
+ },
1977
+ failureMessage: {
1978
+ type: 'string',
1979
+ optional: true,
1980
+ description: 'Failure message',
1981
+ },
1982
+ // Dates
1983
+ created: {
1984
+ type: 'datetime',
1985
+ description: 'Time at which the payout was created',
1986
+ },
1987
+ arrivalDate: {
1988
+ type: 'datetime',
1989
+ optional: true,
1990
+ description: 'Expected arrival date',
1991
+ },
1992
+ // Metadata
1993
+ metadata: {
1994
+ type: 'json',
1995
+ optional: true,
1996
+ description: 'Additional metadata',
1997
+ },
1998
+ },
1999
+ relationships: {
2000
+ destination: {
2001
+ type: 'BankAccount',
2002
+ required: false,
2003
+ description: 'Destination bank account',
2004
+ },
2005
+ balanceTransaction: {
2006
+ type: 'BalanceTransaction',
2007
+ required: false,
2008
+ description: 'Balance transaction',
2009
+ },
2010
+ },
2011
+ actions: [
2012
+ 'create',
2013
+ 'update',
2014
+ 'cancel',
2015
+ 'reverse',
2016
+ 'list',
2017
+ 'retrieve',
2018
+ ],
2019
+ events: [
2020
+ 'payout.created',
2021
+ 'payout.updated',
2022
+ 'payout.canceled',
2023
+ 'payout.failed',
2024
+ 'payout.paid',
2025
+ ],
2026
+ };
2027
+ /**
2028
+ * ApplicationFee entity
2029
+ *
2030
+ * Represents a platform fee on a charge
2031
+ */
2032
+ export const ApplicationFee = {
2033
+ singular: 'application fee',
2034
+ plural: 'application fees',
2035
+ description: 'A platform fee collected on a charge',
2036
+ properties: {
2037
+ // Identity
2038
+ applicationFeeId: {
2039
+ type: 'string',
2040
+ description: 'Unique application fee identifier',
2041
+ },
2042
+ // Amount
2043
+ amount: {
2044
+ type: 'number',
2045
+ description: 'Fee amount in cents',
2046
+ },
2047
+ amountRefunded: {
2048
+ type: 'number',
2049
+ optional: true,
2050
+ description: 'Amount refunded in cents',
2051
+ },
2052
+ currency: {
2053
+ type: 'string',
2054
+ description: 'Currency code (ISO 4217)',
2055
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2056
+ },
2057
+ // Status
2058
+ refunded: {
2059
+ type: 'boolean',
2060
+ optional: true,
2061
+ description: 'Whether fee has been refunded',
2062
+ },
2063
+ // Livemode
2064
+ livemode: {
2065
+ type: 'boolean',
2066
+ description: 'Whether in live mode',
2067
+ },
2068
+ // Timestamps
2069
+ created: {
2070
+ type: 'datetime',
2071
+ description: 'Time at which the fee was created',
2072
+ },
2073
+ },
2074
+ relationships: {
2075
+ charge: {
2076
+ type: 'Charge',
2077
+ description: 'Charge this fee was collected on',
2078
+ },
2079
+ account: {
2080
+ type: 'Account',
2081
+ description: 'Connected account',
2082
+ },
2083
+ balanceTransaction: {
2084
+ type: 'BalanceTransaction',
2085
+ required: false,
2086
+ description: 'Balance transaction',
2087
+ },
2088
+ },
2089
+ actions: [
2090
+ 'list',
2091
+ 'retrieve',
2092
+ 'refund',
2093
+ ],
2094
+ events: [
2095
+ 'application_fee.created',
2096
+ 'application_fee.refunded',
2097
+ ],
2098
+ };
2099
+ // =============================================================================
2100
+ // TREASURY (embedded banking)
2101
+ // =============================================================================
2102
+ /**
2103
+ * FinancialAccount entity (Treasury)
2104
+ *
2105
+ * Represents a Treasury financial account
2106
+ */
2107
+ export const FinancialAccount = {
2108
+ singular: 'financial account',
2109
+ plural: 'financial accounts',
2110
+ description: 'A Treasury financial account for embedded banking',
2111
+ properties: {
2112
+ // Identity
2113
+ financialAccountId: {
2114
+ type: 'string',
2115
+ description: 'Unique financial account identifier',
2116
+ },
2117
+ // Balance
2118
+ balance: {
2119
+ type: 'json',
2120
+ description: 'Account balance',
2121
+ },
2122
+ // Status
2123
+ status: {
2124
+ type: 'string',
2125
+ description: 'Status: open or closed',
2126
+ examples: ['open', 'closed'],
2127
+ },
2128
+ // Supported Currencies
2129
+ supportedCurrencies: {
2130
+ type: 'string',
2131
+ array: true,
2132
+ description: 'Supported currencies',
2133
+ },
2134
+ // Features
2135
+ features: {
2136
+ type: 'json',
2137
+ optional: true,
2138
+ description: 'Enabled features',
2139
+ },
2140
+ // Financial Addresses
2141
+ financialAddresses: {
2142
+ type: 'json',
2143
+ array: true,
2144
+ optional: true,
2145
+ description: 'Financial addresses (e.g., ACH routing info)',
2146
+ },
2147
+ // Metadata
2148
+ metadata: {
2149
+ type: 'json',
2150
+ optional: true,
2151
+ description: 'Additional metadata',
2152
+ },
2153
+ // Timestamps
2154
+ created: {
2155
+ type: 'datetime',
2156
+ description: 'Time at which the account was created',
2157
+ },
2158
+ },
2159
+ relationships: {},
2160
+ actions: [
2161
+ 'create',
2162
+ 'update',
2163
+ 'retrieve',
2164
+ 'list',
2165
+ ],
2166
+ events: [
2167
+ 'treasury.financial_account.created',
2168
+ 'treasury.financial_account.closed',
2169
+ 'treasury.financial_account.features_status_updated',
2170
+ ],
2171
+ };
2172
+ /**
2173
+ * TreasuryTransaction entity
2174
+ *
2175
+ * Represents a transaction in a Treasury financial account
2176
+ */
2177
+ export const TreasuryTransaction = {
2178
+ singular: 'treasury transaction',
2179
+ plural: 'treasury transactions',
2180
+ description: 'A transaction in a Treasury financial account',
2181
+ properties: {
2182
+ // Identity
2183
+ treasuryTransactionId: {
2184
+ type: 'string',
2185
+ description: 'Unique transaction identifier',
2186
+ },
2187
+ // Amount
2188
+ amount: {
2189
+ type: 'number',
2190
+ description: 'Transaction amount in cents',
2191
+ },
2192
+ currency: {
2193
+ type: 'string',
2194
+ description: 'Currency code (ISO 4217)',
2195
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2196
+ },
2197
+ // Description
2198
+ description: {
2199
+ type: 'string',
2200
+ optional: true,
2201
+ description: 'Transaction description',
2202
+ },
2203
+ // Flow
2204
+ flowType: {
2205
+ type: 'string',
2206
+ description: 'Flow type: inbound_transfer, outbound_transfer, outbound_payment, received_credit, received_debit',
2207
+ examples: ['inbound_transfer', 'outbound_transfer', 'outbound_payment', 'received_credit', 'received_debit'],
2208
+ },
2209
+ // Status
2210
+ status: {
2211
+ type: 'string',
2212
+ description: 'Status: open, posted, void',
2213
+ examples: ['open', 'posted', 'void'],
2214
+ },
2215
+ // Balance Impact
2216
+ balanceImpact: {
2217
+ type: 'json',
2218
+ optional: true,
2219
+ description: 'Impact on balance',
2220
+ },
2221
+ // Timestamps
2222
+ created: {
2223
+ type: 'datetime',
2224
+ description: 'Time at which the transaction was created',
2225
+ },
2226
+ },
2227
+ relationships: {
2228
+ financialAccount: {
2229
+ type: 'FinancialAccount',
2230
+ description: 'Financial account',
2231
+ },
2232
+ flowDetails: {
2233
+ type: 'json',
2234
+ required: false,
2235
+ description: 'Details about the flow',
2236
+ },
2237
+ },
2238
+ actions: [
2239
+ 'list',
2240
+ 'retrieve',
2241
+ ],
2242
+ events: [
2243
+ 'treasury.transaction_entry.created',
2244
+ ],
2245
+ };
2246
+ /**
2247
+ * InboundTransfer entity (Treasury)
2248
+ *
2249
+ * Represents a transfer into a Treasury financial account
2250
+ */
2251
+ export const InboundTransfer = {
2252
+ singular: 'inbound transfer',
2253
+ plural: 'inbound transfers',
2254
+ description: 'A transfer into a Treasury financial account',
2255
+ properties: {
2256
+ // Identity
2257
+ inboundTransferId: {
2258
+ type: 'string',
2259
+ description: 'Unique inbound transfer identifier',
2260
+ },
2261
+ // Amount
2262
+ amount: {
2263
+ type: 'number',
2264
+ description: 'Transfer amount in cents',
2265
+ },
2266
+ currency: {
2267
+ type: 'string',
2268
+ description: 'Currency code (ISO 4217)',
2269
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2270
+ },
2271
+ // Description
2272
+ description: {
2273
+ type: 'string',
2274
+ optional: true,
2275
+ description: 'Transfer description',
2276
+ },
2277
+ // Origin
2278
+ originPaymentMethod: {
2279
+ type: 'string',
2280
+ optional: true,
2281
+ description: 'Origin payment method',
2282
+ },
2283
+ originPaymentMethodDetails: {
2284
+ type: 'json',
2285
+ optional: true,
2286
+ description: 'Origin payment method details',
2287
+ },
2288
+ // Status
2289
+ status: {
2290
+ type: 'string',
2291
+ description: 'Status: processing, succeeded, failed, canceled',
2292
+ examples: ['processing', 'succeeded', 'failed', 'canceled'],
2293
+ },
2294
+ // Failure
2295
+ failureDetails: {
2296
+ type: 'json',
2297
+ optional: true,
2298
+ description: 'Failure details',
2299
+ },
2300
+ // Metadata
2301
+ metadata: {
2302
+ type: 'json',
2303
+ optional: true,
2304
+ description: 'Additional metadata',
2305
+ },
2306
+ // Timestamps
2307
+ created: {
2308
+ type: 'datetime',
2309
+ description: 'Time at which the transfer was created',
2310
+ },
2311
+ },
2312
+ relationships: {
2313
+ financialAccount: {
2314
+ type: 'FinancialAccount',
2315
+ description: 'Destination financial account',
2316
+ },
2317
+ },
2318
+ actions: [
2319
+ 'create',
2320
+ 'cancel',
2321
+ 'list',
2322
+ 'retrieve',
2323
+ ],
2324
+ events: [
2325
+ 'treasury.inbound_transfer.created',
2326
+ 'treasury.inbound_transfer.succeeded',
2327
+ 'treasury.inbound_transfer.failed',
2328
+ 'treasury.inbound_transfer.canceled',
2329
+ ],
2330
+ };
2331
+ /**
2332
+ * OutboundTransfer entity (Treasury)
2333
+ *
2334
+ * Represents a transfer out of a Treasury financial account
2335
+ */
2336
+ export const OutboundTransfer = {
2337
+ singular: 'outbound transfer',
2338
+ plural: 'outbound transfers',
2339
+ description: 'A transfer out of a Treasury financial account',
2340
+ properties: {
2341
+ // Identity
2342
+ outboundTransferId: {
2343
+ type: 'string',
2344
+ description: 'Unique outbound transfer identifier',
2345
+ },
2346
+ // Amount
2347
+ amount: {
2348
+ type: 'number',
2349
+ description: 'Transfer amount in cents',
2350
+ },
2351
+ currency: {
2352
+ type: 'string',
2353
+ description: 'Currency code (ISO 4217)',
2354
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2355
+ },
2356
+ // Description
2357
+ description: {
2358
+ type: 'string',
2359
+ optional: true,
2360
+ description: 'Transfer description',
2361
+ },
2362
+ statementDescriptor: {
2363
+ type: 'string',
2364
+ optional: true,
2365
+ description: 'Statement descriptor',
2366
+ },
2367
+ // Destination
2368
+ destinationPaymentMethod: {
2369
+ type: 'string',
2370
+ optional: true,
2371
+ description: 'Destination payment method',
2372
+ },
2373
+ destinationPaymentMethodDetails: {
2374
+ type: 'json',
2375
+ optional: true,
2376
+ description: 'Destination payment method details',
2377
+ },
2378
+ // Status
2379
+ status: {
2380
+ type: 'string',
2381
+ description: 'Status: processing, posted, failed, canceled, returned',
2382
+ examples: ['processing', 'posted', 'failed', 'canceled', 'returned'],
2383
+ },
2384
+ // Expected Arrival
2385
+ expectedArrivalDate: {
2386
+ type: 'datetime',
2387
+ optional: true,
2388
+ description: 'Expected arrival date',
2389
+ },
2390
+ // Return Details
2391
+ returnedDetails: {
2392
+ type: 'json',
2393
+ optional: true,
2394
+ description: 'Return details if returned',
2395
+ },
2396
+ // Metadata
2397
+ metadata: {
2398
+ type: 'json',
2399
+ optional: true,
2400
+ description: 'Additional metadata',
2401
+ },
2402
+ // Timestamps
2403
+ created: {
2404
+ type: 'datetime',
2405
+ description: 'Time at which the transfer was created',
2406
+ },
2407
+ },
2408
+ relationships: {
2409
+ financialAccount: {
2410
+ type: 'FinancialAccount',
2411
+ description: 'Source financial account',
2412
+ },
2413
+ },
2414
+ actions: [
2415
+ 'create',
2416
+ 'cancel',
2417
+ 'list',
2418
+ 'retrieve',
2419
+ ],
2420
+ events: [
2421
+ 'treasury.outbound_transfer.created',
2422
+ 'treasury.outbound_transfer.posted',
2423
+ 'treasury.outbound_transfer.failed',
2424
+ 'treasury.outbound_transfer.canceled',
2425
+ 'treasury.outbound_transfer.returned',
2426
+ ],
2427
+ };
2428
+ /**
2429
+ * OutboundPayment entity (Treasury)
2430
+ *
2431
+ * Represents a payment from a Treasury financial account
2432
+ */
2433
+ export const OutboundPayment = {
2434
+ singular: 'outbound payment',
2435
+ plural: 'outbound payments',
2436
+ description: 'A payment from a Treasury financial account',
2437
+ properties: {
2438
+ // Identity
2439
+ outboundPaymentId: {
2440
+ type: 'string',
2441
+ description: 'Unique outbound payment identifier',
2442
+ },
2443
+ // Amount
2444
+ amount: {
2445
+ type: 'number',
2446
+ description: 'Payment amount in cents',
2447
+ },
2448
+ currency: {
2449
+ type: 'string',
2450
+ description: 'Currency code (ISO 4217)',
2451
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2452
+ },
2453
+ // Description
2454
+ description: {
2455
+ type: 'string',
2456
+ optional: true,
2457
+ description: 'Payment description',
2458
+ },
2459
+ statementDescriptor: {
2460
+ type: 'string',
2461
+ optional: true,
2462
+ description: 'Statement descriptor',
2463
+ },
2464
+ // Destination
2465
+ destinationPaymentMethod: {
2466
+ type: 'string',
2467
+ optional: true,
2468
+ description: 'Destination payment method',
2469
+ },
2470
+ destinationPaymentMethodDetails: {
2471
+ type: 'json',
2472
+ optional: true,
2473
+ description: 'Destination payment method details',
2474
+ },
2475
+ // Status
2476
+ status: {
2477
+ type: 'string',
2478
+ description: 'Status: processing, posted, failed, canceled, returned',
2479
+ examples: ['processing', 'posted', 'failed', 'canceled', 'returned'],
2480
+ },
2481
+ // End User Details
2482
+ endUserDetails: {
2483
+ type: 'json',
2484
+ optional: true,
2485
+ description: 'End user details',
2486
+ },
2487
+ // Metadata
2488
+ metadata: {
2489
+ type: 'json',
2490
+ optional: true,
2491
+ description: 'Additional metadata',
2492
+ },
2493
+ // Timestamps
2494
+ created: {
2495
+ type: 'datetime',
2496
+ description: 'Time at which the payment was created',
2497
+ },
2498
+ },
2499
+ relationships: {
2500
+ financialAccount: {
2501
+ type: 'FinancialAccount',
2502
+ description: 'Source financial account',
2503
+ },
2504
+ },
2505
+ actions: [
2506
+ 'create',
2507
+ 'cancel',
2508
+ 'list',
2509
+ 'retrieve',
2510
+ ],
2511
+ events: [
2512
+ 'treasury.outbound_payment.created',
2513
+ 'treasury.outbound_payment.posted',
2514
+ 'treasury.outbound_payment.failed',
2515
+ 'treasury.outbound_payment.canceled',
2516
+ 'treasury.outbound_payment.returned',
2517
+ ],
2518
+ };
2519
+ /**
2520
+ * ReceivedCredit entity (Treasury)
2521
+ *
2522
+ * Represents a credit received into a Treasury financial account
2523
+ */
2524
+ export const ReceivedCredit = {
2525
+ singular: 'received credit',
2526
+ plural: 'received credits',
2527
+ description: 'A credit received into a Treasury financial account',
2528
+ properties: {
2529
+ // Identity
2530
+ receivedCreditId: {
2531
+ type: 'string',
2532
+ description: 'Unique received credit identifier',
2533
+ },
2534
+ // Amount
2535
+ amount: {
2536
+ type: 'number',
2537
+ description: 'Credit amount in cents',
2538
+ },
2539
+ currency: {
2540
+ type: 'string',
2541
+ description: 'Currency code (ISO 4217)',
2542
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2543
+ },
2544
+ // Description
2545
+ description: {
2546
+ type: 'string',
2547
+ optional: true,
2548
+ description: 'Credit description',
2549
+ },
2550
+ // Network
2551
+ network: {
2552
+ type: 'string',
2553
+ description: 'Network: ach, us_domestic_wire',
2554
+ examples: ['ach', 'us_domestic_wire'],
2555
+ },
2556
+ // Initiating Payment Method Details
2557
+ initiatingPaymentMethodDetails: {
2558
+ type: 'json',
2559
+ optional: true,
2560
+ description: 'Initiating payment method details',
2561
+ },
2562
+ // Status
2563
+ status: {
2564
+ type: 'string',
2565
+ description: 'Status: succeeded or failed',
2566
+ examples: ['succeeded', 'failed'],
2567
+ },
2568
+ // Failure Code
2569
+ failureCode: {
2570
+ type: 'string',
2571
+ optional: true,
2572
+ description: 'Failure code',
2573
+ },
2574
+ // Timestamps
2575
+ created: {
2576
+ type: 'datetime',
2577
+ description: 'Time at which the credit was received',
2578
+ },
2579
+ },
2580
+ relationships: {
2581
+ financialAccount: {
2582
+ type: 'FinancialAccount',
2583
+ description: 'Financial account',
2584
+ },
2585
+ },
2586
+ actions: [
2587
+ 'list',
2588
+ 'retrieve',
2589
+ ],
2590
+ events: [
2591
+ 'treasury.received_credit.created',
2592
+ 'treasury.received_credit.succeeded',
2593
+ 'treasury.received_credit.failed',
2594
+ ],
2595
+ };
2596
+ /**
2597
+ * ReceivedDebit entity (Treasury)
2598
+ *
2599
+ * Represents a debit received from a Treasury financial account
2600
+ */
2601
+ export const ReceivedDebit = {
2602
+ singular: 'received debit',
2603
+ plural: 'received debits',
2604
+ description: 'A debit received from a Treasury financial account',
2605
+ properties: {
2606
+ // Identity
2607
+ receivedDebitId: {
2608
+ type: 'string',
2609
+ description: 'Unique received debit identifier',
2610
+ },
2611
+ // Amount
2612
+ amount: {
2613
+ type: 'number',
2614
+ description: 'Debit amount in cents',
2615
+ },
2616
+ currency: {
2617
+ type: 'string',
2618
+ description: 'Currency code (ISO 4217)',
2619
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2620
+ },
2621
+ // Description
2622
+ description: {
2623
+ type: 'string',
2624
+ optional: true,
2625
+ description: 'Debit description',
2626
+ },
2627
+ // Network
2628
+ network: {
2629
+ type: 'string',
2630
+ description: 'Network: ach',
2631
+ examples: ['ach'],
2632
+ },
2633
+ // Initiating Payment Method Details
2634
+ initiatingPaymentMethodDetails: {
2635
+ type: 'json',
2636
+ optional: true,
2637
+ description: 'Initiating payment method details',
2638
+ },
2639
+ // Status
2640
+ status: {
2641
+ type: 'string',
2642
+ description: 'Status: succeeded or failed',
2643
+ examples: ['succeeded', 'failed'],
2644
+ },
2645
+ // Failure Code
2646
+ failureCode: {
2647
+ type: 'string',
2648
+ optional: true,
2649
+ description: 'Failure code',
2650
+ },
2651
+ // Timestamps
2652
+ created: {
2653
+ type: 'datetime',
2654
+ description: 'Time at which the debit was received',
2655
+ },
2656
+ },
2657
+ relationships: {
2658
+ financialAccount: {
2659
+ type: 'FinancialAccount',
2660
+ description: 'Financial account',
2661
+ },
2662
+ },
2663
+ actions: [
2664
+ 'list',
2665
+ 'retrieve',
2666
+ ],
2667
+ events: [
2668
+ 'treasury.received_debit.created',
2669
+ ],
2670
+ };
2671
+ // =============================================================================
2672
+ // ISSUING (cards)
2673
+ // =============================================================================
2674
+ /**
2675
+ * IssuingCard entity
2676
+ *
2677
+ * Represents an issued payment card
2678
+ */
2679
+ export const IssuingCard = {
2680
+ singular: 'issuing card',
2681
+ plural: 'issuing cards',
2682
+ description: 'An issued physical or virtual payment card',
2683
+ properties: {
2684
+ // Identity
2685
+ issuingCardId: {
2686
+ type: 'string',
2687
+ description: 'Unique card identifier',
2688
+ },
2689
+ last4: {
2690
+ type: 'string',
2691
+ optional: true,
2692
+ description: 'Last 4 digits of card number',
2693
+ },
2694
+ // Brand
2695
+ brand: {
2696
+ type: 'string',
2697
+ description: 'Card brand: visa or mastercard',
2698
+ examples: ['visa', 'mastercard'],
2699
+ },
2700
+ // Type
2701
+ type: {
2702
+ type: 'string',
2703
+ description: 'Card type: physical or virtual',
2704
+ examples: ['physical', 'virtual'],
2705
+ },
2706
+ // Status
2707
+ status: {
2708
+ type: 'string',
2709
+ description: 'Status: active, inactive, canceled',
2710
+ examples: ['active', 'inactive', 'canceled'],
2711
+ },
2712
+ // Cancellation
2713
+ cancellationReason: {
2714
+ type: 'string',
2715
+ optional: true,
2716
+ description: 'Cancellation reason',
2717
+ },
2718
+ // Spending Controls
2719
+ spendingControls: {
2720
+ type: 'json',
2721
+ optional: true,
2722
+ description: 'Spending controls and limits',
2723
+ },
2724
+ // Shipping
2725
+ shipping: {
2726
+ type: 'json',
2727
+ optional: true,
2728
+ description: 'Shipping information (for physical cards)',
2729
+ },
2730
+ // Expiration
2731
+ expMonth: {
2732
+ type: 'number',
2733
+ optional: true,
2734
+ description: 'Expiration month',
2735
+ },
2736
+ expYear: {
2737
+ type: 'number',
2738
+ optional: true,
2739
+ description: 'Expiration year',
2740
+ },
2741
+ // Currency
2742
+ currency: {
2743
+ type: 'string',
2744
+ description: 'Currency code (ISO 4217)',
2745
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2746
+ },
2747
+ // Metadata
2748
+ metadata: {
2749
+ type: 'json',
2750
+ optional: true,
2751
+ description: 'Additional metadata',
2752
+ },
2753
+ // Timestamps
2754
+ created: {
2755
+ type: 'datetime',
2756
+ description: 'Time at which the card was created',
2757
+ },
2758
+ },
2759
+ relationships: {
2760
+ cardholder: {
2761
+ type: 'IssuingCardholder',
2762
+ description: 'Cardholder',
2763
+ },
2764
+ replacementFor: {
2765
+ type: 'IssuingCard',
2766
+ required: false,
2767
+ description: 'Card being replaced',
2768
+ },
2769
+ replacedBy: {
2770
+ type: 'IssuingCard',
2771
+ required: false,
2772
+ description: 'Replacement card',
2773
+ },
2774
+ },
2775
+ actions: [
2776
+ 'create',
2777
+ 'update',
2778
+ 'cancel',
2779
+ 'list',
2780
+ 'retrieve',
2781
+ ],
2782
+ events: [
2783
+ 'issuing_card.created',
2784
+ 'issuing_card.updated',
2785
+ ],
2786
+ };
2787
+ /**
2788
+ * IssuingCardholder entity
2789
+ *
2790
+ * Represents a cardholder
2791
+ */
2792
+ export const IssuingCardholder = {
2793
+ singular: 'issuing cardholder',
2794
+ plural: 'issuing cardholders',
2795
+ description: 'A cardholder for issued cards',
2796
+ properties: {
2797
+ // Identity
2798
+ issuingCardholderId: {
2799
+ type: 'string',
2800
+ description: 'Unique cardholder identifier',
2801
+ },
2802
+ name: {
2803
+ type: 'string',
2804
+ description: 'Cardholder name',
2805
+ },
2806
+ email: {
2807
+ type: 'string',
2808
+ optional: true,
2809
+ description: 'Cardholder email',
2810
+ },
2811
+ phoneNumber: {
2812
+ type: 'string',
2813
+ optional: true,
2814
+ description: 'Cardholder phone number',
2815
+ },
2816
+ // Type
2817
+ type: {
2818
+ type: 'string',
2819
+ description: 'Cardholder type: individual or company',
2820
+ examples: ['individual', 'company'],
2821
+ },
2822
+ // Billing
2823
+ billing: {
2824
+ type: 'json',
2825
+ description: 'Billing information',
2826
+ },
2827
+ // Company
2828
+ company: {
2829
+ type: 'json',
2830
+ optional: true,
2831
+ description: 'Company information (for company type)',
2832
+ },
2833
+ // Individual
2834
+ individual: {
2835
+ type: 'json',
2836
+ optional: true,
2837
+ description: 'Individual information (for individual type)',
2838
+ },
2839
+ // Status
2840
+ status: {
2841
+ type: 'string',
2842
+ description: 'Status: active, inactive, blocked',
2843
+ examples: ['active', 'inactive', 'blocked'],
2844
+ },
2845
+ // Spending Controls
2846
+ spendingControls: {
2847
+ type: 'json',
2848
+ optional: true,
2849
+ description: 'Default spending controls',
2850
+ },
2851
+ // Requirements
2852
+ requirements: {
2853
+ type: 'json',
2854
+ optional: true,
2855
+ description: 'Verification requirements',
2856
+ },
2857
+ // Metadata
2858
+ metadata: {
2859
+ type: 'json',
2860
+ optional: true,
2861
+ description: 'Additional metadata',
2862
+ },
2863
+ // Timestamps
2864
+ created: {
2865
+ type: 'datetime',
2866
+ description: 'Time at which the cardholder was created',
2867
+ },
2868
+ },
2869
+ relationships: {
2870
+ cards: {
2871
+ type: 'IssuingCard[]',
2872
+ backref: 'cardholder',
2873
+ description: 'Cards issued to this cardholder',
2874
+ },
2875
+ },
2876
+ actions: [
2877
+ 'create',
2878
+ 'update',
2879
+ 'list',
2880
+ 'retrieve',
2881
+ ],
2882
+ events: [
2883
+ 'issuing_cardholder.created',
2884
+ 'issuing_cardholder.updated',
2885
+ ],
2886
+ };
2887
+ /**
2888
+ * IssuingAuthorization entity
2889
+ *
2890
+ * Represents a card authorization attempt
2891
+ */
2892
+ export const IssuingAuthorization = {
2893
+ singular: 'issuing authorization',
2894
+ plural: 'issuing authorizations',
2895
+ description: 'A card authorization attempt',
2896
+ properties: {
2897
+ // Identity
2898
+ issuingAuthorizationId: {
2899
+ type: 'string',
2900
+ description: 'Unique authorization identifier',
2901
+ },
2902
+ // Amount
2903
+ amount: {
2904
+ type: 'number',
2905
+ description: 'Authorization amount in cents',
2906
+ },
2907
+ amountDetails: {
2908
+ type: 'json',
2909
+ optional: true,
2910
+ description: 'Amount details (atm_fee, cashback, etc.)',
2911
+ },
2912
+ currency: {
2913
+ type: 'string',
2914
+ description: 'Currency code (ISO 4217)',
2915
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
2916
+ },
2917
+ // Status
2918
+ status: {
2919
+ type: 'string',
2920
+ description: 'Status: pending, reversed, closed',
2921
+ examples: ['pending', 'reversed', 'closed'],
2922
+ },
2923
+ approved: {
2924
+ type: 'boolean',
2925
+ description: 'Whether authorization was approved',
2926
+ },
2927
+ // Merchant
2928
+ merchantAmount: {
2929
+ type: 'number',
2930
+ optional: true,
2931
+ description: 'Merchant amount in merchant currency',
2932
+ },
2933
+ merchantCurrency: {
2934
+ type: 'string',
2935
+ optional: true,
2936
+ description: 'Merchant currency',
2937
+ },
2938
+ merchantData: {
2939
+ type: 'json',
2940
+ optional: true,
2941
+ description: 'Merchant data',
2942
+ },
2943
+ // Verification Data
2944
+ verificationData: {
2945
+ type: 'json',
2946
+ optional: true,
2947
+ description: 'Verification data',
2948
+ },
2949
+ // Request History
2950
+ requestHistory: {
2951
+ type: 'json',
2952
+ array: true,
2953
+ optional: true,
2954
+ description: 'Request history',
2955
+ },
2956
+ // Metadata
2957
+ metadata: {
2958
+ type: 'json',
2959
+ optional: true,
2960
+ description: 'Additional metadata',
2961
+ },
2962
+ // Timestamps
2963
+ created: {
2964
+ type: 'datetime',
2965
+ description: 'Time at which the authorization was created',
2966
+ },
2967
+ },
2968
+ relationships: {
2969
+ card: {
2970
+ type: 'IssuingCard',
2971
+ description: 'Card used',
2972
+ },
2973
+ cardholder: {
2974
+ type: 'IssuingCardholder',
2975
+ required: false,
2976
+ description: 'Cardholder',
2977
+ },
2978
+ transactions: {
2979
+ type: 'IssuingTransaction[]',
2980
+ description: 'Transactions created from this authorization',
2981
+ },
2982
+ },
2983
+ actions: [
2984
+ 'approve',
2985
+ 'decline',
2986
+ 'list',
2987
+ 'retrieve',
2988
+ 'update',
2989
+ ],
2990
+ events: [
2991
+ 'issuing_authorization.created',
2992
+ 'issuing_authorization.updated',
2993
+ 'issuing_authorization.request',
2994
+ ],
2995
+ };
2996
+ /**
2997
+ * IssuingTransaction entity
2998
+ *
2999
+ * Represents a completed card transaction
3000
+ */
3001
+ export const IssuingTransaction = {
3002
+ singular: 'issuing transaction',
3003
+ plural: 'issuing transactions',
3004
+ description: 'A completed card transaction',
3005
+ properties: {
3006
+ // Identity
3007
+ issuingTransactionId: {
3008
+ type: 'string',
3009
+ description: 'Unique transaction identifier',
3010
+ },
3011
+ // Amount
3012
+ amount: {
3013
+ type: 'number',
3014
+ description: 'Transaction amount in cents',
3015
+ },
3016
+ amountDetails: {
3017
+ type: 'json',
3018
+ optional: true,
3019
+ description: 'Amount details',
3020
+ },
3021
+ currency: {
3022
+ type: 'string',
3023
+ description: 'Currency code (ISO 4217)',
3024
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
3025
+ },
3026
+ // Type
3027
+ type: {
3028
+ type: 'string',
3029
+ description: 'Transaction type: capture or refund',
3030
+ examples: ['capture', 'refund'],
3031
+ },
3032
+ // Merchant
3033
+ merchantAmount: {
3034
+ type: 'number',
3035
+ optional: true,
3036
+ description: 'Merchant amount',
3037
+ },
3038
+ merchantCurrency: {
3039
+ type: 'string',
3040
+ optional: true,
3041
+ description: 'Merchant currency',
3042
+ },
3043
+ merchantData: {
3044
+ type: 'json',
3045
+ optional: true,
3046
+ description: 'Merchant data',
3047
+ },
3048
+ // Purchase Details
3049
+ purchaseDetails: {
3050
+ type: 'json',
3051
+ optional: true,
3052
+ description: 'Purchase details',
3053
+ },
3054
+ // Metadata
3055
+ metadata: {
3056
+ type: 'json',
3057
+ optional: true,
3058
+ description: 'Additional metadata',
3059
+ },
3060
+ // Timestamps
3061
+ created: {
3062
+ type: 'datetime',
3063
+ description: 'Time at which the transaction was created',
3064
+ },
3065
+ },
3066
+ relationships: {
3067
+ card: {
3068
+ type: 'IssuingCard',
3069
+ description: 'Card used',
3070
+ },
3071
+ cardholder: {
3072
+ type: 'IssuingCardholder',
3073
+ required: false,
3074
+ description: 'Cardholder',
3075
+ },
3076
+ authorization: {
3077
+ type: 'IssuingAuthorization',
3078
+ required: false,
3079
+ description: 'Authorization',
3080
+ },
3081
+ dispute: {
3082
+ type: 'IssuingDispute',
3083
+ required: false,
3084
+ description: 'Dispute if disputed',
3085
+ },
3086
+ },
3087
+ actions: [
3088
+ 'list',
3089
+ 'retrieve',
3090
+ 'update',
3091
+ ],
3092
+ events: [
3093
+ 'issuing_transaction.created',
3094
+ 'issuing_transaction.updated',
3095
+ ],
3096
+ };
3097
+ /**
3098
+ * IssuingDispute entity
3099
+ *
3100
+ * Represents a dispute on a card transaction
3101
+ */
3102
+ export const IssuingDispute = {
3103
+ singular: 'issuing dispute',
3104
+ plural: 'issuing disputes',
3105
+ description: 'A dispute on a card transaction',
3106
+ properties: {
3107
+ // Identity
3108
+ issuingDisputeId: {
3109
+ type: 'string',
3110
+ description: 'Unique dispute identifier',
3111
+ },
3112
+ // Amount
3113
+ amount: {
3114
+ type: 'number',
3115
+ description: 'Disputed amount in cents',
3116
+ },
3117
+ currency: {
3118
+ type: 'string',
3119
+ description: 'Currency code (ISO 4217)',
3120
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
3121
+ },
3122
+ // Status
3123
+ status: {
3124
+ type: 'string',
3125
+ description: 'Status: unsubmitted, submitted, won, lost, expired',
3126
+ examples: ['unsubmitted', 'submitted', 'won', 'lost', 'expired'],
3127
+ },
3128
+ // Evidence
3129
+ evidence: {
3130
+ type: 'json',
3131
+ optional: true,
3132
+ description: 'Evidence for dispute',
3133
+ },
3134
+ // Metadata
3135
+ metadata: {
3136
+ type: 'json',
3137
+ optional: true,
3138
+ description: 'Additional metadata',
3139
+ },
3140
+ // Timestamps
3141
+ created: {
3142
+ type: 'datetime',
3143
+ description: 'Time at which the dispute was created',
3144
+ },
3145
+ },
3146
+ relationships: {
3147
+ transaction: {
3148
+ type: 'IssuingTransaction',
3149
+ description: 'Transaction being disputed',
3150
+ },
3151
+ },
3152
+ actions: [
3153
+ 'create',
3154
+ 'submit',
3155
+ 'list',
3156
+ 'retrieve',
3157
+ 'update',
3158
+ ],
3159
+ events: [
3160
+ 'issuing_dispute.created',
3161
+ 'issuing_dispute.updated',
3162
+ 'issuing_dispute.closed',
3163
+ 'issuing_dispute.funds_reinstated',
3164
+ ],
3165
+ };
3166
+ // =============================================================================
3167
+ // BANK
3168
+ // =============================================================================
3169
+ /**
3170
+ * BankAccount entity
3171
+ *
3172
+ * Represents an external bank account
3173
+ */
3174
+ export const BankAccount = {
3175
+ singular: 'bank account',
3176
+ plural: 'bank accounts',
3177
+ description: 'An external bank account',
3178
+ properties: {
3179
+ // Identity
3180
+ bankAccountId: {
3181
+ type: 'string',
3182
+ description: 'Unique bank account identifier',
3183
+ },
3184
+ accountHolderName: {
3185
+ type: 'string',
3186
+ optional: true,
3187
+ description: 'Account holder name',
3188
+ },
3189
+ accountHolderType: {
3190
+ type: 'string',
3191
+ optional: true,
3192
+ description: 'Account holder type: individual or company',
3193
+ examples: ['individual', 'company'],
3194
+ },
3195
+ // Bank Details
3196
+ bankName: {
3197
+ type: 'string',
3198
+ optional: true,
3199
+ description: 'Bank name',
3200
+ },
3201
+ country: {
3202
+ type: 'string',
3203
+ description: 'Country code',
3204
+ },
3205
+ currency: {
3206
+ type: 'string',
3207
+ description: 'Currency code (ISO 4217)',
3208
+ examples: ['USD', 'EUR', 'GBP', 'JPY'],
3209
+ },
3210
+ // Account Number
3211
+ last4: {
3212
+ type: 'string',
3213
+ optional: true,
3214
+ description: 'Last 4 digits of account number',
3215
+ },
3216
+ routingNumber: {
3217
+ type: 'string',
3218
+ optional: true,
3219
+ description: 'Routing number',
3220
+ },
3221
+ // Status
3222
+ status: {
3223
+ type: 'string',
3224
+ optional: true,
3225
+ description: 'Status: new, validated, verified, verification_failed, errored',
3226
+ examples: ['new', 'validated', 'verified', 'verification_failed', 'errored'],
3227
+ },
3228
+ // Fingerprint
3229
+ fingerprint: {
3230
+ type: 'string',
3231
+ optional: true,
3232
+ description: 'Unique fingerprint',
3233
+ },
3234
+ // Metadata
3235
+ metadata: {
3236
+ type: 'json',
3237
+ optional: true,
3238
+ description: 'Additional metadata',
3239
+ },
3240
+ },
3241
+ relationships: {
3242
+ customer: {
3243
+ type: 'Customer',
3244
+ required: false,
3245
+ description: 'Customer this bank account belongs to',
3246
+ },
3247
+ account: {
3248
+ type: 'Account',
3249
+ required: false,
3250
+ description: 'Connected account this bank account belongs to',
3251
+ },
3252
+ },
3253
+ actions: [
3254
+ 'create',
3255
+ 'update',
3256
+ 'delete',
3257
+ 'verify',
3258
+ 'list',
3259
+ 'retrieve',
3260
+ ],
3261
+ events: [],
3262
+ };
3263
+ // =============================================================================
3264
+ // WEBHOOKS
3265
+ // =============================================================================
3266
+ /**
3267
+ * WebhookEndpoint entity
3268
+ *
3269
+ * Represents a webhook endpoint configuration
3270
+ */
3271
+ export const WebhookEndpoint = {
3272
+ singular: 'webhook endpoint',
3273
+ plural: 'webhook endpoints',
3274
+ description: 'A webhook endpoint for receiving events',
3275
+ properties: {
3276
+ // Identity
3277
+ webhookEndpointId: {
3278
+ type: 'string',
3279
+ description: 'Unique webhook endpoint identifier',
3280
+ },
3281
+ // URL
3282
+ url: {
3283
+ type: 'url',
3284
+ description: 'Webhook URL',
3285
+ },
3286
+ // Status
3287
+ status: {
3288
+ type: 'string',
3289
+ optional: true,
3290
+ description: 'Status: enabled or disabled',
3291
+ examples: ['enabled', 'disabled'],
3292
+ },
3293
+ // Events
3294
+ enabledEvents: {
3295
+ type: 'string',
3296
+ array: true,
3297
+ description: 'Events to send to this endpoint',
3298
+ },
3299
+ // API Version
3300
+ apiVersion: {
3301
+ type: 'string',
3302
+ optional: true,
3303
+ description: 'API version',
3304
+ },
3305
+ // Description
3306
+ description: {
3307
+ type: 'string',
3308
+ optional: true,
3309
+ description: 'Endpoint description',
3310
+ },
3311
+ // Secret
3312
+ secret: {
3313
+ type: 'string',
3314
+ optional: true,
3315
+ description: 'Webhook signing secret',
3316
+ },
3317
+ // Metadata
3318
+ metadata: {
3319
+ type: 'json',
3320
+ optional: true,
3321
+ description: 'Additional metadata',
3322
+ },
3323
+ // Timestamps
3324
+ created: {
3325
+ type: 'datetime',
3326
+ description: 'Time at which the endpoint was created',
3327
+ },
3328
+ },
3329
+ relationships: {},
3330
+ actions: [
3331
+ 'create',
3332
+ 'update',
3333
+ 'delete',
3334
+ 'list',
3335
+ 'retrieve',
3336
+ ],
3337
+ events: [],
3338
+ };
3339
+ /**
3340
+ * Event entity
3341
+ *
3342
+ * Represents a Stripe event
3343
+ */
3344
+ export const Event = {
3345
+ singular: 'event',
3346
+ plural: 'events',
3347
+ description: 'A Stripe API event',
3348
+ properties: {
3349
+ // Identity
3350
+ eventId: {
3351
+ type: 'string',
3352
+ description: 'Unique event identifier',
3353
+ },
3354
+ // Type
3355
+ type: {
3356
+ type: 'string',
3357
+ description: 'Event type (e.g., customer.created, charge.succeeded)',
3358
+ },
3359
+ // Data
3360
+ data: {
3361
+ type: 'json',
3362
+ description: 'Event data',
3363
+ },
3364
+ // API Version
3365
+ apiVersion: {
3366
+ type: 'string',
3367
+ optional: true,
3368
+ description: 'API version',
3369
+ },
3370
+ // Request
3371
+ request: {
3372
+ type: 'json',
3373
+ optional: true,
3374
+ description: 'Request information',
3375
+ },
3376
+ // Pending Webhooks
3377
+ pendingWebhooks: {
3378
+ type: 'number',
3379
+ optional: true,
3380
+ description: 'Number of pending webhooks',
3381
+ },
3382
+ // Livemode
3383
+ livemode: {
3384
+ type: 'boolean',
3385
+ description: 'Whether in live mode',
3386
+ },
3387
+ // Timestamps
3388
+ created: {
3389
+ type: 'datetime',
3390
+ description: 'Time at which the event was created',
3391
+ },
3392
+ },
3393
+ relationships: {},
3394
+ actions: [
3395
+ 'list',
3396
+ 'retrieve',
3397
+ ],
3398
+ events: [],
3399
+ };
3400
+ // =============================================================================
3401
+ // EXPORTS
3402
+ // =============================================================================
3403
+ /**
3404
+ * All finance entity types
3405
+ */
3406
+ export const FinanceEntities = {
3407
+ // Core
3408
+ Customer,
3409
+ Product,
3410
+ Price,
3411
+ // Payments
3412
+ PaymentMethod,
3413
+ PaymentIntent,
3414
+ Charge,
3415
+ Refund,
3416
+ // Billing
3417
+ Invoice,
3418
+ InvoiceLineItem,
3419
+ Subscription,
3420
+ SubscriptionItem,
3421
+ Quote,
3422
+ // Balance
3423
+ Balance,
3424
+ BalanceTransaction,
3425
+ // Connect
3426
+ Account,
3427
+ AccountLink,
3428
+ Transfer,
3429
+ Payout,
3430
+ ApplicationFee,
3431
+ // Treasury
3432
+ FinancialAccount,
3433
+ TreasuryTransaction,
3434
+ InboundTransfer,
3435
+ OutboundTransfer,
3436
+ OutboundPayment,
3437
+ ReceivedCredit,
3438
+ ReceivedDebit,
3439
+ // Issuing
3440
+ IssuingCard,
3441
+ IssuingCardholder,
3442
+ IssuingAuthorization,
3443
+ IssuingTransaction,
3444
+ IssuingDispute,
3445
+ // Bank
3446
+ BankAccount,
3447
+ // Webhooks
3448
+ WebhookEndpoint,
3449
+ Event,
3450
+ };
3451
+ /**
3452
+ * Entity categories for organization
3453
+ */
3454
+ export const FinanceCategories = {
3455
+ core: ['Customer', 'Product', 'Price'],
3456
+ payments: ['PaymentMethod', 'PaymentIntent', 'Charge', 'Refund'],
3457
+ billing: ['Invoice', 'InvoiceLineItem', 'Subscription', 'SubscriptionItem', 'Quote'],
3458
+ balance: ['Balance', 'BalanceTransaction'],
3459
+ connect: ['Account', 'AccountLink', 'Transfer', 'Payout', 'ApplicationFee'],
3460
+ treasury: [
3461
+ 'FinancialAccount',
3462
+ 'TreasuryTransaction',
3463
+ 'InboundTransfer',
3464
+ 'OutboundTransfer',
3465
+ 'OutboundPayment',
3466
+ 'ReceivedCredit',
3467
+ 'ReceivedDebit',
3468
+ ],
3469
+ issuing: [
3470
+ 'IssuingCard',
3471
+ 'IssuingCardholder',
3472
+ 'IssuingAuthorization',
3473
+ 'IssuingTransaction',
3474
+ 'IssuingDispute',
3475
+ ],
3476
+ bank: ['BankAccount'],
3477
+ webhooks: ['WebhookEndpoint', 'Event'],
3478
+ };