2019-10-10 13:52:55 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module DiscoursePatrons
|
|
|
|
class PlansController < ::ApplicationController
|
|
|
|
include DiscoursePatrons::Stripe
|
|
|
|
|
|
|
|
before_action :set_api_key
|
|
|
|
|
|
|
|
def index
|
2019-10-17 12:07:06 +11:00
|
|
|
begin
|
2019-10-24 10:39:10 +11:00
|
|
|
plans = ::Stripe::Plan.list(active: true)
|
2019-10-17 12:07:06 +11:00
|
|
|
|
2019-10-25 08:18:16 +11:00
|
|
|
# TODO: Serialize. Remove some attributes like meta.group_name
|
2019-10-17 12:07:06 +11:00
|
|
|
render_json_dump plans.data
|
|
|
|
|
|
|
|
rescue ::Stripe::InvalidRequestError => e
|
|
|
|
return render_json_error e.message
|
|
|
|
end
|
2019-10-10 13:52:55 +11:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|