Skip to content

Commit ee16c10

Browse files
author
David Albrecht
committed
implements getPurchases API call
1 parent d394ba1 commit ee16c10

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

resources/service.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@
120120
'uri' => 'api/v1/get_sales',
121121
'responseModel' => 'GetResponse',
122122
],
123+
'getPurchases' => [
124+
'httpMethod' => 'GET',
125+
'uri' => 'api/v1/get_purchases',
126+
'responseModel' => 'GetResponse',
127+
],
123128
],
124129
'models' => [
125130
'GetResponse' => [

tests/OpenBazaar/ClientTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ public function testGetSales()
9191
$response = $client->getSales();
9292
$this->assertSame($response[0]['order_id'], "549c844c08048166ed4ac9d44d9bf8916c7ce9cb");
9393
}
94+
public function testGetPurchases()
95+
{
96+
$history = new History();
97+
$client = $this->createClient('get_purchases', $history);
98+
$response = $client->getPurchases();
99+
$this->assertSame($response[0]['order_id'], "8bd10ebab092d0fbf2cec1f2d0ad84dfa0f4f8df");
100+
}
94101
public function testLoginFail()
95102
{
96103
$history = new History();

tests/fixtures/get_purchases

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
HTTP/1.1 200 OK
2+
Reproxy-Status: yes
3+
Access-Control-Allow-Origin: *
4+
Cache-Control: public, must-revalidate
5+
Content-Type: application/json
6+
Server: lighttpd
7+
Content-Length: 5103
8+
Date: Mon, 28 Jul 2014 18:40:39 GMT
9+
X-Varnish: 1913846781 1913780733
10+
Age: 259
11+
Via: 1.1 varnish
12+
Connection: close
13+
14+
[{
15+
"status": 0,
16+
"contract_type": "digital good",
17+
"vendor": "@themes",
18+
"description": "A beach theme",
19+
"title": "Beach Theme",
20+
"order_id": "8bd10ebab092d0fbf2cec1f2d0ad84dfa0f4f8df",
21+
"timestamp": 1449283905.809595,
22+
"btc_total": 0.005,
23+
"thumbnail_hash": "4cde0fba7feb2f979975e2d4e772198c77807c0b"
24+
}]

0 commit comments

Comments
 (0)