Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor/
node_modules/
examples/asaas/credentials.php
examples/efi/credentials.php
examples/efi/credentials.php
.idea/
14 changes: 14 additions & 0 deletions examples/efi/charges.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,17 @@
->charge($charge)
->setCustomer($customer)
->create();

/**
* get all charges
* @return array charges
*/
$phpay
->charge()
->setQueryParams([
'charge_type' => 'billet',
'begin_date' => '2024-11-01',
'end_date' => '2024-11-30',
'status' => 'unpaid',
])
->getAll();
29 changes: 29 additions & 0 deletions src/Gateways/Efi/Resources/Charge/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ class Charge implements ChargeInterface
*/
private array $items = [];

/**
* @var array<mixed>
*/
private array $queryParams = [];

/**
* @var array<mixed>
*/
Expand Down Expand Up @@ -68,6 +73,30 @@ public function setCustomer(array $customer): Charge
return $this;
}

/**
* set filters
*
* @param array<mixed> $queryParams
* @return ChargeInterface
* @deprecated
*/
public function setQueryParams(array $queryParams): ChargeInterface
{
$this->queryParams = $queryParams;

return $this;
}

/**
* find all charges
*
* @return array<array|mixed>
*/
public function getAll(): array
{
return $this->get('v1/charges', $this->queryParams);
}

/**
* create charge
*
Expand Down
15 changes: 15 additions & 0 deletions src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,26 @@

interface ChargeInterface
{
/**
* get all charges
*
* @return array<array|mixed>
*/
public function getAll(): array;

/**
* set customer
*
* @param array<mixed> $customer
* @return Charge
*/
public function setCustomer(array $customer): Charge;

/**
* set query params
*
* @param array<mixed> $queryParams
* @return ChargeInterface
*/
public function setQueryParams(array $queryParams): ChargeInterface;
}