tom-microservice 3.5.5 → 3.5.7

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.5",
5
+ "version": "3.5.7",
6
6
  "main": "src",
7
7
  "bin": {
8
8
  "tom": "bin/index.js"
@@ -78,6 +78,7 @@
78
78
  "@commitlint/cli": "latest",
79
79
  "@commitlint/config-conventional": "latest",
80
80
  "@faker-js/faker": "latest",
81
+ "async-listen": "latest",
81
82
  "ava": "latest",
82
83
  "browser-sync": "latest",
83
84
  "c8": "latest",
@@ -103,7 +104,6 @@
103
104
  "standard-markdown": "latest",
104
105
  "standard-version": "latest",
105
106
  "svr": "latest",
106
- "test-listen": "latest",
107
107
  "untracked": "latest"
108
108
  },
109
109
  "engines": {
@@ -16,24 +16,20 @@ module.exports = ({ config }) => {
16
16
 
17
17
  const stripe = createStripe(get(config, 'payment.stripe_key'))
18
18
 
19
- const update = async ({ customerId, ipAddress, headers }) => {
19
+ const update = async ({ setupIntentId, customerId, ipAddress, headers }) => {
20
20
  ward(customerId, { label: 'customerId', test: is.string.nonEmpty })
21
+ ward(setupIntentId, { label: 'setupIntentId', test: is.string.nonEmpty })
21
22
 
22
23
  const [
23
24
  newMetadata,
24
25
  { metadata: oldMetadata, email },
25
- { data: paymentMethods }
26
+ { payment_method: paymentMethod }
26
27
  ] = await Promise.all([
27
28
  getMetadata({ ipAddress, headers }),
28
29
  stripe.customers.retrieve(customerId),
29
- stripe.paymentMethods.list({
30
- customer: customerId,
31
- type: 'card'
32
- })
30
+ stripe.setupIntents.retrieve(setupIntentId)
33
31
  ])
34
32
 
35
- const paymentMethod = paymentMethods[0].id
36
-
37
33
  await stripe.customers.update(customerId, {
38
34
  metadata: { ...oldMetadata, ...newMetadata },
39
35
  invoice_settings: { default_payment_method: paymentMethod }