mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
send email for new customers, closes #103
This commit is contained in:
parent
0f958023d0
commit
4e0ff8a7ca
1 changed files with 9 additions and 2 deletions
|
@ -1,8 +1,15 @@
|
|||
post '/stripe_webhook' do
|
||||
event = JSON.parse request.body.read
|
||||
if event['type'] == 'customer.created'
|
||||
username = event['data']['object']['description']
|
||||
username = event['data']['object']['description'].split(' - ').first
|
||||
email = event['data']['object']['email']
|
||||
|
||||
EmailWorker.perform_async({
|
||||
from: 'web@neocities.org',
|
||||
to: 'contact@neocities.org',
|
||||
subject: "[Neocities] New customer: #{username}",
|
||||
body: "#{username}\n#{email}\n#{Site[username: username].uri}"
|
||||
})
|
||||
end
|
||||
'ok'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue