mppx 0.1.1 → 0.2.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/dist/Challenge.d.ts +18 -18
- package/dist/Challenge.d.ts.map +1 -1
- package/dist/Challenge.js +8 -8
- package/dist/Challenge.js.map +1 -1
- package/dist/Errors.d.ts +58 -8
- package/dist/Errors.d.ts.map +1 -1
- package/dist/Errors.js +51 -9
- package/dist/Errors.js.map +1 -1
- package/dist/Method.d.ts +154 -0
- package/dist/Method.d.ts.map +1 -0
- package/dist/Method.js +81 -0
- package/dist/Method.js.map +1 -0
- package/dist/PaymentRequest.d.ts +5 -5
- package/dist/PaymentRequest.d.ts.map +1 -1
- package/dist/PaymentRequest.js +11 -6
- package/dist/PaymentRequest.js.map +1 -1
- package/dist/cli.js +67 -18
- package/dist/cli.js.map +1 -1
- package/dist/client/Methods.d.ts +2 -2
- package/dist/client/Methods.d.ts.map +1 -1
- package/dist/client/Methods.js +2 -2
- package/dist/client/Methods.js.map +1 -1
- package/dist/client/Mppx.d.ts +7 -7
- package/dist/client/Mppx.d.ts.map +1 -1
- package/dist/client/Mppx.js +3 -3
- package/dist/client/Mppx.js.map +1 -1
- package/dist/client/internal/Fetch.d.ts +10 -10
- package/dist/client/internal/Fetch.d.ts.map +1 -1
- package/dist/client/internal/Fetch.js +2 -2
- package/dist/client/internal/Fetch.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp-sdk/client/McpClient.d.ts +6 -6
- package/dist/mcp-sdk/client/McpClient.d.ts.map +1 -1
- package/dist/mcp-sdk/client/McpClient.js +4 -4
- package/dist/mcp-sdk/client/McpClient.js.map +1 -1
- package/dist/middlewares/elysia.d.ts +1 -1
- package/dist/middlewares/express.d.ts +1 -1
- package/dist/middlewares/hono.d.ts +1 -1
- package/dist/middlewares/internal/mppx.d.ts +7 -7
- package/dist/middlewares/internal/mppx.d.ts.map +1 -1
- package/dist/middlewares/internal/mppx.js +5 -5
- package/dist/middlewares/internal/mppx.js.map +1 -1
- package/dist/middlewares/nextjs.d.ts +1 -1
- package/dist/proxy/Service.js +2 -2
- package/dist/proxy/Service.js.map +1 -1
- package/dist/server/Methods.d.ts +2 -2
- package/dist/server/Methods.d.ts.map +1 -1
- package/dist/server/Methods.js +2 -2
- package/dist/server/Methods.js.map +1 -1
- package/dist/server/Mppx.d.ts +17 -17
- package/dist/server/Mppx.d.ts.map +1 -1
- package/dist/server/Mppx.js +9 -9
- package/dist/server/Mppx.js.map +1 -1
- package/dist/stripe/{Intents.d.ts → Methods.d.ts} +22 -22
- package/dist/stripe/Methods.d.ts.map +1 -0
- package/dist/stripe/Methods.js +42 -0
- package/dist/stripe/Methods.js.map +1 -0
- package/dist/stripe/client/Charge.d.ts +40 -27
- package/dist/stripe/client/Charge.d.ts.map +1 -1
- package/dist/stripe/client/Charge.js +15 -7
- package/dist/stripe/client/Charge.js.map +1 -1
- package/dist/stripe/client/{MethodIntents.d.ts → Methods.d.ts} +24 -23
- package/dist/stripe/client/Methods.d.ts.map +1 -0
- package/dist/stripe/client/{MethodIntents.js → Methods.js} +3 -3
- package/dist/stripe/client/Methods.js.map +1 -0
- package/dist/stripe/client/index.d.ts +1 -1
- package/dist/stripe/client/index.d.ts.map +1 -1
- package/dist/stripe/client/index.js +1 -1
- package/dist/stripe/client/index.js.map +1 -1
- package/dist/stripe/index.d.ts +1 -1
- package/dist/stripe/index.d.ts.map +1 -1
- package/dist/stripe/index.js +1 -1
- package/dist/stripe/index.js.map +1 -1
- package/dist/stripe/internal/types.d.ts +25 -0
- package/dist/stripe/internal/types.d.ts.map +1 -0
- package/dist/stripe/internal/types.js +2 -0
- package/dist/stripe/internal/types.js.map +1 -0
- package/dist/stripe/server/Charge.d.ts +47 -28
- package/dist/stripe/server/Charge.d.ts.map +1 -1
- package/dist/stripe/server/Charge.js +90 -32
- package/dist/stripe/server/Charge.js.map +1 -1
- package/dist/stripe/server/{MethodIntents.d.ts → Methods.d.ts} +24 -23
- package/dist/stripe/server/Methods.d.ts.map +1 -0
- package/dist/stripe/server/{MethodIntents.js → Methods.js} +3 -3
- package/dist/stripe/server/Methods.js.map +1 -0
- package/dist/stripe/server/index.d.ts +1 -1
- package/dist/stripe/server/index.d.ts.map +1 -1
- package/dist/stripe/server/index.js +1 -1
- package/dist/stripe/server/index.js.map +1 -1
- package/dist/tempo/{Intents.d.ts → Methods.d.ts} +72 -69
- package/dist/tempo/Methods.d.ts.map +1 -0
- package/dist/tempo/Methods.js +118 -0
- package/dist/tempo/Methods.js.map +1 -0
- package/dist/tempo/client/ChannelOps.d.ts +1 -1
- package/dist/tempo/client/ChannelOps.js +1 -1
- package/dist/tempo/client/Charge.d.ts +25 -25
- package/dist/tempo/client/Charge.d.ts.map +1 -1
- package/dist/tempo/client/Charge.js +3 -3
- package/dist/tempo/client/Charge.js.map +1 -1
- package/dist/tempo/client/{MethodIntents.d.ts → Methods.d.ts} +74 -70
- package/dist/tempo/client/Methods.d.ts.map +1 -0
- package/dist/tempo/client/{MethodIntents.js → Methods.js} +3 -3
- package/dist/tempo/client/Methods.js.map +1 -0
- package/dist/tempo/client/Session.d.ts +49 -45
- package/dist/tempo/client/Session.d.ts.map +1 -1
- package/dist/tempo/client/Session.js +4 -4
- package/dist/tempo/client/Session.js.map +1 -1
- package/dist/tempo/client/SessionManager.d.ts +1 -1
- package/dist/tempo/client/SessionManager.js +1 -1
- package/dist/tempo/client/index.d.ts +1 -1
- package/dist/tempo/client/index.d.ts.map +1 -1
- package/dist/tempo/client/index.js +1 -1
- package/dist/tempo/client/index.js.map +1 -1
- package/dist/tempo/index.d.ts +1 -1
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +1 -1
- package/dist/tempo/index.js.map +1 -1
- package/dist/tempo/server/Charge.d.ts +27 -27
- package/dist/tempo/server/Charge.d.ts.map +1 -1
- package/dist/tempo/server/Charge.js +3 -3
- package/dist/tempo/server/Charge.js.map +1 -1
- package/dist/tempo/server/{MethodIntents.d.ts → Methods.d.ts} +73 -69
- package/dist/tempo/server/Methods.d.ts.map +1 -0
- package/dist/tempo/server/{MethodIntents.js → Methods.js} +4 -4
- package/dist/tempo/server/Methods.js.map +1 -0
- package/dist/tempo/server/Session.d.ts +51 -47
- package/dist/tempo/server/Session.d.ts.map +1 -1
- package/dist/tempo/server/Session.js +4 -4
- package/dist/tempo/server/Session.js.map +1 -1
- package/dist/tempo/server/index.d.ts +6 -0
- package/dist/tempo/server/index.d.ts.map +1 -0
- package/dist/tempo/server/index.js +6 -0
- package/dist/tempo/server/index.js.map +1 -0
- package/package.json +2 -1
- package/src/Challenge.test-d.ts +3 -3
- package/src/Challenge.test.ts +7 -7
- package/src/Challenge.ts +34 -34
- package/src/Errors.test.ts +75 -21
- package/src/Errors.ts +74 -9
- package/src/Method.test.ts +76 -0
- package/src/Method.ts +228 -0
- package/src/PaymentRequest.test.ts +5 -5
- package/src/PaymentRequest.ts +15 -10
- package/src/cli.test.ts +12 -22
- package/src/cli.ts +74 -21
- package/src/client/Methods.ts +2 -2
- package/src/client/Mppx.test-d.ts +6 -6
- package/src/client/Mppx.test.ts +26 -22
- package/src/client/Mppx.ts +10 -10
- package/src/client/Transport.test.ts +6 -6
- package/src/client/internal/Fetch.ts +21 -24
- package/src/index.ts +1 -2
- package/src/mcp-sdk/client/McpClient.test.ts +1 -1
- package/src/mcp-sdk/client/McpClient.ts +11 -13
- package/src/middlewares/elysia.ts +1 -1
- package/src/middlewares/express.ts +1 -1
- package/src/middlewares/hono.ts +1 -1
- package/src/middlewares/internal/mppx.ts +10 -10
- package/src/middlewares/nextjs.ts +1 -1
- package/src/proxy/Service.ts +2 -2
- package/src/server/Methods.ts +2 -2
- package/src/server/Mppx.test-d.ts +27 -29
- package/src/server/Mppx.test.ts +23 -19
- package/src/server/Mppx.ts +43 -43
- package/src/server/Transport.test.ts +8 -8
- package/src/stripe/{Intents.test.ts → Methods.test.ts} +12 -12
- package/src/stripe/Methods.ts +45 -0
- package/src/stripe/client/Charge.test.ts +189 -0
- package/src/stripe/client/Charge.ts +29 -16
- package/src/stripe/client/{MethodIntents.ts → Methods.ts} +2 -2
- package/src/stripe/client/index.ts +1 -1
- package/src/stripe/index.ts +1 -1
- package/src/stripe/internal/types.ts +22 -0
- package/src/stripe/server/Charge.test.ts +241 -0
- package/src/stripe/server/Charge.ts +124 -38
- package/src/stripe/server/{MethodIntents.ts → Methods.ts} +2 -2
- package/src/stripe/server/index.ts +1 -1
- package/src/tempo/{Intents.test.ts → Methods.test.ts} +15 -15
- package/src/tempo/{Intents.ts → Methods.ts} +77 -22
- package/src/tempo/client/ChannelOps.ts +1 -1
- package/src/tempo/client/Charge.ts +3 -3
- package/src/tempo/client/{MethodIntents.ts → Methods.ts} +2 -2
- package/src/tempo/client/Session.ts +4 -4
- package/src/tempo/client/SessionManager.ts +1 -1
- package/src/tempo/client/index.ts +1 -1
- package/src/tempo/index.ts +1 -1
- package/src/tempo/server/Charge.ts +4 -7
- package/src/tempo/server/{MethodIntents.ts → Methods.ts} +3 -3
- package/src/tempo/server/Session.test.ts +4 -7
- package/src/tempo/server/Session.ts +6 -6
- package/src/tempo/server/index.ts +1 -1
- package/dist/Intent.d.ts +0 -101
- package/dist/Intent.d.ts.map +0 -1
- package/dist/Intent.js +0 -83
- package/dist/Intent.js.map +0 -1
- package/dist/MethodIntent.d.ts +0 -225
- package/dist/MethodIntent.d.ts.map +0 -1
- package/dist/MethodIntent.js +0 -156
- package/dist/MethodIntent.js.map +0 -1
- package/dist/stripe/Intents.d.ts.map +0 -1
- package/dist/stripe/Intents.js +0 -27
- package/dist/stripe/Intents.js.map +0 -1
- package/dist/stripe/client/MethodIntents.d.ts.map +0 -1
- package/dist/stripe/client/MethodIntents.js.map +0 -1
- package/dist/stripe/server/MethodIntents.d.ts.map +0 -1
- package/dist/stripe/server/MethodIntents.js.map +0 -1
- package/dist/tempo/Intents.d.ts.map +0 -1
- package/dist/tempo/Intents.js +0 -81
- package/dist/tempo/Intents.js.map +0 -1
- package/dist/tempo/client/MethodIntents.d.ts.map +0 -1
- package/dist/tempo/client/MethodIntents.js.map +0 -1
- package/dist/tempo/server/MethodIntents.d.ts.map +0 -1
- package/dist/tempo/server/MethodIntents.js.map +0 -1
- package/src/Intent.test.ts +0 -180
- package/src/Intent.ts +0 -109
- package/src/MethodIntent.test.ts +0 -303
- package/src/MethodIntent.ts +0 -388
- package/src/stripe/Intents.ts +0 -27
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type * as Challenge from '../../Challenge.js';
|
|
2
|
-
import * as
|
|
2
|
+
import * as Method from '../../Method.js';
|
|
3
3
|
import * as z from '../../zod.js';
|
|
4
|
-
import
|
|
4
|
+
import type { StripeJs } from '../internal/types.js';
|
|
5
|
+
import * as Methods from '../Methods.js';
|
|
5
6
|
/**
|
|
6
7
|
* Creates a Stripe charge method intent for usage on the client.
|
|
7
8
|
*
|
|
@@ -12,11 +13,18 @@ import * as Intents from '../Intents.js';
|
|
|
12
13
|
* The `paymentMethod` (e.g. from Stripe Elements) can be provided at
|
|
13
14
|
* initialization or at credential-creation time via `context`.
|
|
14
15
|
*
|
|
16
|
+
* Optionally accepts a `client` (a Stripe.js instance from `@stripe/stripe-js`)
|
|
17
|
+
* which is forwarded to the `createToken` callback for use with Elements.
|
|
18
|
+
*
|
|
15
19
|
* @example
|
|
16
20
|
* ```ts
|
|
21
|
+
* import { loadStripe } from '@stripe/stripe-js'
|
|
17
22
|
* import { stripe } from 'mppx/client'
|
|
18
23
|
*
|
|
24
|
+
* const stripeJs = await loadStripe('pk_...')
|
|
25
|
+
*
|
|
19
26
|
* const charge = stripe.charge({
|
|
27
|
+
* client: stripeJs,
|
|
20
28
|
* createToken: async ({ amount, currency, expiresAt, metadata, networkId, paymentMethod }) => {
|
|
21
29
|
* const res = await fetch('/api/create-spt', {
|
|
22
30
|
* method: 'POST',
|
|
@@ -29,9 +37,16 @@ import * as Intents from '../Intents.js';
|
|
|
29
37
|
* })
|
|
30
38
|
* ```
|
|
31
39
|
*/
|
|
32
|
-
export declare function charge(parameters: charge.Parameters):
|
|
33
|
-
readonly name: "
|
|
40
|
+
export declare function charge(parameters: charge.Parameters): Method.Client<{
|
|
41
|
+
readonly name: "stripe";
|
|
42
|
+
readonly intent: "charge";
|
|
34
43
|
readonly schema: {
|
|
44
|
+
readonly credential: {
|
|
45
|
+
readonly payload: z.ZodMiniObject<{
|
|
46
|
+
externalId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
47
|
+
spt: z.ZodMiniString<string>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
};
|
|
35
50
|
readonly request: z.ZodMiniPipe<z.ZodMiniObject<{
|
|
36
51
|
amount: z.ZodMiniString<string>;
|
|
37
52
|
currency: z.ZodMiniString<string>;
|
|
@@ -39,9 +54,17 @@ export declare function charge(parameters: charge.Parameters): MethodIntent.Clie
|
|
|
39
54
|
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
40
55
|
expires: z.ZodMiniDefault<z.ZodMiniString<string>>;
|
|
41
56
|
externalId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
57
|
+
metadata: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
58
|
+
networkId: z.ZodMiniString<string>;
|
|
59
|
+
paymentMethodTypes: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
42
60
|
recipient: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
43
61
|
}, z.core.$strip>, z.ZodMiniTransform<{
|
|
44
62
|
amount: string;
|
|
63
|
+
methodDetails: {
|
|
64
|
+
metadata?: Record<string, string> | undefined;
|
|
65
|
+
networkId: string;
|
|
66
|
+
paymentMethodTypes: string[];
|
|
67
|
+
};
|
|
45
68
|
currency: string;
|
|
46
69
|
expires: string;
|
|
47
70
|
description?: string | undefined;
|
|
@@ -52,33 +75,21 @@ export declare function charge(parameters: charge.Parameters): MethodIntent.Clie
|
|
|
52
75
|
currency: string;
|
|
53
76
|
decimals: number;
|
|
54
77
|
expires: string;
|
|
78
|
+
networkId: string;
|
|
79
|
+
paymentMethodTypes: string[];
|
|
55
80
|
description?: string | undefined;
|
|
56
81
|
externalId?: string | undefined;
|
|
82
|
+
metadata?: Record<string, string> | undefined;
|
|
57
83
|
recipient?: string | undefined;
|
|
58
84
|
}>>;
|
|
59
85
|
};
|
|
60
|
-
}, {
|
|
61
|
-
readonly method: "stripe";
|
|
62
|
-
readonly schema: {
|
|
63
|
-
readonly credential: {
|
|
64
|
-
readonly payload: z.ZodMiniObject<{
|
|
65
|
-
spt: z.ZodMiniString<string>;
|
|
66
|
-
externalId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
67
|
-
}, z.core.$strip>;
|
|
68
|
-
};
|
|
69
|
-
readonly request: {
|
|
70
|
-
readonly methodDetails: z.ZodMiniObject<{
|
|
71
|
-
networkId: z.ZodMiniString<string>;
|
|
72
|
-
paymentMethodTypes: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
73
|
-
metadata: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
74
|
-
}, z.core.$strip>;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
}>, z.ZodMiniObject<{
|
|
86
|
+
}, z.ZodMiniObject<{
|
|
78
87
|
paymentMethod: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
79
88
|
}, z.core.$strip>>;
|
|
80
89
|
export declare namespace charge {
|
|
81
90
|
type Parameters = {
|
|
91
|
+
/** Stripe.js instance from `@stripe/stripe-js`. Forwarded to `createToken` for use with Elements. */
|
|
92
|
+
client?: StripeJs | undefined;
|
|
82
93
|
/** Called when a Stripe challenge is received. Create an SPT to retry. */
|
|
83
94
|
createToken: (parameters: OnChallengeParameters) => Promise<string>;
|
|
84
95
|
/** Optional client-side external reference ID for the credential payload. */
|
|
@@ -87,19 +98,21 @@ export declare namespace charge {
|
|
|
87
98
|
paymentMethod?: string | undefined;
|
|
88
99
|
};
|
|
89
100
|
type OnChallengeParameters = {
|
|
90
|
-
challenge: Challenge.Challenge<z.output<typeof Intents.charge.schema.request>, typeof Intents.charge.name, typeof Intents.charge.method>;
|
|
91
|
-
/** Stripe payment method ID (e.g. from Stripe Elements). */
|
|
92
|
-
paymentMethod?: string | undefined;
|
|
93
101
|
/** Payment amount (in smallest currency unit). */
|
|
94
102
|
amount: string;
|
|
103
|
+
challenge: Challenge.Challenge<z.output<typeof Methods.charge.schema.request>, typeof Methods.charge.intent, typeof Methods.charge.name>;
|
|
104
|
+
/** Stripe.js instance, if provided to `stripe.charge()`. */
|
|
105
|
+
client?: StripeJs | undefined;
|
|
95
106
|
/** Three-letter ISO currency code. */
|
|
96
107
|
currency: string;
|
|
97
|
-
/** Stripe Business Network profile ID. */
|
|
98
|
-
networkId: string | undefined;
|
|
99
108
|
/** SPT expiration as a Unix timestamp (seconds). */
|
|
100
109
|
expiresAt: number;
|
|
101
110
|
/** Optional metadata to associate with the SPT. */
|
|
102
111
|
metadata?: Record<string, string> | undefined;
|
|
112
|
+
/** Stripe Business Network profile ID. */
|
|
113
|
+
networkId: string | undefined;
|
|
114
|
+
/** Stripe payment method ID (e.g. from Stripe Elements). */
|
|
115
|
+
paymentMethod?: string | undefined;
|
|
103
116
|
};
|
|
104
117
|
}
|
|
105
118
|
//# sourceMappingURL=Charge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Charge.d.ts","sourceRoot":"","sources":["../../../src/stripe/client/Charge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAEpD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Charge.d.ts","sourceRoot":"","sources":["../../../src/stripe/client/Charge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAEpD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAmDnD;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,KAAK,UAAU,GAAG;QAChB,qGAAqG;QACrG,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;QAC7B,0EAA0E;QAC1E,WAAW,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;QACnE,6EAA6E;QAC7E,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC/B,wEAAwE;QACxE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACnC,CAAA;IAED,KAAK,qBAAqB,GAAG;QAC3B,kDAAkD;QAClD,MAAM,EAAE,MAAM,CAAA;QACd,SAAS,EAAE,SAAS,CAAC,SAAS,CAC5B,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAC9C,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,EAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAC3B,CAAA;QACD,4DAA4D;QAC5D,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;QAC7B,sCAAsC;QACtC,QAAQ,EAAE,MAAM,CAAA;QAChB,oDAAoD;QACpD,SAAS,EAAE,MAAM,CAAA;QACjB,mDAAmD;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;QAC7C,0CAA0C;QAC1C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;QAC7B,4DAA4D;QAC5D,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACnC,CAAA;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Credential from '../../Credential.js';
|
|
2
|
-
import * as
|
|
2
|
+
import * as Method from '../../Method.js';
|
|
3
3
|
import * as z from '../../zod.js';
|
|
4
|
-
import * as
|
|
4
|
+
import * as Methods from '../Methods.js';
|
|
5
5
|
/**
|
|
6
6
|
* Creates a Stripe charge method intent for usage on the client.
|
|
7
7
|
*
|
|
@@ -12,11 +12,18 @@ import * as Intents from '../Intents.js';
|
|
|
12
12
|
* The `paymentMethod` (e.g. from Stripe Elements) can be provided at
|
|
13
13
|
* initialization or at credential-creation time via `context`.
|
|
14
14
|
*
|
|
15
|
+
* Optionally accepts a `client` (a Stripe.js instance from `@stripe/stripe-js`)
|
|
16
|
+
* which is forwarded to the `createToken` callback for use with Elements.
|
|
17
|
+
*
|
|
15
18
|
* @example
|
|
16
19
|
* ```ts
|
|
20
|
+
* import { loadStripe } from '@stripe/stripe-js'
|
|
17
21
|
* import { stripe } from 'mppx/client'
|
|
18
22
|
*
|
|
23
|
+
* const stripeJs = await loadStripe('pk_...')
|
|
24
|
+
*
|
|
19
25
|
* const charge = stripe.charge({
|
|
26
|
+
* client: stripeJs,
|
|
20
27
|
* createToken: async ({ amount, currency, expiresAt, metadata, networkId, paymentMethod }) => {
|
|
21
28
|
* const res = await fetch('/api/create-spt', {
|
|
22
29
|
* method: 'POST',
|
|
@@ -30,8 +37,8 @@ import * as Intents from '../Intents.js';
|
|
|
30
37
|
* ```
|
|
31
38
|
*/
|
|
32
39
|
export function charge(parameters) {
|
|
33
|
-
const { createToken, externalId, paymentMethod: defaultPaymentMethod } = parameters;
|
|
34
|
-
return
|
|
40
|
+
const { client, createToken, externalId, paymentMethod: defaultPaymentMethod } = parameters;
|
|
41
|
+
return Method.toClient(Methods.charge, {
|
|
35
42
|
context: z.object({
|
|
36
43
|
paymentMethod: z.optional(z.string()),
|
|
37
44
|
}),
|
|
@@ -53,13 +60,14 @@ export function charge(parameters) {
|
|
|
53
60
|
? Math.floor(new Date(challenge.request.expires).getTime() / 1000)
|
|
54
61
|
: Math.floor(Date.now() / 1000) + 3600;
|
|
55
62
|
const spt = await createToken({
|
|
56
|
-
challenge,
|
|
57
|
-
paymentMethod,
|
|
58
63
|
amount,
|
|
64
|
+
challenge,
|
|
65
|
+
client,
|
|
59
66
|
currency,
|
|
60
|
-
networkId,
|
|
61
67
|
expiresAt,
|
|
62
68
|
metadata,
|
|
69
|
+
networkId,
|
|
70
|
+
paymentMethod,
|
|
63
71
|
});
|
|
64
72
|
return Credential.serialize({
|
|
65
73
|
challenge,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Charge.js","sourceRoot":"","sources":["../../../src/stripe/client/Charge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Charge.js","sourceRoot":"","sources":["../../../src/stripe/client/Charge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAEjC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,MAAM,CAAC,UAA6B;IAClD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,UAAU,CAAA;IAE3F,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE;QACrC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YAChB,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACtC,CAAC;QAEF,KAAK,CAAC,gBAAgB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;YAC3C,MAAM,aAAa,GAAG,OAAO,EAAE,aAAa,IAAI,oBAAoB,CAAA;YACpE,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAA;YAC/E,CAAC;YAED,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,MAAgB,CAAA;YACjD,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAkB,CAAA;YACrD,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,SAA+B,CAAA;YAClF,IAAI,CAAC,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;YACnF,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,QAErC,CAAA;YACb,IAAI,QAAQ,EAAE,UAAU,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;YACH,CAAC;YAED,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO;gBACzC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAiB,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;gBAC5E,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;YAExC,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC;gBAC5B,MAAM;gBACN,SAAS;gBACT,MAAM;gBACN,QAAQ;gBACR,SAAS;gBACT,QAAQ;gBACR,SAAS;gBACT,aAAa;aACd,CAAC,CAAA;YAEF,OAAO,UAAU,CAAC,SAAS,CAAC;gBAC1B,SAAS;gBACT,OAAO,EAAE;oBACP,GAAG;oBACH,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACtC;aACF,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { charge as charge_ } from './Charge.js';
|
|
2
2
|
/**
|
|
3
|
-
* Creates a Stripe `charge` client method
|
|
3
|
+
* Creates a Stripe `charge` client method.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
@@ -24,9 +24,16 @@ import { charge as charge_ } from './Charge.js';
|
|
|
24
24
|
* })
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export declare function stripe(parameters: stripe.Parameters): readonly [import("../../
|
|
28
|
-
readonly name: "
|
|
27
|
+
export declare function stripe(parameters: stripe.Parameters): readonly [import("../../Method.js").Client<{
|
|
28
|
+
readonly name: "stripe";
|
|
29
|
+
readonly intent: "charge";
|
|
29
30
|
readonly schema: {
|
|
31
|
+
readonly credential: {
|
|
32
|
+
readonly payload: import("zod/mini").ZodMiniObject<{
|
|
33
|
+
externalId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
34
|
+
spt: import("zod/mini").ZodMiniString<string>;
|
|
35
|
+
}, import("zod/v4/core").$strip>;
|
|
36
|
+
};
|
|
30
37
|
readonly request: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniObject<{
|
|
31
38
|
amount: import("zod/mini").ZodMiniString<string>;
|
|
32
39
|
currency: import("zod/mini").ZodMiniString<string>;
|
|
@@ -34,9 +41,17 @@ export declare function stripe(parameters: stripe.Parameters): readonly [import(
|
|
|
34
41
|
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
35
42
|
expires: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniString<string>>;
|
|
36
43
|
externalId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
44
|
+
metadata: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniRecord<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniString<string>>>;
|
|
45
|
+
networkId: import("zod/mini").ZodMiniString<string>;
|
|
46
|
+
paymentMethodTypes: import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniString<string>>;
|
|
37
47
|
recipient: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
38
48
|
}, import("zod/v4/core").$strip>, import("zod/mini").ZodMiniTransform<{
|
|
39
49
|
amount: string;
|
|
50
|
+
methodDetails: {
|
|
51
|
+
metadata?: Record<string, string> | undefined;
|
|
52
|
+
networkId: string;
|
|
53
|
+
paymentMethodTypes: string[];
|
|
54
|
+
};
|
|
40
55
|
currency: string;
|
|
41
56
|
expires: string;
|
|
42
57
|
description?: string | undefined;
|
|
@@ -47,34 +62,20 @@ export declare function stripe(parameters: stripe.Parameters): readonly [import(
|
|
|
47
62
|
currency: string;
|
|
48
63
|
decimals: number;
|
|
49
64
|
expires: string;
|
|
65
|
+
networkId: string;
|
|
66
|
+
paymentMethodTypes: string[];
|
|
50
67
|
description?: string | undefined;
|
|
51
68
|
externalId?: string | undefined;
|
|
69
|
+
metadata?: Record<string, string> | undefined;
|
|
52
70
|
recipient?: string | undefined;
|
|
53
71
|
}>>;
|
|
54
72
|
};
|
|
55
|
-
}, {
|
|
56
|
-
readonly method: "stripe";
|
|
57
|
-
readonly schema: {
|
|
58
|
-
readonly credential: {
|
|
59
|
-
readonly payload: import("zod/mini").ZodMiniObject<{
|
|
60
|
-
spt: import("zod/mini").ZodMiniString<string>;
|
|
61
|
-
externalId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
62
|
-
}, import("zod/v4/core").$strip>;
|
|
63
|
-
};
|
|
64
|
-
readonly request: {
|
|
65
|
-
readonly methodDetails: import("zod/mini").ZodMiniObject<{
|
|
66
|
-
networkId: import("zod/mini").ZodMiniString<string>;
|
|
67
|
-
paymentMethodTypes: import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniString<string>>;
|
|
68
|
-
metadata: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniRecord<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniString<string>>>;
|
|
69
|
-
}, import("zod/v4/core").$strip>;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
}>, import("zod/mini").ZodMiniObject<{
|
|
73
|
+
}, import("zod/mini").ZodMiniObject<{
|
|
73
74
|
paymentMethod: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
74
75
|
}, import("zod/v4/core").$strip>>];
|
|
75
76
|
export declare namespace stripe {
|
|
76
77
|
type Parameters = charge_.Parameters;
|
|
77
|
-
/** Creates a Stripe `charge` client method
|
|
78
|
+
/** Creates a Stripe `charge` client method for SPT-based payments. */
|
|
78
79
|
const charge: typeof charge_;
|
|
79
80
|
}
|
|
80
|
-
//# sourceMappingURL=
|
|
81
|
+
//# sourceMappingURL=Methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Methods.d.ts","sourceRoot":"","sources":["../../../src/stripe/client/Methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAEnD;AAED,yBAAiB,MAAM,CAAC;IACtB,KAAY,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;IAE3C,sEAAsE;IAC/D,MAAM,MAAM,gBAAU,CAAA;CAC9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { charge as charge_ } from './Charge.js';
|
|
2
2
|
/**
|
|
3
|
-
* Creates a Stripe `charge` client method
|
|
3
|
+
* Creates a Stripe `charge` client method.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
@@ -28,7 +28,7 @@ export function stripe(parameters) {
|
|
|
28
28
|
return [charge_(parameters)];
|
|
29
29
|
}
|
|
30
30
|
(function (stripe) {
|
|
31
|
-
/** Creates a Stripe `charge` client method
|
|
31
|
+
/** Creates a Stripe `charge` client method for SPT-based payments. */
|
|
32
32
|
stripe.charge = charge_;
|
|
33
33
|
})(stripe || (stripe = {}));
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=Methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Methods.js","sourceRoot":"","sources":["../../../src/stripe/client/Methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,MAAM,CAAC,UAA6B;IAClD,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAU,CAAA;AACvC,CAAC;AAED,WAAiB,MAAM;IAGrB,sEAAsE;IACzD,aAAM,GAAG,OAAO,CAAA;AAC/B,CAAC,EALgB,MAAM,KAAN,MAAM,QAKtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stripe/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stripe/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stripe/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stripe/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/stripe/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as Methods from './Methods.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA"}
|
package/dist/stripe/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as Methods from './Methods.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/stripe/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Duck-typed interface for the Stripe Node SDK (`stripe` npm package).
|
|
3
|
+
* Matches the subset of the API used by mppx for server-side payment verification.
|
|
4
|
+
*
|
|
5
|
+
* Uses loose signatures so any Stripe SDK version is assignable.
|
|
6
|
+
*/
|
|
7
|
+
export type StripeClient = {
|
|
8
|
+
paymentIntents: {
|
|
9
|
+
create(...args: any[]): Promise<{
|
|
10
|
+
id: string;
|
|
11
|
+
status: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Duck-typed interface for Stripe.js (`@stripe/stripe-js`).
|
|
17
|
+
* Matches the subset of the API used by mppx for client-side payment method creation.
|
|
18
|
+
*
|
|
19
|
+
* Uses loose signatures so any Stripe.js version is assignable.
|
|
20
|
+
*/
|
|
21
|
+
export type StripeJs = {
|
|
22
|
+
createPaymentMethod(...args: any[]): Promise<Record<string, unknown>>;
|
|
23
|
+
elements(...args: any[]): unknown;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/stripe/internal/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,EAAE;QACd,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAChE,CAAA;CACF,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,mBAAmB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACrE,QAAQ,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAA;CAClC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/stripe/internal/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
import type { LooseOmit } from '../../internal/types.js';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
1
|
+
import type { LooseOmit, OneOf } from '../../internal/types.js';
|
|
2
|
+
import * as Method from '../../Method.js';
|
|
3
|
+
import type { StripeClient } from '../internal/types.js';
|
|
4
|
+
import * as Methods from '../Methods.js';
|
|
4
5
|
/**
|
|
5
6
|
* Creates a Stripe charge method intent for usage on the server.
|
|
6
7
|
*
|
|
7
8
|
* Verifies payment by creating a Stripe PaymentIntent with the provided SPT.
|
|
8
9
|
*
|
|
10
|
+
* Accepts either a `client` (a pre-configured Stripe SDK instance) or a raw
|
|
11
|
+
* `secretKey`. Using `client` is recommended—it lets you configure retries,
|
|
12
|
+
* API version, and other options on the Stripe instance you control.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import Stripe from 'stripe'
|
|
17
|
+
* import { stripe } from 'mppx/server'
|
|
18
|
+
*
|
|
19
|
+
* const stripeClient = new Stripe(process.env.STRIPE_SECRET_KEY!)
|
|
20
|
+
* const charge = stripe.charge({ client: stripeClient, networkId: 'internal', paymentMethodTypes: ['card'] })
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
9
23
|
* @example
|
|
10
24
|
* ```ts
|
|
11
25
|
* import { stripe } from 'mppx/server'
|
|
12
26
|
*
|
|
13
|
-
* const charge = stripe.charge({ secretKey: 'sk_...' })
|
|
27
|
+
* const charge = stripe.charge({ secretKey: 'sk_...', networkId: 'internal', paymentMethodTypes: ['card'] })
|
|
14
28
|
* ```
|
|
15
29
|
*/
|
|
16
|
-
export declare function charge<const parameters extends charge.Parameters>(parameters: parameters):
|
|
17
|
-
readonly name: "
|
|
30
|
+
export declare function charge<const parameters extends charge.Parameters>(parameters: parameters): Method.Server<{
|
|
31
|
+
readonly name: "stripe";
|
|
32
|
+
readonly intent: "charge";
|
|
18
33
|
readonly schema: {
|
|
34
|
+
readonly credential: {
|
|
35
|
+
readonly payload: import("zod/mini").ZodMiniObject<{
|
|
36
|
+
externalId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
37
|
+
spt: import("zod/mini").ZodMiniString<string>;
|
|
38
|
+
}, import("zod/v4/core").$strip>;
|
|
39
|
+
};
|
|
19
40
|
readonly request: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniObject<{
|
|
20
41
|
amount: import("zod/mini").ZodMiniString<string>;
|
|
21
42
|
currency: import("zod/mini").ZodMiniString<string>;
|
|
@@ -23,9 +44,17 @@ export declare function charge<const parameters extends charge.Parameters>(param
|
|
|
23
44
|
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
24
45
|
expires: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniString<string>>;
|
|
25
46
|
externalId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
47
|
+
metadata: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniRecord<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniString<string>>>;
|
|
48
|
+
networkId: import("zod/mini").ZodMiniString<string>;
|
|
49
|
+
paymentMethodTypes: import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniString<string>>;
|
|
26
50
|
recipient: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
27
51
|
}, import("zod/v4/core").$strip>, import("zod/mini").ZodMiniTransform<{
|
|
28
52
|
amount: string;
|
|
53
|
+
methodDetails: {
|
|
54
|
+
metadata?: Record<string, string> | undefined;
|
|
55
|
+
networkId: string;
|
|
56
|
+
paymentMethodTypes: string[];
|
|
57
|
+
};
|
|
29
58
|
currency: string;
|
|
30
59
|
expires: string;
|
|
31
60
|
description?: string | undefined;
|
|
@@ -36,37 +65,27 @@ export declare function charge<const parameters extends charge.Parameters>(param
|
|
|
36
65
|
currency: string;
|
|
37
66
|
decimals: number;
|
|
38
67
|
expires: string;
|
|
68
|
+
networkId: string;
|
|
69
|
+
paymentMethodTypes: string[];
|
|
39
70
|
description?: string | undefined;
|
|
40
71
|
externalId?: string | undefined;
|
|
72
|
+
metadata?: Record<string, string> | undefined;
|
|
41
73
|
recipient?: string | undefined;
|
|
42
74
|
}>>;
|
|
43
75
|
};
|
|
44
|
-
},
|
|
45
|
-
readonly method: "stripe";
|
|
46
|
-
readonly schema: {
|
|
47
|
-
readonly credential: {
|
|
48
|
-
readonly payload: import("zod/mini").ZodMiniObject<{
|
|
49
|
-
spt: import("zod/mini").ZodMiniString<string>;
|
|
50
|
-
externalId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
51
|
-
}, import("zod/v4/core").$strip>;
|
|
52
|
-
};
|
|
53
|
-
readonly request: {
|
|
54
|
-
readonly methodDetails: import("zod/mini").ZodMiniObject<{
|
|
55
|
-
networkId: import("zod/mini").ZodMiniString<string>;
|
|
56
|
-
paymentMethodTypes: import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniString<string>>;
|
|
57
|
-
metadata: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniRecord<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniString<string>>>;
|
|
58
|
-
}, import("zod/v4/core").$strip>;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}>, charge.DeriveDefaults<parameters>, undefined>;
|
|
76
|
+
}, charge.DeriveDefaults<parameters>, undefined>;
|
|
62
77
|
export declare namespace charge {
|
|
63
|
-
type Defaults = LooseOmit<
|
|
78
|
+
type Defaults = LooseOmit<Method.RequestDefaults<typeof Methods.charge>, 'recipient'>;
|
|
64
79
|
type Parameters = {
|
|
65
|
-
/** Stripe secret API key. */
|
|
66
|
-
secretKey: string;
|
|
67
80
|
/** Optional metadata to include in SPT creation requests. */
|
|
68
81
|
metadata?: Record<string, string> | undefined;
|
|
69
|
-
} & Defaults
|
|
82
|
+
} & Defaults & OneOf<{
|
|
83
|
+
/** Pre-configured Stripe SDK instance. Any object matching the duck-typed `StripeClient` shape works. */
|
|
84
|
+
client: StripeClient;
|
|
85
|
+
} | {
|
|
86
|
+
/** Stripe secret API key. */
|
|
87
|
+
secretKey: string;
|
|
88
|
+
}>;
|
|
70
89
|
type DeriveDefaults<parameters extends Parameters> = Pick<parameters, Extract<keyof parameters, keyof Defaults>> & {
|
|
71
90
|
decimals: number;
|
|
72
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Charge.d.ts","sourceRoot":"","sources":["../../../src/stripe/server/Charge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Charge.d.ts","sourceRoot":"","sources":["../../../src/stripe/server/Charge.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,MAAM,CAAC,KAAK,CAAC,UAAU,SAAS,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAqExF;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,KAAK,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAA;IAErF,KAAK,UAAU,GAAG;QAChB,6DAA6D;QAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;KAC9C,GAAG,QAAQ,GACV,KAAK,CACD;QACE,yGAAyG;QACzG,MAAM,EAAE,YAAY,CAAA;KACrB,GACD;QACE,6BAA6B;QAC7B,SAAS,EAAE,MAAM,CAAA;KAClB,CACJ,CAAA;IAEH,KAAK,cAAc,CAAC,UAAU,SAAS,UAAU,IAAI,IAAI,CACvD,UAAU,EACV,OAAO,CAAC,MAAM,UAAU,EAAE,MAAM,QAAQ,CAAC,CAC1C,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CACzB"}
|