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\SplitRules; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* SplitRulesEndpoint class |
11
|
|
|
* |
12
|
|
|
* Classe responsável pelo controle dos endpoints do recurso Split Rules. |
13
|
|
|
*/ |
14
|
|
|
class SplitRulesEndpoint extends Endpoint |
15
|
|
|
{ |
16
|
|
|
protected string $location = '/service/resources/split_rules'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Endpoint para criar um recurso `Split Rules` |
20
|
|
|
* |
21
|
|
|
* @param SplitRules $splitRules |
22
|
|
|
* @param integer $transaction_id |
23
|
|
|
* @return Response |
24
|
|
|
*/ |
25
|
|
|
public function create(SplitRules $splitRules, int $transaction_id): Response |
26
|
|
|
{ |
27
|
|
|
return $this->_POST($splitRules->jsonSerialize(), ['transaction' => $transaction_id]); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Endpoint para obter um recurso `Split Rules` |
32
|
|
|
* |
33
|
|
|
* @param integer $split_rule_id |
34
|
|
|
* @param integer $transaction_id |
35
|
|
|
* @return Response |
36
|
|
|
* |
37
|
|
|
* @codeCoverageIgnore |
38
|
|
|
*/ |
39
|
|
|
public function get(int $split_rule_id, int $transaction_id): Response |
40
|
|
|
{ |
41
|
|
|
return $this->_GET([ |
42
|
|
|
'id' => $split_rule_id, |
43
|
|
|
'transaction' => $transaction_id |
44
|
|
|
]); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Endpoint para listar os recursos `Split Rules` |
49
|
|
|
* |
50
|
|
|
* @param integer $transaction_id |
51
|
|
|
* @return Response |
52
|
|
|
* |
53
|
|
|
* @codeCoverageIgnore |
54
|
|
|
*/ |
55
|
|
|
public function list(int $transaction_id): Response |
56
|
|
|
{ |
57
|
|
|
return $this->_GET(['transaction' => $transaction_id]); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Endpoint para deletar um recurso `Split Rules` |
62
|
|
|
* |
63
|
|
|
* @param integer $split_rule_id |
64
|
|
|
* @param integer $transaction_id |
65
|
|
|
* @return Response |
66
|
|
|
* |
67
|
|
|
* @codeCoverageIgnore |
68
|
|
|
*/ |
69
|
|
|
public function delete(int $split_rule_id, int $transaction_id): Response |
70
|
|
|
{ |
71
|
|
|
return $this->_DELETE([ |
72
|
|
|
'id' => $split_rule_id, |
73
|
|
|
'transaction' => $transaction_id |
74
|
|
|
]); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
} |