-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix contacts search and add discount and invoice resources
- Loading branch information
1 parent
d91bbf8
commit e02200d
Showing
3 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |