Code Duplication    Length = 10-10 lines in 7 locations

src/MercadoPago.php 7 locations

@@ 137-146 (lines=10) @@
134
     * @return array
135
     * @throws MercadoPagoException If request failed.
136
     */
137
    public function getAuthorizedPayment($id)
138
    {
139
        $response = $this->client->get(
140
            '/authorized_payments/' . $id,
141
            [],
142
            ['access_token' => $this->getAccessToken()]
143
        );
144
145
        return $this->handleResponse($response);
146
    }
147
148
    /**
149
     * Refund accredited payment.
@@ 230-239 (lines=10) @@
227
     * @return array
228
     * @throws MercadoPagoException If request failed.
229
     */
230
    public function createPreference($preference)
231
    {
232
        $response = $this->client->post(
233
            '/checkout/preferences',
234
            $preference,
235
            ['access_token' => $this->getAccessToken()]
236
        );
237
238
        return $this->handleResponse($response);
239
    }
240
241
    /**
242
     * Update a checkout preference.
@@ 248-257 (lines=10) @@
245
     * @return array
246
     * @throws MercadoPagoException If request failed.
247
     */
248
    public function updatePreference($id, $preference)
249
    {
250
        $response = $this->client->put(
251
            '/checkout/preferences/' . $id,
252
            $preference,
253
            ['access_token' => $this->getAccessToken()]
254
        );
255
256
        return $this->handleResponse($response);
257
    }
258
259
    /**
260
     * Get a checkout preference.
@@ 265-274 (lines=10) @@
262
     * @return array
263
     * @throws MercadoPagoException If request failed.
264
     */
265
    public function getPreference($id)
266
    {
267
        $response = $this->client->get(
268
            '/checkout/preferences/' . $id,
269
            [],
270
            ['access_token' => $this->getAccessToken()]
271
        );
272
273
        return $this->handleResponse($response);
274
    }
275
276
    /**
277
     * Create a preapproval payment.
@@ 282-291 (lines=10) @@
279
     * @return array
280
     * @throws MercadoPagoException If request failed.
281
     */
282
    public function createPreapprovalPayment($preapprovalPayment)
283
    {
284
        $response = $this->client->post(
285
            '/preapproval',
286
            $preapprovalPayment,
287
            ['access_token' => $this->getAccessToken()]
288
        );
289
290
        return $this->handleResponse($response);
291
    }
292
293
    /**
294
     * Get a preapproval payment.
@@ 299-308 (lines=10) @@
296
     * @return array
297
     * @throws MercadoPagoException If request failed.
298
     */
299
    public function getPreapprovalPayment($id)
300
    {
301
        $response = $this->client->get(
302
            '/preapproval/' . $id,
303
            [],
304
            ['access_token' => $this->getAccessToken()]
305
        );
306
307
        return $this->handleResponse($response);
308
    }
309
310
    /**
311
     * Update a preapproval payment.
@@ 317-326 (lines=10) @@
314
     * @return array
315
     * @throws MercadoPagoException If request failed.
316
     */
317
    public function updatePreapprovalPayment($id, array $payment = [])
318
    {
319
        $response = $this->client->put(
320
            '/preapproval/' . $id,
321
            $payment,
322
            ['access_token' => $this->getAccessToken()]
323
        );
324
325
        return $this->handleResponse($response);
326
    }
327
328
    /**
329
     * @param Response $response