Skip to content

Commit a13a6bd

Browse files
committed
feat: 🎸 add directRequest and phpDoc blocks
1 parent 1585744 commit a13a6bd

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

‎src/Services/Payments.php

+44-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ public function __construct($httpClient, $options)
2323
$this->options = $options;
2424
}
2525

26+
/**
27+
* Get all payments
28+
*
29+
* @link https://swahilies.readme.io/reference/get-reconciliation-list-1
30+
* @return array
31+
* @throws \GuzzleHttp\Exception\GuzzleException
32+
*/
2633
public function all()
2734
{
2835
$response = $this->httpClient->post('', [
@@ -36,7 +43,14 @@ public function all()
3643
return json_decode((string) $response->getBody(), true);
3744
}
3845

39-
public function create(array $data, int $code = 101)
46+
/**
47+
* @param array $data
48+
* @param int $code
49+
* @return array
50+
* @internal
51+
* @throws \GuzzleHttp\Exception\GuzzleException
52+
*/
53+
private function create(array $data, int $code = 101)
4054
{
4155
$payload = [
4256
'api' => 170,
@@ -61,16 +75,45 @@ public function create(array $data, int $code = 101)
6175
return json_decode((string) $response->getBody(), true);
6276
}
6377

78+
/**
79+
* Make a payment request
80+
*
81+
* @link https://swahilies.readme.io/reference/create-check-out-order-1
82+
* @param array $data
83+
* @return array
84+
*/
6485
public function request(array $data)
6586
{
6687
return $this->create($data);
6788
}
6889

90+
/**
91+
* @deprecated 0.1.0 Use directRequest() instead
92+
*/
6993
public function directPush(array $data)
7094
{
7195
return $this->create($data, 104);
7296
}
7397

98+
/**
99+
* Make a direct payment request, no checkout page is shown
100+
* @link https://swahilies.readme.io/reference/create-check-out-order-complete-1
101+
* @param array $data
102+
* @return array
103+
*/
104+
public function directRequest(array $data)
105+
{
106+
return $this->create($data, 104);
107+
}
108+
109+
110+
/**
111+
* Get a payment by ID (Using Client Order ID)
112+
* @link https://swahilies.readme.io/reference/get-order-status-1
113+
* @param string $id
114+
* @return array
115+
* @throws \GuzzleHttp\Exception\GuzzleException
116+
*/
74117
public function find(string $id)
75118
{
76119
$data = [

0 commit comments

Comments
 (0)