@payware/mcp-server 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +42 -4
  2. package/package.json +1 -1
  3. package/src/isv/data/index.js +23 -0
  4. package/src/isv/deep-links/delete-product-link.js +1 -1
  5. package/src/isv/deep-links/delete-transaction-link.js +1 -1
  6. package/src/isv/deep-links/get-product-link.js +1 -1
  7. package/src/isv/deep-links/get-transaction-link.js +1 -1
  8. package/src/isv/index.js +11 -1
  9. package/src/isv/poi/cancel-price.js +149 -0
  10. package/src/isv/poi/get-poi.js +190 -0
  11. package/src/isv/poi/get-qrcode.js +151 -0
  12. package/src/isv/poi/get-status.js +176 -0
  13. package/src/isv/poi/index.js +32 -0
  14. package/src/isv/poi/list-pois.js +168 -0
  15. package/src/isv/poi/set-price.js +225 -0
  16. package/src/isv/transactions/get-status.js +1 -1
  17. package/src/isv/transactions/transaction-history.js +2 -1
  18. package/src/mcp-proxy.js +2 -2
  19. package/src/merchant/data/export-report.js +3 -4
  20. package/src/merchant/data/generate-report.js +3 -4
  21. package/src/merchant/data/get-export-list.js +140 -0
  22. package/src/merchant/data/get-report-requests.js +125 -0
  23. package/src/merchant/data/get-report-status.js +3 -4
  24. package/src/merchant/data/index.js +64 -25
  25. package/src/merchant/data/list-reports.js +107 -0
  26. package/src/merchant/deep-links/delete-product-link.js +1 -1
  27. package/src/merchant/deep-links/delete-transaction-link.js +1 -1
  28. package/src/merchant/deep-links/get-product-link.js +1 -1
  29. package/src/merchant/deep-links/get-transaction-link.js +1 -1
  30. package/src/merchant/transactions/create-transaction.js +4 -2
  31. package/src/merchant/transactions/get-status.js +1 -1
  32. package/src/merchant/transactions/process-transaction.js +10 -1
  33. package/src/merchant/transactions/simulate-callback.js +11 -2
  34. package/src/merchant/transactions/transaction-history.js +1 -1
  35. package/src/payment-institution/data/index.js +23 -0
  36. package/src/payment-institution/deep-links/delete-transaction-link.js +1 -1
  37. package/src/payment-institution/deep-links/get-transaction-link.js +1 -1
  38. package/src/payment-institution/transactions/create-pi-transaction.js +2 -0
  39. package/src/payment-institution/transactions/finalize-transaction.js +1 -0
  40. package/src/payment-institution/transactions/get-transaction-history.js +1 -1
  41. package/src/payment-institution/transactions/get-transaction-status.js +1 -1
  42. package/src/payment-institution/transactions/process-pi-transaction.js +12 -0
  43. package/src/payment-institution/transactions/simulate-pi-callback.js +12 -2
  44. package/src/payment-institution/transactions/soundbite-transaction.js +2 -0
  45. package/src/shared/data/data-api.js +97 -0
  46. package/src/utils/code-examples/merchant/transactions.js +2 -1
  47. package/src/utils/code-examples/payment-institution/transactions.js +1 -0
@@ -15,6 +15,7 @@ export function generateMockCallback(transactionId, status = 'CONFIRMED', option
15
15
  currency = 'EUR',
16
16
  payerAmount = null,
17
17
  payeeAmount = null,
18
+ paymentMethod = null,
18
19
  statusMessage = null,
19
20
  passbackParams = null
20
21
  } = options;
@@ -38,6 +39,7 @@ export function generateMockCallback(transactionId, status = 'CONFIRMED', option
38
39
  currency,
39
40
  status,
40
41
  statusMessage,
42
+ ...(paymentMethod && { paymentMethod }),
41
43
  created: currentTime - 300000, // Created 5 minutes ago (milliseconds)
42
44
  ...(status !== 'EXPIRED' && { finalized: currentTime })
43
45
  };
@@ -152,6 +154,11 @@ export const simulateCallbackTool = {
152
154
  statusMessage: {
153
155
  type: "string",
154
156
  description: "Custom status message for the transaction callback"
157
+ },
158
+ paymentMethod: {
159
+ type: "string",
160
+ enum: ["A2A", "CARD_FUNDED", "BNPL", "INSTANT_CREDIT"],
161
+ description: "Payment method chosen by customer. A2A = direct transfer. CARD_FUNDED = card-linked account. BNPL = buy now pay later. INSTANT_CREDIT = credit line."
155
162
  }
156
163
  },
