-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest-stripe-accounts.js
More file actions
74 lines (73 loc) · 2.57 KB
/
Copy pathtest-stripe-accounts.js
File metadata and controls
74 lines (73 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const TestHelper = require('./test-helper.js')
module.exports = {
createOwnerWithPlan: async (planData) => {
const owner = await TestHelper.createOwner()
const product = await TestHelper.createProduct(owner, {
published: true
})
planData = planData || {}
await TestHelper.createPlan(owner, {
productid: product.id,
published: true,
trial_period_days: planData.trial_period_days !== undefined ? planData.trial_period_days : 0,
amount: planData.amount !== undefined ? planData.amount : 1000,
interval: planData.interval || 'month',
usage_type: planData.usage_type || 'licensed'
})
return owner
},
createOwnerWithUnpublishedPlan: async (planData) => {
const owner = await TestHelper.createOwner()
const product = await TestHelper.createProduct(owner, {
published: true
})
planData = planData || {}
await TestHelper.createPlan(owner, {
productid: product.id,
published: true,
unpublished: 'true',
trial_period_days: planData.trial_period_days !== undefined ? planData.trial_period_days : 0,
amount: planData.amount !== undefined ? planData.amount : 1000,
interval: planData.interval || 'month',
usage_type: planData.usage_type || 'licensed'
})
return owner
},
createOwnerWithNotPublishedPlan: async (planData) => {
const owner = await TestHelper.createOwner()
const product = await TestHelper.createProduct(owner, {
published: true
})
planData = planData || {}
await TestHelper.createPlan(owner, {
productid: product.id,
trial_period_days: planData.trial_period_days !== undefined ? planData.trial_period_days : 0,
amount: planData.amount !== undefined ? planData.amount : 1000,
interval: planData.interval || 'month',
usage_type: planData.usage_type || 'licensed'
})
return owner
},
createUserWithPaymentMethod: async (user) => {
user = user || await TestHelper.createUser()
await TestHelper.createCustomer(user, {
email: user.profile.contactEmail,
description: user.profile.firstName
})
await TestHelper.createPaymentMethod(user, {
cvc: '111',
number: '4111111111111111',
exp_month: '1',
exp_year: (new Date().getFullYear() + 1).toString().substring(2),
name: user.profile.firstName + ' ' + user.profile.lastName,
address_line1: '285 Fulton St',
address_line2: 'Apt 893',
address_city: 'New York',
address_state: 'NY',
address_zip: '10007',
address_country: 'US',
default: 'true'
})
return user
}
}