bradesco_shopfacil 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d49cc7b3c8ba818c23a25a07a08fdbaae0aeb213bfc9194becaa9f9bf3b882a1
4
+ data.tar.gz: 3f108bba2194d7f05b639e53d5727922c24821fa537e3b089f2ae884e2d3c840
5
+ SHA512:
6
+ metadata.gz: 46a93c83596cf1d0b51af91847b641f9a0637cc1571298497ce20c6e67d81678b3ecaba2af1117f799ca493d6db2e1d2ecf80721df2112b64ad61072608fc953
7
+ data.tar.gz: 06dd03023d67c6112eb68ee8485f541bb3a03eaa0582aa3d7f15ad9b82c816bc7f60d85e610bcc689f1014f9d82c8d689e045c1c63190daedb2dc546fe073838
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # Editor directories and files
14
+ .idea
15
+ .vscode
16
+ *.suo
17
+ *.ntvs*
18
+ *.njsproj
19
+ *.sln
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at gilcier06@yahoo.com.br. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bradesco_shopfacil.gemspec
6
+ gemspec
7
+
8
+ gem 'rest-client'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 gilcierweb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,213 @@
1
+ # Bradesco ShopFácil
2
+
3
+ [![Build Status](https://travis-ci.org/gilcierweb/bradesco-shopfacil.svg?branch=master)](https://travis-ci.org/gilcierweb/bradesco-shopfacil)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/16d438fe3991af274cba/maintainability)](https://codeclimate.com/github/gilcierweb/bradesco-shopfacil/maintainability)
5
+ [![Gem Version](https://badge.fury.io/rb/bradesco_shopfacil.svg)](https://badge.fury.io/rb/bradesco_shopfacil)
6
+
7
+ MEIOS DE PAGAMENTO BRADESCO BOLETO BANCÁRIO
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'bradesco_shopfacil'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install bradesco_shopfacil
24
+
25
+ ### Doação / Donate
26
+ Doar com PagSeguro
27
+ https://pag.ae/bmgSGGm
28
+
29
+ [![](https://raw.github.com/gilcierweb/shopfacil/master/examples/image/clique-para-doar-qualquer-quantia.jpg)](https://pag.ae/bmgSGGm)
30
+
31
+ ### Consultoria / consulting
32
+
33
+ http://gilcierweb.com.br
34
+
35
+ ## Usage
36
+
37
+ ### Exemplo / Example
38
+
39
+ ```ruby
40
+
41
+ merchant_id = "90000"
42
+ security_key = "SUA CHAVE"
43
+
44
+ bradesco_shopfacil = BradescoShopfacil::Shopfacil.new(merchant_id, security_key)
45
+
46
+ bradesco_shopfacil.sandbox = true
47
+
48
+ bradesco_shopfacil.order_value = 15000
49
+ bradesco_shopfacil.order_number = "GilcierWeb_#{Time.now.strftime("%Y-%m-%d%H%M%S")}"
50
+ bradesco_shopfacil.order_description = 'Descritivo do pedido'
51
+
52
+ bradesco_shopfacil.buyer_name = "Nome do comprador/Pagador"
53
+ bradesco_shopfacil.buyer_document = "38604763007"
54
+ bradesco_shopfacil.buyer_http_user_agent = request.user_agent # optional
55
+
56
+ bradesco_shopfacil.buyer_address_zip_code = "02010700"
57
+ bradesco_shopfacil.buyer_address_patio = "Rua Domingos Sergio dos Anjos"
58
+ bradesco_shopfacil.buyer_address_number = "277"
59
+ bradesco_shopfacil.buyer_address_complement = ""
60
+ bradesco_shopfacil.buyer_address_neighborhood = "Jardim Santo Elias"
61
+ bradesco_shopfacil.buyer_address_city = "Sao Paulo"
62
+ bradesco_shopfacil.buyer_address_state = "SP"
63
+
64
+ bradesco_shopfacil.bank_slip_beneficiary = "GilcierWeb TI"
65
+ bradesco_shopfacil.bank_slip_wallet = '26'
66
+ bradesco_shopfacil.bank_slip_our_number = "99123456789"
67
+ bradesco_shopfacil.bank_slip_issue_date = Date.today
68
+ bradesco_shopfacil.bank_slip_due_date = "2018-06-30"
69
+ bradesco_shopfacil.bank_slip_value_title = 15000
70
+ bradesco_shopfacil.bank_slip_url_logo = "http://via.placeholder.com/120x80"
71
+ bradesco_shopfacil.bank_slip_header_message = "BRADESCO SHOPFACIL BOLETO BANCÁRIO"
72
+ bradesco_shopfacil.bank_slip_rendering_type = '2'
73
+
74
+ bradesco_shopfacil.bank_slip_instructions_line_1 = ""
75
+ bradesco_shopfacil.bank_slip_instructions_line_2 = ""
76
+ bradesco_shopfacil.bank_slip_instructions_line_3 = ""
77
+ bradesco_shopfacil.bank_slip_instructions_line_4 = ""
78
+ bradesco_shopfacil.bank_slip_instructions_line_5 = ""
79
+ bradesco_shopfacil.bank_slip_instructions_line_6 = ""
80
+ bradesco_shopfacil.bank_slip_instructions_line_7 = ""
81
+ bradesco_shopfacil.bank_slip_instructions_line_8 = ""
82
+ bradesco_shopfacil.bank_slip_instructions_line_9 = ""
83
+ bradesco_shopfacil.bank_slip_instructions_line_10 = ""
84
+ bradesco_shopfacil.bank_slip_instructions_line_11 = ""
85
+ bradesco_shopfacil.bank_slip_instructions_line_12 = ""
86
+
87
+ bradesco_shopfacil.token_request_confirmation_payment = "99999999999"
88
+
89
+ return_api = bradesco_shopfacil.data_service_request
90
+
91
+ return_api
92
+ ```
93
+
94
+ ### Example of Request (JSON)
95
+
96
+ ```json
97
+ {
98
+ "merchant_id": "90000",
99
+ "meio_pagamento": "300",
100
+ "pedido": {
101
+ "numero": "0-9_A-Z_.MAX-27-CH99",
102
+ "valor": 15000,
103
+ "descricao": "Descritivo do pedido"
104
+ },
105
+ "comprador": {
106
+ "nome": "Nome do comprador/sacado",
107
+ "documento": "38604763007",
108
+ "endereco": {
109
+ "cep": "02010700",
110
+ "logradouro": "Rua Domingos Sergio dos Anjos",
111
+ "numero": "277",
112
+ "complemento": "",
113
+ "bairro": "Jardim Santo Elias",
114
+ "cidade": "Sao Paulo",
115
+ "uf": "SP"
116
+ },
117
+ "ip": "IP do comprador",
118
+ "user_agent": "User agent/browser do comprador"
119
+ },
120
+ "boleto": {
121
+ "beneficiario": "Scopus",
122
+ "carteira": "25",
123
+ "nosso_numero": "99123456789",
124
+ "data_emissao": "2016-03-01",
125
+ "data_vencimento": "2016-03-05",
126
+ "valor_titulo": 15000,
127
+ "url_logotipo": "http://via.placeholder.com/120x80",
128
+ "mensagem_cabecalho": "mensagem de cabecalho",
129
+ "tipo_renderizacao": "2",
130
+ "instrucoes": {
131
+ "instrucao_linha_1": "instrucao 01",
132
+ "instrucao_linha_2": "instrucao 02",
133
+ "instrucao_linha_3": "instrucao 03"
134
+ },
135
+ "registro": {
136
+ "agencia_pagador": "00014",
137
+ "razao_conta_pagador": "07050",
138
+ "conta_pagador": "12345679",
139
+ "controle_participante": "Segurança arquivo remessa",
140
+ "aplicar_multa": true,
141
+ "valor_percentual_multa": 1000,
142
+ "valor_desconto_bonificacao": 1200,
143
+ "debito_automatico": false,
144
+ "rateio_credito": false,
145
+ "endereco_debito_automatico": "1",
146
+ "tipo_ocorrencia": "02",
147
+ "especie_titulo": "01",
148
+ "primeira_instrucao": "00",
149
+ "segunda_instrucao": "00",
150
+ "valor_juros_mora": 1000,
151
+ "data_limite_concessao_desconto": "2016-03-07",
152
+ "valor_desconto": 200,
153
+ "valor_iof": 0,
154
+ "valor_abatimento": 0,
155
+ "tipo_inscricao_pagador": "01",
156
+ "sequencia_registro": "00001"
157
+ }
158
+ },
159
+ "token_request_confirmacao_pagamento": "21323dsd23434ad12178DDasY"
160
+ }
161
+ ```
162
+
163
+ ### Example of Response (JSON)
164
+
165
+ ```json
166
+ {
167
+ "merchant_id": "90000",
168
+ "meio_pagamento": "800",
169
+ "pedido": {
170
+ "numero": "0-9_A-Z_.MAX-27-CH99",
171
+ "valor": 15000,
172
+ "descricao": "Descritivo do pedido"
173
+ },
174
+ "boleto": {
175
+ "valor_titulo": 15000,
176
+ "data_geracao": "2016-04-22T08:10:43",
177
+ "data_atualizacao": null,
178
+ "linha_digitavel": "23790000255123456789223000000002867240000015000",
179
+ "linha_digitavel_formatada": "23790.00025 51234.567892 23000.000002 8 67240000015000",
180
+ "token":"c3ZtRGVKRDFoUlRESmxRNnhKQnpJalFrb0VueXdVdUxnT2FVMG45cm1qMFMyRDcwRWZ0cFVBS0o0\nMFAxOHY0aTdJK3E1MXVjUVJjNEpBdUxvcE15T1E9PQ==",
181
+ "url_acesso": "http://localhost:9080/boleto/titulo?token=c3ZtRGVKRDFoUlRESmxRNnhKQnpJalFrb0VueXdVdUxnT2FVMG45cm1qMFMyRDcwRWZ0cFVBS0o0\nMFAxOHY0aTdJK3E1MXVjUVJjNEpBdUxvcE15T1E9PQ=="
182
+ },
183
+ "status": {
184
+ "codigo": 0,
185
+ "mensagem": "OPERACAO REALIZADA COM SUCESSO",
186
+ "detalhes": null
187
+ }
188
+ }
189
+ ```
190
+ ### URL Manual
191
+
192
+ https://homolog.meiosdepagamentobradesco.com.br/manual/Manual_BoletoBancario.pdf
193
+
194
+ ### URL Manual Consultas de Pedidos
195
+
196
+ https://homolog.meiosdepagamentobradesco.com.br/manual/Manual_ConsultaPedidos.pdf
197
+
198
+ ### Site
199
+
200
+ http://gilcierweb.com.br
201
+
202
+ ## Contributing
203
+
204
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bradesco-shopfacil. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
205
+
206
+ ## License
207
+
208
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
209
+
210
+ ## Code of Conduct
211
+
212
+ Everyone interacting in the BradescoShopfacil project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bradesco_shopfacil/blob/master/CODE_OF_CONDUCT.md).
213
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bradesco_shopfacil"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,38 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "bradesco_shopfacil/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bradesco_shopfacil"
8
+ spec.version = BradescoShopfacil::VERSION
9
+ spec.authors = ["gilcierweb"]
10
+ spec.email = ["gilcier06@yahoo.com.br"]
11
+
12
+ spec.summary = "Bradesco ShopFácil - Meios de Pagamento Bradesco Boleto Bancário"
13
+ spec.description = "Bradesco ShopFácil - Meios de Pagamento Bradesco Boleto Bancário"
14
+ spec.homepage = "https://github.com/gilcierweb/bradesco-shopfacil"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_development_dependency "bundler", "~> 1.16"
36
+ spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency "rspec", "~> 3.0"
38
+ end
@@ -0,0 +1,85 @@
1
+ require 'base64'
2
+ require 'rest-client'
3
+
4
+ require 'bradesco_shopfacil/version'
5
+ require 'bradesco_shopfacil/buyer'
6
+ require 'bradesco_shopfacil/buyer_address'
7
+ require 'bradesco_shopfacil/bank_slip'
8
+ require 'bradesco_shopfacil/bank_slip_instructions'
9
+ require 'bradesco_shopfacil/order'
10
+
11
+ module BradescoShopfacil
12
+
13
+ class Shopfacil
14
+
15
+ include Order, Buyer, BankSlip
16
+
17
+ attr_accessor :media_type, :charset, :sandbox, :token_request_confirmation_payment
18
+
19
+ URL_HOMOLOGACAO = 'https://homolog.meiosdepagamentobradesco.com.br'
20
+ URL_PRODUCAO = 'https://meiosdepagamentobradesco.com.br'
21
+
22
+ def media_type
23
+ @media_type ||= 'application/json'
24
+ end
25
+
26
+ def charset
27
+ @charset ||= 'UTF-8'
28
+ end
29
+
30
+ def sandbox
31
+ @sandbox ||= false
32
+ end
33
+
34
+ def initialize(merchant_id, security_key)
35
+ @merchant_id = merchant_id
36
+ @security_key = security_key
37
+ end
38
+
39
+ def data_service_request
40
+
41
+ service_request = {
42
+ "merchant_id" => @merchant_id,
43
+ "meio_pagamento" => "300",
44
+ "pedido" => data_service_order,
45
+ "comprador" => data_service_buyer,
46
+ "boleto" => data_service_bank_slip,
47
+ "token_request_confirmacao_pagamento" => token_request_confirmation_payment
48
+ }
49
+ service_request
50
+
51
+ send_data('/apiboleto/transacao', service_request)
52
+
53
+ end
54
+
55
+ def send_data(params_url, params_data = nil)
56
+
57
+ if sandbox
58
+ url_bradesco = URL_HOMOLOGACAO
59
+ else
60
+ url_bradesco = URL_PRODUCAO
61
+ end
62
+
63
+ url = "#{url_bradesco}#{params_url}"
64
+
65
+ authorization_header = "#{@merchant_id}:#{@security_key}"
66
+ authorization_header_base64 = Base64.encode64(authorization_header)
67
+
68
+ headers = {
69
+ accept: media_type,
70
+ accept_charset: charset,
71
+ accept_encoding: media_type,
72
+ # content_type: :json,
73
+ content_type: "#{media_type};charset=#{charset}",
74
+ Authorization: " Basic #{authorization_header_base64}"
75
+ }
76
+
77
+ response = RestClient.post url, params_data.to_json, headers
78
+
79
+ response.body
80
+
81
+ end
82
+
83
+ end
84
+
85
+ end
@@ -0,0 +1,39 @@
1
+ require_relative 'bank_slip_instructions'
2
+
3
+ module BradescoShopfacil
4
+
5
+ module BankSlip
6
+
7
+ include BankSlipInstructions
8
+
9
+ attr_accessor :bank_slip_beneficiary,
10
+ :bank_slip_wallet,
11
+ :bank_slip_our_number,
12
+ :bank_slip_issue_date,
13
+ :bank_slip_due_date,
14
+ :bank_slip_value_title,
15
+ :bank_slip_url_logo,
16
+ :bank_slip_header_message,
17
+ :bank_slip_rendering_type,
18
+ :data_service_bank_slip_register
19
+
20
+ def data_service_bank_slip
21
+ bank_slip = {
22
+ "beneficiario" => bank_slip_beneficiary,
23
+ "carteira" => bank_slip_wallet,
24
+ "nosso_numero" => bank_slip_our_number,
25
+ "data_emissao" => bank_slip_issue_date,
26
+ "data_vencimento" => bank_slip_due_date,
27
+ "valor_titulo" => bank_slip_value_title,
28
+ "url_logotipo" => bank_slip_url_logo,
29
+ "mensagem_cabecalho" => bank_slip_header_message,
30
+ "tipo_renderizacao" => bank_slip_rendering_type,
31
+ "instrucoes" => data_service_bank_slip_instructions,
32
+ "registro" => data_service_bank_slip_register
33
+ }
34
+ bank_slip
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,38 @@
1
+ module BradescoShopfacil
2
+
3
+ module BankSlipInstructions
4
+
5
+ attr_accessor :bank_slip_instructions_line_1,
6
+ :bank_slip_instructions_line_2,
7
+ :bank_slip_instructions_line_3,
8
+ :bank_slip_instructions_line_4,
9
+ :bank_slip_instructions_line_5,
10
+ :bank_slip_instructions_line_6,
11
+ :bank_slip_instructions_line_7,
12
+ :bank_slip_instructions_line_8,
13
+ :bank_slip_instructions_line_9,
14
+ :bank_slip_instructions_line_10,
15
+ :bank_slip_instructions_line_11,
16
+ :bank_slip_instructions_line_12
17
+
18
+ def data_service_bank_slip_instructions
19
+ bank_slip_instructions = {
20
+ "instrucao_linha_1" => bank_slip_instructions_line_1,
21
+ "instrucao_linha_2" => bank_slip_instructions_line_2,
22
+ "instrucao_linha_3" => bank_slip_instructions_line_3,
23
+ "instrucao_linha_4" => bank_slip_instructions_line_4,
24
+ "instrucao_linha_5" => bank_slip_instructions_line_5,
25
+ "instrucao_linha_6" => bank_slip_instructions_line_6,
26
+ "instrucao_linha_7" => bank_slip_instructions_line_7,
27
+ "instrucao_linha_8" => bank_slip_instructions_line_8,
28
+ "instrucao_linha_9" => bank_slip_instructions_line_9,
29
+ "instrucao_linha_10" => bank_slip_instructions_line_10,
30
+ "instrucao_linha_11" => bank_slip_instructions_line_11,
31
+ "instrucao_linha_12" => bank_slip_instructions_line_12
32
+ }
33
+ bank_slip_instructions
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,38 @@
1
+ require 'socket'
2
+ require 'rest-client'
3
+
4
+ require_relative 'buyer_address'
5
+
6
+ module BradescoShopfacil
7
+
8
+ module Buyer
9
+
10
+ include BuyerAddress
11
+
12
+ attr_accessor :buyer_name, :buyer_document, :buyer_http_user_agent
13
+
14
+ def data_service_buyer
15
+ buyer = {
16
+ "nome" => buyer_name,
17
+ "documento" => buyer_document,
18
+ "endereco" => data_service_buyer_address,
19
+ "ip" => get_ip,
20
+ "user_agent" => get_http_user_agent
21
+ }
22
+ buyer
23
+ end
24
+
25
+ private
26
+
27
+ def get_ip
28
+ ip_address = Socket.ip_address_list
29
+ ip_address[0]
30
+ end
31
+
32
+ def get_http_user_agent
33
+ !buyer_http_user_agent.nil? ? buyer_http_user_agent : RestClient::Platform.default_user_agent
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,27 @@
1
+ module BradescoShopfacil
2
+
3
+ module BuyerAddress
4
+
5
+ attr_accessor :buyer_address_zip_code,
6
+ :buyer_address_patio,
7
+ :buyer_address_number,
8
+ :buyer_address_complement,
9
+ :buyer_address_neighborhood,
10
+ :buyer_address_city,
11
+ :buyer_address_state
12
+
13
+ def data_service_buyer_address
14
+ buyer_address = {
15
+ "cep" => buyer_address_zip_code,
16
+ "logradouro" => buyer_address_patio,
17
+ "numero" => buyer_address_number,
18
+ "complemento" => buyer_address_complement,
19
+ "bairro" => buyer_address_neighborhood,
20
+ "cidade" => buyer_address_city,
21
+ "uf" => buyer_address_state
22
+ }
23
+ buyer_address
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,18 @@
1
+ module BradescoShopfacil
2
+
3
+ module Order
4
+
5
+ attr_accessor :order_number, :order_value, :order_description
6
+
7
+ def data_service_order
8
+ order = {
9
+ "numero" => order_number,
10
+ "valor" => order_value,
11
+ "descricao" => order_description
12
+ }
13
+ order
14
+ end
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,13 @@
1
+ require 'rest-client'
2
+
3
+ module BradescoShopfacil
4
+
5
+ module ServiceRequest
6
+
7
+ def request
8
+ # RestClient.post()
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,3 @@
1
+ module BradescoShopfacil
2
+ VERSION = "0.1.1"
3
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bradesco_shopfacil
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - gilcierweb
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-06-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Bradesco ShopFácil - Meios de Pagamento Bradesco Boleto Bancário
56
+ email:
57
+ - gilcier06@yahoo.com.br
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - bradesco_shopfacil.gemspec
73
+ - lib/bradesco_shopfacil.rb
74
+ - lib/bradesco_shopfacil/bank_slip.rb
75
+ - lib/bradesco_shopfacil/bank_slip_instructions.rb
76
+ - lib/bradesco_shopfacil/buyer.rb
77
+ - lib/bradesco_shopfacil/buyer_address.rb
78
+ - lib/bradesco_shopfacil/order.rb
79
+ - lib/bradesco_shopfacil/service_request.rb
80
+ - lib/bradesco_shopfacil/version.rb
81
+ homepage: https://github.com/gilcierweb/bradesco-shopfacil
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.7.7
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Bradesco ShopFácil - Meios de Pagamento Bradesco Boleto Bancário
105
+ test_files: []