Version Notes
Fixed < PHP 5.4 array issues. Removed an unwelcome log-line from the debugging process
Download this release
Release Info
| Developer | Nicklas Møller |
| Extension | Nicklasmoeller_BillysBilling |
| Version | 0.2.2 |
| Comparing to | |
| See all releases | |
Code changes from version 0.2.1 to 0.2.2
app/code/community/Nicklasmoeller/Billysbilling/Model/Client.php
CHANGED
|
@@ -35,7 +35,7 @@ class Nicklasmoeller_Billysbilling_Model_Client
|
|
| 35 |
*/
|
| 36 |
public function request($method, $endpoint, $body = null)
|
| 37 |
{
|
| 38 |
-
$headers =
|
| 39 |
$ch = curl_init($this->uri . $endpoint);
|
| 40 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
| 41 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
@@ -51,9 +51,9 @@ class Nicklasmoeller_Billysbilling_Model_Client
|
|
| 51 |
$body = json_decode($response);
|
| 52 |
$info = curl_getinfo($ch);
|
| 53 |
|
| 54 |
-
return (object)
|
| 55 |
'status' => $info['http_code'],
|
| 56 |
'body' => $body
|
| 57 |
-
|
| 58 |
}
|
| 59 |
}
|
| 35 |
*/
|
| 36 |
public function request($method, $endpoint, $body = null)
|
| 37 |
{
|
| 38 |
+
$headers = array("X-Access-Token: " . $this->key);
|
| 39 |
$ch = curl_init($this->uri . $endpoint);
|
| 40 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
| 41 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
| 51 |
$body = json_decode($response);
|
| 52 |
$info = curl_getinfo($ch);
|
| 53 |
|
| 54 |
+
return (object) array(
|
| 55 |
'status' => $info['http_code'],
|
| 56 |
'body' => $body
|
| 57 |
+
);
|
| 58 |
}
|
| 59 |
}
|
app/code/community/Nicklasmoeller/Billysbilling/Model/Invoice.php
CHANGED
|
@@ -64,9 +64,9 @@ class Nicklasmoeller_Billysbilling_Model_Invoice extends Nicklasmoeller_Billysbi
|
|
| 64 |
|
| 65 |
$invoice->lines = $this->buildInvoiceLines($orderData);
|
| 66 |
|
| 67 |
-
$res = $this->client->request("POST", "/invoices",
|
| 68 |
'invoice' => $invoice
|
| 69 |
-
|
| 70 |
|
| 71 |
if ($res->status !== 200) {
|
| 72 |
return false;
|
|
@@ -84,7 +84,7 @@ class Nicklasmoeller_Billysbilling_Model_Invoice extends Nicklasmoeller_Billysbi
|
|
| 84 |
*/
|
| 85 |
public function buildInvoiceLines($orderData)
|
| 86 |
{
|
| 87 |
-
$lines =
|
| 88 |
|
| 89 |
$products = $orderData->getAllItems();
|
| 90 |
|
|
@@ -95,8 +95,6 @@ class Nicklasmoeller_Billysbilling_Model_Invoice extends Nicklasmoeller_Billysbi
|
|
| 95 |
foreach ($products as $product) {
|
| 96 |
$tempProduct = Mage::getSingleton('billysbilling/product')->getProduct($product);
|
| 97 |
|
| 98 |
-
Mage::log($tempProduct, null, 'product.log');
|
| 99 |
-
|
| 100 |
$lines[$i] = new stdClass();
|
| 101 |
$lines[$i]->productId = $tempProduct->id;
|
| 102 |
$lines[$i]->description = '';
|
| 64 |
|
| 65 |
$invoice->lines = $this->buildInvoiceLines($orderData);
|
| 66 |
|
| 67 |
+
$res = $this->client->request("POST", "/invoices", array(
|
| 68 |
'invoice' => $invoice
|
| 69 |
+
));
|
| 70 |
|
| 71 |
if ($res->status !== 200) {
|
| 72 |
return false;
|
| 84 |
*/
|
| 85 |
public function buildInvoiceLines($orderData)
|
| 86 |
{
|
| 87 |
+
$lines = array();
|
| 88 |
|
| 89 |
$products = $orderData->getAllItems();
|
| 90 |
|
| 95 |
foreach ($products as $product) {
|
| 96 |
$tempProduct = Mage::getSingleton('billysbilling/product')->getProduct($product);
|
| 97 |
|
|
|
|
|
|
|
| 98 |
$lines[$i] = new stdClass();
|
| 99 |
$lines[$i]->productId = $tempProduct->id;
|
| 100 |
$lines[$i]->description = '';
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Nicklasmoeller_BillysBilling</name>
|
| 4 |
-
<version>0.2.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,11 +10,11 @@
|
|
| 10 |
<description>Billy's Billing enables you to keep your focus on selling, rather than all the hassle with accounting. It automatically sends your data through Billy's Billing API v2.
|
| 11 |

|
| 12 |
It will trigger when you create credit memos and invoices, and submit the order data.</description>
|
| 13 |
-
<notes>
|
| 14 |
<authors><author><name>Nicklas Møller</name><user>nicklasmoeller</user><email>hello@nicklasmoeller.com</email></author></authors>
|
| 15 |
-
<date>2015-01-
|
| 16 |
-
<time>
|
| 17 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Nicklasmoeller_Billysbilling.xml" hash=""/></dir></target><target name="magecommunity"><dir name="Nicklasmoeller"><dir name="Billysbilling"><dir name="Helper"><file name="Data.php" hash="f4736eba20bc2d9c7fcedf64a7633204"/></dir><dir name="Model"><file name="Abstract.php" hash="5c6d911c3ffb7cb9b4a01ac110b6bb0b"/><file name="Client.php" hash="
|
| 18 |
<compatible/>
|
| 19 |
<dependencies><required><php><min>5.2.0</min><max>5.6.4</max></php></required></dependencies>
|
| 20 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Nicklasmoeller_BillysBilling</name>
|
| 4 |
+
<version>0.2.2</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Billy's Billing enables you to keep your focus on selling, rather than all the hassle with accounting. It automatically sends your data through Billy's Billing API v2.
|
| 11 |

|
| 12 |
It will trigger when you create credit memos and invoices, and submit the order data.</description>
|
| 13 |
+
<notes>Fixed < PHP 5.4 array issues. Removed an unwelcome log-line from the debugging process</notes>
|
| 14 |
<authors><author><name>Nicklas Møller</name><user>nicklasmoeller</user><email>hello@nicklasmoeller.com</email></author></authors>
|
| 15 |
+
<date>2015-01-08</date>
|
| 16 |
+
<time>23:53:45</time>
|
| 17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Nicklasmoeller_Billysbilling.xml" hash=""/></dir></target><target name="magecommunity"><dir name="Nicklasmoeller"><dir name="Billysbilling"><dir name="Helper"><file name="Data.php" hash="f4736eba20bc2d9c7fcedf64a7633204"/></dir><dir name="Model"><file name="Abstract.php" hash="5c6d911c3ffb7cb9b4a01ac110b6bb0b"/><file name="Client.php" hash="5a71e03f607e67d1787e5bfe31d6eb74"/><file name="Contact.php" hash="6cac465d3def83ecc5b7023ea1fce0f1"/><file name="Country.php" hash="00719daadf5e6b1bf33d20c871b88bbe"/><file name="Currency.php" hash="f0fc753816c8a701a3f4a2a77e538b19"/><file name="Invoice.php" hash="673c6ac4fb12e7fe8b20c70c91a84ffa"/><file name="Observer.php" hash="415a0dd2fa5a994f7cae110ae4d4a230"/><file name="Organization.php" hash="3c9878026777e83c37a0d6d5fbaa7bdd"/><file name="Product.php" hash="eb05e67dba21ee3aac0c929c583f9622"/><file name="Shipment.php" hash="f994dda14c629a2885de0af7a4b3a2e0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6a3fdd657b1c112c61bb2700564f34ad"/><file name="config.xml" hash="59d4ee6d454c3aa47eb24716e8c9c4f7"/><file name="system.xml" hash="9ff46b75b2ba25efa7fae13c9cbb376f"/></dir></dir></dir></target></contents>
|
| 18 |
<compatible/>
|
| 19 |
<dependencies><required><php><min>5.2.0</min><max>5.6.4</max></php></required></dependencies>
|
| 20 |
</package>
|
