@payware/mcp-server 1.3.2 → 1.4.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 (93) hide show
  1. package/.env.example +4 -0
  2. package/README.md +18 -0
  3. package/package.json +7 -9
  4. package/src/auth/rsa-keys.js +12 -6
  5. package/src/auth/sandbox-setup.js +2 -0
  6. package/src/config/toolsets.js +104 -0
  7. package/src/core/auth/jwt-factory.js +4 -1
  8. package/src/core/auth/jwt-token.js +4 -0
  9. package/src/index.js +10 -6
  10. package/src/isv/data/index.js +15 -14
  11. package/src/isv/deep-links/delete-product-link.js +3 -2
  12. package/src/isv/deep-links/delete-transaction-link.js +3 -2
  13. package/src/isv/deep-links/get-product-link.js +8 -6
  14. package/src/isv/deep-links/get-transaction-link.js +8 -6
  15. package/src/isv/index.js +6 -0
  16. package/src/isv/invitations/index.js +5 -0
  17. package/src/isv/oauth2/get-token-info.js +10 -5
  18. package/src/isv/oauth2/obtain-token.js +9 -4
  19. package/src/isv/oauth2/token-helper.js +28 -26
  20. package/src/isv/poi/cancel-price.js +9 -2
  21. package/src/isv/poi/get-poi.js +4 -3
  22. package/src/isv/poi/get-qrcode.js +40 -9
  23. package/src/isv/poi/get-status.js +196 -168
  24. package/src/isv/poi/list-pois.js +6 -6
  25. package/src/isv/poi/set-price.js +40 -53
  26. package/src/isv/products/audios.js +8 -2
  27. package/src/isv/products/create-product.js +2 -0
  28. package/src/isv/products/delete-product.js +2 -0
  29. package/src/isv/products/get-product-image.js +2 -0
  30. package/src/isv/products/get-product.js +2 -0
  31. package/src/isv/products/list-products.js +2 -0
  32. package/src/isv/products/schedules.js +6 -0
  33. package/src/isv/products/update-product.js +2 -0
  34. package/src/isv/reference/index.js +2 -0
  35. package/src/isv/transactions/cancel-transaction.js +2 -0
  36. package/src/isv/transactions/create-transaction.js +2 -0
  37. package/src/isv/transactions/get-status.js +3 -1
  38. package/src/isv/transactions/process-transaction.js +2 -0
  39. package/src/isv/transactions/simulate-callback.js +21 -10
  40. package/src/isv/transactions/transaction-history.js +2 -0
  41. package/src/merchant/data/export-report.js +2 -0
  42. package/src/merchant/data/generate-report.js +2 -0
  43. package/src/merchant/data/get-export-list.js +2 -0
  44. package/src/merchant/data/get-report-requests.js +2 -0
  45. package/src/merchant/data/get-report-status.js +2 -0
  46. package/src/merchant/data/index.js +15 -10
  47. package/src/merchant/data/list-reports.js +2 -0
  48. package/src/merchant/deep-links/delete-product-link.js +3 -2
  49. package/src/merchant/deep-links/delete-transaction-link.js +3 -2
  50. package/src/merchant/deep-links/get-product-link.js +8 -6
  51. package/src/merchant/deep-links/get-transaction-link.js +8 -6
  52. package/src/merchant/index.js +7 -1
  53. package/src/merchant/logs/index.js +4 -0
  54. package/src/merchant/products/audios.js +15 -14
  55. package/src/merchant/products/create-product.js +3 -2
  56. package/src/merchant/products/delete-product.js +3 -2
  57. package/src/merchant/products/get-product-image.js +3 -2
  58. package/src/merchant/products/get-product.js +3 -2
  59. package/src/merchant/products/list-products.js +3 -2
  60. package/src/merchant/products/schedules.js +11 -10
  61. package/src/merchant/products/update-product.js +3 -2
  62. package/src/merchant/transactions/cancel-transaction.js +3 -2
  63. package/src/merchant/transactions/create-transaction.js +3 -1
  64. package/src/merchant/transactions/get-status.js +4 -3
  65. package/src/merchant/transactions/process-transaction.js +5 -4
  66. package/src/merchant/transactions/simulate-callback.js +325 -313
  67. package/src/merchant/transactions/transaction-history.js +7 -6
  68. package/src/payment-institution/data/index.js +15 -14
  69. package/src/payment-institution/deep-links/delete-transaction-link.js +3 -2
  70. package/src/payment-institution/deep-links/get-transaction-link.js +8 -6
  71. package/src/payment-institution/transactions/create-pi-transaction.js +4 -3
  72. package/src/payment-institution/transactions/finalize-transaction.js +6 -3
  73. package/src/payment-institution/transactions/get-transaction-history.js +8 -5
  74. package/src/payment-institution/transactions/get-transaction-status.js +16 -13
  75. package/src/payment-institution/transactions/process-pi-transaction.js +7 -6
  76. package/src/payment-institution/transactions/simulate-pi-callback.js +388 -375
  77. package/src/payment-institution/transactions/soundbite-transaction.js +6 -5
  78. package/src/proxy-server.js +25 -0
  79. package/src/shared/placements/api.js +51 -0
  80. package/src/shared/placements/tools.js +519 -0
  81. package/src/shared/poi/poi-create-api.js +4 -1
  82. package/src/shared/products/products-api.js +36 -25
  83. package/src/shared/shops/shops-api.js +2 -0
  84. package/src/shared/tool-annotations.js +53 -0
  85. package/src/tools/advanced-code-generator.js +17 -265
  86. package/src/utils/code-examples/common/auth-examples.js +1 -1
  87. package/src/utils/code-examples/isv/products.js +1 -1
  88. package/src/utils/code-examples/isv/transactions.js +1 -1
  89. package/src/utils/code-examples/merchant/transactions.js +1 -1
  90. package/src/utils/format-request.js +2 -0
  91. package/src/utils/json-formatter.js +2 -0
  92. package/src/utils/server-info.js +2 -0
  93. package/src/utils/code-examples.js +0 -646
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
4
4
  import { apiErrorResult } from '../../shared/api-errors.js';
