catarse_pagarme 2.7.15 → 2.8.0

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: 0f85c30f30b3aedff1be40d37d3d06fa3389985c
4
- data.tar.gz: e8257e8c01356915e665fdf4d18a9db70fad9995
3
+ metadata.gz: e3a75276c1a0f9e6fb5ad5458a1caa1e965d18e9
4
+ data.tar.gz: 534ddd033cf2fb9a6929400bc9d9747a479ebf67
5
5
  SHA512:
6
- metadata.gz: 88d44e5aaa0d4bd1eef91c28d057daee181f04dda2fe26d963219f8392fcc948b047768fe74c639e0083ad407b08e9677557e5bfd90753ed25fd1bdb284794c8
7
- data.tar.gz: 766a84c02bf46085fb15413067503a8701afa90f2badf6e38a7d476342f415e5c289856a739c5c9a53dafc2250ad529fd7315607eff3a73d7b62c3917deaf177
6
+ metadata.gz: 226489d3e4d4f644f28f889e737d63e974482c57a11783416cd56d2c574a93099dcce94957919f279794bc59a23819e379fef7fcab4c74222a2206a2c84a76a7
7
+ data.tar.gz: c47171cd1ba7028ef03ddfccfa7aa548f1e429b969906c72b423b97b5ba8215a955005e9259702f1bd0b1aca64ccdbd337a61c6671d84a9a634b5b54b58b3b1c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.7.15)
4
+ catarse_pagarme (2.8.0)
5
5
  pagarme (= 1.10.0)
6
6
  rails (~> 4.0)
7
7
  sidekiq
@@ -47,53 +47,29 @@ GEM
47
47
  tzinfo (~> 1.1)
48
48
  arel (6.0.3)
49
49
  builder (3.2.2)
50
- celluloid (0.17.1.2)
51
- bundler
50
+ celluloid (0.17.2)
52
51
  celluloid-essentials
53
52
  celluloid-extras
54
53
  celluloid-fsm
55
54
  celluloid-pool
56
55
  celluloid-supervision
57
- dotenv
58
- nenv
59
- rspec-logsplit (>= 0.1.2)
60
56
  timers (>= 4.1.1)
61
- celluloid-essentials (0.20.2.1)
62
- bundler
63
- dotenv
64
- nenv
65
- rspec-logsplit (>= 0.1.2)
57
+ celluloid-essentials (0.20.5)
66
58
  timers (>= 4.1.1)
67
- celluloid-extras (0.20.1)
68
- bundler
69
- dotenv
70
- nenv
71
- rspec-logsplit (>= 0.1.2)
59
+ celluloid-extras (0.20.5)
72
60
  timers (>= 4.1.1)
73
- celluloid-fsm (0.20.1)
74
- bundler
75
- dotenv
76
- nenv
77
- rspec-logsplit (>= 0.1.2)
61
+ celluloid-fsm (0.20.5)
78
62
  timers (>= 4.1.1)
79
- celluloid-pool (0.20.1)
80
- bundler
81
- dotenv
82
- nenv
83
- rspec-logsplit (>= 0.1.2)
63
+ celluloid-pool (0.20.5)
84
64
  timers (>= 4.1.1)
85
- celluloid-supervision (0.20.1.1)
86
- bundler
87
- dotenv
88
- nenv
89
- rspec-logsplit (>= 0.1.2)
65
+ celluloid-supervision (0.20.5)
90
66
  timers (>= 4.1.1)
91
67
  coderay (1.1.0)
92
68
  connection_pool (2.2.0)
69
+ database_cleaner (1.5.0)
93
70
  diff-lcs (1.2.5)
94
- domain_name (0.5.24)
71
+ domain_name (0.5.25)
95
72
  unf (>= 0.0.5, < 1.0.0)
96
- dotenv (2.0.2)
97
73
  erubis (2.7.0)
98
74
  factory_girl (4.5.0)
99
75
  activesupport (>= 3.0.0)
@@ -116,7 +92,6 @@ GEM
116
92
  mini_portile (0.6.2)
117
93
  minitest (5.8.1)
118
94
  multi_json (1.11.2)
119
- nenv (0.2.0)
120
95
  netrc (0.10.3)
121
96
  nokogiri (1.6.6.2)
122
97
  mini_portile (~> 0.6.0)
