Code Duplication    Length = 20-21 lines in 2 locations

lib/Payever/ExternalIntegration/Payments/PaymentsApiClient.php 2 locations

@@ 69-88 (lines=20) @@
66
     *
67
     * @throws \Exception
68
     */
69
    public function createPaymentRequest(CreatePaymentRequest $createPaymentRequest)
70
    {
71
        $this->configuration->assertLoaded();
72
73
        if (!$createPaymentRequest->getChannel()) {
74
            $createPaymentRequest->setChannel(
75
                $this->configuration->getChannelSet()
76
            );
77
        }
78
79
        $request = RequestBuilder::post($this->getCreatePaymentURL())
80
            ->addRawHeader(
81
                $this->getToken(OauthToken::SCOPE_CREATE_PAYMENT)->getAuthorizationString()
82
            )
83
            ->setRequestEntity($createPaymentRequest)
84
            ->setResponseEntity(new CreatePaymentResponse())
85
            ->build();
86
87
        return $this->getHttpClient()->execute($request);
88
    }
89
90
    /**
91
     * {@inheritdoc}
@@ 95-115 (lines=21) @@
92
     *
93
     * @throws \Exception
94
     */
95
    public function submitPaymentRequest(SubmitPaymentRequest $submitPaymentRequest)
96
    {
97
        $this->configuration->assertLoaded();
98
99
        if (!$submitPaymentRequest->getChannel()) {
100
            $submitPaymentRequest->setChannel(
101
                $this->configuration->getChannelSet()
102
            );
103
        }
104
105
        $request = RequestBuilder::post($this->getSubmitPaymentURL())
106
            ->addRawHeader(
107
                $this->getToken(OauthToken::SCOPE_CREATE_PAYMENT)->getAuthorizationString()
108
            )
109
            ->contentTypeIsJson()
110
            ->setRequestEntity($submitPaymentRequest)
111
            ->setResponseEntity(new RetrievePaymentResponse())
112
            ->build();
113
114
        return $this->getHttpClient()->execute($request);
115
    }
116
117
    /**
118
     * {@inheritdoc}