5
+ import { READS } from '../../shared/tool-annotations.js';
5
6
 
6
7
  /**
7
8
  * Get transaction history from payware API (for completed/expired transactions)
@@ -91,11 +92,12 @@ function formatTransactionHistory(transaction) {
91
92
  */
92
93
  export const getTransactionHistoryTool = {
93
94
  name: "payware_operations_get_transaction_history",
95
+ annotations: READS,
94
96
  description: `Get history of completed/finalized transactions with final statuses.
95
97
 
96
98
  **Endpoint:** GET /transactions-history/{transactionId}
97
99
  **Use Case:** Retrieve transactions with final statuses: CONFIRMED, DECLINED, FAILED, EXPIRED, CANCELLED.
98
- **Note:** For ACTIVE transactions, use 'payware_transactions_get_transaction_status' instead.
100
+ **Note:** For ACTIVE transactions, use 'payware_operations_get_transaction_status' instead.
99
101
 
100
102
  📦 **This is where the delivery address lives.** For a SHIPPABLE transaction, \`deliveryAddress\`
101
103
  (fullName, streetAddressLine1/2, zipCode, city, region, country, phoneNumber, email) is returned
@@ -129,8 +131,7 @@ retry once the window passes. The failure result exposes this as \`error.throttl
129
131
  },
130
132
  privateKey: {
131
133
  type: "string",
132
- description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default.",
133
- default: getPrivateKeySafe()
134
+ description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
134
135
  },
135
136
  useSandbox: {
136
137
  type: "boolean",
@@ -163,8 +164,8 @@ retry once the window passes. The failure result exposes this as \`error.throttl
163
164
  const formatInfo = formatTransactionHistory(result.transaction);
164
165
 
165
166
  // Format dates
166
- const created = result.transaction.created ? new Date(result.transaction.created * 1000).toISOString() : 'N/A';
167
- const finalized = result.transaction.finalized ? new Date(result.transaction.finalized * 1000).toISOString() : 'N/A';
167
+ const created = result.transaction.created ? new Date(result.transaction.created).toISOString() : 'N/A';
168
+ const finalized = result.transaction.finalized ? new Date(result.transaction.finalized).toISOString() : 'N/A';
168
169
 
169
170
  return {
170
171
  content: [{
@@ -262,7 +263,7 @@ ${JSON.stringify(result.error.details || result.error, null, 2)}
262
263
  1. Verify transaction ID is correct: 10 characters total, starts with 'pw' (standard), 'pr' (product), or 'ps' (soundbite)
263
264
  2. Ensure transaction exists and you have access to it
264
265
  3. If getting rate limit errors, wait 60 seconds before retrying
265
- 4. For ACTIVE transactions, use 'payware_transactions_get_transaction_status' instead
266
+ 4. For ACTIVE transactions, use 'payware_operations_get_transaction_status' instead
266
267
  5. This endpoint only returns transactions with final statuses (CONFIRMED, DECLINED, FAILED, EXPIRED, CANCELLED)`;
267
268
 
268
269
  return {
@@ -19,10 +19,12 @@ import {
19
19
  LOCALES
20
20
  } from '../../shared/data/data-api.js';
21
21
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
22
+ import { CHANGES, CREATES, READS } from '../../shared/tool-annotations.js';
22
23
 
23
24
  // Create a payment institution tool factory
24
- const createPIDataTool = (toolName, apiFunction, description, additionalParams = {}) => ({
25
+ const createPIDataTool = (toolName, apiFunction, description, additionalParams = {}, annotations) => ({
25
26
  name: `payware_data_${toolName}`,
27
+ annotations,
26
28
  description: `${description} (Payment Institution data access)`,
27
29
  inputSchema: {
28
30
  type: "object",
@@ -35,8 +37,7 @@ const createPIDataTool = (toolName, apiFunction, description, additionalParams =
35
37
  },
36
38
  privateKey: {
37
39
  type: "string",
38
- description: "Payment Institution RSA private key for authentication. Uses environment-specific private key as default.",
39
- default: getPrivateKeySafe()
40
+ description: "Payment Institution RSA private key for authentication. Uses environment-specific private key as default."
40
41
  },
41
42
  ...additionalParams
42
43
  },
@@ -78,6 +79,7 @@ const createPIDataTool = (toolName, apiFunction, description, additionalParams =
78
79
  */
79
80
  export const generateReportTool = {
80
81
  name: "payware_data_generate_report",
82
+ annotations: CREATES,
81
83
  description: "Generate an asynchronous data report for Payment Institution analysis. Focuses on P2P transaction flows and cross-institution payments. Production only.",
82
84
  inputSchema: {
83
85
  type: "object",
@@ -122,8 +124,7 @@ export const generateReportTool = {
122
124
  },
123
125
  privateKey: {
124
126
  type: "string",
125
- description: "Payment Institution RSA private key for authentication. Uses environment-specific private key as default.",
126
- default: getPrivateKeySafe()
127
+ description: "Payment Institution RSA private key for authentication. Uses environment-specific private key as default."
127
128
  }
128
129
  },
129
130
  required: ["reportUnitId"]
@@ -221,7 +222,7 @@ This feature is only available in the production environment, not in sandbox.
221
222
  };
222
223
 
223
224
  // Create all other PI data tools
224
- export const listReportsTool = createPIDataTool('list_reports', listReports, 'List All Available Reports', {});
225
+ export const listReportsTool = createPIDataTool('list_reports', listReports, 'List All Available Reports', {}, READS);
225
226
 
226
227
  export const getReportRequestsTool = createPIDataTool('get_report_requests', getReportRequests, 'Get Report Request History', {
227
228
  reportId: {
@@ -229,21 +230,21 @@ export const getReportRequestsTool = createPIDataTool('get_report_requests', get
229
230
  description: "The report unit ID (path) to get execution history for (e.g., '/processedTransactions')",
230
231
  enum: Object.values(REPORT_TYPES)
231
232
  }
232
- });
233
+ }, READS);
233
234
 
234
235
  export const getExportListTool = createPIDataTool('get_export_list', getExportList, 'Get Export List for Request', {
235
236
  requestId: {
236
237
  type: "string",
237
238
  description: "The request ID (UUID) to get exports for"
238
239
  }
239
- });
240
+ }, READS);
240
241
 
241
242
  export const getReportStatusTool = createPIDataTool('get_report_status', getReportStatus, 'Get Report Status', {
242
243
  requestId: {
243
244
  type: "string",
244
245
  description: "The request ID returned from the report generation request (UUID format)"
245
246
  }
246
- });
247
+ }, READS);
247
248
 
248
249
  export const exportReportTool = createPIDataTool('export_report', exportReport, 'Export Report', {
249
250
  requestId: {
@@ -256,35 +257,35 @@ export const exportReportTool = createPIDataTool('export_report', exportReport,
256
257
  enum: Object.values(EXPORT_FORMATS),
257
258
  default: EXPORT_FORMATS.PDF
258
259
  }
259
- });
260
+ }, CREATES);
260
261
 
261
262
  export const getExportStatusTool = createPIDataTool('get_export_status', getExportStatus, 'Get Export Status', {
262
263
  exportId: {
263
264
  type: "string",
264
265
  description: "The export ID returned from the export request (UUID format)"
265
266
  }
266
- });
267
+ }, READS);
267
268
 
