@payware/mcp-server 1.1.1 β†’ 1.3.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 (127) hide show
  1. package/.env.example +0 -0
  2. package/README.md +22 -16
  3. package/check-keys.js +0 -0
  4. package/keys/README.md +0 -0
  5. package/mcp-config.json +0 -0
  6. package/package.json +69 -66
  7. package/payware-mcp-config.json +0 -0
  8. package/src/auth/rsa-keys.js +0 -0
  9. package/src/auth/sandbox-setup.js +186 -186
  10. package/src/config/env.js +0 -0
  11. package/src/config/partner-types.js +0 -0
  12. package/src/core/auth/jwt-factory.js +4 -4
  13. package/src/core/auth/jwt-token.js +107 -66
  14. package/src/core/utils/json-serializer.js +5 -5
  15. package/src/core/utils/key-utils.js +0 -0
  16. package/src/index.js +0 -0
  17. package/src/isv/data/index.js +0 -0
  18. package/src/isv/deep-links/delete-product-link.js +0 -0
  19. package/src/isv/deep-links/delete-transaction-link.js +0 -0
  20. package/src/isv/deep-links/get-product-link.js +0 -0
  21. package/src/isv/deep-links/get-transaction-link.js +0 -0
  22. package/src/isv/deep-links/index.js +0 -0
  23. package/src/isv/index.js +29 -1
  24. package/src/isv/invitations/index.js +471 -0
  25. package/src/isv/oauth2/create-token-simple.js +0 -0
  26. package/src/isv/oauth2/get-token-info.js +0 -0
  27. package/src/isv/oauth2/obtain-token.js +19 -8
  28. package/src/isv/oauth2/token-helper.js +5 -2
  29. package/src/isv/poi/cancel-price.js +2 -10
  30. package/src/isv/poi/create.js +19 -0
  31. package/src/isv/poi/get-poi.js +2 -10
  32. package/src/isv/poi/get-qrcode.js +2 -10
  33. package/src/isv/poi/get-status.js +2 -10
  34. package/src/isv/poi/index.js +5 -0
  35. package/src/isv/poi/list-pois.js +2 -10
  36. package/src/isv/poi/set-price.js +217 -225
  37. package/src/isv/products/audios.js +0 -0
  38. package/src/isv/products/create-product.js +313 -313
  39. package/src/isv/products/delete-product.js +0 -0
  40. package/src/isv/products/get-product-image.js +0 -0
  41. package/src/isv/products/get-product.js +0 -0
  42. package/src/isv/products/index.js +0 -0
  43. package/src/isv/products/list-products.js +0 -0
  44. package/src/isv/products/schedules.js +0 -0
  45. package/src/isv/products/update-product.js +264 -264
  46. package/src/isv/reference/index.js +249 -0
  47. package/src/isv/shops/index.js +22 -0
  48. package/src/isv/transactions/cancel-transaction.js +43 -12
  49. package/src/isv/transactions/create-transaction.js +22 -6
  50. package/src/isv/transactions/get-status.js +18 -11
  51. package/src/isv/transactions/process-transaction.js +160 -42
  52. package/src/isv/transactions/simulate-callback.js +128 -109
  53. package/src/isv/transactions/transaction-history.js +86 -90
  54. package/src/isv/utils/auth.js +2 -2
  55. package/src/mcp-proxy.js +0 -0
  56. package/src/merchant/data/export-report.js +0 -0
  57. package/src/merchant/data/generate-report.js +19 -1
  58. package/src/merchant/data/get-export-list.js +0 -0
  59. package/src/merchant/data/get-report-requests.js +0 -0
  60. package/src/merchant/data/get-report-status.js +0 -0
  61. package/src/merchant/data/index.js +0 -0
  62. package/src/merchant/data/list-reports.js +0 -0
  63. package/src/merchant/deep-links/delete-product-link.js +0 -0
  64. package/src/merchant/deep-links/delete-transaction-link.js +0 -0
  65. package/src/merchant/deep-links/get-product-link.js +0 -0
  66. package/src/merchant/deep-links/get-transaction-link.js +0 -0
  67. package/src/merchant/deep-links/index.js +0 -0
  68. package/src/merchant/index.js +21 -1
  69. package/src/merchant/logs/index.js +366 -0
  70. package/src/merchant/products/audios.js +0 -0
  71. package/src/merchant/products/create-product.js +287 -287
  72. package/src/merchant/products/delete-product.js +0 -0
  73. package/src/merchant/products/get-product-image.js +0 -0
  74. package/src/merchant/products/get-product.js +0 -0
  75. package/src/merchant/products/index.js +0 -0
  76. package/src/merchant/products/list-products.js +0 -0
  77. package/src/merchant/products/schedules.js +0 -0
  78. package/src/merchant/products/update-product.js +281 -281
  79. package/src/merchant/shops/index.js +18 -0
  80. package/src/merchant/transactions/cancel-transaction.js +16 -19
  81. package/src/merchant/transactions/create-transaction.js +99 -19
  82. package/src/merchant/transactions/get-status.js +41 -12
  83. package/src/merchant/transactions/process-transaction.js +8 -16
  84. package/src/merchant/transactions/simulate-callback.js +68 -9
  85. package/src/merchant/transactions/transaction-history.js +275 -257
  86. package/src/payment-institution/data/index.js +0 -0
  87. package/src/payment-institution/deep-links/delete-transaction-link.js +0 -0
  88. package/src/payment-institution/deep-links/get-transaction-link.js +0 -0
  89. package/src/payment-institution/deep-links/index.js +0 -0
  90. package/src/payment-institution/index.js +0 -0
  91. package/src/payment-institution/transactions/create-pi-transaction.js +6 -14
  92. package/src/payment-institution/transactions/finalize-transaction.js +333 -340
  93. package/src/payment-institution/transactions/get-transaction-history.js +3 -11
  94. package/src/payment-institution/transactions/get-transaction-status.js +39 -12
  95. package/src/payment-institution/transactions/process-pi-transaction.js +5 -13
  96. package/src/payment-institution/transactions/simulate-pi-callback.js +49 -9
  97. package/src/payment-institution/transactions/soundbite-transaction.js +5 -13
  98. package/src/proxy-server.js +0 -0
  99. package/src/shared/api-errors.js +188 -0
  100. package/src/shared/auth-headers.js +62 -0
  101. package/src/shared/data/data-api.js +11 -10
  102. package/src/shared/deep-links/api.js +5 -4
  103. package/src/shared/index.js +0 -0
  104. package/src/shared/logs/logs-api.js +242 -0
  105. package/src/shared/poi/poi-create-api.js +419 -0
  106. package/src/shared/products/products-api.js +17 -16
  107. package/src/shared/shops/shops-api.js +155 -0
  108. package/src/tools/advanced-code-generator.js +2255 -2246
  109. package/src/utils/code-examples/common/auth-examples.js +1484 -1481
  110. package/src/utils/code-examples/common/helpers.js +7 -4
  111. package/src/utils/code-examples/common/utils-examples.js +0 -0
  112. package/src/utils/code-examples/frameworks/examples.js +4 -4
  113. package/src/utils/code-examples/index.js +0 -0
  114. package/src/utils/code-examples/isv/oauth2.js +458 -600
  115. package/src/utils/code-examples/isv/products.js +8 -8
  116. package/src/utils/code-examples/isv/transactions.js +815 -812
  117. package/src/utils/code-examples/merchant/products.js +0 -0
  118. package/src/utils/code-examples/merchant/transactions.js +9 -9
  119. package/src/utils/code-examples/payment-institution/transactions.js +0 -0
  120. package/src/utils/code-examples/shared/data.js +0 -0
  121. package/src/utils/code-examples/shared/deep-links.js +0 -0
  122. package/src/utils/code-examples/shared/soundbites.js +0 -0
  123. package/src/utils/code-examples.js +24 -24
  124. package/src/utils/format-request.js +3 -3
  125. package/src/utils/json-formatter.js +20 -20
  126. package/src/utils/server-info.js +0 -0
  127. package/MCP-SETUP.md +0 -190
