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