@payware/mcp-server 1.3.3 → 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.
- package/.env.example +4 -0
- package/README.md +18 -0
- package/package.json +7 -9
- package/src/auth/rsa-keys.js +12 -6
- package/src/auth/sandbox-setup.js +2 -0
- package/src/config/toolsets.js +104 -0
- package/src/core/auth/jwt-factory.js +4 -1
- package/src/core/auth/jwt-token.js +4 -0
- package/src/index.js +10 -6
- package/src/isv/data/index.js +15 -14
- package/src/isv/deep-links/delete-product-link.js +3 -2
- package/src/isv/deep-links/delete-transaction-link.js +3 -2
- package/src/isv/deep-links/get-product-link.js +8 -6
- package/src/isv/deep-links/get-transaction-link.js +8 -6
- package/src/isv/index.js +6 -0
- package/src/isv/invitations/index.js +5 -0
- package/src/isv/oauth2/get-token-info.js +3 -0
- package/src/isv/oauth2/obtain-token.js +3 -0
- package/src/isv/oauth2/token-helper.js +2 -0
- package/src/isv/poi/cancel-price.js +2 -0
- package/src/isv/poi/get-poi.js +2 -0
- package/src/isv/poi/get-qrcode.js +40 -9
- package/src/isv/poi/get-status.js +2 -0
- package/src/isv/poi/list-pois.js +2 -0
- package/src/isv/poi/set-price.js +2 -0
- package/src/isv/products/audios.js +8 -2
- package/src/isv/products/create-product.js +2 -0
- package/src/isv/products/delete-product.js +2 -0
- package/src/isv/products/get-product-image.js +2 -0
- package/src/isv/products/get-product.js +2 -0
- package/src/isv/products/list-products.js +2 -0
- package/src/isv/products/schedules.js +6 -0
- package/src/isv/products/update-product.js +2 -0
- package/src/isv/reference/index.js +2 -0
- package/src/isv/transactions/cancel-transaction.js +2 -0
- package/src/isv/transactions/create-transaction.js +2 -0
- package/src/isv/transactions/get-status.js +3 -1
- package/src/isv/transactions/process-transaction.js +2 -0
- package/src/isv/transactions/simulate-callback.js +2 -0
- package/src/isv/transactions/transaction-history.js +2 -0
- package/src/merchant/data/export-report.js +2 -0
- package/src/merchant/data/generate-report.js +2 -0
- package/src/merchant/data/get-export-list.js +2 -0
- package/src/merchant/data/get-report-requests.js +2 -0
- package/src/merchant/data/get-report-status.js +2 -0
- package/src/merchant/data/index.js +15 -10
- package/src/merchant/data/list-reports.js +2 -0
- package/src/merchant/deep-links/delete-product-link.js +3 -2
- package/src/merchant/deep-links/delete-transaction-link.js +3 -2
- package/src/merchant/deep-links/get-product-link.js +8 -6
- package/src/merchant/deep-links/get-transaction-link.js +8 -6
- package/src/merchant/index.js +7 -1
- package/src/merchant/logs/index.js +4 -0
- package/src/merchant/products/audios.js +15 -14
- package/src/merchant/products/create-product.js +3 -2
- package/src/merchant/products/delete-product.js +3 -2
- package/src/merchant/products/get-product-image.js +3 -2
- package/src/merchant/products/get-product.js +3 -2
- package/src/merchant/products/list-products.js +3 -2
- package/src/merchant/products/schedules.js +11 -10
- package/src/merchant/products/update-product.js +3 -2
- package/src/merchant/transactions/cancel-transaction.js +3 -2
- package/src/merchant/transactions/create-transaction.js +3 -1
- package/src/merchant/transactions/get-status.js +4 -3
- package/src/merchant/transactions/process-transaction.js +5 -4
- package/src/merchant/transactions/simulate-callback.js +3 -0
- package/src/merchant/transactions/transaction-history.js +5 -4
- package/src/payment-institution/data/index.js +15 -14
- package/src/payment-institution/deep-links/delete-transaction-link.js +3 -2
- package/src/payment-institution/deep-links/get-transaction-link.js +8 -6
- package/src/payment-institution/transactions/create-pi-transaction.js +4 -3
- package/src/payment-institution/transactions/finalize-transaction.js +6 -3
- package/src/payment-institution/transactions/get-transaction-history.js +7 -4
- package/src/payment-institution/transactions/get-transaction-status.js +15 -12
- package/src/payment-institution/transactions/process-pi-transaction.js +7 -6
- package/src/payment-institution/transactions/simulate-pi-callback.js +3 -0
- package/src/payment-institution/transactions/soundbite-transaction.js +5 -4
- package/src/proxy-server.js +25 -0
- package/src/shared/placements/api.js +51 -0
- package/src/shared/placements/tools.js +519 -0
- package/src/shared/poi/poi-create-api.js +3 -0
- package/src/shared/products/products-api.js +36 -25
- package/src/shared/shops/shops-api.js +2 -0
- package/src/shared/tool-annotations.js +53 -0
- package/src/tools/advanced-code-generator.js +3 -0
- package/src/utils/format-request.js +2 -0
- package/src/utils/json-formatter.js +2 -0
- package/src/utils/server-info.js +2 -0
- package/src/utils/code-examples.js +0 -646
|
@@ -7,12 +7,14 @@ import {
|
|
|
7
7
|
} from '../../shared/products/products-api.js';
|
|
8
8
|
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
9
9
|
import { PRICE_CORRECTION_TYPES, CORRECTION_TYPES } from '../../shared/products/products-api.js';
|
|
10
|
+
import { CHANGES, CREATES, READS } from '../../shared/tool-annotations.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Create price schedule tool implementation for merchants
|
|
13
14
|
*/
|
|
14
15
|
export const createScheduleTool = {
|
|
15
16
|
name: "payware_products_create_schedule",
|
|
17
|
+
annotations: CREATES,
|
|
16
18
|
description: "Create a price schedule for a product to manage time-based pricing",
|
|
17
19
|
|
|
18
20
|
inputSchema: {
|
|
@@ -62,8 +64,7 @@ export const createScheduleTool = {
|
|
|
62
64
|
},
|
|
63
65
|
privateKey: {
|
|
64
66
|
type: "string",
|
|
65
|
-
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
66
|
-
default: getPrivateKeySafe()
|
|
67
|
+
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
67
68
|
},
|
|
68
69
|
useSandbox: {
|
|
69
70
|
type: "boolean",
|
|
@@ -174,6 +175,7 @@ ${JSON.stringify(schedule, null, 2)}
|
|
|
174
175
|
*/
|
|
175
176
|
export const getSchedulesTool = {
|
|
176
177
|
name: "payware_products_get_schedules",
|
|
178
|
+
annotations: READS,
|
|
177
179
|
description: "Get all price schedules for a product",
|
|
178
180
|
|
|
179
181
|
inputSchema: {
|
|
@@ -191,8 +193,7 @@ export const getSchedulesTool = {
|
|
|
191
193
|
},
|
|
192
194
|
privateKey: {
|
|
193
195
|
type: "string",
|
|
194
|
-
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
195
|
-
default: getPrivateKeySafe()
|
|
196
|
+
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
196
197
|
},
|
|
197
198
|
useSandbox: {
|
|
198
199
|
type: "boolean",
|
|
@@ -286,6 +287,7 @@ ${schedulesList}
|
|
|
286
287
|
*/
|
|
287
288
|
export const getScheduleTool = {
|
|
288
289
|
name: "payware_products_get_schedule",
|
|
290
|
+
annotations: READS,
|
|
289
291
|
description: "Get detailed information about a specific price schedule",
|
|
290
292
|
|
|
291
293
|
inputSchema: {
|
|
@@ -307,8 +309,7 @@ export const getScheduleTool = {
|
|
|
307
309
|
},
|
|
308
310
|
privateKey: {
|
|
309
311
|
type: "string",
|
|
310
|
-
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
311
|
-
default: getPrivateKeySafe()
|
|
312
|
+
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
312
313
|
},
|
|
313
314
|
useSandbox: {
|
|
314
315
|
type: "boolean",
|
|
@@ -399,6 +400,7 @@ ${JSON.stringify(schedule, null, 2)}
|
|
|
399
400
|
*/
|
|
400
401
|
export const updateScheduleTool = {
|
|
401
402
|
name: "payware_products_update_schedule",
|
|
403
|
+
annotations: CHANGES,
|
|
402
404
|
description: "Update an existing price schedule. Only provide fields you want to change.",
|
|
403
405
|
|
|
404
406
|
inputSchema: {
|
|
@@ -449,8 +451,7 @@ export const updateScheduleTool = {
|
|
|
449
451
|
},
|
|
450
452
|
privateKey: {
|
|
451
453
|
type: "string",
|
|
452
|
-
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
453
|
-
default: getPrivateKeySafe()
|
|
454
|
+
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
454
455
|
},
|
|
455
456
|
useSandbox: {
|
|
456
457
|
type: "boolean",
|
|
@@ -547,6 +548,7 @@ ${JSON.stringify(schedule, null, 2)}
|
|
|
547
548
|
*/
|
|
548
549
|
export const deleteScheduleTool = {
|
|
549
550
|
name: "payware_products_delete_schedule",
|
|
551
|
+
annotations: CHANGES,
|
|
550
552
|
description: "Delete a price schedule. This action cannot be undone.",
|
|
551
553
|
|
|
552
554
|
inputSchema: {
|
|
@@ -568,8 +570,7 @@ export const deleteScheduleTool = {
|
|
|
568
570
|
},
|
|
569
571
|
privateKey: {
|
|
570
572
|
type: "string",
|
|
571
|
-
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
572
|
-
default: getPrivateKeySafe()
|
|
573
|
+
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
573
574
|
},
|
|
574
575
|
useSandbox: {
|
|
575
576
|
type: "boolean",
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { updateProduct } from '../../shared/products/products-api.js';
|
|
2
2
|
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
3
3
|
import { PRODUCT_TYPES, OVERLAP_PRIORITY } from '../../shared/products/products-api.js';
|
|
4
|
+
import { CHANGES } from '../../shared/tool-annotations.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Update product tool implementation for merchants
|
|
7
8
|
*/
|
|
8
9
|
export const updateProductTool = {
|
|
9
10
|
name: "payware_products_update_product",
|
|
11
|
+
annotations: CHANGES,
|
|
10
12
|
description: `Update an existing product. Only provide the fields you want to change.
|
|
11
13
|
|
|
12
14
|
**Product Structure:**
|
|
@@ -128,8 +130,7 @@ export const updateProductTool = {
|
|
|
128
130
|
},
|
|
129
131
|
privateKey: {
|
|
130
132
|
type: "string",
|
|
131
|
-
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
132
|
-
default: getPrivateKeySafe()
|
|
133
|
+
description: "RSA private key for authentication (uses environment-specific private key as default)"
|
|
133
134
|
},
|
|
134
135
|
useSandbox: {
|
|
135
136
|
type: "boolean",
|
|
@@ -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 { CHANGES } from '../../shared/tool-annotations.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Cancel a transaction via payware API
|
|
@@ -76,6 +77,7 @@ export async function cancelTransaction({
|
|
|
76
77
|
*/
|
|
77
78
|
export const cancelTransactionTool = {
|
|
78
79
|
name: "payware_operations_cancel_transaction",
|
|
80
|
+
annotations: CHANGES,
|
|
79
81
|
description: "Cancel an ACTIVE transaction created by this merchant. Only the merchant who created the transaction can cancel it, and only before it has been processed.",
|
|
80
82
|
inputSchema: {
|
|
81
83
|
type: "object",
|
|
@@ -104,8 +106,7 @@ export const cancelTransactionTool = {
|
|
|
104
106
|
},
|
|
105
107
|
privateKey: {
|
|
106
108
|
type: "string",
|
|
107
|
-
description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
|
|
108
|
-
default: getPrivateKeySafe()
|
|
109
|
+
description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
|
|
109
110
|
},
|
|
110
111
|
useSandbox: {
|
|
111
112
|
type: "boolean",
|
|
@@ -2,6 +2,7 @@ import axios from 'axios';
|
|
|
2
2
|
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
|
+
import { CREATES } from '../../shared/tool-annotations.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Create a transaction via payware API
|
|
@@ -196,6 +197,7 @@ Original error: ${enhancedMessage}`;
|
|
|
196
197
|
*/
|
|
197
198
|
export const createTransactionTool = {
|
|
198
199
|
name: "payware_operations_create_transaction",
|
|
200
|
+
annotations: CREATES,
|
|
199
201
|
description: `Create a new payware transaction. Parameters map to the following API structure:
|
|
200
202
|
|
|
201
203
|
📋 **ROOT LEVEL** (Transaction metadata):
|
|
@@ -524,7 +526,7 @@ ${JSON.stringify(result.transaction, null, 2)}
|
|
|
524
526
|
|
|
525
527
|
**Next Steps:**
|
|
526
528
|
1. Save the transaction ID: \`${result.transaction.transactionId || 'N/A'}\`
|
|
527
|
-
2. Use \`
|
|
529
|
+
2. Use \`payware_operations_get_transaction_status\` to check status
|
|
528
530
|
3. Wait for callback notification (if callback URL provided)
|
|
529
531
|
4. Process payment through payware interface`
|
|
530
532
|
}]
|
|
@@ -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 from payware API
|
|
@@ -67,11 +68,12 @@ function formatTransactionStatus(transaction) {
|
|
|
67
68
|
*/
|
|
68
69
|
export const getTransactionStatusTool = {
|
|
69
70
|
name: "payware_operations_get_transaction_status",
|
|
71
|
+
annotations: READS,
|
|
70
72
|
description: `Get status of an ACTIVE transaction by ID (for completed/expired transactions use transaction history tool).
|
|
71
73
|
|
|
72
74
|
**Endpoint:** GET /transactions/{transactionId}
|
|
73
75
|
**Use Case:** Check status of ACTIVE transactions only. This endpoint only returns transactions with ACTIVE status.
|
|
74
|
-
**Note:** For transactions with final statuses (CONFIRMED, DECLINED, FAILED, EXPIRED, CANCELLED), use '
|
|
76
|
+
**Note:** For transactions with final statuses (CONFIRMED, DECLINED, FAILED, EXPIRED, CANCELLED), use 'payware_operations_get_transaction_history' instead.
|
|
75
77
|
|
|
76
78
|
🛍️ **Product-originated transactions carry a nested \`product\` object.** Since 2026-07-22 the
|
|
77
79
|
presentation fields are grouped under \`product\` rather than sitting flat on the response - the old
|
|
@@ -123,8 +125,7 @@ with ERR_FEE_MISMATCH. Echo \`fee\` back unchanged instead.`,
|
|
|
123
125
|
},
|
|
124
126
|
privateKey: {
|
|
125
127
|
type: "string",
|
|
126
|
-
description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
|
|
127
|
-
default: getPrivateKeySafe()
|
|
128
|
+
description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
|
|
128
129
|
},
|
|
129
130
|
useSandbox: {
|
|
130
131
|
type: "boolean",
|
|
@@ -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 via payware API (for merchants accepting payments)
|
|
@@ -107,6 +108,7 @@ export async function processTransaction({
|
|
|
107
108
|
*/
|
|
108
109
|
export const processTransactionTool = {
|
|
109
110
|
name: "payware_operations_process_transaction",
|
|
111
|
+
annotations: COMMITS,
|
|
110
112
|
description: `Process a PEER transaction (for merchants accepting payments by scanning customer QR/barcode).
|
|
111
113
|
|
|
112
114
|
**Use Case:** Merchant scans customer's payware QR code or barcode to accept payment.
|
|
@@ -138,8 +140,8 @@ export const processTransactionTool = {
|
|
|
138
140
|
properties: {
|
|
139
141
|
transactionId: {
|
|
140
142
|
type: "string",
|
|
141
|
-
description: "Transaction ID to process. Format: 2-char prefix + 8-char ID. Supports: 'pw' (standard), 'pr' (product), 'ps' (soundbite)",
|
|
142
|
-
pattern: "^(pw|pr|ps)[0-9A-Za-z]{8}$"
|
|
143
|
+
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)",
|
|
144
|
+
pattern: "^(pw|pr|pl|ps)[0-9A-Za-z]{8}$"
|
|
143
145
|
},
|
|
144
146
|
amount: {
|
|
145
147
|
type: ["number", "string"],
|
|
@@ -207,8 +209,7 @@ export const processTransactionTool = {
|
|
|
207
209
|
},
|
|
208
210
|
privateKey: {
|
|
209
211
|
type: "string",
|
|
210
|
-
description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
|
|
211
|
-
default: getPrivateKeySafe()
|
|
212
|
+
description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
|
|
212
213
|
},
|
|
213
214
|
useSandbox: {
|
|
214
215
|
type: "boolean",
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* @param {Object} options - Additional options
|
|
10
10
|
* @returns {Object} Mock callback payload
|
|
11
11
|
*/
|
|
12
|
+
import { LOCAL } from '../../shared/tool-annotations.js';
|
|
13
|
+
|
|
12
14
|
export function generateMockCallback(transactionId, status = 'CONFIRMED', options = {}) {
|
|
13
15
|
const {
|
|
14
16
|
amount = '57.60',
|
|
@@ -137,6 +139,7 @@ export async function simulateCallbackDelivery(callbackUrl, payload) {
|
|
|
137
139
|
*/
|
|
138
140
|
export const simulateCallbackTool = {
|
|
139
141
|
name: "payware_operations_simulate_callback",
|
|
142
|
+
annotations: LOCAL,
|
|
140
143
|
description: `Simulate callback scenarios for testing webhook handling.
|
|
141
144
|
|
|
142
145
|
Generates the payload a merchant's \`callbackUrl\` actually receives, so a handler can be built and
|
|
@@ -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 '
|
|
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",
|
|
@@ -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 '
|
|
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
|
|
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
|
|
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
|
|
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 \`
|
|
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 \`
|
|
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 \`
|
|
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,6 +125,8 @@ 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;
|
|
@@ -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 \`
|
|
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 \`
|
|
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
|
}]
|