-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapplication.yml
104 lines (104 loc) · 2.86 KB
/
application.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Webhook-To-Stripe
steps:
- type: trigger
instance:
src: https://github.com/mesg-foundation/service-webhook
eventKey: request
- type: task
key: request-data
instance:
src: https://github.com/mesg-foundation/service-js-function
taskKey: execute
inputs:
code: >
module.export = value => ({
email: value.email,
number: value.number,
ethAddress: value.ethAddress,
credit_card_token: value.credit_card_token,
amount: (value.number / 1e18) * 0.4 * 100
})
inputs:
email:
key: data.email
number:
key: data.number
ethAddress:
key: data.ethAddress
credit_card_token:
key: data.token
- type: task
key: stripe-charge
instance:
src: https://github.com/mesg-foundation/service-stripe
env:
- STRIPE_SECRET_KEY=$(env:STRIPE_SECRET_KEY)
taskKey: charge
inputs:
amount:
stepKey: request-data
key: result.amount
currency: usd
email:
stepKey: request-data
key: result.email
metadata:
address:
stepKey: request-data
key: result.ethAddress
tokens:
stepKey: request-data
key: result.number
source:
stepKey: request-data
key: result.credit_card_token
- type: task
key: erc20-transfer
instance:
src: https://github.com/mesg-foundation/service-ethereum-erc20
env:
- PROVIDER_ENDPOINT=$(env:PROVIDER_ENDPOINT)
taskKey: transfer
inputs:
privateKey: '$(env:PRIVATE_KEY)'
contractAddress: '0xd14a3d6b94016e455af5eb7f329bc572ea626c5f'
gasLimit: 100000
gasPrice: '10000000000'
to:
stepKey: stripe-charge
key: metadata.address
value:
stepKey: stripe-charge
key: metadata.tokens
- type: task
instance:
src: https://github.com/mesg-foundation/service-js-function
taskKey: execute
inputs:
code: >
module.exports = (value) =>
`Hello, Thanks for your payment of $${value.prices / 100}. You will receive ${value.token / 1e18} MESG tokens. See the details of the transaction here https://ropsten.etherscan.io/tx/${value.transaction}`
inputs:
prices:
stepKey: stripe-charge
key: amount
token:
stepKey: stripe-charge
key: metadata.tokens
transaction:
stepKey: erc20-transfer
key: transactionHash
- type: task
instance:
src: https://github.com/mesg-foundation/service-email-sendgrid
env:
- SENDGRID_API_KEY=$(env:SENDGRID_API_KEY)
taskKey: send
inputs:
from: 'no-reply@mesg.com'
to:
stepKey: stripe-charge
key: customer
subject: 'Your MESG tokens are coming'
text:
key: result