diff --git a/examples/efi/charges.php b/examples/efi/charges.php index a35c63e..a0af6df 100644 --- a/examples/efi/charges.php +++ b/examples/efi/charges.php @@ -60,4 +60,18 @@ */ $phpay ->charge() - ->confirmReceipt($chargeId, []); + ->confirmReceipt($chargeId); + +/** + * destroy charge + */ +$phpay + ->charge() + ->destroy($chargeId); + +/** + * cancel charge + */ +$phpay + ->charge() + ->cancel($chargeId); diff --git a/src/Gateways/Efi/Resources/Charge/Charge.php b/src/Gateways/Efi/Resources/Charge/Charge.php index 72de33b..e00af13 100644 --- a/src/Gateways/Efi/Resources/Charge/Charge.php +++ b/src/Gateways/Efi/Resources/Charge/Charge.php @@ -147,11 +147,22 @@ public function update(string $id, array $data): array * destroy charge * * @param string $id - * @return bool + * @return array + */ + public function destroy(string $id): array + { + return $this->put("v1/charge/{$id}/cancel", []); + } + + /** + * cancel charge + * + * @param string $id + * @return array */ - public function destroy(string $id): bool + public function cancel(string $id): array { - return $this->delete("payments/{$id}"); + return $this->put("v1/charge/{$id}/cancel", []); } /** @@ -191,12 +202,11 @@ public function getQrCodePix(string $id): array * confirm receipt * * @param string $id - * @param array $data * @return array */ - public function confirmReceipt(string $id, array $data): array + public function confirmReceipt(string $id): array { - return $this->put("v1/charge/{$id}/settle", $data); + return $this->put("v1/charge/{$id}/settle", []); } /** diff --git a/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php b/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php index 3e1e0f0..23d3e10 100644 --- a/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php +++ b/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php @@ -39,8 +39,23 @@ public function setQueryParams(array $queryParams): ChargeInterface; /** * @param string $id - * @param array $data * @return array */ - public function confirmReceipt(string $id, array $data): array; + public function confirmReceipt(string $id): array; + + /** + * delete charge by id + * + * @param string $id + * @return array + */ + public function destroy(string $id): array; + + /** + * cancel charge by id + * + * @param string $id + * @return array + */ + public function cancel(string $id): array; }