@bubblelab/bubble-core 0.1.50 → 0.1.52

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 (95) hide show
  1. package/dist/bubble-bundle.d.ts +126 -106
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +4 -0
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubbles/service-bubble/agi-inc.d.ts +132 -132
  6. package/dist/bubbles/service-bubble/ai-agent.d.ts +44 -44
  7. package/dist/bubbles/service-bubble/airtable.d.ts +278 -278
  8. package/dist/bubbles/service-bubble/apify/apify.d.ts +38 -38
  9. package/dist/bubbles/service-bubble/ashby/ashby.d.ts +154 -154
  10. package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +57 -57
  11. package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +94 -94
  12. package/dist/bubbles/service-bubble/eleven-labs.d.ts +48 -48
  13. package/dist/bubbles/service-bubble/firecrawl.d.ts +248 -248
  14. package/dist/bubbles/service-bubble/followupboss.d.ts +306 -306
  15. package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +64 -64
  16. package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts.map +1 -1
  17. package/dist/bubbles/service-bubble/fullenrich/fullenrich.js +8 -4
  18. package/dist/bubbles/service-bubble/fullenrich/fullenrich.js.map +1 -1
  19. package/dist/bubbles/service-bubble/github.d.ts +180 -180
  20. package/dist/bubbles/service-bubble/gmail.d.ts +372 -372
  21. package/dist/bubbles/service-bubble/google-calendar.d.ts +56 -56
  22. package/dist/bubbles/service-bubble/google-drive.d.ts +128 -128
  23. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +54 -54
  24. package/dist/bubbles/service-bubble/hello-world.d.ts +6 -6
  25. package/dist/bubbles/service-bubble/http.d.ts +12 -12
  26. package/dist/bubbles/service-bubble/insforge-db.d.ts +16 -16
  27. package/dist/bubbles/service-bubble/jira/jira.d.ts +67 -67
  28. package/dist/bubbles/service-bubble/notion/notion.d.ts +829 -829
  29. package/dist/bubbles/service-bubble/postgresql.d.ts +16 -16
  30. package/dist/bubbles/service-bubble/resend.d.ts +24 -24
  31. package/dist/bubbles/service-bubble/slack/slack.d.ts +360 -360
  32. package/dist/bubbles/service-bubble/storage.d.ts +40 -40
  33. package/dist/bubbles/service-bubble/stripe/index.d.ts +4 -0
  34. package/dist/bubbles/service-bubble/stripe/index.d.ts.map +1 -0
  35. package/dist/bubbles/service-bubble/stripe/index.js +4 -0
  36. package/dist/bubbles/service-bubble/stripe/index.js.map +1 -0
  37. package/dist/bubbles/service-bubble/stripe/stripe.d.ts +1347 -0
  38. package/dist/bubbles/service-bubble/stripe/stripe.d.ts.map +1 -0
  39. package/dist/bubbles/service-bubble/stripe/stripe.js +669 -0
  40. package/dist/bubbles/service-bubble/stripe/stripe.js.map +1 -0
  41. package/dist/bubbles/service-bubble/stripe/stripe.schema.d.ts +1496 -0
  42. package/dist/bubbles/service-bubble/stripe/stripe.schema.d.ts.map +1 -0
  43. package/dist/bubbles/service-bubble/stripe/stripe.schema.js +671 -0
  44. package/dist/bubbles/service-bubble/stripe/stripe.schema.js.map +1 -0
  45. package/dist/bubbles/service-bubble/stripe/stripe.utils.d.ts +40 -0
  46. package/dist/bubbles/service-bubble/stripe/stripe.utils.d.ts.map +1 -0
  47. package/dist/bubbles/service-bubble/stripe/stripe.utils.js +111 -0
  48. package/dist/bubbles/service-bubble/stripe/stripe.utils.js.map +1 -0
  49. package/dist/bubbles/service-bubble/telegram.d.ts +254 -254
  50. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +40 -40
  51. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +6 -6
  52. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +16 -16
  53. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +8 -8
  54. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +8 -8
  55. package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +22 -22
  56. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
  57. package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +4 -4
  58. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +8 -8
  59. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +8 -8
  60. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts +4 -4
  61. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +324 -324
  62. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +12 -12
  63. package/dist/bubbles/tool-bubble/people-search-tool.d.ts +14 -14
  64. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +12 -12
  65. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +4 -4
  66. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +8 -8
  67. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +60 -60
  68. package/dist/bubbles/tool-bubble/tool-template.d.ts +8 -8
  69. package/dist/bubbles/tool-bubble/twitter-tool.d.ts +150 -150
  70. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +16 -16
  71. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +12 -12
  72. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +12 -12
  73. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +14 -14
  74. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +28 -28
  75. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
  76. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +28 -28
  77. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +8 -8
  78. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +88 -88
  79. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +16 -16
  80. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +4 -4
  81. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +8 -8
  82. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +4 -4
  83. package/dist/bubbles.json +2056 -2
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +1 -0
  87. package/dist/index.js.map +1 -1
  88. package/dist/types/base-bubble-class.d.ts.map +1 -1
  89. package/dist/types/base-bubble-class.js +12 -0
  90. package/dist/types/base-bubble-class.js.map +1 -1
  91. package/dist/utils/schema-comparison.d.ts +10 -0
  92. package/dist/utils/schema-comparison.d.ts.map +1 -1
  93. package/dist/utils/schema-comparison.js +215 -0
  94. package/dist/utils/schema-comparison.js.map +1 -1
  95. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/stripe/stripe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,YAAY,CACvB,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,CAC/C,SAAQ,aAAa,CACrB,CAAC,EACD,OAAO,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC,CACrD;IACC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,SAAS,CAAU;IAC1C,MAAM,CAAC,QAAQ,CAAC,OAAO,YAAY;IACnC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAU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';
