@efaj/pulumi-dynamic-stripe 0.2.2-a1dc919 → 0.2.2

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/README.md CHANGED
@@ -61,10 +61,7 @@ const premiumPrice = new Price("premium-price", {
61
61
  const premiumPaymentLink = new PaymentLink("premium-link", {
62
62
  apiKey: stripeApiKey,
63
63
  priceId: premiumPrice.priceId,
64
- metadata: {
65
- tier: "premium",
66
- campaign: "summer_sale",
67
- },
64
+ sparksAmount: "1000",
68
65
  });
69
66
 
70
67
  // 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>;
5
6
  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;
20
21
  redirectUrl: string;
21
- metadata?: Record<string, string>;
22
22
  allowPromotionCodes?: boolean;
23
23
  managedPayments?: boolean;
24
24
  automaticTax?: boolean;
@@ -72,7 +72,9 @@ class StripePaymentLinkProvider {
72
72
  ? { managed_payments: { enabled: true } }
73
73
  : {}),
74
74
  ...(inputs.automaticTax ? { automatic_tax: { enabled: true } } : {}),
75
- ...(inputs.metadata ? { metadata: inputs.metadata } : {}),
75
+ metadata: {
76
+ sparks: inputs.sparksAmount,
77
+ },
76
78
  });
77
79
  return {
78
80
  id: paymentLink.id,
@@ -87,8 +89,8 @@ class StripePaymentLinkProvider {
87
89
  const replaces = [];
88
90
  if (olds.priceId !== news.priceId)
89
91
  replaces.push("priceId");
90
- if (JSON.stringify(olds.metadata) !== JSON.stringify(news.metadata))
91
- replaces.push("metadata");
92
+ if (olds.sparksAmount !== news.sparksAmount)
93
+ replaces.push("sparksAmount");
92
94
  if (olds.redirectUrl !== news.redirectUrl)
93
95
  replaces.push("redirectUrl");
94
96
  if (olds.allowPromotionCodes !== news.allowPromotionCodes)
@@ -122,8 +124,8 @@ class PaymentLink extends pulumi.dynamic.Resource {
122
124
  super(stripePaymentLinkProvider, name, {
123
125
  apiKey: args.apiKey,
124
126
  priceId: args.priceId,
127
+ sparksAmount: args.sparksAmount,
125
128
  redirectUrl: args.redirectUrl,
126
- metadata: args.metadata,
127
129
  allowPromotionCodes: args.allowPromotionCodes,
128
130
  managedPayments: args.managedPayments,
129
131
  automaticTax: args.automaticTax,
@@ -25,7 +25,6 @@ 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>>;
29
28
  }
30
29
  export interface RecurringProviderArgs {
31
30
  interval: RecurringInterval;
@@ -52,7 +51,6 @@ export interface StripePriceProviderArgs {
52
51
  tiersMode?: TiersMode;
53
52
  tiers?: TierProviderArgs[];
54
53
  transformQuantity?: TransformQuantityProviderArgs;
55
- metadata?: Record<string, string>;
56
54
  }
57
55
  export declare class StripePriceProvider implements pulumi.dynamic.ResourceProvider {
58
56
  create(inputs: StripePriceProviderArgs): Promise<pulumi.dynamic.CreateResult>;
@@ -78,7 +78,6 @@ class StripePriceProvider {
78
78
  },
79
79
  }
80
80
  : {}),
81
- ...(inputs.metadata ? { metadata: inputs.metadata } : {}),
82
81
  });
83
82
  return {
84
83
  id: price.id,
@@ -109,8 +108,6 @@ class StripePriceProvider {
109
108
  if (JSON.stringify(olds.transformQuantity) !==
110
109
  JSON.stringify(news.transformQuantity))
111
110
  replaces.push("transformQuantity");
112
- if (JSON.stringify(olds.metadata) !== JSON.stringify(news.metadata))
113
- replaces.push("metadata");
114
111
  if (olds.apiKey !== news.apiKey)
115
112
  replaces.push("apiKey");
116
113
  return {
@@ -4,14 +4,12 @@ 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>>;
8
7
  }
9
8
  export interface StripeProductProviderArgs {
10
9
  apiKey: string;
11
10
  name: string;
12
11
  description?: string;
13
12
  taxCode?: string;
14
- metadata?: Record<string, string>;
15
13
  }
16
14
  export declare class StripeProductProvider implements pulumi.dynamic.ResourceProvider {
17
15
  create(inputs: StripeProductProviderArgs): Promise<pulumi.dynamic.CreateResult>;
@@ -47,7 +47,6 @@ class StripeProductProvider {
47
47
  name: inputs.name,
48
48
  description: inputs.description,
49
49
  tax_code: inputs.taxCode,
50
- ...(inputs.metadata ? { metadata: inputs.metadata } : {}),
51
50
  });
52
51
  return {
53
52
  id: product.id,
@@ -65,8 +64,6 @@ class StripeProductProvider {
65
64
  changes.push("description");
66
65
  if (olds.taxCode !== news.taxCode)
67
66
  changes.push("taxCode");
68
- if (JSON.stringify(olds.metadata) !== JSON.stringify(news.metadata))
69
- changes.push("metadata");
70
67
  if (olds.apiKey !== news.apiKey)
71
68
  changes.push("apiKey");
72
69
  return {
@@ -80,7 +77,6 @@ class StripeProductProvider {
80
77
  name: news.name,
81
78
  description: news.description,
82
79
  tax_code: news.taxCode,
83
- ...(news.metadata ? { metadata: news.metadata } : {}),
84
80
  });
85
81
  return {
86
82
  outs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efaj/pulumi-dynamic-stripe",
3
- "version": "0.2.2-a1dc919",
3
+ "version": "0.2.2",
4
4
  "description": "A Pulumi Dynamic Provider for Stripe, supporting modern features like Payment Links.",
5
5
  "keywords": [
6
6
  "pulumi",
@@ -75,7 +75,7 @@ describe("Stripe Providers", () => {
75
75
  inputs: {
76
76
  apiKey: "sk_test_123",
77
77
  priceId: "price_abc",
78
- metadata: { sparks: "100" },
78
+ sparksAmount: "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
- metadata: { sparks: "50" },
111
+ sparksAmount: "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
- metadata: { sparks: "100" },
139
+ sparksAmount: "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
- metadata: { sparks: "10" },
183
+ sparksAmount: "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
- metadata: { sparks: "20" },
194
+ sparksAmount: "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
- "metadata",
206
+ "sparksAmount",
207
207
  "redirectUrl",
208
208
  "allowPromotionCodes",
209
209
  "managedPayments",
@@ -215,23 +215,15 @@ describe("Stripe Providers", () => {
215
215
  },
216
216
  {
217
217
  name: "some properties change",
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
- },
218
+ olds: { priceId: "old", sparksAmount: "10", redirectUrl: "url1" },
219
+ news: { priceId: "old", sparksAmount: "20", redirectUrl: "url1" },
228
220
  expectedChanges: true,
229
- expectedReplaces: ["metadata"],
221
+ expectedReplaces: ["sparksAmount"],
230
222
  },
231
223
  {
232
224
  name: "quantity changes",
233
- olds: { priceId: "same", metadata: { sparks: "10" }, quantity: 1 },
234
- news: { priceId: "same", metadata: { sparks: "10" }, quantity: 2 },
225
+ olds: { priceId: "same", sparksAmount: "10", quantity: 1 },
226
+ news: { priceId: "same", sparksAmount: "10", quantity: 2 },
235
227
  expectedChanges: true,
236
228
  expectedReplaces: ["quantity"],
237
229
  },
@@ -239,12 +231,12 @@ describe("Stripe Providers", () => {
239
231
  name: "adjustableQuantity changes",
240
232
  olds: {
241
233
  priceId: "same",
242
- metadata: { sparks: "10" },
234
+ sparksAmount: "10",
243
235
  adjustableQuantity: { enabled: true, minimum: 1, maximum: 10 },
244
236
  },
245
237
  news: {
246
238
  priceId: "same",
247
- metadata: { sparks: "10" },
239
+ sparksAmount: "10",
248
240
  adjustableQuantity: { enabled: true, minimum: 2, maximum: 10 },
249
241
  },
250
242
  expectedChanges: true,
@@ -252,8 +244,8 @@ describe("Stripe Providers", () => {
252
244
  },
253
245
  {
254
246
  name: "no properties change",
255
- olds: { priceId: "same", metadata: { sparks: "10" } },
256
- news: { priceId: "same", metadata: { sparks: "10" } },
247
+ olds: { priceId: "same", sparksAmount: "10" },
248
+ news: { priceId: "same", sparksAmount: "10" },
257
249
  expectedChanges: false,
258
250
  expectedReplaces: [],
259
251
  },