sigep_web 0.2.6.3 → 1.0.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 +5 -5
- data/.github/workflows/test.yml +44 -0
- data/.gitignore +5 -3
- data/Gemfile +1 -2
- data/LICENSE +1 -1
- data/LICENSE.txt +5 -7
- data/README.md +120 -29
- data/Rakefile +3 -3
- data/lib/sigep_web/calculate_digit_checker.rb +22 -18
- data/lib/sigep_web/configuration.rb +5 -3
- data/lib/sigep_web/generate_labels_digit_verifier.rb +19 -18
- data/lib/sigep_web/models/additional_service.rb +14 -0
- data/lib/sigep_web/models/dimension_object.rb +17 -0
- data/lib/sigep_web/models/postal_object.rb +26 -0
- data/lib/sigep_web/models/receiver.rb +35 -0
- data/lib/sigep_web/{Models → models}/sender.rb +5 -3
- data/lib/sigep_web/postage_card_status.rb +15 -18
- data/lib/sigep_web/request_labels.rb +43 -43
- data/lib/sigep_web/request_plp_services.rb +24 -24
- data/lib/sigep_web/request_range.rb +27 -23
- data/lib/sigep_web/request_xml_plp.rb +17 -18
- data/lib/sigep_web/search_client.rb +21 -20
- data/lib/sigep_web/service_availability.rb +25 -24
- data/lib/sigep_web/version.rb +3 -1
- data/lib/sigep_web/web_service_interface_api.rb +15 -11
- data/lib/sigep_web/web_service_reverse_logistic_api.rb +11 -8
- data/lib/sigep_web/xml/additional_service.rb +26 -0
- data/lib/sigep_web/{XML → xml}/dimension_object.rb +3 -1
- data/lib/sigep_web/xml/postal_object.rb +51 -0
- data/lib/sigep_web/{XML → xml}/receiver.rb +2 -0
- data/lib/sigep_web/zip_query.rb +15 -16
- data/lib/sigep_web.rb +26 -26
- data/sigep_web.gemspec +36 -34
- metadata +127 -41
- data/.codeclimate.yml +0 -28
- data/.rubocop.yml +0 -1156
- data/.travis.yml +0 -4
- data/Gemfile.lock +0 -63
- data/lib/sigep_web/Models/additional_service.rb +0 -12
- data/lib/sigep_web/Models/dimension_object.rb +0 -15
- data/lib/sigep_web/Models/postal_object.rb +0 -21
- data/lib/sigep_web/Models/receiver.rb +0 -33
- data/lib/sigep_web/XML/additional_service.rb +0 -24
- data/lib/sigep_web/XML/postal_object.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b15f2b5e8823b2fa0e3ddcd82f81f69bc851aedf5e185fbfd1acc23d8889ed20
|
4
|
+
data.tar.gz: d5a55f1d63603da8d81f454f1b6bd740aff804e0206687b58b14fab68c19907a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccd0a77f6254a8d9adc8987f88fe2c65fe4c35d77fa5ac882d409f2aadb7a9a29d47a73594497cb26d75a0b0ede4150c1442f492d35ee2c4e4fd6f8108872649
|
7
|
+
data.tar.gz: 1ba66ee5c968725d9e90e320de07f98db2e34fb9d6a8dfb4e3ab0d38508d1fdbde9b23767ffc9853f268d48272df57cb93b0fc24e58e50471cf92c43e50a9a1d
|
@@ -0,0 +1,44 @@
|
|
1
|
+
name: gha-workflow-test
|
2
|
+
on: [push, pull_request]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
gha-job-lint:
|
6
|
+
name: Lint
|
7
|
+
runs-on: ubuntu-18.04
|
8
|
+
steps:
|
9
|
+
- name: Checkout source
|
10
|
+
uses: actions/checkout@v2
|
11
|
+
- name: Setup ruby
|
12
|
+
uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: '2.6'
|
15
|
+
- name: Bundle
|
16
|
+
run: |
|
17
|
+
gem install bundler
|
18
|
+
bundle install --jobs 4 --retry 3
|
19
|
+
- name: Lint
|
20
|
+
run: bundle exec standardrb
|
21
|
+
|
22
|
+
# The test job is a matrix of ruby/rails versions.
|
23
|
+
gha-job-test:
|
24
|
+
name: Ruby ${{ matrix.ruby }}
|
25
|
+
runs-on: ubuntu-18.04
|
26
|
+
strategy:
|
27
|
+
matrix:
|
28
|
+
ruby: [ '2.6', '2.7', '3.0', '3.1' ]
|
29
|
+
steps:
|
30
|
+
- name: Checkout source
|
31
|
+
uses: actions/checkout@v2
|
32
|
+
- name: Setup ruby
|
33
|
+
uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
36
|
+
bundler-cache: true
|
37
|
+
|
38
|
+
- name: Test
|
39
|
+
run: bundle exec rspec
|
40
|
+
|
41
|
+
- name: Coverage
|
42
|
+
uses: coverallsapp/github-action@master
|
43
|
+
with:
|
44
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
data/.gitignore
CHANGED
@@ -27,9 +27,11 @@ build/
|
|
27
27
|
|
28
28
|
# for a library or gem, you might want to ignore these files since the code is
|
29
29
|
# intended to run in multiple environments; otherwise, check them in:
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
Gemfile.lock
|
31
|
+
.ruby-version
|
32
|
+
.ruby-gemset
|
33
|
+
.tool-versions
|
33
34
|
|
34
35
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
36
|
.rvmrc
|
37
|
+
.coverwalls.yml
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2018 Marcelo Perini Veloso
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/LICENSE.txt
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
4
|
-
|
5
|
-
|
3
|
+
Copyright (c) 2018 Marcelo Perini Veloso
|
6
4
|
|
7
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -11,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
9
|
copies of the Software, and to permit persons to whom the Software is
|
12
10
|
furnished to do so, subject to the following conditions:
|
13
11
|
|
14
|
-
The above copyright notice and this permission notice shall be included in
|
15
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
16
14
|
|
17
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# Sigep Web
|
2
2
|
|
3
|
-
|
3
|
+

