@drawbridge/drawbridge-stripe 0.0.8 → 0.0.9

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/dist/index.js CHANGED
@@ -19,24 +19,26 @@ var require_billing = __commonJS({
19
19
  }
20
20
  };
21
21
  const subscribe = async ({
22
- currency: currency2,
22
+ currency,
23
23
  customer,
24
24
  default_payment_method = null,
25
25
  metadata = {}
26
26
  }) => {
27
27
  var _a, _b, _c, _d;
28
28
  try {
29
- const billing_profile_data = {
30
- customer
29
+ const payer = {
30
+ billing_profile_data: {
31
+ customer
32
+ }
31
33
  };
32
34
  if (Boolean(default_payment_method)) {
33
- billing_profile_data["default_payment_method"] = default_payment_method;
35
+ payer.billing_profile_data.default_payment_method = default_payment_method;
34
36
  }
35
37
  ;
36
38
  const { data: intent } = await axios.post(
37
39
  billing + "/intents",
38
40
  {
39
- currency: currency2,
41
+ currency,
40
42
  cadence_data: {
41
43
  billing_cycle: {
42
44
  type: "month",
@@ -45,9 +47,7 @@ var require_billing = __commonJS({
45
47
  day_of_month: 1
46
48
  }
47
49
  },
48
- payer: {
49
- billing_profile_data
50
- }
50
+ payer
51
51
  },
52
52
  actions: [
53
53
  {
@@ -99,7 +99,7 @@ var require_billing = __commonJS({
99
99
  lte: {
100
100
  balance_type: "monetary",
101
101
  monetary: {
102
- currency: currency2,
102
+ currency,
103
103
  value: 500
104
104
  // cents
105
105
  }
@@ -126,7 +126,7 @@ var require_billing = __commonJS({
126
126
  lte: {
127
127
  balance_type: "monetary",
128
128
  monetary: {
129
- currency: currency2,
129
+ currency,
130
130
  value: 1
131
131
  // cents
132
132
  }
@@ -148,7 +148,10 @@ var require_billing = __commonJS({
148
148
  throw error;
149
149
  }
150
150
  };
151
- const unsubscribe = async (id) => {
151
+ const unsubscribe = async ({
152
+ currency,
153
+ id
154
+ }) => {
152
155
  try {
153
156
  const { data } = await axios.post(
154
157
  billing + "/intents",
@@ -250,7 +253,7 @@ var require_subscription = __commonJS({
250
253
  };
251
254
  };
252
255
  const createTier = async ({
253
- currency: currency2,
256
+ currency,
254
257
  interval,
255
258
  limit,
256
259
  metadata,
@@ -266,7 +269,7 @@ var require_subscription = __commonJS({
266
269
  response["product"] = product == null ? void 0 : product.id;
267
270
  const price = await stripe2.prices.create({
268
271
  billing_scheme: "tiered",
269
- currency: currency2,
272
+ currency,
270
273
  metadata,
271
274
  nickname: name,
272
275
  product: product == null ? void 0 : product.id,
@@ -294,7 +297,7 @@ var require_subscription = __commonJS({
294
297
  ;
295
298
  };
296
299
  const createItem = async ({
297
- currency: currency2,
300
+ currency,
298
301
  interval,
299
302
  limit,
300
303
  metadata,
@@ -311,7 +314,7 @@ var require_subscription = __commonJS({
311
314
  response["meter"] = meter;
312
315
  response["usage"] = usage;
313
316
  const { price, product } = await createTier({
314
- currency: currency2,
317
+ currency,
315
318
  interval,
316
319
  limit,
317
320
  metadata,
package/dist/index.mjs CHANGED
@@ -25,24 +25,26 @@ var require_billing = __commonJS({
25
25
  }
26
26
  };
27
27
  const subscribe = async ({
28
- currency: currency2,
28
+ currency,
29
29
  customer,
30
30
  default_payment_method = null,
31
31
  metadata = {}
32
32
  }) => {
33
33
  var _a, _b, _c, _d;
34
34
  try {
35
- const billing_profile_data = {
36
- customer
35
+ const payer = {
36
+ billing_profile_data: {
37
+ customer
38
+ }
37
39
  };
38
40
  if (Boolean(default_payment_method)) {
39
- billing_profile_data["default_payment_method"] = default_payment_method;
41
+ payer.billing_profile_data.default_payment_method = default_payment_method;
40
42
  }
41
43
  ;
42
44
  const { data: intent } = await axios.post(
43
45
  billing + "/intents",
44
46
  {
45
- currency: currency2,
47
+ currency,
46
48
  cadence_data: {
47
49
  billing_cycle: {
48
50
  type: "month",
@@ -51,9 +53,7 @@ var require_billing = __commonJS({
51
53
  day_of_month: 1
52
54
  }
53
55
  },
54
- payer: {
55
- billing_profile_data
56
- }
56
+ payer
57
57
  },
58
58
  actions: [
59
59
  {
@@ -105,7 +105,7 @@ var require_billing = __commonJS({
105
105
  lte: {
106
106
  balance_type: "monetary",
107
107
  monetary: {
108
- currency: currency2,
108
+ currency,
109
109
  value: 500
110
110
  // cents
111
111
  }
@@ -132,7 +132,7 @@ var require_billing = __commonJS({
132
132
  lte: {
133
133
  balance_type: "monetary",
134
134
  monetary: {
135
- currency: currency2,
135
+ currency,
136
136
  value: 1
137
137
  // cents
138
138
  }
@@ -154,7 +154,10 @@ var require_billing = __commonJS({
154
154
  throw error;
155
155
  }
156
156
  };
157
- const unsubscribe = async (id) => {
157
+ const unsubscribe = async ({
158
+ currency,
159
+ id
160
+ }) => {
158
161
  try {
159
162
  const { data } = await axios.post(
160
163
  billing + "/intents",
@@ -256,7 +259,7 @@ var require_subscription = __commonJS({
256
259
  };
257
260
  };
258
261
  const createTier = async ({
259
- currency: currency2,
262
+ currency,
260
263
  interval,
261
264
  limit,
262
265
  metadata,
@@ -272,7 +275,7 @@ var require_subscription = __commonJS({
272
275
  response["product"] = product == null ? void 0 : product.id;
273
276
  const price = await stripe.prices.create({
274
277
  billing_scheme: "tiered",
275
- currency: currency2,
278
+ currency,
276
279
  metadata,
277
280
  nickname: name,
278
281
  product: product == null ? void 0 : product.id,
@@ -300,7 +303,7 @@ var require_subscription = __commonJS({
300
303
  ;
301
304
  };
302
305
  const createItem = async ({
303
- currency: currency2,
306
+ currency,
304
307
  interval,
305
308
  limit,
306
309
  metadata,
@@ -317,7 +320,7 @@ var require_subscription = __commonJS({
317
320
  response["meter"] = meter;
318
321
  response["usage"] = usage;
319
322
  const { price, product } = await createTier({
320
- currency: currency2,
323
+ currency,
321
324
  interval,
322
325
  limit,
323
326
  metadata,
package/package.json CHANGED
@@ -24,5 +24,5 @@
24
24
  "build": "tsup ./index.js"
25
25
  },
26
26
  "types": "dist/index.d.ts",
27
- "version": "0.0.8"
27
+ "version": "0.0.9"
28
28
  }