Skip to content

Commit dff5873

Browse files
committed
add authorization method and remove redundant methods
1 parent 9ed503b commit dff5873

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
@@ -27,17 +27,6 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
2727
- request (object)
2828
- `returns`: boolean
2929

30-
* getSendReceipt
31-
- `accepts`:
32-
- receipt_id (string)
33-
- `returns`: object
34-
35-
* processSendReceipt
36-
- `accepts`:
37-
- receipt_id (string)
38-
- event (string)
39-
- `returns`: object
40-
4130
* indexUser
4231
- `accepts`:
4332
- name (string)
@@ -58,16 +47,16 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
5847

5948
* getLink
6049
- `accepts`:
61-
- lind_id (string)
50+
- link_id (string)
6251
- `returns`: object
6352

6453
* chargeLink
6554
- `accepts`:
66-
- lind_id (string)
55+
- link_id (string)
6756
- amount (integer)
6857
- `returns`: object
6958

70-
* authorizaDirectCharge
59+
* authorizeCharge
7160
- `accepts`:
7261
- reference (string)
7362
- 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)