268
269
  export const downloadExportTool = createPIDataTool('download_export', downloadExport, 'Download Export', {
269
270
  exportId: {
270
271
  type: "string",
271
272
  description: "The export ID from the export request (UUID format)"
272
273
  }
273
- });
274
+ }, READS);
274
275
 
275
276
  export const cancelReportTool = createPIDataTool('cancel_report', cancelReport, 'Cancel Report', {
276
277
  requestId: {
277
278
  type: "string",
278
279
  description: "The request ID of the report to cancel (UUID format)"
279
280
  }
280
- });
281
+ }, CHANGES);
281
282
 
282
283
  export const cancelExportTool = createPIDataTool('cancel_export', cancelExport, 'Cancel Export', {
283
284
  exportId: {
284
285
  type: "string",
285
286
  description: "The export ID of the export to cancel (UUID format)"
286
287
  }
287
- });
288
+ }, CHANGES);
288
289
 
289
290
  /**
290
291
  * All Payment Institution data tools
@@ -1,11 +1,13 @@
1
1
  import { deleteTransactionDeepLink } from '../../shared/deep-links/api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { CHANGES } from '../../shared/tool-annotations.js';
3
4
 
4
5
  /**
5
6
  * Delete deep link for a payment institution transaction
6
7
  */
7
8
  export const deleteTransactionLinkTool = {
8
9
  name: "payware_deep_links_delete_transaction_link",
10
+ annotations: CHANGES,
9
11
  description: `Delete an active deep link for a transaction where the payment institution acts as source (SRC) or destination (DST). Once deleted, the deep link URL will no longer redirect to the payware mobile app.
10
12
 
11
13
  **Use Cases:**
@@ -34,8 +36,7 @@ export const deleteTransactionLinkTool = {
34
36
  },
35
37
  privateKey: {
36
38
  type: "string",
37
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
38
- default: getPrivateKeySafe()
39
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
39
40
  }
40
41
  },
41
42
  required: ["transactionId"]
@@ -1,16 +1,18 @@
1
1
  import { getTransactionDeepLink } from '../../shared/deep-links/api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { ADDS } from '../../shared/tool-annotations.js';
3
4
 
4
5
  /**
5
6
  * Get deep link for a payment institution transaction
6
7
  */
7
8
  export const getTransactionLinkTool = {
8
9
  name: "payware_deep_links_get_transaction_link",
10
+ annotations: ADDS,
9
11
  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
12
 
11
13
  **Deep Link Format:**
12
14
  - Web URL: https://go.payware.eu/{transactionId}
13
- - Mobile Redirect: payware://{transactionId}
15
+ - Mobile Redirect: payware:/{transactionId} (one slash: the identifier is case-sensitive, so it must not sit in the URI host, which redirect services lowercase)
14
16
 
15
17
  **Use Cases:**
16
18
  - P2P payments initiated via messaging services
@@ -19,6 +21,7 @@ export const getTransactionLinkTool = {
19
21
 
20
22
  **Important Notes:**
21
23
  - Deep links are only supported in production environment
24
+ - Apps that open payware links must accept \`payware:\` followed by one, two or three slashes (QR codes and NFC tags carry \`payware://{id}\`): read the identifier after the scheme and any slashes, up to \`/\`, \`?\` or \`#\`, and keep its case
22
25
  - Link expiration is synchronized with the referenced transaction
23
26
  - Payment institutions only manage transaction links (no product links)
24
27
  - Traditional deep links that route to app content when app is installed`,
@@ -38,8 +41,7 @@ export const getTransactionLinkTool = {
38
41
  },
39
42
  privateKey: {
40
43
  type: "string",
41
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
42
- default: getPrivateKeySafe()
44
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
43
45
  }
44
46
  },