@@ -168,7 +143,6 @@ GEM
168
143
  rspec-expectations (3.3.1)
169
144
  diff-lcs (>= 1.2.0, < 2.0)
170
145
  rspec-support (~> 3.3.0)
171
- rspec-logsplit (0.1.3)
172
146
  rspec-mocks (3.3.2)
173
147
  diff-lcs (>= 1.2.0, < 2.0)
174
148
  rspec-support (~> 3.3.0)
@@ -210,6 +184,7 @@ PLATFORMS
210
184
 
211
185
  DEPENDENCIES
212
186
  catarse_pagarme!
187
+ database_cleaner
213
188
  factory_girl_rails
214
189
  pg
215
190
  pry
@@ -27,7 +27,7 @@ module CatarsePagarme::FeeCalculatorConcern
27
27
  end
28
28
 
29
29
  def get_stone_fee
30
- self.payment.installments > 1 ? tax_calc_for_installment(stone_tax) : tax_calc(stone_tax)
30
+ self.payment.installments > 1 ? tax_calc_for_installment(stone_installment_tax) : tax_calc(stone_tax)
31
31
  end
32
32
 
33
33
  def get_cielo_fee
@@ -72,6 +72,10 @@ module CatarsePagarme::FeeCalculatorConcern
72
72
  CatarsePagarme.configuration.stone_tax.to_f
73
73
  end
74
74
 
75
+ def stone_installment_tax
76
+ CatarsePagarme.configuration.stone_installment_tax.to_f
77
+ end
78
+
75
79
  def installment_diners_tax
76
80
  CatarsePagarme.configuration.cielo_installment_diners_tax.to_f
77
81
  end
@@ -25,4 +25,5 @@ Gem::Specification.new do |s|
25
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
+ s.add_development_dependency "database_cleaner"
28
29
  end
@@ -2,7 +2,7 @@ module CatarsePagarme
2
2
  class Configuration
3
3
  attr_accessor :api_key, :slip_tax, :credit_card_tax, :interest_rate, :host, :subdomain, :protocol,
4
4
  :max_installments, :minimum_value_for_installment, :credit_card_cents_fee, :pagarme_tax, :stone_tax,
5
- :cielo_tax, :cielo_installment_diners_tax, :cielo_installment_not_diners_tax,
5
+ :stone_installment_tax, :cielo_tax, :cielo_installment_diners_tax, :cielo_installment_not_diners_tax,
6
6
  :cielo_installment_amex_tax, :cielo_installment_not_amex_tax, :ecr_key, :slip_week_day_interval
7
7
 
8
8
  def initialize
@@ -13,17 +13,18 @@ module CatarsePagarme
13
13
  self.interest_rate = 0
14
14
  self.max_installments = 12
15
15
  self.minimum_value_for_installment = 10
16
- self.credit_card_cents_fee = 0.39
16
+ self.credit_card_cents_fee = 0
17
17
  self.host = 'catarse.me'
18
18
  self.subdomain = 'www'
19
19
  self.protocol = 'http'
20
- self.pagarme_tax = 0.0063
21
- self.stone_tax = 0.0307
22
- self.cielo_tax = 0.038
23
- self.cielo_installment_diners_tax = 0.048
24
- self.cielo_installment_not_diners_tax = 0.0455
25
- self.cielo_installment_amex_tax = 0.058
26
- self.cielo_installment_not_amex_tax = 0.048
20
+ self.pagarme_tax = 0
21
+ self.stone_tax = 0
22
+ self.stone_installment_tax = 0
23
+ self.cielo_tax = 0
24
+ self.cielo_installment_diners_tax = 0
25
+ self.cielo_installment_not_diners_tax = 0
26
+ self.cielo_installment_amex_tax = 0
27
+ self.cielo_installment_not_amex_tax = 0
27
28
  self.slip_week_day_interval = 2
28
29
  end
29
30
  end
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.7.15"
2
+ VERSION = "2.8.0"
3
3
  end
@@ -8,16 +8,17 @@ describe CatarsePagarme::PaymentDelegator do
8
8
  let(:fake_transaction) { double("fake transaction", id: payment.gateway_id, card_brand: 'visa', acquirer_name: 'stone', tid: '404040404', installments: 2) }
9
9
 
10
10
  before do
