@payware/mcp-server 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +0 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/check-keys.js +0 -0
- package/keys/README.md +0 -0
- package/mcp-config.json +0 -0
- package/package.json +73 -66
- package/payware-mcp-config.json +0 -0
- package/src/auth/rsa-keys.js +0 -0
- package/src/auth/sandbox-setup.js +186 -186
- package/src/config/env.js +0 -0
- package/src/config/partner-types.js +0 -0
- package/src/core/auth/jwt-factory.js +0 -0
- package/src/core/auth/jwt-token.js +0 -0
- package/src/core/utils/json-serializer.js +0 -0
- package/src/core/utils/key-utils.js +0 -0
- package/src/index.js +0 -0
- package/src/isv/data/index.js +0 -0
- package/src/isv/deep-links/delete-product-link.js +0 -0
- package/src/isv/deep-links/delete-transaction-link.js +0 -0
- package/src/isv/deep-links/get-product-link.js +0 -0
- package/src/isv/deep-links/get-transaction-link.js +0 -0
- package/src/isv/deep-links/index.js +0 -0
- package/src/isv/index.js +29 -1
- package/src/isv/invitations/index.js +471 -0
- package/src/isv/oauth2/create-token-simple.js +0 -0
- package/src/isv/oauth2/get-token-info.js +0 -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/audios.js +0 -0
- package/src/isv/products/create-product.js +313 -313
- package/src/isv/products/delete-product.js +0 -0
- package/src/isv/products/get-product-image.js +0 -0
- package/src/isv/products/get-product.js +0 -0
- package/src/isv/products/index.js +0 -0
- package/src/isv/products/list-products.js +0 -0
- package/src/isv/products/schedules.js +0 -0
- 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/isv/utils/auth.js +0 -0
- package/src/mcp-proxy.js +0 -0
- package/src/merchant/data/export-report.js +0 -0
- package/src/merchant/data/generate-report.js +19 -1
- package/src/merchant/data/get-export-list.js +0 -0
- package/src/merchant/data/get-report-requests.js +0 -0
- package/src/merchant/data/get-report-status.js +0 -0
- package/src/merchant/data/index.js +0 -0
- package/src/merchant/data/list-reports.js +0 -0
- package/src/merchant/deep-links/delete-product-link.js +0 -0
- package/src/merchant/deep-links/delete-transaction-link.js +0 -0
- package/src/merchant/deep-links/get-product-link.js +0 -0
- package/src/merchant/deep-links/get-transaction-link.js +0 -0
- package/src/merchant/deep-links/index.js +0 -0
- package/src/merchant/index.js +21 -1
- package/src/merchant/logs/index.js +366 -0
- package/src/merchant/products/audios.js +0 -0
- package/src/merchant/products/create-product.js +287 -287
- package/src/merchant/products/delete-product.js +0 -0
- package/src/merchant/products/get-product-image.js +0 -0
- package/src/merchant/products/get-product.js +0 -0
- package/src/merchant/products/index.js +0 -0
- package/src/merchant/products/list-products.js +0 -0
- package/src/merchant/products/schedules.js +0 -0
- 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/data/index.js +0 -0
- package/src/payment-institution/deep-links/delete-transaction-link.js +0 -0
- package/src/payment-institution/deep-links/get-transaction-link.js +0 -0
- package/src/payment-institution/deep-links/index.js +0 -0
- package/src/payment-institution/index.js +0 -0
- 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/proxy-server.js +25 -4
- 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/index.js +0 -0
- 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/common/utils-examples.js +0 -0
- package/src/utils/code-examples/frameworks/examples.js +0 -0
- package/src/utils/code-examples/index.js +0 -0
- package/src/utils/code-examples/isv/oauth2.js +458 -600
- package/src/utils/code-examples/isv/products.js +0 -0
- package/src/utils/code-examples/isv/transactions.js +815 -812
- package/src/utils/code-examples/merchant/products.js +0 -0
- package/src/utils/code-examples/merchant/transactions.js +0 -0
- package/src/utils/code-examples/payment-institution/transactions.js +0 -0
- package/src/utils/code-examples/shared/data.js +0 -0
- package/src/utils/code-examples/shared/deep-links.js +0 -0
- package/src/utils/code-examples/shared/soundbites.js +0 -0
- package/src/utils/code-examples.js +0 -0
- package/src/utils/format-request.js +0 -0
- package/src/utils/json-formatter.js +0 -0
- package/src/utils/server-info.js +0 -0
- package/MCP-SETUP.md +0 -190
package/.env.example
CHANGED
|
File without changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 payware LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Official MCP (Model Context Protocol) server for payware payment API integration. This server enables AI assistants to interact with payware APIs, automating integration workflows for all partner types.
|
|
6
6
|
|
|
7
|
+
Releases are published to npm as `@payware/mcp-server` and to the official [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.payware/mcp-server`. MIT licensed, see [LICENSE](LICENSE).
|
|
8
|
+
|
|
7
9
|
## Who Is This For?
|
|
8
10
|
|
|
9
11
|
- **Merchants** - Accept payments, manage products, generate transaction reports
|
|
@@ -38,6 +40,11 @@ Official MCP (Model Context Protocol) server for payware payment API integration
|
|
|
38
40
|
- **Get QR Code**: Generate QR code for POI payments
|
|
39
41
|
- **List POIs**: List all POIs for a merchant
|
|
40
42
|
|
|
43
|
+
### 📋 Logs Tools (Premium)
|
|
44
|
+
- **Query Logs**: Search and filter application logs by level, logger, message content, and date range
|
|
45
|
+
- **Log Status**: Check log availability and storage information
|
|
46
|
+
- **Download Logs**: Get compressed archive of logs for offline analysis
|
|
47
|
+
|
|
41
48
|
### 🛠️ Utility Tools
|
|
42
49
|
- **Advanced Code Generation**: Generate complete integration code across 8 languages (Python, Node.js, PHP, Java, C#, Go, Ruby, cURL) with 16+ framework support
|
|
43
50
|
- **Framework Integration**: Framework-specific examples for Django, FastAPI, Express, NestJS, Laravel, Spring Boot, ASP.NET, and more
|
package/check-keys.js
CHANGED
|
File without changes
|
package/keys/README.md
CHANGED
|
File without changes
|
package/mcp-config.json
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,66 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@payware/mcp-server",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"proxy
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@payware/mcp-server",
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"mcpName": "io.github.payware/mcp-server",
|
|
5
|
+
"description": "Official MCP server for payware payment API integration",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"payware-mcp": "src/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "node src/index.js",
|
|
13
|
+
"dev": "node --watch src/index.js",
|
|
14
|
+
"proxy": "node src/proxy-server.js",
|
|
15
|
+
"proxy:dev": "node --watch src/proxy-server.js",
|
|
16
|
+
"bridge": "node src/mcp-proxy.js",
|
|
17
|
+
"inspector": "npx @modelcontextprotocol/inspector node src/mcp-proxy.js",
|
|
18
|
+
"test": "node --test tests/api-errors.test.js tests/json-serializer.test.js tests/request-contract.test.js tests/tool-contract.test.js",
|
|
19
|
+
"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",
|
|
20
|
+
"check": "node --check src/index.js && npm test"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@modelcontextprotocol/sdk": "^0.5.0",
|
|
24
|
+
"axios": "^1.6.0",
|
|
25
|
+
"cors": "^2.8.5",
|
|
26
|
+
"dotenv": "^17.2.2",
|
|
27
|
+
"express": "^5.1.0",
|
|
28
|
+
"http-proxy-middleware": "^3.0.5",
|
|
29
|
+
"jsonwebtoken": "^9.0.0",
|
|
30
|
+
"node-forge": "^1.3.1"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"mcp",
|
|
37
|
+
"model-context-protocol",
|
|
38
|
+
"payware",
|
|
39
|
+
"payments",
|
|
40
|
+
"api",
|
|
41
|
+
"fintech",
|
|
42
|
+
"pos",
|
|
43
|
+
"terminal",
|
|
44
|
+
"merchant",
|
|
45
|
+
"isv",
|
|
46
|
+
"oauth2",
|
|
47
|
+
"a2a-payments",
|
|
48
|
+
"account-to-account",
|
|
49
|
+
"instant-payments",
|
|
50
|
+
"transaction-resolution",
|
|
51
|
+
"qr-code-payments"
|
|
52
|
+
],
|
|
53
|
+
"author": "payware <support@payware.com>",
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/payware/mcp-server.git"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/payware/mcp-server/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/payware/mcp-server#readme",
|
|
63
|
+
"files": [
|
|
64
|
+
"src/",
|
|
65
|
+
"keys/README.md",
|
|
66
|
+
"README.md",
|
|
67
|
+
"check-keys.js",
|
|
68
|
+
"mcp-config.json",
|
|
69
|
+
"payware-mcp-config.json",
|
|
70
|
+
".env.example",
|
|
71
|
+
"MCP-SETUP.md"
|
|
72
|
+
]
|
|
73
|
+
}
|
package/payware-mcp-config.json
CHANGED
|
File without changes
|
package/src/auth/rsa-keys.js
CHANGED
|
File without changes
|
|
@@ -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/config/env.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/index.js
CHANGED
|
File without changes
|
package/src/isv/data/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|