157
164
  required: ["transactionId"],
@@ -166,7 +173,8 @@ export const simulateCallbackTool = {
166
173
  amount = '57.60',
167
174
  currency = 'EUR',
168
175
  fee = '0.00',
169
- statusMessage
176
+ statusMessage,
177
+ paymentMethod
170
178
  } = args;
171
179
 
172
180
  if (!transactionId) {
@@ -178,7 +186,8 @@ export const simulateCallbackTool = {
178
186
  amount,
179
187
  currency,
180
188
  fee,
181
- statusMessage
189
+ statusMessage,
190
+ paymentMethod
182
191
  });
183
192
 
184
193
  // Simulate callback delivery if URL provided
@@ -161,7 +161,7 @@ export const getTransactionHistoryTool = {
161
161
  - ID: ${result.transaction.transactionId || 'N/A'}
162
162
  - Initiated By: ${result.transaction.initiatedBy || 'N/A'}
163
163
  - Amount: ${result.transaction.amount ? `${result.transaction.amount} ${result.transaction.currency}` : 'N/A'}
164
- - Reason: ${result.transaction.reasonL1 || 'N/A'}${result.transaction.reasonL2 ? ` (${result.transaction.reasonL2})` : ''}
164
+ ${result.transaction.paymentMethod ? `- Payment Method: ${result.transaction.paymentMethod}\n` : ''}- Reason: ${result.transaction.reasonL1 || 'N/A'}${result.transaction.reasonL2 ? ` (${result.transaction.reasonL2})` : ''}
165
165
 
166
166
  **Parties:**
167
167
  - Payee: ${result.transaction.payeeFriendlyName || 'N/A'} (${result.transaction.payeeAccount || 'N/A'})
@@ -11,6 +11,9 @@ import {
11
11
  downloadExport,
12
12
  cancelReport,
13
13
  cancelExport,
14
+ listReports,
15
+ getReportRequests,
16
+ getExportList,
14
17
  REPORT_TYPES,
15
18
  EXPORT_FORMATS,
16
19
  LOCALES
@@ -218,6 +221,23 @@ This feature is only available in the production environment, not in sandbox.
218
221
  };
219
222
 
220
223
  // Create all other PI data tools
224
+ export const listReportsTool = createPIDataTool('list_reports', listReports, 'List All Available Reports', {});
225
+
226
+ export const getReportRequestsTool = createPIDataTool('get_report_requests', getReportRequests, 'Get Report Request History', {
227
+ reportId: {
228
+ type: "string",
229
+ description: "The report unit ID (path) to get execution history for (e.g., '/processedTransactions')",
230
+ enum: Object.values(REPORT_TYPES)
231
+ }
232
+ });
233
+
234
+ export const getExportListTool = createPIDataTool('get_export_list', getExportList, 'Get Export List for Request', {
235
+ requestId: {
236
+ type: "string",
237
+ description: "The request ID (UUID) to get exports for"
238
+ }
239
+ });
240
+
221
241
  export const getReportStatusTool = createPIDataTool('get_report_status', getReportStatus, 'Get Report Status', {
222
242
  requestId: {
223
243
  type: "string",
@@ -270,9 +290,12 @@ export const cancelExportTool = createPIDataTool('cancel_export', cancelExport,
270
290
  * All Payment Institution data tools
271
291
  */
272
292
  export const paymentInstitutionDataTools = [
293
+ listReportsTool,
273
294
  generateReportTool,
295
+ getReportRequestsTool,
274
296
  getReportStatusTool,
275
297
  exportReportTool,
298
+ getExportListTool,
276
299
  getExportStatusTool,
277
300
  downloadExportTool,
278
301
  cancelReportTool,
@@ -76,7 +76,7 @@ export const deleteTransactionLinkTool = {
76
76
  **Deletion Details:**
77
77
  - Transaction ID: ${transactionId}
78
78
  - Status: Successfully deleted
79
- - Link URL: https://url.payware.eu/${transactionId} (now inactive)
79
+ - Link URL: https://go.payware.eu/${transactionId} (now inactive)
80
80
 
81
81
  **Payment Institution Info:**
82
82
  - Partner ID: ${partnerId}
@@ -9,7 +9,7 @@ export const getTransactionLinkTool = {
9
9
  description: `Get an active deep link for a transaction where the payment institution acts as source (SRC) or destination (DST). Returns a clickable URL that redirects to the payware mobile app.
10
10
 
11
11
  **Deep Link Format:**
12
- - Web URL: https://url.payware.eu/{transactionId}
12
+ - Web URL: https://go.payware.eu/{transactionId}
13
13
  - Mobile Redirect: payware://{transactionId}
14
14
 
15
15
  **Use Cases:**
@@ -407,6 +407,8 @@ export const createPITransactionTool = {
407
407
  useSandbox
408
408
  });
409
409
 
410
+ const baseUrl = useSandbox ? getSandboxUrl() : getProductionUrl();
411
+
410
412
  if (result.success) {
411
413
  const roleDescription = role === 'SRC' ? 'Payer (Source)' : 'Payee (Destination)';
412
414
  const status = result.transaction.status || 'ACTIVE';
@@ -263,6 +263,7 @@ export const finalizeTransactionTool = {
263
263
  ${statusMessage ? `- Status Message: ${statusMessage}` : ''}
264
264
  ${amount ? `- Final Amount: ${amount} ${currency}` : ''}
265
265
  ${fee !== undefined ? `- Fee Collected: ${fee} ${currency}` : ''}
266
+ ${result.transaction.paymentMethod ? `- Payment Method: ${result.transaction.paymentMethod}` : ''}
266
267
 
267
268
  **Transaction Response:**
268
269
  \`\`\`json
@@ -166,7 +166,7 @@ ${tx.statusMessage ? `- Status Message: ${tx.statusMessage}` : ''}
166
166
 
167
167
  **Transaction Details:**
168
168
  - Amount: ${tx.amount || 'N/A'} ${tx.currency || 'N/A'}
169
- - Reason L1: ${tx.reasonL1 || 'N/A'}
169
+ ${tx.paymentMethod ? `- Payment Method: ${tx.paymentMethod}\n` : ''}- Reason L1: ${tx.reasonL1 || 'N/A'}
170
170
  ${tx.reasonL2 ? `- Reason L2: ${tx.reasonL2}` : ''}
171
171
 
172
172
  **Payee Information:**
@@ -156,7 +156,7 @@ export const getPITransactionStatusTool = {
156
156
 
157
157
  **Transaction Details:**
158
158
  - Amount: ${tx.amount || 'N/A'} ${tx.currency || 'N/A'}
159
- - Reason L1: ${tx.reasonL1 || 'N/A'}
159
+ ${tx.paymentMethod ? `- Payment Method: ${tx.paymentMethod}\n` : ''}- Reason L1: ${tx.reasonL1 || 'N/A'}
160
160
  ${tx.reasonL2 ? `- Reason L2: ${tx.reasonL2}` : ''}
161
161
 
162
162
  **Payee Information:**
@@ -24,6 +24,8 @@ export async function processPITransaction({
24
24
  privateKey,
25
25
  // Delivery address for SHIPPABLE transactions
26
26
  deliveryAddress,
27
+ // Payment method for POI transactions (Payment Choice Architecture)
28
+ paymentMethod,
27
29
  useSandbox = true
28
30
  }) {
29
31
  if (!transactionId) {
@@ -56,6 +58,7 @@ export async function processPITransaction({
56
58
  friendlyName,
57
59
  ...(callbackUrl && { callbackUrl }),
58
60
  ...(passbackParams && { passbackParams }),
61
+ ...(paymentMethod && { paymentMethod }),
59
62
  trData: {
60
63
  ...(amount !== undefined && { amount: amount.toString() }),
61
64
  currency,
@@ -213,6 +216,12 @@ export const processPITransactionTool = {
213
216
  description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
214
217
  default: getPrivateKeySafe()
215
218
  },
219
+ // Payment method for POI transactions
220
+ paymentMethod: {
221
+ type: "string",
222
+ enum: ["A2A", "CARD_FUNDED", "BNPL", "INSTANT_CREDIT"],
223
+ description: "Payment method chosen by customer (for POI transactions only). A2A = direct transfer (lower fee, no rewards). CARD_FUNDED = card-linked account (higher fee, rewards eligible). BNPL = buy now pay later (installments). INSTANT_CREDIT = credit line approved at purchase."
224
+ },
216
225
  // Delivery address for SHIPPABLE transactions
217
226
  deliveryAddress: {
218
227
  type: "object",
@@ -290,6 +299,7 @@ export const processPITransactionTool = {
290
299
  timeToLive,
291
300
  partnerId = getPartnerIdSafe(),
292
301
  privateKey = getPrivateKeySafe(args.useSandbox ?? true),
302
+ paymentMethod,
293
303
  deliveryAddress,
294
304
  useSandbox = true
295
305
  } = args;
@@ -335,6 +345,7 @@ export const processPITransactionTool = {
335
345
  timeToLive,
336
346
  partnerId,
337
347
  privateKey,
348
+ paymentMethod,
338
349
  deliveryAddress,
339
350
  useSandbox
340
351
  });
@@ -353,6 +364,7 @@ export const processPITransactionTool = {
353
364
  - Friendly Name: ${friendlyName}
354
365
  ${amount ? `- Amount: ${amount} ${currency}` : ''}
355
366
  ${reasonL1 ? `- Reason: ${reasonL1}${reasonL2 ? ` (${reasonL2})` : ''}` : ''}
367
+ ${paymentMethod ? `- Payment Method: ${paymentMethod}` : ''}
356
368
  ${timeToLive ? `- Time to Live: ${timeToLive} seconds` : ''}
357
369
  ${callbackUrl ? `- Callback URL: ${callbackUrl}` : ''}
358
370
  ${passbackParams ? `- Passback Params: ${passbackParams}` : ''}
@@ -27,6 +27,7 @@ export function generateMockPICallback(transactionId, callbackType = 'TRANSACTIO
27
27
  timeToLive = 600,
28
28
  initiatedBy = 'PEER',
29
29
  transactionType = 'DEFAULT',
30
+ paymentMethod = null,
30
31
  status = 'CONFIRMED',
31
32
  statusMessage = null,
32
33
  passbackParams = null
@@ -60,7 +61,8 @@ export function generateMockPICallback(transactionId, callbackType = 'TRANSACTIO
60
61
  ...(reasonL2 && { reasonL2 }),
61
62
  timeToLive,
62
63
  transactionType,
63
- initiatedBy
64
+ initiatedBy,
65
+ ...(paymentMethod && { paymentMethod })
64
66
  };
65
67
  } else {
66
68
  // TRANSACTION_FINALIZED
@@ -73,6 +75,7 @@ export function generateMockPICallback(transactionId, callbackType = 'TRANSACTIO
73
75
  currency,
74
76
  status,
75
77
  ...(statusMessage && { statusMessage }),
78
+ ...(paymentMethod && { paymentMethod }),
76
79
  created: Date.now() - 300000, // Created 5 minutes ago (milliseconds)
77
80
  finalized: Date.now()
78
81
  };
@@ -202,6 +205,11 @@ export const simulatePICallbackTool = {
202
205
  statusMessage: {
203
206
  type: "string",
204
207
  description: "Status message (only for TRANSACTION_FINALIZED callbacks)"
208
+ },
209
+ paymentMethod: {
210
+ type: "string",
211
+ enum: ["A2A", "CARD_FUNDED", "BNPL", "INSTANT_CREDIT"],
212
+ description: "Payment method chosen by customer. A2A = direct transfer. CARD_FUNDED = card-linked account. BNPL = buy now pay later. INSTANT_CREDIT = credit line."
205
213
  }
206
214
  },
207
215
  required: ["transactionId"]
@@ -225,7 +233,8 @@ export const simulatePICallbackTool = {
225
233
  reasonL2,
226
234
  timeToLive = 600,
227
235
  status = 'CONFIRMED',
228
- statusMessage
236
+ statusMessage,
237
+ paymentMethod
229
238
  } = args;
230
239
 
231
240
  if (!transactionId) {
@@ -248,6 +257,7 @@ export const simulatePICallbackTool = {
248
257
  timeToLive,
249
258
  initiatedBy: 'PEER',
250
259
  transactionType: 'DEFAULT',
260
+ paymentMethod,
251
261
  status,
252
262
  statusMessage
253
263
  });
@@ -152,6 +152,8 @@ export const soundbiteTransactionTool = {
152
152
  useSandbox
153
153
  });
154
154
 
155
+ const baseUrl = useSandbox ? getSandboxUrl() : getProductionUrl();
156
+
155
157
  if (result.success) {
156
158
  const tx = result.transaction;
157
159
  const createdDate = tx.created ? new Date(tx.created * 1000).toISOString() : 'N/A';
@@ -369,4 +369,101 @@ export async function cancelExport({
369
369
  } catch (error) {
370
370
  throw new Error(`Failed to cancel export: ${error.response?.data?.message || error.message}`);
371
371
  }
372
+ }
373
+
374
+ /**
375
+ * List all available reports
376
+ */
377
+ export async function listReports({
378
+ partnerType,
379
+ ...authParams
380
+ }) {
381
+ const headers = await createAuthHeaders(partnerType, authParams);
382
+
383
+ try {
384
+ const response = await axios.get(
385
+ `${getProductionUrl()}/data-retrieval/reports`,
386
+ { headers }
387
+ );
388
+
389
+ return {
390
+ success: true,
391
+ data: response.data,
392
+ requestInfo: {
393
+ url: `${getProductionUrl()}/data-retrieval/reports`,
394
+ method: 'GET',
395
+ statusCode: response.status
396
+ }
397
+ };
398
+ } catch (error) {
399
+ throw new Error(`Failed to list reports: ${error.response?.data?.message || error.message}`);
400
+ }
401
+ }
402
+
403
+ /**
404
+ * Get report request history for a specific report type
405
+ */
406
+ export async function getReportRequests({
407
+ reportId,
408
+ partnerType,
409
+ ...authParams
410
+ }) {
411
+ if (!reportId) {
412
+ throw new Error('reportId is required (e.g., "/processedTransactions")');
413
+ }
414
+
415
+ const headers = await createAuthHeaders(partnerType, authParams);
416
+
417
+ try {
418
+ const response = await axios.get(
419
+ `${getProductionUrl()}/data-retrieval${reportId}`,
420
+ { headers }
421
+ );
422
+
423
+ return {
424
+ success: true,
425
+ data: response.data,
426
+ requestInfo: {
427
+ url: `${getProductionUrl()}/data-retrieval${reportId}`,
428
+ method: 'GET',
429
+ statusCode: response.status
430
+ }
431
+ };
432
+ } catch (error) {
433
+ throw new Error(`Failed to get report requests: ${error.response?.data?.message || error.message}`);
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Get export list for a specific request
439
+ */
440
+ export async function getExportList({
441
+ requestId,
442
+ partnerType,
443
+ ...authParams
444
+ }) {
445
+ if (!requestId) {
446
+ throw new Error('requestId is required (UUID from report generation)');
447
+ }
448
+
449
+ const headers = await createAuthHeaders(partnerType, authParams);
450
+
451
+ try {
452
+ const response = await axios.get(
453
+ `${getProductionUrl()}/data-retrieval/exports/${requestId}`,
454
+ { headers }
455
+ );
456
+
457
+ return {
458
+ success: true,
459
+ data: response.data,
460
+ requestInfo: {
461
+ url: `${getProductionUrl()}/data-retrieval/exports/${requestId}`,
462
+ method: 'GET',
463
+ statusCode: response.status
464
+ }
465
+ };
466
+ } catch (error) {
467
+ throw new Error(`Failed to get export list: ${error.response?.data?.message || error.message}`);
468
+ }
372
469
  }
@@ -50,7 +50,8 @@ export const MerchantTransactionOperations = {
50
50
  method: 'POST',
51
51
  sampleBody: {
52
52
  account: 'MERCHANT_ACCOUNT_123',
53
- friendlyName: 'My Store'
53
+ friendlyName: 'My Store',
54
+ paymentMethod: 'A2A' // Optional: A2A, CARD_FUNDED, BNPL, INSTANT_CREDIT
54
55
  }
55
56
  },
56
57
 
@@ -33,6 +33,7 @@ export const PITransactionOperations = {
33
33
  sampleBody: {
34
34
  account: 'PI_ACCOUNT',
35
35
  friendlyName: 'Payment Institution Name',
36
+ paymentMethod: 'A2A', // Optional: A2A, CARD_FUNDED, BNPL, INSTANT_CREDIT
36
37
  trData: {
37
38
  amount: '50.00',
38
39
  currency: 'EUR',