-
-
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 #54 from bildvitta/feature/sales-periodicitie-facts
Criar histórico do pagamento de sinal no vendas
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/Contracts/Resources/Programmatic/SalePeriodicityFactContract.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,24 @@ | ||
<?php | ||
|
||
namespace Bildvitta\IssVendas\Contracts\Resources\Programmatic; | ||
|
||
use Illuminate\Http\Client\RequestException; | ||
|
||
interface SalePeriodicityFactContract | ||
{ | ||
/** | ||
* @const string | ||
*/ | ||
public const ENDPOINT_PREFIX = '/programmatic/sales/%s/periodicities/facts'; | ||
|
||
|
||
/** | ||
* @param string $sale_uuid | ||
* @param array $data | ||
* | ||
* @return object | ||
* | ||
* @throws RequestException | ||
*/ | ||
public function create(string $sale_uuid, array $data): object; | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Bildvitta\IssVendas\Resources\Programmatic; | ||
|
||
use Bildvitta\IssVendas\Contracts\Resources\Programmatic\SalePeriodicityFactContract; | ||
|
||
class SalePeriodicityFact implements SalePeriodicityFactContract | ||
{ | ||
private Sale $sale; | ||
|
||
public function __construct(Sale $sale) | ||
{ | ||
$this->sale = $sale; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function create(string $sale_uuid, array $data): object | ||
{ | ||
return $this->sale->programmatic->vendas->request->post( | ||
vsprintf(self::ENDPOINT_PREFIX, [$sale_uuid]), | ||
$data | ||
)->throw()->object(); | ||
} | ||
} |