catarse_pagarme 2.6.4 → 2.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 008c3f9e2eafaadfcd0293484f6f8a4daa222d18
4
- data.tar.gz: 523a8a3472c6befdf2c5ab012cd650b8710296aa
3
+ metadata.gz: 2e8d37af9d49cc8c8fb5b97b68e5e57ba5c2df42
4
+ data.tar.gz: 75d95b6329ae2f4977b08a729ca51d65b44f322b
5
5
  SHA512:
6
- metadata.gz: 36e5af7633be4187029a2105a8e87ca58897b5d233550f65d9ccacb3bc67f800f4e33be03947005e96149f60160670500cc70a55aa2edbea8ba6e222615efea6
7
- data.tar.gz: 5421d05f378915169ce0f3271cb4c31dd1ab4efd2bc18cd922931a5a91769286e6879d8701f56a808e5b27079361ac99831404289649dc8104aebb5c14785135
6
+ metadata.gz: 1637595ea9eefabe4ff14c0fbe22aed07cb29946593efe041381e7bfc0ed9af29e42b8229621653c712ee4de0eccd4253bb1382da749ea0f79df105788d4b32e
7
+ data.tar.gz: 920c7ae1937ae7a74e763cfebae198b7dcaeb5536a98ddc4d8cc570cd5f7ede090c452612663f69e7f38bbbb9e91a16f1c36c6caa6925b9a01740e80614967a6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.6.4)
4
+ catarse_pagarme (2.6.5)
5
5
  pagarme (~> 1.9.8)
6
6
  rails (~> 4.0)
7
7
 
@@ -116,7 +116,7 @@ GEM
116
116
  thread_safe (~> 0.1)
117
117
  unf (0.1.4)
118
118
  unf_ext
119
- unf_ext (0.0.6)
119
+ unf_ext (0.0.7.1)
120
120
 
121
121
  PLATFORMS
122
122
  ruby
@@ -9,6 +9,13 @@ module CatarsePagarme
9
9
  layout :false
10
10
 
11
11
  protected
12
+ def metadata_attributes
13
+ {
14
+ key: payment.generate_key,
15
+ project_id: payment.contribution.project_id
16
+ }
17
+ end
18
+
12
19
  def configure_pagarme
13
20
  PagarMe.api_key = CatarsePagarme.configuration.api_key
14
21
  end
@@ -23,9 +23,7 @@ module CatarsePagarme
23
23
  email: payment.user.email,
24
24
  name: payment.user.name
25
25
  },
26
- metadata: {
27
- key: payment.generate_key
28
- }
26
+ metadata: metadata_attributes
29
27
  }
30
28
 
31
29
  if params[:card_hash].present?
@@ -28,9 +28,7 @@ module CatarsePagarme
28
28
  email: payment.user.email,
29
29
  name: payment.user.name
30
30
  },
31
- metadata: {
32
- key: payment.generate_key
33
- }
31
+ metadata: metadata_attributes
34
32
  }.update({ user: params[:user] })
35
33
  end
36
34
 
@@ -10,8 +10,8 @@ module CatarsePagarme
10
10
  end
11
11
 
12
12
  def change_payment_state
13
- self.payment.save!
14
13
  self.payment.update_attributes(attributes_to_payment)
14
+ self.payment.save!
15
15
  delegator.update_fee
16
16
  self.payment.payment_notifications.create(contribution_id: self.payment.contribution_id, extra_data: self.transaction.to_json)
17
17
  delegator.change_status_by_transaction(self.transaction.status)
@@ -27,11 +27,23 @@ module CatarsePagarme
27
27
  gateway_id: self.transaction.id,
28
28
  gateway: 'Pagarme',
29
29
  gateway_data: self.transaction.to_json,
30
- installments: (self.transaction.installments || 1),
30
+ installments: default_installments,
31
31
  installment_value: (delegator.value_for_installment(self.transaction.installments || 0) / 100.0).to_f
32
32
  }
33
33
  end
34
34
 
35
+ def default_installments
36
+ (self.transaction.installments || 1)
37
+ end
38
+
39
+ def default_installment_value
40
+ if default_installments == 1
41
+ self.payment.value
42
+ else
43
+ (delegator.value_for_installment(self.transaction.installments || 0) / 100.0).to_f
44
+ end
45
+ end
46
+
35
47
  def delegator
36
48
  self.payment.pagarme_delegator
37
49
  end
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.6.4"
2
+ VERSION = "2.6.5"
3
3
  end
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.6.4
4
+ version: 2.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antônio Roberto Silva