45
47
  required: ["transactionId"]
@@ -83,7 +85,7 @@ export const getTransactionLinkTool = {
83
85
  **Deep Link Details:**
84
86
  - Transaction ID: ${transactionId}
85
87
  - Web URL: ${linkUrl}
86
- - Mobile Redirect: payware://${transactionId}
88
+ - Mobile Redirect: payware:/${transactionId}
87
89
 
88
90
  **Payment Institution Info:**
89
91
  - Partner ID: ${partnerId}
@@ -106,7 +108,7 @@ ${JSON.stringify(result.data, null, 2)}
106
108
 
107
109
  **Usage:**
108
110
  1. Share the web URL: \`${linkUrl}\`
109
- 2. On mobile devices, it will redirect to: \`payware://${transactionId}\`
111
+ 2. On mobile devices, it will redirect to: \`payware:/${transactionId}\`
110
112
  3. Link expires when the transaction expires
111
113
  4. Use for P2P transaction notifications and sharing`
112
114
  }]
@@ -129,7 +131,7 @@ ${JSON.stringify(result.data, null, 2)}
129
131
  5. **Invalid transaction ID**: Ensure transaction ID format is correct
130
132
 
131
133
  **Troubleshooting:**
132
- 1. Verify transaction exists using \`payware_transactions_get_transaction_status\`
134
+ 1. Verify transaction exists using \`payware_operations_get_transaction_status\`
133
135
  2. Check if running in production environment
134
136
  3. Ensure JWT authentication is working
135
137
  4. Confirm payment institution role in transaction
@@ -3,6 +3,7 @@ import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { createMinimizedJSON } from '../../core/utils/json-serializer.js';
4
4
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
5
5
  import { apiErrorResult } from '../../shared/api-errors.js';
6
+ import { CREATES } from '../../shared/tool-annotations.js';
6
7
 
7
8
  /**
8
9
  * Create a payment institution transaction via payware API
@@ -150,6 +151,7 @@ export async function createPITransaction({
150
151
  */
151
152
  export const createPITransactionTool = {
152
153
  name: "payware_operations_create_transaction",
154
+ annotations: CREATES,
153
155
  description: `Create a new payware transaction as a payment institution. Payment institutions must specify their role and account details.
