product controller
This commit is contained in:
@@ -10,6 +10,7 @@ module DiscoursePatrons
|
||||
begin
|
||||
plans = ::Stripe::Plan.list(active: true)
|
||||
|
||||
# TODO: Serialize. Remove some attributes like meta.group_name
|
||||
render_json_dump plans.data
|
||||
|
||||
rescue ::Stripe::InvalidRequestError => e
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module DiscoursePatrons
|
||||
class ProductsController < ::ApplicationController
|
||||
include DiscoursePatrons::Stripe
|
||||
|
||||
before_action :set_api_key
|
||||
|
||||
def index
|
||||
begin
|
||||
products = ::Stripe::Product.list(active: true)
|
||||
|
||||
# TODO: Serialize. Remove some attributes like metadata
|
||||
render_json_dump products.data
|
||||
|
||||
rescue ::Stripe::InvalidRequestError => e
|
||||
return render_json_error e.message
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user