1
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
2
|
|
|
# ############################################################################# |
3
|
|
|
# |
4
|
|
|
# The MIT License (MIT) |
5
|
|
|
# |
6
|
|
|
# Copyright (c) 2016 Trocafone |
7
|
|
|
# |
8
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy |
9
|
|
|
# of this software and associated documentation files (the "Software"), to deal |
10
|
|
|
# in the Software without restriction, including without limitation the rights |
11
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12
|
|
|
# copies of the Software, and to permit persons to whom the Software is |
13
|
|
|
# furnished to do so, subject to the following conditions: |
14
|
|
|
# |
15
|
|
|
# The above copyright notice and this permission notice shall be included in |
16
|
|
|
# all copies or substantial portions of the Software. |
17
|
|
|
# |
18
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24
|
|
|
# SOFTWARE. |
25
|
|
|
# |
26
|
|
|
############################################################################### |
27
|
|
|
|
28
|
1 |
|
from correios_lib.base import EntityBase |
29
|
1 |
|
from correios_lib.entities import * |
|
|
|
|
30
|
1 |
|
from voluptuous import * |
|
|
|
|
31
|
|
|
|
32
|
|
|
|
33
|
1 |
|
class RequestSolicitarPostagemReversa(EntityBase): |
|
|
|
|
34
|
|
|
|
35
|
1 |
|
def get_schema(self): |
36
|
1 |
|
return Schema({ |
|
|
|
|
37
|
|
|
Required('codAdministrativo'): Coerce(int), |
|
|
|
|
38
|
|
|
Required('codigo_servico'): Coerce(int), |
|
|
|
|
39
|
|
|
Required('cartao'): Coerce(int), |
|
|
|
|
40
|
|
|
Required('destinatario'): Destinatario, |
|
|
|
|
41
|
|
|
Required('coletas_solicitadas'): [Coleta] |
|
|
|
|
42
|
|
|
}) |
43
|
|
|
|
44
|
|
|
|
45
|
1 |
|
class RequestCancelarPedido(EntityBase): |
|
|
|
|
46
|
|
|
|
47
|
1 |
|
def get_schema(self): |
48
|
|
|
return Schema({ |
|
|
|
|
49
|
|
|
Required('codAdministrativo'): Coerce(int), |
|
|
|
|
50
|
|
|
Required('numeroPedido'): Coerce(int), |
|
|
|
|
51
|
|
|
Required('tipo'): Any('C', 'A') |
|
|
|
|
52
|
|
|
}) |
53
|
|
|
|
54
|
|
|
|
55
|
1 |
|
class RequestAcompanharPedido(EntityBase): |
|
|
|
|
56
|
|
|
|
57
|
1 |
|
def get_schema(self): |
58
|
1 |
|
return Schema({ |
|
|
|
|
59
|
|
|
Required('codAdministrativo'): Coerce(int), |
|
|
|
|
60
|
|
|
Required('tipoBusca'): Any('H', 'U'), |
|
|
|
|
61
|
|
|
Required('numeroPedido'): Coerce(int), |
|
|
|
|
62
|
|
|
Required('tipoSolicitacao'): Any('C', 'A') |
|
|
|
|
63
|
|
|
}) |
64
|
|
|
|
65
|
|
|
|
66
|
1 |
|
class RequestAcompanharPedidoPorData(EntityBase): |
|
|
|
|
67
|
|
|
|
68
|
1 |
|
def get_schema(self): |
69
|
|
|
return Schema({ |
|
|
|
|
70
|
|
|
Required('codAdministrativo'): Coerce(int), |
|
|
|
|
71
|
|
|
Required('tipoSolicitacao'): Any('C', 'A'), |
|
|
|
|
72
|
|
|
Required('data'): Date |
|
|
|
|
73
|
|
|
}) |
74
|
|
|
|
75
|
|
|
|
76
|
1 |
|
class RequestSolicitarRange(EntityBase): |
|
|
|
|
77
|
|
|
|
78
|
1 |
|
def get_schema(self): |
79
|
|
|
return Schema({ |
|
|
|
|
80
|
|
|
Required('codAdministrativo'): Coerce(int), |
|
|
|
|
81
|
|
|
Required('tipo'): Any('AP', 'LR'), |
|
|
|
|
82
|
|
|
Optional('servico'): Any('LR', 'LS', 'LV'), |
|
|
|
|
83
|
|
|
Required('quantidade'): All( |
|
|
|
|
84
|
|
|
Coerce(int), Range(min=1, max=100000) |
|
|
|
|
85
|
|
|
) |
86
|
|
|
}) |
87
|
|
|
|
88
|
|
|
|
89
|
1 |
|
class RequestCalcularDigitoVerificador(EntityBase): |
|
|
|
|
90
|
|
|
|
91
|
1 |
|
def get_schema(self): |
92
|
|
|
return Schema({ |
|
|
|
|
93
|
|
|
Required('numero'): Coerce(int), |
|
|
|
|
94
|
|
|
}) |
95
|
|
|
|
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.