Skip to content

Commit d5b5597

Browse files
authored
Merge pull request #5 from thepeerstack/support-for-direct-debit
update methods to match documentation
2 parents 495a531 + 9ed503b commit d5b5597

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
@@ -37,7 +37,7 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
3737
* processSendReceipt
3838
- `accepts`:
3939
- receipt_id (string)
40-
- insufficient_funds (bool)
40+
- event (string)
4141
- `returns`: object
4242

4343
* indexUser
@@ -72,7 +72,7 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
7272
* authorizaDirectCharge
7373
- `accepts`:
7474
- reference (string)
75-
- insufficient_funds (bool)
75+
- event (string)
7676
- `returns`: object
7777

7878
## 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)