Skip to content

Commit

Permalink
Add createInvoicePayment and deleteInvoicePayment
Browse files Browse the repository at this point in the history
  • Loading branch information
christianruhstaller committed Mar 5, 2019
1 parent d8e910d commit c166826
Showing 1 changed file with 41 additions and 15 deletions.
56 changes: 41 additions & 15 deletions src/Bexio/Resource/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

/**
* Class Invoice
*
* @package Bexio\Resource
* https://docs.bexio.com/ressources/kb_invoice/
*/
class Invoice extends Bexio {
class Invoice extends Bexio
{

/**
* Gets all orders
Expand Down Expand Up @@ -40,7 +42,7 @@ public function searchInvoices(array $params = [])
*/
public function getInvoice($id)
{
return $this->client->get('kb_invoice/' . $id, []);
return $this->client->get('kb_invoice/'.$id, []);
}

/**
Expand All @@ -51,12 +53,12 @@ public function getInvoice($id)
*/
public function getPdf($id)
{
return $this->client->get('kb_invoice/' . $id . '/pdf', []);
return $this->client->get('kb_invoice/'.$id.'/pdf', []);
}

/**
* Add new invoice
*
*
* @param array $params
* @return mixed
*/
Expand All @@ -68,7 +70,7 @@ public function createInvoice($params = [])
/**
* Edit invoice
*
* @param $id
* @param $id
* @param array $params
* @return mixed
*/
Expand All @@ -85,7 +87,7 @@ public function editInvoice($id, $params = [])
*/
public function deleteInvoice($id)
{
return $this->client->delete('kb_invoice/' . $id, []);
return $this->client->delete('kb_invoice/'.$id, []);
}

/**
Expand All @@ -96,7 +98,7 @@ public function deleteInvoice($id)
*/
public function issueInvoice($id)
{
return $this->client->post('kb_invoice/' . $id . '/issue', []);
return $this->client->post('kb_invoice/'.$id.'/issue', []);
}

/**
Expand All @@ -107,18 +109,19 @@ public function issueInvoice($id)
*/
public function sendInvoice($id)
{
return $this->client->post('kb_invoice/' . $id . '/send', []);
return $this->client->post('kb_invoice/'.$id.'/send', []);
}

/**
* Mark specific invoice as sent
*s
*
* @param $id
* @return mixed
*/
public function markInvoiceAsSent($id)
{
return $this->client->post('kb_invoice/' . $id . '/mark_as_sent', []);
return $this->client->post('kb_invoice/'.$id.'/mark_as_sent', []);
}


Expand All @@ -130,7 +133,7 @@ public function markInvoiceAsSent($id)
*/
public function getComments($id)
{
return $this->client->get('kb_invoice/' . $id . '/comment');
return $this->client->get('kb_invoice/'.$id.'/comment');
}

/**
Expand All @@ -142,19 +145,19 @@ public function getComments($id)
*/
public function getComment($id, $commentId)
{
return $this->client->get('kb_invoice/' . $id . '/comment/' . $commentId);
return $this->client->get('kb_invoice/'.$id.'/comment/'.$commentId);
}

/**
* Create comment
*
* @param $id
* @param $id
* @param array $params
* @return mixed
*/
public function createComment($id, $params = [])
{
return $this->client->post('kb_invoice/' . $id . '/comment', $params);
return $this->client->post('kb_invoice/'.$id.'/comment', $params);
}

/**
Expand All @@ -165,7 +168,7 @@ public function createComment($id, $params = [])
*/
public function getInvoicePayments($id)
{
return $this->client->get('kb_invoice/' . $id . '/payment', []);
return $this->client->get('kb_invoice/'.$id.'/payment', []);
}

/**
Expand All @@ -177,6 +180,29 @@ public function getInvoicePayments($id)
*/
public function getInvoicePayment($id, $paymentId)
{
return $this->client->get('kb_invoice/' . $id . '/payment/' . $paymentId, []);
return $this->client->get('kb_invoice/'.$id.'/payment/'.$paymentId, []);
}

/**
* Create a new invoice payment
*
* @param array $params
* @return mixed
*/
public function createInvoicePayment($id, $params = [])
{
return $this->client->post('kb_invoice/'.$id.'/payment', $params);
}

/**
* Celete a invoice payment
*
* @param $id
* @param $paymentId
* @return mixed
*/
public function deleteInvoicePayment($id, $paymentId)
{
return $this->client->delete('kb_invoice/'.$id.'/payment/'.$paymentId, []);
}
}

0 comments on commit c166826

Please sign in to comment.