Skip to content

Commit ec31f69

Browse files
committed
test and confirm api functionality
1 parent 57d1f14 commit ec31f69

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ $invoice = $sppApi->getInvoice('1D3850383');
4141
$invoiceData = [
4242
'email' => '[email protected]',
4343
];
44-
$statusCode = $sppApi->updateInvoice($invoiceData);
44+
$statusCode = $sppApi->updateInvoice($invoiceID, $invoiceData);
4545
```
4646

4747
#### Charge invoice
@@ -73,7 +73,7 @@ $sppApi->getClient($clientID);
7373

7474
#### Update a client
7575
```
76-
$sppApi->updateClient($clientData);
76+
$sppApi->updateClient($clientID, $clientData);
7777
```
7878

7979
#### Delete a client
@@ -83,7 +83,7 @@ $sppApi->deleteClient($clientID);
8383

8484
#### Get all clients
8585
```
86-
$sppApi->getClients($clientID);
86+
$sppApi->getClients();
8787
```
8888

8989
### Orders
@@ -100,7 +100,7 @@ $sppApi->getOrder($orderID);
100100

101101
#### Update an order
102102
```
103-
$sppApi->updateOrder($orderData);
103+
$sppApi->updateOrder($orderID, $orderData);
104104
```
105105

106106
#### Delete an order
@@ -110,7 +110,7 @@ $sppApi->deleteOrder($orderID);
110110

111111
#### Get all orders
112112
```
113-
$sppApi->getOrders($orderID);
113+
$sppApi->getOrders();
114114
```
115115

116116
#### Create order message

src/Api.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function createInvoice(array $data)
3535
{
3636
$response = $this->client->request('POST', 'invoices', [
3737
'auth' => [$this->apiKey, ''],
38-
'json' => $data,
38+
'form_params' => $data,
3939
]);
4040

4141
return $response->getStatusCode();
@@ -56,17 +56,17 @@ public function updateInvoice($invoiceID, array $data)
5656
{
5757
$response = $this->client->request('POST', 'invoices/' . $invoiceID, [
5858
'auth' => [$this->apiKey, ''],
59-
'json' => $data,
59+
'form_params' => $data,
6060
]);
6161

6262
return $response->getStatusCode();
6363
}
6464

65-
public function chargeInvoice($invoiceID, $paymentMethodID)
65+
public function chargeInvoice($invoiceID, $paymentMethodID = null)
6666
{
6767
$response = $this->client->request('POST', 'invoices/' . $invoiceID . '/charge', [
6868
'auth' => [$this->apiKey, ''],
69-
'json' => [
69+
'form_params' => [
7070
'payment_method_id' => $paymentMethodID,
7171
],
7272
]);
@@ -96,7 +96,7 @@ public function createClient(array $data)
9696
{
9797
$response = $this->client->request('POST', 'clients', [
9898
'auth' => [$this->apiKey, ''],
99-
'json' => $data,
99+
'form_params' => $data,
100100
]);
101101

102102
return $response->getStatusCode();
@@ -117,7 +117,7 @@ public function updateClient($clientID, array $data)
117117
{
118118
$response = $this->client->request('POST', 'clients/' . $clientID, [
119119
'auth' => [$this->apiKey, ''],
120-
'json' => $data,
120+
'form_params' => $data,
121121
]);
122122

123123
return $response->getStatusCode();
@@ -148,7 +148,7 @@ public function createOrder(array $data)
148148
{
149149
$response = $this->client->request('POST', 'orders', [
150150
'auth' => [$this->apiKey, ''],
151-
'json' => $data,
151+
'form_params' => $data,
152152
]);
153153

154154
return $response->getStatusCode();
@@ -169,7 +169,7 @@ public function updateOrder($orderID, array $data)
169169
{
170170
$response = $this->client->request('POST', 'orders/' . $orderID, [
171171
'auth' => [$this->apiKey, ''],
172-
'json' => $data,
172+
'form_params' => $data,
173173
]);
174174

175175
return $response->getStatusCode();
@@ -200,7 +200,7 @@ public function createOrderMessage($orderID, $message, $user_id, $staff_only = 0
200200
{
201201
$response = $this->client->request('POST', 'order_messages/' . $orderID, [
202202
'auth' => [$this->apiKey, ''],
203-
'json' => [
203+
'form_params' => [
204204
'order' => $orderID,
205205
'message' => $message,
206206
'user_id' => $user_id,

0 commit comments

Comments
 (0)