Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixing credit card mask issue

  • Loading branch information...
commit a082e80538efcf9fa3151ad0e3586ef54e218e10 1 parent e6e5842
@BrunoGrasselli BrunoGrasselli authored
Showing with 4 additions and 4 deletions.
  1. +1 −1  lib/rbraspag/poster.rb
  2. +3 −3 spec/poster_spec.rb
View
2  lib/rbraspag/poster.rb
@@ -27,7 +27,7 @@ def with_logger(method)
end
def mask_data(data)
- copy_data = data.dup
+ copy_data = Rack::Utils.parse_nested_query(data)
copy_data['cardNumber'] = "************%s" % copy_data['cardNumber'][-4..-1] if copy_data['cardNumber']
copy_data['securityCode'] = "***" if copy_data['securityCode']
copy_data
View
6 spec/poster_spec.rb
@@ -2,7 +2,7 @@
require 'ostruct'
describe Braspag::Poster do
- let(:request) { OpenStruct.new(:url => 'http://foo/bar') }
+ let!(:request) { ::HTTPI::Request.new('http://foo/bar') }
let(:response) { mock(:body => 'success') }
let(:logger) { mock(:info => nil) }
subject { described_class.new('http://foo/bar') }
@@ -15,7 +15,7 @@
end
it "should log the request info" do
- logger.should_receive(:info).with('[Braspag] #doe: http://foo/bar, data: {:foo=>:bar, :egg=>:span}')
+ logger.should_receive(:info).with('[Braspag] #doe: http://foo/bar, data: {"foo"=>"bar", "egg"=>"span"}')
subject.do_post(:doe, { :foo => :bar, :egg => :span })
end
@@ -25,7 +25,7 @@
end
it "should log response info" do
- logger.should_receive(:info).with('[Braspag] #doe: http://foo/bar, data: {:foo=>:bar, :egg=>:span}')
+ logger.should_receive(:info).with('[Braspag] #doe: http://foo/bar, data: {"foo"=>"bar", "egg"=>"span"}')
subject.do_post(:doe, { :foo => :bar, :egg => :span })
end
Please sign in to comment.
Something went wrong with that request. Please try again.