-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from pablosanches/feat/estoques
Feat/estoques
- Loading branch information
Showing
22 changed files
with
1,136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace PabloSanches\Bling\Resource\Depositos; | ||
|
||
use PabloSanches\Bling\Http\BlingResponse; | ||
use PabloSanches\Bling\Http\HttpMethods; | ||
use PabloSanches\Bling\Http\Uri; | ||
use PabloSanches\Bling\Resource\AbstractResource; | ||
use PabloSanches\Bling\Resource\Depositos\Dto\BuscarTodosDepositosRequestDto; | ||
use PabloSanches\Bling\Resource\Depositos\Dto\PersistirDepositoRequestDto; | ||
|
||
class Depositos extends AbstractResource | ||
{ | ||
public function criar(array $payload): BlingResponse | ||
{ | ||
$requestDto = PersistirDepositoRequestDto::factory($payload); | ||
return $this->request( | ||
HttpMethods::POST, | ||
Uri::fromPath('/depositos'), | ||
$requestDto | ||
); | ||
} | ||
|
||
public function atualizar(int $id, array $payload): BlingResponse | ||
{ | ||
$requestDto = PersistirDepositoRequestDto::factory($payload); | ||
return $this->request( | ||
HttpMethods::PUT, | ||
Uri::fromPath("/depositos/{$id}"), | ||
$requestDto | ||
); | ||
} | ||
|
||
public function remover(int $id): BlingResponse | ||
{ | ||
throw new \DomainException('Operação indisponível para este resource.'); | ||
} | ||
|
||
public function buscar(int $id): BlingResponse | ||
{ | ||
return $this->request( | ||
HttpMethods::GET, | ||
Uri::fromPath("/depositos/{$id}") | ||
); | ||
} | ||
|
||
public function buscarTodos(array $options = []): BlingResponse | ||
{ | ||
$queryDto = BuscarTodosDepositosRequestDto::factory($options); | ||
return $this->request( | ||
HttpMethods::GET, | ||
Uri::fromPath('/depositos'), | ||
$queryDto | ||
); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Resource/Depositos/Dto/BuscarTodosDepositosRequestDto.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace PabloSanches\Bling\Resource\Depositos\Dto; | ||
|
||
use PabloSanches\Bling\Resource\Dto\FiltersDto; | ||
|
||
class BuscarTodosDepositosRequestDto extends FiltersDto | ||
{ | ||
public ?string $descricao = null; | ||
|
||
public ?int $situacao = null; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Resource/Depositos/Dto/PersistirDepositoRequestDto.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace PabloSanches\Bling\Resource\Depositos\Dto; | ||
|
||
use PabloSanches\Bling\Resource\Dto\AbstractDto; | ||
|
||
class PersistirDepositoRequestDto extends AbstractDto | ||
{ | ||
public string $descricao; | ||
public int $situacao; | ||
public bool $padrao; | ||
public bool $desconsiderarSaldo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace PabloSanches\Bling\Resource\Estoques\Dto; | ||
|
||
use PabloSanches\Bling\Resource\Dto\AbstractDto; | ||
|
||
class AtualizarEstoqueRequestDto extends AbstractDto | ||
{ | ||
public string $operacao; | ||
public ?float $preco = null; | ||
public ?float $custo = null; | ||
public float $quantidade; | ||
public ?string $observacoes = null; | ||
public string $data; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Resource/Estoques/Dto/BuscarSaldoDepositoRequestDto.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace PabloSanches\Bling\Resource\Estoques\Dto; | ||
|
||
use PabloSanches\Bling\Resource\Dto\FiltersDto; | ||
|
||
class BuscarSaldoDepositoRequestDto extends FiltersDto | ||
{ | ||
public int $idDeposito; | ||
public array $idsProdutos; | ||
public ?string $codigo = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace PabloSanches\Bling\Resource\Estoques\Dto; | ||
|
||
use PabloSanches\Bling\Resource\Dto\FiltersDto; | ||
|
||
class BuscarSaldosRequestDto extends FiltersDto | ||
{ | ||
public array $idsProdutos = []; | ||
|
||
public ?string $codigo = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace PabloSanches\Bling\Resource\Estoques\Dto; | ||
|
||
use PabloSanches\Bling\Resource\Dto\AbstractDto; | ||
|
||
class CriarEstoqueRequestDto extends AbstractDto | ||
{ | ||
public array $produto; | ||
public array $deposito; | ||
public string $operacao; | ||
public ?float $preco = null; | ||
public ?float $custo = null; | ||
public float $quantidade; | ||
public ?string $observacoes = null; | ||
} |
Oops, something went wrong.