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,4 +1,4 @@
1
- module Braspag
1
+ module BraspagPagador
2
2
  class Connection
3
3
  def purchase(order, credit_card)
4
4
  resp = self.authorize(order, credit_card)
@@ -107,7 +107,7 @@ module Braspag
107
107
  "securityCode" => credit_card.verification_value.to_s,
108
108
  "customerName" => order.customer.name.to_s,
109
109
  "orderId" => order.id.to_s,
110
- "amount" => Braspag::Converter::decimal_to_string(order.amount),
110
+ "amount" => BraspagPagador::Converter::decimal_to_string(order.amount),
111
111
  "paymentMethod" => order.payment_method,
112
112
  "numberPayments" => order.installments,
113
113
  "typePayment" => order.installments_type
@@ -115,7 +115,7 @@ module Braspag
115
115
  end
116
116
 
117
117
  def self.from_authorize(connection, order, credit_card, params)
118
- response = Braspag::Converter::hash_from_xml(params.body, {
118
+ response = BraspagPagador::Converter::hash_from_xml(params.body, {
119
119
  :amount => nil,
120
120
  :number => "authorisationNumber",
121
121
  :message => nil,
@@ -129,7 +129,7 @@ module Braspag
129
129
  order.gateway_return_code = response[:return_code]
130
130
  order.gateway_status = response[:status]
131
131
  order.gateway_message = response[:message]
132
- order.gateway_amount = Braspag::Converter::string_to_decimal(response[:amount])
132
+ order.gateway_amount = BraspagPagador::Converter::string_to_decimal(response[:amount])
133
133
 
134
134
  response
135
135
  end
@@ -142,7 +142,7 @@ module Braspag
142
142
  end
143
143
 
144
144
  def self.from_capture(connection, order, params)
145
- response = Braspag::Converter::hash_from_xml(params.body, {
145
+ response = BraspagPagador::Converter::hash_from_xml(params.body, {
146
146
  :amount => nil,
147
147
  :message => 'message',
148
148
  :return_code => 'returnCode',
@@ -155,7 +155,7 @@ module Braspag
155
155
  order.gateway_capture_return_code = response[:return_code]
156
156
  order.gateway_capture_status = response[:status]
157
157
  order.gateway_capture_message = response[:message]
158
- order.gateway_capture_amount = Braspag::Converter::string_to_decimal(response[:amount])
158
+ order.gateway_capture_amount = BraspagPagador::Converter::string_to_decimal(response[:amount])
159
159
 
160
160
  response
161
161
  end
@@ -168,7 +168,7 @@ module Braspag
168
168
  end
169
169
 
170
170
  def self.from_void(connection, order, params)
171
- response = Braspag::Converter::hash_from_xml(params.body, {
171
+ response = BraspagPagador::Converter::hash_from_xml(params.body, {
172
172
  :order_id => "orderId",
173
173
  :amount => nil,
174
174
  :message => 'message',
@@ -182,7 +182,7 @@ module Braspag
182
182
  order.gateway_void_return_code = response[:return_code]
183
183
  order.gateway_void_status = response[:status]
184
184
  order.gateway_void_message = response[:message]
185
- order.gateway_void_amount = Braspag::Converter::string_to_decimal(response[:amount])
185
+ order.gateway_void_amount = BraspagPagador::Converter::string_to_decimal(response[:amount])
186
186
 
187
187
  response
188
188
  end
@@ -1,10 +1,10 @@
1
- module Braspag
1
+ module BraspagPagador
2
2
  class Connection
3
3
  def generate_eft(order, eft)
4
4
 
5
5
  params = {
6
6
  Id_Loja: self.merchant_id,
7
- VALOR: Braspag::Converter::decimal_to_string(order.amount),
7
+ VALOR: BraspagPagador::Converter::decimal_to_string(order.amount),
8
8
  CODPAGAMENTO: order.payment_method,
9
9
  VENDAID: order.id,
10
10
  NOME: order.customer.name
@@ -47,7 +47,7 @@ module Braspag
47
47
  class CryptoValidator < ActiveModel::EachValidator
48
48
  def validate_each(record, attribute, value)
49
49
  unless (
50
- value.kind_of?(Braspag::Crypto::NoCrypto) ||
50
+ value.kind_of?(BraspagPagador::Crypto::NoCrypto) ||
51
51
  value.respond_to?(:encrypt)
52
52
  )
53
53
  record.errors.add attribute, "invalid crypto"
@@ -1,4 +1,4 @@
1
- module Braspag
1
+ module BraspagPagador
2
2
  class Connection
3
3
  def save_credit_card(credit_card, customer, request_id)
4
4
  response = self.soap_request(:save_credit_card, credit_card, customer, request_id)
@@ -0,0 +1,3 @@
1
+ module BraspagPagador
2
+ VERSION = "0.9.5"
3
+ end
@@ -1,67 +1,67 @@
1
1
  # encoding: utf-8
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
3
 
4
- describe Braspag::Connection do
4
+ describe BraspagPagador::Connection do
5
5
  let(:merchant_id) { "{12345678-1234-1234-1234-123456789000}" }
6
-
6
+
7
7
  it "should accept a valid merchant" do
8
8
  expect {
9
- Braspag::Connection.new(:merchant_id => merchant_id)
10
- }.to_not raise_error(Braspag::Connection::InvalidMerchantId)
9
+ BraspagPagador::Connection.new(:merchant_id => merchant_id)
10
+ }.to_not raise_error(BraspagPagador::Connection::InvalidMerchantId)
11
11
  end
12
-
12
+
13
13
  it "should raise error with invalid merchant" do
14
14
  expect {
15
- Braspag::Connection.new(:merchant_id => "INVALID")
16
- }.to raise_error(Braspag::Connection::InvalidMerchantId)
15
+ BraspagPagador::Connection.new(:merchant_id => "INVALID")
16
+ }.to raise_error(BraspagPagador::Connection::InvalidMerchantId)
17
17
  end
18
-
18
+
19
19
  [:homologation, :production].each do |env|
20
20
  it "should accept #{env} environment" do
21
21
  expect {
22
- Braspag::Connection.new(:merchant_id => merchant_id, :environment => env)
23
- }.to_not raise_error(Braspag::Connection::InvalidEnvironment)
22
+ BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => env)
23
+ }.to_not raise_error(BraspagPagador::Connection::InvalidEnvironment)
24
24
  end
25
25
  end
26
-
26
+
27
27
  it "should raise error with invalid environment" do
28
28
  expect {
29
- Braspag::Connection.new(:merchant_id => merchant_id, :environment => :bla)
30
- }.to raise_error(Braspag::Connection::InvalidEnvironment)
29
+ BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :bla)
30
+ }.to raise_error(BraspagPagador::Connection::InvalidEnvironment)
31
31
  end
32
-
32
+
33
33
  describe ".production?" do
34
34
  it "should return true" do
35
- connection = Braspag::Connection.new(:merchant_id => merchant_id, :environment => :production)
35
+ connection = BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :production)
36
36
  connection.production?.should be(true)
37
37
  end
38
-
38
+
39
39
  it "should return false" do
40
- connection = Braspag::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
40
+ connection = BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
41
41
  connection.production?.should be(false)
42
42
  end
43
43
  end
44
-
44
+
45
45
  describe ".homologation?" do
46
46
  it "should return true" do
47
- connection = Braspag::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
47
+ connection = BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
48
48
  connection.homologation?.should be(true)
49
49
  end
50
-
50
+
51
51
  it "should return false" do
52
- connection = Braspag::Connection.new(:merchant_id => merchant_id, :environment => :production)
52
+ connection = BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :production)
53
53
  connection.homologation?.should be(false)
54
54
  end
55
55
  end
56
-
56
+
57
57
  describe ".url_for" do
58
58
  let(:braspag_homologation_url) { "https://homologacao.pagador.com.br" }
59
59
  let(:braspag_production_url) { "https://transaction.pagador.com.br" }
60
60
  let(:braspag_homologation_protected_card_url) { "https://homologacao.braspag.com.br/services/testenvironment" }
61
- let(:braspag_production_protected_card_url) { "https://cartaoprotegido.braspag.com.br/Services" }
62
-
61
+ let(:braspag_production_protected_card_url) { "https://cartaoprotegido.braspag.com.br/Services/V2" }
62
+
63
63
  it "should return the correct credit card creation url when connection environment is homologation" do
64
- connection = Braspag::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
64
+ connection = BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
65
65
  connection.url_for(:authorize).should == "#{braspag_homologation_url}/webservices/pagador/Pagador.asmx/Authorize"
66
66
  connection.url_for(:capture).should == "#{braspag_homologation_url}/webservices/pagador/Pagador.asmx/Capture"
67
67
  connection.url_for(:void).should == "#{braspag_homologation_url}/webservices/pagador/Pagador.asmx/VoidTransaction"
@@ -71,13 +71,13 @@ describe Braspag::Connection do
71
71
  connection.url_for(:info_credit_card).should == "#{braspag_homologation_url}/pagador/webservice/pedido.asmx/GetDadosCartao"
72
72
  connection.url_for(:info).should == "#{braspag_homologation_url}/pagador/webservice/pedido.asmx/GetDadosPedido"
73
73
  connection.url_for(:encrypt).should == "#{braspag_homologation_url}/BraspagGeneralService/BraspagGeneralService.asmx"
74
- connection.url_for(:archive_card).should == "#{braspag_homologation_protected_card_url}/CartaoProtegido.asmx?wsdl"
74
+ connection.url_for(:save_credit_card).should == "#{braspag_homologation_protected_card_url}/CartaoProtegido.asmx?wsdl"
75
75
  connection.url_for(:get_card).should == "#{braspag_homologation_protected_card_url}/CartaoProtegido.asmx/GetCreditCard"
76
76
  connection.url_for(:recurrency).should == "#{braspag_homologation_protected_card_url}/CartaoProtegido.asmx?wsdl"
77
77
  end
78
78
 
79
79
  it "should return the correct credit card creation url when connection environment is production" do
80
- connection = Braspag::Connection.new(:merchant_id => merchant_id, :environment => :production)
80
+ connection = BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :production)
81
81
  connection.url_for(:authorize).should == "#{braspag_production_url}/webservices/pagador/Pagador.asmx/Authorize"
82
82
  connection.url_for(:capture).should == "#{braspag_production_url}/webservices/pagador/Pagador.asmx/Capture"
83
83
  connection.url_for(:void).should == "#{braspag_production_url}/webservices/pagador/Pagador.asmx/VoidTransaction"
@@ -87,57 +87,57 @@ describe Braspag::Connection do
87
87
  connection.url_for(:info_credit_card).should == "#{braspag_production_url}/webservices/pagador/pedido.asmx/GetDadosCartao"
88
88
  connection.url_for(:info).should == "#{braspag_production_url}/webservices/pagador/pedido.asmx/GetDadosPedido"
89
89
  connection.url_for(:encrypt).should == "#{braspag_production_url}/BraspagGeneralService/BraspagGeneralService.asmx"
90
- connection.url_for(:archive_card).should == "#{braspag_production_protected_card_url}/CartaoProtegido.asmx?wsdl"
90
+ connection.url_for(:save_credit_card).should == "#{braspag_production_protected_card_url}/CartaoProtegido.asmx?wsdl"
91
91
  connection.url_for(:get_card).should == "#{braspag_production_protected_card_url}/CartaoProtegido.asmx/GetCreditCard"
92
92
  connection.url_for(:recurrency).should == "#{braspag_production_protected_card_url}/CartaoProtegido.asmx?wsdl"
93
93
  end
94
94
  end
95
-
95
+
96
96
  describe ".post" do
97
97
  it "should convert data" do
98
- connection = Braspag::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
99
-
98
+ connection = BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :homologation)
99
+
100
100
  mock1 = mock
101
101
  mock2 = mock
102
102
  resp = mock
103
103
  convert_to = mock
104
-
104
+
105
105
  connection.should_receive(:convert).with(
106
106
  :info,
107
107
  :to,
108
108
  [mock1, mock2]
109
109
  ).and_return(convert_to)
110
-
110
+
111
111
  connection.should_receive(:convert).with(
112
112
  :info,
113
113
  :from,
114
114
  [mock1, mock2, resp]
115
115
  )
116
-
117
- Braspag::Poster.any_instance.should_receive(:do_post).with(
116
+
117
+ BraspagPagador::Poster.any_instance.should_receive(:do_post).with(
118
118
  :info,
119
119
  convert_to
120
120
  ).and_return(resp)
121
-
121
+
122
122
  connection.post(:info, mock1, mock2)
123
123
  end
124
124
  end
125
-
125
+
126
126
  describe ".convert" do
127
- let (:connection) { Braspag::Connection.new(:merchant_id => merchant_id, :environment => :homologation) }
127
+ let (:connection) { BraspagPagador::Connection.new(:merchant_id => merchant_id, :environment => :homologation) }
128
128
  {
129
- :authorize => Braspag::CreditCard,
130
- :void => Braspag::CreditCard,
131
- :capture => Braspag::CreditCard,
132
- :archive_card => Braspag::CreditCard,
133
- :get_card => Braspag::CreditCard,
134
- :recurrency => Braspag::CreditCard,
135
- :generate_billet => Braspag::Billet,
136
- :generate_eft => Braspag::EFT,
137
- :info_billet => Braspag::Order,
138
- :info_credit_card => Braspag::Order,
139
- :info => Braspag::Order,
140
- :encrypt => Braspag::Crypto::Webservice
129
+ :authorize => BraspagPagador::CreditCard,
130
+ :void => BraspagPagador::CreditCard,
131
+ :capture => BraspagPagador::CreditCard,
132
+ :save_credit_card => BraspagPagador::CreditCard,
133
+ :get_card => BraspagPagador::CreditCard,
134
+ :recurrency => BraspagPagador::CreditCard,
135
+ :generate_billet => BraspagPagador::Billet,
136
+ :generate_eft => BraspagPagador::EFT,
137
+ :info_billet => BraspagPagador::Order,
138
+ :info_credit_card => BraspagPagador::Order,
139
+ :info => BraspagPagador::Order,
140
+ :encrypt => BraspagPagador::Crypto::Webservice
141
141
  }.each do |method_name, kclass|
142
142
  it "should call method when convert #{method_name} to #{kclass}" do
143
143
  args = [mock, mock]
@@ -1,30 +1,30 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe Braspag::Converter do
3
+ describe BraspagPagador::Converter do
4
4
  describe ".decimal_to_string" do
5
5
  it "should convert decimal to string with comma as decimal separator" do
6
- Braspag::Converter.decimal_to_string(10).should eq("10,00")
7
- Braspag::Converter.decimal_to_string(1).should eq("1,00")
8
- Braspag::Converter.decimal_to_string(0.1).should eq("0,10")
9
- Braspag::Converter.decimal_to_string(0.01).should eq("0,01")
10
- Braspag::Converter.decimal_to_string(9.99999).should eq("10,00") # round up
11
- Braspag::Converter.decimal_to_string(10.9).should eq("10,90")
12
- Braspag::Converter.decimal_to_string(9.1111).should eq("9,11")
13
- Braspag::Converter.decimal_to_string("10,00").should eq("10,00")
6
+ BraspagPagador::Converter.decimal_to_string(10).should eq("10,00")
7
+ BraspagPagador::Converter.decimal_to_string(1).should eq("1,00")
8
+ BraspagPagador::Converter.decimal_to_string(0.1).should eq("0,10")
9
+ BraspagPagador::Converter.decimal_to_string(0.01).should eq("0,01")
10
+ BraspagPagador::Converter.decimal_to_string(9.99999).should eq("10,00") # round up
11
+ BraspagPagador::Converter.decimal_to_string(10.9).should eq("10,90")
12
+ BraspagPagador::Converter.decimal_to_string(9.1111).should eq("9,11")
13
+ BraspagPagador::Converter.decimal_to_string("10,00").should eq("10,00")
14
14
  end
15
15
  end
16
-
16
+
17
17
  describe ".string_to_decimal" do
18
18
  it "should string with comma as decimal separator to decimal" do
19
- Braspag::Converter.string_to_decimal("1000,00").should eq(1000.00)
20
- Braspag::Converter.string_to_decimal("1.000,00").should eq(1000.00)
21
- Braspag::Converter.string_to_decimal("10,00").should eq(10.00)
22
- Braspag::Converter.string_to_decimal("1,00").should eq(1.00)
23
- Braspag::Converter.string_to_decimal("0,10").should eq(0.1)
24
- Braspag::Converter.string_to_decimal("0,01").should eq(0.01)
25
- Braspag::Converter.string_to_decimal("9,99").should eq(9.99)
26
- Braspag::Converter.string_to_decimal("10,9").should eq(10.90)
27
- Braspag::Converter.string_to_decimal("9,1111").should eq(9.1111)
19
+ BraspagPagador::Converter.string_to_decimal("1000,00").should eq(1000.00)
20
+ BraspagPagador::Converter.string_to_decimal("1.000,00").should eq(1000.00)
21
+ BraspagPagador::Converter.string_to_decimal("10,00").should eq(10.00)
22
+ BraspagPagador::Converter.string_to_decimal("1,00").should eq(1.00)
23
+ BraspagPagador::Converter.string_to_decimal("0,10").should eq(0.1)
24
+ BraspagPagador::Converter.string_to_decimal("0,01").should eq(0.01)
25
+ BraspagPagador::Converter.string_to_decimal("9,99").should eq(9.99)
26
+ BraspagPagador::Converter.string_to_decimal("10,9").should eq(10.90)
27
+ BraspagPagador::Converter.string_to_decimal("9,1111").should eq(9.1111)
28
28
  end
29
29
  end
30
30
 
@@ -44,14 +44,14 @@ describe Braspag::Converter do
44
44
  keys = { :foo => nil, :meu_elemento => "bar", :outro_elemento => "baz" }
45
45
  expected = { :foo => "blabla", :meu_elemento => "bleble", :outro_elemento => nil }
46
46
 
47
- Braspag::Converter::hash_from_xml(document, keys).should == expected
47
+ BraspagPagador::Converter::hash_from_xml(document, keys).should == expected
48
48
  end
49
-
49
+
50
50
  it "should return a Hash with invalid key" do
51
51
  keys = { :foo => "invalid", :meu_elemento => "bar", :outro_elemento => "baz" }
52
52
  expected = { :foo => nil, :meu_elemento => "bleble", :outro_elemento => nil }
53
53
 
54
- Braspag::Converter::hash_from_xml(document, keys).should == expected
54
+ BraspagPagador::Converter::hash_from_xml(document, keys).should == expected
55
55
  end
56
56
  end
57
57
 
@@ -62,62 +62,62 @@ describe Braspag::Converter do
62
62
  keys = { :foo => proc, :meu_elemento => "bar", :outro_elemento => "baz" }
63
63
  expected = { :foo => "value returned by Proc", :meu_elemento => "bleble", :outro_elemento => nil }
64
64
 
65
- Braspag::Converter::hash_from_xml(document, keys).should == expected
65
+ BraspagPagador::Converter::hash_from_xml(document, keys).should == expected
66
66
  end
67
67
  end
68
68
  end
69
-
69
+
70
70
  describe ".payment_method_name?" do
71
71
  it "should return name from number" do
72
- Braspag::Converter.payment_method_name?(6).should eq(:billet_bradesco)
72
+ BraspagPagador::Converter.payment_method_name?(6).should eq(:billet_bradesco)
73
73
  end
74
74
 
75
75
  it "should return name from string" do
76
- Braspag::Converter.payment_method_name?("6").should eq(:billet_bradesco)
76
+ BraspagPagador::Converter.payment_method_name?("6").should eq(:billet_bradesco)
77
77
  end
78
78
 
79
79
  it "should return name from string with 0" do
80
- Braspag::Converter.payment_method_name?("06").should eq(:billet_bradesco)
80
+ BraspagPagador::Converter.payment_method_name?("06").should eq(:billet_bradesco)
81
81
  end
82
82
 
83
83
  it "should return nil when not found" do
84
- Braspag::Converter.payment_method_name?("AAA").should be(nil)
84
+ BraspagPagador::Converter.payment_method_name?("AAA").should be(nil)
85
85
  end
86
86
  end
87
-
87
+
88
88
  describe ".status_name?" do
89
89
  it "should return name from number" do
90
- Braspag::Converter.status_name?(1).should eq(:starting)
90
+ BraspagPagador::Converter.status_name?(1).should eq(:starting)
91
91
  end
92
92
 
93
93
  it "should return name from string" do
94
- Braspag::Converter.status_name?("1").should eq(:starting)
94
+ BraspagPagador::Converter.status_name?("1").should eq(:starting)
95
95
  end
96
96
 
97
97
  it "should return name from string with 0" do
98
- Braspag::Converter.status_name?("01").should eq(:starting)
98
+ BraspagPagador::Converter.status_name?("01").should eq(:starting)
99
99
  end
100
100
 
101
101
  it "should return nil when not found" do
102
- Braspag::Converter.status_name?("AAA").should be(nil)
102
+ BraspagPagador::Converter.status_name?("AAA").should be(nil)
103
103
  end
104
104
  end
105
-
105
+
106
106
  describe "payment_method_type?" do
107
107
  it "should response nil when invalid method" do
108
- Braspag::Converter.payment_method_type?(999).should be(nil)
108
+ BraspagPagador::Converter.payment_method_type?(999).should be(nil)
109
109
  end
110
-
110
+
111
111
  it "should response billet" do
112
- Braspag::Converter.payment_method_type?(6).should be(:billet)
112
+ BraspagPagador::Converter.payment_method_type?(6).should be(:billet)
113
113
  end
114
-
114
+
115
115
  it "should response eft" do
116
- Braspag::Converter.payment_method_type?(16).should be(:eft)
116
+ BraspagPagador::Converter.payment_method_type?(16).should be(:eft)
117
117
  end
118
-
118
+
119
119
  it "should response credit_card" do
120
- Braspag::Converter.payment_method_type?(997).should be(:credit_card)
120
+ BraspagPagador::Converter.payment_method_type?(997).should be(:credit_card)
121
121
  end
122
122
  end
123
123
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe Braspag::Customer do
3
+ describe BraspagPagador::Customer do
4
4
  [:purchase, :generate, :authorize, :archive, :recurrency ].each do |context_type|
5
5
  context "on #{context_type}" do
6
6
  it "should validate minimum 1 length of name" do
@@ -46,4 +46,4 @@ describe Braspag::Customer do
46
46
  end
47
47
  end
48
48
  end
49
- end
49
+ end