@agentwonderland/mcp 0.1.48 → 0.1.50
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/dist/core/__tests__/payments.test.js +21 -2
- package/dist/core/payments.js +3 -1
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/package.json +1 -1
- package/src/core/__tests__/payments.test.ts +34 -2
- package/src/core/payments.ts +5 -1
- package/src/core/version.ts +1 -1
|
@@ -124,15 +124,34 @@ describe("payment method initialization", () => {
|
|
|
124
124
|
networkId: "profile_test",
|
|
125
125
|
});
|
|
126
126
|
expect(mockCreateLinkSharedPaymentToken).toHaveBeenCalledWith(expect.objectContaining({
|
|
127
|
-
amount: "
|
|
127
|
+
amount: "2000",
|
|
128
128
|
currency: "usd",
|
|
129
129
|
networkId: "profile_test",
|
|
130
130
|
paymentMethodId: "csmrpd_link_123",
|
|
131
131
|
}));
|
|
132
132
|
const linkTokenRequest = mockCreateLinkSharedPaymentToken.mock.calls[0]?.[0];
|
|
133
|
-
expect(linkTokenRequest?.context).toContain("up to USD
|
|
133
|
+
expect(linkTokenRequest?.context).toContain("up to USD 20.00");
|
|
134
134
|
expect(linkTokenRequest?.context).toContain("quoted at USD 0.25");
|
|
135
135
|
});
|
|
136
|
+
it("allows a low env override while never approving below the quoted amount", async () => {
|
|
137
|
+
process.env.AGENTWONDERLAND_LINK_APPROVAL_LIMIT_CENTS = "10";
|
|
138
|
+
currentLink = {
|
|
139
|
+
paymentMethodId: "csmrpd_link_123",
|
|
140
|
+
label: "Visa ****4242",
|
|
141
|
+
};
|
|
142
|
+
const { getPaymentFetch } = await import("../payments.js");
|
|
143
|
+
await getPaymentFetch("link");
|
|
144
|
+
const stripeConfig = mockStripe.mock.calls[0]?.[0];
|
|
145
|
+
await stripeConfig.createToken({
|
|
146
|
+
amount: "25",
|
|
147
|
+
currency: "usd",
|
|
148
|
+
expiresAt: 1778290000,
|
|
149
|
+
networkId: "profile_test",
|
|
150
|
+
});
|
|
151
|
+
expect(mockCreateLinkSharedPaymentToken).toHaveBeenCalledWith(expect.objectContaining({
|
|
152
|
+
amount: "25",
|
|
153
|
+
}));
|
|
154
|
+
});
|
|
136
155
|
it("advertises Link as Stripe SPT compatibility", async () => {
|
|
137
156
|
currentLink = {
|
|
138
157
|
paymentMethodId: "csmrpd_link_123",
|
package/dist/core/payments.js
CHANGED
|
@@ -26,7 +26,7 @@ const REGISTRY_METHOD_MAP = {
|
|
|
26
26
|
card: "stripe_card",
|
|
27
27
|
link: "stripe_card",
|
|
28
28
|
};
|
|
29
|
-
const DEFAULT_LINK_APPROVAL_LIMIT_CENTS =
|
|
29
|
+
const DEFAULT_LINK_APPROVAL_LIMIT_CENTS = 2_000;
|
|
30
30
|
const ACCEPTED_PAYMENT_ALIASES = {
|
|
31
31
|
tempo: ["tempo_usdc", "tempo"],
|
|
32
32
|
base: ["base_usdc", "base"],
|
|
@@ -189,6 +189,8 @@ async function initLink() {
|
|
|
189
189
|
paymentMethod: linkConfig.paymentMethodId,
|
|
190
190
|
createToken: async (params) => {
|
|
191
191
|
const approvalAmount = getLinkApprovalLimitAmount(params.amount);
|
|
192
|
+
console.error(`Requesting Link approval up to ${formatMinorCurrencyAmount(params.currency, approvalAmount)} ` +
|
|
193
|
+
`for this ${formatMinorCurrencyAmount(params.currency, params.amount)} Agent Wonderland run.`);
|
|
192
194
|
return createLinkSharedPaymentToken({
|
|
193
195
|
amount: approvalAmount,
|
|
194
196
|
currency: params.currency,
|
package/dist/core/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MCP_PACKAGE_VERSION = "0.1.
|
|
1
|
+
export declare const MCP_PACKAGE_VERSION = "0.1.50";
|
package/dist/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const MCP_PACKAGE_VERSION = "0.1.
|
|
1
|
+
export const MCP_PACKAGE_VERSION = "0.1.50";
|
package/package.json
CHANGED
|
@@ -166,17 +166,49 @@ describe("payment method initialization", () => {
|
|
|
166
166
|
|
|
167
167
|
expect(mockCreateLinkSharedPaymentToken).toHaveBeenCalledWith(
|
|
168
168
|
expect.objectContaining({
|
|
169
|
-
amount: "
|
|
169
|
+
amount: "2000",
|
|
170
170
|
currency: "usd",
|
|
171
171
|
networkId: "profile_test",
|
|
172
172
|
paymentMethodId: "csmrpd_link_123",
|
|
173
173
|
}),
|
|
174
174
|
);
|
|
175
175
|
const linkTokenRequest = mockCreateLinkSharedPaymentToken.mock.calls[0]?.[0] as { context: string } | undefined;
|
|
176
|
-
expect(linkTokenRequest?.context).toContain("up to USD
|
|
176
|
+
expect(linkTokenRequest?.context).toContain("up to USD 20.00");
|
|
177
177
|
expect(linkTokenRequest?.context).toContain("quoted at USD 0.25");
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
+
it("allows a low env override while never approving below the quoted amount", async () => {
|
|
181
|
+
process.env.AGENTWONDERLAND_LINK_APPROVAL_LIMIT_CENTS = "10";
|
|
182
|
+
currentLink = {
|
|
183
|
+
paymentMethodId: "csmrpd_link_123",
|
|
184
|
+
label: "Visa ****4242",
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const { getPaymentFetch } = await import("../payments.js");
|
|
188
|
+
await getPaymentFetch("link");
|
|
189
|
+
|
|
190
|
+
const stripeConfig = mockStripe.mock.calls[0]?.[0] as {
|
|
191
|
+
createToken: (params: {
|
|
192
|
+
amount: string;
|
|
193
|
+
currency: string;
|
|
194
|
+
expiresAt: number;
|
|
195
|
+
networkId: string;
|
|
196
|
+
}) => Promise<string>;
|
|
197
|
+
};
|
|
198
|
+
await stripeConfig.createToken({
|
|
199
|
+
amount: "25",
|
|
200
|
+
currency: "usd",
|
|
201
|
+
expiresAt: 1778290000,
|
|
202
|
+
networkId: "profile_test",
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
expect(mockCreateLinkSharedPaymentToken).toHaveBeenCalledWith(
|
|
206
|
+
expect.objectContaining({
|
|
207
|
+
amount: "25",
|
|
208
|
+
}),
|
|
209
|
+
);
|
|
210
|
+
});
|
|
211
|
+
|
|
180
212
|
it("advertises Link as Stripe SPT compatibility", async () => {
|
|
181
213
|
currentLink = {
|
|
182
214
|
paymentMethodId: "csmrpd_link_123",
|
package/src/core/payments.ts
CHANGED
|
@@ -41,7 +41,7 @@ const REGISTRY_METHOD_MAP: Record<string, string> = {
|
|
|
41
41
|
link: "stripe_card",
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const DEFAULT_LINK_APPROVAL_LIMIT_CENTS =
|
|
44
|
+
const DEFAULT_LINK_APPROVAL_LIMIT_CENTS = 2_000;
|
|
45
45
|
|
|
46
46
|
const ACCEPTED_PAYMENT_ALIASES: Record<string, string[]> = {
|
|
47
47
|
tempo: ["tempo_usdc", "tempo"],
|
|
@@ -240,6 +240,10 @@ async function initLink(): Promise<typeof fetch | null> {
|
|
|
240
240
|
metadata?: Record<string, string>;
|
|
241
241
|
}) => {
|
|
242
242
|
const approvalAmount = getLinkApprovalLimitAmount(params.amount);
|
|
243
|
+
console.error(
|
|
244
|
+
`Requesting Link approval up to ${formatMinorCurrencyAmount(params.currency, approvalAmount)} ` +
|
|
245
|
+
`for this ${formatMinorCurrencyAmount(params.currency, params.amount)} Agent Wonderland run.`,
|
|
246
|
+
);
|
|
243
247
|
return createLinkSharedPaymentToken({
|
|
244
248
|
amount: approvalAmount,
|
|
245
249
|
currency: params.currency,
|
package/src/core/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const MCP_PACKAGE_VERSION = "0.1.
|
|
1
|
+
export const MCP_PACKAGE_VERSION = "0.1.50";
|