Code Duplication    Length = 19-19 lines in 7 locations

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

@@ 32-50 (lines=19) @@
29
     * @return Contracts\IntencaoVenda\GetByFiltrosResponse
30
     * @throws \Exception
31
     */
32
    public function getByFiltros(Contracts\IntencaoVenda\GetByFiltrosRequest $getByFiltrosRequest)
33
    {
34
        try{
35
            $this->response = $this->_httpClient->post(__FUNCTION__,[
36
                'body' => json_encode($getByFiltrosRequest),
37
            ]);
38
39
            return SerializerHelper::denormalize(
40
                $this->response->json(),
41
                Contracts\IntencaoVenda\GetByFiltrosResponse::class
42
            );
43
        }catch (RequestException $ex) {
44
            $this->response = $ex->getResponse();
45
            $responseBody = $ex->getResponse()->json();
46
            throw new \Exception($responseBody['message']);
47
        }catch (\Exception $ex){
48
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
49
        }
50
    }
51
52
    /**
53
     * @param Contracts\IntencaoVenda\GetByFiltrosRequest $getByFiltrosRequest
@@ 57-75 (lines=19) @@
54
     * @return Contracts\IntencaoVenda\GetByFiltrosResponse
55
     * @throws \Exception
56
     */
57
    public function getByFiltrosAsync(Contracts\IntencaoVenda\GetByFiltrosRequest $getByFiltrosRequest)
58
    {
59
        try{
60
            $this->response = $this->_httpClient->post(__FUNCTION__,[
61
                'body' => json_encode($getByFiltrosRequest),
62
            ]);
63
64
            return SerializerHelper::denormalize(
65
                $this->response->json(),
66
                Contracts\IntencaoVenda\GetByFiltrosResponse::class
67
            );
68
        }catch (RequestException $ex) {
69
            $this->response = $ex->getResponse();
70
            $responseBody = $ex->getResponse()->json();
71
            throw new \Exception($responseBody['message']);
72
        }catch (\Exception $ex){
73
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
74
        }
75
    }
76
77
    /**
78
     * @param integer $intencaoVendaId

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

@@ 32-50 (lines=19) @@
29
     * @return Contracts\Login\LoginResponse
30
     * @throws \Exception
31
     */
32
    public function login(Contracts\Login\LoginRequest $loginRequest)
33
    {
34
        try{
35
            $this->response = $this->_httpClient->post(__FUNCTION__,[
36
                'body' => json_encode($loginRequest)
37
            ]);
38
39
            return SerializerHelper::denormalize(
40
                $this->response->json(),
41
                Contracts\Login\LoginResponse::class
42
            );
43
        }catch (RequestException $ex) {
44
            $this->response = $ex->getResponse();
45
            $responseBody = $ex->getResponse()->json();
46
            throw new \Exception($responseBody['message']);
47
        }catch (\Exception $ex){
48
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
49
        }
50
    }
51
52
    /**
53
     * @return Contracts\Login\LoginResponse
@@ 76-94 (lines=19) @@
73
     * @return Contracts\Login\ConsultaLoginResponse
74
     * @throws \Exception
75
     */
76
    public function consultaLogin(Contracts\Login\ConsultaLoginRequest $consultaLoginRequest)
77
    {
78
        try{
79
            $this->response = $this->_httpClient->post(__FUNCTION__,[
80
                'body' => json_encode($consultaLoginRequest)
81
            ]);
82
83
            return SerializerHelper::denormalize(
84
                $this->response->json(),
85
                Contracts\Login\ConsultaLoginResponse::class
86
            );
87
        }catch (RequestException $ex) {
88
            $this->response = $ex->getResponse();
89
            $responseBody = $ex->getResponse()->json();
90
            throw new \Exception($responseBody['message']);
91
        }catch (\Exception $ex){
92
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
93
        }
94
    }
95
}

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

@@ 31-49 (lines=19) @@
28
     * @return Contracts\PagamentoExterno\GetByFiltrosResponse
29
     * @throws \Exception
30
     */
31
    public function getByFiltros(Contracts\PagamentoExterno\GetByFiltrosRequest $getByFiltrosRequest)
32
    {
33
        try{
34
            $this->response = $this->_httpClient->post(__FUNCTION__,[
35
                'body' => json_encode($getByFiltrosRequest),
36
            ]);
37
38
            return SerializerHelper::denormalize(
39
                $this->response->json(),
40
                Contracts\PagamentoExterno\GetByFiltrosResponse::class
41
            );
42
        }catch (RequestException $ex) {
43
            $this->response = $ex->getResponse();
44
            $responseBody = $ex->getResponse()->json();
45
            throw new \Exception($responseBody['message']);
46
        }catch (\Exception $ex){
47
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
48
        }
49
    }
50
51
}

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

@@ 65-83 (lines=19) @@
62
     * @return Pedido\GetByFiltrosResponse
63
     * @throws \Exception
64
     */
65
    public function getByFiltros(Pedido\GetByFiltrosRequest $getByFiltrosRequest)
66
    {
67
        try{
68
            $this->response = $this->_httpClient->post(__FUNCTION__,[
69
                'body' => json_encode($getByFiltrosRequest),
70
            ]);
71
72
            return SerializerHelper::denormalize(
73
                $this->response->json(),
74
                Pedido\GetByFiltrosResponse::class
75
            );
76
        }catch (RequestException $ex) {
77
            $this->response = $ex->getResponse();
78
            $responseBody = $ex->getResponse()->json();
79
            throw new \Exception($responseBody['message']);
80
        }catch (\Exception $ex){
81
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
82
        }
83
    }
84
85
    /**
86
     * @param $pessoaId

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

@@ 84-102 (lines=19) @@
81
     * @return Contracts\Terminal\GetByIdResponse
82
     * @throws \Exception
83
     */
84
    public function insert(Contracts\Terminal\InsertRequest $insertRequest)
85
    {
86
        try{
87
            $this->response = $this->_httpClient->post(__FUNCTION__,[
88
                'body' => json_encode($insertRequest)
89
            ]);
90
91
            return SerializerHelper::denormalize(
92
                $this->response->json(),
93
                Contracts\Terminal\InsertResponse::class
94
            );
95
        }catch (RequestException $ex) {
96
            $this->response = $ex->getResponse();
97
            $responseBody = $ex->getResponse()->json();
98
            throw new \Exception($responseBody['message']);
99
        }catch (\Exception $ex){
100
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
101
        }
102
    }
103
104
}