Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Commit

Permalink
Added send method to Invoice.
Browse files Browse the repository at this point in the history
  • Loading branch information
khairulashraff committed Mar 14, 2017
1 parent 99fd7b5 commit f84b5ac
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Services/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,32 @@ class Invoice extends Service {
* Download Invoice as PDF
*
* @param string $id Invoice ID.
*
* @return \GuzzleHttp\Psr7\Stream
*/
public function downloadPdf($id) {
return $this->request('GET', $this->getResourceName() . '/' . $id . '/pdf', [], [
'Accept' => 'application/pdf'
]);
}

/**
* Send an invoice through email.
*
* @param string $id Invoice ID.
* @param string $email Email to be sent to.
*
* @return \GuzzleHttp\Psr7\Stream
*/
public function send($id, $email = null) {
$url = $this->getResourceName() . '/' . $id . '/send';

if ($email) {
$url .= '?sendTo=' . urlencode($email);
}

return $this->request('POST', $url, [], [
'Content-Type' => 'application/octet-stream'
]);
}
}

0 comments on commit f84b5ac

Please sign in to comment.