Skip to content

Commit 395dd42

Browse files
PHPAY-34: feat: delete charge on efi library
1 parent 9f50d3a commit 395dd42

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

examples/efi/charges.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,10 @@
6161
$phpay
6262
->charge()
6363
->confirmReceipt($chargeId);
64+
65+
/**
66+
* destroy charge
67+
*/
68+
$phpay
69+
->charge()
70+
->destroy($chargeId);

src/Gateways/Efi/Resources/Charge/Charge.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ public function update(string $id, array $data): array
147147
* destroy charge
148148
*
149149
* @param string $id
150-
* @return bool
150+
* @return array<array|mixed>
151151
*/
152-
public function destroy(string $id): bool
152+
public function destroy(string $id): array
153153
{
154-
return $this->delete("payments/{$id}");
154+
return $this->put("v1/charge/{$id}/cancel", []);
155155
}
156156

157157
/**

src/Gateways/Efi/Resources/Charge/Interface/ChargeInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,12 @@ public function setQueryParams(array $queryParams): ChargeInterface;
4242
* @return array<array|mixed>
4343
*/
4444
public function confirmReceipt(string $id): array;
45+
46+
/**
47+
* delete charge by id
48+
*
49+
* @param string $id
50+
* @return array<array|mixed>
51+
*/
52+
public function destroy(string $id): array;
4553
}

0 commit comments

Comments
 (0)