@payware/mcp-server 1.0.0

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 (106) hide show
  1. package/.env.example +92 -0
  2. package/MCP-SETUP.md +190 -0
  3. package/README.md +483 -0
  4. package/check-keys.js +52 -0
  5. package/keys/README.md +112 -0
  6. package/mcp-config.json +9 -0
  7. package/package.json +66 -0
  8. package/payware-mcp-config.json +12 -0
  9. package/src/auth/rsa-keys.js +82 -0
  10. package/src/auth/sandbox-setup.js +187 -0
  11. package/src/config/env.js +229 -0
  12. package/src/config/partner-types.js +143 -0
  13. package/src/core/auth/jwt-factory.js +182 -0
  14. package/src/core/auth/jwt-token.js +735 -0
  15. package/src/core/utils/json-serializer.js +100 -0
  16. package/src/core/utils/key-utils.js +133 -0
  17. package/src/index.js +237 -0
  18. package/src/isv/data/index.js +291 -0
  19. package/src/isv/deep-links/delete-product-link.js +154 -0
  20. package/src/isv/deep-links/delete-transaction-link.js +154 -0
  21. package/src/isv/deep-links/get-product-link.js +167 -0
  22. package/src/isv/deep-links/get-transaction-link.js +167 -0
  23. package/src/isv/deep-links/index.js +23 -0
  24. package/src/isv/index.js +103 -0
  25. package/src/isv/oauth2/create-token-simple.js +46 -0
  26. package/src/isv/oauth2/get-token-info.js +157 -0
  27. package/src/isv/oauth2/obtain-token.js +189 -0
  28. package/src/isv/oauth2/token-helper.js +151 -0
  29. package/src/isv/products/audios.js +470 -0
  30. package/src/isv/products/create-product.js +314 -0
  31. package/src/isv/products/delete-product.js +119 -0
  32. package/src/isv/products/get-product-image.js +247 -0
  33. package/src/isv/products/get-product.js +168 -0
  34. package/src/isv/products/index.js +65 -0
  35. package/src/isv/products/list-products.js +136 -0
  36. package/src/isv/products/schedules.js +522 -0
  37. package/src/isv/products/update-product.js +265 -0
  38. package/src/isv/transactions/cancel-transaction.js +129 -0
  39. package/src/isv/transactions/create-transaction.js +361 -0
  40. package/src/isv/transactions/get-status.js +217 -0
  41. package/src/isv/transactions/process-transaction.js +145 -0
  42. package/src/isv/transactions/simulate-callback.js +146 -0
  43. package/src/isv/transactions/transaction-history.js +186 -0
  44. package/src/isv/utils/auth.js +159 -0
  45. package/src/mcp-proxy.js +150 -0
  46. package/src/merchant/data/export-report.js +108 -0
  47. package/src/merchant/data/generate-report.js +151 -0
  48. package/src/merchant/data/get-report-status.js +120 -0
  49. package/src/merchant/data/index.js +351 -0
  50. package/src/merchant/deep-links/delete-product-link.js +121 -0
  51. package/src/merchant/deep-links/delete-transaction-link.js +121 -0
  52. package/src/merchant/deep-links/get-product-link.js +134 -0
  53. package/src/merchant/deep-links/get-transaction-link.js +134 -0
  54. package/src/merchant/deep-links/index.js +23 -0
  55. package/src/merchant/index.js +92 -0
  56. package/src/merchant/products/audios.js +606 -0
  57. package/src/merchant/products/create-product.js +288 -0
  58. package/src/merchant/products/delete-product.js +111 -0
  59. package/src/merchant/products/get-product-image.js +252 -0
  60. package/src/merchant/products/get-product.js +144 -0
  61. package/src/merchant/products/index.js +65 -0
  62. package/src/merchant/products/list-products.js +112 -0
  63. package/src/merchant/products/schedules.js +646 -0
  64. package/src/merchant/products/update-product.js +282 -0
  65. package/src/merchant/transactions/cancel-transaction.js +241 -0
  66. package/src/merchant/transactions/create-transaction.js +482 -0
  67. package/src/merchant/transactions/get-status.js +196 -0
  68. package/src/merchant/transactions/process-transaction.js +349 -0
  69. package/src/merchant/transactions/simulate-callback.js +246 -0
  70. package/src/merchant/transactions/transaction-history.js +258 -0
  71. package/src/payment-institution/data/index.js +280 -0
  72. package/src/payment-institution/deep-links/delete-transaction-link.js +128 -0
  73. package/src/payment-institution/deep-links/get-transaction-link.js +141 -0
  74. package/src/payment-institution/deep-links/index.js +17 -0
  75. package/src/payment-institution/index.js +92 -0
  76. package/src/payment-institution/transactions/create-pi-transaction.js +484 -0
  77. package/src/payment-institution/transactions/finalize-transaction.js +340 -0
  78. package/src/payment-institution/transactions/get-transaction-history.js +269 -0
  79. package/src/payment-institution/transactions/get-transaction-status.js +234 -0
  80. package/src/payment-institution/transactions/process-pi-transaction.js +421 -0
  81. package/src/payment-institution/transactions/simulate-pi-callback.js +326 -0
  82. package/src/payment-institution/transactions/soundbite-transaction.js +269 -0
  83. package/src/proxy-server.js +205 -0
  84. package/src/shared/data/data-api.js +372 -0
  85. package/src/shared/deep-links/api.js +214 -0
  86. package/src/shared/index.js +44 -0
  87. package/src/shared/products/products-api.js +872 -0
  88. package/src/tools/advanced-code-generator.js +2247 -0
  89. package/src/utils/code-examples/common/auth-examples.js +1482 -0
  90. package/src/utils/code-examples/common/helpers.js +416 -0
  91. package/src/utils/code-examples/common/utils-examples.js +591 -0
  92. package/src/utils/code-examples/frameworks/examples.js +859 -0
  93. package/src/utils/code-examples/index.js +441 -0
  94. package/src/utils/code-examples/isv/oauth2.js +600 -0
  95. package/src/utils/code-examples/isv/products.js +666 -0
  96. package/src/utils/code-examples/isv/transactions.js +813 -0
  97. package/src/utils/code-examples/merchant/products.js +497 -0
  98. package/src/utils/code-examples/merchant/transactions.js +623 -0
  99. package/src/utils/code-examples/payment-institution/transactions.js +388 -0
  100. package/src/utils/code-examples/shared/data.js +607 -0
  101. package/src/utils/code-examples/shared/deep-links.js +662 -0
  102. package/src/utils/code-examples/shared/soundbites.js +808 -0
  103. package/src/utils/code-examples.js +646 -0
  104. package/src/utils/format-request.js +363 -0
  105. package/src/utils/json-formatter.js +249 -0
  106. package/src/utils/server-info.js +132 -0
