braspag-pagador 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +164 -162
  3. data/braspag-pagador.gemspec +3 -3
  4. data/coverage/.resultset.json +69 -26
  5. data/coverage/index.html +1431 -1147
  6. data/lib/{braspag.rb → braspag-pagador.rb} +14 -14
  7. data/lib/{braspag → braspag-pagador}/core/connection.rb +5 -3
  8. data/lib/{braspag → braspag-pagador}/core/converter.rb +4 -4
  9. data/lib/{braspag → braspag-pagador}/core/customer.rb +2 -2
  10. data/lib/{braspag → braspag-pagador}/core/order.rb +51 -51
  11. data/lib/{braspag → braspag-pagador}/core/poster.rb +1 -1
  12. data/lib/{braspag → braspag-pagador}/crypto/no_crypto.rb +2 -2
  13. data/lib/{braspag → braspag-pagador}/crypto/webservice.rb +10 -10
  14. data/lib/{braspag → braspag-pagador}/payment/billet.rb +10 -10
  15. data/lib/{braspag → braspag-pagador}/payment/credit_card.rb +8 -8
  16. data/lib/{braspag → braspag-pagador}/payment/eft.rb +3 -3
  17. data/lib/{braspag → braspag-pagador}/payment/recurrency_credit_card.rb +1 -1
  18. data/lib/{braspag → braspag-pagador}/templates/crypto/decrypt.xml.erb +0 -0
  19. data/lib/{braspag → braspag-pagador}/templates/crypto/encrypt.xml.erb +0 -0
  20. data/lib/{braspag → braspag-pagador}/templates/justclick/archive.xml.erb +0 -0
  21. data/lib/{braspag → braspag-pagador}/templates/justclick/get_recurrency.xml.erb +0 -0
  22. data/lib/{braspag → braspag-pagador}/templates/justclick/recurrency.xml.erb +0 -0
  23. data/lib/braspag-pagador/version.rb +3 -0
  24. data/spec/core/connection_spec.rb +50 -50
  25. data/spec/core/converter_spec.rb +41 -41
  26. data/spec/core/customer_spec.rb +2 -2
  27. data/spec/core/order_spec.rb +78 -78
  28. data/spec/core/poster_spec.rb +8 -8
  29. data/spec/crypto/webservice_spec.rb +23 -23
  30. data/spec/integration/billet_spec.rb +11 -11
  31. data/spec/payment/billet_spec.rb +48 -48
  32. data/spec/payment/credit_card_spec.rb +82 -82
  33. data/spec/payment/eft_spec.rb +25 -25
  34. data/spec/payment/recurrency_credit_card_spec.rb +11 -11
  35. data/spec/spec_helper.rb +5 -5
  36. metadata +20 -20
  37. data/lib/braspag/version.rb +0 -3
@@ -1,66 +1,66 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe Braspag::Connection do
3
+ describe BraspagPagador::Connection do
4
4
  let(:merchant_id) { "{12345678-1234-1234-1234-123456789000}" }
5
- let(:connection) { Braspag::Connection.new(:merchant_id => merchant_id, :environment => :homologation)}
6
-
5
+ let(:connection) { BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :homologation)}
6
+
7
7
  let(:customer) do
8
- Braspag::Customer.new(:name => "W" * 21)
8
+ BraspagPagador::Customer.new(:name => "W" * 21)
9
9
  end
10
10
 
11
11
  let(:order) do
