catarse_pagarme 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/models/catarse_pagarme/balance_transfer_delegator.rb +1 -1
- data/app/models/catarse_pagarme/credit_card_transaction.rb +1 -1
- data/app/models/catarse_pagarme/payment_delegator.rb +1 -1
- data/app/models/catarse_pagarme/slip_transaction.rb +3 -2
- data/app/models/catarse_pagarme/transaction_base.rb +1 -1
- data/app/workers/catarse_pagarme/verify_pagarme_worker.rb +1 -1
- data/lib/catarse_pagarme/version.rb +1 -1
- data/spec/controllers/catarse_pagarme/credit_cards_controller_spec.rb +1 -1
- data/spec/controllers/catarse_pagarme/notifications_controller_spec.rb +1 -2
- data/spec/models/catarse_pagarme/slip_transaction_spec.rb +1 -1
- data/spec/support/factories.rb +1 -3
- data/spec/workers/catarse_pagarme/verify_pagarme_worker_spec.rb +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e7be854657adedb16a5144be548f82a1d4afb2a
|
4
|
+
data.tar.gz: fcc26b9e7c29296a0f0718fb763714446a1b0ad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be12e118913110b6a09a4003c7e1d7721c78e235b4453868f8b8e2ade9742939999223fb8f4df1e14b7d3714666efd361ebe96089ef3866569fe71c24104a9da
|
7
|
+
data.tar.gz: 744fc8c23ccfb2e2e65bc2f21c8ca6a1e43e1a1cdf1309161a1bea1b3b22118d131c258c4436d8c91a1eed9c2f27d769f5456c005f6cf5c1c13c1dce5922aa03
|
data/Gemfile.lock
CHANGED
@@ -26,7 +26,7 @@ module CatarsePagarme
|
|
26
26
|
transfer.create
|
27
27
|
raise "unable to create a transfer" unless transfer.id.present?
|
28
28
|
|
29
|
-
balance_transfer.
|
29
|
+
balance_transfer.update(transfer_id: transfer.id)
|
30
30
|
balance_transfer.transition_to(:processing, transfer_data: transfer.to_hash)
|
31
31
|
balance_transfer
|
32
32
|
end
|
@@ -40,7 +40,7 @@ module CatarsePagarme
|
|
40
40
|
}.merge(credit_card_identifier)
|
41
41
|
)
|
42
42
|
|
43
|
-
unless payment.
|
43
|
+
unless payment.update(gateway: 'Pagarme', payment_method: payment_method)
|
44
44
|
raise ::PagarMe::PagarMeError.new(payment.errors.messages.values.flatten.to_sentence)
|
45
45
|
end
|
46
46
|
|
@@ -127,7 +127,7 @@ module CatarsePagarme
|
|
127
127
|
raise "unable to create a transfer" unless transfer.id.present?
|
128
128
|
|
129
129
|
#avoid sending notification
|
130
|
-
payment.
|
130
|
+
payment.update(state: 'pending_refund')
|
131
131
|
payment.payment_transfers.create!({
|
132
132
|
user: payment.user,
|
133
133
|
transfer_id: transfer.id,
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module CatarsePagarme
|
2
2
|
class SlipTransaction < TransactionBase
|
3
3
|
def charge!
|
4
|
-
unless payment.
|
4
|
+
unless payment.update(
|
5
5
|
gateway: 'Pagarme',
|
6
|
-
payment_method: payment_method
|
6
|
+
payment_method: payment_method
|
7
|
+
)
|
7
8
|
|
8
9
|
raise ::PagarMe::PagarMeError.new(
|
9
10
|
payment.errors.messages.values.flatten.to_sentence)
|
@@ -10,7 +10,7 @@ module CatarsePagarme
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def change_payment_state
|
13
|
-
self.payment.
|
13
|
+
self.payment.update(attributes_to_payment)
|
14
14
|
self.payment.save!
|
15
15
|
delegator.update_transaction
|
16
16
|
self.payment.payment_notifications.create(contribution_id: self.payment.contribution_id, extra_data: self.transaction.to_json)
|
@@ -9,7 +9,7 @@ class CatarsePagarme::VerifyPagarmeWorker
|
|
9
9
|
raise "payment not found" unless payment.present?
|
10
10
|
raise "source not found" unless source.present? && source.try(:[], "metadata").try(:[], "key") == key
|
11
11
|
|
12
|
-
payment.
|
12
|
+
payment.update(gateway_id: source["id"])
|
13
13
|
payment.pagarme_delegator.update_transaction
|
14
14
|
payment.pagarme_delegator.change_status_by_transaction source["status"]
|
15
15
|
end
|
@@ -11,7 +11,7 @@ describe CatarsePagarme::CreditCardsController, type: :controller do
|
|
11
11
|
let(:payment) do
|
12
12
|
contribution.reload
|
13
13
|
p = contribution.payments.first
|
14
|
-
#p.
|
14
|
+
#p.update(state: 'pending', gateway_id: nil)
|
15
15
|
p
|
16
16
|
end
|
17
17
|
|
@@ -13,7 +13,7 @@ describe CatarsePagarme::NotificationsController, type: :controller do
|
|
13
13
|
let(:contribution) { create(:contribution, value: 10, project: project) }
|
14
14
|
let(:payment) {
|
15
15
|
p = contribution.payments.first
|
16
|
-
p.
|
16
|
+
p.update gateway_id: 'abcd'
|
17
17
|
p
|
18
18
|
}
|
19
19
|
let(:credit_card) { create(:credit_card, subscription_id: '1542')}
|
@@ -48,4 +48,3 @@ describe CatarsePagarme::NotificationsController, type: :controller do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
51
|
-
|
@@ -66,7 +66,7 @@ describe CatarsePagarme::SlipTransaction do
|
|
66
66
|
|
67
67
|
context "with valid attributes" do
|
68
68
|
before do
|
69
|
-
payment.should_receive(:
|
69
|
+
payment.should_receive(:update).at_least(1).and_call_original
|
70
70
|
PagarMe::Transaction.should_receive(:find_by_id).with(pagarme_transaction.id).and_return(pagarme_transaction)
|
71
71
|
CatarsePagarme::PaymentDelegator.any_instance.should_receive(:change_status_by_transaction).with('paid')
|
72
72
|
|
data/spec/support/factories.rb
CHANGED
@@ -70,7 +70,7 @@ FactoryGirl.define do
|
|
70
70
|
#after(:create) do |project|
|
71
71
|
# create(:reward, project: project)
|
72
72
|
# if project.state == 'change_to_online_after_create'
|
73
|
-
# project.
|
73
|
+
# project.update(state: 'online')
|
74
74
|
# end
|
75
75
|
#end
|
76
76
|
f.name "Foo bar"
|
@@ -190,5 +190,3 @@ FactoryGirl.define do
|
|
190
190
|
f.name "foo"
|
191
191
|
end
|
192
192
|
end
|
193
|
-
|
194
|
-
|
@@ -23,7 +23,7 @@ describe CatarsePagarme::VerifyPagarmeWorker do
|
|
23
23
|
allow_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:update_transaction)
|
24
24
|
allow_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:change_status_by_transaction)
|
25
25
|
|
26
|
-
expect_any_instance_of(Payment).to receive(:
|
26
|
+
expect_any_instance_of(Payment).to receive(:update).with({gateway_id: fake_transaction["id"]})
|
27
27
|
expect_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:update_transaction)
|
28
28
|
expect_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:change_status_by_transaction).with(fake_transaction["status"])
|
29
29
|
end
|
@@ -65,4 +65,3 @@ describe CatarsePagarme::VerifyPagarmeWorker do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
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: 3.0.
|
4
|
+
version: 3.0.1
|
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: 2020-12-
|
12
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|