stripe-cli-ruby 1.54.1-x86_64-linux → 1.55.1-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/exe/x86_64-linux/stripe +0 -0
- data/lib/puma/plugin/stripe.rb +20 -4
- data/lib/stripe_cli/upstream.rb +1 -1
- data/lib/stripe_cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '08a54c14377aaf77142bce777e72808f119d45de62d6fe1d690c8c4b09d8dc70'
|
|
4
|
+
data.tar.gz: 1b96bbc7023fce9c94ede01b6ac9c87cf0ee310d7d88aee41a9af89cd0dc6cb2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a665da221d6c2f2e3ad341f685c47881b662888cfe4d5fc885cebdf85cca2013887054197b95c0e2f1cfe062194e668d8efb20e97d78585fac0658cafab2b53
|
|
7
|
+
data.tar.gz: a0a20eca5a8a99836199eea68299a831b9a4d156746ad573a3cf48f3356ba4b05ae8690c72f32bab990e885008d38ba16ebc300ccff154003e4471f496d65e2f
|
data/README.md
CHANGED
|
@@ -71,7 +71,9 @@ Add `plugin :stripe` to `puma.rb` configuration:
|
|
|
71
71
|
plugin :stripe if ENV["RAILS_ENV"] == "development"
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
By default, events will be forwarded to `/stripe_events`, this can be configured using `stripe_forward_to "/stripe/webhook"` in `puma.rb`.
|
|
74
|
+
By default, all events will be forwarded to `/stripe_events`, this can be configured using `stripe_forward_to "/stripe/webhook"` in `puma.rb`.
|
|
75
|
+
|
|
76
|
+
To forward the events of the webhook endpoints set up in your Stripe dashboard instead, add `stripe_use_configured_webhooks` to `puma.rb`. Each endpoint's events go to that endpoint's path on your local server, so an endpoint at `https://example.com/stripe/webhook` gets forwarded to `http://localhost:3000/stripe/webhook`. Your test mode account needs at least one webhook endpoint.
|
|
75
77
|
|
|
76
78
|
You can grab your *signing secret* using `StripeCLI.signing_secret`. For example:
|
|
77
79
|
|
data/exe/x86_64-linux/stripe
CHANGED
|
Binary file
|
data/lib/puma/plugin/stripe.rb
CHANGED
|
@@ -10,8 +10,12 @@ Puma::Plugin.create do
|
|
|
10
10
|
@launcher = launcher
|
|
11
11
|
|
|
12
12
|
launcher.events.on_booted do
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if use_configured_webhooks?
|
|
14
|
+
launcher.log_writer.log "Stripe: forwarding webhooks configured in the dashboard to #{forward_to}"
|
|
15
|
+
else
|
|
16
|
+
launcher.log_writer.log "Stripe: forwarding webhooks to #{forward_to}"
|
|
17
|
+
end
|
|
18
|
+
@pid = spawn(StripeCLI.executable, "listen", "--all-snapshot", *("--use-configured-webhooks" if use_configured_webhooks?), "--forward-to", forward_to.to_s, "--api-key", Stripe.api_key.to_s)
|
|
15
19
|
rescue StripeCLI::UnsupportedPlatformException, StripeCLI::ExecutableNotFoundException, Errno::ENOENT => e
|
|
16
20
|
launcher.log_writer.log "[Stripe] Could not start the Stripe CLI: #{e.message}"
|
|
17
21
|
end
|
|
@@ -29,10 +33,18 @@ Puma::Plugin.create do
|
|
|
29
33
|
rescue Errno::ECHILD, Errno::ESRCH
|
|
30
34
|
end
|
|
31
35
|
|
|
36
|
+
def use_configured_webhooks?
|
|
37
|
+
@launcher.options[:stripe_use_configured_webhooks]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Dashboard endpoints bring their own paths, so only the host and port are ours.
|
|
32
41
|
def forward_to
|
|
33
|
-
path = @launcher.options.fetch(:stripe_forward_to, "/stripe_events")
|
|
34
42
|
_, port, host = @launcher.binder.ios.first.addr
|
|
35
|
-
|
|
43
|
+
if use_configured_webhooks?
|
|
44
|
+
URI::HTTP.build(port:, host:)
|
|
45
|
+
else
|
|
46
|
+
URI::HTTP.build(port:, host:, path: @launcher.options.fetch(:stripe_forward_to, "/stripe_events"))
|
|
47
|
+
end
|
|
36
48
|
end
|
|
37
49
|
end
|
|
38
50
|
|
|
@@ -41,5 +53,9 @@ module Puma
|
|
|
41
53
|
def stripe_forward_to(path)
|
|
42
54
|
@options[:stripe_forward_to] = path
|
|
43
55
|
end
|
|
56
|
+
|
|
57
|
+
def stripe_use_configured_webhooks(enabled = true)
|
|
58
|
+
@options[:stripe_use_configured_webhooks] = enabled
|
|
59
|
+
end
|
|
44
60
|
end
|
|
45
61
|
end
|
data/lib/stripe_cli/upstream.rb
CHANGED
data/lib/stripe_cli/version.rb
CHANGED