diff --git a/examples/efi/charges.php b/examples/efi/charges.php index a0af6df..14f5ad4 100644 --- a/examples/efi/charges.php +++ b/examples/efi/charges.php @@ -63,15 +63,26 @@ ->confirmReceipt($chargeId); /** - * destroy charge + * cancel charge */ $phpay ->charge() - ->destroy($chargeId); + ->cancel($chargeId); /** - * cancel charge + * update due date */ $phpay ->charge() - ->cancel($chargeId); + ->updateDueDate($chargeId, $dueDate); + +/** + * update billet metadata + * notification_url and custom_id + */ +$phpay + ->charge() + ->updateMetadata($chargeId, [ + 'notification_url' => $notificationUrl, + 'custom_id' => $customId, + ]); diff --git a/src/Gateways/Efi/Resources/Charge/Charge.php b/src/Gateways/Efi/Resources/Charge/Charge.php index e00af13..b63eaf0 100644 --- a/src/Gateways/Efi/Resources/Charge/Charge.php +++ b/src/Gateways/Efi/Resources/Charge/Charge.php @@ -132,37 +132,41 @@ public function create(): array } /** - * update charge + * update billet metadata + * notification_url and custom_id * * @param string $id * @param array $data * @return array */ - public function update(string $id, array $data): array + public function updateMetadata(string $id, array $data): array { - return $this->put("payments/{$id}", $data); + return $this->put("v1/charge/{$id}/metadata", $data); } /** - * destroy charge + * cancel charge * * @param string $id * @return array */ - public function destroy(string $id): array + public function cancel(string $id): array { return $this->put("v1/charge/{$id}/cancel", []); } /** - * cancel charge + * update due date * * @param string $id + * @param string $dueDate * @return array */ - public function cancel(string $id): array + public function updateDueDate(string $id, string $dueDate): array { - return $this->put("v1/charge/{$id}/cancel", []); + return $this->put("v1/charge/{$id}/billet", [ + 'expire_at' => $dueDate, + ]); } /** @@ -176,28 +180,6 @@ public function getStatus(string $id): array return $this->get("payments/{$id}/status"); } - /** - * get digitable line - * - * @param string $id - * @return mixed - */ - public function getDigitableLine(string $id): mixed - { - return $this->get("payments/{$id}/identificationField")['identificationField']; - } - - /** - * get qrcode pix - * - * @param string $id - * @return array - */ - public function getQrCodePix(string $id): array - { - return $this->get("payments/{$id}/pixQrCode"); - } - /** * confirm receipt * diff --git a/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php b/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php index 23d3e10..4dc6a4b 100644 --- a/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php +++ b/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php @@ -44,18 +44,27 @@ public function setQueryParams(array $queryParams): ChargeInterface; public function confirmReceipt(string $id): array; /** - * delete charge by id + * cancel charge by id * * @param string $id * @return array */ - public function destroy(string $id): array; + public function cancel(string $id): array; /** - * cancel charge by id - * * @param string $id + * @param string $dueDate * @return array */ - public function cancel(string $id): array; + public function updateDueDate(string $id, string $dueDate): array; + + /** + * update billet metadata + * notification_url and custom_id + * + * @param string $id + * @param array $data + * @return array + */ + public function updateMetadata(string $id, array $data): array; }