@contractspec/example.integration-stripe 3.7.7 → 3.7.10
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/.turbo/turbo-build.log +36 -33
- package/CHANGELOG.md +24 -0
- package/README.md +6 -3
- package/dist/blueprint.d.ts +1 -2
- package/dist/blueprint.js +62 -9
- package/dist/browser/blueprint.js +62 -9
- package/dist/browser/connection.sample.js +78 -2
- package/dist/browser/index.js +151 -66
- package/dist/browser/integration-stripe.feature.js +139 -3
- package/dist/browser/integration.js +78 -0
- package/dist/browser/workflow.js +4 -3
- package/dist/connection.sample.js +78 -2
- package/dist/contracts.test.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +151 -66
- package/dist/integration-stripe.feature.js +139 -3
- package/dist/integration.d.ts +1 -0
- package/dist/integration.js +79 -0
- package/dist/node/blueprint.js +62 -9
- package/dist/node/connection.sample.js +78 -2
- package/dist/node/index.js +151 -66
- package/dist/node/integration-stripe.feature.js +139 -3
- package/dist/node/integration.js +78 -0
- package/dist/node/workflow.js +4 -3
- package/dist/workflow.d.ts +1 -2
- package/dist/workflow.js +4 -3
- package/package.json +20 -6
- package/src/blueprint.ts +6 -6
- package/src/connection.sample.ts +3 -2
- package/src/contracts.test.ts +34 -0
- package/src/index.ts +1 -0
- package/src/integration-stripe.feature.ts +12 -4
- package/src/integration.ts +79 -0
- package/src/workflow.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -1,11 +1,65 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/
|
|
2
|
+
// src/workflow.ts
|
|
3
3
|
import {
|
|
4
4
|
OwnersEnum,
|
|
5
5
|
StabilityEnum,
|
|
6
6
|
TagsEnum
|
|
7
7
|
} from "@contractspec/lib.contracts-spec/ownership";
|
|
8
|
-
|
|
8
|
+
import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
|
|
9
|
+
var collectPaymentWorkflow = defineWorkflow({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "integration-stripe.workflow.payment",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
title: "Collect Card Payment",
|
|
14
|
+
description: "Charge a customer using the tenant Stripe connection and record settlement details.",
|
|
15
|
+
domain: "payments",
|
|
16
|
+
owners: [OwnersEnum.PlatformCore],
|
|
17
|
+
tags: [TagsEnum.Marketplace, "stripe"],
|
|
18
|
+
stability: StabilityEnum.Experimental
|
|
19
|
+
},
|
|
20
|
+
definition: {
|
|
21
|
+
entryStepId: "prepare",
|
|
22
|
+
steps: [
|
|
23
|
+
{
|
|
24
|
+
id: "prepare",
|
|
25
|
+
type: "automation",
|
|
26
|
+
label: "Prepare charge parameters",
|
|
27
|
+
action: {
|
|
28
|
+
operation: { key: "payments.prepareCharge", version: "1.0.0" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "charge",
|
|
33
|
+
type: "automation",
|
|
34
|
+
label: "Charge card via Stripe",
|
|
35
|
+
action: {
|
|
36
|
+
operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "confirm",
|
|
41
|
+
type: "automation",
|
|
42
|
+
label: "Confirm settlement",
|
|
43
|
+
action: {
|
|
44
|
+
operation: { key: "payments.recordSettlement", version: "1.0.0" }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
transitions: [
|
|
49
|
+
{ from: "prepare", to: "charge" },
|
|
50
|
+
{ from: "charge", to: "confirm", condition: "output.success === true" }
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// src/blueprint.ts
|
|
56
|
+
import { defineAppConfig } from "@contractspec/lib.contracts-spec/app-config/spec";
|
|
57
|
+
import {
|
|
58
|
+
OwnersEnum as OwnersEnum2,
|
|
59
|
+
StabilityEnum as StabilityEnum2,
|
|
60
|
+
TagsEnum as TagsEnum2
|
|
61
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
62
|
+
var artisanStripeBlueprint = defineAppConfig({
|
|
9
63
|
meta: {
|
|
10
64
|
key: "artisan.payments.stripe",
|
|
11
65
|
version: "1.0.0",
|
|
@@ -13,9 +67,9 @@ var artisanStripeBlueprint = {
|
|
|
13
67
|
title: "ArtisanOS Stripe Payments",
|
|
14
68
|
description: "Blueprint enabling card payments for ArtisanOS merchants via the Stripe integration.",
|
|
15
69
|
domain: "payments",
|
|
16
|
-
owners: [
|
|
17
|
-
tags: [
|
|
18
|
-
stability:
|
|
70
|
+
owners: [OwnersEnum2.PlatformCore],
|
|
71
|
+
tags: [TagsEnum2.Marketplace, "stripe", "payments"],
|
|
72
|
+
stability: StabilityEnum2.Experimental
|
|
19
73
|
},
|
|
20
74
|
capabilities: {
|
|
21
75
|
enabled: [{ key: "payments.psp", version: "1.0.0" }]
|
|
@@ -50,21 +104,96 @@ var artisanStripeBlueprint = {
|
|
|
50
104
|
},
|
|
51
105
|
workflows: {
|
|
52
106
|
collectPayment: {
|
|
53
|
-
key:
|
|
54
|
-
version:
|
|
107
|
+
key: collectPaymentWorkflow.meta.key,
|
|
108
|
+
version: collectPaymentWorkflow.meta.version
|
|
55
109
|
}
|
|
56
110
|
},
|
|
57
|
-
policies: [{ key: "artisan.payments.default", version: "1.0.0" }],
|
|
58
111
|
notes: "Install this blueprint and pair it with the Stripe integration connection to enable card collection."
|
|
59
|
-
};
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// src/integration.ts
|
|
115
|
+
import { defineIntegration } from "@contractspec/lib.contracts-spec/integrations/spec";
|
|
116
|
+
import {
|
|
117
|
+
OwnersEnum as OwnersEnum3,
|
|
118
|
+
StabilityEnum as StabilityEnum3,
|
|
119
|
+
TagsEnum as TagsEnum3
|
|
120
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
121
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
122
|
+
var StripeConfigModel = defineSchemaModel({
|
|
123
|
+
name: "StripePaymentsIntegrationConfig",
|
|
124
|
+
description: "Managed configuration required to connect a Stripe account.",
|
|
125
|
+
fields: {
|
|
126
|
+
accountId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
127
|
+
webhookEndpoint: {
|
|
128
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
129
|
+
isOptional: false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
var StripeSecretModel = defineSchemaModel({
|
|
134
|
+
name: "StripePaymentsIntegrationSecret",
|
|
135
|
+
description: "Secret material stored out-of-band for the Stripe provider.",
|
|
136
|
+
fields: {
|
|
137
|
+
apiKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
138
|
+
webhookSecret: {
|
|
139
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
140
|
+
isOptional: false
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
var StripePaymentsIntegrationSpec = defineIntegration({
|
|
145
|
+
meta: {
|
|
146
|
+
key: "integration-stripe.integration.psp",
|
|
147
|
+
version: "1.0.0",
|
|
148
|
+
title: "Stripe Payments Integration",
|
|
149
|
+
description: "Integration contract for managed or BYOK Stripe card processing.",
|
|
150
|
+
domain: "payments",
|
|
151
|
+
category: "payments",
|
|
152
|
+
owners: [OwnersEnum3.PlatformCore],
|
|
153
|
+
tags: [TagsEnum3.Marketplace, "stripe", "payments"],
|
|
154
|
+
stability: StabilityEnum3.Experimental
|
|
155
|
+
},
|
|
156
|
+
supportedModes: ["managed", "byok"],
|
|
157
|
+
capabilities: {
|
|
158
|
+
provides: [{ key: "payments.psp", version: "1.0.0" }]
|
|
159
|
+
},
|
|
160
|
+
configSchema: {
|
|
161
|
+
schema: StripeConfigModel,
|
|
162
|
+
example: {
|
|
163
|
+
accountId: "acct_demo_artisan",
|
|
164
|
+
webhookEndpoint: "https://pay.artisanos.dev/webhooks/stripe"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
secretSchema: {
|
|
168
|
+
schema: StripeSecretModel,
|
|
169
|
+
example: {
|
|
170
|
+
apiKey: "sk_live_redacted",
|
|
171
|
+
webhookSecret: "whsec_redacted"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
healthCheck: {
|
|
175
|
+
method: "ping",
|
|
176
|
+
timeoutMs: 5000
|
|
177
|
+
},
|
|
178
|
+
docsUrl: "https://docs.stripe.com",
|
|
179
|
+
constraints: {
|
|
180
|
+
rateLimit: {
|
|
181
|
+
rpm: 1000
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
byokSetup: {
|
|
185
|
+
setupInstructions: "Create a restricted API key and webhook endpoint, then bind the secret reference to the tenant connection.",
|
|
186
|
+
requiredScopes: ["charges:write", "customers:read", "webhooks:write"]
|
|
187
|
+
}
|
|
188
|
+
});
|
|
60
189
|
|
|
61
190
|
// src/connection.sample.ts
|
|
62
191
|
var stripeLiveConnection = {
|
|
63
192
|
meta: {
|
|
64
193
|
id: "conn-stripe-live",
|
|
65
194
|
tenantId: "artisan-co",
|
|
66
|
-
integrationKey:
|
|
67
|
-
integrationVersion:
|
|
195
|
+
integrationKey: StripePaymentsIntegrationSpec.meta.key,
|
|
196
|
+
integrationVersion: StripePaymentsIntegrationSpec.meta.version,
|
|
68
197
|
label: "Stripe Production",
|
|
69
198
|
environment: "production",
|
|
70
199
|
createdAt: "2026-01-01T00:00:00.000Z",
|
|
@@ -163,10 +292,17 @@ var IntegrationStripeFeature = defineFeature({
|
|
|
163
292
|
stability: "experimental"
|
|
164
293
|
},
|
|
165
294
|
integrations: [
|
|
166
|
-
{
|
|
295
|
+
{
|
|
296
|
+
key: StripePaymentsIntegrationSpec.meta.key,
|
|
297
|
+
version: StripePaymentsIntegrationSpec.meta.version
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
workflows: [
|
|
301
|
+
{
|
|
302
|
+
key: collectPaymentWorkflow.meta.key,
|
|
303
|
+
version: collectPaymentWorkflow.meta.version
|
|
304
|
+
}
|
|
167
305
|
],
|
|
168
|
-
workflows: [{ key: "integration-stripe.workflow.payment", version: "1.0.0" }],
|
|
169
|
-
policies: [{ key: "integration-stripe.policy.payments", version: "1.0.0" }],
|
|
170
306
|
docs: [
|
|
171
307
|
"docs.examples.integration-stripe",
|
|
172
308
|
"docs.examples.integration-stripe.usage"
|
|
@@ -225,63 +361,12 @@ var artisanStripeTenantConfig = {
|
|
|
225
361
|
},
|
|
226
362
|
notes: "Stripe connection bound for production payments."
|
|
227
363
|
};
|
|
228
|
-
|
|
229
|
-
// src/workflow.ts
|
|
230
|
-
import {
|
|
231
|
-
OwnersEnum as OwnersEnum2,
|
|
232
|
-
StabilityEnum as StabilityEnum2,
|
|
233
|
-
TagsEnum as TagsEnum2
|
|
234
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
235
|
-
var collectPaymentWorkflow = {
|
|
236
|
-
meta: {
|
|
237
|
-
key: "artisan.payments.collectPayment",
|
|
238
|
-
version: "1.0.0",
|
|
239
|
-
title: "Collect Card Payment",
|
|
240
|
-
description: "Charge a customer using the tenant Stripe connection and record settlement details.",
|
|
241
|
-
domain: "payments",
|
|
242
|
-
owners: [OwnersEnum2.PlatformCore],
|
|
243
|
-
tags: [TagsEnum2.Marketplace, "stripe"],
|
|
244
|
-
stability: StabilityEnum2.Experimental
|
|
245
|
-
},
|
|
246
|
-
definition: {
|
|
247
|
-
entryStepId: "prepare",
|
|
248
|
-
steps: [
|
|
249
|
-
{
|
|
250
|
-
id: "prepare",
|
|
251
|
-
type: "automation",
|
|
252
|
-
label: "Prepare charge parameters",
|
|
253
|
-
action: {
|
|
254
|
-
operation: { key: "payments.prepareCharge", version: "1.0.0" }
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
id: "charge",
|
|
259
|
-
type: "automation",
|
|
260
|
-
label: "Charge card via Stripe",
|
|
261
|
-
action: {
|
|
262
|
-
operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
id: "confirm",
|
|
267
|
-
type: "automation",
|
|
268
|
-
label: "Confirm settlement",
|
|
269
|
-
action: {
|
|
270
|
-
operation: { key: "payments.recordSettlement", version: "1.0.0" }
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
],
|
|
274
|
-
transitions: [
|
|
275
|
-
{ from: "prepare", to: "charge" },
|
|
276
|
-
{ from: "charge", to: "confirm", condition: "output.success === true" }
|
|
277
|
-
]
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
364
|
export {
|
|
281
365
|
stripeLiveConnection,
|
|
282
366
|
example_default as example,
|
|
283
367
|
collectPaymentWorkflow,
|
|
284
368
|
artisanStripeTenantConfig,
|
|
285
369
|
artisanStripeBlueprint,
|
|
370
|
+
StripePaymentsIntegrationSpec,
|
|
286
371
|
IntegrationStripeFeature
|
|
287
372
|
};
|
|
@@ -1,4 +1,133 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
// src/workflow.ts
|
|
3
|
+
import {
|
|
4
|
+
OwnersEnum,
|
|
5
|
+
StabilityEnum,
|
|
6
|
+
TagsEnum
|
|
7
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
8
|
+
import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
|
|
9
|
+
var collectPaymentWorkflow = defineWorkflow({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "integration-stripe.workflow.payment",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
title: "Collect Card Payment",
|
|
14
|
+
description: "Charge a customer using the tenant Stripe connection and record settlement details.",
|
|
15
|
+
domain: "payments",
|
|
16
|
+
owners: [OwnersEnum.PlatformCore],
|
|
17
|
+
tags: [TagsEnum.Marketplace, "stripe"],
|
|
18
|
+
stability: StabilityEnum.Experimental
|
|
19
|
+
},
|
|
20
|
+
definition: {
|
|
21
|
+
entryStepId: "prepare",
|
|
22
|
+
steps: [
|
|
23
|
+
{
|
|
24
|
+
id: "prepare",
|
|
25
|
+
type: "automation",
|
|
26
|
+
label: "Prepare charge parameters",
|
|
27
|
+
action: {
|
|
28
|
+
operation: { key: "payments.prepareCharge", version: "1.0.0" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "charge",
|
|
33
|
+
type: "automation",
|
|
34
|
+
label: "Charge card via Stripe",
|
|
35
|
+
action: {
|
|
36
|
+
operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "confirm",
|
|
41
|
+
type: "automation",
|
|
42
|
+
label: "Confirm settlement",
|
|
43
|
+
action: {
|
|
44
|
+
operation: { key: "payments.recordSettlement", version: "1.0.0" }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
transitions: [
|
|
49
|
+
{ from: "prepare", to: "charge" },
|
|
50
|
+
{ from: "charge", to: "confirm", condition: "output.success === true" }
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// src/integration.ts
|
|
56
|
+
import { defineIntegration } from "@contractspec/lib.contracts-spec/integrations/spec";
|
|
57
|
+
import {
|
|
58
|
+
OwnersEnum as OwnersEnum2,
|
|
59
|
+
StabilityEnum as StabilityEnum2,
|
|
60
|
+
TagsEnum as TagsEnum2
|
|
61
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
62
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
63
|
+
var StripeConfigModel = defineSchemaModel({
|
|
64
|
+
name: "StripePaymentsIntegrationConfig",
|
|
65
|
+
description: "Managed configuration required to connect a Stripe account.",
|
|
66
|
+
fields: {
|
|
67
|
+
accountId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
68
|
+
webhookEndpoint: {
|
|
69
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
70
|
+
isOptional: false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var StripeSecretModel = defineSchemaModel({
|
|
75
|
+
name: "StripePaymentsIntegrationSecret",
|
|
76
|
+
description: "Secret material stored out-of-band for the Stripe provider.",
|
|
77
|
+
fields: {
|
|
78
|
+
apiKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
79
|
+
webhookSecret: {
|
|
80
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
81
|
+
isOptional: false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var StripePaymentsIntegrationSpec = defineIntegration({
|
|
86
|
+
meta: {
|
|
87
|
+
key: "integration-stripe.integration.psp",
|
|
88
|
+
version: "1.0.0",
|
|
89
|
+
title: "Stripe Payments Integration",
|
|
90
|
+
description: "Integration contract for managed or BYOK Stripe card processing.",
|
|
91
|
+
domain: "payments",
|
|
92
|
+
category: "payments",
|
|
93
|
+
owners: [OwnersEnum2.PlatformCore],
|
|
94
|
+
tags: [TagsEnum2.Marketplace, "stripe", "payments"],
|
|
95
|
+
stability: StabilityEnum2.Experimental
|
|
96
|
+
},
|
|
97
|
+
supportedModes: ["managed", "byok"],
|
|
98
|
+
capabilities: {
|
|
99
|
+
provides: [{ key: "payments.psp", version: "1.0.0" }]
|
|
100
|
+
},
|
|
101
|
+
configSchema: {
|
|
102
|
+
schema: StripeConfigModel,
|
|
103
|
+
example: {
|
|
104
|
+
accountId: "acct_demo_artisan",
|
|
105
|
+
webhookEndpoint: "https://pay.artisanos.dev/webhooks/stripe"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
secretSchema: {
|
|
109
|
+
schema: StripeSecretModel,
|
|
110
|
+
example: {
|
|
111
|
+
apiKey: "sk_live_redacted",
|
|
112
|
+
webhookSecret: "whsec_redacted"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
healthCheck: {
|
|
116
|
+
method: "ping",
|
|
117
|
+
timeoutMs: 5000
|
|
118
|
+
},
|
|
119
|
+
docsUrl: "https://docs.stripe.com",
|
|
120
|
+
constraints: {
|
|
121
|
+
rateLimit: {
|
|
122
|
+
rpm: 1000
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
byokSetup: {
|
|
126
|
+
setupInstructions: "Create a restricted API key and webhook endpoint, then bind the secret reference to the tenant connection.",
|
|
127
|
+
requiredScopes: ["charges:write", "customers:read", "webhooks:write"]
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
2
131
|
// src/integration-stripe.feature.ts
|
|
3
132
|
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
4
133
|
var IntegrationStripeFeature = defineFeature({
|
|
@@ -13,10 +142,17 @@ var IntegrationStripeFeature = defineFeature({
|
|
|
13
142
|
stability: "experimental"
|
|
14
143
|
},
|
|
15
144
|
integrations: [
|
|
16
|
-
{
|
|
145
|
+
{
|
|
146
|
+
key: StripePaymentsIntegrationSpec.meta.key,
|
|
147
|
+
version: StripePaymentsIntegrationSpec.meta.version
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
workflows: [
|
|
151
|
+
{
|
|
152
|
+
key: collectPaymentWorkflow.meta.key,
|
|
153
|
+
version: collectPaymentWorkflow.meta.version
|
|
154
|
+
}
|
|
17
155
|
],
|
|
18
|
-
workflows: [{ key: "integration-stripe.workflow.payment", version: "1.0.0" }],
|
|
19
|
-
policies: [{ key: "integration-stripe.policy.payments", version: "1.0.0" }],
|
|
20
156
|
docs: [
|
|
21
157
|
"docs.examples.integration-stripe",
|
|
22
158
|
"docs.examples.integration-stripe.usage"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StripePaymentsIntegrationSpec: import("@contractspec/lib.contracts-spec/integrations/spec").IntegrationSpec;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/integration.ts
|
|
3
|
+
import { defineIntegration } from "@contractspec/lib.contracts-spec/integrations/spec";
|
|
4
|
+
import {
|
|
5
|
+
OwnersEnum,
|
|
6
|
+
StabilityEnum,
|
|
7
|
+
TagsEnum
|
|
8
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
9
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
10
|
+
var StripeConfigModel = defineSchemaModel({
|
|
11
|
+
name: "StripePaymentsIntegrationConfig",
|
|
12
|
+
description: "Managed configuration required to connect a Stripe account.",
|
|
13
|
+
fields: {
|
|
14
|
+
accountId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
15
|
+
webhookEndpoint: {
|
|
16
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
17
|
+
isOptional: false
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var StripeSecretModel = defineSchemaModel({
|
|
22
|
+
name: "StripePaymentsIntegrationSecret",
|
|
23
|
+
description: "Secret material stored out-of-band for the Stripe provider.",
|
|
24
|
+
fields: {
|
|
25
|
+
apiKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
26
|
+
webhookSecret: {
|
|
27
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
28
|
+
isOptional: false
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var StripePaymentsIntegrationSpec = defineIntegration({
|
|
33
|
+
meta: {
|
|
34
|
+
key: "integration-stripe.integration.psp",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
title: "Stripe Payments Integration",
|
|
37
|
+
description: "Integration contract for managed or BYOK Stripe card processing.",
|
|
38
|
+
domain: "payments",
|
|
39
|
+
category: "payments",
|
|
40
|
+
owners: [OwnersEnum.PlatformCore],
|
|
41
|
+
tags: [TagsEnum.Marketplace, "stripe", "payments"],
|
|
42
|
+
stability: StabilityEnum.Experimental
|
|
43
|
+
},
|
|
44
|
+
supportedModes: ["managed", "byok"],
|
|
45
|
+
capabilities: {
|
|
46
|
+
provides: [{ key: "payments.psp", version: "1.0.0" }]
|
|
47
|
+
},
|
|
48
|
+
configSchema: {
|
|
49
|
+
schema: StripeConfigModel,
|
|
50
|
+
example: {
|
|
51
|
+
accountId: "acct_demo_artisan",
|
|
52
|
+
webhookEndpoint: "https://pay.artisanos.dev/webhooks/stripe"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
secretSchema: {
|
|
56
|
+
schema: StripeSecretModel,
|
|
57
|
+
example: {
|
|
58
|
+
apiKey: "sk_live_redacted",
|
|
59
|
+
webhookSecret: "whsec_redacted"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
healthCheck: {
|
|
63
|
+
method: "ping",
|
|
64
|
+
timeoutMs: 5000
|
|
65
|
+
},
|
|
66
|
+
docsUrl: "https://docs.stripe.com",
|
|
67
|
+
constraints: {
|
|
68
|
+
rateLimit: {
|
|
69
|
+
rpm: 1000
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
byokSetup: {
|
|
73
|
+
setupInstructions: "Create a restricted API key and webhook endpoint, then bind the secret reference to the tenant connection.",
|
|
74
|
+
requiredScopes: ["charges:write", "customers:read", "webhooks:write"]
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
export {
|
|
78
|
+
StripePaymentsIntegrationSpec
|
|
79
|
+
};
|
package/dist/node/blueprint.js
CHANGED
|
@@ -1,10 +1,64 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/workflow.ts
|
|
2
2
|
import {
|
|
3
3
|
OwnersEnum,
|
|
4
4
|
StabilityEnum,
|
|
5
5
|
TagsEnum
|
|
6
6
|
} from "@contractspec/lib.contracts-spec/ownership";
|
|
7
|
-
|
|
7
|
+
import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
|
|
8
|
+
var collectPaymentWorkflow = defineWorkflow({
|
|
9
|
+
meta: {
|
|
10
|
+
key: "integration-stripe.workflow.payment",
|
|
11
|
+
version: "1.0.0",
|
|
12
|
+
title: "Collect Card Payment",
|
|
13
|
+
description: "Charge a customer using the tenant Stripe connection and record settlement details.",
|
|
14
|
+
domain: "payments",
|
|
15
|
+
owners: [OwnersEnum.PlatformCore],
|
|
16
|
+
tags: [TagsEnum.Marketplace, "stripe"],
|
|
17
|
+
stability: StabilityEnum.Experimental
|
|
18
|
+
},
|
|
19
|
+
definition: {
|
|
20
|
+
entryStepId: "prepare",
|
|
21
|
+
steps: [
|
|
22
|
+
{
|
|
23
|
+
id: "prepare",
|
|
24
|
+
type: "automation",
|
|
25
|
+
label: "Prepare charge parameters",
|
|
26
|
+
action: {
|
|
27
|
+
operation: { key: "payments.prepareCharge", version: "1.0.0" }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "charge",
|
|
32
|
+
type: "automation",
|
|
33
|
+
label: "Charge card via Stripe",
|
|
34
|
+
action: {
|
|
35
|
+
operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "confirm",
|
|
40
|
+
type: "automation",
|
|
41
|
+
label: "Confirm settlement",
|
|
42
|
+
action: {
|
|
43
|
+
operation: { key: "payments.recordSettlement", version: "1.0.0" }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
transitions: [
|
|
48
|
+
{ from: "prepare", to: "charge" },
|
|
49
|
+
{ from: "charge", to: "confirm", condition: "output.success === true" }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// src/blueprint.ts
|
|
55
|
+
import { defineAppConfig } from "@contractspec/lib.contracts-spec/app-config/spec";
|
|
56
|
+
import {
|
|
57
|
+
OwnersEnum as OwnersEnum2,
|
|
58
|
+
StabilityEnum as StabilityEnum2,
|
|
59
|
+
TagsEnum as TagsEnum2
|
|
60
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
61
|
+
var artisanStripeBlueprint = defineAppConfig({
|
|
8
62
|
meta: {
|
|
9
63
|
key: "artisan.payments.stripe",
|
|
10
64
|
version: "1.0.0",
|
|
@@ -12,9 +66,9 @@ var artisanStripeBlueprint = {
|
|
|
12
66
|
title: "ArtisanOS Stripe Payments",
|
|
13
67
|
description: "Blueprint enabling card payments for ArtisanOS merchants via the Stripe integration.",
|
|
14
68
|
domain: "payments",
|
|
15
|
-
owners: [
|
|
16
|
-
tags: [
|
|
17
|
-
stability:
|
|
69
|
+
owners: [OwnersEnum2.PlatformCore],
|
|
70
|
+
tags: [TagsEnum2.Marketplace, "stripe", "payments"],
|
|
71
|
+
stability: StabilityEnum2.Experimental
|
|
18
72
|
},
|
|
19
73
|
capabilities: {
|
|
20
74
|
enabled: [{ key: "payments.psp", version: "1.0.0" }]
|
|
@@ -49,13 +103,12 @@ var artisanStripeBlueprint = {
|
|
|
49
103
|
},
|
|
50
104
|
workflows: {
|
|
51
105
|
collectPayment: {
|
|
52
|
-
key:
|
|
53
|
-
version:
|
|
106
|
+
key: collectPaymentWorkflow.meta.key,
|
|
107
|
+
version: collectPaymentWorkflow.meta.version
|
|
54
108
|
}
|
|
55
109
|
},
|
|
56
|
-
policies: [{ key: "artisan.payments.default", version: "1.0.0" }],
|
|
57
110
|
notes: "Install this blueprint and pair it with the Stripe integration connection to enable card collection."
|
|
58
|
-
};
|
|
111
|
+
});
|
|
59
112
|
export {
|
|
60
113
|
artisanStripeBlueprint
|
|
61
114
|
};
|
|
@@ -1,10 +1,86 @@
|
|
|
1
|
+
// src/integration.ts
|
|
2
|
+
import { defineIntegration } from "@contractspec/lib.contracts-spec/integrations/spec";
|
|
3
|
+
import {
|
|
4
|
+
OwnersEnum,
|
|
5
|
+
StabilityEnum,
|
|
6
|
+
TagsEnum
|
|
7
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
8
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
9
|
+
var StripeConfigModel = defineSchemaModel({
|
|
10
|
+
name: "StripePaymentsIntegrationConfig",
|
|
11
|
+
description: "Managed configuration required to connect a Stripe account.",
|
|
12
|
+
fields: {
|
|
13
|
+
accountId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
webhookEndpoint: {
|
|
15
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
16
|
+
isOptional: false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var StripeSecretModel = defineSchemaModel({
|
|
21
|
+
name: "StripePaymentsIntegrationSecret",
|
|
22
|
+
description: "Secret material stored out-of-band for the Stripe provider.",
|
|
23
|
+
fields: {
|
|
24
|
+
apiKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
25
|
+
webhookSecret: {
|
|
26
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
27
|
+
isOptional: false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var StripePaymentsIntegrationSpec = defineIntegration({
|
|
32
|
+
meta: {
|
|
33
|
+
key: "integration-stripe.integration.psp",
|
|
34
|
+
version: "1.0.0",
|
|
35
|
+
title: "Stripe Payments Integration",
|
|
36
|
+
description: "Integration contract for managed or BYOK Stripe card processing.",
|
|
37
|
+
domain: "payments",
|
|
38
|
+
category: "payments",
|
|
39
|
+
owners: [OwnersEnum.PlatformCore],
|
|
40
|
+
tags: [TagsEnum.Marketplace, "stripe", "payments"],
|
|
41
|
+
stability: StabilityEnum.Experimental
|
|
42
|
+
},
|
|
43
|
+
supportedModes: ["managed", "byok"],
|
|
44
|
+
capabilities: {
|
|
45
|
+
provides: [{ key: "payments.psp", version: "1.0.0" }]
|
|
46
|
+
},
|
|
47
|
+
configSchema: {
|
|
48
|
+
schema: StripeConfigModel,
|
|
49
|
+
example: {
|
|
50
|
+
accountId: "acct_demo_artisan",
|
|
51
|
+
webhookEndpoint: "https://pay.artisanos.dev/webhooks/stripe"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
secretSchema: {
|
|
55
|
+
schema: StripeSecretModel,
|
|
56
|
+
example: {
|
|
57
|
+
apiKey: "sk_live_redacted",
|
|
58
|
+
webhookSecret: "whsec_redacted"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
healthCheck: {
|
|
62
|
+
method: "ping",
|
|
63
|
+
timeoutMs: 5000
|
|
64
|
+
},
|
|
65
|
+
docsUrl: "https://docs.stripe.com",
|
|
66
|
+
constraints: {
|
|
67
|
+
rateLimit: {
|
|
68
|
+
rpm: 1000
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
byokSetup: {
|
|
72
|
+
setupInstructions: "Create a restricted API key and webhook endpoint, then bind the secret reference to the tenant connection.",
|
|
73
|
+
requiredScopes: ["charges:write", "customers:read", "webhooks:write"]
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
1
77
|
// src/connection.sample.ts
|
|
2
78
|
var stripeLiveConnection = {
|
|
3
79
|
meta: {
|
|
4
80
|
id: "conn-stripe-live",
|
|
5
81
|
tenantId: "artisan-co",
|
|
6
|
-
integrationKey:
|
|
7
|
-
integrationVersion:
|
|
82
|
+
integrationKey: StripePaymentsIntegrationSpec.meta.key,
|
|
83
|
+
integrationVersion: StripePaymentsIntegrationSpec.meta.version,
|
|
8
84
|
label: "Stripe Production",
|
|
9
85
|
environment: "production",
|
|
10
86
|
createdAt: "2026-01-01T00:00:00.000Z",
|