Skip to content

Commit

Permalink
implements getPurchases API call
Browse files Browse the repository at this point in the history
  • Loading branch information
David Albrecht committed Apr 14, 2016
1 parent d394ba1 commit ee16c10
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resources/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
'uri' => 'api/v1/get_sales',
'responseModel' => 'GetResponse',
],
'getPurchases' => [
'httpMethod' => 'GET',
'uri' => 'api/v1/get_purchases',
'responseModel' => 'GetResponse',
],
],
'models' => [
'GetResponse' => [
Expand Down
7 changes: 7 additions & 0 deletions tests/OpenBazaar/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ public function testGetSales()
$response = $client->getSales();
$this->assertSame($response[0]['order_id'], "549c844c08048166ed4ac9d44d9bf8916c7ce9cb");
}
public function testGetPurchases()
{
$history = new History();
$client = $this->createClient('get_purchases', $history);
$response = $client->getPurchases();
$this->assertSame($response[0]['order_id'], "8bd10ebab092d0fbf2cec1f2d0ad84dfa0f4f8df");
}
public function testLoginFail()
{
$history = new History();
Expand Down
24 changes: 24 additions & 0 deletions tests/fixtures/get_purchases
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
HTTP/1.1 200 OK
Reproxy-Status: yes
Access-Control-Allow-Origin: *
Cache-Control: public, must-revalidate
Content-Type: application/json
Server: lighttpd
Content-Length: 5103
Date: Mon, 28 Jul 2014 18:40:39 GMT
X-Varnish: 1913846781 1913780733
Age: 259
Via: 1.1 varnish
Connection: close

[{
"status": 0,
"contract_type": "digital good",
"vendor": "@themes",
"description": "A beach theme",
"title": "Beach Theme",
"order_id": "8bd10ebab092d0fbf2cec1f2d0ad84dfa0f4f8df",
"timestamp": 1449283905.809595,
"btc_total": 0.005,
"thumbnail_hash": "4cde0fba7feb2f979975e2d4e772198c77807c0b"
}]

0 comments on commit ee16c10

Please sign in to comment.