Skip to content

Commit 96e9ac2

Browse files
Merge pull request #3
Implementação do Enumerador Meio de Captura
2 parents 87db24f + 9f6e38f commit 96e9ac2

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

examples/functions/EnumeratorCli.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function enumeratorTest(): array
1414
9 => 'tipo-maquineta',
1515
10 => 'tipo-servico',
1616
11 => 'voucher',
17+
12 => 'meio-captura',
1718
];
1819

1920
echo "\n ############################################\n";
@@ -32,6 +33,7 @@ function enumeratorTest(): array
3233
echo " # 9 - Tipo Maquineta #\n";
3334
echo " # 10 - Tipo Servico #\n";
3435
echo " # 11 - Voucher #\n";
36+
echo " # 12 - Meio Captura #\n";
3537
echo " # #\n";
3638
echo " ############################################\n";
3739

src/Client.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use TeiaCardSdk\Endpoints\Enumerador\Adquirente;
88
use TeiaCardSdk\Endpoints\Enumerador\Bandeira;
99
use TeiaCardSdk\Endpoints\Enumerador\CampoDivergente;
10+
use TeiaCardSdk\Endpoints\Enumerador\MeioCaptura;
1011
use TeiaCardSdk\Endpoints\Enumerador\MotivoEstorno;
1112
use TeiaCardSdk\Endpoints\Enumerador\MotivoStatusConciliacao;
1213
use TeiaCardSdk\Endpoints\Enumerador\TipoAjuste;
@@ -23,7 +24,6 @@ class Client
2324
{
2425
/** @var string */
2526
private const BASE_URI_PROD = 'https://api.saferedi.nteia.com/v1/';
26-
2727
/** @var string */
2828
private const BASE_URI_HMG = 'https://api.sandbox.saferedi.nteia.com/v1/';
2929

@@ -69,6 +69,9 @@ class Client
6969
/** @var Voucher */
7070
private $voucher;
7171

72+
/** @var MeioCaptura */
73+
private $meioCaptura;
74+
7275
/** @var Venda */
7376
private $venda;
7477

@@ -97,6 +100,7 @@ public function __construct(bool $production = false, string $accessToken = null
97100
$this->tipoMaquineta = new TipoMaquineta($this);
98101
$this->tipoServico = new TipoServico($this);
99102
$this->voucher = new Voucher($this);
103+
$this->meioCaptura = new MeioCaptura($this);
100104
$this->venda = new Venda($this);
101105
}
102106

@@ -118,6 +122,7 @@ public function request(string $method, string $uri, array $options = []): array
118122
$uri,
119123
$options
120124
);
125+
121126
return ResponseHandler::success($response->getBody()->getContents());
122127
} catch (Throwable $exception) {
123128
throw ResponseHandler::failure($exception);
@@ -258,6 +263,14 @@ public function voucher(): Voucher
258263
return $this->voucher;
259264
}
260265

266+
/**
267+
* @return MeioCaptura
268+
*/
269+
public function meioCaptura(): MeioCaptura
270+
{
271+
return $this->meioCaptura;
272+
}
273+
261274
/**
262275
* @return Venda
263276
*/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace TeiaCardSdk\Endpoints\Enumerador;
4+
5+
use Illuminate\Support\Collection;
6+
use TeiaCardSdk\Endpoints\Endpoint;
7+
use TeiaCardSdk\Exceptions\TeiaCardBaseException;
8+
use TeiaCardSdk\Routes;
9+
use Throwable;
10+
11+
class MeioCaptura extends Endpoint
12+
{
13+
/**
14+
* @return Collection
15+
* @throws Throwable
16+
* @throws TeiaCardBaseException
17+
*/
18+
public function getList(): Collection
19+
{
20+
$response = $this->client->request(
21+
self::GET,
22+
Routes::meioCaptura()->list()
23+
);
24+
25+
return collect($response['data']);
26+
}
27+
}

src/Routes.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,20 @@ public static function voucher(): Anonymous
169169
return $anonymous;
170170
}
171171

172+
/**
173+
* @return Anonymous
174+
*/
175+
public static function meioCaptura(): Anonymous
176+
{
177+
$anonymous = new Anonymous();
178+
179+
$anonymous->list = static function () {
180+
return 'enum/meio-captura';
181+
};
182+
183+
return $anonymous;
184+
}
185+
172186
public static function sales(): Anonymous
173187
{
174188
$anonymous = new Anonymous();

0 commit comments

Comments
 (0)