PaymentLinksEndpoint   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 39
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A getById() 0 3 1
A getByExternalCode() 0 3 1
1
<?php
2
3
namespace Ipag\Sdk\Endpoint;
4
5
use Ipag\Sdk\Core\Endpoint;
6
use Ipag\Sdk\Http\Response;
7
use Ipag\Sdk\Model\PaymentLink;
8
9
/**
10
 * PaymentLinksEndpoint class
11
 *
12
 * Classe responsável pelo controle dos endpoints do recurso Payment Links.
13
 */
14
class PaymentLinksEndpoint extends Endpoint
15
{
16
    protected string $location = '/service/resources/payment_links';
17
18
    /**
19
     * Endpoint para criar um recurso `Payment Link`
20
     *
21
     * @param PaymentLink $paymentLink
22
     * @return Response
23
     */
24
    public function create(PaymentLink $paymentLink): Response
25
    {
26
        return $this->_POST($paymentLink->jsonSerialize());
27
    }
28
29
    /**
30
     * Endpoint para obter um recurso `Payment Link`
31
     *
32
     * @param integer $id
33
     * @return Response
34
     *
35
     * @codeCoverageIgnore
36
     */
37
    public function getById(int $id): Response
38
    {
39
        return $this->_GET(['id' => $id]);
40
    }
41
42
    /**
43
     * Endpoint para obter um recurso `Payment Link` pelo Código Externo
44
     *
45
     * @param integer $externalCode
46
     * @return Response
47
     *
48
     * @codeCoverageIgnore
49
     */
50
    public function getByExternalCode(int $externalCode): Response
51
    {
52
        return $this->_GET(['external_code' => $externalCode]);
53
    }
54
}