Skip to content

Commit 9ed503b

Browse files
committed
update methods to match documentation
1 parent 7a3d7b6 commit 9ed503b

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
3535
* processSendReceipt
3636
- `accepts`:
3737
- receipt_id (string)
38-
- insufficient_funds (bool)
38+
- event (string)
3939
- `returns`: object
4040

4141
* indexUser
@@ -70,7 +70,7 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
7070
* authorizaDirectCharge
7171
- `accepts`:
7272
- reference (string)
73-
- insufficient_funds (bool)
73+
- event (string)
7474
- `returns`: object
7575

7676
## Extra

src/Thepeer.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ public function validateSignature(Request $payload)
4949

5050
$calculatedSignature = hash_hmac('sha1', json_encode($payload->all()), $this->secretKey);
5151

52-
if ($headerSignature === $calculatedSignature) {
53-
return true;
54-
}
55-
56-
return false;
52+
return $headerSignature === $calculatedSignature;
5753
}
5854

5955
public function getSendReceipt(string $receipt)
@@ -69,12 +65,12 @@ public function getSendReceipt(string $receipt)
6965
}
7066
}
7167

72-
public function processSendReceipt(string $receipt, bool $insufficient_funds)
68+
public function processSendReceipt(string $receipt, string $event)
7369
{
7470
try {
7571
$request = $this->client->post("/send/{$receipt}", [
7672
"body" => json_encode([
77-
'insufficient_funds' => $insufficient_funds,
73+
'event' => $event,
7874
])
7975
]);
8076

@@ -166,12 +162,12 @@ public function chargeLink(string $link, int $amount, string $remark)
166162
}
167163
}
168164

169-
public function authorizeDirectCharge(string $reference, bool $insufficient_funds)
165+
public function authorizeDirectCharge(string $reference, string $event)
170166
{
171167
try {
172168
$request = $this->client->post("/debit/{$reference}", [
173169
"body" => json_encode([
174-
'insufficient_funds' => $insufficient_funds,
170+
'event' => $event,
175171
])
176172
]);
177173

0 commit comments

Comments
 (0)