@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/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { defineFeature } from '@contractspec/lib.contracts-spec';
|
|
2
|
+
import { StripePaymentsIntegrationSpec } from './integration';
|
|
3
|
+
import { collectPaymentWorkflow } from './workflow';
|
|
2
4
|
|
|
3
5
|
export const IntegrationStripeFeature = defineFeature({
|
|
4
6
|
meta: {
|
|
@@ -14,12 +16,18 @@ export const IntegrationStripeFeature = defineFeature({
|
|
|
14
16
|
},
|
|
15
17
|
|
|
16
18
|
integrations: [
|
|
17
|
-
{
|
|
19
|
+
{
|
|
20
|
+
key: StripePaymentsIntegrationSpec.meta.key,
|
|
21
|
+
version: StripePaymentsIntegrationSpec.meta.version,
|
|
22
|
+
},
|
|
18
23
|
],
|
|
19
24
|
|
|
20
|
-
workflows: [
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
workflows: [
|
|
26
|
+
{
|
|
27
|
+
key: collectPaymentWorkflow.meta.key,
|
|
28
|
+
version: collectPaymentWorkflow.meta.version,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
23
31
|
|
|
24
32
|
docs: [
|
|
25
33
|
'docs.examples.integration-stripe',
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { defineIntegration } from '@contractspec/lib.contracts-spec/integrations/spec';
|
|
2
|
+
import {
|
|
3
|
+
OwnersEnum,
|
|
4
|
+
StabilityEnum,
|
|
5
|
+
TagsEnum,
|
|
6
|
+
} from '@contractspec/lib.contracts-spec/ownership';
|
|
7
|
+
import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
8
|
+
|
|
9
|
+
const 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
|
+
|
|
21
|
+
const 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
|
+
|
|
33
|
+
export const StripePaymentsIntegrationSpec = defineIntegration({
|
|
34
|
+
meta: {
|
|
35
|
+
key: 'integration-stripe.integration.psp',
|
|
36
|
+
version: '1.0.0',
|
|
37
|
+
title: 'Stripe Payments Integration',
|
|
38
|
+
description:
|
|
39
|
+
'Integration contract for managed or BYOK Stripe card processing.',
|
|
40
|
+
domain: 'payments',
|
|
41
|
+
category: 'payments',
|
|
42
|
+
owners: [OwnersEnum.PlatformCore],
|
|
43
|
+
tags: [TagsEnum.Marketplace, 'stripe', 'payments'],
|
|
44
|
+
stability: StabilityEnum.Experimental,
|
|
45
|
+
},
|
|
46
|
+
supportedModes: ['managed', 'byok'],
|
|
47
|
+
capabilities: {
|
|
48
|
+
provides: [{ key: 'payments.psp', version: '1.0.0' }],
|
|
49
|
+
},
|
|
50
|
+
configSchema: {
|
|
51
|
+
schema: StripeConfigModel,
|
|
52
|
+
example: {
|
|
53
|
+
accountId: 'acct_demo_artisan',
|
|
54
|
+
webhookEndpoint: 'https://pay.artisanos.dev/webhooks/stripe',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
secretSchema: {
|
|
58
|
+
schema: StripeSecretModel,
|
|
59
|
+
example: {
|
|
60
|
+
apiKey: 'sk_live_redacted',
|
|
61
|
+
webhookSecret: 'whsec_redacted',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
healthCheck: {
|
|
65
|
+
method: 'ping',
|
|
66
|
+
timeoutMs: 5000,
|
|
67
|
+
},
|
|
68
|
+
docsUrl: 'https://docs.stripe.com',
|
|
69
|
+
constraints: {
|
|
70
|
+
rateLimit: {
|
|
71
|
+
rpm: 1000,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
byokSetup: {
|
|
75
|
+
setupInstructions:
|
|
76
|
+
'Create a restricted API key and webhook endpoint, then bind the secret reference to the tenant connection.',
|
|
77
|
+
requiredScopes: ['charges:write', 'customers:read', 'webhooks:write'],
|
|
78
|
+
},
|
|
79
|
+
});
|
package/src/workflow.ts
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
StabilityEnum,
|
|
4
4
|
TagsEnum,
|
|
5
5
|
} from '@contractspec/lib.contracts-spec/ownership';
|
|
6
|
-
import
|
|
6
|
+
import { defineWorkflow } from '@contractspec/lib.contracts-spec/workflow';
|
|
7
7
|
|
|
8
|
-
export const collectPaymentWorkflow
|
|
8
|
+
export const collectPaymentWorkflow = defineWorkflow({
|
|
9
9
|
meta: {
|
|
10
|
-
key: '
|
|
10
|
+
key: 'integration-stripe.workflow.payment',
|
|
11
11
|
version: '1.0.0',
|
|
12
12
|
title: 'Collect Card Payment',
|
|
13
13
|
description:
|
|
@@ -50,4 +50,4 @@ export const collectPaymentWorkflow: WorkflowSpec = {
|
|
|
50
50
|
{ from: 'charge', to: 'confirm', condition: 'output.success === true' },
|
|
51
51
|
],
|
|
52
52
|
},
|
|
53
|
-
};
|
|
53
|
+
});
|