@payware/mcp-server 1.5.1 → 2.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 +1 -1
- package/README.md +1 -5
- package/package.json +1 -1
- package/src/config/toolsets.js +0 -2
- package/src/isv/index.js +0 -6
- package/src/isv/products/get-product.js +0 -1
- package/src/isv/transactions/create-transaction.js +1 -1
- package/src/merchant/index.js +0 -6
- package/src/merchant/products/get-product.js +0 -1
- package/src/payment-institution/index.js +1 -9
- package/src/shared/auth-headers.js +7 -6
- package/src/shared/placements/tools.js +4 -17
- package/src/tools/advanced-code-generator.js +2 -28
- package/src/utils/code-examples/common/helpers.js +1 -11
- package/src/utils/code-examples/index.js +1 -18
- package/src/isv/deep-links/delete-product-link.js +0 -155
- package/src/isv/deep-links/delete-transaction-link.js +0 -155
- package/src/isv/deep-links/get-product-link.js +0 -169
- package/src/isv/deep-links/get-transaction-link.js +0 -169
- package/src/isv/deep-links/index.js +0 -23
- package/src/merchant/deep-links/delete-product-link.js +0 -122
- package/src/merchant/deep-links/delete-transaction-link.js +0 -122
- package/src/merchant/deep-links/get-product-link.js +0 -136
- package/src/merchant/deep-links/get-transaction-link.js +0 -136
- package/src/merchant/deep-links/index.js +0 -23
- package/src/payment-institution/deep-links/delete-transaction-link.js +0 -129
- package/src/payment-institution/deep-links/get-transaction-link.js +0 -143
- package/src/payment-institution/deep-links/index.js +0 -17
- package/src/shared/deep-links/api.js +0 -215
- package/src/utils/code-examples/shared/deep-links.js +0 -662
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { deleteTransactionDeepLink } from '../../shared/deep-links/api.js';
|
|
2
|
-
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
3
|
-
import { CHANGES } from '../../shared/tool-annotations.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Delete deep link for a merchant transaction
|
|
7
|
-
*/
|
|
8
|
-
export const deleteTransactionLinkTool = {
|
|
9
|
-
name: "payware_deep_links_delete_transaction_link",
|
|
10
|
-
annotations: CHANGES,
|
|
11
|
-
description: `Delete an active deep link for a transaction. Once deleted, the deep link URL will no longer redirect to the payware mobile app.
|
|
12
|
-
|
|
13
|
-
**Use Cases:**
|
|
14
|
-
- Remove expired transaction links
|
|
15
|
-
- Clean up after transaction completion
|
|
16
|
-
- Security cleanup for sensitive transactions
|
|
17
|
-
|
|
18
|
-
**Important Notes:**
|
|
19
|
-
- Deep links are only supported in production environment
|
|
20
|
-
- Once deleted, the link cannot be recovered - you'll need to create a new one
|
|
21
|
-
- This operation is irreversible`,
|
|
22
|
-
|
|
23
|
-
inputSchema: {
|
|
24
|
-
type: "object",
|
|
25
|
-
properties: {
|
|
26
|
-
transactionId: {
|
|
27
|
-
type: "string",
|
|
28
|
-
description: "The transaction identifier (e.g., 'pw7e4rCToG')",
|
|
29
|
-
pattern: "^[a-zA-Z0-9]+$"
|
|
30
|
-
},
|
|
31
|
-
partnerId: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: "Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default.",
|
|
34
|
-
default: getPartnerIdSafe()
|
|
35
|
-
},
|
|
36
|
-
privateKey: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
required: ["transactionId"]
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
async handler(args) {
|
|
45
|
-
const {
|
|
46
|
-
transactionId,
|
|
47
|
-
partnerId = getPartnerIdSafe(),
|
|
48
|
-
privateKey = getPrivateKeySafe()
|
|
49
|
-
} = args;
|
|
50
|
-
|
|
51
|
-
if (!transactionId) {
|
|
52
|
-
throw new Error("transactionId is required");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!partnerId) {
|
|
56
|
-
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (!privateKey) {
|
|
60
|
-
throw new Error("Private key is required. Provide via 'privateKey' parameter or set PAYWARE_PRIVATE_KEY environment variable.");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
const result = await deleteTransactionDeepLink({
|
|
65
|
-
transactionId,
|
|
66
|
-
partnerType: 'merchant',
|
|
67
|
-
partnerId,
|
|
68
|
-
privateKey
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
content: [{
|
|
73
|
-
type: "text",
|
|
74
|
-
text: `✅ **Transaction Deep Link Deleted**
|
|
75
|
-
|
|
76
|
-
**Deletion Details:**
|
|
77
|
-
- Transaction ID: ${transactionId}
|
|
78
|
-
- Status: Successfully deleted
|
|
79
|
-
- Link URL: https://go.payware.eu/${transactionId} (now inactive)
|
|
80
|
-
|
|
81
|
-
**API Call Details:**
|
|
82
|
-
- Endpoint: DELETE ${result.requestInfo.url}
|
|
83
|
-
- Status: ${result.requestInfo.statusCode}
|
|
84
|
-
- Method: ${result.requestInfo.method}
|
|
85
|
-
|
|
86
|
-
**Result:**
|
|
87
|
-
- The deep link is no longer active
|
|
88
|
-
- Mobile redirects will no longer work
|
|
89
|
-
- URL will return an error if accessed
|
|
90
|
-
|
|
91
|
-
**Important Notes:**
|
|
92
|
-
⚠️ This operation is irreversible
|
|
93
|
-
⚠️ Create a new link if needed using \`payware_deep_links_get_transaction_link\`
|
|
94
|
-
⚠️ Any existing shared links will stop working immediately`
|
|
95
|
-
}]
|
|
96
|
-
};
|
|
97
|
-
} catch (error) {
|
|
98
|
-
return {
|
|
99
|
-
content: [{
|
|
100
|
-
type: "text",
|
|
101
|
-
text: `❌ **Failed to Delete Transaction Deep Link**
|
|
102
|
-
|
|
103
|
-
**Error Details:**
|
|
104
|
-
- Transaction ID: ${transactionId}
|
|
105
|
-
- Message: ${error.message}
|
|
106
|
-
|
|
107
|
-
**Common Issues:**
|
|
108
|
-
1. **Link not found**: Deep link may already be deleted or never existed
|
|
109
|
-
2. **Authentication failed**: Verify partner ID and private key
|
|
110
|
-
3. **Sandbox environment**: Deep links are production-only
|
|
111
|
-
4. **Invalid transaction ID**: Ensure transaction ID format is correct
|
|
112
|
-
|
|
113
|
-
**Troubleshooting:**
|
|
114
|
-
1. Check if deep link exists using \`payware_deep_links_get_transaction_link\`
|
|
115
|
-
2. Verify running in production environment
|
|
116
|
-
3. Ensure JWT authentication is working
|
|
117
|
-
4. Confirm transaction ID is correct`
|
|
118
|
-
}]
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { getProductDeepLink } from '../../shared/deep-links/api.js';
|
|
2
|
-
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
3
|
-
import { ADDS } from '../../shared/tool-annotations.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get deep link for a merchant product
|
|
7
|
-
*/
|
|
8
|
-
export const getProductLinkTool = {
|
|
9
|
-
name: "payware_deep_links_get_product_link",
|
|
10
|
-
annotations: ADDS,
|
|
11
|
-
description: `Get an active deep link for a product. Returns a clickable URL that redirects to the payware mobile app. For a link whose payments are attributed to one placement of the product (a poster, an ad, a mailing), use payware_products_get_placement_link instead.
|
|
12
|
-
|
|
13
|
-
**Deep Link Format:**
|
|
14
|
-
- Web URL: https://go.payware.eu/{productId}
|
|
15
|
-
- Mobile Redirect: payware:/{productId} (one slash: the identifier is case-sensitive, so it must not sit in the URI host, which redirect services lowercase)
|
|
16
|
-
|
|
17
|
-
**Use Cases:**
|
|
18
|
-
- Mobile-only e-commerce product references
|
|
19
|
-
- Advertisement links to products
|
|
20
|
-
- Product sharing via messaging
|
|
21
|
-
|
|
22
|
-
**Important Notes:**
|
|
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
|
|
25
|
-
- Link expiration is synchronized with the referenced product
|
|
26
|
-
- Traditional deep links that route to app content when app is installed`,
|
|
27
|
-
|
|
28
|
-
inputSchema: {
|
|
29
|
-
type: "object",
|
|
30
|
-
properties: {
|
|
31
|
-
productId: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: "The product identifier (e.g., 'pr7e4rCToG')",
|
|
34
|
-
pattern: "^[a-zA-Z0-9]+$"
|
|
35
|
-
},
|
|
36
|
-
partnerId: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default.",
|
|
39
|
-
default: getPartnerIdSafe()
|
|
40
|
-
},
|
|
41
|
-
privateKey: {
|
|
42
|
-
type: "string",
|
|
43
|
-
description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
required: ["productId"]
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
async handler(args) {
|
|
50
|
-
const {
|
|
51
|
-
productId,
|
|
52
|
-
partnerId = getPartnerIdSafe(),
|
|
53
|
-
privateKey = getPrivateKeySafe()
|
|
54
|
-
} = args;
|
|
55
|
-
|
|
56
|
-
if (!productId) {
|
|
57
|
-
throw new Error("productId is required");
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (!partnerId) {
|
|
61
|
-
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!privateKey) {
|
|
65
|
-
throw new Error("Private key is required. Provide via 'privateKey' parameter or set PAYWARE_PRIVATE_KEY environment variable.");
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
const result = await getProductDeepLink({
|
|
70
|
-
productId,
|
|
71
|
-
partnerType: 'merchant',
|
|
72
|
-
partnerId,
|
|
73
|
-
privateKey
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Extract the URL - API returns either string directly or object with link property
|
|
77
|
-
const linkUrl = typeof result.data === 'string' ? result.data : (result.data.link || result.data)
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
content: [{
|
|
81
|
-
type: "text",
|
|
82
|
-
text: `🔗 **Product Deep Link Retrieved**
|
|
83
|
-
|
|
84
|
-
**Deep Link Details:**
|
|
85
|
-
- Product ID: ${productId}
|
|
86
|
-
- Web URL: ${linkUrl}
|
|
87
|
-
- Mobile Redirect: payware:/${productId}
|
|
88
|
-
|
|
89
|
-
**Link Information:**
|
|
90
|
-
- Status: Active
|
|
91
|
-
- Expiration: Synchronized with product
|
|
92
|
-
- Platform: Production only
|
|
93
|
-
|
|
94
|
-
**API Response:**
|
|
95
|
-
\`\`\`json
|
|
96
|
-
${JSON.stringify(result.data, null, 2)}
|
|
97
|
-
\`\`\`
|
|
98
|
-
|
|
99
|
-
**API Call Details:**
|
|
100
|
-
- Endpoint: GET ${result.requestInfo.url}
|
|
101
|
-
- Status: ${result.requestInfo.statusCode}
|
|
102
|
-
- Method: ${result.requestInfo.method}
|
|
103
|
-
|
|
104
|
-
**Usage:**
|
|
105
|
-
1. Share the web URL: \`${linkUrl}\`
|
|
106
|
-
2. On mobile devices, it will redirect to: \`payware:/${productId}\`
|
|
107
|
-
3. Link expires when the product expires
|
|
108
|
-
4. Recreate if product is updated`
|
|
109
|
-
}]
|
|
110
|
-
};
|
|
111
|
-
} catch (error) {
|
|
112
|
-
return {
|
|
113
|
-
content: [{
|
|
114
|
-
type: "text",
|
|
115
|
-
text: `❌ **Failed to Get Product Deep Link**
|
|
116
|
-
|
|
117
|
-
**Error Details:**
|
|
118
|
-
- Product ID: ${productId}
|
|
119
|
-
- Message: ${error.message}
|
|
120
|
-
|
|
121
|
-
**Common Issues:**
|
|
122
|
-
1. **Product not found**: Check if product exists and is not expired
|
|
123
|
-
2. **Authentication failed**: Verify partner ID and private key
|
|
124
|
-
3. **Sandbox environment**: Deep links are production-only
|
|
125
|
-
4. **Invalid product ID**: Ensure product ID format is correct
|
|
126
|
-
|
|
127
|
-
**Troubleshooting:**
|
|
128
|
-
1. Verify product exists in your payware dashboard
|
|
129
|
-
2. Check if running in production environment
|
|
130
|
-
3. Ensure JWT authentication is working
|
|
131
|
-
4. Confirm product is active and not expired`
|
|
132
|
-
}]
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { getTransactionDeepLink } from '../../shared/deep-links/api.js';
|
|
2
|
-
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
3
|
-
import { ADDS } from '../../shared/tool-annotations.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get deep link for a merchant transaction
|
|
7
|
-
*/
|
|
8
|
-
export const getTransactionLinkTool = {
|
|
9
|
-
name: "payware_deep_links_get_transaction_link",
|
|
10
|
-
annotations: ADDS,
|
|
11
|
-
description: `Get an active deep link for a transaction. Returns a clickable URL that redirects to the payware mobile app.
|
|
12
|
-
|
|
13
|
-
**Deep Link Format:**
|
|
14
|
-
- Web URL: https://go.payware.eu/{transactionId}
|
|
15
|
-
- Mobile Redirect: payware:/{transactionId} (one slash: the identifier is case-sensitive, so it must not sit in the URI host, which redirect services lowercase)
|
|
16
|
-
|
|
17
|
-
**Use Cases:**
|
|
18
|
-
- P2P payments via messaging services
|
|
19
|
-
- Mobile-only e-commerce payments
|
|
20
|
-
- Advertisement references
|
|
21
|
-
|
|
22
|
-
**Important Notes:**
|
|
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
|
|
25
|
-
- Link expiration is synchronized with the referenced transaction
|
|
26
|
-
- Traditional deep links that route to app content when app is installed`,
|
|
27
|
-
|
|
28
|
-
inputSchema: {
|
|
29
|
-
type: "object",
|
|
30
|
-
properties: {
|
|
31
|
-
transactionId: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: "The transaction identifier (e.g., 'pw7e4rCToG')",
|
|
34
|
-
pattern: "^[a-zA-Z0-9]+$"
|
|
35
|
-
},
|
|
36
|
-
partnerId: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default.",
|
|
39
|
-
default: getPartnerIdSafe()
|
|
40
|
-
},
|
|
41
|
-
privateKey: {
|
|
42
|
-
type: "string",
|
|
43
|
-
description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
required: ["transactionId"]
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
async handler(args) {
|
|
50
|
-
const {
|
|
51
|
-
transactionId,
|
|
52
|
-
partnerId = getPartnerIdSafe(),
|
|
53
|
-
privateKey = getPrivateKeySafe()
|
|
54
|
-
} = args;
|
|
55
|
-
|
|
56
|
-
if (!transactionId) {
|
|
57
|
-
throw new Error("transactionId is required");
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (!partnerId) {
|
|
61
|
-
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!privateKey) {
|
|
65
|
-
throw new Error("Private key is required. Provide via 'privateKey' parameter or set PAYWARE_PRIVATE_KEY environment variable.");
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
const result = await getTransactionDeepLink({
|
|
70
|
-
transactionId,
|
|
71
|
-
partnerType: 'merchant',
|
|
72
|
-
partnerId,
|
|
73
|
-
privateKey
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Extract the URL - API returns either string directly or object with link property
|
|
77
|
-
const linkUrl = typeof result.data === 'string' ? result.data : (result.data.link || result.data)
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
content: [{
|
|
81
|
-
type: "text",
|
|
82
|
-
text: `🔗 **Transaction Deep Link Retrieved**
|
|
83
|
-
|
|
84
|
-
**Deep Link Details:**
|
|
85
|
-
- Transaction ID: ${transactionId}
|
|
86
|
-
- Web URL: ${linkUrl}
|
|
87
|
-
- Mobile Redirect: payware:/${transactionId}
|
|
88
|
-
|
|
89
|
-
**Link Information:**
|
|
90
|
-
- Status: Active
|
|
91
|
-
- Expiration: Synchronized with transaction
|
|
92
|
-
- Platform: Production only
|
|
93
|
-
|
|
94
|
-
**API Response:**
|
|
95
|
-
\`\`\`json
|
|
96
|
-
${JSON.stringify(result.data, null, 2)}
|
|
97
|
-
\`\`\`
|
|
98
|
-
|
|
99
|
-
**API Call Details:**
|
|
100
|
-
- Endpoint: GET ${result.requestInfo.url}
|
|
101
|
-
- Status: ${result.requestInfo.statusCode}
|
|
102
|
-
- Method: ${result.requestInfo.method}
|
|
103
|
-
|
|
104
|
-
**Usage:**
|
|
105
|
-
1. Share the web URL: \`${linkUrl}\`
|
|
106
|
-
2. On mobile devices, it will redirect to: \`payware:/${transactionId}\`
|
|
107
|
-
3. Link expires when the transaction expires
|
|
108
|
-
4. Recreate if transaction is extended`
|
|
109
|
-
}]
|
|
110
|
-
};
|
|
111
|
-
} catch (error) {
|
|
112
|
-
return {
|
|
113
|
-
content: [{
|
|
114
|
-
type: "text",
|
|
115
|
-
text: `❌ **Failed to Get Transaction Deep Link**
|
|
116
|
-
|
|
117
|
-
**Error Details:**
|
|
118
|
-
- Transaction ID: ${transactionId}
|
|
119
|
-
- Message: ${error.message}
|
|
120
|
-
|
|
121
|
-
**Common Issues:**
|
|
122
|
-
1. **Transaction not found**: Check if transaction exists and is not expired
|
|
123
|
-
2. **Authentication failed**: Verify partner ID and private key
|
|
124
|
-
3. **Sandbox environment**: Deep links are production-only
|
|
125
|
-
4. **Invalid transaction ID**: Ensure transaction ID format is correct
|
|
126
|
-
|
|
127
|
-
**Troubleshooting:**
|
|
128
|
-
1. Verify transaction exists using \`payware_operations_get_transaction_status\`
|
|
129
|
-
2. Check if running in production environment
|
|
130
|
-
3. Ensure JWT authentication is working
|
|
131
|
-
4. Confirm transaction is not expired`
|
|
132
|
-
}]
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merchant Deep Links Tools
|
|
3
|
-
* Deep link management for merchants
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { getTransactionLinkTool } from './get-transaction-link.js';
|
|
7
|
-
import { getProductLinkTool } from './get-product-link.js';
|
|
8
|
-
import { deleteTransactionLinkTool } from './delete-transaction-link.js';
|
|
9
|
-
import { deleteProductLinkTool } from './delete-product-link.js';
|
|
10
|
-
|
|
11
|
-
export const merchantDeepLinksTools = [
|
|
12
|
-
getTransactionLinkTool,
|
|
13
|
-
getProductLinkTool,
|
|
14
|
-
deleteTransactionLinkTool,
|
|
15
|
-
deleteProductLinkTool
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
getTransactionLinkTool,
|
|
20
|
-
getProductLinkTool,
|
|
21
|
-
deleteTransactionLinkTool,
|
|
22
|
-
deleteProductLinkTool
|
|
23
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { deleteTransactionDeepLink } from '../../shared/deep-links/api.js';
|
|
2
|
-
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
3
|
-
import { CHANGES } from '../../shared/tool-annotations.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Delete deep link for a payment institution transaction
|
|
7
|
-
*/
|
|
8
|
-
export const deleteTransactionLinkTool = {
|
|
9
|
-
name: "payware_deep_links_delete_transaction_link",
|
|
10
|
-
annotations: CHANGES,
|
|
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.
|
|
12
|
-
|
|
13
|
-
**Use Cases:**
|
|
14
|
-
- Remove expired transaction links
|
|
15
|
-
- Clean up after transaction completion
|
|
16
|
-
- Security cleanup for sensitive P2P transactions
|
|
17
|
-
|
|
18
|
-
**Important Notes:**
|
|
19
|
-
- Deep links are only supported in production environment
|
|
20
|
-
- Once deleted, the link cannot be recovered - you'll need to create a new one
|
|
21
|
-
- Payment institutions only manage transaction links (no product links)
|
|
22
|
-
- This operation is irreversible`,
|
|
23
|
-
|
|
24
|
-
inputSchema: {
|
|
25
|
-
type: "object",
|
|
26
|
-
properties: {
|
|
27
|
-
transactionId: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "The transaction identifier (e.g., 'pw7e4rCToG')",
|
|
30
|
-
pattern: "^[a-zA-Z0-9]+$"
|
|
31
|
-
},
|
|
32
|
-
partnerId: {
|
|
33
|
-
type: "string",
|
|
34
|
-
description: "Payment Institution Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default.",
|
|
35
|
-
default: getPartnerIdSafe()
|
|
36
|
-
},
|
|
37
|
-
privateKey: {
|
|
38
|
-
type: "string",
|
|
39
|
-
description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
required: ["transactionId"]
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
async handler(args) {
|
|
46
|
-
const {
|
|
47
|
-
transactionId,
|
|
48
|
-
partnerId = getPartnerIdSafe(),
|
|
49
|
-
privateKey = getPrivateKeySafe()
|
|
50
|
-
} = args;
|
|
51
|
-
|
|
52
|
-
if (!transactionId) {
|
|
53
|
-
throw new Error("transactionId is required");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!partnerId) {
|
|
57
|
-
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (!privateKey) {
|
|
61
|
-
throw new Error("Private key is required. Provide via 'privateKey' parameter or set PAYWARE_PRIVATE_KEY environment variable.");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
const result = await deleteTransactionDeepLink({
|
|
66
|
-
transactionId,
|
|
67
|
-
partnerType: 'payment_institution',
|
|
68
|
-
partnerId,
|
|
69
|
-
privateKey
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
content: [{
|
|
74
|
-
type: "text",
|
|
75
|
-
text: `✅ **Transaction Deep Link Deleted (Payment Institution)**
|
|
76
|
-
|
|
77
|
-
**Deletion Details:**
|
|
78
|
-
- Transaction ID: ${transactionId}
|
|
79
|
-
- Status: Successfully deleted
|
|
80
|
-
- Link URL: https://go.payware.eu/${transactionId} (now inactive)
|
|
81
|
-
|
|
82
|
-
**Payment Institution Info:**
|
|
83
|
-
- Partner ID: ${partnerId}
|
|
84
|
-
- Role: SRC/DST for P2P transactions
|
|
85
|
-
|
|
86
|
-
**API Call Details:**
|
|
87
|
-
- Endpoint: DELETE ${result.requestInfo.url}
|
|
88
|
-
- Status: ${result.requestInfo.statusCode}
|
|
89
|
-
- Method: ${result.requestInfo.method}
|
|
90
|
-
|
|
91
|
-
**Result:**
|
|
92
|
-
- The deep link is no longer active
|
|
93
|
-
- Mobile redirects will no longer work
|
|
94
|
-
- URL will return an error if accessed
|
|
95
|
-
|
|
96
|
-
**Important Notes:**
|
|
97
|
-
⚠️ This operation is irreversible
|
|
98
|
-
⚠️ Create a new link if needed using \`payware_deep_links_get_transaction_link\`
|
|
99
|
-
⚠️ Any existing shared links will stop working immediately`
|
|
100
|
-
}]
|
|
101
|
-
};
|
|
102
|
-
} catch (error) {
|
|
103
|
-
return {
|
|
104
|
-
content: [{
|
|
105
|
-
type: "text",
|
|
106
|
-
text: `❌ **Failed to Delete Transaction Deep Link (Payment Institution)**
|
|
107
|
-
|
|
108
|
-
**Error Details:**
|
|
109
|
-
- Transaction ID: ${transactionId}
|
|
110
|
-
- Message: ${error.message}
|
|
111
|
-
|
|
112
|
-
**Common Issues:**
|
|
113
|
-
1. **Link not found**: Deep link may already be deleted or never existed
|
|
114
|
-
2. **Authentication failed**: Verify partner ID and private key
|
|
115
|
-
3. **Authorization failed**: Ensure PI is SRC or DST for this transaction
|
|
116
|
-
4. **Sandbox environment**: Deep links are production-only
|
|
117
|
-
5. **Invalid transaction ID**: Ensure transaction ID format is correct
|
|
118
|
-
|
|
119
|
-
**Troubleshooting:**
|
|
120
|
-
1. Check if deep link exists using \`payware_deep_links_get_transaction_link\`
|
|
121
|
-
2. Verify running in production environment
|
|
122
|
-
3. Ensure JWT authentication is working
|
|
123
|
-
4. Confirm payment institution role in transaction
|
|
124
|
-
5. Ensure transaction ID is correct`
|
|
125
|
-
}]
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { getTransactionDeepLink } from '../../shared/deep-links/api.js';
|
|
2
|
-
import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
|
|
3
|
-
import { ADDS } from '../../shared/tool-annotations.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get deep link for a payment institution transaction
|
|
7
|
-
*/
|
|
8
|
-
export const getTransactionLinkTool = {
|
|
9
|
-
name: "payware_deep_links_get_transaction_link",
|
|
10
|
-
annotations: ADDS,
|
|
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.
|
|
12
|
-
|
|
13
|
-
**Deep Link Format:**
|
|
14
|
-
- Web URL: https://go.payware.eu/{transactionId}
|
|
15
|
-
- Mobile Redirect: payware:/{transactionId} (one slash: the identifier is case-sensitive, so it must not sit in the URI host, which redirect services lowercase)
|
|
16
|
-
|
|
17
|
-
**Use Cases:**
|
|
18
|
-
- P2P payments initiated via messaging services
|
|
19
|
-
- Transaction notifications with direct links
|
|
20
|
-
- Transaction status sharing
|
|
21
|
-
|
|
22
|
-
**Important Notes:**
|
|
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
|
|
25
|
-
- Link expiration is synchronized with the referenced transaction
|
|
26
|
-
- Payment institutions only manage transaction links (no product links)
|
|
27
|
-
- Traditional deep links that route to app content when app is installed`,
|
|
28
|
-
|
|
29
|
-
inputSchema: {
|
|
30
|
-
type: "object",
|
|
31
|
-
properties: {
|
|
32
|
-
transactionId: {
|
|
33
|
-
type: "string",
|
|
34
|
-
description: "The transaction identifier (e.g., 'pw7e4rCToG')",
|
|
35
|
-
pattern: "^[a-zA-Z0-9]+$"
|
|
36
|
-
},
|
|
37
|
-
partnerId: {
|
|
38
|
-
type: "string",
|
|
39
|
-
description: "Payment Institution Partner ID from payware dashboard. Uses PAYWARE_PARTNER_ID env var as default.",
|
|
40
|
-
default: getPartnerIdSafe()
|
|
41
|
-
},
|
|
42
|
-
privateKey: {
|
|
43
|
-
type: "string",
|
|
44
|
-
description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
required: ["transactionId"]
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
async handler(args) {
|
|
51
|
-
const {
|
|
52
|
-
transactionId,
|
|
53
|
-
partnerId = getPartnerIdSafe(),
|
|
54
|
-
privateKey = getPrivateKeySafe()
|
|
55
|
-
} = args;
|
|
56
|
-
|
|
57
|
-
if (!transactionId) {
|
|
58
|
-
throw new Error("transactionId is required");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (!partnerId) {
|
|
62
|
-
throw new Error("Partner ID is required. Provide via 'partnerId' parameter or set PAYWARE_PARTNER_ID environment variable.");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!privateKey) {
|
|
66
|
-
throw new Error("Private key is required. Provide via 'privateKey' parameter or set PAYWARE_PRIVATE_KEY environment variable.");
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
const result = await getTransactionDeepLink({
|
|
71
|
-
transactionId,
|
|
72
|
-
partnerType: 'payment_institution',
|
|
73
|
-
partnerId,
|
|
74
|
-
privateKey
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Extract the URL - API returns either string directly or object with link property
|
|
78
|
-
const linkUrl = typeof result.data === 'string' ? result.data : (result.data.link || result.data)
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
content: [{
|
|
82
|
-
type: "text",
|
|
83
|
-
text: `🔗 **Transaction Deep Link Retrieved (Payment Institution)**
|
|
84
|
-
|
|
85
|
-
**Deep Link Details:**
|
|
86
|
-
- Transaction ID: ${transactionId}
|
|
87
|
-
- Web URL: ${linkUrl}
|
|
88
|
-
- Mobile Redirect: payware:/${transactionId}
|
|
89
|
-
|
|
90
|
-
**Payment Institution Info:**
|
|
91
|
-
- Partner ID: ${partnerId}
|
|
92
|
-
- Role: SRC/DST for P2P transactions
|
|
93
|
-
|
|
94
|
-
**Link Information:**
|
|
95
|
-
- Status: Active
|
|
96
|
-
- Expiration: Synchronized with transaction
|
|
97
|
-
- Platform: Production only
|
|
98
|
-
|
|
99
|
-
**API Response:**
|
|
100
|
-
\`\`\`json
|
|
101
|
-
${JSON.stringify(result.data, null, 2)}
|
|
102
|
-
\`\`\`
|
|
103
|
-
|
|
104
|
-
**API Call Details:**
|
|
105
|
-
- Endpoint: GET ${result.requestInfo.url}
|
|
106
|
-
- Status: ${result.requestInfo.statusCode}
|
|
107
|
-
- Method: ${result.requestInfo.method}
|
|
108
|
-
|
|
109
|
-
**Usage:**
|
|
110
|
-
1. Share the web URL: \`${linkUrl}\`
|
|
111
|
-
2. On mobile devices, it will redirect to: \`payware:/${transactionId}\`
|
|
112
|
-
3. Link expires when the transaction expires
|
|
113
|
-
4. Use for P2P transaction notifications and sharing`
|
|
114
|
-
}]
|
|
115
|
-
};
|
|
116
|
-
} catch (error) {
|
|
117
|
-
return {
|
|
118
|
-
content: [{
|
|
119
|
-
type: "text",
|
|
120
|
-
text: `❌ **Failed to Get Transaction Deep Link (Payment Institution)**
|
|
121
|
-
|
|
122
|
-
**Error Details:**
|
|
123
|
-
- Transaction ID: ${transactionId}
|
|
124
|
-
- Message: ${error.message}
|
|
125
|
-
|
|
126
|
-
**Common Issues:**
|
|
127
|
-
1. **Transaction not found**: Check if transaction exists and is not expired
|
|
128
|
-
2. **Authentication failed**: Verify partner ID and private key
|
|
129
|
-
3. **Authorization failed**: Ensure PI is SRC or DST for this transaction
|
|
130
|
-
4. **Sandbox environment**: Deep links are production-only
|
|
131
|
-
5. **Invalid transaction ID**: Ensure transaction ID format is correct
|
|
132
|
-
|
|
133
|
-
**Troubleshooting:**
|
|
134
|
-
1. Verify transaction exists using \`payware_operations_get_transaction_status\`
|
|
135
|
-
2. Check if running in production environment
|
|
136
|
-
3. Ensure JWT authentication is working
|
|
137
|
-
4. Confirm payment institution role in transaction
|
|
138
|
-
5. Verify transaction is not expired`
|
|
139
|
-
}]
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|