Add empty webhook url and upgrade stripe gem

This commit is contained in:
Rimian Perkins 2020-01-10 10:24:09 +11:00
parent 7f4fb2a503
commit 431279a4f7
5 changed files with 31 additions and 2 deletions

View File

@ -52,6 +52,12 @@ In the admin, add a new Product. Once you have a product saved, you can add plan
If you take a look at your [Stripe Dashboard](https://dashboard.stripe.com), you'll see all those products and plans are listed. Discourse Subscriptions does not create them locally. They are created in Stripe.
## Enable Webhooks
You'll need to tell Stripe where your end points are. You can enter this in your Stripe dashboard.
The address for webhooks is: `/s/hooks`
## Testing
Test with these credit card numbers:

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
module DiscourseSubscriptions
class HooksController < ::ApplicationController
def create
head 200
end
end
end

View File

@ -18,6 +18,7 @@ DiscourseSubscriptions::Engine.routes.draw do
end
resources :customers, only: [:create]
resources :hooks, only: [:create]
resources :invoices, only: [:index]
resources :payments, only: [:create]
resources :plans, only: [:index]

View File

@ -2,7 +2,7 @@
# name: discourse-subscriptions
# about: Integrates Stripe into Discourse to allow visitors to subscribe
# version: 2.7.0
# version: 2.7.1
# url: https://github.com/rimian/discourse-subscriptions
# authors: Rimian Perkins
@ -44,7 +44,7 @@ after_initialize do
::Stripe.set_app_info(
'Discourse Subscriptions',
version: '2.7.0',
version: '2.7.1',
url: 'https://github.com/rimian/discourse-subscriptions'
)
@ -60,6 +60,7 @@ after_initialize do
"../app/controllers/user/payments_controller",
"../app/controllers/user/subscriptions_controller",
"../app/controllers/customers_controller",
"../app/controllers/hooks_controller",
"../app/controllers/invoices_controller",
"../app/controllers/plans_controller",
"../app/controllers/payments_controller",

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
require 'rails_helper'
module DiscourseSubscriptions
RSpec.describe HooksController do
it "responds ok" do
post "/s/hooks.json"
expect(response.status).to eq 200
end
end
end