@payware/mcp-server 1.2.0 → 1.3.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/README.md +5 -0
- package/package.json +69 -66
- package/src/auth/sandbox-setup.js +186 -186
- package/src/isv/index.js +29 -1
- package/src/isv/invitations/index.js +471 -0
- package/src/isv/oauth2/obtain-token.js +19 -8
- package/src/isv/oauth2/token-helper.js +5 -2
- package/src/isv/poi/cancel-price.js +2 -10
- package/src/isv/poi/create.js +19 -0
- package/src/isv/poi/get-poi.js +2 -10
- package/src/isv/poi/get-qrcode.js +2 -10
- package/src/isv/poi/get-status.js +2 -10
- package/src/isv/poi/index.js +5 -0
- package/src/isv/poi/list-pois.js +2 -10
- package/src/isv/poi/set-price.js +217 -225
- package/src/isv/products/create-product.js +313 -313
- package/src/isv/products/update-product.js +264 -264
- package/src/isv/reference/index.js +249 -0
- package/src/isv/shops/index.js +22 -0
- package/src/isv/transactions/cancel-transaction.js +41 -10
- package/src/isv/transactions/create-transaction.js +20 -4
- package/src/isv/transactions/get-status.js +18 -11
- package/src/isv/transactions/process-transaction.js +160 -42
- package/src/isv/transactions/simulate-callback.js +128 -109
- package/src/isv/transactions/transaction-history.js +86 -90
- package/src/merchant/data/generate-report.js +19 -1
- package/src/merchant/index.js +21 -1
- package/src/merchant/logs/index.js +366 -0
- package/src/merchant/products/create-product.js +287 -287
- package/src/merchant/products/update-product.js +281 -281
- package/src/merchant/shops/index.js +18 -0
- package/src/merchant/transactions/cancel-transaction.js +10 -13
- package/src/merchant/transactions/create-transaction.js +88 -8
- package/src/merchant/transactions/get-status.js +40 -11
- package/src/merchant/transactions/process-transaction.js +2 -10
- package/src/merchant/transactions/simulate-callback.js +68 -9
- package/src/merchant/transactions/transaction-history.js +275 -257
- package/src/payment-institution/transactions/create-pi-transaction.js +2 -10
- package/src/payment-institution/transactions/finalize-transaction.js +333 -340
- package/src/payment-institution/transactions/get-transaction-history.js +2 -10
- package/src/payment-institution/transactions/get-transaction-status.js +38 -11
- package/src/payment-institution/transactions/process-pi-transaction.js +2 -10
- package/src/payment-institution/transactions/simulate-pi-callback.js +49 -9
- package/src/payment-institution/transactions/soundbite-transaction.js +2 -10
- package/src/shared/api-errors.js +188 -0
- package/src/shared/auth-headers.js +62 -0
- package/src/shared/data/data-api.js +11 -10
- package/src/shared/deep-links/api.js +5 -4
- package/src/shared/logs/logs-api.js +242 -0
- package/src/shared/poi/poi-create-api.js +419 -0
- package/src/shared/products/products-api.js +17 -16
- package/src/shared/shops/shops-api.js +155 -0
- package/src/tools/advanced-code-generator.js +2255 -2246
- package/src/utils/code-examples/common/auth-examples.js +1484 -1481
- package/src/utils/code-examples/common/helpers.js +7 -4
- package/src/utils/code-examples/isv/oauth2.js +458 -600
- package/src/utils/code-examples/isv/transactions.js +815 -812
- package/MCP-SETUP.md +0 -190
package/README.md
CHANGED
|
@@ -38,6 +38,11 @@ Official MCP (Model Context Protocol) server for payware payment API integration
|
|
|
38
38
|
- **Get QR Code**: Generate QR code for POI payments
|
|
39
39
|
- **List POIs**: List all POIs for a merchant
|
|
40
40
|
|
|
41
|
+
### 📋 Logs Tools (Premium)
|
|
42
|
+
- **Query Logs**: Search and filter application logs by level, logger, message content, and date range
|
|
43
|
+
- **Log Status**: Check log availability and storage information
|
|
44
|
+
- **Download Logs**: Get compressed archive of logs for offline analysis
|
|
45
|
+
|
|
41
46
|
### 🛠️ Utility Tools
|
|
42
47
|
- **Advanced Code Generation**: Generate complete integration code across 8 languages (Python, Node.js, PHP, Java, C#, Go, Ruby, cURL) with 16+ framework support
|
|
43
48
|
- **Framework Integration**: Framework-specific examples for Django, FastAPI, Express, NestJS, Laravel, Spring Boot, ASP.NET, and more
|
package/package.json
CHANGED
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@payware/mcp-server",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Official MCP server for payware payment API integration",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"payware-mcp": "
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"start": "node src/index.js",
|
|
12
|
-
"dev": "node --watch src/index.js",
|
|
13
|
-
"proxy": "node src/proxy-server.js",
|
|
14
|
-
"proxy:dev": "node --watch src/proxy-server.js",
|
|
15
|
-
"bridge": "node src/mcp-proxy.js",
|
|
16
|
-
"inspector": "npx @modelcontextprotocol/inspector node src/mcp-proxy.js"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"node": "
|
|
30
|
-
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"url": "https://github.com/payware/mcp-server
|
|
54
|
-
},
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
".
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@payware/mcp-server",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Official MCP server for payware payment API integration",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"payware-mcp": "src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node src/index.js",
|
|
12
|
+
"dev": "node --watch src/index.js",
|
|
13
|
+
"proxy": "node src/proxy-server.js",
|
|
14
|
+
"proxy:dev": "node --watch src/proxy-server.js",
|
|
15
|
+
"bridge": "node src/mcp-proxy.js",
|
|
16
|
+
"inspector": "npx @modelcontextprotocol/inspector node src/mcp-proxy.js",
|
|
17
|
+
"test": "node --test tests/api-errors.test.js tests/json-serializer.test.js tests/request-contract.test.js tests/tool-contract.test.js",
|
|
18
|
+
"test:watch": "node --test --watch tests/api-errors.test.js tests/json-serializer.test.js tests/request-contract.test.js tests/tool-contract.test.js",
|
|
19
|
+
"check": "node --check src/index.js && npm test"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@modelcontextprotocol/sdk": "^0.5.0",
|
|
23
|
+
"axios": "^1.6.0",
|
|
24
|
+
"cors": "^2.8.5",
|
|
25
|
+
"dotenv": "^17.2.2",
|
|
26
|
+
"express": "^5.1.0",
|
|
27
|
+
"http-proxy-middleware": "^3.0.5",
|
|
28
|
+
"jsonwebtoken": "^9.0.0",
|
|
29
|
+
"node-forge": "^1.3.1"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.0.0"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"mcp",
|
|
36
|
+
"model-context-protocol",
|
|
37
|
+
"payware",
|
|
38
|
+
"payments",
|
|
39
|
+
"payment-gateway",
|
|
40
|
+
"payment-processing",
|
|
41
|
+
"api",
|
|
42
|
+
"fintech",
|
|
43
|
+
"pos",
|
|
44
|
+
"terminal",
|
|
45
|
+
"merchant",
|
|
46
|
+
"isv",
|
|
47
|
+
"oauth2"
|
|
48
|
+
],
|
|
49
|
+
"author": "payware <support@payware.com>",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/payware/mcp-server.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/payware/mcp-server/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/payware/mcp-server#readme",
|
|
59
|
+
"files": [
|
|
60
|
+
"src/",
|
|
61
|
+
"keys/README.md",
|
|
62
|
+
"README.md",
|
|
63
|
+
"check-keys.js",
|
|
64
|
+
"mcp-config.json",
|
|
65
|
+
"payware-mcp-config.json",
|
|
66
|
+
".env.example",
|
|
67
|
+
"MCP-SETUP.md"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Setup sandbox authentication configuration
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { getPartnerIdSafe, getPrivateKeySafe } from '../config/env.js';
|
|
6
|
-
|
|
7
|
-
const SANDBOX_CONFIG = {
|
|
8
|
-
baseUrl: 'https://sandbox.payware.eu/api',
|
|
9
|
-
apiVersion: '1',
|
|
10
|
-
environment: 'sandbox',
|
|
11
|
-
supportedCurrencies: [
|
|
12
|
-
// Major currencies
|
|
13
|
-
'EUR', 'USD', 'GBP', 'JPY', 'CHF', 'CAD', 'AUD', 'CNY', 'SEK', 'NOK', 'DKK',
|
|
14
|
-
// All other supported currencies (100+ total)
|
|
15
|
-
'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AWG', 'AZN',
|
|
16
|
-
'BAM', 'BBD', 'BDT', '
|
|
17
|
-
'CDF', 'CLP', 'COP', 'CRC', 'CUP', 'CVE', 'CZK',
|
|
18
|
-
'DJF', 'DOP', 'DZD',
|
|
19
|
-
'EGP', 'ERN', 'ETB',
|
|
20
|
-
'FJD', 'FKP',
|
|
21
|
-
'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD',
|
|
22
|
-
'HKD', 'HNL', 'HRK', 'HTG', 'HUF',
|
|
23
|
-
'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK',
|
|
24
|
-
'JMD', 'JOD',
|
|
25
|
-
'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT',
|
|
26
|
-
'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LYD',
|
|
27
|
-
'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZN',
|
|
28
|
-
'NAD', 'NGN', 'NIO', 'NPR', 'NZD',
|
|
29
|
-
'OMR',
|
|
30
|
-
'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG',
|
|
31
|
-
'QAR',
|
|
32
|
-
'RON', 'RSD', 'RUB', 'RWF',
|
|
33
|
-
'SAR', 'SBD', 'SCR', 'SDG', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'STD', 'SVC', 'SYP', 'SZL',
|
|
34
|
-
'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS',
|
|
35
|
-
'UAH', 'UGX', 'UYU', 'UZS',
|
|
36
|
-
'VND', 'VUV',
|
|
37
|
-
'WST',
|
|
38
|
-
'XAF', 'XCD', 'XOF', 'XPF',
|
|
39
|
-
'YER',
|
|
40
|
-
'ZAR', 'ZMW', 'ZWL'
|
|
41
|
-
], // ISO 3-character codes
|
|
42
|
-
supportedTransactionTypes: ['PLAIN', 'QR', 'BARCODE'], // trOptions.type values
|
|
43
|
-
transactionTypes: ['DEFAULT', 'SHIPPABLE'], // transactionType values
|
|
44
|
-
maxAmount: 'Unlimited', // Limited by Java type implementation
|
|
45
|
-
minAmount: '0.00', // Zero allowed for flexible amounts
|
|
46
|
-
maxTTL: 600, // seconds
|
|
47
|
-
minTTL: 60, // seconds
|
|
48
|
-
defaultTTL: 120, // seconds
|
|
49
|
-
audience: 'https://payware.eu', // Required JWT audience
|
|
50
|
-
transactionIdPrefix: 'pw' // All transaction IDs start with 'pw'
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Generate sandbox configuration
|
|
55
|
-
* @param {string} partnerId - Partner ID
|
|
56
|
-
* @param {string} privateKey - Private key (optional, for validation)
|
|
57
|
-
* @returns {Object} Sandbox configuration object
|
|
58
|
-
*/
|
|
59
|
-
export function generateSandboxConfig(partnerId, privateKey = null) {
|
|
60
|
-
const config = {
|
|
61
|
-
...SANDBOX_CONFIG,
|
|
62
|
-
partnerId,
|
|
63
|
-
endpoints: {
|
|
64
|
-
createTransaction: `${SANDBOX_CONFIG.baseUrl}/transactions`,
|
|
65
|
-
getTransactionStatus: `${SANDBOX_CONFIG.baseUrl}/transactions/{id}`,
|
|
66
|
-
processTransaction: `${SANDBOX_CONFIG.baseUrl}/transactions/{id}`,
|
|
67
|
-
cancelTransaction: `${SANDBOX_CONFIG.baseUrl}/transactions/{id}`,
|
|
68
|
-
getTransactionHistory: `${SANDBOX_CONFIG.baseUrl}/transactions-history/{id}`,
|
|
69
|
-
callback: 'https://your-callback-url' // Provided by merchant
|
|
70
|
-
},
|
|
71
|
-
headers: {
|
|
72
|
-
'Content-Type': 'application/json',
|
|
73
|
-
'Api-Version': '1'
|
|
74
|
-
},
|
|
75
|
-
authentication: {
|
|
76
|
-
type: 'JWT',
|
|
77
|
-
algorithm: 'RS256',
|
|
78
|
-
audience: 'https://payware.eu',
|
|
79
|
-
requiresContentMd5: 'For POST/PUT/PATCH requests',
|
|
80
|
-
hasPrivateKey: !!privateKey
|
|
81
|
-
},
|
|
82
|
-
generatedAt: new Date().toISOString()
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return config;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Setup sandbox auth tool implementation
|
|
90
|
-
*/
|
|
91
|
-
export const setupSandboxAuthTool = {
|
|
92
|
-
name: "payware_authentication_setup_sandbox_auth",
|
|
93
|
-
description: "Setup sandbox authentication configuration for payware API",
|
|
94
|
-
inputSchema: {
|
|
95
|
-
type: "object",
|
|
96
|
-
properties: {
|
|
97
|
-
partnerId: {
|
|
98
|
-
type: "string",
|
|
99
|
-
description: "Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default."
|
|
100
|
-
},
|
|
101
|
-
privateKey: {
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "RSA private key in PEM format (optional, for validation). Uses environment-specific private key as default."
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
additionalProperties: false
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
async handler(args) {
|
|
110
|
-
const {
|
|
111
|
-
partnerId = getPartnerIdSafe(),
|
|
112
|
-
privateKey = getPrivateKeySafe()
|
|
113
|
-
} = args;
|
|
114
|
-
|
|
115
|
-
if (!partnerId) {
|
|
116
|
-
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const config = generateSandboxConfig(partnerId, privateKey);
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
content: [{
|
|
123
|
-
type: "text",
|
|
124
|
-
text: `🔧 **Sandbox Authentication Setup Complete**
|
|
125
|
-
|
|
126
|
-
**Configuration:**
|
|
127
|
-
\`\`\`json
|
|
128
|
-
${JSON.stringify(config, null, 2)}
|
|
129
|
-
\`\`\`
|
|
130
|
-
|
|
131
|
-
**Environment Details:**
|
|
132
|
-
- Base URL: ${config.baseUrl}
|
|
133
|
-
- API Version: ${config.apiVersion}
|
|
134
|
-
- Environment: ${config.environment}
|
|
135
|
-
- Partner ID: ${config.partnerId}
|
|
136
|
-
|
|
137
|
-
**Supported Features:**
|
|
138
|
-
- Request Types (trOptions.type): ${config.supportedTransactionTypes.join(', ')}
|
|
139
|
-
- Transaction Types: ${config.transactionTypes.join(', ')}
|
|
140
|
-
- Currencies: ${config.supportedCurrencies.join(', ')} (ISO 3-char codes)
|
|
141
|
-
- Amount Range: €${config.minAmount} - ${config.maxAmount} (currency values)
|
|
142
|
-
- TTL Range: ${config.minTTL}-${config.maxTTL} seconds (default: ${config.defaultTTL})
|
|
143
|
-
- Transaction ID Format: Starts with '${config.transactionIdPrefix}'
|
|
144
|
-
- QR Options: Format (PNG/JPEG/SVG), Border, Error Correction (L/M/Q/H), Scale, Version
|
|
145
|
-
- Barcode Options: Format (CODE128/CODE39/EAN13), Width, Height, Font Size, Text Location
|
|
146
|
-
- Additional: passbackParams for custom callback data
|
|
147
|
-
|
|
148
|
-
**API Endpoints:**
|
|
149
|
-
- Create Transaction: \`POST ${config.endpoints.createTransaction}\`
|
|
150
|
-
- Get Transaction Status: \`GET ${config.endpoints.getTransactionStatus}\`
|
|
151
|
-
- Process Transaction: \`POST ${config.endpoints.processTransaction}\` (merchants only)
|
|
152
|
-
- Cancel Transaction: \`PATCH ${config.endpoints.cancelTransaction}\` (creators only)
|
|
153
|
-
- Transaction History: \`GET ${config.endpoints.getTransactionHistory}\` (completed/expired)
|
|
154
|
-
- Callback Endpoint: \`POST [your-callback-url]\` (configured by you)
|
|
155
|
-
|
|
156
|
-
**Required Headers (All Requests):**
|
|
157
|
-
${Object.entries(config.headers).map(([key, value]) => `- ${key}: ${value}`).join('\n')}
|
|
158
|
-
- Authorization: Bearer {JWT_TOKEN} (with contentSha256 for POST/PATCH)
|
|
159
|
-
|
|
160
|
-
**JWT Requirements:**
|
|
161
|
-
- Algorithm: RS256
|
|
162
|
-
- Issuer (iss): Your Partner ID
|
|
163
|
-
- Audience (aud): https://payware.eu
|
|
164
|
-
- Content-SHA256: Required in JWT header for POST/PATCH requests
|
|
165
|
-
- Private Key: RSA 2048-bit minimum
|
|
166
|
-
|
|
167
|
-
**Required Fields for Transaction Creation:**
|
|
168
|
-
- trData.currency: ISO 3-character code (required)
|
|
169
|
-
- trData.reasonL1: Description, max 100 chars (required)
|
|
170
|
-
- trData.reasonL2: Continuation, max 100 chars (optional)
|
|
171
|
-
- trData.amount: Currency value as string/number, 0.00+ (optional for flexible)
|
|
172
|
-
- trOptions.type: PLAIN, QR, or BARCODE (default: PLAIN)
|
|
173
|
-
- trOptions.timeToLive: 60-600 seconds (default: 120)
|
|
174
|
-
|
|
175
|
-
**Next Steps:**
|
|
176
|
-
1. Generate RSA key pair (2048-bit minimum)
|
|
177
|
-
2. Register public key in payware portal
|
|
178
|
-
3. Create JWT token with proper structure
|
|
179
|
-
4. Test with create transaction endpoint
|
|
180
|
-
5. Implement callback handler for status updates
|
|
181
|
-
|
|
182
|
-
**⚠️ Sandbox Only:**
|
|
183
|
-
This configuration is for sandbox testing only. Do not use in production.`
|
|
184
|
-
}]
|
|
185
|
-
};
|
|
186
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Setup sandbox authentication configuration
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { getPartnerIdSafe, getPrivateKeySafe } from '../config/env.js';
|
|
6
|
+
|
|
7
|
+
const SANDBOX_CONFIG = {
|
|
8
|
+
baseUrl: 'https://sandbox.payware.eu/api',
|
|
9
|
+
apiVersion: '1',
|
|
10
|
+
environment: 'sandbox',
|
|
11
|
+
supportedCurrencies: [
|
|
12
|
+
// Major currencies
|
|
13
|
+
'EUR', 'USD', 'GBP', 'JPY', 'CHF', 'CAD', 'AUD', 'CNY', 'SEK', 'NOK', 'DKK',
|
|
14
|
+
// All other supported currencies (100+ total)
|
|
15
|
+
'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AWG', 'AZN',
|
|
16
|
+
'BAM', 'BBD', 'BDT', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTC', 'BTN', 'BWP', 'BYN', 'BZD',
|
|
17
|
+
'CDF', 'CLP', 'COP', 'CRC', 'CUP', 'CVE', 'CZK',
|
|
18
|
+
'DJF', 'DOP', 'DZD',
|
|
19
|
+
'EGP', 'ERN', 'ETB',
|
|
20
|
+
'FJD', 'FKP',
|
|
21
|
+
'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD',
|
|
22
|
+
'HKD', 'HNL', 'HRK', 'HTG', 'HUF',
|
|
23
|
+
'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK',
|
|
24
|
+
'JMD', 'JOD',
|
|
25
|
+
'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT',
|
|
26
|
+
'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LYD',
|
|
27
|
+
'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZN',
|
|
28
|
+
'NAD', 'NGN', 'NIO', 'NPR', 'NZD',
|
|
29
|
+
'OMR',
|
|
30
|
+
'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG',
|
|
31
|
+
'QAR',
|
|
32
|
+
'RON', 'RSD', 'RUB', 'RWF',
|
|
33
|
+
'SAR', 'SBD', 'SCR', 'SDG', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'STD', 'SVC', 'SYP', 'SZL',
|
|
34
|
+
'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS',
|
|
35
|
+
'UAH', 'UGX', 'UYU', 'UZS',
|
|
36
|
+
'VND', 'VUV',
|
|
37
|
+
'WST',
|
|
38
|
+
'XAF', 'XCD', 'XOF', 'XPF',
|
|
39
|
+
'YER',
|
|
40
|
+
'ZAR', 'ZMW', 'ZWL'
|
|
41
|
+
], // ISO 3-character codes
|
|
42
|
+
supportedTransactionTypes: ['PLAIN', 'QR', 'BARCODE'], // trOptions.type values
|
|
43
|
+
transactionTypes: ['DEFAULT', 'SHIPPABLE'], // transactionType values
|
|
44
|
+
maxAmount: 'Unlimited', // Limited by Java type implementation
|
|
45
|
+
minAmount: '0.00', // Zero allowed for flexible amounts
|
|
46
|
+
maxTTL: 600, // seconds
|
|
47
|
+
minTTL: 60, // seconds
|
|
48
|
+
defaultTTL: 120, // seconds
|
|
49
|
+
audience: 'https://payware.eu', // Required JWT audience
|
|
50
|
+
transactionIdPrefix: 'pw' // All transaction IDs start with 'pw'
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Generate sandbox configuration
|
|
55
|
+
* @param {string} partnerId - Partner ID
|
|
56
|
+
* @param {string} privateKey - Private key (optional, for validation)
|
|
57
|
+
* @returns {Object} Sandbox configuration object
|
|
58
|
+
*/
|
|
59
|
+
export function generateSandboxConfig(partnerId, privateKey = null) {
|
|
60
|
+
const config = {
|
|
61
|
+
...SANDBOX_CONFIG,
|
|
62
|
+
partnerId,
|
|
63
|
+
endpoints: {
|
|
64
|
+
createTransaction: `${SANDBOX_CONFIG.baseUrl}/transactions`,
|
|
65
|
+
getTransactionStatus: `${SANDBOX_CONFIG.baseUrl}/transactions/{id}`,
|
|
66
|
+
processTransaction: `${SANDBOX_CONFIG.baseUrl}/transactions/{id}`,
|
|
67
|
+
cancelTransaction: `${SANDBOX_CONFIG.baseUrl}/transactions/{id}`,
|
|
68
|
+
getTransactionHistory: `${SANDBOX_CONFIG.baseUrl}/transactions-history/{id}`,
|
|
69
|
+
callback: 'https://your-callback-url' // Provided by merchant
|
|
70
|
+
},
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-Type': 'application/json',
|
|
73
|
+
'Api-Version': '1'
|
|
74
|
+
},
|
|
75
|
+
authentication: {
|
|
76
|
+
type: 'JWT',
|
|
77
|
+
algorithm: 'RS256',
|
|
78
|
+
audience: 'https://payware.eu',
|
|
79
|
+
requiresContentMd5: 'For POST/PUT/PATCH requests',
|
|
80
|
+
hasPrivateKey: !!privateKey
|
|
81
|
+
},
|
|
82
|
+
generatedAt: new Date().toISOString()
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return config;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Setup sandbox auth tool implementation
|
|
90
|
+
*/
|
|
91
|
+
export const setupSandboxAuthTool = {
|
|
92
|
+
name: "payware_authentication_setup_sandbox_auth",
|
|
93
|
+
description: "Setup sandbox authentication configuration for payware API",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: "object",
|
|
96
|
+
properties: {
|
|
97
|
+
partnerId: {
|
|
98
|
+
type: "string",
|
|
99
|
+
description: "Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default."
|
|
100
|
+
},
|
|
101
|
+
privateKey: {
|
|
102
|
+
type: "string",
|
|
103
|
+
description: "RSA private key in PEM format (optional, for validation). Uses environment-specific private key as default."
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
additionalProperties: false
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
async handler(args) {
|
|
110
|
+
const {
|
|
111
|
+
partnerId = getPartnerIdSafe(),
|
|
112
|
+
privateKey = getPrivateKeySafe()
|
|
113
|
+
} = args;
|
|
114
|
+
|
|
115
|
+
if (!partnerId) {
|
|
116
|
+
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const config = generateSandboxConfig(partnerId, privateKey);
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
content: [{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: `🔧 **Sandbox Authentication Setup Complete**
|
|
125
|
+
|
|
126
|
+
**Configuration:**
|
|
127
|
+
\`\`\`json
|
|
128
|
+
${JSON.stringify(config, null, 2)}
|
|
129
|
+
\`\`\`
|
|
130
|
+
|
|
131
|
+
**Environment Details:**
|
|
132
|
+
- Base URL: ${config.baseUrl}
|
|
133
|
+
- API Version: ${config.apiVersion}
|
|
134
|
+
- Environment: ${config.environment}
|
|
135
|
+
- Partner ID: ${config.partnerId}
|
|
136
|
+
|
|
137
|
+
**Supported Features:**
|
|
138
|
+
- Request Types (trOptions.type): ${config.supportedTransactionTypes.join(', ')}
|
|
139
|
+
- Transaction Types: ${config.transactionTypes.join(', ')}
|
|
140
|
+
- Currencies: ${config.supportedCurrencies.join(', ')} (ISO 3-char codes)
|
|
141
|
+
- Amount Range: €${config.minAmount} - ${config.maxAmount} (currency values)
|
|
142
|
+
- TTL Range: ${config.minTTL}-${config.maxTTL} seconds (default: ${config.defaultTTL})
|
|
143
|
+
- Transaction ID Format: Starts with '${config.transactionIdPrefix}'
|
|
144
|
+
- QR Options: Format (PNG/JPEG/SVG), Border, Error Correction (L/M/Q/H), Scale, Version
|
|
145
|
+
- Barcode Options: Format (CODE128/CODE39/EAN13), Width, Height, Font Size, Text Location
|
|
146
|
+
- Additional: passbackParams for custom callback data
|
|
147
|
+
|
|
148
|
+
**API Endpoints:**
|
|
149
|
+
- Create Transaction: \`POST ${config.endpoints.createTransaction}\`
|
|
150
|
+
- Get Transaction Status: \`GET ${config.endpoints.getTransactionStatus}\`
|
|
151
|
+
- Process Transaction: \`POST ${config.endpoints.processTransaction}\` (merchants only)
|
|
152
|
+
- Cancel Transaction: \`PATCH ${config.endpoints.cancelTransaction}\` (creators only)
|
|
153
|
+
- Transaction History: \`GET ${config.endpoints.getTransactionHistory}\` (completed/expired)
|
|
154
|
+
- Callback Endpoint: \`POST [your-callback-url]\` (configured by you)
|
|
155
|
+
|
|
156
|
+
**Required Headers (All Requests):**
|
|
157
|
+
${Object.entries(config.headers).map(([key, value]) => `- ${key}: ${value}`).join('\n')}
|
|
158
|
+
- Authorization: Bearer {JWT_TOKEN} (with contentSha256 for POST/PATCH)
|
|
159
|
+
|
|
160
|
+
**JWT Requirements:**
|
|
161
|
+
- Algorithm: RS256
|
|
162
|
+
- Issuer (iss): Your Partner ID
|
|
163
|
+
- Audience (aud): https://payware.eu
|
|
164
|
+
- Content-SHA256: Required in JWT header for POST/PATCH requests
|
|
165
|
+
- Private Key: RSA 2048-bit minimum
|
|
166
|
+
|
|
167
|
+
**Required Fields for Transaction Creation:**
|
|
168
|
+
- trData.currency: ISO 3-character code (required)
|
|
169
|
+
- trData.reasonL1: Description, max 100 chars (required)
|
|
170
|
+
- trData.reasonL2: Continuation, max 100 chars (optional)
|
|
171
|
+
- trData.amount: Currency value as string/number, 0.00+ (optional for flexible)
|
|
172
|
+
- trOptions.type: PLAIN, QR, or BARCODE (default: PLAIN)
|
|
173
|
+
- trOptions.timeToLive: 60-600 seconds (default: 120)
|
|
174
|
+
|
|
175
|
+
**Next Steps:**
|
|
176
|
+
1. Generate RSA key pair (2048-bit minimum)
|
|
177
|
+
2. Register public key in payware portal
|
|
178
|
+
3. Create JWT token with proper structure
|
|
179
|
+
4. Test with create transaction endpoint
|
|
180
|
+
5. Implement callback handler for status updates
|
|
181
|
+
|
|
182
|
+
**⚠️ Sandbox Only:**
|
|
183
|
+
This configuration is for sandbox testing only. Do not use in production.`
|
|
184
|
+
}]
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
187
|
};
|
package/src/isv/index.js
CHANGED
|
@@ -28,6 +28,13 @@ import { isvDeepLinksTools } from './deep-links/index.js';
|
|
|
28
28
|
// POI tools
|
|
29
29
|
import { isvPOITools } from './poi/index.js';
|
|
30
30
|
|
|
31
|
+
// Shop tools
|
|
32
|
+
import { isvShopTools } from './shops/index.js';
|
|
33
|
+
|
|
34
|
+
// Merchant onboarding: invitations, and the reference data their forms need
|
|
35
|
+
import { isvInvitationTools } from './invitations/index.js';
|
|
36
|
+
import { isvReferenceTools } from './reference/index.js';
|
|
37
|
+
|
|
31
38
|
// Import shared tools
|
|
32
39
|
import { sharedTools } from '../shared/index.js';
|
|
33
40
|
|
|
@@ -61,7 +68,16 @@ export const isvTools = [
|
|
|
61
68
|
...isvDeepLinksTools,
|
|
62
69
|
|
|
63
70
|
// POI management
|
|
64
|
-
...isvPOITools
|
|
71
|
+
...isvPOITools,
|
|
72
|
+
|
|
73
|
+
// Shop lookup - needed before any call that takes a shopCode
|
|
74
|
+
...isvShopTools,
|
|
75
|
+
|
|
76
|
+
// Merchant onboarding. These come BEFORE a merchant exists, so they authenticate as the ISV
|
|
77
|
+
// itself rather than on behalf of anyone - they are how the merchantPartnerId + oauth2Token pair
|
|
78
|
+
// that every other tool here requires comes into existence in the first place.
|
|
79
|
+
...isvInvitationTools,
|
|
80
|
+
...isvReferenceTools
|
|
65
81
|
];
|
|
66
82
|
|
|
67
83
|
/**
|
|
@@ -104,6 +120,18 @@ export function getISVTools() {
|
|
|
104
120
|
else if (tool.name.startsWith('payware_poi_')) {
|
|
105
121
|
newName = tool.name; // Keep poi grouping
|
|
106
122
|
}
|
|
123
|
+
// Shop tools keep their shops grouping
|
|
124
|
+
else if (tool.name.startsWith('payware_shops_')) {
|
|
125
|
+
newName = tool.name; // Keep shops grouping
|
|
126
|
+
}
|
|
127
|
+
// Merchant onboarding (invitations) keeps its isv grouping
|
|
128
|
+
else if (tool.name.startsWith('payware_isv_')) {
|
|
129
|
+
newName = tool.name; // Keep isv grouping
|
|
130
|
+
}
|
|
131
|
+
// Reference data keeps its reference grouping
|
|
132
|
+
else if (tool.name.startsWith('payware_reference_')) {
|
|
133
|
+
newName = tool.name; // Keep reference grouping
|
|
134
|
+
}
|
|
107
135
|
|
|
108
136
|
return {
|
|
109
137
|
...tool,
|