@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,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Payment Institution Deep Links Tools
|
|
3
|
-
* Deep link management for payment institutions (transaction links only)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { getTransactionLinkTool } from './get-transaction-link.js';
|
|
7
|
-
import { deleteTransactionLinkTool } from './delete-transaction-link.js';
|
|
8
|
-
|
|
9
|
-
export const paymentInstitutionDeepLinksTools = [
|
|
10
|
-
getTransactionLinkTool,
|
|
11
|
-
deleteTransactionLinkTool
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
getTransactionLinkTool,
|
|
16
|
-
deleteTransactionLinkTool
|
|
17
|
-
};
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { createJWTToken } from '../../core/auth/jwt-token.js';
|
|
3
|
-
import { createJWTForPartner } from '../../core/auth/jwt-factory.js';
|
|
4
|
-
import { getProductionUrl } from '../../config/env.js';
|
|
5
|
-
import { describeApiError } from '../api-errors.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Create authentication headers based on partner type
|
|
9
|
-
* @param {string} partnerType - merchant, isv, or payment_institution
|
|
10
|
-
* @param {Object} authParams - Authentication parameters
|
|
11
|
-
* @returns {Object} Headers for API request
|
|
12
|
-
*/
|
|
13
|
-
async function createAuthHeaders(partnerType, authParams) {
|
|
14
|
-
const baseHeaders = {
|
|
15
|
-
'Content-Type': 'application/json',
|
|
16
|
-
'Api-Version': '1'
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
let tokenData;
|
|
20
|
-
|
|
21
|
-
switch (partnerType) {
|
|
22
|
-
case 'merchant':
|
|
23
|
-
case 'payment_institution':
|
|
24
|
-
// Standard JWT authentication
|
|
25
|
-
tokenData = createJWTToken(
|
|
26
|
-
authParams.partnerId,
|
|
27
|
-
authParams.privateKey,
|
|
28
|
-
authParams.requestBody || ''
|
|
29
|
-
);
|
|
30
|
-
break;
|
|
31
|
-
|
|
32
|
-
case 'isv':
|
|
33
|
-
// ISV JWT with OAuth2 - note the parameter mapping
|
|
34
|
-
tokenData = await createJWTForPartner({
|
|
35
|
-
partnerId: authParams.isvPartnerId,
|
|
36
|
-
privateKey: authParams.privateKey,
|
|
37
|
-
merchantId: authParams.merchantPartnerId, // Map merchantPartnerId to merchantId
|
|
38
|
-
oauth2Token: authParams.oauth2Token,
|
|
39
|
-
requestBody: authParams.requestBody || ''
|
|
40
|
-
});
|
|
41
|
-
break;
|
|
42
|
-
|
|
43
|
-
default:
|
|
44
|
-
throw new Error(`Unknown partner type: ${partnerType}`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
...baseHeaders,
|
|
49
|
-
'Authorization': `Bearer ${tokenData.token}`
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Get deep link for a transaction
|
|
55
|
-
* @param {Object} params - Parameters
|
|
56
|
-
* @param {string} params.transactionId - Transaction ID
|
|
57
|
-
* @param {string} params.partnerType - Partner type (merchant, isv, payment_institution)
|
|
58
|
-
* @param {Object} params.authParams - Authentication parameters
|
|
59
|
-
* @returns {Object} Deep link response
|
|
60
|
-
*/
|
|
61
|
-
export async function getTransactionDeepLink({
|
|
62
|
-
transactionId,
|
|
63
|
-
partnerType,
|
|
64
|
-
...authParams
|
|
65
|
-
}) {
|
|
66
|
-
if (!transactionId) {
|
|
67
|
-
throw new Error('transactionId is required');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const headers = await createAuthHeaders(partnerType, authParams);
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
const response = await axios.get(
|
|
74
|
-
`${getProductionUrl()}/transactions/${transactionId}/link`,
|
|
75
|
-
{ headers }
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
success: true,
|
|
80
|
-
data: response.data,
|
|
81
|
-
requestInfo: {
|
|
82
|
-
url: `${getProductionUrl()}/transactions/${transactionId}/link`,
|
|
83
|
-
method: 'GET',
|
|
84
|
-
statusCode: response.status
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
} catch (error) {
|
|
88
|
-
throw describeApiError(error, 'get transaction deep link');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Get deep link for a product
|
|
94
|
-
* @param {Object} params - Parameters
|
|
95
|
-
* @param {string} params.productId - Product ID
|
|
96
|
-
* @param {string} params.partnerType - Partner type (merchant, isv)
|
|
97
|
-
* @param {Object} params.authParams - Authentication parameters
|
|
98
|
-
* @returns {Object} Deep link response
|
|
99
|
-
*/
|
|
100
|
-
export async function getProductDeepLink({
|
|
101
|
-
productId,
|
|
102
|
-
partnerType,
|
|
103
|
-
...authParams
|
|
104
|
-
}) {
|
|
105
|
-
if (!productId) {
|
|
106
|
-
throw new Error('productId is required');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (partnerType === 'payment_institution') {
|
|
110
|
-
throw new Error('Payment institutions do not manage products');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const headers = await createAuthHeaders(partnerType, authParams);
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
const response = await axios.get(
|
|
117
|
-
`${getProductionUrl()}/products/${productId}/link`,
|
|
118
|
-
{ headers }
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
success: true,
|
|
123
|
-
data: response.data,
|
|
124
|
-
requestInfo: {
|
|
125
|
-
url: `${getProductionUrl()}/products/${productId}/link`,
|
|
126
|
-
method: 'GET',
|
|
127
|
-
statusCode: response.status
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
} catch (error) {
|
|
131
|
-
throw describeApiError(error, 'get product deep link');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Delete deep link for a transaction
|
|
137
|
-
* @param {Object} params - Parameters
|
|
138
|
-
* @param {string} params.transactionId - Transaction ID
|
|
139
|
-
* @param {string} params.partnerType - Partner type (merchant, isv, payment_institution)
|
|
140
|
-
* @param {Object} params.authParams - Authentication parameters
|
|
141
|
-
* @returns {Object} Delete response
|
|
142
|
-
*/
|
|
143
|
-
export async function deleteTransactionDeepLink({
|
|
144
|
-
transactionId,
|
|
145
|
-
partnerType,
|
|
146
|
-
...authParams
|
|
147
|
-
}) {
|
|
148
|
-
if (!transactionId) {
|
|
149
|
-
throw new Error('transactionId is required');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const headers = await createAuthHeaders(partnerType, authParams);
|
|
153
|
-
|
|
154
|
-
try {
|
|
155
|
-
const response = await axios.delete(
|
|
156
|
-
`${getProductionUrl()}/transactions/${transactionId}/link`,
|
|
157
|
-
{ headers }
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
return {
|
|
161
|
-
success: true,
|
|
162
|
-
data: response.data,
|
|
163
|
-
requestInfo: {
|
|
164
|
-
url: `${getProductionUrl()}/transactions/${transactionId}/link`,
|
|
165
|
-
method: 'DELETE',
|
|
166
|
-
statusCode: response.status
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
} catch (error) {
|
|
170
|
-
throw describeApiError(error, 'delete transaction deep link');
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Delete deep link for a product
|
|
176
|
-
* @param {Object} params - Parameters
|
|
177
|
-
* @param {string} params.productId - Product ID
|
|
178
|
-
* @param {string} params.partnerType - Partner type (merchant, isv)
|
|
179
|
-
* @param {Object} params.authParams - Authentication parameters
|
|
180
|
-
* @returns {Object} Delete response
|
|
181
|
-
*/
|
|
182
|
-
export async function deleteProductDeepLink({
|
|
183
|
-
productId,
|
|
184
|
-
partnerType,
|
|
185
|
-
...authParams
|
|
186
|
-
}) {
|
|
187
|
-
if (!productId) {
|
|
188
|
-
throw new Error('productId is required');
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (partnerType === 'payment_institution') {
|
|
192
|
-
throw new Error('Payment institutions do not manage products');
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const headers = await createAuthHeaders(partnerType, authParams);
|
|
196
|
-
|
|
197
|
-
try {
|
|
198
|
-
const response = await axios.delete(
|
|
199
|
-
`${getProductionUrl()}/products/${productId}/link`,
|
|
200
|
-
{ headers }
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
success: true,
|
|
205
|
-
data: response.data,
|
|
206
|
-
requestInfo: {
|
|
207
|
-
url: `${getProductionUrl()}/products/${productId}/link`,
|
|
208
|
-
method: 'DELETE',
|
|
209
|
-
statusCode: response.status
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
} catch (error) {
|
|
213
|
-
throw describeApiError(error, 'delete product deep link');
|
|
214
|
-
}
|
|
215
|
-
}
|