Skip to content

Commit

Permalink
Fix contacts search and add discount and invoice resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz-Silpion committed Aug 31, 2017
1 parent d91bbf8 commit e02200d
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bexio/Resource/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getContacts(array $params = [])
*/
public function searchContacts(array $params = [])
{
return $this->client->get('contact/search', $params);
return $this->client->post('contact/search', $params);
}

/**
Expand Down
60 changes: 60 additions & 0 deletions src/Bexio/Resource/Discount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace Bexio\Resource;

use Bexio\Bexio;

class Discount extends Bexio {

/**
* Gets all discounts
*
* @param string $resource
* @param int $parentId
* @return array
*/
public function getDiscounts($resource, $parentId, array $params = [])
{
return $this->client->get("$resource/$parentId/kb_position_discount", $params);
}

/**
* Search for discounts
*
* @param string $resource
* @param int $parentId
* @param array $params
* @return mixed
*/
public function searchDiscounts($resource, $parentId, array $params = [])
{
return $this->client->get("$resource/$parentId/kb_position_discount", $params);
}

/**
* Get specific discount
*
* @param string $resource
* @param $parentId
* @param $id
* @return mixed
*/
public function getDiscount($resource, $parentId, $id)
{
return $this->client->get("$resource/$parentId/kb_position_discount/" . $id, []);
}

/**
* Add new discount
*
* @param string $resource
* @param int $parentId
* @param array $params
* @return mixed
*/
public function createDiscount($resource, $parentId, $params = [])
{
return $this->client->post("$resource/$parentId/kb_position_discount", $params);
}

}
52 changes: 52 additions & 0 deletions src/Bexio/Resource/Invoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace Bexio\Resource;

use Bexio\Bexio;

class Invoice extends Bexio {

/**
* Gets all orders
*
* @return array
*/
public function getInvoices(array $params = [])
{
return $this->client->get('kb_invoice', $params);
}

/**
* Search for invoices
*
* @param array $params
* @return mixed
*/
public function searchOrders(array $params = [])
{
return $this->client->get('kb_invoice/search', $params);
}

/**
* Get specific invoice
*
* @param $id
* @return mixed
*/
public function getInvoice($id)
{
return $this->client->get('kb_invoice/' . $id, []);
}

/**
* Add new invoice
*
* @param array $params
* @return mixed
*/
public function createInvoice($params = [])
{
return $this->client->post('kb_invoice', $params);
}

}

0 comments on commit e02200d

Please sign in to comment.