154
156
 
155
157
  **Payment Institution Features:**
@@ -245,8 +247,7 @@ export const createPITransactionTool = {
245
247
  },
246
248
  privateKey: {
247
249
  type: "string",
248
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
249
- default: getPrivateKeySafe(true)
250
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
250
251
  },
251
252
  passbackParams: {
252
253
  type: "string",
@@ -437,7 +438,7 @@ ${JSON.stringify(result.transaction, null, 2)}
437
438
  **Next Steps:**
438
439
  1. Save the transaction ID: \`${result.transaction.transactionId || 'N/A'}\`
439
440
  2. ${role === 'SRC' ? 'Share transaction ID with payee for processing' : 'Wait for payer to process this transaction'}
440
- 3. Use \`payware_pi_get_transaction_status\` to check status
441
+ 3. Use \`payware_operations_get_transaction_status\` to check status
441
442
  4. Monitor callback notifications (if callback URL provided)
442
443
  5. ${role === 'SRC' ? 'Complete payment through payware interface' : 'Handle incoming payment processing'}`
443
444
  }]
@@ -3,6 +3,7 @@ import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { createMinimizedJSON } from '../../core/utils/json-serializer.js';
4
4
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
5
5
  import { apiErrorResult } from '../../shared/api-errors.js';
6
+ import { COMMITS } from '../../shared/tool-annotations.js';
6
7
 
7
8
  /**
8
9
  * Finalize a transaction as a payment institution via payware API
@@ -98,6 +99,7 @@ export async function finalizeTransaction({
98
99
  */