12
- Braspag::Order.new(
12
+ BraspagPagador::Order.new(
13
13
  :id => "um order id",
14
14
  :amount => 1000.00,
15
- :payment_method => Braspag::PAYMENT_METHOD[:eft_itau],
15
+ :payment_method => BraspagPagador::PAYMENT_METHOD[:eft_itau],
16
16
  :customer => customer
17
17
  )
18
18
  end
19
19
 
20
20
  let(:eft) do
21
- Braspag::EFT.new(
22
- :crypto => Braspag::Crypto::NoCrypto.new
21
+ BraspagPagador::EFT.new(
22
+ :crypto => BraspagPagador::Crypto::NoCrypto.new
23
23
  )
24
24
  end
25
-
25
+
26
26
  let(:eft_with_encrypt) do
27
- Braspag::EFT.new(
28
- :crypto => Braspag::Crypto::Webservice.new
27
+ BraspagPagador::EFT.new(
28
+ :crypto => BraspagPagador::Crypto::Webservice.new
29
29
  )
30
30
  end
31
-
31
+
32
32
  context ".generate_eft" do
33
33
  it "should return active merchant response" do
34
34
  response = connection.generate_eft(order, eft)
35
35
  response.success?.should eq(true)
36
36
  response.message.should eq('OK')
37
37
  end
38
-
38
+
39
39
  it "should return active merchant response for encrypt error" do
40
- Braspag::Crypto::Webservice.any_instance.should_receive(:encrypt).and_raise('ERROR')
40
+ BraspagPagador::Crypto::Webservice.any_instance.should_receive(:encrypt).and_raise('ERROR')
41
41
  response = connection.generate_eft(order, eft_with_encrypt)
42
42
  response.success?.should eq(false)
43
43
  response.message.should eq('ERROR')
44
44
  end
45
-
45
+
46
46
  it "should popule eft code a html form" do
47
47
  response = connection.generate_eft(order, eft)
48
-
48
+
49
49
  eft.code.should eq("<form id='form_tef_um order id' name='form_tef_um order id' action='https://homologacao.pagador.com.br/pagador/passthru.asp' method='post'><input type='text' name='Id_Loja' value='{12345678-1234-1234-1234-123456789000}' /><input type='text' name='VALOR' value='1000,00' /><input type='text' name='CODPAGAMENTO' value='12' /><input type='text' name='VENDAID' value='um order id' /><input type='text' name='NOME' value='WWWWWWWWWWWWWWWWWWWWW' /></form><script type='text/javascript' charset='utf-8'>document.forms['form_tef_um order id'].submit();</script>")
50
50
  end
51
51
 
52
52
  it "should populate eft code a html form when crypto strategy is given" do
53
- Braspag::Crypto::Webservice.any_instance.should_receive(:encrypt).and_return('vei na boa')
53
+ BraspagPagador::Crypto::Webservice.any_instance.should_receive(:encrypt).and_return('vei na boa')
54
54
  response = connection.generate_eft(order, eft_with_encrypt)
55
-
55
+
56
56
  eft_with_encrypt.code.should eq("<form id='form_tef_um order id' name='form_tef_um order id' action='https://homologacao.pagador.com.br/pagador/passthru.asp' method='post'><input type='text' name='Id_Loja' value='{12345678-1234-1234-1234-123456789000}' /><input type='text' name='crypt' value='vei na boa' /></form><script type='text/javascript' charset='utf-8'>document.forms['form_tef_um order id'].submit();</script>")
57
57
  end
58
58
  end
59
59
  end
60
60
 
61
61
 
62
- describe Braspag::EFT do
63
-
62
+ describe BraspagPagador::EFT do
63
+
64
64
  context "on generate" do
65
65
  it "should not allow blank for crypto" do
66
66
  subject.crypto = ''
@@ -73,9 +73,9 @@ describe Braspag::EFT do
73
73
  subject.valid?(:generate)
74
74
  subject.errors.messages[:crypto].should include("invalid crypto")
75
75
  end
76
-
77
- [ Braspag::Crypto::Webservice.new,
78
- Braspag::Crypto::NoCrypto.new
76
+
77
+ [ BraspagPagador::Crypto::Webservice.new,
78
+ BraspagPagador::Crypto::NoCrypto.new
79
79
  ].each do |crypto|
80
80
  it "should accept valid crypto: #{crypto.class}" do
81
81
  subject.crypto = crypto
@@ -84,5 +84,5 @@ describe Braspag::EFT do
84
84
  end
85
85
  end
86
86
  end
87
-
88
- end
87
+
88
+ end
@@ -1,18 +1,18 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe Braspag::Connection do
3
+ describe BraspagPagador::Connection do
4
4
  let(:merchant_id) { "{12345678-1234-1234-1234-123456789000}" }
5
- let(:connection) { Braspag::Connection.new(:merchant_id => merchant_id, :environment => :homologation)}
6
-
5
+ let(:connection) { BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :homologation)}
6
+
7
7
  pending 'archive'
8
-
8
+
9
9
  pending 'get_recurrency'
10
-
10
+
11
11
  pending 'recurrency'
12
12
  end
13
13
 
14
- describe Braspag::CreditCard do
15
-
14
+ describe BraspagPagador::CreditCard do
15
+
16
16
  [:purchase, :authorize, :archive].each do |context_type|
17
17
  context "on #{context_type}" do
18
18
  it "should validate minimum 1 length of holder_name" do
@@ -44,7 +44,7 @@ describe Braspag::CreditCard do
44
44
  subject.valid?(context_type)
45
45
  subject.errors.messages[:year].should include("can't be blank")
46
46
  end
47
-
47
+
48
48
  it "should not allow invalid date for month & year" do
49
49
  subject.month = "14"
50
50
  subject.year = "2012"
@@ -70,7 +70,7 @@ describe Braspag::CreditCard do
70
70
  end
71
71
  end
72
72
  end
73
-
73
+
74
74
  [:purchase, :authorize, :recurrency].each do |context_type|
75
75
  context "on #{context_type}" do
76
76
  it "should validate minimum 1 length of verification_value" do
@@ -86,7 +86,7 @@ describe Braspag::CreditCard do
86
86
  end
87
87
  end
88
88
  end
89
-
89
+
90
90
  [:get_recurrency, :recurrency].each do |context_type|
91
91
  context "on #{context_type}" do
92
92
  it "should validate length of id" do
@@ -96,5 +96,5 @@ describe Braspag::CreditCard do
96
96
  end
97
97
  end
98
98
  end
99
-
99
+
100
100
  end
@@ -5,15 +5,15 @@ Bundler.setup(:default, :test, :development)
5
5
 
6
6
  require 'simplecov'
7
7
  SimpleCov.start do
8
- add_group "Core", "lib/braspag/core"
9
- add_group "Crypto", "lib/braspag/crypto"
10
- add_group "Payment", "lib/braspag/payment"
11
- add_group "ActiveMerchant", "lib/braspag/active_mechant"
8
+ add_group "Core", "lib/braspag-pagador/core"
9
+ add_group "Crypto", "lib/braspag-pagador/crypto"
10
+ add_group "Payment", "lib/braspag-pagador/payment"
11
+ add_group "ActiveMerchant", "lib/braspag-pagador/active_mechant"
12
12
  add_group "Spec", "spec"
13
13
  end
14
14
 
15
15
  require 'pry'
16
- require 'braspag'
16
+ require 'braspag-pagador'
17
17
 
18
18
  HTTPI.log = false
19
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braspag-pagador
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - CodeMiner42
@@ -221,24 +221,24 @@ files:
221
221
  - coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css
222
222
  - coverage/assets/0.5.3/stylesheet.css
223
223
  - coverage/index.html
224
- - lib/braspag.rb
225
- - lib/braspag/core/connection.rb
226
- - lib/braspag/core/converter.rb
227
- - lib/braspag/core/customer.rb
228
- - lib/braspag/core/order.rb
229
- - lib/braspag/core/poster.rb
230
- - lib/braspag/crypto/no_crypto.rb
231
- - lib/braspag/crypto/webservice.rb
232
- - lib/braspag/payment/billet.rb
233
- - lib/braspag/payment/credit_card.rb
234
- - lib/braspag/payment/eft.rb
235
- - lib/braspag/payment/recurrency_credit_card.rb
236
- - lib/braspag/templates/crypto/decrypt.xml.erb
237
- - lib/braspag/templates/crypto/encrypt.xml.erb
238
- - lib/braspag/templates/justclick/archive.xml.erb
239
- - lib/braspag/templates/justclick/get_recurrency.xml.erb
240
- - lib/braspag/templates/justclick/recurrency.xml.erb
241
- - lib/braspag/version.rb
224
+ - lib/braspag-pagador.rb
225
+ - lib/braspag-pagador/core/connection.rb
226
+ - lib/braspag-pagador/core/converter.rb
227
+ - lib/braspag-pagador/core/customer.rb
228
+ - lib/braspag-pagador/core/order.rb
229
+ - lib/braspag-pagador/core/poster.rb
230
+ - lib/braspag-pagador/crypto/no_crypto.rb
231
+ - lib/braspag-pagador/crypto/webservice.rb
232
+ - lib/braspag-pagador/payment/billet.rb
233
+ - lib/braspag-pagador/payment/credit_card.rb
234
+ - lib/braspag-pagador/payment/eft.rb
235
+ - lib/braspag-pagador/payment/recurrency_credit_card.rb
236
+ - lib/braspag-pagador/templates/crypto/decrypt.xml.erb
237
+ - lib/braspag-pagador/templates/crypto/encrypt.xml.erb
238
+ - lib/braspag-pagador/templates/justclick/archive.xml.erb
239
+ - lib/braspag-pagador/templates/justclick/get_recurrency.xml.erb
240
+ - lib/braspag-pagador/templates/justclick/recurrency.xml.erb
241
+ - lib/braspag-pagador/version.rb
242
242
  - spec/core/connection_spec.rb
243
243
  - spec/core/converter_spec.rb
244
244
  - spec/core/customer_spec.rb
@@ -252,7 +252,7 @@ files:
252
252
  - spec/payment/eft_spec.rb
253
253
  - spec/payment/recurrency_credit_card_spec.rb
254
254
  - spec/spec_helper.rb
255
- homepage: http://github.com/raphaelcosta/braspag
255
+ homepage: http://github.com/raphaelcosta/braspag-pagador
256
256
  licenses: []
257
257
  metadata: {}
258
258
  post_install_message:
@@ -1,3 +0,0 @@
1
- module Braspag
2
- VERSION = "0.9.4"
3
- end