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