Services/Xero.php
authoredward <edward@roojs.com>
Fri, 29 Jun 2018 05:24:49 +0000 (13:24 +0800)
committeredward <edward@roojs.com>
Fri, 29 Jun 2018 05:24:49 +0000 (13:24 +0800)
Services/Xero.php

index e5ce36b..965a33b 100644 (file)
@@ -71,6 +71,19 @@ class Services_Xero
         return $data;
     }
     
+    function getInvoice($id)
+    {
+        $response = $this->XeroOAuth->request('GET', $this->XeroOAuth->url("Invoices/{$id}", 'core'), array(), '', $this->format);
+        
+        $data = $this->XeroOAuth->parseResponse($response['response'], $response['format']);
+        
+        if (empty($response['code']) || $response['code'] != 200) {
+            return $this->toFailedResult($response['code'], $data);
+        }
+        
+        return $data;
+    }
+    
     function createInvoice($xml = '', $params = array())
     {
         if(empty($xml)) {