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