@@ -1,288 +1,288 @@
1
- import { createProduct } from '../../shared/products/products-api.js';
2
- import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
- import { PRODUCT_TYPES, OVERLAP_PRIORITY } from '../../shared/products/products-api.js';
4
-
5
- /**
6
- * Create product tool implementation for merchants
7
- */
8
- export const createProductTool = {
9
- name: "payware_products_create_product",
10
- description: `Create a new product for inventory management and payment processing.
11
-
12
- **Product Structure:**
13
- πŸ“¦ **PRODUCT METADATA**: name, shortDescription, longDescription, sku, upc, shippable, active, shop
14
- πŸ’° **PRODUCT DATA** (prData object): type, regularPrice, currency, overlapPriority, timeToLive, activeFrom, activeTo, timeZone
15
- βš™οΈ **PRODUCT OPTIONS** (prOptions object): imageUrl, termsUrl, termsText
16
-
17
- **Required:** name
18
- **Optional:** All other parameters have sensible defaults`,
19
-
20
- inputSchema: {
21
- type: "object",
22
- properties: {
23
- name: {
24
- type: "string",
25
- description: "Product recognizable name (required)",
26
- maxLength: 50
27
- },
28
- shortDescription: {
29
- type: "string",
30
- description: "Short product description",
31
- maxLength: 150
32
- },
33
- longDescription: {
34
- type: "string",
35
- description: "Long product description",
36
- maxLength: 1500
37
- },
38
- sku: {
39
- type: "string",
40
- description: "Stock Keeping Unit (SKU)",
41
- maxLength: 25
42
- },
43
- upc: {
44
- type: "string",
45
- description: "Universal Product Code (UPC)",
46
- maxLength: 15
47
- },
48
- shippable: {
49
- type: "string",
50
- enum: ["TRUE", "FALSE"],
51
- description: "Indicates if product requires delivery address",
52
- default: "FALSE"
53
- },
54
- active: {
55
- type: "string",
56
- enum: ["TRUE", "FALSE"],
57
- description: "Indicates if product can serve as payment source",
58
- default: "FALSE"
59
- },
60
- shop: {
61
- type: "string",
62
- description: "Shop code (if not supplied, default shop is used)",
63
- maxLength: 10
64
- },
65
- // Product Data Properties
66
- productType: {
67
- type: "string",
68
- enum: Object.values(PRODUCT_TYPES),
69
- description: "Type of product",
70
- default: PRODUCT_TYPES.ITEM
71
- },
72
- regularPrice: {
73
- type: "string",
74
- description: "Product regular price (positive number with max 2 decimals)",
75
- default: "0.00"
76
- },
77
- currency: {
78
- type: "string",
79
- pattern: "^[A-Z]{3}$",
80
- description: "Price currency (3-character ISO code)",
81
- default: "EUR"
82
- },
83
- overlapPriority: {
84
- type: "string",
85
- enum: Object.values(OVERLAP_PRIORITY),
86
- description: "Priority when overlapping price schedules exist",
87
- default: OVERLAP_PRIORITY.LOWEST
88
- },
89
- timeToLive: {
90
- type: "number",
91
- description: "Time allowed for product payment in seconds (60-2592000)",
92
- minimum: 60,
93
- maximum: 2592000,
94
- default: 86400
95
- },
96
- activeFrom: {
97
- type: "string",
98
- pattern: "^\\d{4}-\\d{2}-\\d{2}$",
99
- description: "Product active state starting date (YYYY-MM-DD format)"
100
- },
101
- activeTo: {
102
- type: "string",
103
- pattern: "^\\d{4}-\\d{2}-\\d{2}$",
104
- description: "Product active state ending date (YYYY-MM-DD format)"
105
- },
106
- timeZone: {
107
- type: "string",
108
- description: "Product state scheduling timezone (IANA format, e.g., 'Europe/Sofia')",
109
- default: "GMT"
110
- },
111
- // Product Options Properties
112
- imageUrl: {
113
- type: "string",
114
- description: "URL pointing to external product image resource",
115
- maxLength: 150,
116
- format: "uri"
117
- },
118
- termsUrl: {
119
- type: "string",
120
- description: "URL pointing to external terms and conditions resource",
121
- maxLength: 150,
122
- format: "uri"
123
- },
124
- termsText: {
125
- type: "string",
126
- description: "Terms and conditions text",
127
- maxLength: 3000
128
- },
129
- // Authentication
130
- partnerId: {
131
- type: "string",
132
- description: "Merchant partner ID (uses PAYWARE_PARTNER_ID env var as default)",
133
- default: getPartnerIdSafe()
134
- },
135
- privateKey: {
136
- type: "string",
137
- description: "RSA private key for authentication (uses environment-specific private key as default)",
138
- default: getPrivateKeySafe(true)
139
- },
140
- useSandbox: {
141
- type: "boolean",
142
- description: "Use sandbox environment",
143
- default: true
144
- }
145
- },
146
- required: ["name"]
147
- },
148
-
149
- async handler(args) {
150
- const {
151
- name,
152
- shortDescription,
153
- longDescription,
154
- sku,
155
- upc,
156
- shippable = "FALSE",
157
- active = "FALSE",
158
- shop,
159
- productType = PRODUCT_TYPES.ITEM,
160
- regularPrice = "0.00",
161
- currency = "EUR",
162
- overlapPriority = OVERLAP_PRIORITY.LOWEST,
163
- timeToLive = 86400,
164
- activeFrom,
165
- activeTo,
166
- timeZone = "GMT",
167
- imageUrl,
168
- termsUrl,
169
- termsText,
170
- partnerId = getPartnerIdSafe(),
171
- privateKey = getPrivateKeySafe(args.useSandbox ?? true),
172
- useSandbox = true
173
- } = args;
174
-
175
- if (!name) {
176
- throw new Error("Product name is required");
177
- }
178
-
179
- if (!partnerId) {
180
- throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
181
- }
182
-
183
- if (!privateKey) {
184
- throw new Error("Private key is required. Provide via 'privateKey' parameter or set environment-specific private key variable.");
185
- }
186
-
187
- // Build prData object
188
- const prData = {
189
- type: productType,
190
- regularPrice,
191
- currency,
192
- overlapPriority,
193
- timeToLive,
194
- timeZone
195
- };
196
-
197
- if (activeFrom) prData.activeFrom = activeFrom;
198
- if (activeTo) prData.activeTo = activeTo;
199
-
200
- // Build prOptions object
201
- const prOptions = {};
202
- if (imageUrl) prOptions.imageUrl = imageUrl;
203
- if (termsUrl) prOptions.termsUrl = termsUrl;
204
- if (termsText) prOptions.termsText = termsText;
205
-
206
- try {
207
- const result = await createProduct({
208
- name,
209
- shortDescription,
210
- longDescription,
211
- sku,
212
- upc,
213
- shippable,
214
- active,
215
- shop,
216
- prData,
217
- prOptions,
218
- partnerType: 'merchant',
219
- partnerId,
220
- privateKey,
221
- useSandbox
222
- });
223
-
224
- const product = result.data;
225
-
226
- return {
227
- content: [{
228
- type: "text",
229
- text: `πŸ“¦ **Product Created Successfully**
230
-
231
- **Product Details:**
232
- - ID: ${product.productId}
233
- - Name: ${product.name}
234
- - Type: ${product.type}
235
- - Price: ${product.regularPrice} ${product.currencyCode}
236
- - Status: ${product.active ? 'βœ… Active' : '⏸️ Inactive'}
237
- - Shop: ${product.shopCode} (${product.shopName})
238
- ${product.shortDescription ? `- Description: ${product.shortDescription}` : ''}
239
- ${product.sku ? `- SKU: ${product.sku}` : ''}
240
- ${product.upc ? `- UPC: ${product.upc}` : ''}
241
-
242
- **Product Settings:**
243
- - Shippable: ${product.shippable ? 'Yes' : 'No'}
244
- - Time to Live: ${product.timeToLive} seconds
245
- - Sale Price: ${product.salePrice} ${product.currencyCode}
246
- - Overlap Priority: ${product.overlapPriority}
247
-
248
- **Active Period:**
249
- - From: ${product.activeFromZoned || product.activeFrom}
250
- - To: ${product.activeToZoned || product.activeTo}
251
- - Timezone: ${product.timeZone}
252
-
253
- **API Response:**
254
- \`\`\`json
255
- ${JSON.stringify(product, null, 2)}
256
- \`\`\`
257
-
258
- **API Call Details:**
259
- - Endpoint: ${result.requestInfo.method} ${result.requestInfo.url}
260
- - Status: ${result.requestInfo.statusCode}
261
-
262
- **Next Steps:**
263
- 1. Save the product ID: \`${product.productId}\`
264
- 2. Use \`payware_products_get_product\` to view product details
265
- 3. Use \`payware_products_create_schedule\` to add price schedules
266
- 4. Use \`payware_products_register_audio\` to add soundbites`
267
- }]
268
- };
269
- } catch (error) {
270
- return {
271
- content: [{
272
- type: "text",
273
- text: `❌ **Product Creation Failed**
274
-
275
- **Error Details:**
276
- - Message: ${error.message}
277
-
278
- **Troubleshooting:**
279
- 1. Verify JWT token is valid and not expired
280
- 2. Check product parameters (name, price format, dates)
281
- 3. Ensure private key matches public key registered with payware
282
- 4. Verify partner ID and API access
283
- 5. Check sandbox API status`
284
- }]
285
- };
286
- }
287
- }
1
+ import { createProduct } from '../../shared/products/products-api.js';
2
+ import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { PRODUCT_TYPES, OVERLAP_PRIORITY } from '../../shared/products/products-api.js';
4
+
5
+ /**
6
+ * Create product tool implementation for merchants
7
+ */
8
+ export const createProductTool = {
9
+ name: "payware_products_create_product",
10
+ description: `Create a new product for inventory management and payment processing.
11
+
12
+ **Product Structure:**
13
+ πŸ“¦ **PRODUCT METADATA**: name, shortDescription, longDescription, sku, upc, shippable, active, shop
14
+ πŸ’° **PRODUCT DATA** (prData object): type, regularPrice, currency, overlapPriority, timeToLive, activeFrom, activeTo, timeZone
15
+ βš™οΈ **PRODUCT OPTIONS** (prOptions object): imageUrl, termsUrl, termsText
16
+
17
+ **Required:** name
18
+ **Optional:** All other parameters have sensible defaults`,
19
+
20
+ inputSchema: {
21
+ type: "object",
22
+ properties: {
23
+ name: {
24
+ type: "string",
25
+ description: "Product recognizable name (required)",
26
+ maxLength: 50
27
+ },
28
+ shortDescription: {
29
+ type: "string",
30
+ description: "Short product description",
31
+ maxLength: 150
32
+ },
33
+ longDescription: {
34
+ type: "string",
35
+ description: "Long product description",
36
+ maxLength: 1500
37
+ },
38
+ sku: {
39
+ type: "string",
40
+ description: "Stock Keeping Unit (SKU)",
41
+ maxLength: 25
42
+ },
43
+ upc: {
44
+ type: "string",
45
+ description: "Universal Product Code (UPC)",
46
+ maxLength: 15
47
+ },
48
+ shippable: {
49
+ type: "string",
50
+ enum: ["TRUE", "FALSE"],
51
+ description: "Indicates if product requires delivery address",
52
+ default: "FALSE"
53
+ },
54
+ active: {
55
+ type: "string",
56
+ enum: ["TRUE", "FALSE"],
57
+ description: "Indicates if product can serve as payment source",
58
+ default: "FALSE"
59
+ },
60
+ shop: {
61
+ type: "string",
62
+ description: "Shop code (if not supplied, default shop is used)",
63
+ maxLength: 10
64
+ },
65
+ // Product Data Properties
66
+ productType: {
67
+ type: "string",
68
+ enum: Object.values(PRODUCT_TYPES),
69
+ description: "Type of product",
70
+ default: PRODUCT_TYPES.ITEM
71
+ },
72
+ regularPrice: {
73
+ type: "string",
74
+ description: "Product regular price as a decimal string. Zero or positive, at most 12 integer digits, and no more decimals than the currency's minor unit (0 for JPY, 2 for EUR, 3 for KWD, 8 for BTC). Returned as a string too.",
75
+ default: "0.00"
76
+ },
77
+ currency: {
78
+ type: "string",
79
+ pattern: "^[A-Z]{3}$",
80
+ description: "Price currency (3-character ISO code)",
81
+ default: "EUR"
82
+ },
83
+ overlapPriority: {
84
+ type: "string",
85
+ enum: Object.values(OVERLAP_PRIORITY),
86
+ description: "Priority when overlapping price schedules exist",
87
+ default: OVERLAP_PRIORITY.LOWEST
88
+ },
89
+ timeToLive: {
90
+ type: "number",
91
+ description: "Time allowed for product payment in seconds (60-2592000)",
92
+ minimum: 60,
93
+ maximum: 2592000,
94
+ default: 86400
95
+ },
96
+ activeFrom: {
97
+ type: "string",
98
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$",
99
+ description: "Product active state starting date (YYYY-MM-DD format)"
100
+ },
101
+ activeTo: {
102
+ type: "string",
103
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$",
104
+ description: "Product active state ending date (YYYY-MM-DD format)"
105
+ },
106
+ timeZone: {
107
+ type: "string",
108
+ description: "Product state scheduling timezone (IANA format, e.g., 'Europe/Sofia')",
109
+ default: "GMT"
110
+ },
111
+ // Product Options Properties
112
+ imageUrl: {
113
+ type: "string",
114
+ description: "URL pointing to external product image resource",
115
+ maxLength: 150,
116
+ format: "uri"
117
+ },
118
+ termsUrl: {
119
+ type: "string",
120
+ description: "URL pointing to external terms and conditions resource",
121
+ maxLength: 150,
122
+ format: "uri"
123
+ },
124
+ termsText: {
125
+ type: "string",
126
+ description: "Terms and conditions text",
127
+ maxLength: 3000
128
+ },
129
+ // Authentication
130
+ partnerId: {
131
+ type: "string",
132
+ description: "Merchant partner ID (uses PAYWARE_PARTNER_ID env var as default)",
133
+ default: getPartnerIdSafe()
134
+ },
135
+ privateKey: {
136
+ type: "string",
137
+ description: "RSA private key for authentication (uses environment-specific private key as default)",
138
+ default: getPrivateKeySafe(true)
139
+ },
140
+ useSandbox: {
141
+ type: "boolean",
142
+ description: "Use sandbox environment",
143
+ default: true
144
+ }
145
+ },
146
+ required: ["name"]
147
+ },
148
+
149
+ async handler(args) {
150
+ const {
151
+ name,
152
+ shortDescription,
153
+ longDescription,
154
+ sku,
155
+ upc,
156
+ shippable = "FALSE",
157
+ active = "FALSE",
158
+ shop,
159
+ productType = PRODUCT_TYPES.ITEM,
160
+ regularPrice = "0.00",
161
+ currency = "EUR",
162
+ overlapPriority = OVERLAP_PRIORITY.LOWEST,
163
+ timeToLive = 86400,
164
+ activeFrom,
165
+ activeTo,
166
+ timeZone = "GMT",
167
+ imageUrl,
168
+ termsUrl,
169
+ termsText,
170
+ partnerId = getPartnerIdSafe(),
171
+ privateKey = getPrivateKeySafe(args.useSandbox ?? true),
172
+ useSandbox = true
173
+ } = args;
174
+
175
+ if (!name) {
176
+ throw new Error("Product name is required");
177
+ }
178
+
179
+ if (!partnerId) {
180
+ throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
181
+ }
182
+
183
+ if (!privateKey) {
184
+ throw new Error("Private key is required. Provide via 'privateKey' parameter or set environment-specific private key variable.");
185
+ }
186
+
187
+ // Build prData object
188
+ const prData = {
189
+ type: productType,
190
+ regularPrice,
191
+ currency,
192
+ overlapPriority,
193
+ timeToLive,
194
+ timeZone
195
+ };
196
+
197
+ if (activeFrom) prData.activeFrom = activeFrom;
198
+ if (activeTo) prData.activeTo = activeTo;
199
+
200
+ // Build prOptions object
201
+ const prOptions = {};
202
+ if (imageUrl) prOptions.imageUrl = imageUrl;
203
+ if (termsUrl) prOptions.termsUrl = termsUrl;
204
+ if (termsText) prOptions.termsText = termsText;
205
+
206
+ try {
207
+ const result = await createProduct({
208
+ name,
209
+ shortDescription,
210
+ longDescription,
211
+ sku,
212
+ upc,
213
+ shippable,
214
+ active,
215
+ shop,
216
+ prData,
217
+ prOptions,
218
+ partnerType: 'merchant',
219
+ partnerId,
220
+ privateKey,
221
+ useSandbox
222
+ });
223
+
224
+ const product = result.data;
225
+
226
+ return {
227
+ content: [{
228
+ type: "text",
229
+ text: `πŸ“¦ **Product Created Successfully**
230
+
231
+ **Product Details:**
232
+ - ID: ${product.productId}
233
+ - Name: ${product.name}
234
+ - Type: ${product.type}
235
+ - Price: ${product.regularPrice} ${product.currencyCode}
236
+ - Status: ${product.active ? 'βœ… Active' : '⏸️ Inactive'}
237
+ - Shop: ${product.shopCode} (${product.shopName})
238
+ ${product.shortDescription ? `- Description: ${product.shortDescription}` : ''}
239
+ ${product.sku ? `- SKU: ${product.sku}` : ''}
240
+ ${product.upc ? `- UPC: ${product.upc}` : ''}
241
+
242
+ **Product Settings:**
243
+ - Shippable: ${product.shippable ? 'Yes' : 'No'}
244
+ - Time to Live: ${product.timeToLive} seconds
245
+ - Sale Price: ${product.salePrice} ${product.currencyCode}
246
+ - Overlap Priority: ${product.overlapPriority}
247
+
248
+ **Active Period:**
249
+ - From: ${product.activeFromZoned || product.activeFrom}
250
+ - To: ${product.activeToZoned || product.activeTo}
251
+ - Timezone: ${product.timeZone}
252
+
253
+ **API Response:**
254
+ \`\`\`json
255
+ ${JSON.stringify(product, null, 2)}
256
+ \`\`\`
257
+
258
+ **API Call Details:**
259
+ - Endpoint: ${result.requestInfo.method} ${result.requestInfo.url}
260
+ - Status: ${result.requestInfo.statusCode}
261
+
262
+ **Next Steps:**
263
+ 1. Save the product ID: \`${product.productId}\`
264
+ 2. Use \`payware_products_get_product\` to view product details
265
+ 3. Use \`payware_products_create_schedule\` to add price schedules
266
+ 4. Use \`payware_products_register_audio\` to add soundbites`
267
+ }]
268
+ };
269
+ } catch (error) {
270
+ return {
271
+ content: [{
272
+ type: "text",
273
+ text: `❌ **Product Creation Failed**
274
+
275
+ **Error Details:**
276
+ - Message: ${error.message}
277
+
278
+ **Troubleshooting:**
279
+ 1. Verify JWT token is valid and not expired
280
+ 2. Check product parameters (name, price format, dates)
281
+ 3. Ensure private key matches public key registered with payware
282
+ 4. Verify partner ID and API access
283
+ 5. Check sandbox API status`
284
+ }]
285
+ };
286
+ }
287
+ }
288
288
  };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes