@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.
- package/.env.example +92 -0
- package/MCP-SETUP.md +190 -0
- package/README.md +483 -0
- package/check-keys.js +52 -0
- package/keys/README.md +112 -0
- package/mcp-config.json +9 -0
- package/package.json +66 -0
- package/payware-mcp-config.json +12 -0
- package/src/auth/rsa-keys.js +82 -0
- package/src/auth/sandbox-setup.js +187 -0
- package/src/config/env.js +229 -0
- package/src/config/partner-types.js +143 -0
- package/src/core/auth/jwt-factory.js +182 -0
- package/src/core/auth/jwt-token.js +735 -0
- package/src/core/utils/json-serializer.js +100 -0
- package/src/core/utils/key-utils.js +133 -0
- package/src/index.js +237 -0
- package/src/isv/data/index.js +291 -0
- package/src/isv/deep-links/delete-product-link.js +154 -0
- package/src/isv/deep-links/delete-transaction-link.js +154 -0
- package/src/isv/deep-links/get-product-link.js +167 -0
- package/src/isv/deep-links/get-transaction-link.js +167 -0
- package/src/isv/deep-links/index.js +23 -0
- package/src/isv/index.js +103 -0
- package/src/isv/oauth2/create-token-simple.js +46 -0
- package/src/isv/oauth2/get-token-info.js +157 -0
- package/src/isv/oauth2/obtain-token.js +189 -0
- package/src/isv/oauth2/token-helper.js +151 -0
- package/src/isv/products/audios.js +470 -0
- package/src/isv/products/create-product.js +314 -0
- package/src/isv/products/delete-product.js +119 -0
- package/src/isv/products/get-product-image.js +247 -0
- package/src/isv/products/get-product.js +168 -0
- package/src/isv/products/index.js +65 -0
- package/src/isv/products/list-products.js +136 -0
- package/src/isv/products/schedules.js +522 -0
- package/src/isv/products/update-product.js +265 -0
- package/src/isv/transactions/cancel-transaction.js +129 -0
- package/src/isv/transactions/create-transaction.js +361 -0
- package/src/isv/transactions/get-status.js +217 -0
- package/src/isv/transactions/process-transaction.js +145 -0
- package/src/isv/transactions/simulate-callback.js +146 -0
- package/src/isv/transactions/transaction-history.js +186 -0
- package/src/isv/utils/auth.js +159 -0
- package/src/mcp-proxy.js +150 -0
- package/src/merchant/data/export-report.js +108 -0
- package/src/merchant/data/generate-report.js +151 -0
- package/src/merchant/data/get-report-status.js +120 -0
- package/src/merchant/data/index.js +351 -0
- package/src/merchant/deep-links/delete-product-link.js +121 -0
- package/src/merchant/deep-links/delete-transaction-link.js +121 -0
- package/src/merchant/deep-links/get-product-link.js +134 -0
- package/src/merchant/deep-links/get-transaction-link.js +134 -0
- package/src/merchant/deep-links/index.js +23 -0
- package/src/merchant/index.js +92 -0
- package/src/merchant/products/audios.js +606 -0
- package/src/merchant/products/create-product.js +288 -0
- package/src/merchant/products/delete-product.js +111 -0
- package/src/merchant/products/get-product-image.js +252 -0
- package/src/merchant/products/get-product.js +144 -0
- package/src/merchant/products/index.js +65 -0
- package/src/merchant/products/list-products.js +112 -0
- package/src/merchant/products/schedules.js +646 -0
- package/src/merchant/products/update-product.js +282 -0
- package/src/merchant/transactions/cancel-transaction.js +241 -0
- package/src/merchant/transactions/create-transaction.js +482 -0
- package/src/merchant/transactions/get-status.js +196 -0
- package/src/merchant/transactions/process-transaction.js +349 -0
- package/src/merchant/transactions/simulate-callback.js +246 -0
- package/src/merchant/transactions/transaction-history.js +258 -0
- package/src/payment-institution/data/index.js +280 -0
- package/src/payment-institution/deep-links/delete-transaction-link.js +128 -0
- package/src/payment-institution/deep-links/get-transaction-link.js +141 -0
- package/src/payment-institution/deep-links/index.js +17 -0
- package/src/payment-institution/index.js +92 -0
- package/src/payment-institution/transactions/create-pi-transaction.js +484 -0
- package/src/payment-institution/transactions/finalize-transaction.js +340 -0
- package/src/payment-institution/transactions/get-transaction-history.js +269 -0
- package/src/payment-institution/transactions/get-transaction-status.js +234 -0
- package/src/payment-institution/transactions/process-pi-transaction.js +421 -0
- package/src/payment-institution/transactions/simulate-pi-callback.js +326 -0
- package/src/payment-institution/transactions/soundbite-transaction.js +269 -0
- package/src/proxy-server.js +205 -0
- package/src/shared/data/data-api.js +372 -0
- package/src/shared/deep-links/api.js +214 -0
- package/src/shared/index.js +44 -0
- package/src/shared/products/products-api.js +872 -0
- package/src/tools/advanced-code-generator.js +2247 -0
- package/src/utils/code-examples/common/auth-examples.js +1482 -0
- package/src/utils/code-examples/common/helpers.js +416 -0
- package/src/utils/code-examples/common/utils-examples.js +591 -0
- package/src/utils/code-examples/frameworks/examples.js +859 -0
- package/src/utils/code-examples/index.js +441 -0
- package/src/utils/code-examples/isv/oauth2.js +600 -0
- package/src/utils/code-examples/isv/products.js +666 -0
- package/src/utils/code-examples/isv/transactions.js +813 -0
- package/src/utils/code-examples/merchant/products.js +497 -0
- package/src/utils/code-examples/merchant/transactions.js +623 -0
- package/src/utils/code-examples/payment-institution/transactions.js +388 -0
- package/src/utils/code-examples/shared/data.js +607 -0
- package/src/utils/code-examples/shared/deep-links.js +662 -0
- package/src/utils/code-examples/shared/soundbites.js +808 -0
- package/src/utils/code-examples.js +646 -0
- package/src/utils/format-request.js +363 -0
- package/src/utils/json-formatter.js +249 -0
- package/src/utils/server-info.js +132 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { updateProduct } 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
|
+
* Update product tool implementation for ISVs
|
|
7
|
+
*/
|
|
8
|
+
export const updateProductTool = {
|
|
9
|
+
name: "payware_products_update_product",
|
|
10
|
+
description: `Update an existing product on behalf of a merchant (ISV operation). Only provide the fields you want to change.`,
|
|
11
|
+
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: "object",
|
|
14
|
+
properties: {
|
|
15
|
+
// ISV Authentication
|
|
16
|
+
merchantPartnerId: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Target merchant partner ID (8 alphanumeric characters, e.g., 'PZAYNMVE')"
|
|
19
|
+
},
|
|
20
|
+
oauth2Token: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "OAuth2 access token obtained from the merchant"
|
|
23
|
+
},
|
|
24
|
+
productId: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Product identifier to update (starts with 'pr')",
|
|
27
|
+
pattern: "^pr[a-zA-Z0-9]+$"
|
|
28
|
+
},
|
|
29
|
+
// Product fields - same as merchant version
|
|
30
|
+
name: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Product recognizable name",
|
|
33
|
+
maxLength: 50
|
|
34
|
+
},
|
|
35
|
+
shortDescription: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Short product description",
|
|
38
|
+
maxLength: 150
|
|
39
|
+
},
|
|
40
|
+
longDescription: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "Long product description",
|
|
43
|
+
maxLength: 1500
|
|
44
|
+
},
|
|
45
|
+
sku: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "Stock Keeping Unit (SKU)",
|
|
48
|
+
maxLength: 25
|
|
49
|
+
},
|
|
50
|
+
upc: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "Universal Product Code (UPC)",
|
|
53
|
+
maxLength: 15
|
|
54
|
+
},
|
|
55
|
+
shippable: {
|
|
56
|
+
type: "string",
|
|
57
|
+
enum: ["TRUE", "FALSE"],
|
|
58
|
+
description: "Indicates if product requires delivery address"
|
|
59
|
+
},
|
|
60
|
+
active: {
|
|
61
|
+
type: "string",
|
|
62
|
+
enum: ["TRUE", "FALSE"],
|
|
63
|
+
description: "Indicates if product can serve as payment source"
|
|
64
|
+
},
|
|
65
|
+
shop: {
|
|
66
|
+
type: "string",
|
|
67
|
+
description: "Shop code",
|
|
68
|
+
maxLength: 10
|
|
69
|
+
},
|
|
70
|
+
productType: {
|
|
71
|
+
type: "string",
|
|
72
|
+
enum: Object.values(PRODUCT_TYPES),
|
|
73
|
+
description: "Type of product"
|
|
74
|
+
},
|
|
75
|
+
regularPrice: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "Product regular price (positive number with max 2 decimals)"
|
|
78
|
+
},
|
|
79
|
+
currency: {
|
|
80
|
+
type: "string",
|
|
81
|
+
pattern: "^[A-Z]{3}$",
|
|
82
|
+
description: "Price currency (3-character ISO code)"
|
|
83
|
+
},
|
|
84
|
+
overlapPriority: {
|
|
85
|
+
type: "string",
|
|
86
|
+
enum: Object.values(OVERLAP_PRIORITY),
|
|
87
|
+
description: "Priority when overlapping price schedules exist"
|
|
88
|
+
},
|
|
89
|
+
timeToLive: {
|
|
90
|
+
type: "number",
|
|
91
|
+
description: "Time allowed for product payment in seconds (60-2592000)",
|
|
92
|
+
minimum: 60,
|
|
93
|
+
maximum: 2592000
|
|
94
|
+
},
|
|
95
|
+
activeFrom: {
|
|
96
|
+
type: "string",
|
|
97
|
+
pattern: "^\\d{4}-\\d{2}-\\d{2}$",
|
|
98
|
+
description: "Product active state starting date (YYYY-MM-DD format)"
|
|
99
|
+
},
|
|
100
|
+
activeTo: {
|
|
101
|
+
type: "string",
|
|
102
|
+
pattern: "^\\d{4}-\\d{2}-\\d{2}$",
|
|
103
|
+
description: "Product active state ending date (YYYY-MM-DD format)"
|
|
104
|
+
},
|
|
105
|
+
timeZone: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "Product state scheduling timezone (IANA format, e.g., 'Europe/Sofia')"
|
|
108
|
+
},
|
|
109
|
+
imageUrl: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "URL pointing to external product image resource",
|
|
112
|
+
maxLength: 150,
|
|
113
|
+
format: "uri"
|
|
114
|
+
},
|
|
115
|
+
termsUrl: {
|
|
116
|
+
type: "string",
|
|
117
|
+
description: "URL pointing to external terms and conditions resource",
|
|
118
|
+
maxLength: 150,
|
|
119
|
+
format: "uri"
|
|
120
|
+
},
|
|
121
|
+
termsText: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "Terms and conditions text",
|
|
124
|
+
maxLength: 3000
|
|
125
|
+
},
|
|
126
|
+
useSandbox: {
|
|
127
|
+
type: "boolean",
|
|
128
|
+
description: "Use sandbox environment",
|
|
129
|
+
default: true
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
required: ["merchantPartnerId", "oauth2Token", "productId"]
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
async handler(args) {
|
|
136
|
+
const {
|
|
137
|
+
merchantPartnerId,
|
|
138
|
+
oauth2Token,
|
|
139
|
+
productId,
|
|
140
|
+
name,
|
|
141
|
+
shortDescription,
|
|
142
|
+
longDescription,
|
|
143
|
+
sku,
|
|
144
|
+
upc,
|
|
145
|
+
shippable,
|
|
146
|
+
active,
|
|
147
|
+
shop,
|
|
148
|
+
productType,
|
|
149
|
+
regularPrice,
|
|
150
|
+
currency,
|
|
151
|
+
overlapPriority,
|
|
152
|
+
timeToLive,
|
|
153
|
+
activeFrom,
|
|
154
|
+
activeTo,
|
|
155
|
+
timeZone,
|
|
156
|
+
imageUrl,
|
|
157
|
+
termsUrl,
|
|
158
|
+
termsText,
|
|
159
|
+
useSandbox = true
|
|
160
|
+
} = args;
|
|
161
|
+
|
|
162
|
+
// ISV validation
|
|
163
|
+
if (!merchantPartnerId) {
|
|
164
|
+
throw new Error("Merchant Partner ID is required for ISV operations");
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (!oauth2Token) {
|
|
168
|
+
throw new Error("OAuth2 token is required for ISV operations");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!productId) {
|
|
172
|
+
throw new Error("Product ID is required");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Get ISV credentials
|
|
176
|
+
const isvPartnerId = getPartnerIdSafe();
|
|
177
|
+
const privateKey = getPrivateKeySafe();
|
|
178
|
+
|
|
179
|
+
if (!isvPartnerId || !privateKey) {
|
|
180
|
+
throw new Error("ISV credentials are required");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Build prData object only with provided fields
|
|
184
|
+
const prData = {};
|
|
185
|
+
if (productType !== undefined) prData.type = productType;
|
|
186
|
+
if (regularPrice !== undefined) prData.regularPrice = regularPrice;
|
|
187
|
+
if (currency !== undefined) prData.currency = currency;
|
|
188
|
+
if (overlapPriority !== undefined) prData.overlapPriority = overlapPriority;
|
|
189
|
+
if (timeToLive !== undefined) prData.timeToLive = timeToLive;
|
|
190
|
+
if (activeFrom !== undefined) prData.activeFrom = activeFrom;
|
|
191
|
+
if (activeTo !== undefined) prData.activeTo = activeTo;
|
|
192
|
+
if (timeZone !== undefined) prData.timeZone = timeZone;
|
|
193
|
+
|
|
194
|
+
// Build prOptions object only with provided fields
|
|
195
|
+
const prOptions = {};
|
|
196
|
+
if (imageUrl !== undefined) prOptions.imageUrl = imageUrl;
|
|
197
|
+
if (termsUrl !== undefined) prOptions.termsUrl = termsUrl;
|
|
198
|
+
if (termsText !== undefined) prOptions.termsText = termsText;
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
const result = await updateProduct({
|
|
202
|
+
productId,
|
|
203
|
+
name,
|
|
204
|
+
shortDescription,
|
|
205
|
+
longDescription,
|
|
206
|
+
sku,
|
|
207
|
+
upc,
|
|
208
|
+
shippable,
|
|
209
|
+
active,
|
|
210
|
+
shop,
|
|
211
|
+
prData,
|
|
212
|
+
prOptions,
|
|
213
|
+
partnerType: 'isv',
|
|
214
|
+
isvPartnerId,
|
|
215
|
+
privateKey,
|
|
216
|
+
merchantPartnerId,
|
|
217
|
+
oauth2Token,
|
|
218
|
+
useSandbox
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const product = result.data;
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
content: [{
|
|
225
|
+
type: "text",
|
|
226
|
+
text: `✅ **Product Updated Successfully (ISV -> Merchant: ${merchantPartnerId})**
|
|
227
|
+
|
|
228
|
+
**Updated Product Details:**
|
|
229
|
+
- ID: ${product.productId}
|
|
230
|
+
- Name: ${product.name}
|
|
231
|
+
- Type: ${product.type}
|
|
232
|
+
- Price: ${product.regularPrice} ${product.currencyCode}
|
|
233
|
+
- Status: ${product.active ? '✅ Active' : '⏸️ Inactive'}
|
|
234
|
+
- Shop: ${product.shopCode} (${product.shopName})
|
|
235
|
+
|
|
236
|
+
**ISV Integration Details:**
|
|
237
|
+
- ISV Partner: ${isvPartnerId}
|
|
238
|
+
- Target Merchant: ${merchantPartnerId}
|
|
239
|
+
- OAuth2 Token: ${oauth2Token.substring(0, 8)}...
|
|
240
|
+
|
|
241
|
+
**API Response:**
|
|
242
|
+
\`\`\`json
|
|
243
|
+
${JSON.stringify(product, null, 2)}
|
|
244
|
+
\`\`\``
|
|
245
|
+
}]
|
|
246
|
+
};
|
|
247
|
+
} catch (error) {
|
|
248
|
+
return {
|
|
249
|
+
content: [{
|
|
250
|
+
type: "text",
|
|
251
|
+
text: `❌ **Product Update Failed**
|
|
252
|
+
|
|
253
|
+
**Error Details:**
|
|
254
|
+
- Message: ${error.message}
|
|
255
|
+
- Product ID: ${productId}
|
|
256
|
+
|
|
257
|
+
**ISV Authentication Check:**
|
|
258
|
+
- ISV Partner ID: ${isvPartnerId}
|
|
259
|
+
- Merchant Partner ID: ${merchantPartnerId || 'Missing'}
|
|
260
|
+
- OAuth2 Token: ${oauth2Token ? 'Provided' : 'Missing'}`
|
|
261
|
+
}]
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { createJWTForPartner } from '../../core/auth/jwt-factory.js';
|
|
3
|
+
import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cancel a transaction via payware API as an ISV
|
|
7
|
+
*/
|
|
8
|
+
export async function cancelTransaction({ transactionId, merchantPartnerId, oauth2Token, useSandbox = true }) {
|
|
9
|
+
if (!transactionId) {
|
|
10
|
+
throw new Error('Transaction ID is required');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (!merchantPartnerId) {
|
|
14
|
+
throw new Error('Merchant Partner ID is required for ISV operations');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!oauth2Token) {
|
|
18
|
+
throw new Error('OAuth2 token is required for ISV operations');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const isvPartnerId = getPartnerIdSafe();
|
|
22
|
+
const privateKey = getPrivateKeySafe(useSandbox);
|
|
23
|
+
|
|
24
|
+
const requestBody = {}; // Empty body for cancel
|
|
25
|
+
|
|
26
|
+
const jwtData = await createJWTForPartner({
|
|
27
|
+
partnerId: isvPartnerId,
|
|
28
|
+
privateKey,
|
|
29
|
+
requestBody,
|
|
30
|
+
merchantId: merchantPartnerId,
|
|
31
|
+
oauth2Token
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Use the same JSON serialization method as the JWT factory for MD5 calculation
|
|
35
|
+
const { createMinimizedJSON } = await import('../../core/utils/json-serializer.js');
|
|
36
|
+
const minimizedBodyString = createMinimizedJSON(requestBody);
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const baseUrl = useSandbox ? getSandboxUrl() : getProductionUrl();
|
|
40
|
+
// Send the exact minimized JSON string that was used for MD5 calculation
|
|
41
|
+
const response = await axios.delete(`${baseUrl}/transactions/${transactionId}`, {
|
|
42
|
+
headers: {
|
|
43
|
+
'Authorization': `Bearer ${jwtData.token}`,
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
'Api-Version': '1'
|
|
46
|
+
},
|
|
47
|
+
data: minimizedBodyString,
|
|
48
|
+
// Tell axios to send the string as-is, don't serialize it again
|
|
49
|
+
transformRequest: [(data) => data]
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return response.data;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (error.response) {
|
|
55
|
+
throw new Error(`payware API Error: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
|
|
56
|
+
}
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const cancelTransactionTool = {
|
|
62
|
+
name: 'payware_operations_cancel_transaction',
|
|
63
|
+
description: `Cancel an active transaction as an ISV on behalf of a merchant.
|
|
64
|
+
|
|
65
|
+
Requires ISV authentication with merchant partner ID and OAuth2 token.
|
|
66
|
+
Only ACTIVE transactions can be cancelled.`,
|
|
67
|
+
|
|
68
|
+
inputSchema: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
required: ['transactionId', 'merchantPartnerId', 'oauth2Token'],
|
|
71
|
+
properties: {
|
|
72
|
+
transactionId: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Transaction ID to cancel'
|
|
75
|
+
},
|
|
76
|
+
merchantPartnerId: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'Partner ID of the target merchant'
|
|
79
|
+
},
|
|
80
|
+
oauth2Token: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'OAuth2 access token obtained from the merchant'
|
|
83
|
+
},
|
|
84
|
+
useSandbox: {
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
description: 'Use sandbox environment for testing',
|
|
87
|
+
default: true
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
async handler(params) {
|
|
93
|
+
try {
|
|
94
|
+
const result = await cancelTransaction(params);
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
content: [{
|
|
98
|
+
type: 'text',
|
|
99
|
+
text: `✅ Transaction Cancelled Successfully (ISV -> Merchant: ${params.merchantPartnerId})
|
|
100
|
+
|
|
101
|
+
📋 **Cancellation Details:**
|
|
102
|
+
- **Transaction ID**: ${params.transactionId}
|
|
103
|
+
- **Status**: ${result.status || 'CANCELLED'}
|
|
104
|
+
- **ISV Partner**: ${getPartnerIdSafe()}
|
|
105
|
+
- **Target Merchant**: ${params.merchantPartnerId}
|
|
106
|
+
|
|
107
|
+
**Raw Response:**
|
|
108
|
+
\`\`\`json
|
|
109
|
+
${JSON.stringify(result, null, 2)}
|
|
110
|
+
\`\`\``
|
|
111
|
+
}]
|
|
112
|
+
};
|
|
113
|
+
} catch (error) {
|
|
114
|
+
return {
|
|
115
|
+
content: [{
|
|
116
|
+
type: 'text',
|
|
117
|
+
text: `❌ Transaction Cancellation Failed
|
|
118
|
+
|
|
119
|
+
**Error**: ${error.message}
|
|
120
|
+
|
|
121
|
+
**ISV Authentication:**
|
|
122
|
+
- Merchant Partner ID: ${params.merchantPartnerId}
|
|
123
|
+
- OAuth2 Token: ${params.oauth2Token ? 'Provided' : 'Missing'}
|
|
124
|
+
- ISV Partner ID: ${getPartnerIdSafe()}`
|
|
125
|
+
}]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|