cieloz 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/README.md +17 -43
- data/cieloz.gemspec +0 -2
- data/lib/cieloz/requisicao_transacao.rb +1 -1
- data/lib/cieloz/requisicao_transacao/forma_pagamento.rb +5 -5
- data/lib/cieloz/version.rb +1 -1
- data/test/minitest_helper.rb +0 -1
- data/test/unit/configuracao_test.rb +5 -5
- metadata +21 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c6abab787494fb941d6bfa10208971d50d430ac
|
4
|
+
data.tar.gz: e597e34b03aec7cc047f3cc66ed25c32e496d7f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55bd65325bd4bd7ef671d83d1c6df2f10ed5399dea6e3ec057815d32a73729f9eb34112974b7c7eeb4437e1a8e420c394277468dd332cb5a7ba2539b3f168e99
|
7
|
+
data.tar.gz: aa9053791efa6953a6d307ab6d49c1c6557c29ef3035bd013d6998bd35274edbe724a0157494cacba82136a049751d09aa37d0db4aa57b2e5bd4d4018f4f70a5
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -216,56 +216,30 @@ When you provide values.
|
|
216
216
|
## Configuration
|
217
217
|
|
218
218
|
Your application can configure Cieloz::Configuracao default values.
|
219
|
-
In a Rails application, it can be done in a config/initializers/cieloz.rb file.
|
220
219
|
|
221
|
-
If you don't provide ```credenciais```, all operations will be requested against Cielo Homologation Environment.
|
220
|
+
* If you don't provide ```credenciais```, all operations will be requested against Cielo Homologation Environment.
|
221
|
+
* When you go to production, you MUST configure ```credenciais``` with your Cielo ```numero``` and ```chave```.
|
222
222
|
|
223
|
-
|
223
|
+
General settings can be placed in ```config/application.rb```:
|
224
224
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
# must reload routes to initialize routes.url_helpers
|
229
|
-
reload_routes!
|
225
|
+
module MyStore
|
226
|
+
class Application < Rails::Application
|
227
|
+
# ...
|
230
228
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
# after the user types this Credit card data.
|
238
|
-
#
|
239
|
-
# NOTICE: In order to *_url methods to work, it's required to set
|
240
|
-
# in config/application.rb or in one of config/environment initializers:
|
241
|
-
#
|
242
|
-
# [Rails.application.]routes.default_url_options = { host: "HOSTNAME[:PORT]" }
|
243
|
-
#
|
244
|
-
c.url_retorno = routes.url_helpers.root_url
|
245
|
-
|
246
|
-
# Credit card data is asked to the user in a page hosted by Cielo. This is the default mode
|
247
|
-
# c.cielo_mode!
|
248
|
-
|
249
|
-
# Your application must provide a view asking credit card data, and provide additional security,
|
250
|
-
# in conformance with PCI Standards: http://www.cielo.com.br/portal/cielo/solucoes-de-tecnologia/o-que-e-ais.html
|
251
|
-
# c.store_mode!
|
252
|
-
|
253
|
-
# default to Cieloz::Homologacao::Credenciais::LOJA if store_mode? and ::CIELO if cielo_mode?
|
254
|
-
# c.credenciais = { numero: "", chave: "" }
|
255
|
-
|
256
|
-
# c.moeda = 986 # ISO 4217 - Manual Cielo, p 11
|
257
|
-
# c.idioma = "PT" # EN and ES available - language to Cielo use in this pages
|
229
|
+
Cieloz::Configuracao.tap do |c|
|
230
|
+
c.store_mode!
|
231
|
+
c.soft_descriptor = "My Store Descriptor"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
258
235
|
|
259
|
-
|
260
|
-
# c.max_parcelas = 3 # no additional interest rates
|
236
|
+
and settings specific per environment in respective config at ```config/environments``` directory.
|
261
237
|
|
262
|
-
|
263
|
-
# c.max_adm_parcelas = 10 # available with Cielo interest rate
|
238
|
+
If you configure your server with environment variables, ```config/environments/production.rb``` can configure Cieloz:
|
264
239
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
end
|
240
|
+
Cieloz::Configuracao.credenciais.tap do |c|
|
241
|
+
c.numero = ENV["MY_STORE_CIELO_NUMERO"]
|
242
|
+
c.chave = ENV["MY_STORE_CIELO_CHAVE"]
|
269
243
|
end
|
270
244
|
|
271
245
|
## Getting Started
|
data/cieloz.gemspec
CHANGED
@@ -39,7 +39,7 @@ class Cieloz::RequisicaoTransacao < Cieloz::Requisicao
|
|
39
39
|
# validates string values because false.blank? is true, failing presence validation
|
40
40
|
validates :capturar, inclusion: { in: ["true", "false"] }
|
41
41
|
|
42
|
-
with_options if:
|
42
|
+
with_options if: -> { @autorizar != AUTORIZACAO_DIRETA } do |txn|
|
43
43
|
txn.validates :url_retorno, presence: true
|
44
44
|
txn.validates :url_retorno, length: { maximum: 1024 }
|
45
45
|
end
|
@@ -19,18 +19,18 @@ class Cieloz::RequisicaoTransacao
|
|
19
19
|
validates :parcelas, numericality: {
|
20
20
|
only_integer: true, greater_than: 0,
|
21
21
|
less_than_or_equal_to: Cieloz::Configuracao.max_parcelas
|
22
|
-
}, if:
|
22
|
+
}, if: -> { produto == PARCELADO_LOJA }
|
23
23
|
|
24
24
|
validates :parcelas, numericality: {
|
25
25
|
only_integer: true,
|
26
26
|
greater_than: Cieloz::Configuracao.max_parcelas,
|
27
27
|
less_than_or_equal_to: Cieloz::Configuracao.max_adm_parcelas
|
28
|
-
}, if:
|
28
|
+
}, if: -> { produto == PARCELADO_ADM }
|
29
29
|
|
30
|
-
validates :bandeira, inclusion: { in: BANDEIRAS_DEBITO }, if:
|
31
|
-
validates :bandeira, inclusion: { in: Cieloz::Bandeiras::ALL }, if:
|
30
|
+
validates :bandeira, inclusion: { in: BANDEIRAS_DEBITO }, if: -> { @produto == DEBITO }
|
31
|
+
validates :bandeira, inclusion: { in: Cieloz::Bandeiras::ALL }, if: -> { @produto == CREDITO }
|
32
32
|
validates :bandeira, inclusion: { in: BANDEIRAS_PARCELAMENTO },
|
33
|
-
if:
|
33
|
+
if: -> { [ PARCELADO_LOJA, PARCELADO_ADM ].include? @produto }
|
34
34
|
|
35
35
|
|
36
36
|
def self.map_debito(source, opts={})
|
data/lib/cieloz/version.rb
CHANGED
data/test/minitest_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
describe Cieloz::Configuracao do
|
2
2
|
let(:_) { Cieloz::Configuracao }
|
3
|
-
let(:
|
3
|
+
let(:_hash) { { numero: 123, chave: "abc123" } }
|
4
4
|
|
5
5
|
before do
|
6
6
|
_.reset!
|
@@ -65,11 +65,11 @@ describe Cieloz::Configuracao do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "set" do
|
68
|
-
before { _.credenciais =
|
68
|
+
before { _.credenciais = _hash }
|
69
69
|
|
70
70
|
it "returns DadosEc with credenciais attributes" do
|
71
|
-
_.credenciais.numero.must_equal
|
72
|
-
_.credenciais.chave.must_equal
|
71
|
+
_.credenciais.numero.must_equal _hash[:numero]
|
72
|
+
_.credenciais.chave.must_equal _hash[:chave]
|
73
73
|
end
|
74
74
|
|
75
75
|
it "returns the same DadosEc in subsequent calls" do
|
@@ -84,7 +84,7 @@ describe Cieloz::Configuracao do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it "returns production host when credenciais is set" do
|
87
|
-
_.credenciais =
|
87
|
+
_.credenciais = _hash
|
88
88
|
_.host.must_equal Cieloz::Configuracao::HOST
|
89
89
|
end
|
90
90
|
end
|
metadata
CHANGED
@@ -1,125 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cieloz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fábio Luiz Nery de Miranda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activemodel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: turn
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: vcr
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: debugger
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '>='
|
108
|
+
- - ">="
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
description: A utility gem for Cielo Integration
|
@@ -129,7 +115,8 @@ executables: []
|
|
129
115
|
extensions: []
|
130
116
|
extra_rdoc_files: []
|
131
117
|
files:
|
132
|
-
- .gitignore
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
133
120
|
- Gemfile
|
134
121
|
- LICENSE.txt
|
135
122
|
- README.md
|
@@ -199,17 +186,17 @@ require_paths:
|
|
199
186
|
- lib
|
200
187
|
required_ruby_version: !ruby/object:Gem::Requirement
|
201
188
|
requirements:
|
202
|
-
- -
|
189
|
+
- - ">="
|
203
190
|
- !ruby/object:Gem::Version
|
204
191
|
version: '0'
|
205
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
193
|
requirements:
|
207
|
-
- -
|
194
|
+
- - ">="
|
208
195
|
- !ruby/object:Gem::Version
|
209
196
|
version: '0'
|
210
197
|
requirements: []
|
211
198
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.
|
199
|
+
rubygems_version: 2.2.2
|
213
200
|
signing_key:
|
214
201
|
specification_version: 4
|
215
202
|
summary: ''
|