99
100
  export const finalizeTransactionTool = {
100
101
  name: "payware_operations_finalize_transaction",
102
+ annotations: COMMITS,
101
103
  description: `Finalize a transaction as a payment institution. This updates the transaction status after execution in your payment network.
102
104
 
103
105
  **Payment Institution Finalization:**
@@ -164,8 +166,7 @@ export const finalizeTransactionTool = {
164
166
  },
165
167
  privateKey: {
166
168
  type: "string",
167
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
168
- default: getPrivateKeySafe()
169
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
169
170
  },
170
171
  useSandbox: {
171
172
  type: "boolean",
@@ -233,6 +234,8 @@ export const finalizeTransactionTool = {
233
234
  privateKey,
234
235
  useSandbox
235
236
  });
237
+ // The success text quotes the endpoint. The helper above keeps its own baseUrl, so it needs one here.
238
+ const baseUrl = useSandbox ? getSandboxUrl() : getProductionUrl();
236
239
 
237
240
  if (result.success) {
238
241
  const statusEmojis = {
@@ -277,7 +280,7 @@ ${JSON.stringify(result.transaction, null, 2)}
277
280
  ${status === 'CONFIRMED' ?
278
281
  `1. ✅ Payment completed successfully
279
282
  2. Transaction funds should be processed in your network
280
- 3. Use \`payware_pi_get_transaction_history\` to retrieve details later` :
283
+ 3. Use \`payware_operations_get_transaction_history\` to retrieve details later` :
281
284
  `1. ⚠️ Payment not completed due to: ${statusMessage || status}
282
285
  2. Transaction marked as ${status} in payware system
283
286
  3. All parties notified via callbacks`
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
4
4
  import { apiErrorResult } from '../../shared/api-errors.js';
5
+ import { READS } from '../../shared/tool-annotations.js';
5
6
 
6
7
  /**
7
8
  * Get transaction history via payware API (completed/expired transactions)
@@ -54,6 +55,7 @@ export async function getPITransactionHistory({
54
55
  */
55
56
  export const getPITransactionHistoryTool = {
56
57
  name: "payware_operations_get_transaction_history",
58
+ annotations: READS,
57
59
  description: `Get the complete history of a completed or expired payware transaction as a payment institution.
58
60
 
59
61
  **Use Cases:**
@@ -86,8 +88,7 @@ export const getPITransactionHistoryTool = {
86
88
  },
87
89
  privateKey: {
88
90
  type: "string",
89
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
90
- default: getPrivateKeySafe()
91
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
91
92
  },
92
93
  useSandbox: {
93
94
  type: "boolean",
@@ -124,10 +125,12 @@ export const getPITransactionHistoryTool = {
124
125
  privateKey,
125
126
  useSandbox
126
127
  });
128
+ // The success text quotes the endpoint. The helper above keeps its own baseUrl, so it needs one here.
129
+ const baseUrl = useSandbox ? getSandboxUrl() : getProductionUrl();
127
130
 
128
131
  if (result.success) {
129
132
  const tx = result.transaction;
130
- const createdDate = tx.created ? new Date(tx.created * 1000).toISOString() : 'N/A';
133
+ const createdDate = tx.created ? new Date(tx.created).toISOString() : 'N/A';
131
134
 
132
135
  // Status emoji mapping
133
136
  const statusEmojis = {
@@ -235,7 +238,7 @@ ${JSON.stringify(result.error.details || result.error, null, 2)}
235
238
  1. **ERR_MISSING_TRANSACTION (404)**: Transaction not found in history
236
239
  2. **HTTP 429 (Too Many Requests)**: API is throttled, implement retry logic
237
240
  3. **Authentication Issues**: Verify JWT token and partner credentials
238
- 4. **Transaction Still Active**: Use \`payware_pi_get_transaction_status\` for active transactions
241
+ 4. **Transaction Still Active**: Use \`payware_operations_get_transaction_status\` for active transactions
239
242
 
240
243
  **Troubleshooting:**
241
244
  1. Verify transaction ID is correct: 10 characters total, starts with 'pw' (standard), 'pr' (product), or 'ps' (soundbite)
@@ -251,7 +254,7 @@ ${JSON.stringify(result.error.details || result.error, null, 2)}
251
254
  - Avoid excessive polling of this endpoint
252
255
 
253
256
  **Alternative Actions:**
254
- - If transaction is still active: Use \`payware_pi_get_transaction_status\`
257
+ - If transaction is still active: Use \`payware_operations_get_transaction_status\`
255
258
  - If rate limited: Wait and retry after a delay
256
259
  - If transaction not found: Verify the transaction ID exists`
257
260
  }]
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
4
4
  import { apiErrorResult } from '../../shared/api-errors.js';
5
+ import { READS } from '../../shared/tool-annotations.js';
5
6
 
6
7
  /**
7
8
  * Get transaction status via payware API (active transactions)
@@ -54,6 +55,7 @@ export async function getPITransactionStatus({
54
55
  */