|
4
4
|
[](https://badge.fury.io/rb/sigep_web)
|
5
|
-
[](https://coveralls.io/github/marceloperini/sigep_web?branch=master)
|
6
|
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DWFWT6N2YCZTG)
|
6
7
|
|
7
8
|
## About
|
8
9
|
|
9
|
-
This gem provide a easy way to integrate an application to Correios Sigep Web API, all features is based on this API documentation
|
10
|
+
This gem provide a easy way to integrate an application to Correios Sigep Web API, all features is based on this [API documentation](https://www2.correios.com.br/sistemas/encomendas/sigepweb/doc/Manual_de_Implementacao_do_Web_Service_SIGEP_WEB.pdf)
|
10
11
|
|
11
12
|
## Getting started
|
12
13
|
|
@@ -37,43 +38,47 @@ end
|
|
37
38
|
```
|
38
39
|
### How It Works
|
39
40
|
|
40
|
-
####
|
41
|
+
#### Consulting service availability
|
41
42
|
|
42
43
|
This check whether a particular service is available from source zip code to target zip code.
|
43
44
|
|
44
45
|
``` ruby
|
45
|
-
SigepWeb.service_availability(service_number: '40215',
|
46
|
+
SigepWeb.service_availability(service_number: '40215',
|
47
|
+
source_zip: '70002900',
|
48
|
+
target_zip: '74730490')
|
46
49
|
```
|
47
50
|
|
48
51
|
This method will return a hash like this if has a success response, the second attribute indicate if a particular service is available.
|
49
52
|
|
50
53
|
``` ruby
|
51
|
-
{ :
|
54
|
+
{ success: true, response: true }
|
52
55
|
```
|
53
56
|
|
54
57
|
#### Search Client
|
58
|
+
|
55
59
|
This method return the available services of specific post card
|
56
60
|
|
57
61
|
``` ruby
|
58
|
-
SigepWeb.search_client(id_contract: "0000000000",
|
62
|
+
SigepWeb.search_client(id_contract: "0000000000",
|
63
|
+
id_post_card: "0000000000")
|
59
64
|
```
|
60
65
|
|
61
66
|
The method will return something like this
|
62
67
|
|
63
68
|
``` ruby
|
64
69
|
{
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
70
|
+
success: true,
|
71
|
+
response: {
|
72
|
+
cnpj: '0000000000',
|
73
|
+
contratos: {
|
74
|
+
cartoes_postage: {
|
75
|
+
codigo_administrativo: '000000000',
|
76
|
+
numero: '000000000',
|
77
|
+
servicos: [
|
73
78
|
{
|
74
|
-
:
|
75
|
-
:
|
76
|
-
:
|
79
|
+
codigo: '40096',
|
80
|
+
descricao: 'SEDEX - CONTRATO',
|
81
|
+
id: '104625'
|
77
82
|
},
|
78
83
|
...
|
79
84
|
]
|
@@ -84,6 +89,7 @@ The method will return something like this
|
|
84
89
|
```
|
85
90
|
|
86
91
|
#### Zip Query
|
92
|
+
|
87
93
|
This method return the address based on zip code
|
88
94
|
|
89
95
|
``` ruby
|
@@ -94,22 +100,107 @@ This method will return a hash like this
|
|
94
100
|
|
95
101
|
``` ruby
|
96
102
|
{
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
103
|
+
success: true,
|
104
|
+
response: {
|
105
|
+
bairro: 'Asa Norte',
|
106
|
+
cep: '70002900',
|
107
|
+
cidade: 'Brasília',
|
108
|
+
complemento: nil,
|
109
|
+
complemento2: nil,
|
110
|
+
end: 'SBN Quadra 1 Bloco A',
|
111
|
+
id: '0',
|
112
|
+
uf: 'DF'
|
107
113
|
}
|
108
114
|
}
|
109
115
|
```
|
110
116
|
|
111
117
|
#### Request Labels For Posts
|
118
|
+
|
112
119
|
Return one label or a range of labels to use for posts
|
120
|
+
|
113
121
|
``` ruby
|
114
|
-
SigepWeb.request_labels(receiver_type:
|
122
|
+
SigepWeb.request_labels(receiver_type: 'C', identifier: '00000000000000',
|
123
|
+
id_service: '104625', qt_labels: 1)
|
124
|
+
```
|
125
|
+
|
126
|
+
return:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
{ success: true, response: ['DL61145929 BR'] }
|
130
|
+
```
|
131
|
+
|
132
|
+
#### Request verifying digit
|
133
|
+
|
134
|
+
to generate the verifying digit for a specific label use:
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
SigepWeb.generate_labels_digit_verifier(labels: 'DL61145929 BR')
|
138
|
+
```
|
139
|
+
|
140
|
+
return:
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
{ success: true, response: 6 }
|
144
|
+
```
|
145
|
+
|
146
|
+
#### Create receiver structure
|
147
|
+
|
148
|
+
use the _SigepWeb::Models::Receiver_ to create receiver structure:
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
SigepWeb::Models::Receiver.new(name: 'Josefina', email: 'josefina@foo.com',
|
152
|
+
number: '10', address: 'Rua X',
|
153
|
+
complement: 'Perto da rua X+1',
|
154
|
+
neighborhood: 'Bairro X-1',
|
155
|
+
city: 'Cidade Y', uf: 'SP', amount: '0,0',
|
156
|
+
cep: '04105-070')
|
157
|
+
```
|
158
|
+
#### Create post object dimensions
|
159
|
+
|
160
|
+
use the _SigepWeb::Models::DimensionObject_ to create object dimensions:
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
SigepWeb::Models::DimensionObject.new(object_type: '002', height: '20',
|
164
|
+
width: '30', length: '38',
|
165
|
+
diameter: '0')
|
166
|
+
```
|
167
|
+
|
168
|
+
* object_type: use 001 to letter envelope, 002 to package/ box and 003 to roll/ cylinder
|
169
|
+
|
170
|
+
#### Create post object
|
171
|
+
|
172
|
+
use the _SigepWeb::Models::PostalObject_ to create post object:
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
SigepWeb::Models::PostalObject.new(label_number: 'DL611459296BR',
|
176
|
+
postage_code_service: '40096',
|
177
|
+
cubage: 0.0, weight: '400',
|
178
|
+
receiver: receiver,
|
179
|
+
dimension_object: dimension_object,
|
180
|
+
processing_status: '0')
|
181
|
+
```
|
182
|
+
|
183
|
+
* label_number: tracking code with verifying digit
|
184
|
+
* postage_code: service code to use (SEDEX, PAC, etc.), for this example was used SEDEX, to get all available codes use _SigepWeb.search_client_
|
185
|
+
* receiver: object instance of _SigepWeb::Models::Receiver_ class
|
186
|
+
* dimension_object: object instance of _SigepWeb::Models::DimensionObject_ class
|
187
|
+
* processing_status: default value is '0'
|
188
|
+
|
189
|
+
#### Create sender
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
SigepWeb::Models::Sender.new(directorship_number: '16', name: 'Loja X',
|
193
|
+
address: 'Rua X', number: '10',
|
194
|
+
complement: 'perto da rua X+1',
|
195
|
+
neighborhood: 'Bairro Y',
|
196
|
+
zip_code: '7400000', city: 'Goiânia',
|
197
|
+
uf: 'GO', email: 'contato@loja_x.com.br',
|
198
|
+
postal_objects: postal_objects)
|
199
|
+
```
|
200
|
+
|
201
|
+
#### Submit the plp
|
202
|
+
|
203
|
+
```ruby
|
204
|
+
SigepWeb.request_plp_services(plp: sender, id_plp_client: 00_000_000,
|
205
|
+
labels: labels)
|
115
206
|
```
|
data/Rakefile
CHANGED
@@ -1,31 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SigepWeb
|
2
4
|
class CalculateDigitChecker < WebServiceReverseLogisticApi
|
3
|
-
def initialize(
|
4
|
-
@number =
|
5
|
+
def initialize(number:)
|
6
|
+
@number = number
|
7
|
+
|
5
8
|
super()
|
6
9
|
end
|
7
10
|
|
8
11
|
def request
|
9
12
|
authenticate = SigepWeb.configuration.authenticate
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
response = process(
|
15
|
+
:calcular_digito_verificador,
|
16
|
+
usuario: authenticate.user,
|
17
|
+
senha: authenticate.password,
|
18
|
+
codAdministrativo: authenticate.administrative_code,
|
19
|
+
numero: number
|
20
|
+
).to_hash[:calcular_digito_verificador_response][:return]
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
rescue Savon::SOAPFault => msg
|
24
|
-
{
|
25
|
-
success: false,
|
26
|
-
error: msg
|
27
|
-
}
|
22
|
+
if response[:cod_erro] == "0"
|
23
|
+
{success: true, response: response}
|
24
|
+
else
|
25
|
+
{success: false, error: response}
|
28
26
|
end
|
27
|
+
rescue Savon::SOAPFault => exception
|
28
|
+
{success: false, error: exception.message}
|
29
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
attr_reader :number
|
30
34
|
end
|
31
35
|
end
|
@@ -5,9 +5,11 @@ module SigepWeb
|
|
5
5
|
|
6
6
|
def authenticate
|
7
7
|
@authenticate ||=
|
8
|
-
Authenticate.new(
|
9
|
-
|
10
|
-
|
8
|
+
Authenticate.new(
|
9
|
+
user: user, password: password,
|
10
|
+
administrative_code: administrative_code,
|
11
|
+
contract: contract, card: card
|
12
|
+
)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,29 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SigepWeb
|
2
4
|
class GenerateLabelsDigitVerifier < WebServiceInterfaceApi
|
3
|
-
def initialize(
|
4
|
-
@labels =
|
5
|
+
def initialize(labels:)
|
6
|
+
@labels = labels
|
7
|
+
|
5
8
|
super()
|
6
9
|
end
|
7
10
|
|
8
11
|
def request
|
9
12
|
authenticate = SigepWeb.configuration.authenticate
|
10
|
-
begin
|
11
|
-
response = process(:gera_digito_verificador_etiquetas, {
|
12
|
-
etiquetas: @labels,
|
13
|
-
usuario: authenticate.user,
|
14
|
-
senha: authenticate.password
|
15
|
-
}).to_hash[:gera_digito_verificador_etiquetas_response][:return]
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
response = process(
|
15
|
+
:gera_digito_verificador_etiquetas,
|
16
|
+
etiquetas: labels,
|
17
|
+
usuario: authenticate.user,
|
18
|
+
senha: authenticate.password
|
19
|
+
).to_hash[:gera_digito_verificador_etiquetas_response][:return]
|
20
|
+
|
21
|
+
{success: true, response: response}
|
22
|
+
rescue Savon::SOAPFault => e
|
23
|
+
{success: false, error: e.message}
|
27
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :labels
|
28
29
|
end
|
29
30
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SigepWeb
|
4
|
+
module Models
|
5
|
+
class AdditionalService
|
6
|
+
attr_accessor :codes, :declareted_value
|
7
|
+
|
8
|
+
def initialize(codes:, declareted_value:)
|
9
|
+
@codes = codes
|
10
|
+
@declareted_value = declareted_value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SigepWeb
|
4
|
+
module Models
|
5
|
+
class DimensionObject
|
6
|
+
attr_accessor :object_type, :height, :width, :length, :diameter
|
7
|
+
|
8
|
+
def initialize(object_type:, height:, width:, length:, diameter:)
|
9
|
+
@object_type = object_type
|
10
|
+
@height = height
|
11
|
+
@width = width
|
12
|
+
@length = length
|
13
|
+
@diameter = diameter
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SigepWeb
|
4
|
+
module Models
|
5
|
+
class PostalObject
|
6
|
+
attr_accessor :label_number, :postage_code_service, :cubage,
|
7
|
+
:weight, :receiver, :dimension_object, :processing_status,
|
8
|
+
:additional_service_codes, :additional_services_declared_value
|
9
|
+
|
10
|
+
def initialize(label_number:, postage_code_service:, cubage:, weight:,
|
11
|
+
receiver:, dimension_object:, processing_status:,
|
12
|
+
additional_service_codes: nil, additional_services_declared_value: nil)
|
13
|
+
|
14
|
+
@label_number = label_number
|
15
|
+
@postage_code_service = postage_code_service
|
16
|
+
@cubage = cubage
|
17
|
+
@weight = weight
|
18
|
+
@receiver = receiver
|
19
|
+
@dimension_object = dimension_object
|
20
|
+
@processing_status = processing_status
|
21
|
+
@additional_service_codes = additional_service_codes
|
22
|
+
@additional_services_declared_value = additional_services_declared_value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SigepWeb
|
4
|
+
module Models
|
5
|
+
class Receiver
|
6
|
+
attr_accessor :name, :phone, :cellphone, :email, :address,
|
7
|
+
:complement, :neighborhood, :city, :uf, :cep, :number,
|
8
|
+
:user_postal_code, :cost_center_client, :invoice_number,
|
9
|
+
:invoice_serie, :invoice_value, :invoice_nature,
|
10
|
+
:description_object, :amount
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
@name = options[:name]
|
14
|
+
@phone = options[:phone]
|
15
|
+
@cellphone = options[:cellphone]
|
16
|
+
@email = options[:email]
|
17
|
+
@address = options[:address]
|
18
|
+
@complement = options[:complement]
|
19
|
+
@number = options[:number]
|
20
|
+
@neighborhood = options[:neighborhood]
|
21
|
+
@city = options[:city]
|
22
|
+
@uf = options[:uf]
|
23
|
+
@cep = options[:cep]
|
24
|
+
@user_postal_code = options[:user_postal_code]
|
25
|
+
@cost_center_client = options[:cost_center_client]
|
26
|
+
@invoice_number = options[:invoice_number]
|
27
|
+
@invoice_serie = options[:invoice_serie]
|
28
|
+
@invoice_value = options[:invoice_value]
|
29
|
+
@invoice_nature = options[:invoice_nature]
|
30
|
+
@description_object = options[:description_object]
|
31
|
+
@amount = options[:amount]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SigepWeb
|
2
4
|
module Models
|
3
5
|
class Sender
|
@@ -24,10 +26,10 @@ module SigepWeb
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def to_xml
|
27
|
-
builder = Nokogiri::XML::Builder.new(encoding:
|
29
|
+
builder = Nokogiri::XML::Builder.new(encoding: "ISO-8859-1") do |xml|
|
28
30
|
xml.correioslog do
|
29
|
-
xml.tipo_arquivo
|
30
|
-
xml.versao_arquivo
|
31
|
+
xml.tipo_arquivo "Postagem"
|
32
|
+
xml.versao_arquivo "2.3"
|
31
33
|
plp_xml(xml)
|
32
34
|
receiver_xml(xml)
|
33
35
|
xml.forma_pagamento @payment_form
|
@@ -1,29 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SigepWeb
|
2
4
|
class PostageCardStatus < WebServiceInterfaceApi
|
3
|
-
def initialize(
|
4
|
-
@postage_number_card =
|
5
|
+
def initialize(postage_number_card:)
|
6
|
+
@postage_number_card = postage_number_card
|
7
|
+
|
5
8
|
super()
|
6
9
|
end
|
7
10
|
|
8
11
|
def request
|
9
12
|
authenticate = SigepWeb.configuration.authenticate
|
10
|
-
begin
|
11
|
-
response = process(:get_status_cartao_postagem, {
|
12
|
-
numeroCartaoPostagem: @postage_number_card,
|
13
|
-
usuario: authenticate.user,
|
14
|
-
senha: authenticate.password
|
15
|
-
}).to_hash[:get_status_cartao_postagem_response][:return]
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
response = process(
|
15
|
+
:get_status_cartao_postagem,
|
16
|
+
numeroCartaoPostagem: @postage_number_card,
|
17
|
+
usuario: authenticate.user,
|
18
|
+
senha: authenticate.password
|
19
|
+
).to_hash[:get_status_cartao_postagem_response][:return]
|
20
|
+
|
21
|
+
{success: true, response: response}
|
22
|
+
rescue Savon::SOAPFault => e
|
23
|
+
{success: false, error: e.message}
|
27
24
|
end
|
28
25
|
end
|
29
26
|
end
|