baby-braspag 0.1.6 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/RELEASES.md +5 -1
- data/baby-braspag.gemspec +3 -3
- data/lib/baby-braspag.rb +9 -0
- data/lib/baby-braspag/connection.rb +7 -0
- data/lib/baby-braspag/payment_method.rb +1 -0
- data/lib/baby-braspag/protected_credit_card.rb +36 -13
- data/lib/baby-braspag/version.rb +1 -1
- data/spec/connection_spec.rb +50 -0
- data/spec/poster_spec.rb +1 -0
- data/spec/protected_credit_card_spec.rb +123 -48
- metadata +20 -15
data/RELEASES.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# RELEASES
|
2
2
|
|
3
|
+
## 0.2.1 - 11/08/2014
|
4
|
+
|
5
|
+
Log das operações `SaveCreditCard` e `JustClickShop` do serviço `CartaoProtegido`.
|
6
|
+
|
3
7
|
## For next release
|
4
8
|
|
5
9
|
d2b9a7a Voltando a usar o HTTPI
|
@@ -17,4 +21,4 @@ a663e0a baixando a versão mínima requerida do nokogiri
|
|
17
21
|
628d108 refatorando testes e implementação
|
18
22
|
087549a moving Connection exceptions to errors.rb; tests for Utils class
|
19
23
|
9a727eb bump up version
|
20
|
-
6e5b1c3 refatorando para suportar o ambiente de produção da Braspag
|
24
|
+
6e5b1c3 refatorando para suportar o ambiente de produção da Braspag
|
data/baby-braspag.gemspec
CHANGED
@@ -20,11 +20,11 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_dependency 'httpi', '>= 0.9.6'
|
22
22
|
s.add_dependency 'json', '>= 1.6.1'
|
23
|
-
s.add_dependency 'nokogiri', '
|
24
|
-
s.add_dependency 'savon', '
|
23
|
+
s.add_dependency 'nokogiri', '~> 1.6.1'
|
24
|
+
s.add_dependency 'savon', '~> 2.3.2'
|
25
25
|
|
26
26
|
s.add_development_dependency "rake"
|
27
|
-
s.add_development_dependency "rspec"
|
27
|
+
s.add_development_dependency "rspec", '~> 2.12.0'
|
28
28
|
s.add_development_dependency "fakeweb"
|
29
29
|
s.add_development_dependency "shoulda-matchers"
|
30
30
|
s.add_development_dependency "guard-rspec"
|
data/lib/baby-braspag.rb
CHANGED
@@ -42,4 +42,13 @@ module Braspag
|
|
42
42
|
def self.proxy_address
|
43
43
|
@proxy_address
|
44
44
|
end
|
45
|
+
|
46
|
+
def self.savon_global_options=(options_hash)
|
47
|
+
@savon_global_options ||= {}
|
48
|
+
@savon_global_options.merge!(options_hash)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.savon_global_options
|
52
|
+
@savon_global_options || {}
|
53
|
+
end
|
45
54
|
end
|
@@ -46,5 +46,12 @@ module Braspag
|
|
46
46
|
def homologation?
|
47
47
|
@environment == 'homologation'
|
48
48
|
end
|
49
|
+
|
50
|
+
def savon_client(url, options = {})
|
51
|
+
options = options.merge(Braspag.savon_global_options)
|
52
|
+
options = options.merge(:proxy => Braspag::proxy_address) if !Braspag::proxy_address.blank?
|
53
|
+
options = options.merge(:wsdl => url)
|
54
|
+
Savon.client(options)
|
55
|
+
end
|
49
56
|
end
|
50
57
|
end
|
@@ -18,6 +18,7 @@ module Braspag
|
|
18
18
|
:amex_sitef => 58, # Amex SITEF
|
19
19
|
:aura_dtef => 37, # Aura DTEF
|
20
20
|
:redecard_sitef => 44, # Redecard SITEF - Mastercard/Diners
|
21
|
+
:amex_cielo => 180,
|
21
22
|
# MÉXICO
|
22
23
|
:mex_amex_2p => 45, # American Express 2 Party
|
23
24
|
:mex_banorte_visa => 50, # Banorte Visa
|
@@ -40,14 +40,20 @@ module Braspag
|
|
40
40
|
data['saveCreditCardRequestWS'][v] = params[k] || ""
|
41
41
|
end
|
42
42
|
|
43
|
+
data_for_logging = data['saveCreditCardRequestWS'].dup
|
44
|
+
data_for_logging['CardNumber'] = "************%s" % data_for_logging['CardNumber'][-4..-1]
|
43
45
|
|
44
|
-
|
45
|
-
response = client.request(:web, :save_credit_card) do
|
46
|
-
soap.body = data
|
47
|
-
end
|
46
|
+
Braspag.logger.info("[Braspag] #save_credit_card, data: #{data_for_logging}") if Braspag.logger
|
48
47
|
|
49
|
-
|
48
|
+
client = savon_client(self.save_protected_card_url)
|
49
|
+
response = client.call(:save_credit_card, :message => data)
|
50
|
+
|
51
|
+
# We do not want to let any sensitive data exposed on log files.
|
52
|
+
redacted_response = redact_just_click_key(response)
|
53
|
+
|
54
|
+
Braspag.logger.info("[Braspag] #save_credit_card returns: #{redacted_response}") if Braspag.logger
|
50
55
|
|
56
|
+
response.to_hash[:save_credit_card_response][:save_credit_card_result]
|
51
57
|
end
|
52
58
|
|
53
59
|
# request the credit card info in Braspag PCI Compliant
|
@@ -93,13 +99,18 @@ module Braspag
|
|
93
99
|
end
|
94
100
|
end
|
95
101
|
|
102
|
+
data_for_logging = data['justClickShopRequestWS'].dup
|
103
|
+
data_for_logging['SecurityCode'] = data_for_logging['SecurityCode'].gsub(/./, '*')
|
104
|
+
data_for_logging['JustClickKey'] = data_for_logging['JustClickKey'].gsub(/\h/, 'X')
|
105
|
+
|
106
|
+
Braspag.logger.info("[Braspag] #just_click_shop, data: #{data_for_logging}") if Braspag.logger
|
107
|
+
|
96
108
|
client = savon_client(self.just_click_shop_url)
|
97
|
-
response = client.
|
98
|
-
soap.body = data
|
99
|
-
end
|
109
|
+
response = client.call(:just_click_shop, :message => data)
|
100
110
|
|
101
|
-
|
111
|
+
Braspag.logger.info("[Braspag] #just_click_shop returns: #{response}") if Braspag.logger
|
102
112
|
|
113
|
+
response.to_hash[:just_click_shop_response][:just_click_shop_result]
|
103
114
|
end
|
104
115
|
|
105
116
|
def self.check_protected_card_params(params)
|
@@ -151,10 +162,22 @@ module Braspag
|
|
151
162
|
Braspag::Connection.instance.protected_card_url + JUST_CLICK_SHOP_URI
|
152
163
|
end
|
153
164
|
|
154
|
-
def self.savon_client
|
155
|
-
|
156
|
-
|
157
|
-
|
165
|
+
def self.savon_client(url)
|
166
|
+
Braspag::Connection.instance.savon_client url
|
167
|
+
end
|
168
|
+
|
169
|
+
# Internal: Redact the JustClickKey value from a XML response.
|
170
|
+
#
|
171
|
+
# response - the XML response string to be parsed.
|
172
|
+
#
|
173
|
+
# Example
|
174
|
+
#
|
175
|
+
# redact_just_click_key('<JustClickKey>{070071E9-1F73-4C85-B1E4-D8040A627DED}</JustClickKey>')
|
176
|
+
# # => '<JustClickKey>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</JustClickKey>'
|
177
|
+
#
|
178
|
+
# Returns a String.
|
179
|
+
def self.redact_just_click_key(response)
|
180
|
+
response.to_s.gsub(/(?<=<JustClickKey>)(.*?)(?=<\/JustClickKey>)/) { |key| key.gsub(/\h/, 'X') }
|
158
181
|
end
|
159
182
|
end
|
160
183
|
end
|
data/lib/baby-braspag/version.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
@@ -185,4 +185,54 @@ describe Braspag::Connection do
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
188
|
+
|
189
|
+
describe "#savon_client" do
|
190
|
+
let(:wsdl_uri) { 'http://localhost?wsdl' }
|
191
|
+
let(:proxy) { nil }
|
192
|
+
let(:global_settings) { {} }
|
193
|
+
|
194
|
+
before do
|
195
|
+
Braspag.proxy_address = proxy
|
196
|
+
Braspag.savon_global_options = global_settings
|
197
|
+
end
|
198
|
+
|
199
|
+
context "with local setting" do
|
200
|
+
it "should set the settings on client" do
|
201
|
+
Savon.should_receive(:client).with(:wsdl => wsdl_uri, :logger_level => :info)
|
202
|
+
|
203
|
+
Braspag::Connection.clone.instance.savon_client(wsdl_uri, :logger_level => :info)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context "with proxy address set" do
|
208
|
+
let(:proxy) { 'http://some.proxy.com:3444' }
|
209
|
+
|
210
|
+
it "should set the proxy on client" do
|
211
|
+
Savon.should_receive(:client).with(:wsdl => wsdl_uri, :proxy => proxy)
|
212
|
+
|
213
|
+
Braspag::Connection.clone.instance.savon_client(wsdl_uri)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
context "with global setting" do
|
218
|
+
let(:global_settings) { {:log => false} }
|
219
|
+
|
220
|
+
it "should set the settings on client" do
|
221
|
+
Savon.should_receive(:client).with(:wsdl => wsdl_uri, :log => false)
|
222
|
+
|
223
|
+
Braspag::Connection.clone.instance.savon_client(wsdl_uri)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
context "with local setting, global settings and proxy" do
|
228
|
+
let(:proxy) { 'http://some.proxy.com:3444' }
|
229
|
+
let(:global_settings) { {:log => false} }
|
230
|
+
|
231
|
+
it "should set the settings and proxy on client" do
|
232
|
+
Savon.should_receive(:client).with(:wsdl => wsdl_uri, :proxy => proxy, :log => false, :logger_level => :info)
|
233
|
+
|
234
|
+
Braspag::Connection.clone.instance.savon_client(wsdl_uri, :logger_level => :info)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
188
238
|
end
|
data/spec/poster_spec.rb
CHANGED
@@ -10,20 +10,6 @@ describe Braspag::ProtectedCreditCard do
|
|
10
10
|
Braspag::Connection.stub(:instance => @connection)
|
11
11
|
Braspag.proxy_address = nil
|
12
12
|
end
|
13
|
-
context "savon_client with proxy addres set" do
|
14
|
-
let (:savon_double) {double('Savon')}
|
15
|
-
before do
|
16
|
-
@http = double("HTTP")
|
17
|
-
Savon::Client.stub(:new).and_return savon_double
|
18
|
-
savon_double.stub(:http).and_return @http
|
19
|
-
Braspag.proxy_address = "http://some.proxy.com:3444"
|
20
|
-
end
|
21
|
-
it "should set the http proxy" do
|
22
|
-
@http.should_receive(:proxy=).with "http://some.proxy.com:3444"
|
23
|
-
|
24
|
-
Braspag::ProtectedCreditCard.savon_client("url")
|
25
|
-
end
|
26
|
-
end
|
27
13
|
|
28
14
|
describe ".save" do
|
29
15
|
let(:params) do
|
@@ -33,7 +19,7 @@ describe Braspag::ProtectedCreditCard do
|
|
33
19
|
:card_number => "9" * 10,
|
34
20
|
:expiration => "10/12",
|
35
21
|
:order_id => "um order id",
|
36
|
-
:request_id => "
|
22
|
+
:request_id => "{D1BBDA27-65B9-4E68-9700-7A834A80BE88}"
|
37
23
|
}
|
38
24
|
end
|
39
25
|
|
@@ -42,19 +28,21 @@ describe Braspag::ProtectedCreditCard do
|
|
42
28
|
end
|
43
29
|
|
44
30
|
let(:save_protected_card_url) { "http://braspag.com/bla" }
|
45
|
-
|
46
31
|
let(:savon_double) { double('Savon') }
|
32
|
+
let(:logger) { mock(:info => nil) }
|
47
33
|
|
48
34
|
before do
|
35
|
+
Braspag.stub(:logger => logger)
|
49
36
|
@connection.should_receive(:merchant_id)
|
50
37
|
end
|
51
38
|
|
52
39
|
context "with valid params" do
|
53
|
-
let(:
|
40
|
+
let(:valid_response_hash) do
|
54
41
|
{
|
55
42
|
:save_credit_card_response => {
|
56
43
|
:save_credit_card_result => {
|
57
|
-
:
|
44
|
+
:correlation_id => '{D1BBDA27-65B9-4E68-9700-7A834A80BE88}',
|
45
|
+
:just_click_key => '{070071E9-1F73-4C85-B1E4-D8040A627DED}',
|
58
46
|
:success => true
|
59
47
|
}
|
60
48
|
}
|
@@ -62,27 +50,93 @@ describe Braspag::ProtectedCreditCard do
|
|
62
50
|
end
|
63
51
|
|
64
52
|
let(:response) do
|
65
|
-
|
53
|
+
xml_response = <<-XML
|
54
|
+
<?xml version="1.0" encoding="utf-8"?>
|
55
|
+
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
56
|
+
<soap:Body>
|
57
|
+
<SaveCreditCardResponse xmlns="http://www.cartaoprotegido.com.br/WebService/">
|
58
|
+
<SaveCreditCardResult>
|
59
|
+
<CorrelationId>{D1BBDA27-65B9-4E68-9700-7A834A80BE88}</CorrelationId>
|
60
|
+
<JustClickKey>{070071E9-1F73-4C85-B1E4-D8040A627DED}</JustClickKey>
|
61
|
+
<Success>true</Success>
|
62
|
+
</SaveCreditCardResult>
|
63
|
+
</SaveCreditCardResponse>
|
64
|
+
</soap:Body>
|
65
|
+
</soap:Envelope>
|
66
|
+
XML
|
67
|
+
|
68
|
+
double('Response', :to_s => xml_response, :to_hash => valid_response_hash)
|
66
69
|
end
|
67
70
|
|
68
71
|
before do
|
69
72
|
Braspag::ProtectedCreditCard.should_receive(:save_protected_card_url)
|
70
73
|
Braspag::ProtectedCreditCard.should_receive(:check_protected_card_params)
|
71
74
|
.and_return(true)
|
72
|
-
|
73
|
-
savon_double.should_receive(:
|
74
|
-
|
75
|
-
@response = Braspag::ProtectedCreditCard.save(params)
|
75
|
+
@connection.should_receive(:savon_client).and_return(savon_double)
|
76
|
+
savon_double.should_receive(:call).and_return(response)
|
76
77
|
end
|
77
78
|
|
78
79
|
it "should return a Hash" do
|
80
|
+
@response = Braspag::ProtectedCreditCard.save(params)
|
81
|
+
|
79
82
|
@response.should be_kind_of Hash
|
80
83
|
@response.should == {
|
81
|
-
:
|
84
|
+
:correlation_id => '{D1BBDA27-65B9-4E68-9700-7A834A80BE88}',
|
85
|
+
:just_click_key => '{070071E9-1F73-4C85-B1E4-D8040A627DED}',
|
82
86
|
:success => true
|
83
87
|
}
|
84
88
|
end
|
85
89
|
|
90
|
+
it "should log that the save call was performed" do
|
91
|
+
Braspag.logger.should_receive(:info).with(%r{\[Braspag\] #save_credit_card, data:})
|
92
|
+
|
93
|
+
Braspag::ProtectedCreditCard.save(params)
|
94
|
+
end
|
95
|
+
|
96
|
+
[
|
97
|
+
%r{"RequestId"=>"{D1BBDA27-65B9-4E68-9700-7A834A80BE88}"},
|
98
|
+
%r{"MerchantKey"=>"um id qualquer"},
|
99
|
+
%r{"CustomerName"=>"WWWWWWWWWWWWWWWWWWWWW"},
|
100
|
+
%r{"CardHolder"=>"Joao Maria Souza"},
|
101
|
+
%r{"CardExpiration"=>"10/12"}
|
102
|
+
].each do |request_param|
|
103
|
+
it "should log the request data with the #{request_param} parameter" do
|
104
|
+
Braspag.logger.should_receive(:info).with(request_param)
|
105
|
+
|
106
|
+
Braspag::ProtectedCreditCard.save(params)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should log the response received from to the save call" do
|
111
|
+
Braspag.logger.should_receive(:info)
|
112
|
+
Braspag.logger.should_receive(:info).with(%r{\[Braspag\] #save_credit_card returns:})
|
113
|
+
|
114
|
+
Braspag::ProtectedCreditCard.save(params)
|
115
|
+
end
|
116
|
+
|
117
|
+
[
|
118
|
+
%r{<CorrelationId>{D1BBDA27-65B9-4E68-9700-7A834A80BE88}</CorrelationId>},
|
119
|
+
%r{<JustClickKey>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</JustClickKey>},
|
120
|
+
%r{<Success>true</Success>}
|
121
|
+
].each do |response_field|
|
122
|
+
it "should log the response with the #{response_field} field" do
|
123
|
+
Braspag.logger.should_receive(:info).with(response_field)
|
124
|
+
|
125
|
+
Braspag::ProtectedCreditCard.save(params)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should redact the given card number" do
|
130
|
+
Braspag.logger.should_receive(:info).with(%r{"CardNumber"=>"\*\*\*\*\*\*\*\*\*\*\*\*9999"})
|
131
|
+
|
132
|
+
Braspag::ProtectedCreditCard.save(params)
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should redact the just click key value" do
|
136
|
+
Braspag.logger.should_receive(:info).with(%r{<JustClickKey>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}<\/JustClickKey>})
|
137
|
+
|
138
|
+
Braspag::ProtectedCreditCard.save(params)
|
139
|
+
end
|
86
140
|
end
|
87
141
|
|
88
142
|
context "with invalid params" do
|
@@ -106,8 +160,8 @@ describe Braspag::ProtectedCreditCard do
|
|
106
160
|
.and_return(true)
|
107
161
|
Braspag::ProtectedCreditCard.should_receive(:save_protected_card_url)
|
108
162
|
.and_return(save_protected_card_url)
|
109
|
-
|
110
|
-
savon_double.should_receive(:
|
163
|
+
@connection.should_receive(:savon_client).and_return(savon_double)
|
164
|
+
savon_double.should_receive(:call).and_return(response)
|
111
165
|
|
112
166
|
@response = Braspag::ProtectedCreditCard.save(params)
|
113
167
|
end
|
@@ -151,9 +205,9 @@ describe Braspag::ProtectedCreditCard do
|
|
151
205
|
EOXML
|
152
206
|
end
|
153
207
|
|
154
|
-
|
155
|
-
|
156
|
-
|
208
|
+
let(:logger) { mock(:info => nil) }
|
209
|
+
before { Braspag.logger = logger }
|
210
|
+
|
157
211
|
it "should raise an error when just click key is not valid" do
|
158
212
|
Braspag::ProtectedCreditCard.should_receive(:valid_just_click_key?)
|
159
213
|
.with("bla")
|
@@ -204,84 +258,105 @@ describe Braspag::ProtectedCreditCard do
|
|
204
258
|
:payment_method => :redecard,
|
205
259
|
:number_installments => 3,
|
206
260
|
:payment_type => "test",
|
207
|
-
:just_click_key => "
|
261
|
+
:just_click_key => "{070071E9-1F73-4C85-B1E4-D8040A627DED}",
|
208
262
|
:security_code => "123"
|
209
263
|
} }
|
210
264
|
|
265
|
+
let(:logger) { mock(:info => nil) }
|
266
|
+
|
211
267
|
class SavonClientTest
|
212
268
|
attr_accessor :response
|
213
269
|
attr_reader :method
|
214
270
|
|
215
|
-
def
|
216
|
-
@method
|
217
|
-
|
271
|
+
def call(method, options, &block)
|
272
|
+
@method = method
|
273
|
+
@options = options
|
218
274
|
|
219
275
|
@response
|
220
276
|
end
|
221
277
|
|
222
|
-
def
|
223
|
-
@
|
278
|
+
def options
|
279
|
+
OpenStruct.new(@options || {})
|
224
280
|
end
|
225
281
|
end
|
226
282
|
|
227
|
-
before
|
283
|
+
before do
|
284
|
+
Braspag.stub(:logger => logger)
|
228
285
|
@savon_client_test = SavonClientTest.new
|
229
286
|
@savon_client_test.response = {:just_click_shop_response => {}}
|
230
|
-
|
287
|
+
@connection.should_receive(:savon_client).with('https://www.cartaoprotegido.com.br/Services/TestEnvironment/CartaoProtegido.asmx?wsdl').and_return(@savon_client_test)
|
231
288
|
end
|
232
289
|
|
233
290
|
after :each do
|
234
|
-
Savon::Client.unstub(:new)
|
235
291
|
end
|
236
292
|
|
237
293
|
it "should have RequestId" do
|
238
294
|
described_class.just_click_shop(params)
|
239
|
-
@savon_client_test.
|
295
|
+
@savon_client_test.options.message['justClickShopRequestWS']['RequestId'].should eq '123'
|
240
296
|
end
|
241
297
|
|
242
298
|
it "should have MerchantKey" do
|
243
299
|
described_class.just_click_shop(params)
|
244
|
-
@savon_client_test.
|
300
|
+
@savon_client_test.options.message['justClickShopRequestWS']['MerchantKey'].should eq 'um id qualquer'
|
245
301
|
end
|
246
302
|
|
247
303
|
it "should have CustomerName" do
|
248
304
|
described_class.just_click_shop(params)
|
249
|
-
@savon_client_test.
|
305
|
+
@savon_client_test.options.message['justClickShopRequestWS']['CustomerName'].should eq 'Joao Silva'
|
250
306
|
end
|
251
307
|
|
252
308
|
it "should have OrderId" do
|
253
309
|
described_class.just_click_shop(params)
|
254
|
-
@savon_client_test.
|
310
|
+
@savon_client_test.options.message['justClickShopRequestWS']['OrderId'].should eq '999'
|
255
311
|
end
|
256
312
|
|
257
313
|
it "should have Amount" do
|
258
314
|
described_class.just_click_shop(params)
|
259
|
-
@savon_client_test.
|
315
|
+
@savon_client_test.options.message['justClickShopRequestWS']['Amount'].should eq "1050"
|
260
316
|
end
|
261
317
|
|
262
318
|
it "should have PaymentMethod" do
|
263
319
|
described_class.just_click_shop(params)
|
264
|
-
@savon_client_test.
|
320
|
+
@savon_client_test.options.message['justClickShopRequestWS']['PaymentMethod'].should eq 20
|
265
321
|
end
|
266
322
|
|
267
323
|
it "should have PaymentType" do
|
268
324
|
described_class.just_click_shop(params)
|
269
|
-
@savon_client_test.
|
325
|
+
@savon_client_test.options.message['justClickShopRequestWS']['PaymentType'].should eq 'test'
|
270
326
|
end
|
271
327
|
|
272
328
|
it "should have NumberInstallments" do
|
273
329
|
described_class.just_click_shop(params)
|
274
|
-
@savon_client_test.
|
330
|
+
@savon_client_test.options.message['justClickShopRequestWS']['NumberInstallments'].should eq 3
|
275
331
|
end
|
276
332
|
|
277
333
|
it "should have JustClickKey" do
|
278
334
|
described_class.just_click_shop(params)
|
279
|
-
@savon_client_test.
|
335
|
+
@savon_client_test.options.message['justClickShopRequestWS']['JustClickKey'].should eq '{070071E9-1F73-4C85-B1E4-D8040A627DED}'
|
280
336
|
end
|
281
337
|
|
282
338
|
it "should have SecurityCode" do
|
283
339
|
described_class.just_click_shop(params)
|
284
|
-
@savon_client_test.
|
340
|
+
@savon_client_test.options.message['justClickShopRequestWS']['SecurityCode'].should eq '123'
|
341
|
+
end
|
342
|
+
|
343
|
+
it "should log the request data and the response body" do
|
344
|
+
Braspag.logger.should_receive(:info).with(%r{\[Braspag\] #just_click_shop, data:})
|
345
|
+
Braspag.logger.should_receive(:info).with(%r{\[Braspag\] #just_click_shop returns:})
|
346
|
+
|
347
|
+
described_class.just_click_shop(params)
|
348
|
+
end
|
349
|
+
|
350
|
+
it "should redact the given security code" do
|
351
|
+
Braspag.logger.should_receive(:info).with(%r{"SecurityCode"=>"\*\*\*"})
|
352
|
+
|
353
|
+
described_class.just_click_shop(params)
|
354
|
+
end
|
355
|
+
|
356
|
+
it "should redact the given security code" do
|
357
|
+
Braspag.logger.should_receive(:info).with(%r{"JustClickKey"=>"{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"})
|
358
|
+
|
359
|
+
described_class.just_click_shop(params)
|
285
360
|
end
|
286
361
|
end
|
287
362
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baby-braspag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httpi
|
@@ -48,33 +48,33 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.
|
53
|
+
version: 1.6.1
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.6.1
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: savon
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 2.3.2
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 2.3.2
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rake
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,17 +96,17 @@ dependencies:
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: 2.12.0
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 2.12.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: fakeweb
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,12 +242,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
242
|
- - ! '>='
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
|
+
segments:
|
246
|
+
- 0
|
247
|
+
hash: 818008938633395010
|
245
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
249
|
none: false
|
247
250
|
requirements:
|
248
251
|
- - ! '>='
|
249
252
|
- !ruby/object:Gem::Version
|
250
253
|
version: '0'
|
254
|
+
segments:
|
255
|
+
- 0
|
256
|
+
hash: 818008938633395010
|
251
257
|
requirements: []
|
252
258
|
rubyforge_project: baby-braspag
|
253
259
|
rubygems_version: 1.8.25
|
@@ -266,4 +272,3 @@ test_files:
|
|
266
272
|
- spec/protected_credit_card_spec.rb
|
267
273
|
- spec/spec_helper.rb
|
268
274
|
- spec/utils_spec.rb
|
269
|
-
has_rdoc:
|