Skip to content

Commit 8fda4d7

Browse files
authored
Merge pull request #6 from thepeerstack/support-for-direct-debit
add authorization method and remove redundant methods
2 parents d5b5597 + dff5873 commit 8fda4d7

File tree

2 files changed

+5
-46
lines changed

2 files changed

+5
-46
lines changed

README.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
2929
- request (object)
3030
- `returns`: boolean
3131

32-
* getSendReceipt
33-
- `accepts`:
34-
- receipt_id (string)
35-
- `returns`: object
36-
37-
* processSendReceipt
38-
- `accepts`:
39-
- receipt_id (string)
40-
- event (string)
41-
- `returns`: object
42-
4332
* indexUser
4433
- `accepts`:
4534
- name (string)
@@ -60,16 +49,16 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
6049

6150
* getLink
6251
- `accepts`:
63-
- lind_id (string)
52+
- link_id (string)
6453
- `returns`: object
6554

6655
* chargeLink
6756
- `accepts`:
68-
- lind_id (string)
57+
- link_id (string)
6958
- amount (integer)
7059
- `returns`: object
7160

72-
* authorizaDirectCharge
61+
* authorizeCharge
7362
- `accepts`:
7463
- reference (string)
7564
- event (string)

src/Thepeer.php

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,36 +52,6 @@ public function validateSignature(Request $payload)
5252
return $headerSignature === $calculatedSignature;
5353
}
5454

55-
public function getSendReceipt(string $receipt)
56-
{
57-
try {
58-
$request = $this->client->get("/send/{$receipt}");
59-
60-
$payload = json_decode($request->getBody()->getContents());
61-
62-
return $this->processResponse($payload, $request);
63-
} catch (GuzzleException $e) {
64-
throw new ServerErrorException($e->getMessage());
65-
}
66-
}
67-
68-
public function processSendReceipt(string $receipt, string $event)
69-
{
70-
try {
71-
$request = $this->client->post("/send/{$receipt}", [
72-
"body" => json_encode([
73-
'event' => $event,
74-
])
75-
]);
76-
77-
$payload = json_decode($request->getBody()->getContents());
78-
79-
return $this->processResponse($payload, $request);
80-
} catch (GuzzleException $e) {
81-
throw new ServerErrorException($e->getMessage());
82-
}
83-
}
84-
8555
public function indexUser(string $name, string $email, string $identifier)
8656
{
8757
try {
@@ -162,10 +132,10 @@ public function chargeLink(string $link, int $amount, string $remark)
162132
}
163133
}
164134

165-
public function authorizeDirectCharge(string $reference, string $event)
135+
public function authorizeCharge(string $reference, string $event)
166136
{
167137
try {
168-
$request = $this->client->post("/debit/{$reference}", [
138+
$request = $this->client->post("/authorization/{$reference}", [
169139
"body" => json_encode([
170140
'event' => $event,
171141
])

0 commit comments

Comments
 (0)