Skip to content
Open
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: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ $thepeer->chargeLink("lost-in-the-world", 5000, "Benz");
- reference (string)
- event (string)
- `returns`: object
* getBusinesses
- `accepts`:
- channel (string)
- `returns`: object

## Extra

Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
{
"name": "Michael Okoh",
"email": "[email protected]"
},
{
"name": "Idorenyin Udoh",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
Expand Down
13 changes: 13 additions & 0 deletions src/Thepeer.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ public function authorizeCharge(string $reference, string $event)
}
}

public function getBusinesses(string $channel)
{
try {
$request = $this->client->get("/businesses?channel={$channel}");

$payload = json_decode($request->getBody()->getContents());

return $this->processResponse($payload, $request);
} catch (GuzzleException $e) {
throw new ServerErrorException($e->getMessage());
}
}

private function processResponse($payload, $request)
{
switch ($request->getStatusCode()) {
Expand Down