Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
* processSendReceipt
- `accepts`:
- receipt_id (string)
- insufficient_funds (bool)
- event (string)
- `returns`: object

* indexUser
Expand Down Expand Up @@ -70,7 +70,7 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
* authorizaDirectCharge
- `accepts`:
- reference (string)
- insufficient_funds (bool)
- event (string)
- `returns`: object

## Extra
Expand Down
14 changes: 5 additions & 9 deletions src/Thepeer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ public function validateSignature(Request $payload)

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

if ($headerSignature === $calculatedSignature) {
return true;
}

return false;
return $headerSignature === $calculatedSignature;
}

public function getSendReceipt(string $receipt)
Expand All @@ -69,12 +65,12 @@ public function getSendReceipt(string $receipt)
}
}

public function processSendReceipt(string $receipt, bool $insufficient_funds)
public function processSendReceipt(string $receipt, string $event)
{
try {
$request = $this->client->post("/send/{$receipt}", [
"body" => json_encode([
'insufficient_funds' => $insufficient_funds,
'event' => $event,
])
]);

Expand Down Expand Up @@ -166,12 +162,12 @@ public function chargeLink(string $link, int $amount, string $remark)
}
}

public function authorizeDirectCharge(string $reference, bool $insufficient_funds)
public function authorizeDirectCharge(string $reference, string $event)
{
try {
$request = $this->client->post("/debit/{$reference}", [
"body" => json_encode([
'insufficient_funds' => $insufficient_funds,
'event' => $event,
])
]);

Expand Down