2019-09-24 16:04:42 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
module DiscoursePatrons
|
|
|
|
|
class PlansController < ::Admin::AdminController
|
2019-09-24 20:44:51 +10:00
|
|
|
include DiscoursePatrons::Stripe
|
2019-09-24 16:04:42 +10:00
|
|
|
|
2019-09-24 20:44:51 +10:00
|
|
|
before_action :set_api_key
|
|
|
|
|
|
|
|
|
|
def create
|
|
|
|
|
plan = ::Stripe::Plan.create(
|
|
|
|
|
amount: params[:amount],
|
|
|
|
|
interval: params[:interval],
|
|
|
|
|
product: {
|
|
|
|
|
name: 'Gold special',
|
|
|
|
|
},
|
2019-09-24 20:57:42 +10:00
|
|
|
currency: SiteSetting.discourse_patrons_currency,
|
2019-09-24 20:44:51 +10:00
|
|
|
id: 'gold-special',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
plan.to_json
|
2019-09-24 16:04:42 +10:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|