mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-07-07 06:52:32 +00:00
Add empty webhook url and upgrade stripe gem
This commit is contained in:
parent
7f4fb2a503
commit
431279a4f7
@ -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.
|
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
|
## Testing
|
||||||
|
|
||||||
Test with these credit card numbers:
|
Test with these credit card numbers:
|
||||||
|
9
app/controllers/hooks_controller.rb
Normal file
9
app/controllers/hooks_controller.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module DiscourseSubscriptions
|
||||||
|
class HooksController < ::ApplicationController
|
||||||
|
def create
|
||||||
|
head 200
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -18,6 +18,7 @@ DiscourseSubscriptions::Engine.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
resources :customers, only: [:create]
|
resources :customers, only: [:create]
|
||||||
|
resources :hooks, only: [:create]
|
||||||
resources :invoices, only: [:index]
|
resources :invoices, only: [:index]
|
||||||
resources :payments, only: [:create]
|
resources :payments, only: [:create]
|
||||||
resources :plans, only: [:index]
|
resources :plans, only: [:index]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# name: discourse-subscriptions
|
# name: discourse-subscriptions
|
||||||
# about: Integrates Stripe into Discourse to allow visitors to subscribe
|
# 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
|
# url: https://github.com/rimian/discourse-subscriptions
|
||||||
# authors: Rimian Perkins
|
# authors: Rimian Perkins
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ after_initialize do
|
|||||||
|
|
||||||
::Stripe.set_app_info(
|
::Stripe.set_app_info(
|
||||||
'Discourse Subscriptions',
|
'Discourse Subscriptions',
|
||||||
version: '2.7.0',
|
version: '2.7.1',
|
||||||
url: 'https://github.com/rimian/discourse-subscriptions'
|
url: 'https://github.com/rimian/discourse-subscriptions'
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -60,6 +60,7 @@ after_initialize do
|
|||||||
"../app/controllers/user/payments_controller",
|
"../app/controllers/user/payments_controller",
|
||||||
"../app/controllers/user/subscriptions_controller",
|
"../app/controllers/user/subscriptions_controller",
|
||||||
"../app/controllers/customers_controller",
|
"../app/controllers/customers_controller",
|
||||||
|
"../app/controllers/hooks_controller",
|
||||||
"../app/controllers/invoices_controller",
|
"../app/controllers/invoices_controller",
|
||||||
"../app/controllers/plans_controller",
|
"../app/controllers/plans_controller",
|
||||||
"../app/controllers/payments_controller",
|
"../app/controllers/payments_controller",
|
||||||
|
12
spec/requests/hooks_controller_spec.rb
Normal file
12
spec/requests/hooks_controller_spec.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user