2
+ import { CredentialType } from '@bubblelab/shared-schemas';
3
+ import { StripeParamsSchema, StripeResultSchema, } from './stripe.schema.js';
4
+ /**
5
+ * Stripe Service Bubble
6
+ *
7
+ * Comprehensive Stripe integration for payment and billing management.
8
+ * Based on the Stripe MCP (Model Context Protocol) implementation.
9
+ *
10
+ * Features:
11
+ * - Customer management (create, list)
12
+ * - Product and price management
13
+ * - Payment links creation
14
+ * - Invoice management
15
+ * - Subscription management
16
+ * - Payment intents listing
17
+ * - Refund creation
18
+ * - Balance retrieval
19
+ *
20
+ * Use cases:
21
+ * - Accept payments through payment links
22
+ * - Manage customer billing and subscriptions
23
+ * - Create and manage products and pricing
24
+ * - Process refunds
25
+ * - Monitor account balance
26
+ *
27
+ * Security Features:
28
+ * - OAuth 2.0 authentication with Stripe
29
+ * - Secure API key handling
30
+ * - Input validation with Zod schemas
31
+ */
32
+ export class StripeBubble extends ServiceBubble {
33
+ static type = 'service';
34
+ static service = 'stripe';
35
+ static authType = 'apikey';
36
+ static bubbleName = 'stripe';
37
+ static schema = StripeParamsSchema;
38
+ static resultSchema = StripeResultSchema;
39
+ static shortDescription = 'Stripe integration for payments, billing, and subscriptions';
40
+ static longDescription = `
41
+ Stripe service integration for comprehensive payment and billing management.
42
+ Based on the official Stripe MCP implementation.
43
+
44
+ Features:
45
+ - Customer management (create, list)
46
+ - Product and price management
47
+ - Payment links creation
48
+ - Invoice management
49
+ - Subscription management
50
+ - Payment intents listing
51
+ - Refund creation
52
+ - Balance retrieval
53
+
54
+ Use cases:
55
+ - Accept payments through payment links
56
+ - Manage customer billing and subscriptions
57
+ - Create and manage products and pricing
58
+ - Process refunds
59
+ - Monitor account balance
60
+
61
+ Security Features:
62
+ - OAuth 2.0 authentication with Stripe
63
+ - Secure API key handling
64
+ - Input validation with Zod schemas
65
+ `;
66
+ static alias = 'payments';
67
+ constructor(params = {
68
+ operation: 'list_customers',
69
+ limit: 10,
70
+ }, context) {
71
+ super(params, context);
72
+ }
73
+ async testCredential() {
74
+ const credential = this.chooseCredential();
75
+ if (!credential) {
76
+ return false;
77
+ }
78
+ try {
79
+ // Test by fetching account balance (minimal API call)
80
+ const response = await this.makeStripeRequest('/v1/balance', 'GET');
81
+ return response !== null && typeof response === 'object';
82
+ }
83
+ catch {
84
+ return false;
85
+ }
86
+ }
87
+ async makeStripeRequest(endpoint, method = 'GET', body) {
88
+ const credential = this.chooseCredential();
89
+ if (!credential) {
90
+ throw new Error('Stripe credentials are required');
91
+ }
92
+ const url = `https://api.stripe.com${endpoint}`;
93
+ const headers = {
94
+ Authorization: `Bearer ${credential}`,
95
+ 'Content-Type': 'application/x-www-form-urlencoded',
96
+ };
97
+ const requestInit = {
98
+ method,
99
+ headers,
100
+ };
101
+ if (body && method !== 'GET') {
102
+ // Stripe API uses form-urlencoded format
103
+ requestInit.body = this.encodeFormData(body);
104
+ }
105
+ const response = await fetch(url, requestInit);
106
+ if (!response.ok) {
107
+ const errorData = await response.json().catch(() => ({}));
108
+ const errorMessage = errorData?.error?.message ||
109
+ `Stripe API error: ${response.status} ${response.statusText}`;
110
+ throw new Error(errorMessage);
111
+ }
112
+ return await response.json();
113
+ }
114
+ encodeFormData(data, prefix = '') {
115
+ const params = [];
116
+ for (const [key, value] of Object.entries(data)) {
117
+ if (value === undefined || value === null)
118
+ continue;
119
+ const fullKey = prefix ? `${prefix}[${key}]` : key;
120
+ if (typeof value === 'object' && !Array.isArray(value)) {
121
+ params.push(this.encodeFormData(value, fullKey));
122
+ }
123
+ else if (Array.isArray(value)) {
124
+ value.forEach((item, index) => {
125
+ if (typeof item === 'object') {
126
+ params.push(this.encodeFormData(item, `${fullKey}[${index}]`));
127
+ }
128
+ else {
129
+ params.push(`${encodeURIComponent(`${fullKey}[${index}]`)}=${encodeURIComponent(String(item))}`);
130
+ }
131
+ });
132
+ }
133
+ else {
134
+ params.push(`${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`);
135
+ }
136
+ }
137
+ return params.filter(Boolean).join('&');
138
+ }
139
+ async performAction(context) {
140
+ void context;
141
+ const { operation } = this.params;
142
+ try {
143
+ const result = await (async () => {
144
+ const parsedParams = this.params;
145
+ switch (operation) {
146
+ case 'create_customer':
147
+ return await this.createCustomer(parsedParams);
148
+ case 'list_customers':
149
+ return await this.listCustomers(parsedParams);
150
+ case 'create_product':
151
+ return await this.createProduct(parsedParams);
152
+ case 'list_products':
153
+ return await this.listProducts(parsedParams);
154
+ case 'create_price':
155
+ return await this.createPrice(parsedParams);
156
+ case 'list_prices':
157
+ return await this.listPrices(parsedParams);
158
+ case 'create_payment_link':
159
+ return await this.createPaymentLink(parsedParams);
160
+ case 'create_invoice':
161
+ return await this.createInvoice(parsedParams);
162
+ case 'list_invoices':
163
+ return await this.listInvoices(parsedParams);
164
+ case 'retrieve_invoice':
165
+ return await this.retrieveInvoice(parsedParams);
166
+ case 'finalize_invoice':
167
+ return await this.finalizeInvoice(parsedParams);
168
+ case 'get_balance':
169
+ return await this.getBalance();
170
+ case 'list_payment_intents':
171
+ return await this.listPaymentIntents(parsedParams);
172
+ case 'list_subscriptions':
173
+ return await this.listSubscriptions(parsedParams);
174
+ case 'cancel_subscription':
175
+ return await this.cancelSubscription(parsedParams);
176
+ case 'list_payment_links':
177
+ return await this.listPaymentLinks(parsedParams);
178
+ case 'create_subscription':
179
+ return await this.createSubscription(parsedParams);
180
+ default:
181
+ throw new Error(`Unsupported operation: ${operation}`);
182
+ }
183
+ })();
184
+ return result;
185
+ }
186
+ catch (error) {
187
+ return {
188
+ operation,
189
+ success: false,
190
+ error: error instanceof Error ? error.message : 'Unknown error occurred',
191
+ };
192
+ }
193
+ }
194
+ // ============================================================================
195
+ // CUSTOMER OPERATIONS
196
+ // ============================================================================
197
+ async createCustomer(params) {
198
+ const { name, email, metadata } = params;
199
+ const body = { name };
200
+ if (email)
201
+ body.email = email;
202
+ if (metadata)
203
+ body.metadata = metadata;
204
+ const response = await this.makeStripeRequest('/v1/customers', 'POST', body);
205
+ const customer = response;
206
+ return {
207
+ operation: 'create_customer',
208
+ success: true,
209
+ customer: {
210
+ id: customer.id,
211
+ name: customer.name,
212
+ email: customer.email,
213
+ created: customer.created,
214
+ metadata: customer.metadata,
215
+ },
216
+ error: '',
217
+ };
218
+ }
219
+ async listCustomers(params) {
220
+ const { limit, email } = params;
221
+ const queryParams = new URLSearchParams();
222
+ if (limit)
223
+ queryParams.set('limit', String(limit));
224
+ if (email)
225
+ queryParams.set('email', email);
226
+ const endpoint = `/v1/customers${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
227
+ const response = await this.makeStripeRequest(endpoint, 'GET');
228
+ const data = response;
229
+ return {
230
+ operation: 'list_customers',
231
+ success: true,
232
+ customers: data.data.map((c) => ({
233
+ id: c.id,
234
+ name: c.name,
235
+ email: c.email,
236
+ created: c.created,
237
+ metadata: c.metadata,
238
+ })),
239
+ error: '',
240
+ };
241
+ }
242
+ // ============================================================================
243
+ // PRODUCT OPERATIONS
244
+ // ============================================================================
245
+ async createProduct(params) {
246
+ const { name, description, metadata } = params;
247
+ const body = { name };
248
+ if (description)
249
+ body.description = description;
250
+ if (metadata)
251
+ body.metadata = metadata;
252
+ const response = await this.makeStripeRequest('/v1/products', 'POST', body);
253
+ const product = response;
254
+ return {
255
+ operation: 'create_product',
256
+ success: true,
257
+ product: {
258
+ id: product.id,
259
+ name: product.name,
260
+ description: product.description,
261
+ active: product.active,
262
+ created: product.created,
263
+ metadata: product.metadata,
264
+ },
265
+ error: '',
266
+ };
267
+ }
268
+ async listProducts(params) {
269
+ const { limit, active } = params;
270
+ const queryParams = new URLSearchParams();
271
+ if (limit)
272
+ queryParams.set('limit', String(limit));
273
+ if (active !== undefined)
274
+ queryParams.set('active', String(active));
275
+ const endpoint = `/v1/products${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
276
+ const response = await this.makeStripeRequest(endpoint, 'GET');
277
+ const data = response;
278
+ return {
279
+ operation: 'list_products',
280
+ success: true,
281
+ products: data.data.map((p) => ({
282
+ id: p.id,
283
+ name: p.name,
284
+ description: p.description,
285
+ active: p.active,
286
+ created: p.created,
287
+ metadata: p.metadata,
288
+ })),
289
+ error: '',
290
+ };
291
+ }
292
+ // ============================================================================
293
+ // PRICE OPERATIONS
294
+ // ============================================================================
295
+ async createPrice(params) {
296
+ const { product, unit_amount, currency, recurring, metadata } = params;
297
+ const body = {
298
+ product,
299
+ unit_amount,
300
+ currency,
301
+ };
302
+ if (recurring)
303
+ body.recurring = recurring;
304
+ if (metadata)
305
+ body.metadata = metadata;
306
+ const response = await this.makeStripeRequest('/v1/prices', 'POST', body);
307
+ const price = response;
308
+ return {
309
+ operation: 'create_price',
310
+ success: true,
311
+ price: {
312
+ id: price.id,
313
+ product: price.product,
314
+ unit_amount: price.unit_amount,
315
+ currency: price.currency,
316
+ type: price.type,
317
+ active: price.active,
318
+ created: price.created,
319
+ metadata: price.metadata,
320
+ },
321
+ error: '',
322
+ };
323
+ }
324
+ async listPrices(params) {
325
+ const { limit, product, active } = params;
326
+ const queryParams = new URLSearchParams();
327
+ if (limit)
328
+ queryParams.set('limit', String(limit));
329
+ if (product)
330
+ queryParams.set('product', product);
331
+ if (active !== undefined)
332
+ queryParams.set('active', String(active));
333
+ const endpoint = `/v1/prices${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
334
+ const response = await this.makeStripeRequest(endpoint, 'GET');
335
+ const data = response;
336
+ return {
337
+ operation: 'list_prices',
338
+ success: true,
339
+ prices: data.data.map((p) => ({
340
+ id: p.id,
341
+ product: p.product,
342
+ unit_amount: p.unit_amount,
343
+ currency: p.currency,
344
+ type: p.type,
345
+ active: p.active,
346
+ created: p.created,
347
+ metadata: p.metadata,
348
+ })),
349
+ error: '',
350
+ };
351
+ }
352
+ // ============================================================================
353
+ // PAYMENT LINK OPERATIONS
354
+ // ============================================================================
355
+ async createPaymentLink(params) {
356
+ const { price, quantity, redirect_url, metadata } = params;
357
+ const body = {
358
+ line_items: [{ price, quantity }],
359
+ };
360
+ if (redirect_url) {
361
+ body.after_completion = {
362
+ type: 'redirect',
363
+ redirect: { url: redirect_url },
364
+ };
365
+ }
366
+ if (metadata)
367
+ body.metadata = metadata;
368
+ const response = await this.makeStripeRequest('/v1/payment_links', 'POST', body);
369
+ const paymentLink = response;
370
+ return {
371
+ operation: 'create_payment_link',
372
+ success: true,
373
+ payment_link: {
374
+ id: paymentLink.id,
375
+ url: paymentLink.url,
376
+ active: paymentLink.active,
377
+ created: paymentLink.created,
378
+ metadata: paymentLink.metadata,
379
+ },
380
+ error: '',
381
+ };
382
+ }
383
+ // ============================================================================
384
+ // INVOICE OPERATIONS
385
+ // ============================================================================
386
+ async createInvoice(params) {
387
+ const { customer, auto_advance, collection_method, days_until_due, metadata, } = params;
388
+ const body = {
389
+ customer,
390
+ auto_advance,
391
+ collection_method,
392
+ };
393
+ if (days_until_due)
394
+ body.days_until_due = days_until_due;
395
+ if (metadata)
396
+ body.metadata = metadata;
397
+ const response = await this.makeStripeRequest('/v1/invoices', 'POST', body);
398
+ const invoice = response;
399
+ return {
400
+ operation: 'create_invoice',
401
+ success: true,
402
+ invoice: {
403
+ id: invoice.id,
404
+ customer: invoice.customer,
405
+ status: invoice.status,
406
+ total: invoice.total,
407
+ currency: invoice.currency,
408
+ created: invoice.created,
409
+ hosted_invoice_url: invoice.hosted_invoice_url,
410
+ metadata: invoice.metadata,
411
+ },
412
+ error: '',
413
+ };
414
+ }
415
+ async listInvoices(params) {
416
+ const { limit, customer, status } = params;
417
+ const queryParams = new URLSearchParams();
418
+ if (limit)
419
+ queryParams.set('limit', String(limit));
420
+ if (customer)
421
+ queryParams.set('customer', customer);
422
+ if (status)
423
+ queryParams.set('status', status);
424
+ const endpoint = `/v1/invoices${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
425
+ const response = await this.makeStripeRequest(endpoint, 'GET');
426
+ const data = response;
427
+ return {
428
+ operation: 'list_invoices',
429
+ success: true,
430
+ invoices: data.data.map((i) => ({
431
+ id: i.id,
432
+ customer: i.customer,
433
+ status: i.status,
434
+ total: i.total,
435
+ currency: i.currency,
436
+ created: i.created,
437
+ hosted_invoice_url: i.hosted_invoice_url,
438
+ invoice_pdf: i.invoice_pdf,
439
+ metadata: i.metadata,
440
+ })),
441
+ error: '',
442
+ };
443
+ }
444
+ async retrieveInvoice(params) {
445
+ const { invoice_id } = params;
446
+ const response = await this.makeStripeRequest(`/v1/invoices/${invoice_id}`, 'GET');
447
+ const invoice = response;
448
+ return {
449
+ operation: 'retrieve_invoice',
450
+ success: true,
451
+ invoice: {
452
+ id: invoice.id,
453
+ customer: invoice.customer,
454
+ status: invoice.status,
455
+ total: invoice.total,
456
+ currency: invoice.currency,
457
+ created: invoice.created,
458
+ hosted_invoice_url: invoice.hosted_invoice_url,
459
+ invoice_pdf: invoice.invoice_pdf,
460
+ metadata: invoice.metadata,
461
+ },
462
+ error: '',
463
+ };
464
+ }
465
+ async finalizeInvoice(params) {
466
+ const { invoice_id, auto_advance } = params;
467
+ const body = {};
468
+ if (auto_advance !== undefined) {
469
+ body.auto_advance = String(auto_advance);
470
+ }
471
+ const response = await this.makeStripeRequest(`/v1/invoices/${invoice_id}/finalize`, 'POST', Object.keys(body).length > 0 ? body : undefined);
472
+ const invoice = response;
473
+ return {
474
+ operation: 'finalize_invoice',
475
+ success: true,
476
+ invoice: {
477
+ id: invoice.id,
478
+ customer: invoice.customer,
479
+ status: invoice.status,
480
+ total: invoice.total,
481
+ currency: invoice.currency,
482
+ created: invoice.created,
483
+ hosted_invoice_url: invoice.hosted_invoice_url,
484
+ invoice_pdf: invoice.invoice_pdf,
485
+ metadata: invoice.metadata,
486
+ },
487
+ error: '',
488
+ };
489
+ }
490
+ // ============================================================================
491
+ // BALANCE OPERATIONS
492
+ // ============================================================================
493
+ async getBalance() {
494
+ const response = await this.makeStripeRequest('/v1/balance', 'GET');
495
+ const balance = response;
496
+ return {
497
+ operation: 'get_balance',
498
+ success: true,
499
+ balance: {
500
+ available: balance.available.map((b) => ({
501
+ amount: b.amount,
502
+ currency: b.currency,
503
+ })),
504
+ pending: balance.pending.map((b) => ({
505
+ amount: b.amount,
506
+ currency: b.currency,
507
+ })),
508
+ },
509
+ error: '',
510
+ };
511
+ }
512
+ // ============================================================================
513
+ // PAYMENT INTENT OPERATIONS
514
+ // ============================================================================
515
+ async listPaymentIntents(params) {
516
+ const { limit, customer } = params;
517
+ const queryParams = new URLSearchParams();
518
+ if (limit)
519
+ queryParams.set('limit', String(limit));
520
+ if (customer)
521
+ queryParams.set('customer', customer);
522
+ const endpoint = `/v1/payment_intents${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
523
+ const response = await this.makeStripeRequest(endpoint, 'GET');
524
+ const data = response;
525
+ return {
526
+ operation: 'list_payment_intents',
527
+ success: true,
528
+ payment_intents: data.data.map((pi) => ({
529
+ id: pi.id,
530
+ amount: pi.amount,
531
+ currency: pi.currency,
532
+ status: pi.status,
533
+ customer: pi.customer,
534
+ created: pi.created,
535
+ metadata: pi.metadata,
536
+ })),
537
+ error: '',
538
+ };
539
+ }
540
+ // ============================================================================
541
+ // SUBSCRIPTION OPERATIONS
542
+ // ============================================================================
543
+ async listSubscriptions(params) {
544
+ const { limit, customer, status } = params;
545
+ const queryParams = new URLSearchParams();
546
+ if (limit)
547
+ queryParams.set('limit', String(limit));
548
+ if (customer)
549
+ queryParams.set('customer', customer);
550
+ if (status && status !== 'all')
551
+ queryParams.set('status', status);
552
+ const endpoint = `/v1/subscriptions${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
553
+ const response = await this.makeStripeRequest(endpoint, 'GET');
554
+ const data = response;
555
+ return {
556
+ operation: 'list_subscriptions',
557
+ success: true,
558
+ subscriptions: data.data.map((s) => ({
559
+ id: s.id,
560
+ customer: s.customer,
561
+ status: s.status,
562
+ current_period_start: s.current_period_start,
563
+ current_period_end: s.current_period_end,
564
+ cancel_at_period_end: s.cancel_at_period_end,
565
+ created: s.created,
566
+ metadata: s.metadata,
567
+ })),
568
+ error: '',
569
+ };
570
+ }
571
+ async cancelSubscription(params) {
572
+ const { subscription_id, cancel_at_period_end } = params;
573
+ let response;
574
+ if (cancel_at_period_end) {
575
+ // Update to cancel at period end
576
+ response = await this.makeStripeRequest(`/v1/subscriptions/${subscription_id}`, 'POST', { cancel_at_period_end: true });
577
+ }
578
+ else {
579
+ // Cancel immediately
580
+ response = await this.makeStripeRequest(`/v1/subscriptions/${subscription_id}`, 'DELETE');
581
+ }
582
+ const subscription = response;
583
+ return {
584
+ operation: 'cancel_subscription',
585
+ success: true,
586
+ subscription: {
587
+ id: subscription.id,
588
+ customer: subscription.customer,
589
+ status: subscription.status,
590
+ current_period_start: subscription.current_period_start,
591
+ current_period_end: subscription.current_period_end,
592
+ cancel_at_period_end: subscription.cancel_at_period_end,
593
+ created: subscription.created,
594
+ metadata: subscription.metadata,
595
+ },
596
+ error: '',
597
+ };
598
+ }
599
+ // ============================================================================
600
+ // PAYMENT LINK LIST OPERATIONS
601
+ // ============================================================================
602
+ async listPaymentLinks(params) {
603
+ const { limit, active } = params;
604
+ const queryParams = new URLSearchParams();
605
+ if (limit)
606
+ queryParams.set('limit', String(limit));
607
+ if (active !== undefined)
608
+ queryParams.set('active', String(active));
609
+ const endpoint = `/v1/payment_links${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
610
+ const response = await this.makeStripeRequest(endpoint, 'GET');
611
+ const data = response;
612
+ return {
613
+ operation: 'list_payment_links',
614
+ success: true,
615
+ payment_links: data.data.map((pl) => ({
616
+ id: pl.id,
617
+ url: pl.url,
618
+ active: pl.active,
619
+ created: pl.created,
620
+ metadata: pl.metadata,
621
+ })),
622
+ error: '',
623
+ };
624
+ }
625
+ // ============================================================================
626
+ // SUBSCRIPTION CREATE OPERATIONS
627
+ // ============================================================================
628
+ async createSubscription(params) {
629
+ const { customer, price, trial_period_days, payment_behavior, metadata } = params;
630
+ const body = {
631
+ customer,
632
+ items: [{ price }],
633
+ payment_behavior: payment_behavior || 'default_incomplete',
634
+ };
635
+ if (trial_period_days)
636
+ body.trial_period_days = trial_period_days;
637
+ if (metadata)
638
+ body.metadata = metadata;
639
+ const response = await this.makeStripeRequest('/v1/subscriptions', 'POST', body);
640
+ const subscription = response;
641
+ return {
642
+ operation: 'create_subscription',
643
+ success: true,
644
+ subscription: {
645
+ id: subscription.id,
646
+ customer: subscription.customer,
647
+ status: subscription.status,
648
+ current_period_start: subscription.current_period_start,
649
+ current_period_end: subscription.current_period_end,
650
+ cancel_at_period_end: subscription.cancel_at_period_end,
651
+ created: subscription.created,
652
+ metadata: subscription.metadata,
653
+ },
654
+ error: '',
655
+ };
656
+ }
657
+ // ============================================================================
658
+ // CREDENTIAL MANAGEMENT
659
+ // ============================================================================
660
+ chooseCredential() {
661
+ const { credentials } = this.params;
662
+ if (!credentials || typeof credentials !== 'object') {
663
+ return undefined;
664
+ }
665
+ // Stripe bubble uses STRIPE_CRED credentials
666
+ return credentials[CredentialType.STRIPE_CRED];
667
+ }
668
+ }
669
+ //# sourceMappingURL=stripe.js.map