11
- CatarsePagarme.configuration = double('fake config', {
11
+ allow(CatarsePagarme).to receive(:configuration).and_return(double('fake config', {
12
12
  slip_tax: 2.00,
13
13
  credit_card_tax: 0.01,
14
14
  pagarme_tax: 0.0063,
15
15
  cielo_tax: 0.038,
16
16
  stone_tax: 0.0307,
17
+ stone_installment_tax: 0.0307,
17
18
  credit_card_cents_fee: 0.39,
18
19
  api_key: '',
19
20
  interest_rate: interest_rate
20
- })
21
+ }))
21
22
  allow(delegator).to receive(:transaction).and_return(fake_transaction)
22
23
  end
23
24
 
@@ -40,7 +41,7 @@ describe CatarsePagarme::PaymentDelegator do
40
41
  subject { delegator.value_with_installment_tax(installment)}
41
42
 
42
43
  it "should return the payment value with installments tax" do
43
- expect(subject).to eq(1057)
44
+ expect(subject).to eq(1090)
44
45
  end
45
46
  end
46
47
 
@@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test'
3
3
 
4
4
  require File.expand_path("../dummy/config/environment", __FILE__)
5
5
 
6
+ require 'database_cleaner'
6
7
  require 'pagarme'
7
8
  require 'open-uri'
8
9
  require 'rspec/rails'
@@ -14,7 +15,7 @@ Dir[ File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}
14
15
 
15
16
  RSpec.configure do |config|
16
17
  config.include FactoryGirl::Syntax::Methods
17
- config.use_transactional_examples = true
18
+ config.use_transactional_examples = false
18
19
 
19
20
  # If true, the base class of anonymous controllers will be inferred
20
21
  # automatically. This will be the default behavior in future versions of
@@ -31,12 +32,48 @@ RSpec.configure do |config|
31
32
  c.syntax = :expect
32
33
  end
33
34
 
35
+ config.before(:suite) do
36
+ DatabaseCleaner.clean_with :truncation
37
+ DatabaseCleaner.strategy = :transaction
38
+
39
+ con = ActiveRecord::Base.connection
40
+ con.execute %{
41
+ INSERT INTO public.project_states (state, state_order) VALUES
42
+ ('deleted', 'archived'),
43
+ ('rejected', 'created'),
44
+ ('draft', 'created'),
45
+ ('in_analysis', 'created'),
46
+ ('approved', 'publishable'),
47
+ ('online', 'published'),
48
+ ('waiting_funds', 'published'),
49
+ ('failed', 'finished'),
50
+ ('successful', 'finished');
51
+
52
+ INSERT INTO public.flexible_project_states (state, state_order) VALUES
53
+ ('deleted', 'archived'),
54
+ ('rejected', 'created'),
55
+ ('draft', 'created'),
56
+ ('in_analysis', 'created'),
57
+ ('approved', 'publishable'),
58
+ ('online', 'published'),
59
+ ('waiting_funds', 'published'),
60
+ ('failed', 'finished'),
61
+ ('successful', 'finished');
62
+ }
63
+ end
64
+
34
65
  config.before(:each) do
66
+ DatabaseCleaner.start
67
+ ActionMailer::Base.deliveries.clear
35
68
  allow(PagarMe).to receive(:api_key).and_return('ak_test_XLoo19QDn9kg5JFGU70x12IA4NqbAv')
36
69
  allow(PaymentEngines).to receive(:configuration).and_return({})
37
70
  Sidekiq::Testing.inline!
38
71
  allow(CatarsePagarme::VerifyPagarmeWorker).to receive(:perform_in).and_return(true)
39
72
  end
73
+
74
+ config.after(:each) do
75
+ DatabaseCleaner.clean
76
+ end
40
77
  end
41
78
 
42
79
  def sample_card_hash
@@ -57,6 +57,7 @@ FactoryGirl.define do
57
57
  f.online_date Time.now
58
58
  f.online_days 5
59
59
  f.video_url 'http://vimeo.com/17298435'
60
+ f.video_thumbnail 'http://vimeo.com/17298435'
60
61
  f.state 'online'
61
62
  end
62
63
 
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.15
4
+ version: 2.8.0
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-10-08 00:00:00.000000000 Z
12
+ date: 2015-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: database_cleaner
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  description: Pagar.me engine for catarse
113
127
  email:
114
128
  - forevertonny@gmail.com