upgrades: add authorize.net integration.
Add integration for accepting payments with Authorize.net. https://developer.authorize.net/hello_world.html
This commit is contained in:
@@ -4,7 +4,7 @@ class UserUpgradesController < ApplicationController
|
||||
respond_to :js, :html, :json, :xml
|
||||
|
||||
def create
|
||||
@user_upgrade = authorize UserUpgrade.create(recipient: recipient, purchaser: CurrentUser.user, status: "pending", upgrade_type: params[:upgrade_type])
|
||||
@user_upgrade = authorize UserUpgrade.create(recipient: recipient, purchaser: CurrentUser.user, status: "pending", upgrade_type: params[:upgrade_type], payment_processor: params[:payment_processor])
|
||||
@country = params[:country] || CurrentUser.country || "US"
|
||||
@allow_promotion_codes = params[:promo].to_s.truthy?
|
||||
@checkout = @user_upgrade.create_checkout!(country: @country, allow_promotion_codes: @allow_promotion_codes)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WebhooksController < ApplicationController
|
||||
skip_forgery_protection only: :receive
|
||||
skip_forgery_protection only: [:receive, :authorize_net]
|
||||
|
||||
rescue_with Stripe::SignatureVerificationError, status: 400
|
||||
rescue_with DiscordSlashCommand::WebhookVerificationError, status: 401
|
||||
|
||||
@@ -17,4 +18,9 @@ class WebhooksController < ApplicationController
|
||||
head 400
|
||||
end
|
||||
end
|
||||
|
||||
def authorize_net
|
||||
PaymentTransaction::AuthorizeNet.receive_webhook(request)
|
||||
head 200
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user