Billys_Billing_Invoicer - Version 1.0.2

Version Notes

Added support for sending payments along with invoices

Download this release

Release Info

Developer Billy's Billing
Extension Billys_Billing_Invoicer
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/BillysBilling/Invoicer/Model/Observer.php CHANGED
@@ -7,6 +7,7 @@ class BillysBilling_Invoicer_Model_Observer {
7
  private $shippingId = "";
8
  private $accountId = "";
9
  private $vatModelId = "";
 
10
 
11
  private $client;
12
 
@@ -27,6 +28,7 @@ class BillysBilling_Invoicer_Model_Observer {
27
  $this->shippingId = Mage::getStoreConfig("billy/invoicer/shipping_account");
28
  $this->accountId = Mage::getStoreConfig("billy/invoicer/sales_account");
29
  $this->vatModelId = Mage::getStoreConfig("billy/invoicer/vat_model");
 
30
 
31
  // Include Billy's PHP SDK
32
  if (!class_exists('Billy_Client', false)) {
@@ -107,12 +109,27 @@ class BillysBilling_Invoicer_Model_Observer {
107
  // Create new invoice
108
  try {
109
  if ($this->testMode) {
110
- return $this->client->fakePost(Mage::getBaseDir() . "/tests/output.log", "invoices", $invoice);
111
  }
112
- return $this->client->post("invoices", $invoice);
113
  } catch (Billy_Exception $e) {
114
  BillysBilling_Invoicer_Helper_Data::printError($e, "Error occurred on invoice creation.");
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
 
118
  /**
7
  private $shippingId = "";
8
  private $accountId = "";
9
  private $vatModelId = "";
10
+ private $bankAccountId = "";
11
 
12
  private $client;
13
 
28
  $this->shippingId = Mage::getStoreConfig("billy/invoicer/shipping_account");
29
  $this->accountId = Mage::getStoreConfig("billy/invoicer/sales_account");
30
  $this->vatModelId = Mage::getStoreConfig("billy/invoicer/vat_model");
31
+ $this->bankAccountId = Mage::getStoreConfig("billy/invoicer/bank_account");
32
 
33
  // Include Billy's PHP SDK
34
  if (!class_exists('Billy_Client', false)) {
109
  // Create new invoice
110
  try {
111
  if ($this->testMode) {
112
+ $response = $this->client->fakePost(Mage::getBaseDir() . "/tests/output.log", "invoices", $invoice);
113
  }
114
+ $response = $this->client->post("invoices", $invoice);
115
  } catch (Billy_Exception $e) {
116
  BillysBilling_Invoicer_Helper_Data::printError($e, "Error occurred on invoice creation.");
117
  }
118
+ if ($response->success) {
119
+ $payment = array(
120
+ "paidDate" => $date,
121
+ "accountId" => $this->bankAccountId,
122
+ "amount" => $order->getTotalPaid(),
123
+ "invoiceIds" => array(
124
+ $response->id
125
+ )
126
+ );
127
+ if ($this->testMode) {
128
+ return $this->client->fakePost(Mage::getBaseDir() . "/tests/output.log", "payments", $payment);
129
+ }
130
+ return $this->client->post("payments", $payment);
131
+ }
132
+ return $response;
133
  }
134
 
135
  /**
app/code/community/BillysBilling/Invoicer/etc/config.xml CHANGED
@@ -1,7 +1,7 @@
1
  <config>
2
  <modules>
3
  <BillysBilling_Invoicer>
4
- <version>1.0.0</version>
5
  </BillysBilling_Invoicer>
6
  </modules>
7
  <global>
1
  <config>
2
  <modules>
3
  <BillysBilling_Invoicer>
4
+ <version>1.0.2</version>
5
  </BillysBilling_Invoicer>
6
  </modules>
7
  <global>
app/code/community/BillysBilling/Invoicer/etc/system.xml CHANGED
@@ -64,6 +64,15 @@
64
  <show_in_website>0</show_in_website>
65
  <show_in_store>0</show_in_store>
66
  </vat_model>
 
 
 
 
 
 
 
 
 
67
  </fields>
68
  </invoicer>
69
  </groups>
64
  <show_in_website>0</show_in_website>
65
  <show_in_store>0</show_in_store>
66
  </vat_model>
67
+ <bank_account translate="label">
68
+ <label>Bank Account</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>BillysBilling_Invoicer_Model_Accounts</source_model>
71
+ <sort_order>40</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>0</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </bank_account>
76
  </fields>
77
  </invoicer>
78
  </groups>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Billys_Billing_Invoicer</name>
4
- <version>1.0.1</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>
@@ -14,12 +14,12 @@
14
  &#xD;
15
  This extension has been testing with the latest releases of version 1.5, 1.6 and 1.7.&#xD;
16
  &#xD;
17
- When this extension has been installed, you should go to System Configuration and access the Billy's Billing configuration page. From here you enter an API key (you can get this from organization settings in Billy's Billing) and save the configuration. When this is done, you will be able to change the dropdown boxes for shipping product, sales account and VAT model. After they have been selected, you are ready to use the extension.</description>
18
- <notes>Added support for newer versions.</notes>
19
  <authors><author><name>Billy's Billing</name><user>billysbilling</user><email>michael@billysbilling.com</email></author></authors>
20
- <date>2013-04-03</date>
21
- <time>09:56:30</time>
22
- <contents><target name="magecommunity"><dir name="BillysBilling"><dir name="Invoicer"><dir name="Helper"><file name="Data.php" hash="2e73f30c86e3cb150b91856d2efeebf4"/></dir><dir name="Model"><file name="Accounts.php" hash="a6861ea516d74d199d52be6e4a8eeb1c"/><file name="Observer.php" hash="63da9b1b6c03202ecc2b3f0abe9496b9"/><file name="Products.php" hash="86953a3321a191587b6da1ab57626c53"/><file name="VatModels.php" hash="e87151fe22f857340476d1d4ebaeb31c"/><dir name="billysbilling-php"><dir name="Billy"><file name="Client.php" hash="b947948ae0063e2a121751782f44c751"/><file name="Exception.php" hash="239b2ecc8821b6e55faef561d0f3089c"/><file name="Request.php" hash="60d6c8d0661ff97cfc828cc785e7c942"/></dir><file name="bootstrap.php" hash="95d828828c4fdf4d338407f4a270c397"/><file name=".DS_Store" hash="ac8ffff9277a5c8cfaa12d9a1e52ef3e"/></dir><file name=".DS_Store" hash="e78a22cf29e6201ef29c5f0981c55604"/></dir><dir name="etc"><file name="config.xml" hash="1bbf2701ae5cd06789f24499b2ff65e7"/><file name="system.xml" hash="5bf923d3297151b518e5e484c9e36f2f"/></dir><file name=".DS_Store" hash="3fad5b10a22595598493fd98e0879784"/></dir><file name=".DS_Store" hash="099e78847f139a18fba02cd92135dd9a"/></dir></target><target name="mageetc"><dir name="modules"><file name="BillysBilling_Invoicer.xml" hash="4b11b30f403a358332323f04da27d1d4"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.3.0</min><max>5.4.13</max></php></required></dependencies>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Billys_Billing_Invoicer</name>
4
+ <version>1.0.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>
14
  &#xD;
15
  This extension has been testing with the latest releases of version 1.5, 1.6 and 1.7.&#xD;
16
  &#xD;
17
+ When this extension has been installed, you should go to System Configuration and access the Billy's Billing configuration page. From here you enter an API key (you can get this from organization settings in Billy's Billing) and save the configuration. When this is done, you will be able to change the dropdown boxes for shipping product, sales account, VAT model, and bank account. After they have been selected, you are ready to use the extension.</description>
18
+ <notes>Added support for sending payments along with invoices</notes>
19
  <authors><author><name>Billy's Billing</name><user>billysbilling</user><email>michael@billysbilling.com</email></author></authors>
20
+ <date>2013-04-04</date>
21
+ <time>14:20:38</time>
22
+ <contents><target name="magecommunity"><dir name="BillysBilling"><dir name="Invoicer"><dir name="Helper"><file name="Data.php" hash="2e73f30c86e3cb150b91856d2efeebf4"/></dir><dir name="Model"><file name="Accounts.php" hash="a6861ea516d74d199d52be6e4a8eeb1c"/><file name="Observer.php" hash="1da721ce910f738efe3b257e719bfdfd"/><file name="Products.php" hash="86953a3321a191587b6da1ab57626c53"/><file name="VatModels.php" hash="e87151fe22f857340476d1d4ebaeb31c"/><dir name="billysbilling-php"><dir name="Billy"><file name="Client.php" hash="b947948ae0063e2a121751782f44c751"/><file name="Exception.php" hash="239b2ecc8821b6e55faef561d0f3089c"/><file name="Request.php" hash="60d6c8d0661ff97cfc828cc785e7c942"/></dir><file name="bootstrap.php" hash="95d828828c4fdf4d338407f4a270c397"/><file name=".DS_Store" hash="ac8ffff9277a5c8cfaa12d9a1e52ef3e"/></dir><file name=".DS_Store" hash="e78a22cf29e6201ef29c5f0981c55604"/></dir><dir name="etc"><file name="config.xml" hash="6e6e43879755df280715e65b68483775"/><file name="system.xml" hash="241330951b933b6283bd6869541db5dc"/></dir><file name=".DS_Store" hash="3fad5b10a22595598493fd98e0879784"/></dir><file name=".DS_Store" hash="099e78847f139a18fba02cd92135dd9a"/></dir></target><target name="mageetc"><dir name="modules"><file name="BillysBilling_Invoicer.xml" hash="4b11b30f403a358332323f04da27d1d4"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.3.0</min><max>5.4.13</max></php></required></dependencies>
25
  </package>