tom-microservice 3.9.50 → 3.10.1
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "tom-microservice",
|
|
3
3
|
"description": "Tom creates customers, subscriptions plans & send notifications.",
|
|
4
4
|
"homepage": "https://tom.js.org",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.10.1",
|
|
6
6
|
"main": "src",
|
|
7
7
|
"bin": {
|
|
8
8
|
"tom": "bin/index.js"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"map-values-deep": "~1.0.2",
|
|
48
48
|
"meow": "~9.0.0",
|
|
49
49
|
"mitt": "~3.0.1",
|
|
50
|
-
"morgan": "~1.
|
|
50
|
+
"morgan": "~1.11.0",
|
|
51
51
|
"nodemailer": "~8.0.0",
|
|
52
52
|
"ow": "~0.28.2",
|
|
53
53
|
"p-reflect": "~2.1.0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
"nano-staged": {
|
|
139
139
|
"*.js": [
|
|
140
|
-
"
|
|
140
|
+
"standard --fix"
|
|
141
141
|
],
|
|
142
142
|
"package.json": [
|
|
143
143
|
"finepack"
|
|
@@ -30,15 +30,31 @@ module.exports = ({ config }) => {
|
|
|
30
30
|
|
|
31
31
|
const metadata = await getMetadata({ ipAddress, headers })
|
|
32
32
|
|
|
33
|
+
const priceId = planId.startsWith('price_')
|
|
34
|
+
? planId
|
|
35
|
+
: await stripe.prices
|
|
36
|
+
.list({ lookup_keys: [planId], limit: 1 })
|
|
37
|
+
.then(({ data }) => {
|
|
38
|
+
if (!data.length) {
|
|
39
|
+
throw new TypeError(
|
|
40
|
+
`The lookup key '${planId}' doesn't match any active Stripe price`
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
return data[0].id
|
|
44
|
+
})
|
|
45
|
+
|
|
33
46
|
const session = await stripe.checkout.sessions.create({
|
|
34
47
|
billing_address_collection: 'required',
|
|
35
48
|
mode: 'subscription',
|
|
36
49
|
line_items: [
|
|
37
50
|
{
|
|
38
|
-
price:
|
|
51
|
+
price: priceId,
|
|
39
52
|
quantity: 1
|
|
40
53
|
}
|
|
41
54
|
],
|
|
55
|
+
adaptive_pricing: {
|
|
56
|
+
enabled: true
|
|
57
|
+
},
|
|
42
58
|
tax_id_collection: {
|
|
43
59
|
enabled: true
|
|
44
60
|
},
|