From 01c6fc83f80772796052a64bb3165e4361d945e1 Mon Sep 17 00:00:00 2001 From: evandrosystems Date: Thu, 26 Dec 2024 00:52:53 -0300 Subject: [PATCH] PHPAY-35: feat: mark charge as paid on efi library --- examples/efi/charges.php | 9 +++++++++ src/Gateways/Efi/Resources/Charge/Charge.php | 2 +- .../Efi/Resources/Charge/Interface/ChargeInterface.php | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/efi/charges.php b/examples/efi/charges.php index 46b8d6c..a35c63e 100644 --- a/examples/efi/charges.php +++ b/examples/efi/charges.php @@ -52,3 +52,12 @@ $phpay ->charge() ->find($chargeId); + +/** + * confirm receipt + * + * @return array charge + */ +$phpay + ->charge() + ->confirmReceipt($chargeId, []); diff --git a/src/Gateways/Efi/Resources/Charge/Charge.php b/src/Gateways/Efi/Resources/Charge/Charge.php index 257713b..72de33b 100644 --- a/src/Gateways/Efi/Resources/Charge/Charge.php +++ b/src/Gateways/Efi/Resources/Charge/Charge.php @@ -196,7 +196,7 @@ public function getQrCodePix(string $id): array */ public function confirmReceipt(string $id, array $data): array { - return $this->post("payments/{$id}/receiveInCash", $data); + return $this->put("v1/charge/{$id}/settle", $data); } /** diff --git a/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php b/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php index 06bdcf5..3e1e0f0 100644 --- a/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php +++ b/src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php @@ -36,4 +36,11 @@ public function setCustomer(array $customer): Charge; * @return ChargeInterface */ public function setQueryParams(array $queryParams): ChargeInterface; + + /** + * @param string $id + * @param array $data + * @return array + */ + public function confirmReceipt(string $id, array $data): array; }