conekta_event 1.0.0
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/MIT-LICENSE +20 -0
- data/README.md +156 -0
- data/Rakefile +36 -0
- data/app/controllers/conekta_event/webhook_controller.rb +46 -0
- data/bin/rails +14 -0
- data/conekta_event.gemspec +26 -0
- data/config/routes.rb +3 -0
- data/lib/conekta_event/engine.rb +5 -0
- data/lib/conekta_event/version.rb +3 -0
- data/lib/conekta_event.rb +76 -0
- data/spec/controllers/webhook_controller_spec.rb +81 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +0 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +38 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +17 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +91 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +56 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +32 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/lib/conekta_event_spec.rb +206 -0
- data/spec/rails_helper.rb +45 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/fixtures/evt_charge_paid.json +49 -0
- data/spec/support/fixtures/evt_invalid_id.json +7 -0
- metadata +189 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,206 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe ConektaEvent do
|
4
|
+
let(:events) { [] }
|
5
|
+
let(:subscriber) { ->(evt){ events << evt } }
|
6
|
+
let(:charge_succeeded) { double('charge paid') }
|
7
|
+
let(:subscription_canceled) { double('subscription canceled') }
|
8
|
+
|
9
|
+
describe ".configure" do
|
10
|
+
it "yields itself to the block" do
|
11
|
+
yielded = nil
|
12
|
+
ConektaEvent.configure { |events| yielded = events }
|
13
|
+
expect(yielded).to eq ConektaEvent
|
14
|
+
end
|
15
|
+
|
16
|
+
it "requires a block argument" do
|
17
|
+
expect { ConektaEvent.configure }.to raise_error ArgumentError
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".setup - deprecated" do
|
21
|
+
it "evaluates the block in its own context" do
|
22
|
+
ctx = nil
|
23
|
+
ConektaEvent.setup { ctx = self }
|
24
|
+
expect(ctx).to eq ConektaEvent
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "subscribing to a specific event type" do
|
30
|
+
before do
|
31
|
+
expect(charge_succeeded).to receive(:[]).with(:type).and_return('charge.paid')
|
32
|
+
expect(Conekta::Event).to receive(:find).with('evt_charge_paid').and_return(charge_succeeded)
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with a block subscriber" do
|
36
|
+
it "calls the subscriber with the retrieved event" do
|
37
|
+
ConektaEvent.subscribe('charge.paid', &subscriber)
|
38
|
+
|
39
|
+
ConektaEvent.instrument(id: 'evt_charge_paid', type: 'charge.paid')
|
40
|
+
|
41
|
+
expect(events).to eq [charge_succeeded]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "with a subscriber that responds to #call" do
|
46
|
+
it "calls the subscriber with the retrieved event" do
|
47
|
+
ConektaEvent.subscribe('charge.paid', subscriber)
|
48
|
+
|
49
|
+
ConektaEvent.instrument(id: 'evt_charge_paid', type: 'charge.paid')
|
50
|
+
|
51
|
+
expect(events).to eq [charge_succeeded]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "subscribing to the 'account.application.deauthorized' event type" do
|
57
|
+
before do
|
58
|
+
expect(Conekta::Event).to receive(:find).with('evt_account_application_deauthorized').and_raise(Conekta::ErrorList)
|
59
|
+
end
|
60
|
+
|
61
|
+
context "with a subscriber params with symbolized keys" do
|
62
|
+
it "calls the subscriber with the retrieved event" do
|
63
|
+
ConektaEvent.subscribe('account.application.deauthorized', subscriber)
|
64
|
+
|
65
|
+
ConektaEvent.instrument(id: 'evt_account_application_deauthorized', type: 'account.application.deauthorized')
|
66
|
+
|
67
|
+
expect(events.first.type).to eq 'account.application.deauthorized'
|
68
|
+
expect(events.first[:type]).to eq 'account.application.deauthorized'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "with a subscriber params with indifferent access (stringified keys)" do
|
73
|
+
it "calls the subscriber with the retrieved event" do
|
74
|
+
ConektaEvent.subscribe('account.application.deauthorized', subscriber)
|
75
|
+
|
76
|
+
ConektaEvent.instrument({ id: 'evt_account_application_deauthorized', type: 'account.application.deauthorized' }.with_indifferent_access)
|
77
|
+
|
78
|
+
expect(events.first.type).to eq 'account.application.deauthorized'
|
79
|
+
expect(events.first[:type]).to eq 'account.application.deauthorized'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# describe "subscribing to a namespace of event types" do
|
85
|
+
# let(:card_created) { double('card created') }
|
86
|
+
# let(:card_updated) { double('card updated') }
|
87
|
+
#
|
88
|
+
# before do
|
89
|
+
# expect(card_created).to receive(:[]).with(:type).and_return('customer.card.created')
|
90
|
+
# expect(Stripe::Event).to receive(:retrieve).with('evt_card_created').and_return(card_created)
|
91
|
+
#
|
92
|
+
# expect(card_updated).to receive(:[]).with(:type).and_return('customer.card.updated')
|
93
|
+
# expect(Stripe::Event).to receive(:retrieve).with('evt_card_updated').and_return(card_updated)
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# context "with a block subscriber" do
|
97
|
+
# it "calls the subscriber with any events in the namespace" do
|
98
|
+
# ConektaEvent.subscribe('customer.card', &subscriber)
|
99
|
+
#
|
100
|
+
# ConektaEvent.instrument(id: 'evt_card_created', type: 'customer.card.created')
|
101
|
+
# ConektaEvent.instrument(id: 'evt_card_updated', type: 'customer.card.updated')
|
102
|
+
#
|
103
|
+
# expect(events).to eq [card_created, card_updated]
|
104
|
+
# end
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# context "with a subscriber that responds to #call" do
|
108
|
+
# it "calls the subscriber with any events in the namespace" do
|
109
|
+
# ConektaEvent.subscribe('customer.card.', subscriber)
|
110
|
+
#
|
111
|
+
# ConektaEvent.instrument(id: 'evt_card_updated', type: 'customer.card.updated')
|
112
|
+
# ConektaEvent.instrument(id: 'evt_card_created', type: 'customer.card.created')
|
113
|
+
#
|
114
|
+
# expect(events).to eq [card_updated, card_created]
|
115
|
+
# end
|
116
|
+
# end
|
117
|
+
# end
|
118
|
+
|
119
|
+
describe "subscribing to all event types" do
|
120
|
+
before do
|
121
|
+
expect(charge_succeeded).to receive(:[]).with(:type).and_return('charge.paid')
|
122
|
+
expect(Conekta::Event).to receive(:find).with('evt_charge_paid').and_return(charge_succeeded)
|
123
|
+
|
124
|
+
expect(subscription_canceled).to receive(:[]).with(:type).and_return('subscription.canceled ')
|
125
|
+
expect(Conekta::Event).to receive(:find).with('evt_subscription_canceled').and_return(subscription_canceled)
|
126
|
+
end
|
127
|
+
|
128
|
+
context "with a block subscriber" do
|
129
|
+
it "calls the subscriber with all retrieved events" do
|
130
|
+
ConektaEvent.all(&subscriber)
|
131
|
+
|
132
|
+
ConektaEvent.instrument(id: 'evt_charge_paid', type: 'charge.succeeded')
|
133
|
+
ConektaEvent.instrument(id: 'evt_subscription_canceled', type: 'subscription.canceled ')
|
134
|
+
|
135
|
+
expect(events).to eq [charge_succeeded, subscription_canceled]
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "with a subscriber that responds to #call" do
|
140
|
+
it "calls the subscriber with all retrieved events" do
|
141
|
+
ConektaEvent.all(subscriber)
|
142
|
+
|
143
|
+
ConektaEvent.instrument(id: 'evt_charge_paid', type: 'charge.succeeded')
|
144
|
+
ConektaEvent.instrument(id: 'evt_subscription_canceled', type: 'subscription.canceled ')
|
145
|
+
|
146
|
+
expect(events).to eq [charge_succeeded, subscription_canceled]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe ".listening?" do
|
152
|
+
it "returns true when there is a subscriber for a matching event type" do
|
153
|
+
ConektaEvent.subscribe('customer.', &subscriber)
|
154
|
+
|
155
|
+
expect(ConektaEvent.listening?('customer.card')).to be true
|
156
|
+
expect(ConektaEvent.listening?('customer.')).to be true
|
157
|
+
end
|
158
|
+
|
159
|
+
it "returns false when there is not a subscriber for a matching event type" do
|
160
|
+
ConektaEvent.subscribe('customer.', &subscriber)
|
161
|
+
|
162
|
+
expect(ConektaEvent.listening?('account')).to be false
|
163
|
+
end
|
164
|
+
|
165
|
+
it "returns true when a subscriber is subscribed to all events" do
|
166
|
+
ConektaEvent.all(&subscriber)
|
167
|
+
|
168
|
+
expect(ConektaEvent.listening?('customer.')).to be true
|
169
|
+
expect(ConektaEvent.listening?('account')).to be true
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe ConektaEvent::NotificationAdapter do
|
174
|
+
let(:adapter) { ConektaEvent.adapter }
|
175
|
+
|
176
|
+
it "calls the subscriber with the last argument" do
|
177
|
+
expect(subscriber).to receive(:call).with(:last)
|
178
|
+
|
179
|
+
adapter.call(subscriber).call(:first, :last)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
describe ConektaEvent::Namespace do
|
184
|
+
let(:namespace) { ConektaEvent.namespace }
|
185
|
+
|
186
|
+
describe "#call" do
|
187
|
+
it "prepends the namespace to a given string" do
|
188
|
+
expect(namespace.call('foo.bar')).to eq 'conekta_event.foo.bar'
|
189
|
+
end
|
190
|
+
|
191
|
+
it "returns the namespace given no arguments" do
|
192
|
+
expect(namespace.call).to eq 'conekta_event.'
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe "#to_regexp" do
|
197
|
+
it "matches namespaced strings" do
|
198
|
+
expect(namespace.to_regexp('foo.bar')).to match namespace.call('foo.bar')
|
199
|
+
end
|
200
|
+
|
201
|
+
it "matches all namespaced strings given no arguments" do
|
202
|
+
expect(namespace.to_regexp).to match namespace.call('foo.bar')
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require File.expand_path('../dummy/config/environment', __FILE__)
|
4
|
+
# Prevent database truncation if the environment is production
|
5
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
6
|
+
require 'rspec/rails'
|
7
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
8
|
+
|
9
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
10
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
11
|
+
# run as spec files by default. This means that files in spec/support that end
|
12
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
13
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
14
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
15
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
16
|
+
#
|
17
|
+
# The following line is provided for convenience purposes. It has the downside
|
18
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
19
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
20
|
+
# require only the support files necessary.
|
21
|
+
#
|
22
|
+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
23
|
+
Dir[Rails.root.join('../spec/support/**/*.rb')].each { |f| require f }
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
27
|
+
# based on their file location, for example enabling you to call `get` and
|
28
|
+
# `post` in specs under `spec/controllers`.
|
29
|
+
#
|
30
|
+
# You can disable this behaviour by removing the line below, and instead
|
31
|
+
# explicitly tag your specs with their type, e.g.:
|
32
|
+
#
|
33
|
+
# RSpec.describe UsersController, :type => :controller do
|
34
|
+
# # ...
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# The different available types are documented in the features, such as in
|
38
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
39
|
+
config.infer_spec_type_from_file_location!
|
40
|
+
|
41
|
+
# Filter lines from Rails gems in backtraces.
|
42
|
+
config.filter_rails_from_backtrace!
|
43
|
+
# arbitrary gems may also be filtered via:
|
44
|
+
# config.filter_gems_from_backtrace("gem name")
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'webmock/rspec'
|
2
|
+
require 'byebug'
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.order = 'random'
|
6
|
+
|
7
|
+
config.expect_with :rspec do |c|
|
8
|
+
c.syntax = :expect
|
9
|
+
end
|
10
|
+
|
11
|
+
config.expect_with :rspec do |expectations|
|
12
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
13
|
+
end
|
14
|
+
|
15
|
+
config.mock_with :rspec do |mocks|
|
16
|
+
mocks.verify_partial_doubles = true
|
17
|
+
end
|
18
|
+
|
19
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
20
|
+
|
21
|
+
config.before do
|
22
|
+
@event_retriever = ConektaEvent.event_retriever
|
23
|
+
@notifier = ConektaEvent.backend.notifier
|
24
|
+
ConektaEvent.backend.notifier = @notifier.class.new
|
25
|
+
end
|
26
|
+
|
27
|
+
config.after do
|
28
|
+
ConektaEvent.event_retriever = @event_retriever
|
29
|
+
ConektaEvent.backend.notifier = @notifier
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"data": {
|
3
|
+
"object": {
|
4
|
+
"id": "5511d4ce2412294cf6000081",
|
5
|
+
"livemode": false,
|
6
|
+
"created_at": 1427231950,
|
7
|
+
"status": "paid",
|
8
|
+
"currency": "MXN",
|
9
|
+
"description": "Stogies",
|
10
|
+
"failure_code": null,
|
11
|
+
"failure_message": null,
|
12
|
+
"monthly_installments": null,
|
13
|
+
"object": "charge",
|
14
|
+
"amount": 20000,
|
15
|
+
"paid_at": 1427231952,
|
16
|
+
"fee": 963,
|
17
|
+
"customer_id": "",
|
18
|
+
"refunds": [],
|
19
|
+
"payment_method": {
|
20
|
+
"name": "Jorge Lopez",
|
21
|
+
"exp_month": "12",
|
22
|
+
"exp_year": "19",
|
23
|
+
"auth_code": "000000",
|
24
|
+
"object": "card_payment",
|
25
|
+
"last4": "4242",
|
26
|
+
"brand": "visa"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"previous_attributes": {
|
30
|
+
"payment_method": {}
|
31
|
+
}
|
32
|
+
},
|
33
|
+
"livemode": false,
|
34
|
+
"webhook_status": "pending",
|
35
|
+
"id": "5511d4d02412294cf6000088",
|
36
|
+
"object": "event",
|
37
|
+
"type": "charge.paid",
|
38
|
+
"created_at": 1427231952,
|
39
|
+
"webhook_logs": [
|
40
|
+
{
|
41
|
+
"id": "webhl_m5kgkhmgETe6Y4s",
|
42
|
+
"url": "http://requestb.in/1em0jsx1",
|
43
|
+
"failed_attempts": 0,
|
44
|
+
"last_http_response_status": -1,
|
45
|
+
"object": "webhook_log",
|
46
|
+
"last_attempted_at": 0
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
metadata
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: conekta_event
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jorge Najera
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: conekta
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Conekta webhook integration for Rails applications.
|
84
|
+
email:
|
85
|
+
- jorge.najera.t@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- Gemfile
|
93
|
+
- MIT-LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- app/controllers/conekta_event/webhook_controller.rb
|
97
|
+
- bin/rails
|
98
|
+
- conekta_event.gemspec
|
99
|
+
- config/routes.rb
|
100
|
+
- lib/conekta_event.rb
|
101
|
+
- lib/conekta_event/engine.rb
|
102
|
+
- lib/conekta_event/version.rb
|
103
|
+
- spec/controllers/webhook_controller_spec.rb
|
104
|
+
- spec/dummy/Rakefile
|
105
|
+
- spec/dummy/app/assets/config/manifest.js
|
106
|
+
- spec/dummy/app/assets/images/.keep
|
107
|
+
- spec/dummy/app/assets/javascripts/application.js
|
108
|
+
- spec/dummy/app/assets/javascripts/cable.js
|
109
|
+
- spec/dummy/app/assets/javascripts/channels/.keep
|
110
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
111
|
+
- spec/dummy/app/channels/application_cable/channel.rb
|
112
|
+
- spec/dummy/app/channels/application_cable/connection.rb
|
113
|
+
- spec/dummy/app/controllers/application_controller.rb
|
114
|
+
- spec/dummy/app/controllers/concerns/.keep
|
115
|
+
- spec/dummy/app/helpers/application_helper.rb
|
116
|
+
- spec/dummy/app/jobs/application_job.rb
|
117
|
+
- spec/dummy/app/mailers/application_mailer.rb
|
118
|
+
- spec/dummy/app/models/application_record.rb
|
119
|
+
- spec/dummy/app/models/concerns/.keep
|
120
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
121
|
+
- spec/dummy/app/views/layouts/mailer.html.erb
|
122
|
+
- spec/dummy/app/views/layouts/mailer.text.erb
|
123
|
+
- spec/dummy/bin/bundle
|
124
|
+
- spec/dummy/bin/rails
|
125
|
+
- spec/dummy/bin/rake
|
126
|
+
- spec/dummy/bin/setup
|
127
|
+
- spec/dummy/bin/update
|
128
|
+
- spec/dummy/bin/yarn
|
129
|
+
- spec/dummy/config.ru
|
130
|
+
- spec/dummy/config/application.rb
|
131
|
+
- spec/dummy/config/boot.rb
|
132
|
+
- spec/dummy/config/cable.yml
|
133
|
+
- spec/dummy/config/database.yml
|
134
|
+
- spec/dummy/config/environment.rb
|
135
|
+
- spec/dummy/config/environments/development.rb
|
136
|
+
- spec/dummy/config/environments/production.rb
|
137
|
+
- spec/dummy/config/environments/test.rb
|
138
|
+
- spec/dummy/config/initializers/application_controller_renderer.rb
|
139
|
+
- spec/dummy/config/initializers/assets.rb
|
140
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
141
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
142
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
143
|
+
- spec/dummy/config/initializers/inflections.rb
|
144
|
+
- spec/dummy/config/initializers/mime_types.rb
|
145
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
146
|
+
- spec/dummy/config/locales/en.yml
|
147
|
+
- spec/dummy/config/puma.rb
|
148
|
+
- spec/dummy/config/routes.rb
|
149
|
+
- spec/dummy/config/secrets.yml
|
150
|
+
- spec/dummy/config/spring.rb
|
151
|
+
- spec/dummy/lib/assets/.keep
|
152
|
+
- spec/dummy/log/.keep
|
153
|
+
- spec/dummy/package.json
|
154
|
+
- spec/dummy/public/404.html
|
155
|
+
- spec/dummy/public/422.html
|
156
|
+
- spec/dummy/public/500.html
|
157
|
+
- spec/dummy/public/apple-touch-icon-precomposed.png
|
158
|
+
- spec/dummy/public/apple-touch-icon.png
|
159
|
+
- spec/dummy/public/favicon.ico
|
160
|
+
- spec/lib/conekta_event_spec.rb
|
161
|
+
- spec/rails_helper.rb
|
162
|
+
- spec/spec_helper.rb
|
163
|
+
- spec/support/fixtures/evt_charge_paid.json
|
164
|
+
- spec/support/fixtures/evt_invalid_id.json
|
165
|
+
homepage:
|
166
|
+
licenses:
|
167
|
+
- MIT
|
168
|
+
metadata: {}
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options: []
|
171
|
+
require_paths:
|
172
|
+
- lib
|
173
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 2.5.1
|
186
|
+
signing_key:
|
187
|
+
specification_version: 4
|
188
|
+
summary: Conekta webhook integration for Rails applications.
|
189
|
+
test_files: []
|