@efaj/pulumi-dynamic-stripe 0.2.2 → 0.2.3
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/CHANGELOG.md +7 -0
- package/README.md +4 -1
- package/dist/StripePaymentLink.d.ts +2 -2
- package/dist/StripePaymentLink.js +4 -6
- package/dist/StripePrice.d.ts +2 -0
- package/dist/StripePrice.js +3 -0
- package/dist/StripeProduct.d.ts +2 -0
- package/dist/StripeProduct.js +4 -0
- package/package.json +1 -1
- package/tests/index.test.ts +23 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.3](https://github.com/efaj/pulumi-dynamic-stripe/compare/v0.2.2...v0.2.3) (2026-08-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **leak:** fixed an exposed an specific use case via specific "sparks" metadata ([a1dc919](https://github.com/efaj/pulumi-dynamic-stripe/commit/a1dc9193b64c7fc6246b13988862b2f41ae1286a))
|
|
9
|
+
|
|
3
10
|
## [0.2.2](https://github.com/efaj/pulumi-dynamic-stripe/compare/v0.2.1...v0.2.2) (2026-08-29)
|
|
4
11
|
|
|
5
12
|
|
package/README.md
CHANGED
|
@@ -61,7 +61,10 @@ const premiumPrice = new Price("premium-price", {
|
|
|
61
61
|
const premiumPaymentLink = new PaymentLink("premium-link", {
|
|
62
62
|
apiKey: stripeApiKey,
|
|
63
63
|
priceId: premiumPrice.priceId,
|
|
64
|
-
|
|
64
|
+
metadata: {
|
|
65
|
+
tier: "premium",
|
|
66
|
+
campaign: "summer_sale",
|
|
67
|
+
},
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
// Export the generated URL so it can be used in your application
|
|
@@ -2,8 +2,8 @@ import * as pulumi from "@pulumi/pulumi";
|
|
|
2
2
|
export interface StripePaymentLinkArgs {
|
|
3
3
|
apiKey: pulumi.Input<string>;
|
|
4
4
|
priceId: pulumi.Input<string>;
|
|
5
|
-
sparksAmount: pulumi.Input<string>;
|
|
6
5
|
redirectUrl: pulumi.Input<string>;
|
|
6
|
+
metadata?: pulumi.Input<Record<string, string>>;
|
|
7
7
|
allowPromotionCodes?: pulumi.Input<boolean>;
|
|
8
8
|
managedPayments?: pulumi.Input<boolean>;
|
|
9
9
|
automaticTax?: pulumi.Input<boolean>;
|
|
@@ -17,8 +17,8 @@ export interface StripePaymentLinkArgs {
|
|
|
17
17
|
export interface StripePaymentLinkProviderArgs {
|
|
18
18
|
apiKey: string;
|
|
19
19
|
priceId: string;
|
|
20
|
-
sparksAmount: string;
|
|
21
20
|
redirectUrl: string;
|
|
21
|
+
metadata?: Record<string, string>;
|
|
22
22
|
allowPromotionCodes?: boolean;
|
|
23
23
|
managedPayments?: boolean;
|
|
24
24
|
automaticTax?: boolean;
|
|
@@ -72,9 +72,7 @@ class StripePaymentLinkProvider {
|
|
|
72
72
|
? { managed_payments: { enabled: true } }
|
|
73
73
|
: {}),
|
|
74
74
|
...(inputs.automaticTax ? { automatic_tax: { enabled: true } } : {}),
|
|
75
|
-
metadata: {
|
|
76
|
-
sparks: inputs.sparksAmount,
|
|
77
|
-
},
|
|
75
|
+
...(inputs.metadata ? { metadata: inputs.metadata } : {}),
|
|
78
76
|
});
|
|
79
77
|
return {
|
|
80
78
|
id: paymentLink.id,
|
|
@@ -89,8 +87,8 @@ class StripePaymentLinkProvider {
|
|
|
89
87
|
const replaces = [];
|
|
90
88
|
if (olds.priceId !== news.priceId)
|
|
91
89
|
replaces.push("priceId");
|
|
92
|
-
if (olds.
|
|
93
|
-
replaces.push("
|
|
90
|
+
if (JSON.stringify(olds.metadata) !== JSON.stringify(news.metadata))
|
|
91
|
+
replaces.push("metadata");
|
|
94
92
|
if (olds.redirectUrl !== news.redirectUrl)
|
|
95
93
|
replaces.push("redirectUrl");
|
|
96
94
|
if (olds.allowPromotionCodes !== news.allowPromotionCodes)
|
|
@@ -124,8 +122,8 @@ class PaymentLink extends pulumi.dynamic.Resource {
|
|
|
124
122
|
super(stripePaymentLinkProvider, name, {
|
|
125
123
|
apiKey: args.apiKey,
|
|
126
124
|
priceId: args.priceId,
|
|
127
|
-
sparksAmount: args.sparksAmount,
|
|
128
125
|
redirectUrl: args.redirectUrl,
|
|
126
|
+
metadata: args.metadata,
|
|
129
127
|
allowPromotionCodes: args.allowPromotionCodes,
|
|
130
128
|
managedPayments: args.managedPayments,
|
|
131
129
|
automaticTax: args.automaticTax,
|
package/dist/StripePrice.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface StripePriceArgs {
|
|
|
25
25
|
tiersMode?: pulumi.Input<TiersMode>;
|
|
26
26
|
tiers?: pulumi.Input<pulumi.Input<TierArgs>[]>;
|
|
27
27
|
transformQuantity?: pulumi.Input<TransformQuantityArgs>;
|
|
28
|
+
metadata?: pulumi.Input<Record<string, string>>;
|
|
28
29
|
}
|
|
29
30
|
export interface RecurringProviderArgs {
|
|
30
31
|
interval: RecurringInterval;
|
|
@@ -51,6 +52,7 @@ export interface StripePriceProviderArgs {
|
|
|
51
52
|
tiersMode?: TiersMode;
|
|
52
53
|
tiers?: TierProviderArgs[];
|
|
53
54
|
transformQuantity?: TransformQuantityProviderArgs;
|
|
55
|
+
metadata?: Record<string, string>;
|
|
54
56
|
}
|
|
55
57
|
export declare class StripePriceProvider implements pulumi.dynamic.ResourceProvider {
|
|
56
58
|
create(inputs: StripePriceProviderArgs): Promise<pulumi.dynamic.CreateResult>;
|
package/dist/StripePrice.js
CHANGED
|
@@ -78,6 +78,7 @@ class StripePriceProvider {
|
|
|
78
78
|
},
|
|
79
79
|
}
|
|
80
80
|
: {}),
|
|
81
|
+
...(inputs.metadata ? { metadata: inputs.metadata } : {}),
|
|
81
82
|
});
|
|
82
83
|
return {
|
|
83
84
|
id: price.id,
|
|
@@ -108,6 +109,8 @@ class StripePriceProvider {
|
|
|
108
109
|
if (JSON.stringify(olds.transformQuantity) !==
|
|
109
110
|
JSON.stringify(news.transformQuantity))
|
|
110
111
|
replaces.push("transformQuantity");
|
|
112
|
+
if (JSON.stringify(olds.metadata) !== JSON.stringify(news.metadata))
|
|
113
|
+
replaces.push("metadata");
|
|
111
114
|
if (olds.apiKey !== news.apiKey)
|
|
112
115
|
replaces.push("apiKey");
|
|
113
116
|
return {
|
package/dist/StripeProduct.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ export interface StripeProductArgs {
|
|
|
4
4
|
name: pulumi.Input<string>;
|
|
5
5
|
description?: pulumi.Input<string>;
|
|
6
6
|
taxCode?: pulumi.Input<string>;
|
|
7
|
+
metadata?: pulumi.Input<Record<string, string>>;
|
|
7
8
|
}
|
|
8
9
|
export interface StripeProductProviderArgs {
|
|
9
10
|
apiKey: string;
|
|
10
11
|
name: string;
|
|
11
12
|
description?: string;
|
|
12
13
|
taxCode?: string;
|
|
14
|
+
metadata?: Record<string, string>;
|
|
13
15
|
}
|
|
14
16
|
export declare class StripeProductProvider implements pulumi.dynamic.ResourceProvider {
|
|
15
17
|
create(inputs: StripeProductProviderArgs): Promise<pulumi.dynamic.CreateResult>;
|
package/dist/StripeProduct.js
CHANGED
|
@@ -47,6 +47,7 @@ class StripeProductProvider {
|
|
|
47
47
|
name: inputs.name,
|
|
48
48
|
description: inputs.description,
|
|
49
49
|
tax_code: inputs.taxCode,
|
|
50
|
+
...(inputs.metadata ? { metadata: inputs.metadata } : {}),
|
|
50
51
|
});
|
|
51
52
|
return {
|
|
52
53
|
id: product.id,
|
|
@@ -64,6 +65,8 @@ class StripeProductProvider {
|
|
|
64
65
|
changes.push("description");
|
|
65
66
|
if (olds.taxCode !== news.taxCode)
|
|
66
67
|
changes.push("taxCode");
|
|
68
|
+
if (JSON.stringify(olds.metadata) !== JSON.stringify(news.metadata))
|
|
69
|
+
changes.push("metadata");
|
|
67
70
|
if (olds.apiKey !== news.apiKey)
|
|
68
71
|
changes.push("apiKey");
|
|
69
72
|
return {
|
|
@@ -77,6 +80,7 @@ class StripeProductProvider {
|
|
|
77
80
|
name: news.name,
|
|
78
81
|
description: news.description,
|
|
79
82
|
tax_code: news.taxCode,
|
|
83
|
+
...(news.metadata ? { metadata: news.metadata } : {}),
|
|
80
84
|
});
|
|
81
85
|
return {
|
|
82
86
|
outs: {
|
package/package.json
CHANGED
package/tests/index.test.ts
CHANGED
|
@@ -75,7 +75,7 @@ describe("Stripe Providers", () => {
|
|
|
75
75
|
inputs: {
|
|
76
76
|
apiKey: "sk_test_123",
|
|
77
77
|
priceId: "price_abc",
|
|
78
|
-
|
|
78
|
+
metadata: { sparks: "100" },
|
|
79
79
|
redirectUrl: "https://example.com/success",
|
|
80
80
|
allowPromotionCodes: true,
|
|
81
81
|
managedPayments: true,
|
|
@@ -108,7 +108,7 @@ describe("Stripe Providers", () => {
|
|
|
108
108
|
inputs: {
|
|
109
109
|
apiKey: "sk_test_123",
|
|
110
110
|
priceId: "price_abc",
|
|
111
|
-
|
|
111
|
+
metadata: { sparks: "50" },
|
|
112
112
|
redirectUrl: "https://example.com/success",
|
|
113
113
|
},
|
|
114
114
|
expectedPayload: {
|
|
@@ -136,7 +136,7 @@ describe("Stripe Providers", () => {
|
|
|
136
136
|
inputs: {
|
|
137
137
|
apiKey: "sk_test_123",
|
|
138
138
|
priceId: "price_abc",
|
|
139
|
-
|
|
139
|
+
metadata: { sparks: "100" },
|
|
140
140
|
redirectUrl: "https://example.com/success",
|
|
141
141
|
quantity: 5,
|
|
142
142
|
adjustableQuantity: { enabled: true, maximum: 5 },
|
|
@@ -180,7 +180,7 @@ describe("Stripe Providers", () => {
|
|
|
180
180
|
name: "all properties change",
|
|
181
181
|
olds: {
|
|
182
182
|
priceId: "old",
|
|
183
|
-
|
|
183
|
+
metadata: { sparks: "10" },
|
|
184
184
|
redirectUrl: "url1",
|
|
185
185
|
allowPromotionCodes: false,
|
|
186
186
|
managedPayments: false,
|
|
@@ -191,7 +191,7 @@ describe("Stripe Providers", () => {
|
|
|
191
191
|
},
|
|
192
192
|
news: {
|
|
193
193
|
priceId: "new",
|
|
194
|
-
|
|
194
|
+
metadata: { sparks: "20" },
|
|
195
195
|
redirectUrl: "url2",
|
|
196
196
|
allowPromotionCodes: true,
|
|
197
197
|
managedPayments: true,
|
|
@@ -203,7 +203,7 @@ describe("Stripe Providers", () => {
|
|
|
203
203
|
expectedChanges: true,
|
|
204
204
|
expectedReplaces: [
|
|
205
205
|
"priceId",
|
|
206
|
-
"
|
|
206
|
+
"metadata",
|
|
207
207
|
"redirectUrl",
|
|
208
208
|
"allowPromotionCodes",
|
|
209
209
|
"managedPayments",
|
|
@@ -215,15 +215,23 @@ describe("Stripe Providers", () => {
|
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
name: "some properties change",
|
|
218
|
-
olds: {
|
|
219
|
-
|
|
218
|
+
olds: {
|
|
219
|
+
priceId: "old",
|
|
220
|
+
metadata: { sparks: "10" },
|
|
221
|
+
redirectUrl: "url1",
|
|
222
|
+
},
|
|
223
|
+
news: {
|
|
224
|
+
priceId: "old",
|
|
225
|
+
metadata: { sparks: "20" },
|
|
226
|
+
redirectUrl: "url1",
|
|
227
|
+
},
|
|
220
228
|
expectedChanges: true,
|
|
221
|
-
expectedReplaces: ["
|
|
229
|
+
expectedReplaces: ["metadata"],
|
|
222
230
|
},
|
|
223
231
|
{
|
|
224
232
|
name: "quantity changes",
|
|
225
|
-
olds: { priceId: "same",
|
|
226
|
-
news: { priceId: "same",
|
|
233
|
+
olds: { priceId: "same", metadata: { sparks: "10" }, quantity: 1 },
|
|
234
|
+
news: { priceId: "same", metadata: { sparks: "10" }, quantity: 2 },
|
|
227
235
|
expectedChanges: true,
|
|
228
236
|
expectedReplaces: ["quantity"],
|
|
229
237
|
},
|
|
@@ -231,12 +239,12 @@ describe("Stripe Providers", () => {
|
|
|
231
239
|
name: "adjustableQuantity changes",
|
|
232
240
|
olds: {
|
|
233
241
|
priceId: "same",
|
|
234
|
-
|
|
242
|
+
metadata: { sparks: "10" },
|
|
235
243
|
adjustableQuantity: { enabled: true, minimum: 1, maximum: 10 },
|
|
236
244
|
},
|
|
237
245
|
news: {
|
|
238
246
|
priceId: "same",
|
|
239
|
-
|
|
247
|
+
metadata: { sparks: "10" },
|
|
240
248
|
adjustableQuantity: { enabled: true, minimum: 2, maximum: 10 },
|
|
241
249
|
},
|
|
242
250
|
expectedChanges: true,
|
|
@@ -244,8 +252,8 @@ describe("Stripe Providers", () => {
|
|
|
244
252
|
},
|
|
245
253
|
{
|
|
246
254
|
name: "no properties change",
|
|
247
|
-
olds: { priceId: "same",
|
|
248
|
-
news: { priceId: "same",
|
|
255
|
+
olds: { priceId: "same", metadata: { sparks: "10" } },
|
|
256
|
+
news: { priceId: "same", metadata: { sparks: "10" } },
|
|
249
257
|
expectedChanges: false,
|
|
250
258
|
expectedReplaces: [],
|
|
251
259
|
},
|