@@ -0,0 +1,606 @@
1
+ import {
2
+ registerAudio,
3
+ getProductAudios,
4
+ getAudio,
5
+ updateAudio,
6
+ deleteAudio
7
+ } from '../../shared/products/products-api.js';
8
+ import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
9
+
10
+ /**
11
+ * Register audio tool implementation for merchants
12
+ */
13
+ export const registerAudioTool = {
14
+ name: "payware_products_register_audio",
15
+ description: `Register an audio file (soundbite) for a product to enable audio-based payment initiation.
16
+
17
+ **Supported formats:** Most audio/video formats (up to 200MB)
18
+ **Note:** For video files, only the audio channel is registered`,
19
+
20
+ inputSchema: {
21
+ type: "object",
22
+ properties: {
23
+ productId: {
24
+ type: "string",
25
+ description: "Product identifier (starts with 'pr')",
26
+ pattern: "^pr[a-zA-Z0-9]+$"
27
+ },
28
+ audioPath: {
29
+ type: "string",
30
+ description: "Path to the audio file to upload (e.g., '/path/to/audio.mp3')"
31
+ },
32
+ partnerId: {
33
+ type: "string",
34
+ description: "Merchant partner ID (uses PAYWARE_PARTNER_ID env var as default)",
35
+ default: getPartnerIdSafe()
36
+ },
37
+ privateKey: {
38
+ type: "string",
39
+ description: "RSA private key for authentication (uses environment-specific private key as default)",
40
+ default: getPrivateKeySafe()
41
+ },
42
+ useSandbox: {
43
+ type: "boolean",
44
+ description: "Use sandbox environment",
45
+ default: true
46
+ }
47
+ },
48
+ required: ["productId", "audioPath"]
49
+ },
50
+
51
+ async handler(args) {
52
+ const {
53
+ productId,
54
+ audioPath,
55
+ partnerId = getPartnerIdSafe(),
56
+ privateKey = getPrivateKeySafe(),
57
+ useSandbox = true
58
+ } = args;
59
+
60
+ if (!productId) {
61
+ throw new Error("Product ID is required");
62
+ }
63
+
64
+ if (!audioPath) {
65
+ throw new Error("Audio file path is required");
66
+ }
67
+
68
+ if (!partnerId || !privateKey) {
69
+ throw new Error("Partner ID and private key are required");
70
+ }
71
+
72
+ try {
73
+ const result = await registerAudio({
74
+ productId,
75
+ audioPath,
76
+ partnerType: 'merchant',
77
+ partnerId,
78
+ privateKey,
79
+ useSandbox
80
+ });
81
+
82
+ const audio = result.data;
83
+
84
+ return {
85
+ content: [{
86
+ type: "text",
87
+ text: `🎵 **Audio Registered Successfully**
88
+
89
+ **Audio Details:**
90
+ - ID: ${audio.id}
91
+ - Product ID: ${audio.productId}
92
+ - Title: ${audio.title}
93
+ - Status: ${audio.status === '1' ? '✅ Ready' : '⏳ Processing'}
94
+ - Duration: ${audio.duration} seconds
95
+ - Uploaded: ${audio.uploadedAt}
96
+
97
+ **API Response:**
98
+ \`\`\`json
99
+ ${JSON.stringify(audio, null, 2)}
100
+ \`\`\`
101
+
102
+ **API Call Details:**
103
+ - Endpoint: ${result.requestInfo.method} ${result.requestInfo.url}
104
+ - Status: ${result.requestInfo.statusCode}
105
+
106
+ **Important Notes:**
107
+ ${audio.status === '0' ? '⏳ Audio is being processed. Check status with `payware_products_get_audio`' : ''}
108
+ ${audio.status === '1' ? '✅ Audio is ready for use in soundbite transactions' : ''}
109
+
110
+ **Next Steps:**
111
+ - Use \`payware_products_get_audios\` to view all product audios
112
+ - Use \`payware_products_get_audio\` to check processing status
113
+ - Create soundbite transactions using this audio`
114
+ }]
115
+ };
116
+ } catch (error) {
117
+ return {
118
+ content: [{
119
+ type: "text",
120
+ text: `❌ **Audio Registration Failed**
121
+
122
+ **Error Details:**
123
+ - Message: ${error.message}
124
+ - Product ID: ${productId}
125
+ - Audio Path: ${audioPath}
126
+
127
+ **Troubleshooting:**
128
+ 1. Verify the audio file path exists and is accessible
129
+ 2. Check file size (max 200MB)
130
+ 3. Ensure supported audio/video format
131
+ 4. Verify the product ID exists and belongs to your account
132
+ 5. Check available storage space`
133
+ }]
134
+ };
135
+ }
136
+ }
137
+ };
138
+
139
+ /**
140
+ * Get product audios tool implementation for merchants
141
+ */
142
+ export const getAudiosTool = {
143
+ name: "payware_products_get_audios",
144
+ description: "Get all registered audio files for a product",
145
+
146
+ inputSchema: {
147
+ type: "object",
148
+ properties: {
149
+ productId: {
150
+ type: "string",
151
+ description: "Product identifier (starts with 'pr')",
152
+ pattern: "^pr[a-zA-Z0-9]+$"
153
+ },
154
+ partnerId: {
155
+ type: "string",
156
+ description: "Merchant partner ID (uses PAYWARE_PARTNER_ID env var as default)",
157
+ default: getPartnerIdSafe()
158
+ },
159
+ privateKey: {
160
+ type: "string",
161
+ description: "RSA private key for authentication (uses environment-specific private key as default)",
162
+ default: getPrivateKeySafe()
163
+ },
164
+ useSandbox: {
165
+ type: "boolean",
166
+ description: "Use sandbox environment",
167
+ default: true
168
+ }
169
+ },
170
+ required: ["productId"]
171
+ },
172
+
173
+ async handler(args) {
174
+ const {
175
+ productId,
176
+ partnerId = getPartnerIdSafe(),
177
+ privateKey = getPrivateKeySafe(),
178
+ useSandbox = true
179
+ } = args;
180
+
181
+ if (!productId) {
182
+ throw new Error("Product ID is required");
183
+ }
184
+
185
+ if (!partnerId || !privateKey) {
186
+ throw new Error("Partner ID and private key are required");
187
+ }
188
+
189
+ try {
190
+ const result = await getProductAudios({
191
+ productId,
192
+ partnerType: 'merchant',
193
+ partnerId,
194
+ privateKey,
195
+ useSandbox
196
+ });
197
+
198
+ const audios = result.data;
199
+ const audioCount = Array.isArray(audios) ? audios.length : 0;
200
+
201
+ let audiosList = '';
202
+ if (Array.isArray(audios) && audios.length > 0) {
203
+ audiosList = audios.map(audio =>
204
+ `**Audio ${audio.id}:**
205
+ - Title: ${audio.title}
206
+ - Status: ${audio.status === '1' ? '✅ Ready' : '⏳ Processing'}
207
+ - Duration: ${audio.duration} seconds
208
+ - Uploaded: ${audio.uploadedAt}`
209
+ ).join('\n\n');
210
+ } else {
211
+ audiosList = 'No audio files found for this product.';
212
+ }
213
+
214
+ return {
215
+ content: [{
216
+ type: "text",
217
+ text: `🎵 **Product Audio Files**
218
+
219
+ **Product ID:** ${productId}
220
+ **Total Audio Files:** ${audioCount}
221
+
222
+ **Audio Files:**
223
+ ${audiosList}
224
+
225
+ **API Call Details:**
226
+ - Endpoint: ${result.requestInfo.method} ${result.requestInfo.url}
227
+ - Status: ${result.requestInfo.statusCode}
228
+
229
+ **Available Actions:**
230
+ - \`payware_products_register_audio\` - Upload new audio file
231
+ - \`payware_products_get_audio\` - Get specific audio details
232
+ - \`payware_products_update_audio\` - Update audio information
233
+ - \`payware_products_delete_audio\` - Delete audio file`
234
+ }]
235
+ };
236
+ } catch (error) {
237
+ return {
238
+ content: [{
239
+ type: "text",
240
+ text: `❌ **Failed to Get Audio Files**
241
+
242
+ **Error Details:**
243
+ - Message: ${error.message}
244
+ - Product ID: ${productId}`
245
+ }]
246
+ };
247
+ }
248
+ }
249
+ };
250
+
251
+ /**
252
+ * Get audio tool implementation for merchants
253
+ */
254
+ export const getAudioTool = {
255
+ name: "payware_products_get_audio",
256
+ description: "Get detailed information about a specific audio file",
257
+
258
+ inputSchema: {
259
+ type: "object",
260
+ properties: {
261
+ productId: {
262
+ type: "string",
263
+ description: "Product identifier (starts with 'pr')",
264
+ pattern: "^pr[a-zA-Z0-9]+$"
265
+ },
266
+ audioId: {
267
+ type: "number",
268
+ description: "Audio identifier"
269
+ },
270
+ partnerId: {
271
+ type: "string",
272
+ description: "Merchant partner ID (uses PAYWARE_PARTNER_ID env var as default)",
273
+ default: getPartnerIdSafe()
274
+ },
275
+ privateKey: {
276
+ type: "string",
277
+ description: "RSA private key for authentication (uses environment-specific private key as default)",
278
+ default: getPrivateKeySafe()
279
+ },
280
+ useSandbox: {
281
+ type: "boolean",
282
+ description: "Use sandbox environment",
283
+ default: true
284
+ }
285
+ },
286
+ required: ["productId", "audioId"]
287
+ },
288
+
289
+ async handler(args) {
290
+ const {
291
+ productId,
292
+ audioId,
293
+ partnerId = getPartnerIdSafe(),
294
+ privateKey = getPrivateKeySafe(),
295
+ useSandbox = true
296
+ } = args;
297
+
298
+ if (!productId || !audioId) {
299
+ throw new Error("Product ID and audio ID are required");
300
+ }
301
+
302
+ if (!partnerId || !privateKey) {
303
+ throw new Error("Partner ID and private key are required");
304
+ }
305
+
306
+ try {
307
+ const result = await getAudio({
308
+ productId,
309
+ audioId,
310
+ partnerType: 'merchant',
311
+ partnerId,
312
+ privateKey,
313
+ useSandbox
314
+ });
315
+
316
+ const audio = result.data;
317
+
318
+ return {
319
+ content: [{
320
+ type: "text",
321
+ text: `🎵 **Audio Details**
322
+
323
+ **Audio Information:**
324
+ - ID: ${audio.id}
325
+ - Product ID: ${audio.productId}
326
+ - Title: ${audio.title}
327
+ - Status: ${audio.status === '1' ? '✅ Ready for use' : '⏳ Processing'}
328
+ - Duration: ${audio.duration} seconds
329
+ - Uploaded: ${audio.uploadedAt}
330
+
331
+ **API Response:**
332
+ \`\`\`json
333
+ ${JSON.stringify(audio, null, 2)}
334
+ \`\`\`
335
+
336
+ **API Call Details:**
337
+ - Endpoint: ${result.requestInfo.method} ${result.requestInfo.url}
338
+ - Status: ${result.requestInfo.statusCode}
339
+
340
+ **Status Information:**
341
+ ${audio.status === '0' ? '⏳ **Processing:** Audio is being processed and will be available soon' : ''}
342
+ ${audio.status === '1' ? '✅ **Ready:** Audio is processed and ready for soundbite transactions' : ''}
343
+
344
+ **Available Actions:**
345
+ - \`payware_products_update_audio\` - Update audio title or reassign to another product
346
+ - \`payware_products_delete_audio\` - Delete this audio file`
347
+ }]
348
+ };
349
+ } catch (error) {
350
+ return {
351
+ content: [{
352
+ type: "text",
353
+ text: `❌ **Failed to Get Audio**
354
+
355
+ **Error Details:**
356
+ - Message: ${error.message}
357
+ - Product ID: ${productId}
358
+ - Audio ID: ${audioId}`
359
+ }]
360
+ };
361
+ }
362
+ }
363
+ };
364
+
365
+ /**
366
+ * Update audio tool implementation for merchants
367
+ */
368
+ export const updateAudioTool = {
369
+ name: "payware_products_update_audio",
370
+ description: "Update audio information (title) or reassign audio to another product",
371
+
372
+ inputSchema: {
373
+ type: "object",
374
+ properties: {
375
+ productId: {
376
+ type: "string",
377
+ description: "Current product identifier (starts with 'pr')",
378
+ pattern: "^pr[a-zA-Z0-9]+$"
379
+ },
380
+ audioId: {
381
+ type: "number",
382
+ description: "Audio identifier"
383
+ },
384
+ title: {
385
+ type: "string",
386
+ description: "New audio title",
387
+ maxLength: 150
388
+ },
389
+ newProductId: {
390
+ type: "string",
391
+ description: "New product ID to reassign audio to (starts with 'pr')",
392
+ pattern: "^pr[a-zA-Z0-9]+$"
393
+ },
394
+ partnerId: {
395
+ type: "string",
396
+ description: "Merchant partner ID (uses PAYWARE_PARTNER_ID env var as default)",
397
+ default: getPartnerIdSafe()
398
+ },
399
+ privateKey: {
400
+ type: "string",
401
+ description: "RSA private key for authentication (uses environment-specific private key as default)",
402
+ default: getPrivateKeySafe()
403
+ },
404
+ useSandbox: {
405
+ type: "boolean",
406
+ description: "Use sandbox environment",
407
+ default: true
408
+ }
409
+ },
410
+ required: ["productId", "audioId"]
411
+ },
412
+
413
+ async handler(args) {
414
+ const {
415
+ productId,
416
+ audioId,
417
+ title,
418
+ newProductId,
419
+ partnerId = getPartnerIdSafe(),
420
+ privateKey = getPrivateKeySafe(),
421
+ useSandbox = true
422
+ } = args;
423
+
424
+ if (!productId || !audioId) {
425
+ throw new Error("Product ID and audio ID are required");
426
+ }
427
+
428
+ if (!title && !newProductId) {
429
+ throw new Error("Either title or newProductId must be provided to update");
430
+ }
431
+
432
+ if (!partnerId || !privateKey) {
433
+ throw new Error("Partner ID and private key are required");
434
+ }
435
+
436
+ try {
437
+ const result = await updateAudio({
438
+ productId,
439
+ audioId,
440
+ title,
441
+ newProductId,
442
+ partnerType: 'merchant',
443
+ partnerId,
444
+ privateKey,
445
+ useSandbox
446
+ });
447
+
448
+ const audio = result.data;
449
+
450
+ return {
451
+ content: [{
452
+ type: "text",
453
+ text: `✅ **Audio Updated Successfully**
454
+
455
+ **Updated Audio:**
456
+ - ID: ${audio.id}
457
+ - Product ID: ${audio.productId}${newProductId ? ` (reassigned from ${productId})` : ''}
458
+ - Title: ${audio.title}
459
+ - Status: ${audio.status === '1' ? '✅ Ready' : '⏳ Processing'}
460
+ - Duration: ${audio.duration} seconds
461
+ - Uploaded: ${audio.uploadedAt}
462
+
463
+ **Changes Made:**
464
+ ${title ? `- Title updated to: "${title}"` : ''}
465
+ ${newProductId ? `- Reassigned from product ${productId} to ${newProductId}` : ''}
466
+
467
+ **API Response:**
468
+ \`\`\`json
469
+ ${JSON.stringify(audio, null, 2)}
470
+ \`\`\`
471
+
472
+ **API Call Details:**
473
+ - Endpoint: ${result.requestInfo.method} ${result.requestInfo.url}
474
+ - Status: ${result.requestInfo.statusCode}`
475
+ }]
476
+ };
477
+ } catch (error) {
478
+ return {
479
+ content: [{
480
+ type: "text",
481
+ text: `❌ **Audio Update Failed**
482
+
483
+ **Error Details:**
484
+ - Message: ${error.message}
485
+ - Product ID: ${productId}
486
+ - Audio ID: ${audioId}
487
+
488
+ **Troubleshooting:**
489
+ 1. Verify both product IDs exist and belong to your account
490
+ 2. Check that the audio ID is correct
491
+ 3. Ensure title length is within limits (150 chars)
492
+ 4. Verify JWT token is valid and not expired`
493
+ }]
494
+ };
495
+ }
496
+ }
497
+ };
498
+
499
+ /**
500
+ * Delete audio tool implementation for merchants
501
+ */
502
+ export const deleteAudioTool = {
503
+ name: "payware_products_delete_audio",
504
+ description: "Delete an audio file from a product. This action cannot be undone.",
505
+
506
+ inputSchema: {
507
+ type: "object",
508
+ properties: {
509
+ productId: {
510
+ type: "string",
511
+ description: "Product identifier (starts with 'pr')",
512
+ pattern: "^pr[a-zA-Z0-9]+$"
513
+ },
514
+ audioId: {
515
+ type: "number",
516
+ description: "Audio identifier"
517
+ },
518
+ partnerId: {
519
+ type: "string",
520
+ description: "Merchant partner ID (uses PAYWARE_PARTNER_ID env var as default)",
521
+ default: getPartnerIdSafe()
522
+ },
523
+ privateKey: {
524
+ type: "string",
525
+ description: "RSA private key for authentication (uses environment-specific private key as default)",
526
+ default: getPrivateKeySafe()
527
+ },
528
+ useSandbox: {
529
+ type: "boolean",
530
+ description: "Use sandbox environment",
531
+ default: true
532
+ }
533
+ },
534
+ required: ["productId", "audioId"]
535
+ },
536
+
537
+ async handler(args) {
538
+ const {
539
+ productId,
540
+ audioId,
541
+ partnerId = getPartnerIdSafe(),
542
+ privateKey = getPrivateKeySafe(),
543
+ useSandbox = true
544
+ } = args;
545
+
546
+ if (!productId || !audioId) {
547
+ throw new Error("Product ID and audio ID are required");
548
+ }
549
+
550
+ if (!partnerId || !privateKey) {
551
+ throw new Error("Partner ID and private key are required");
552
+ }
553
+
554
+ try {
555
+ const result = await deleteAudio({
556
+ productId,
557
+ audioId,
558
+ partnerType: 'merchant',
559
+ partnerId,
560
+ privateKey,
561
+ useSandbox
562
+ });
563
+
564
+ return {
565
+ content: [{
566
+ type: "text",
567
+ text: `🗑️ **Audio Deleted Successfully**
568
+
569
+ **Deleted Audio:**
570
+ - Product ID: ${productId}
571
+ - Audio ID: ${audioId}
572
+
573
+ **API Call Details:**
574
+ - Endpoint: ${result.requestInfo.method} ${result.requestInfo.url}
575
+ - Status: ${result.requestInfo.statusCode}
576
+
577
+ **Important Notes:**
578
+ ⚠️ This action cannot be undone
579
+ ⚠️ Any soundbite transactions using this audio may be affected
580
+
581
+ **Next Steps:**
582
+ - Use \`payware_products_get_audios\` to view remaining audio files
583
+ - Upload new audio files with \`payware_products_register_audio\`
584
+ - Check for any active soundbite transactions that used this audio`
585
+ }]
586
+ };
587
+ } catch (error) {
588
+ return {
589
+ content: [{
590
+ type: "text",
591
+ text: `❌ **Audio Deletion Failed**
592
+
593
+ **Error Details:**
594
+ - Message: ${error.message}
595
+ - Product ID: ${productId}
596
+ - Audio ID: ${audioId}
597
+
598
+ **Troubleshooting:**
599
+ 1. Verify the audio ID exists and belongs to the specified product
600
+ 2. Check if the audio is currently being used in active transactions
601
+ 3. Ensure proper permissions and JWT token validity`
602
+ }]
603
+ };
604
+ }
605
+ }
606
+ };