55
56
  export const getPITransactionStatusTool = {
56
57
  name: "payware_operations_get_transaction_status",
58
+ annotations: READS,
57
59
  description: `Get the current status of an active payware transaction as a financial institution.
58
60
 
59
61
  **Use Cases:**
@@ -96,7 +98,7 @@ Four rules a payer-facing app must follow:
96
98
  4. **A missing field is usually a plan boundary, not an error.** \`imageUrl\` and \`termsUrl\` are
97
99
  Standard and above; \`termsText\` and the descriptions are universal.
98
100
 
99
- For a \`pr\`/\`ps\` identifier the values are resolved live (product -> shop -> merchant fallback, then
101
+ For a \`pr\`, \`pl\` or \`ps\` identifier the values are resolved live (product -> shop -> merchant fallback, then
100
102
  plan gating); for the resulting \`pw\` transaction they are the snapshot frozen at creation, so what
101
103
  you get always reflects what the payer could have been shown at scan time.
102
104
 
@@ -105,14 +107,14 @@ strings at the smallest unit their own currency can be paid in - not always two
105
107
  **the value to echo back unchanged at finalize**; \`feeFixed\` and \`feeRate\` are informational, and
106
108
  recomputing the fee from them is rejected with ERR_FEE_MISMATCH.
107
109
 
108
- **Note:** This endpoint only returns active transactions. Use \`payware_pi_get_transaction_history\` for completed/expired transactions.`,
110
+ **Note:** This endpoint only returns active transactions. Use \`payware_operations_get_transaction_history\` for completed/expired transactions.`,
109
111
  inputSchema: {
110
112
  type: "object",
111
113
  properties: {
112
114
  transactionId: {
113
115
  type: "string",
114
- description: "Transaction ID to check status. Format: 2-char prefix + 8-char ID. Supports: 'pw' (standard), 'pr' (product), 'ps' (soundbite)",
115
- pattern: "^(pw|pr|ps)[0-9A-Za-z]{8}$"
116
+ description: "Transaction ID to check status. Format: 2-char prefix + 8-char ID. Supports: 'pw' (standard), 'pr' (product), 'pl' (placement: pays as its product, and the payment is attributed to the placement), 'ps' (soundbite)",
117
+ pattern: "^(pw|pr|pl|ps)[0-9A-Za-z]{8}$"
116
118
  },
117
119
  partnerId: {
118
120
  type: "string",
@@ -121,8 +123,7 @@ recomputing the fee from them is rejected with ERR_FEE_MISMATCH.
121
123
  },
122
124
  privateKey: {
123
125
  type: "string",
124
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
125
- default: getPrivateKeySafe()
126
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
126
127
  },
127
128
  useSandbox: {
128
129
  type: "boolean",
@@ -159,10 +160,12 @@ recomputing the fee from them is rejected with ERR_FEE_MISMATCH.
159
160
  privateKey,
160
161
  useSandbox
161
162
  });
163
+ // The success text quotes the endpoint. The helper above keeps its own baseUrl, so it needs one here.
164
+ const baseUrl = useSandbox ? getSandboxUrl() : getProductionUrl();
162
165
 
163
166
  if (result.success) {
164
167
  const tx = result.transaction;
165
- const createdDate = tx.created ? new Date(tx.created * 1000).toISOString() : 'N/A';
168
+ const createdDate = tx.created ? new Date(tx.created).toISOString() : 'N/A';
166
169
 
167
170
  // Transaction type display
168
171
  const typeDisplay = tx.transactionType || 'DEFAULT';
@@ -209,8 +212,8 @@ ${JSON.stringify(result.transaction, null, 2)}
209
212
  **Next Steps:**
210
213
  1. ${!tx.payerAccount ? 'Transaction waiting for payer to process' : 'Transaction processed, waiting for finalization'}
211
214
  2. ${tx.timeToLive && parseInt(tx.timeToLive) < 60 ? '⚠️ Transaction expires soon!' : 'Monitor remaining TTL'}
212
- 3. Use \`payware_pi_process_transaction\` if you need to process this transaction
213
- 4. Use \`payware_pi_finalize_transaction\` to confirm/decline after processing
215
+ 3. Use \`payware_operations_process_transaction\` if you need to process this transaction
216
+ 4. Use \`payware_operations_finalize_transaction\` to confirm/decline after processing
214
217
 
215
218
  **⚠️ Transaction State:**
216
219
  - This is an **active** transaction
@@ -240,18 +243,18 @@ ${JSON.stringify(result.error.details || result.error, null, 2)}
240
243
 
241
244
  **Common Issues:**
242
245
  1. **ERR_MISSING_TRANSACTION (404)**: Transaction not found, expired, or already completed
243
- 2. **Invalid Transaction ID**: Check transaction ID format (10 chars: 'pw'/'pr'/'ps' + 8 chars)
246
+ 2. **Invalid Transaction ID**: Check transaction ID format (10 chars: 'pw'/'pr'/'pl'/'ps' + 8 chars)
244
247
  3. **Authentication Issues**: Verify JWT token and partner credentials
245
248
 
246
249
  **Troubleshooting:**
247
- 1. Verify transaction ID is correct: 10 characters total, starts with 'pw' (standard), 'pr' (product), or 'ps' (soundbite)
250
+ 1. Verify transaction ID is correct: 10 characters total, starts with 'pw' (standard), 'pr' (product), 'pl' (placement) or 'ps' (soundbite)
248
251
  2. Check if transaction has expired or been completed
249
- 3. Use \`payware_pi_get_transaction_history\` for completed/expired transactions
252
+ 3. Use \`payware_operations_get_transaction_history\` for completed/expired transactions
250
253
  4. Verify your partner credentials and API access
251
254
  5. Ensure transaction was created or you have access to it
252
255
 
253
256
  **Alternative Actions:**
254
- - If transaction is completed: Use \`payware_pi_get_transaction_history\`
257
+ - If transaction is completed: Use \`payware_operations_get_transaction_history\`
255
258
  - If transaction ID is wrong: Verify the correct transaction ID
256
259
  - If access issues: Check your payment institution credentials`
257
260
  }]
@@ -3,6 +3,7 @@ import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { createMinimizedJSON } from '../../core/utils/json-serializer.js';
4
4
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
5
5
  import { apiErrorResult } from '../../shared/api-errors.js';
6
+ import { COMMITS } from '../../shared/tool-annotations.js';
6
7
 
7
8
  /**
8
9
  * Process a transaction as a payment institution via payware API
@@ -112,6 +113,7 @@ export async function processPITransaction({
112
113
  */
113
114
  export const processPITransactionTool = {
114
115
  name: "payware_operations_process_transaction",
116
+ annotations: COMMITS,
115
117
  description: `Process a transaction as a payment institution. Payment institutions can process transactions created by others and must provide account/friendlyName details.
116
118
 
117
119
  **Use Cases:**
@@ -148,8 +150,8 @@ export const processPITransactionTool = {
148
150
  properties: {
149
151
  transactionId: {
150
152
  type: "string",
151
- description: "Transaction ID to process. Format: 2-char prefix + 8-char ID. Supports: 'pw' (standard), 'pr' (product), 'ps' (soundbite)",
152
- pattern: "^(pw|pr|ps)[0-9A-Za-z]{8}$"
153
+ description: "Transaction ID to process. Format: 2-char prefix + 8-char ID. Supports: 'pw' (standard), 'pr' (product), 'pl' (placement: pays as its product, and the payment is attributed to the placement), 'ps' (soundbite)",
154
+ pattern: "^(pw|pr|pl|ps)[0-9A-Za-z]{8}$"
153
155
  },
154
156
  account: {
155
157
  type: "string",
@@ -205,8 +207,7 @@ export const processPITransactionTool = {
205
207
  },
206
208
  privateKey: {
207
209
  type: "string",
208
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
209
- default: getPrivateKeySafe()
210
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
210
211
  },
211
212
  // Payment method for POI transactions
212
213
  paymentMethod: {
@@ -373,7 +374,7 @@ ${JSON.stringify(result.transaction, null, 2)}
373
374
  1. **TRANSACTION_PROCESSED** callback will be sent to counterparty
374
375
  2. Wait for callback notification to your URL (if provided)
375
376
  3. Monitor transaction status for completion
376
- 4. Use \`payware_pi_finalize_transaction\` to confirm/decline the transaction
377
+ 4. Use \`payware_operations_finalize_transaction\` to confirm/decline the transaction
377
378
  5. Handle final TRANSACTION_FINALIZED callbacks
378
379
 
379
380
  **⚠️ Important:**
@@ -412,7 +413,7 @@ ${JSON.stringify(result.error.details || result.error, null, 2)}
412
413
  7. **ERR_SPECIFYING_CURRENCY_NOT_ALLOWED**: Cannot change currency on merchant transactions
413
414
 
414
415
  **Troubleshooting:**
415
- 1. Verify transaction ID is correct: 10 characters total, starts with 'pw' (standard), 'pr' (product), or 'ps' (soundbite)
416
+ 1. Verify transaction ID is correct: 10 characters total, starts with 'pw' (standard), 'pr' (product), 'pl' (placement) or 'ps' (soundbite)
416
417
  2. Ensure account and friendlyName are provided
417
418
  3. Check currency matches original transaction currency
418
419
  4. Verify callback URL is provided (especially for payee role)