Skip to content

Commit 483d2c2

Browse files
Merge pull request #28 from raul-facturapi/feat/series_org
2 parents 25ea60c + 8ec09f8 commit 483d2c2

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

src/Resources/Organizations.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,91 @@ public function deleteCertificate($id)
308308
throw new Facturapi_Exception('Unable to delete organization: ' . $e->getMessage());
309309
}
310310
}
311+
312+
/**
313+
* Get the series of an Organization
314+
*
315+
* @param id : Unique ID for the Organization
316+
*
317+
* @return Response body from HTTP GET request
318+
*
319+
* @throws Facturapi_Exception
320+
**/
321+
public function getSeriesGroup($id)
322+
{
323+
try {
324+
return json_decode($this->execute_get_request($this->get_request_url($id) . "/series-group"));
325+
} catch (Facturapi_Exception $e) {
326+
throw new Facturapi_Exception('Unable to find series: ' . $e);
327+
}
328+
}
329+
330+
/**
331+
* Create a Series Organization
332+
*
333+
* @param id : Unique ID for the Organization
334+
*
335+
*
336+
* @param params : object of properties and property values for new Series Organization
337+
*
338+
* @return Response body with JSON object
339+
* for created Organization from HTTP POST request
340+
*
341+
* @throws Facturapi_Exception
342+
**/
343+
public function createSeriesGroup($id, $params)
344+
{
345+
try {
346+
return json_decode($this->execute_JSON_post_request($this->get_request_url($id) . "/series-group", $params));
347+
} catch (Facturapi_Exception $e) {
348+
throw new Facturapi_Exception('Unable to create series: ' . $e);
349+
}
350+
}
351+
352+
/**
353+
* Update a Series Organization
354+
*
355+
* @param id : Unique ID for the Organization
356+
*
357+
* @param series_name: Name of the series to update
358+
*
359+
* @param params : object of properties and property values for updated Series Organization
360+
*
361+
* @return Response body with JSON object
362+
* for updated Series Organization from HTTP POST request
363+
*
364+
* @throws Facturapi_Exception
365+
**/
366+
public function updateSeriesGroup($id, $series_name, $params)
367+
{
368+
try {
369+
return json_decode($this->execute_JSON_put_request($this->get_request_url($id) . "/series-group" . "/" . $series_name, $params));
370+
} catch (Facturapi_Exception $e) {
371+
throw new Facturapi_Exception('Unable to create series: ' . $e);
372+
}
373+
}
374+
375+
/**
376+
* Delete a Series Organization
377+
*
378+
* @param id : Unique ID for the Organization
379+
*
380+
* @param series_name: Name of the series to update
381+
*
382+
* @param params : object of properties and property values for new Series Organization
383+
*
384+
* @return Response body with JSON object
385+
* for delete Series Organization from HTTP DELETE request
386+
*
387+
* @throws Facturapi_Exception
388+
**/
389+
public function deleteSeriesGroup($id, $series_name)
390+
{
391+
try {
392+
return json_decode($this->execute_delete_request($this->get_request_url($id) . "/series-group" . "/" . $series_name, null));
393+
} catch (Facturapi_Exception $e) {
394+
throw new Facturapi_Exception('Unable to create series: ' . $e);
395+
}
396+
}
397+
311398
}

0 commit comments

Comments
 (0)