TransactionEndpoint   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 41
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A list() 0 3 1
A releaseReceivables() 0 3 1
A get() 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
8
/**
9
 * TransactionEndpoint class
10
 *
11
 * Classe responsável pelo controle dos endpoints do recurso Transaction.
12
 */
13
class TransactionEndpoint extends Endpoint
14
{
15
    protected string $location = '/service/resources/transactions';
16
17
    /**
18
     * Endpoint para obter um recurso Transaction
19
     *
20
     * @param integer $id
21
     * @return Response
22
     *
23
     * @codeCoverageIgnore
24
     */
25
    public function get(int $id): Response
26
    {
27
        return $this->_GET(['id' => $id]);
28
    }
29
30
    /**
31
     * Endpoint para listar recursos Transaction
32
     *
33
     * @param array|null $filters
34
     * @return Response
35
     *
36
     */
37
    public function list(?array $filters = []): Response
38
    {
39
        return $this->_GET($filters ?? []);
40
    }
41
42
    /**
43
     * Endpoint para liberar recebíveis de recurso Transaction
44
     *
45
     * @param integer $sellerId
46
     * @param integer $transactionId
47
     * @return Response
48
     *
49
     * @codeCoverageIgnore
50
     */
51
    public function releaseReceivables(int $sellerId, int $transactionId): Response
52
    {
53
        return $this->_POST(['seller_id' => $sellerId, 'transaction_id' => $transactionId]);
54
    }
55
56
}