@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/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",
|
|
@@ -149,57 +278,36 @@ var example = defineExample({
|
|
|
149
278
|
});
|
|
150
279
|
var example_default = example;
|
|
151
280
|
|
|
152
|
-
// src/
|
|
153
|
-
import {
|
|
154
|
-
|
|
155
|
-
StabilityEnum as StabilityEnum2,
|
|
156
|
-
TagsEnum as TagsEnum2
|
|
157
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
158
|
-
var collectPaymentWorkflow = {
|
|
281
|
+
// src/integration-stripe.feature.ts
|
|
282
|
+
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
283
|
+
var IntegrationStripeFeature = defineFeature({
|
|
159
284
|
meta: {
|
|
160
|
-
key: "
|
|
285
|
+
key: "integration-stripe",
|
|
161
286
|
version: "1.0.0",
|
|
162
|
-
title: "
|
|
163
|
-
description: "
|
|
164
|
-
domain: "
|
|
165
|
-
owners: [
|
|
166
|
-
tags: [
|
|
167
|
-
stability:
|
|
287
|
+
title: "Stripe Payments Integration",
|
|
288
|
+
description: "Stripe payments integration with blueprint, workflow, and tenant configuration",
|
|
289
|
+
domain: "integration",
|
|
290
|
+
owners: ["@integration-team"],
|
|
291
|
+
tags: ["integration", "stripe", "payments"],
|
|
292
|
+
stability: "experimental"
|
|
168
293
|
},
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
id: "confirm",
|
|
190
|
-
type: "automation",
|
|
191
|
-
label: "Confirm settlement",
|
|
192
|
-
action: {
|
|
193
|
-
operation: { key: "payments.recordSettlement", version: "1.0.0" }
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
],
|
|
197
|
-
transitions: [
|
|
198
|
-
{ from: "prepare", to: "charge" },
|
|
199
|
-
{ from: "charge", to: "confirm", condition: "output.success === true" }
|
|
200
|
-
]
|
|
201
|
-
}
|
|
202
|
-
};
|
|
294
|
+
integrations: [
|
|
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
|
+
}
|
|
305
|
+
],
|
|
306
|
+
docs: [
|
|
307
|
+
"docs.examples.integration-stripe",
|
|
308
|
+
"docs.examples.integration-stripe.usage"
|
|
309
|
+
]
|
|
310
|
+
});
|
|
203
311
|
|
|
204
312
|
// src/tenant.ts
|
|
205
313
|
var artisanStripeTenantConfig = {
|
|
@@ -253,35 +361,12 @@ var artisanStripeTenantConfig = {
|
|
|
253
361
|
},
|
|
254
362
|
notes: "Stripe connection bound for production payments."
|
|
255
363
|
};
|
|
256
|
-
|
|
257
|
-
// src/integration-stripe.feature.ts
|
|
258
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
259
|
-
var IntegrationStripeFeature = defineFeature({
|
|
260
|
-
meta: {
|
|
261
|
-
key: "integration-stripe",
|
|
262
|
-
version: "1.0.0",
|
|
263
|
-
title: "Stripe Payments Integration",
|
|
264
|
-
description: "Stripe payments integration with blueprint, workflow, and tenant configuration",
|
|
265
|
-
domain: "integration",
|
|
266
|
-
owners: ["@integration-team"],
|
|
267
|
-
tags: ["integration", "stripe", "payments"],
|
|
268
|
-
stability: "experimental"
|
|
269
|
-
},
|
|
270
|
-
integrations: [
|
|
271
|
-
{ key: "integration-stripe.integration.psp", version: "1.0.0" }
|
|
272
|
-
],
|
|
273
|
-
workflows: [{ key: "integration-stripe.workflow.payment", version: "1.0.0" }],
|
|
274
|
-
policies: [{ key: "integration-stripe.policy.payments", version: "1.0.0" }],
|
|
275
|
-
docs: [
|
|
276
|
-
"docs.examples.integration-stripe",
|
|
277
|
-
"docs.examples.integration-stripe.usage"
|
|
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
|
};
|