diff --git a/src/Services/Invoice.php b/src/Services/Invoice.php index 1cbe8cc..68a6d8e 100644 --- a/src/Services/Invoice.php +++ b/src/Services/Invoice.php @@ -13,6 +13,7 @@ class Invoice extends Service { * Download Invoice as PDF * * @param string $id Invoice ID. + * * @return \GuzzleHttp\Psr7\Stream */ public function downloadPdf($id) { @@ -20,4 +21,24 @@ public function downloadPdf($id) { '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' + ]); + } } \ No newline at end of file