Skip to content

Commit 0f57a51

Browse files
authored
allow sending query parameters to create and edit customer (#36)
1 parent 96a0481 commit 0f57a51

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/Resources/Customers.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Customers extends BaseClient {
1111
/**
1212
* Get all Customers
1313
*
14-
* @param Search parameters
14+
* @param $params Search parameters
1515
*
1616
* @return JSON objects for all Customers
1717
*
@@ -28,7 +28,7 @@ public function all( $params = null ) {
2828
/**
2929
* Get a Customer by ID
3030
*
31-
* @param id : Unique ID for customer
31+
* @param string $id : Unique ID for customer
3232
*
3333
* @return JSON object for requested Customer
3434
*
@@ -45,16 +45,17 @@ public function retrieve( $id ) {
4545
/**
4646
* Create a Customer in your organization
4747
*
48-
* @param params : array of properties and property values for new customer
48+
* @param $data : array of properties and property values for new customer
49+
* @param $params : array of optional query parameters
4950
*
5051
* @return Response body with JSON object
5152
* for created Customer from HTTP POST request
5253
*
5354
* @throws Facturapi_Exception
5455
**/
55-
public function create( $params ) {
56+
public function create( $data, $params = null ) {
5657
try {
57-
return json_decode( $this->execute_JSON_post_request( $this->get_request_url(), $params ) );
58+
return json_decode( $this->execute_JSON_post_request( $this->get_request_url($params), $data ) );
5859
} catch ( Facturapi_Exception $e ) {
5960
throw new Facturapi_Exception( 'Unable to create customer: ' . $e->getMessage() );
6061
}
@@ -64,17 +65,18 @@ public function create( $params ) {
6465
/**
6566
* Update a Customer in your organization
6667
*
67-
* @param $id
68-
* @param $params array of properties and property values for customer
68+
* @param string $id
69+
* @param $data Array of properties and property values for customer
70+
* @param $params Array of optional query parameters
6971
*
7072
* @return Response body from HTTP POST request
7173
*
7274
* @throws Facturapi_Exception
7375
*
7476
*/
75-
public function update( $id, $params ) {
77+
public function update( $id, $data, $params = null ) {
7678
try {
77-
return json_decode( $this->execute_JSON_put_request( $this->get_request_url( $id ), $params ) );
79+
return json_decode( $this->execute_JSON_put_request( $this->get_request_url( $id, $params ), $data ) );
7880
} catch ( Facturapi_Exception $e ) {
7981
throw new Facturapi_Exception( 'Unable to update customer: ' . $e->getMessage() );
8082
}
@@ -83,7 +85,7 @@ public function update( $id, $params ) {
8385
/**
8486
* Delete a Customer in your organization
8587
*
86-
* @param id : Unique ID for the customer
88+
* @param string $id : Unique ID for the customer
8789
*
8890
* @return Response body from HTTP POST request
8991
*
@@ -100,8 +102,7 @@ public function delete( $id ) {
100102
/**
101103
* Validates that a Customer's tax info is still valid
102104
*
103-
* @param id : Unique ID for the customer
104-
*
105+
* @param string $id : Unique ID for the customer
105106
* @return Response body from HTTP POST request
106107
*
107108
* @throws Facturapi_Exception

0 commit comments

Comments
 (0)