Files
danbooru/app/controllers/webhooks_controller.rb
evazion 1eb15da7c5 upgrades: add authorize.net integration.
Add integration for accepting payments with Authorize.net.

https://developer.authorize.net/hello_world.html
2022-05-15 01:47:45 -05:00

27 lines
651 B
Ruby

# frozen_string_literal: true
class WebhooksController < ApplicationController
skip_forgery_protection only: [:receive, :authorize_net]
rescue_with Stripe::SignatureVerificationError, status: 400
rescue_with DiscordSlashCommand::WebhookVerificationError, status: 401
def receive
case params[:source]
when "stripe"
PaymentTransaction::Stripe.receive_webhook(request)
head 200
when "discord"
json = DiscordSlashCommand.receive_webhook(request)
render json: json
else
head 400
end
end
def authorize_net
PaymentTransaction::AuthorizeNet.receive_webhook(request)
head 200
end
end