@payware/mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +92 -0
- package/MCP-SETUP.md +190 -0
- package/README.md +483 -0
- package/check-keys.js +52 -0
- package/keys/README.md +112 -0
- package/mcp-config.json +9 -0
- package/package.json +66 -0
- package/payware-mcp-config.json +12 -0
- package/src/auth/rsa-keys.js +82 -0
- package/src/auth/sandbox-setup.js +187 -0
- package/src/config/env.js +229 -0
- package/src/config/partner-types.js +143 -0
- package/src/core/auth/jwt-factory.js +182 -0
- package/src/core/auth/jwt-token.js +735 -0
- package/src/core/utils/json-serializer.js +100 -0
- package/src/core/utils/key-utils.js +133 -0
- package/src/index.js +237 -0
- package/src/isv/data/index.js +291 -0
- package/src/isv/deep-links/delete-product-link.js +154 -0
- package/src/isv/deep-links/delete-transaction-link.js +154 -0
- package/src/isv/deep-links/get-product-link.js +167 -0
- package/src/isv/deep-links/get-transaction-link.js +167 -0
- package/src/isv/deep-links/index.js +23 -0
- package/src/isv/index.js +103 -0
- package/src/isv/oauth2/create-token-simple.js +46 -0
- package/src/isv/oauth2/get-token-info.js +157 -0
- package/src/isv/oauth2/obtain-token.js +189 -0
- package/src/isv/oauth2/token-helper.js +151 -0
- package/src/isv/products/audios.js +470 -0
- package/src/isv/products/create-product.js +314 -0
- package/src/isv/products/delete-product.js +119 -0
- package/src/isv/products/get-product-image.js +247 -0
- package/src/isv/products/get-product.js +168 -0
- package/src/isv/products/index.js +65 -0
- package/src/isv/products/list-products.js +136 -0
- package/src/isv/products/schedules.js +522 -0
- package/src/isv/products/update-product.js +265 -0
- package/src/isv/transactions/cancel-transaction.js +129 -0
- package/src/isv/transactions/create-transaction.js +361 -0
- package/src/isv/transactions/get-status.js +217 -0
- package/src/isv/transactions/process-transaction.js +145 -0
- package/src/isv/transactions/simulate-callback.js +146 -0
- package/src/isv/transactions/transaction-history.js +186 -0
- package/src/isv/utils/auth.js +159 -0
- package/src/mcp-proxy.js +150 -0
- package/src/merchant/data/export-report.js +108 -0
- package/src/merchant/data/generate-report.js +151 -0
- package/src/merchant/data/get-report-status.js +120 -0
- package/src/merchant/data/index.js +351 -0
- package/src/merchant/deep-links/delete-product-link.js +121 -0
- package/src/merchant/deep-links/delete-transaction-link.js +121 -0
- package/src/merchant/deep-links/get-product-link.js +134 -0
- package/src/merchant/deep-links/get-transaction-link.js +134 -0
- package/src/merchant/deep-links/index.js +23 -0
- package/src/merchant/index.js +92 -0
- package/src/merchant/products/audios.js +606 -0
- package/src/merchant/products/create-product.js +288 -0
- package/src/merchant/products/delete-product.js +111 -0
- package/src/merchant/products/get-product-image.js +252 -0
- package/src/merchant/products/get-product.js +144 -0
- package/src/merchant/products/index.js +65 -0
- package/src/merchant/products/list-products.js +112 -0
- package/src/merchant/products/schedules.js +646 -0
- package/src/merchant/products/update-product.js +282 -0
- package/src/merchant/transactions/cancel-transaction.js +241 -0
- package/src/merchant/transactions/create-transaction.js +482 -0
- package/src/merchant/transactions/get-status.js +196 -0
- package/src/merchant/transactions/process-transaction.js +349 -0
- package/src/merchant/transactions/simulate-callback.js +246 -0
- package/src/merchant/transactions/transaction-history.js +258 -0
- package/src/payment-institution/data/index.js +280 -0
- package/src/payment-institution/deep-links/delete-transaction-link.js +128 -0
- package/src/payment-institution/deep-links/get-transaction-link.js +141 -0
- package/src/payment-institution/deep-links/index.js +17 -0
- package/src/payment-institution/index.js +92 -0
- package/src/payment-institution/transactions/create-pi-transaction.js +484 -0
- package/src/payment-institution/transactions/finalize-transaction.js +340 -0
- package/src/payment-institution/transactions/get-transaction-history.js +269 -0
- package/src/payment-institution/transactions/get-transaction-status.js +234 -0
- package/src/payment-institution/transactions/process-pi-transaction.js +421 -0
- package/src/payment-institution/transactions/simulate-pi-callback.js +326 -0
- package/src/payment-institution/transactions/soundbite-transaction.js +269 -0
- package/src/proxy-server.js +205 -0
- package/src/shared/data/data-api.js +372 -0
- package/src/shared/deep-links/api.js +214 -0
- package/src/shared/index.js +44 -0
- package/src/shared/products/products-api.js +872 -0
- package/src/tools/advanced-code-generator.js +2247 -0
- package/src/utils/code-examples/common/auth-examples.js +1482 -0
- package/src/utils/code-examples/common/helpers.js +416 -0
- package/src/utils/code-examples/common/utils-examples.js +591 -0
- package/src/utils/code-examples/frameworks/examples.js +859 -0
- package/src/utils/code-examples/index.js +441 -0
- package/src/utils/code-examples/isv/oauth2.js +600 -0
- package/src/utils/code-examples/isv/products.js +666 -0
- package/src/utils/code-examples/isv/transactions.js +813 -0
- package/src/utils/code-examples/merchant/products.js +497 -0
- package/src/utils/code-examples/merchant/transactions.js +623 -0
- package/src/utils/code-examples/payment-institution/transactions.js +388 -0
- package/src/utils/code-examples/shared/data.js +607 -0
- package/src/utils/code-examples/shared/deep-links.js +662 -0
- package/src/utils/code-examples/shared/soundbites.js +808 -0
- package/src/utils/code-examples.js +646 -0
- package/src/utils/format-request.js +363 -0
- package/src/utils/json-formatter.js +249 -0
- package/src/utils/server-info.js +132 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { getTransactionDeepLink } from '../../shared/deep-links/api.js';
|
|
2
|
+
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get deep link for a payment institution transaction
|
|
6
|
+
*/
|
|
7
|
+
export const getTransactionLinkTool = {
|
|
8
|
+
name: "payware_deep_links_get_transaction_link",
|
|
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
|
+
|
|
11
|
+
**Deep Link Format:**
|
|
12
|
+
- Web URL: https://url.payware.eu/{transactionId}
|
|
13
|
+
- Mobile Redirect: payware://{transactionId}
|
|
14
|
+
|
|
15
|
+
**Use Cases:**
|
|
16
|
+
- P2P payments initiated via messaging services
|
|
17
|
+
- Transaction notifications with direct links
|
|
18
|
+
- Transaction status sharing
|
|
19
|
+
|
|
20
|
+
**Important Notes:**
|
|
21
|
+
- Deep links are only supported in production environment
|
|
22
|
+
- Link expiration is synchronized with the referenced transaction
|
|
23
|
+
- Payment institutions only manage transaction links (no product links)
|
|
24
|
+
- Traditional deep links that route to app content when app is installed`,
|
|
25
|
+
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
transactionId: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "The transaction identifier (e.g., 'pw7e4rCToG')",
|
|
32
|
+
pattern: "^[a-zA-Z0-9]+$"
|
|
33
|
+
},
|
|
34
|
+
partnerId: {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Payment Institution Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default.",
|
|
37
|
+
default: getPartnerIdSafe()
|
|
38
|
+
},
|
|
39
|
+
privateKey: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
|
|
42
|
+
default: getPrivateKeySafe()
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
required: ["transactionId"]
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
async handler(args) {
|
|
49
|
+
const {
|
|
50
|
+
transactionId,
|
|
51
|
+
partnerId = getPartnerIdSafe(),
|
|
52
|
+
privateKey = getPrivateKeySafe()
|
|
53
|
+
} = args;
|
|
54
|
+
|
|
55
|
+
if (!transactionId) {
|
|
56
|
+
throw new Error("transactionId is required");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!partnerId) {
|
|
60
|
+
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!privateKey) {
|
|
64
|
+
throw new Error("Private key is required. Provide via 'privateKey' parameter or set PAYWARE_PRIVATE_KEY environment variable.");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const result = await getTransactionDeepLink({
|
|
69
|
+
transactionId,
|
|
70
|
+
partnerType: 'payment_institution',
|
|
71
|
+
partnerId,
|
|
72
|
+
privateKey
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Extract the URL - API returns either string directly or object with link property
|
|
76
|
+
const linkUrl = typeof result.data === 'string' ? result.data : (result.data.link || result.data)
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
content: [{
|
|
80
|
+
type: "text",
|
|
81
|
+
text: `🔗 **Transaction Deep Link Retrieved (Payment Institution)**
|
|
82
|
+
|
|
83
|
+
**Deep Link Details:**
|
|
84
|
+
- Transaction ID: ${transactionId}
|
|
85
|
+
- Web URL: ${linkUrl}
|
|
86
|
+
- Mobile Redirect: payware://${transactionId}
|
|
87
|
+
|
|
88
|
+
**Payment Institution Info:**
|
|
89
|
+
- Partner ID: ${partnerId}
|
|
90
|
+
- Role: SRC/DST for P2P transactions
|
|
91
|
+
|
|
92
|
+
**Link Information:**
|
|
93
|
+
- Status: Active
|
|
94
|
+
- Expiration: Synchronized with transaction
|
|
95
|
+
- Platform: Production only
|
|
96
|
+
|
|
97
|
+
**API Response:**
|
|
98
|
+
\`\`\`json
|
|
99
|
+
${JSON.stringify(result.data, null, 2)}
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
**API Call Details:**
|
|
103
|
+
- Endpoint: GET ${result.requestInfo.url}
|
|
104
|
+
- Status: ${result.requestInfo.statusCode}
|
|
105
|
+
- Method: ${result.requestInfo.method}
|
|
106
|
+
|
|
107
|
+
**Usage:**
|
|
108
|
+
1. Share the web URL: \`${linkUrl}\`
|
|
109
|
+
2. On mobile devices, it will redirect to: \`payware://${transactionId}\`
|
|
110
|
+
3. Link expires when the transaction expires
|
|
111
|
+
4. Use for P2P transaction notifications and sharing`
|
|
112
|
+
}]
|
|
113
|
+
};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
return {
|
|
116
|
+
content: [{
|
|
117
|
+
type: "text",
|
|
118
|
+
text: `❌ **Failed to Get Transaction Deep Link (Payment Institution)**
|
|
119
|
+
|
|
120
|
+
**Error Details:**
|
|
121
|
+
- Transaction ID: ${transactionId}
|
|
122
|
+
- Message: ${error.message}
|
|
123
|
+
|
|
124
|
+
**Common Issues:**
|
|
125
|
+
1. **Transaction not found**: Check if transaction exists and is not expired
|
|
126
|
+
2. **Authentication failed**: Verify partner ID and private key
|
|
127
|
+
3. **Authorization failed**: Ensure PI is SRC or DST for this transaction
|
|
128
|
+
4. **Sandbox environment**: Deep links are production-only
|
|
129
|
+
5. **Invalid transaction ID**: Ensure transaction ID format is correct
|
|
130
|
+
|
|
131
|
+
**Troubleshooting:**
|
|
132
|
+
1. Verify transaction exists using \`payware_transactions_get_transaction_status\`
|
|
133
|
+
2. Check if running in production environment
|
|
134
|
+
3. Ensure JWT authentication is working
|
|
135
|
+
4. Confirm payment institution role in transaction
|
|
136
|
+
5. Verify transaction is not expired`
|
|
137
|
+
}]
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment Institution Deep Links Tools
|
|
3
|
+
* Deep link management for payment institutions (transaction links only)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { getTransactionLinkTool } from './get-transaction-link.js';
|
|
7
|
+
import { deleteTransactionLinkTool } from './delete-transaction-link.js';
|
|
8
|
+
|
|
9
|
+
export const paymentInstitutionDeepLinksTools = [
|
|
10
|
+
getTransactionLinkTool,
|
|
11
|
+
deleteTransactionLinkTool
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
getTransactionLinkTool,
|
|
16
|
+
deleteTransactionLinkTool
|
|
17
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment Institution partner tools registry
|
|
3
|
+
* Tools available for banks, e-wallets, and financial institutions
|
|
4
|
+
*
|
|
5
|
+
* Features specific to Payment Institutions:
|
|
6
|
+
* - Role-based transactions (SRC/DST)
|
|
7
|
+
* - Account and friendlyName requirements
|
|
8
|
+
* - Transaction processing and finalization
|
|
9
|
+
* - P2P cross-institution payments
|
|
10
|
+
* - Extended TTL ranges (up to 30 days)
|
|
11
|
+
* - Soundbite transaction support
|
|
12
|
+
* - Transaction history access
|
|
13
|
+
* - Callback handling (TRANSACTION_PROCESSED, TRANSACTION_FINALIZED)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// Import payment institution specific transaction tools
|
|
17
|
+
import { createPITransactionTool } from './transactions/create-pi-transaction.js';
|
|
18
|
+
import { processPITransactionTool } from './transactions/process-pi-transaction.js';
|
|
19
|
+
import { finalizeTransactionTool } from './transactions/finalize-transaction.js';
|
|
20
|
+
import { getPITransactionStatusTool } from './transactions/get-transaction-status.js';
|
|
21
|
+
import { getPITransactionHistoryTool } from './transactions/get-transaction-history.js';
|
|
22
|
+
import { soundbiteTransactionTool } from './transactions/soundbite-transaction.js';
|
|
23
|
+
import { simulatePICallbackTool } from './transactions/simulate-pi-callback.js';
|
|
24
|
+
|
|
25
|
+
// Data tools
|
|
26
|
+
import { paymentInstitutionDataTools } from './data/index.js';
|
|
27
|
+
|
|
28
|
+
// Deep links tools
|
|
29
|
+
import { paymentInstitutionDeepLinksTools } from './deep-links/index.js';
|
|
30
|
+
|
|
31
|
+
// Import shared tools
|
|
32
|
+
import { sharedTools } from '../shared/index.js';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Payment Institution specific tools
|
|
36
|
+
* Includes role-based transactions, P2P flows, and PI-specific operations
|
|
37
|
+
*/
|
|
38
|
+
export const paymentInstitutionTools = [
|
|
39
|
+
// Shared tools (authentication, utilities, etc.)
|
|
40
|
+
...sharedTools,
|
|
41
|
+
|
|
42
|
+
// PI-specific transaction tools
|
|
43
|
+
createPITransactionTool,
|
|
44
|
+
processPITransactionTool,
|
|
45
|
+
finalizeTransactionTool,
|
|
46
|
+
getPITransactionStatusTool,
|
|
47
|
+
getPITransactionHistoryTool,
|
|
48
|
+
soundbiteTransactionTool,
|
|
49
|
+
simulatePICallbackTool,
|
|
50
|
+
|
|
51
|
+
// Data management
|
|
52
|
+
...paymentInstitutionDataTools,
|
|
53
|
+
|
|
54
|
+
// Deep links management
|
|
55
|
+
...paymentInstitutionDeepLinksTools
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get tools for Payment Institution partner type with proper grouping
|
|
60
|
+
* @returns {Array} Array of Payment Institution tools with grouped names
|
|
61
|
+
*/
|
|
62
|
+
export function getPaymentInstitutionTools() {
|
|
63
|
+
return paymentInstitutionTools.map(tool => {
|
|
64
|
+
let newName = tool.name;
|
|
65
|
+
|
|
66
|
+
// Authentication tools use authentication grouping
|
|
67
|
+
if (tool.name.startsWith('payware_authentication_')) {
|
|
68
|
+
newName = tool.name; // Keep authentication grouping
|
|
69
|
+
}
|
|
70
|
+
// Utility tools keep their utils grouping
|
|
71
|
+
else if (tool.name.startsWith('payware_utils_')) {
|
|
72
|
+
newName = tool.name; // Keep utils grouping
|
|
73
|
+
}
|
|
74
|
+
// Operations tools (PI-specific transaction operations) keep operations grouping
|
|
75
|
+
else if (tool.name.startsWith('payware_operations_')) {
|
|
76
|
+
newName = tool.name; // Keep operations grouping
|
|
77
|
+
}
|
|
78
|
+
// Data tools keep their data grouping
|
|
79
|
+
else if (tool.name.startsWith('payware_data_')) {
|
|
80
|
+
newName = tool.name; // Keep data grouping
|
|
81
|
+
}
|
|
82
|
+
// Deep links tools keep their deep_links grouping
|
|
83
|
+
else if (tool.name.startsWith('payware_deep_links_')) {
|
|
84
|
+
newName = tool.name; // Keep deep_links grouping
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
...tool,
|
|
89
|
+
name: newName
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|