Code Duplication    Length = 19-20 lines in 8 locations

src/Integracao/ControlPay/API/PedidoApi.php 4 locations

@@ 87-106 (lines=20) @@
84
     * @return Pedido\GetByPessoaIdByReferenciaResponse
85
     * @throws \Exception
86
     */
87
    public function getByPessoaIdByReferencia($pessoaId, $pedidoReferencia)
88
    {
89
        try{
90
            $this->response = $this->_httpClient->post(__FUNCTION__,[
91
                'query' => $this->addQueryAdditionalParameters([
92
                    'pessoaId' => $pessoaId,
93
                    'pedidoReferencia' => $pedidoReferencia
94
                ])
95
            ]);
96
97
            return SerializerHelper::denormalize(
98
                $this->response->json(),
99
                Pedido\GetByPessoaIdByReferenciaResponse::class
100
            );
101
        }catch (RequestException $ex) {
102
            $this->requestException($ex);
103
        }catch (\Exception $ex){
104
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
105
        }
106
    }
107
108
    /**
109
     * @param $pessoaVendedorId
@@ 114-133 (lines=20) @@
111
     * @return Pedido\GetByPessoaIdByReferenciaResponse
112
     * @throws \Exception
113
     */
114
    public function getPedidosByPessoaId($pessoaVendedorId, $pedidoId)
115
    {
116
        try{
117
            $this->response = $this->_httpClient->post(__FUNCTION__,[
118
                'query' => $this->addQueryAdditionalParameters([
119
                    'pessoaVendedorId' => $pessoaVendedorId,
120
                    'pedidoId' => $pedidoId
121
                ])
122
            ]);
123
124
            return SerializerHelper::denormalize(
125
                $this->response->json(),
126
                Pedido\GetByPessoaIdByReferenciaResponse::class
127
            );
128
        }catch (RequestException $ex) {
129
            $this->requestException($ex);
130
        }catch (\Exception $ex){
131
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
132
        }
133
    }
134
135
    /**
136
     * @param $pedidoId
@@ 140-158 (lines=19) @@
137
     * @return Pedido\CancelarResponse
138
     * @throws \Exception
139
     */
140
    public function cancelar($pedidoId)
141
    {
142
        try{
143
            $this->response = $this->_httpClient->post(__FUNCTION__,[
144
                'query' => $this->addQueryAdditionalParameters([
145
                    'pedidoId' => $pedidoId
146
                ])
147
            ]);
148
149
            return SerializerHelper::denormalize(
150
                $this->response->json(),
151
                Pedido\CancelarResponse::class
152
            );
153
        }catch (RequestException $ex) {
154
            $this->requestException($ex);
155
        }catch (\Exception $ex){
156
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
157
        }
158
    }
159
160
    /**
161
     * @param integer $pedidoId
@@ 165-183 (lines=19) @@
162
     * @return Pedido\GetByIdResponse
163
     * @throws \Exception
164
     */
165
    public function getById($pedidoId)
166
    {
167
        try{
168
            $this->response = $this->_httpClient->post(__FUNCTION__,[
169
                'query' => $this->addQueryAdditionalParameters([
170
                    'pedidoId' => $pedidoId
171
                ])
172
            ]);
173
174
            return SerializerHelper::denormalize(
175
                $this->response->json(),
176
                Pedido\GetByIdResponse::class
177
            );
178
        }catch (RequestException $ex) {
179
            $this->requestException($ex);
180
        }catch (\Exception $ex){
181
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
182
        }
183
    }
184
}

src/Integracao/ControlPay/API/ProdutoApi.php 1 location

@@ 31-49 (lines=19) @@
28
     * @return Contracts\Venda\VenderResponse
29
     * @throws \Exception
30
     */
31
    public function getByAtivosByPessoaId($pessoaId)
32
    {
33
        try{
34
            $this->response = $this->_httpClient->post(__FUNCTION__,[
35
                'query' => $this->addQueryAdditionalParameters([
36
                    'pessoaId' => $pessoaId
37
                ])
38
            ]);
39
40
            return SerializerHelper::denormalize(
41
                $this->response->json(),
42
                Contracts\Produto\GetByAtivosByPessoaIdResponse::class
43
            );
44
        }catch (RequestException $ex) {
45
            $this->requestException($ex);
46
        }catch (\Exception $ex){
47
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
48
        }
49
    }
50
51
}

src/Integracao/ControlPay/API/TerminalApi.php 2 locations

@@ 31-49 (lines=19) @@
28
     * @return Contracts\Terminal\GetByPessoaIdResponse
29
     * @throws \Exception
30
     */
31
    public function getByPessoaId($pessoaId)
32
    {
33
        try{
34
            $this->response = $this->_httpClient->post(__FUNCTION__,[
35
                'query' => $this->addQueryAdditionalParameters([
36
                    'pessoaId' => $pessoaId
37
                ])
38
            ]);
39
40
            return SerializerHelper::denormalize(
41
                $this->response->json(),
42
                Contracts\Terminal\GetByPessoaIdResponse::class
43
            );
44
        }catch (RequestException $ex) {
45
            $this->requestException($ex);
46
        }catch (\Exception $ex){
47
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
48
        }
49
    }
50
51
    /**
52
     * @param integer $terminalId
@@ 56-74 (lines=19) @@
53
     * @return Contracts\Terminal\GetByIdResponse
54
     * @throws \Exception
55
     */
56
    public function getById($terminalId)
57
    {
58
        try{
59
            $this->response = $this->_httpClient->post(__FUNCTION__,[
60
                'query' => $this->addQueryAdditionalParameters([
61
                    'terminalId' => $terminalId
62
                ])
63
            ]);
64
65
            return SerializerHelper::denormalize(
66
                $this->response->json(),
67
                Contracts\Terminal\GetByIdResponse::class
68
            );
69
        }catch (RequestException $ex) {
70
            $this->requestException($ex);
71
        }catch (\Exception $ex){
72
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
73
        }
74
    }
75
76
    /**
77
     * @param Contracts\Terminal\InsertRequest $insertRequest

src/Integracao/ControlPay/API/IntencaoVendaApi.php 1 location

@@ 55-73 (lines=19) @@
52
     * @return Contracts\IntencaoVenda\GetByIdResponse
53
     * @throws \Exception
54
     */
55
    public function getById($intencaoVendaId)
56
    {
57
        try{
58
            $this->response = $this->_httpClient->post(__FUNCTION__,[
59
                'query' => $this->addQueryAdditionalParameters([
60
                    'intencaoVendaId' => $intencaoVendaId
61
                ])
62
            ]);
63
64
            return SerializerHelper::denormalize(
65
                $this->response->json(),
66
                Contracts\IntencaoVenda\GetByIdResponse::class
67
            );
68
        }catch (RequestException $ex) {
69
            $this->requestException($ex);
70
        }catch (\Exception $ex){
71
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
72
        }
73
    }
74
75
//    /**
76
//     * API Provavelmente descontinuada