maxmind minfraud reporting

This commit is contained in:
Kyle Drake 2023-11-26 11:09:02 -06:00
parent 7c04f53af1
commit 6ddef6aa59
2 changed files with 23 additions and 3 deletions

View file

@ -250,7 +250,8 @@ post '/admin/banhammer' do
StopForumSpamWorker.perform_async( StopForumSpamWorker.perform_async(
username: site.username, username: site.username,
email: site.email, email: site.email,
ip: site.ip ip: site.ip,
classifier: params[:classifier]
) )
end end
end end

View file

@ -3,8 +3,27 @@ class StopForumSpamWorker
sidekiq_options queue: :stop_forum_spam, retry: 1, backtrace: true sidekiq_options queue: :stop_forum_spam, retry: 1, backtrace: true
def perform(opts) def perform(opts)
opts.merge! api_key: $config['stop_forum_spam_api_key'] txn = Minfraud::Components::Report::Transaction.new(
res = HTTP.post 'https://stopforumspam.com/add', form: opts ip_address: opts.ip,
tag: :spam_or_abuse,
# The following key/values are not mandatory but are encouraged
maxmind_id: $config['minfraud_account_id'],
#minfraud_id: '01c25cb0-f067-4e02-8ed0-a094c580f5e4',
#transaction_id: 'txn123'
#chargeback_code: 'BL'
notes: opts[:classifier]
)
reporter = Minfraud::Report.new transaction: txn
res = reporter.report_transaction
puts res.inspect
res = HTTP.post 'https://stopforumspam.com/add', form: {
api_key: $config['stop_forum_spam_api_key'],
username: opts.username,
email: opts.email,
ip: opts.ip
}
puts res.inspect puts res.inspect
end end
end end