catarse_pagarme 2.7.11 → 2.7.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +147 -80
- data/app/controllers/catarse_pagarme/credit_cards_controller.rb +7 -3
- data/catarse_pagarme.gemspec +1 -1
- data/lib/catarse_pagarme/version.rb +1 -1
- data/spec/controllers/catarse_pagarme/credit_cards_controller_spec.rb +6 -1
- data/spec/controllers/catarse_pagarme/notifications_controller_spec.rb +1 -1
- data/spec/controllers/catarse_pagarme/slip_controller_spec.rb +1 -1
- data/spec/helpers/catarse_pagarme/application_helper_spec.rb +1 -1
- data/spec/models/catarse_pagarme/bank_account_concern_spec.rb +3 -3
- data/spec/models/catarse_pagarme/payment_delegator_spec.rb +22 -25
- data/spec/spec_helper.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14e84a0ddd613b1fd2ee2f51fae08cc6542306d4
|
4
|
+
data.tar.gz: dd2dec497640537f62475803a3f6abd1919e722a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3c7c3caaac778b061c792c0aca0823f0e8d381e51d78f82e4b2db06e37d3b2b72de52bb2a130db1de56e0e7fcd01cd4c0d3a12d0d353ab6298983a9c986bc82
|
7
|
+
data.tar.gz: 61177fc473ca51054fdd5ad6133735687c35e5f1657b170c6da1aec65c7d2bd70755ea99d115400452e94214b7c8c112b2f3153a825929016cc71caa97973d62
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
catarse_pagarme (2.7.
|
4
|
+
catarse_pagarme (2.7.12)
|
5
5
|
pagarme (= 1.10.0)
|
6
6
|
rails (~> 4.0)
|
7
7
|
sidekiq
|
@@ -10,88 +10,152 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actionmailer (4.
|
14
|
-
actionpack (= 4.
|
15
|
-
actionview (= 4.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
actionmailer (4.2.4)
|
14
|
+
actionpack (= 4.2.4)
|
15
|
+
actionview (= 4.2.4)
|
16
|
+
activejob (= 4.2.4)
|
17
|
+
mail (~> 2.5, >= 2.5.4)
|
18
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
19
|
+
actionpack (4.2.4)
|
20
|
+
actionview (= 4.2.4)
|
21
|
+
activesupport (= 4.2.4)
|
22
|
+
rack (~> 1.6)
|
21
23
|
rack-test (~> 0.6.2)
|
22
|
-
|
23
|
-
|
24
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
25
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
26
|
+
actionview (4.2.4)
|
27
|
+
activesupport (= 4.2.4)
|
24
28
|
builder (~> 3.1)
|
25
29
|
erubis (~> 2.7.0)
|
26
|
-
|
27
|
-
|
30
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
31
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
32
|
+
activejob (4.2.4)
|
33
|
+
activesupport (= 4.2.4)
|
34
|
+
globalid (>= 0.3.0)
|
35
|
+
activemodel (4.2.4)
|
36
|
+
activesupport (= 4.2.4)
|
28
37
|
builder (~> 3.1)
|
29
|
-
activerecord (4.
|
30
|
-
activemodel (= 4.
|
31
|
-
activesupport (= 4.
|
32
|
-
arel (~>
|
33
|
-
activesupport (4.
|
34
|
-
i18n (~> 0.
|
38
|
+
activerecord (4.2.4)
|
39
|
+
activemodel (= 4.2.4)
|
40
|
+
activesupport (= 4.2.4)
|
41
|
+
arel (~> 6.0)
|
42
|
+
activesupport (4.2.4)
|
43
|
+
i18n (~> 0.7)
|
35
44
|
json (~> 1.7, >= 1.7.7)
|
36
45
|
minitest (~> 5.1)
|
37
|
-
thread_safe (~> 0.
|
46
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
38
47
|
tzinfo (~> 1.1)
|
39
|
-
arel (
|
48
|
+
arel (6.0.3)
|
40
49
|
builder (3.2.2)
|
41
|
-
celluloid (0.
|
42
|
-
|
50
|
+
celluloid (0.17.1.2)
|
51
|
+
bundler
|
52
|
+
celluloid-essentials
|
53
|
+
celluloid-extras
|
54
|
+
celluloid-fsm
|
55
|
+
celluloid-pool
|
56
|
+
celluloid-supervision
|
57
|
+
dotenv
|
58
|
+
nenv
|
59
|
+
rspec-logsplit (>= 0.1.2)
|
60
|
+
timers (>= 4.1.1)
|
61
|
+
celluloid-essentials (0.20.2.1)
|
62
|
+
bundler
|
63
|
+
dotenv
|
64
|
+
nenv
|
65
|
+
rspec-logsplit (>= 0.1.2)
|
66
|
+
timers (>= 4.1.1)
|
67
|
+
celluloid-extras (0.20.1)
|
68
|
+
bundler
|
69
|
+
dotenv
|
70
|
+
nenv
|
71
|
+
rspec-logsplit (>= 0.1.2)
|
72
|
+
timers (>= 4.1.1)
|
73
|
+
celluloid-fsm (0.20.1)
|
74
|
+
bundler
|
75
|
+
dotenv
|
76
|
+
nenv
|
77
|
+
rspec-logsplit (>= 0.1.2)
|
78
|
+
timers (>= 4.1.1)
|
79
|
+
celluloid-pool (0.20.1)
|
80
|
+
bundler
|
81
|
+
dotenv
|
82
|
+
nenv
|
83
|
+
rspec-logsplit (>= 0.1.2)
|
84
|
+
timers (>= 4.1.1)
|
85
|
+
celluloid-supervision (0.20.1.1)
|
86
|
+
bundler
|
87
|
+
dotenv
|
88
|
+
nenv
|
89
|
+
rspec-logsplit (>= 0.1.2)
|
90
|
+
timers (>= 4.1.1)
|
43
91
|
coderay (1.1.0)
|
44
92
|
connection_pool (2.2.0)
|
45
93
|
diff-lcs (1.2.5)
|
46
94
|
domain_name (0.5.24)
|
47
95
|
unf (>= 0.0.5, < 1.0.0)
|
96
|
+
dotenv (2.0.2)
|
48
97
|
erubis (2.7.0)
|
49
|
-
factory_girl (4.
|
98
|
+
factory_girl (4.5.0)
|
50
99
|
activesupport (>= 3.0.0)
|
51
|
-
factory_girl_rails (4.
|
52
|
-
factory_girl (~> 4.
|
100
|
+
factory_girl_rails (4.5.0)
|
101
|
+
factory_girl (~> 4.5.0)
|
53
102
|
railties (>= 3.0.0)
|
54
|
-
|
103
|
+
globalid (0.3.6)
|
104
|
+
activesupport (>= 4.1.0)
|
105
|
+
hitimes (1.2.3)
|
55
106
|
http-cookie (1.0.2)
|
56
107
|
domain_name (~> 0.5)
|
57
|
-
i18n (0.
|
58
|
-
json (1.8.
|
59
|
-
|
60
|
-
|
61
|
-
|
108
|
+
i18n (0.7.0)
|
109
|
+
json (1.8.3)
|
110
|
+
loofah (2.0.3)
|
111
|
+
nokogiri (>= 1.5.9)
|
112
|
+
mail (2.6.3)
|
113
|
+
mime-types (>= 1.16, < 3)
|
62
114
|
method_source (0.8.2)
|
63
|
-
mime-types (
|
64
|
-
|
115
|
+
mime-types (2.6.2)
|
116
|
+
mini_portile (0.6.2)
|
117
|
+
minitest (5.8.1)
|
65
118
|
multi_json (1.11.2)
|
119
|
+
nenv (0.2.0)
|
66
120
|
netrc (0.10.3)
|
121
|
+
nokogiri (1.6.6.2)
|
122
|
+
mini_portile (~> 0.6.0)
|
67
123
|
pagarme (1.10.0)
|
68
124
|
multi_json
|
69
125
|
rest-client
|
70
|
-
pg (0.
|
71
|
-
|
72
|
-
pry (0.10.1)
|
126
|
+
pg (0.18.3)
|
127
|
+
pry (0.10.2)
|
73
128
|
coderay (~> 1.1.0)
|
74
129
|
method_source (~> 0.8.1)
|
75
130
|
slop (~> 3.4)
|
76
|
-
rack (1.
|
77
|
-
rack-test (0.6.
|
131
|
+
rack (1.6.4)
|
132
|
+
rack-test (0.6.3)
|
78
133
|
rack (>= 1.0)
|
79
|
-
rails (4.
|
80
|
-
actionmailer (= 4.
|
81
|
-
actionpack (= 4.
|
82
|
-
actionview (= 4.
|
83
|
-
|
84
|
-
|
85
|
-
|
134
|
+
rails (4.2.4)
|
135
|
+
actionmailer (= 4.2.4)
|
136
|
+
actionpack (= 4.2.4)
|
137
|
+
actionview (= 4.2.4)
|
138
|
+
activejob (= 4.2.4)
|
139
|
+
activemodel (= 4.2.4)
|
140
|
+
activerecord (= 4.2.4)
|
141
|
+
activesupport (= 4.2.4)
|
86
142
|
bundler (>= 1.3.0, < 2.0)
|
87
|
-
railties (= 4.
|
88
|
-
sprockets-rails
|
89
|
-
|
90
|
-
|
91
|
-
|
143
|
+
railties (= 4.2.4)
|
144
|
+
sprockets-rails
|
145
|
+
rails-deprecated_sanitizer (1.0.3)
|
146
|
+
activesupport (>= 4.2.0.alpha)
|
147
|
+
rails-dom-testing (1.0.7)
|
148
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
149
|
+
nokogiri (~> 1.6.0)
|
150
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
151
|
+
rails-html-sanitizer (1.0.2)
|
152
|
+
loofah (~> 2.0)
|
153
|
+
railties (4.2.4)
|
154
|
+
actionpack (= 4.2.4)
|
155
|
+
activesupport (= 4.2.4)
|
92
156
|
rake (>= 0.8.7)
|
93
157
|
thor (>= 0.18.1, < 2.0)
|
94
|
-
rake (10.
|
158
|
+
rake (10.4.2)
|
95
159
|
redis (3.2.1)
|
96
160
|
redis-namespace (1.5.2)
|
97
161
|
redis (~> 3.0, >= 3.0.4)
|
@@ -99,39 +163,42 @@ GEM
|
|
99
163
|
http-cookie (>= 1.0.2, < 2.0)
|
100
164
|
mime-types (>= 1.16, < 3.0)
|
101
165
|
netrc (~> 0.7)
|
102
|
-
rspec-core (
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
166
|
+
rspec-core (3.3.2)
|
167
|
+
rspec-support (~> 3.3.0)
|
168
|
+
rspec-expectations (3.3.1)
|
169
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
170
|
+
rspec-support (~> 3.3.0)
|
171
|
+
rspec-logsplit (0.1.3)
|
172
|
+
rspec-mocks (3.3.2)
|
173
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
174
|
+
rspec-support (~> 3.3.0)
|
175
|
+
rspec-rails (3.3.3)
|
176
|
+
actionpack (>= 3.0, < 4.3)
|
177
|
+
activesupport (>= 3.0, < 4.3)
|
178
|
+
railties (>= 3.0, < 4.3)
|
179
|
+
rspec-core (~> 3.3.0)
|
180
|
+
rspec-expectations (~> 3.3.0)
|
181
|
+
rspec-mocks (~> 3.3.0)
|
182
|
+
rspec-support (~> 3.3.0)
|
183
|
+
rspec-support (3.3.0)
|
184
|
+
sidekiq (3.5.0)
|
185
|
+
celluloid (~> 0.17.0)
|
186
|
+
connection_pool (~> 2.2, >= 2.2.0)
|
187
|
+
json (~> 1.0)
|
188
|
+
redis (~> 3.2, >= 3.2.1)
|
189
|
+
redis-namespace (~> 1.5, >= 1.5.2)
|
120
190
|
slop (3.6.0)
|
121
|
-
sprockets (3.
|
122
|
-
rack (
|
123
|
-
sprockets-rails (2.3.
|
191
|
+
sprockets (3.3.5)
|
192
|
+
rack (> 1, < 3)
|
193
|
+
sprockets-rails (2.3.3)
|
124
194
|
actionpack (>= 3.0)
|
125
195
|
activesupport (>= 3.0)
|
126
196
|
sprockets (>= 2.8, < 4.0)
|
127
197
|
thor (0.19.1)
|
128
|
-
thread_safe (0.3.
|
129
|
-
timers (4.
|
198
|
+
thread_safe (0.3.5)
|
199
|
+
timers (4.1.1)
|
130
200
|
hitimes
|
131
|
-
|
132
|
-
polyglot
|
133
|
-
polyglot (>= 0.3.1)
|
134
|
-
tzinfo (1.2.1)
|
201
|
+
tzinfo (1.2.2)
|
135
202
|
thread_safe (~> 0.1)
|
136
203
|
unf (0.1.4)
|
137
204
|
unf_ext
|
@@ -146,4 +213,4 @@ DEPENDENCIES
|
|
146
213
|
factory_girl_rails
|
147
214
|
pg
|
148
215
|
pry
|
149
|
-
rspec-rails (~>
|
216
|
+
rspec-rails (~> 3.3)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module CatarsePagarme
|
2
2
|
class CreditCardsController < CatarsePagarme::ApplicationController
|
3
|
+
MAX_SOFT_DESCRIPTOR_LENGTH = 13
|
3
4
|
|
4
5
|
def create
|
5
6
|
transaction = CreditCardTransaction.new(credit_card_attributes, payment).charge!
|
@@ -15,9 +16,12 @@ module CatarsePagarme
|
|
15
16
|
hash = {
|
16
17
|
payment_method: 'credit_card',
|
17
18
|
amount: delegator.value_with_installment_tax(get_installment),
|
18
|
-
postback_url: ipn_pagarme_index_url(
|
19
|
-
|
20
|
-
|
19
|
+
postback_url: ipn_pagarme_index_url(
|
20
|
+
host: CatarsePagarme.configuration.host,
|
21
|
+
subdomain: CatarsePagarme.configuration.subdomain,
|
22
|
+
protocol: CatarsePagarme.configuration.protocol
|
23
|
+
),
|
24
|
+
soft_descriptor: payment.project.name[0, MAX_SOFT_DESCRIPTOR_LENGTH],
|
21
25
|
installments: get_installment,
|
22
26
|
customer: {
|
23
27
|
email: payment.user.email,
|
data/catarse_pagarme.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency "weekdays", ">= 1.0.2"
|
23
23
|
s.add_dependency "sidekiq"
|
24
24
|
|
25
|
-
s.add_development_dependency "rspec-rails", "~>
|
25
|
+
s.add_development_dependency "rspec-rails", "~> 3.3"
|
26
26
|
s.add_development_dependency "factory_girl_rails"
|
27
27
|
s.add_development_dependency "pg"
|
28
28
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe CatarsePagarme::CreditCardsController do
|
3
|
+
describe CatarsePagarme::CreditCardsController, type: :controller do
|
4
4
|
before do
|
5
5
|
controller.stub(:current_user).and_return(user)
|
6
6
|
end
|
@@ -24,11 +24,16 @@ describe CatarsePagarme::CreditCardsController do
|
|
24
24
|
let(:user) { payment.user }
|
25
25
|
context "with valid card data" do
|
26
26
|
before do
|
27
|
+
allow(CatarsePagarme::CreditCardTransaction).to receive(:new).and_call_original
|
27
28
|
post :create, {
|
28
29
|
locale: :pt, id: contribution.id, use_route: 'catarse_pagarme',
|
29
30
|
card_hash: sample_card_hash }
|
30
31
|
end
|
31
32
|
|
33
|
+
it 'should receive soft descriptor with project name' do
|
34
|
+
expect(CatarsePagarme::CreditCardTransaction).to have_received(:new).with(hash_including(soft_descriptor: payment.project.name), anything)
|
35
|
+
end
|
36
|
+
|
32
37
|
it 'and payment_status is not failed' do
|
33
38
|
expect(ActiveSupport::JSON.decode(response.body)['payment_status']).not_to eq('failed')
|
34
39
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe CatarsePagarme::NotificationsController do
|
3
|
+
describe CatarsePagarme::NotificationsController, type: :controller do
|
4
4
|
let(:fake_transaction) { double("fake transaction", id: payment.gateway_id, card_brand: 'visa', acquirer_name: 'stone', tid: '404040404', installments: 2) }
|
5
5
|
|
6
6
|
before do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe CatarsePagarme::ApplicationHelper do
|
3
|
+
describe CatarsePagarme::ApplicationHelper, type: :helper do
|
4
4
|
before do
|
5
5
|
installments_hash = {"installments"=>{"1"=>{"installment"=>1, "amount"=>10000, "installment_amount"=>10000}, "2"=>{"installment"=>2, "amount"=>10000, "installment_amount"=>5000}, "3"=>{"installment"=>3, "amount"=>10000, "installment_amount"=>3333}, "4"=>{"installment"=>4, "amount"=>10000, "installment_amount"=>2500}, "5"=>{"installment"=>5, "amount"=>10000, "installment_amount"=>2000}, "6"=>{"installment"=>6, "amount"=>10000, "installment_amount"=>1667}, "7"=>{"installment"=>7, "amount"=>10000, "installment_amount"=>1429}, "8"=>{"installment"=>8, "amount"=>10000, "installment_amount"=>1250}, "9"=>{"installment"=>9, "amount"=>10000, "installment_amount"=>1111}, "10"=>{"installment"=>10, "amount"=>10000, "installment_amount"=>1000}, "11"=>{"installment"=>11, "amount"=>10000, "installment_amount"=>909}, "12"=>{"installment"=>12, "amount"=>10000, "installment_amount"=>833}}}
|
6
6
|
PagarMe::Transaction.stub(:calculate_installments).and_return(installments_hash)
|
@@ -30,16 +30,16 @@ describe FakeBankAccount do
|
|
30
30
|
let(:local_bank_account) { BankAccount.new(valid_attr) }
|
31
31
|
|
32
32
|
it "local_bank_account should be valid" do
|
33
|
-
expect(local_bank_account.valid?).to
|
33
|
+
expect(local_bank_account.valid?).to be_truthy
|
34
34
|
end
|
35
35
|
|
36
36
|
it "bank_account_on_pagarme should be not valid with these attrs" do
|
37
|
-
expect(bank_account_on_pagarme.valid?).to
|
37
|
+
expect(bank_account_on_pagarme.valid?).to be_falsy
|
38
38
|
end
|
39
39
|
|
40
40
|
it "bank_account_on_pagarme should be valid with another attrs" do
|
41
41
|
subject { FakeBankAccount.new(valid_attr_on_pagarme).valid? }
|
42
|
-
expect(subject).to
|
42
|
+
expect(subject).to be_truthy
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -4,16 +4,21 @@ describe CatarsePagarme::PaymentDelegator do
|
|
4
4
|
let(:contribution) { create(:contribution, value: 10) }
|
5
5
|
let(:payment) { contribution.payments.first }
|
6
6
|
let(:delegator) { payment.pagarme_delegator }
|
7
|
+
let(:interest_rate) { 0 }
|
7
8
|
let(:fake_transaction) { double("fake transaction", id: payment.gateway_id, card_brand: 'visa', acquirer_name: 'stone', tid: '404040404', installments: 2) }
|
8
9
|
|
9
10
|
before do
|
10
|
-
CatarsePagarme.configuration
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
CatarsePagarme.configuration = double('fake config', {
|
12
|
+
slip_tax: 2.00,
|
13
|
+
credit_card_tax: 0.01,
|
14
|
+
pagarme_tax: 0.0063,
|
15
|
+
cielo_tax: 0.038,
|
16
|
+
stone_tax: 0.0307,
|
17
|
+
credit_card_cents_fee: 0.39,
|
18
|
+
api_key: '',
|
19
|
+
interest_rate: interest_rate
|
20
|
+
})
|
21
|
+
allow(delegator).to receive(:transaction).and_return(fake_transaction)
|
17
22
|
end
|
18
23
|
|
19
24
|
describe "instance of CatarsePagarme::paymentDelegator" do
|
@@ -30,11 +35,9 @@ describe CatarsePagarme::PaymentDelegator do
|
|
30
35
|
|
31
36
|
describe "#value_with_installment_tax" do
|
32
37
|
let(:installment) { 5 }
|
33
|
-
|
38
|
+
let(:interest_rate) { 1.8 }
|
34
39
|
|
35
|
-
|
36
|
-
CatarsePagarme.configuration.stub(:interest_rate).and_return(1.8)
|
37
|
-
end
|
40
|
+
subject { delegator.value_with_installment_tax(installment)}
|
38
41
|
|
39
42
|
it "should return the payment value with installments tax" do
|
40
43
|
expect(subject).to eq(1057)
|
@@ -63,7 +66,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
63
66
|
|
64
67
|
describe "#get_installments" do
|
65
68
|
before do
|
66
|
-
delegator.
|
69
|
+
allow(delegator).to receive(:value_for_transaction).and_return(10000)
|
67
70
|
end
|
68
71
|
subject { delegator.get_installments }
|
69
72
|
|
@@ -137,13 +140,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
137
140
|
|
138
141
|
describe "#transfer_funds" do
|
139
142
|
let(:admin_user) { create(:user, admin: true) }
|
140
|
-
let(:transfer_mock) {
|
141
|
-
t = mock()
|
142
|
-
allow(t).to receive(:create).and_return(true)
|
143
|
-
allow(t).to receive(:id).and_return("123")
|
144
|
-
allow(t).to receive(:to_json).and_return({id: '123'}.to_json)
|
145
|
-
t
|
146
|
-
}
|
143
|
+
let(:transfer_mock) { double(create: true, id: "123", to_json: {id: '123'}.to_json) }
|
147
144
|
before do
|
148
145
|
allow(PagarMe::Transfer).to receive(:new).and_return(transfer_mock)
|
149
146
|
create(:bank_account, user: payment.user)
|
@@ -190,7 +187,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
190
187
|
payment.stub(:paid?).and_return(true)
|
191
188
|
payment.stub(:refunded?).and_return(false)
|
192
189
|
payment.stub(:pending_refund?).and_return(false)
|
193
|
-
payment.
|
190
|
+
expect(payment).to_not receive(:pay)
|
194
191
|
end
|
195
192
|
|
196
193
|
it { delegator.change_status_by_transaction(status) }
|
@@ -201,7 +198,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
201
198
|
payment.stub(:paid?).and_return(false)
|
202
199
|
payment.stub(:refunded?).and_return(false)
|
203
200
|
payment.stub(:pending_refund?).and_return(false)
|
204
|
-
payment.
|
201
|
+
expect(payment).to receive(:pay)
|
205
202
|
end
|
206
203
|
|
207
204
|
it { delegator.change_status_by_transaction(status) }
|
@@ -213,7 +210,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
213
210
|
context "and payment is already refunded" do
|
214
211
|
before do
|
215
212
|
payment.stub(:refunded?).and_return(true)
|
216
|
-
payment.
|
213
|
+
expect(payment).to_not receive(:refund)
|
217
214
|
end
|
218
215
|
|
219
216
|
it { delegator.change_status_by_transaction('refunded') }
|
@@ -222,7 +219,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
222
219
|
context "and payment is not refunded" do
|
223
220
|
before do
|
224
221
|
payment.stub(:refunded?).and_return(false)
|
225
|
-
payment.
|
222
|
+
expect(payment).to receive(:refund)
|
226
223
|
end
|
227
224
|
|
228
225
|
it { delegator.change_status_by_transaction('refunded') }
|
@@ -233,7 +230,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
233
230
|
context "and payment is already canceled" do
|
234
231
|
before do
|
235
232
|
payment.stub(:refused?).and_return(true)
|
236
|
-
payment.
|
233
|
+
expect(payment).to_not receive(:refuse)
|
237
234
|
end
|
238
235
|
|
239
236
|
it { delegator.change_status_by_transaction('refused') }
|
@@ -242,7 +239,7 @@ describe CatarsePagarme::PaymentDelegator do
|
|
242
239
|
context "and payment is not refused" do
|
243
240
|
before do
|
244
241
|
payment.stub(:refused?).and_return(false)
|
245
|
-
payment.
|
242
|
+
expect(payment).to receive(:refuse)
|
246
243
|
end
|
247
244
|
|
248
245
|
it { delegator.change_status_by_transaction('refused') }
|
data/spec/spec_helper.rb
CHANGED
@@ -32,10 +32,10 @@ RSpec.configure do |config|
|
|
32
32
|
end
|
33
33
|
|
34
34
|
config.before(:each) do
|
35
|
-
PagarMe.
|
36
|
-
PaymentEngines.
|
35
|
+
allow(PagarMe).to receive(:api_key).and_return('ak_test_XLoo19QDn9kg5JFGU70x12IA4NqbAv')
|
36
|
+
allow(PaymentEngines).to receive(:configuration).and_return({})
|
37
37
|
Sidekiq::Testing.inline!
|
38
|
-
CatarsePagarme::VerifyPagarmeWorker.
|
38
|
+
allow(CatarsePagarme::VerifyPagarmeWorker).to receive(:perform_in).and_return(true)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catarse_pagarme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antônio Roberto Silva
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: '3.3'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: '3.3'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: factory_girl_rails
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|