the subscribe product page
This commit is contained in:
@@ -8,14 +8,14 @@ module DiscoursePatrons
|
||||
|
||||
def index
|
||||
begin
|
||||
customers = ::Stripe::Customer.list(
|
||||
email: current_user.email,
|
||||
expand: ['data.subscriptions']
|
||||
)
|
||||
products = ::Stripe::Product.list(active: true)
|
||||
|
||||
subscriptions = customers[:data].map do |customer|
|
||||
customer[:subscriptions][:data]
|
||||
end.flatten(1)
|
||||
subscriptions = products[:data].map do |p|
|
||||
{
|
||||
id: p[:id],
|
||||
description: p.dig(:metadata, :description)
|
||||
}
|
||||
end
|
||||
|
||||
render_json_dump subscriptions
|
||||
|
||||
@@ -50,17 +50,6 @@ module DiscoursePatrons
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
begin
|
||||
subscription = ::Stripe::Subscription.delete(params[:id])
|
||||
|
||||
render_json_dump subscription
|
||||
|
||||
rescue ::Stripe::InvalidRequestError => e
|
||||
return render_json_error e.message
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def plan_group(plan)
|
||||
|
||||
Reference in New Issue
Block a user