rbraspag 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/rbraspag/eft.rb +9 -0
- data/lib/rbraspag/utils.rb +1 -1
- data/lib/rbraspag/version.rb +1 -1
- data/spec/eft_spec.rb +6 -6
- data/spec/utils_spec.rb +1 -1
- metadata +21 -21
data/Gemfile.lock
CHANGED
data/lib/rbraspag/eft.rb
CHANGED
@@ -34,6 +34,9 @@ module Braspag
|
|
34
34
|
raise InvalidOrderId unless params[:order_id].is_a?(String) || params[:order_id].is_a?(Fixnum)
|
35
35
|
raise InvalidOrderId unless (1..50).include?(params[:order_id].to_s.size)
|
36
36
|
|
37
|
+
params[:installments] = "1" if params[:installments].nil?
|
38
|
+
params[:installments] = "1" if params[:installments].nil?
|
39
|
+
|
37
40
|
unless params[:customer_name].nil?
|
38
41
|
raise InvalidCustomerName unless (1..255).include?(params[:customer_name].to_s.size)
|
39
42
|
end
|
@@ -55,6 +58,12 @@ module Braspag
|
|
55
58
|
raise InvalidHasInterest unless (params[:has_interest].is_a?(TrueClass) || params[:has_interest].is_a?(FalseClass))
|
56
59
|
end
|
57
60
|
|
61
|
+
if params[:has_interest]
|
62
|
+
params[:has_interest] = "1"
|
63
|
+
else
|
64
|
+
params[:has_interest] = "0"
|
65
|
+
end
|
66
|
+
|
58
67
|
data = create_data(params)
|
59
68
|
|
60
69
|
html = "<form id=\"form_tef_#{params[:order_id]}\" name=\"form_tef_#{params[:order_id]}\" action=\"#{self.uri}\" method=\"post\">\n"
|
data/lib/rbraspag/utils.rb
CHANGED
@@ -3,7 +3,7 @@ module Braspag
|
|
3
3
|
def self.convert_decimal_to_string(value)
|
4
4
|
cents = "0#{((value - value.to_i) * 100).to_i}".slice(-2,2)
|
5
5
|
integer = (value - (value - value.to_i)).to_i
|
6
|
-
"#{integer}
|
6
|
+
"#{integer}#{cents}"
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.convert_to_map(document, map = {})
|
data/lib/rbraspag/version.rb
CHANGED
data/spec/eft_spec.rb
CHANGED
@@ -154,12 +154,12 @@ describe Braspag::Eft do
|
|
154
154
|
<form id="form_tef_1234123125" name="form_tef_1234123125" action="https://homologacao.pagador.com.br/pagador/passthru.asp" method="post">
|
155
155
|
<input type="text" name="Id_Loja" value="{84BE7E7F-698A-6C74-F820-AE359C2A07C2}" />
|
156
156
|
<input type="text" name="VENDAID" value="1234123125" />
|
157
|
-
<input type="text" name="
|
158
|
-
<input type="text" name="
|
159
|
-
<input type="text" name="
|
160
|
-
<input type="text" name="
|
161
|
-
<input type="text" name="PARCELAS" value="" />
|
162
|
-
<input type="text" name="TIPOPARCELADO" value="" />
|
157
|
+
<input type="text" name="nome" value="" />
|
158
|
+
<input type="text" name="CPF" value="" />
|
159
|
+
<input type="text" name="VALOR" value="12300" />
|
160
|
+
<input type="text" name="CODPAGAMENTO" value="11" />
|
161
|
+
<input type="text" name="PARCELAS" value="1" />
|
162
|
+
<input type="text" name="TIPOPARCELADO" value="0" />
|
163
163
|
</form>
|
164
164
|
<script type="text/javascript" charset="utf-8">
|
165
165
|
document.forms["form_tef_1234123125"].submit();
|
data/spec/utils_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
|
4
4
|
describe Braspag::Utils do
|
5
5
|
it '.convert_decimal_to_string' do
|
6
|
-
Braspag::Utils.convert_decimal_to_string(10.80).should == "
|
6
|
+
Braspag::Utils.convert_decimal_to_string(10.80).should == "1080"
|
7
7
|
end
|
8
8
|
|
9
9
|
pending "convert_to_map"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbraspag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -19,7 +19,7 @@ default_executable:
|
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: cs-httpi
|
22
|
-
requirement: &
|
22
|
+
requirement: &16255680 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
25
|
- - ! '>='
|
@@ -27,10 +27,10 @@ dependencies:
|
|
27
27
|
version: 0.9.5.2
|
28
28
|
type: :runtime
|
29
29
|
prerelease: false
|
30
|
-
version_requirements: *
|
30
|
+
version_requirements: *16255680
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: json
|
33
|
-
requirement: &
|
33
|
+
requirement: &16252880 !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
36
|
- - ! '>='
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
version: '0'
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: *
|
41
|
+
version_requirements: *16252880
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: nokogiri
|
44
|
-
requirement: &
|
44
|
+
requirement: &16249860 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
47
|
- - ! '>='
|
@@ -49,10 +49,10 @@ dependencies:
|
|
49
49
|
version: '0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *16249860
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
55
|
-
requirement: &
|
55
|
+
requirement: &16248280 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ! '>='
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
version: '0'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
|
-
version_requirements: *
|
63
|
+
version_requirements: *16248280
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: rspec
|
66
|
-
requirement: &
|
66
|
+
requirement: &16238220 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ! '>='
|
@@ -71,10 +71,10 @@ dependencies:
|
|
71
71
|
version: '0'
|
72
72
|
type: :development
|
73
73
|
prerelease: false
|
74
|
-
version_requirements: *
|
74
|
+
version_requirements: *16238220
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: fakeweb
|
77
|
-
requirement: &
|
77
|
+
requirement: &16236240 !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|
80
80
|
- - ! '>='
|
@@ -82,10 +82,10 @@ dependencies:
|
|
82
82
|
version: '0'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
|
-
version_requirements: *
|
85
|
+
version_requirements: *16236240
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: shoulda-matchers
|
88
|
-
requirement: &
|
88
|
+
requirement: &16233720 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
@@ -93,10 +93,10 @@ dependencies:
|
|
93
93
|
version: '0'
|
94
94
|
type: :development
|
95
95
|
prerelease: false
|
96
|
-
version_requirements: *
|
96
|
+
version_requirements: *16233720
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: guard-rspec
|
99
|
-
requirement: &
|
99
|
+
requirement: &16201180 !ruby/object:Gem::Requirement
|
100
100
|
none: false
|
101
101
|
requirements:
|
102
102
|
- - ! '>='
|
@@ -104,10 +104,10 @@ dependencies:
|
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
|
-
version_requirements: *
|
107
|
+
version_requirements: *16201180
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
109
|
name: guard-bundler
|
110
|
-
requirement: &
|
110
|
+
requirement: &16186720 !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|
113
113
|
- - ! '>='
|
@@ -115,10 +115,10 @@ dependencies:
|
|
115
115
|
version: '0'
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
|
-
version_requirements: *
|
118
|
+
version_requirements: *16186720
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: ruby-debug19
|
121
|
-
requirement: &
|
121
|
+
requirement: &16183540 !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
124
124
|
- - ! '>='
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
version: '0'
|
127
127
|
type: :development
|
128
128
|
prerelease: false
|
129
|
-
version_requirements: *
|
129
|
+
version_requirements: *16183540
|
130
130
|
description: rbraspag gem to use Braspag gateway
|
131
131
|
email:
|
132
132
|
- tinorj@gmail.com
|