auto-invoice-free-extension - Version 1.0.9

Version Notes

- fix bugs with paypal and credit card payment method

Download this release

Release Info

Developer Bss Commerce
Extension auto-invoice-free-extension
Version 1.0.9
Comparing to
See all releases


Code changes from version 1.0.8 to 1.0.9

app/code/community/Bss/Autoinvoice/Helper/Data.php CHANGED
@@ -25,9 +25,6 @@
25
  * @copyright Copyright (c) 2014-2016 BssCommerce Co. (http://bsscommerce.com)
26
  * @license http://bsscommerce.com/Bss-Commerce-License.txt
27
  */
28
- ?>
29
-
30
- <?php
31
  class Bss_Autoinvoice_Helper_Data extends Mage_Core_Helper_Abstract {
32
- public function data() {}
33
  }
25
  * @copyright Copyright (c) 2014-2016 BssCommerce Co. (http://bsscommerce.com)
26
  * @license http://bsscommerce.com/Bss-Commerce-License.txt
27
  */
 
 
 
28
  class Bss_Autoinvoice_Helper_Data extends Mage_Core_Helper_Abstract {
29
+
30
  }
app/code/community/Bss/Autoinvoice/Model/Observer.php CHANGED
@@ -1,4 +1,3 @@
1
- <?php ob_start(); ?>
2
  <?php
3
  /**
4
  * BssCommerce Co.
@@ -26,9 +25,6 @@
26
  * @copyright Copyright (c) 2014-2016 BssCommerce Co. (http://bsscommerce.com)
27
  * @license http://bsscommerce.com/Bss-Commerce-License.txt
28
  */
29
- ?>
30
-
31
- <?php
32
  class Bss_Autoinvoice_Model_Observer {
33
  /* @var Magento_Sales_Model_Order_Invoice */
34
  public $_invoice;
@@ -106,4 +102,5 @@ class Bss_Autoinvoice_Model_Observer {
106
 
107
  return $this;
108
  }
 
109
  }
 
1
  <?php
2
  /**
3
  * BssCommerce Co.
25
  * @copyright Copyright (c) 2014-2016 BssCommerce Co. (http://bsscommerce.com)
26
  * @license http://bsscommerce.com/Bss-Commerce-License.txt
27
  */
 
 
 
28
  class Bss_Autoinvoice_Model_Observer {
29
  /* @var Magento_Sales_Model_Order_Invoice */
30
  public $_invoice;
102
 
103
  return $this;
104
  }
105
+
106
  }
app/code/community/Bss/Autoinvoice/Model/Order/Payment.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BssCommerce Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://bsscommerce.com/Bss-Commerce-License.txt
11
+ *
12
+ * =================================================================
13
+ * MAGENTO EDITION USAGE NOTICE
14
+ * =================================================================
15
+ * This package designed for Magento COMMUNITY edition
16
+ * BssCommerce does not guarantee correct work of this extension
17
+ * on any other Magento edition except Magento COMMUNITY edition.
18
+ * BssCommerce does not provide extension support in case of
19
+ * incorrect edition usage.
20
+ * =================================================================
21
+ *
22
+ * @category BSS
23
+ * @package Bss_Autoinvoice
24
+ * @author Trung <kiutisuperking@gmail.com>
25
+ * @copyright Copyright (c) 2014-2016 BssCommerce Co. (http://bsscommerce.com)
26
+ * @license http://bsscommerce.com/Bss-Commerce-License.txt
27
+ */
28
+ class Bss_Autoinvoice_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
29
+ {
30
+ public function capture($invoice)
31
+ {
32
+ if(Mage::getStoreConfig('autoinvoice/settings/active') && Mage::getStoreConfig('autoinvoice/settings/invoice')) {
33
+ $payment = $this->getOrder()->getPayment()->getMethodInstance()->getCode();
34
+ if(!in_array($payment,explode(',',Mage::getStoreConfig('autoinvoice/settings/payment_methods'))) ) {
35
+ return $this;
36
+ }
37
+ }
38
+
39
+ if (is_null($invoice)) {
40
+ $invoice = $this->_invoice();
41
+ $this->setCreatedInvoice($invoice);
42
+ return $this; // @see Mage_Sales_Model_Order_Invoice::capture()
43
+ }
44
+
45
+ $amountToCapture = $this->_formatAmount($invoice->getBaseGrandTotal());
46
+ $order = $this->getOrder();
47
+
48
+ // prepare parent transaction and its amount
49
+ $paidWorkaround = 0;
50
+ if (!$invoice->wasPayCalled()) {
51
+ $paidWorkaround = (float)$amountToCapture;
52
+ }
53
+ $this->_isCaptureFinal($paidWorkaround);
54
+
55
+ $this->_generateTransactionId(
56
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE,
57
+ $this->getAuthorizationTransaction()
58
+ );
59
+
60
+ Mage::dispatchEvent('sales_order_payment_capture', array('payment' => $this, 'invoice' => $invoice));
61
+
62
+ /**
63
+ * Fetch an update about existing transaction. It can determine whether the transaction can be paid
64
+ * Capture attempt will happen only when invoice is not yet paid and the transaction can be paid
65
+ */
66
+ if ($invoice->getTransactionId()) {
67
+ $this->getMethodInstance()
68
+ ->setStore($order->getStoreId())
69
+ ->fetchTransactionInfo($this, $invoice->getTransactionId());
70
+ }
71
+ $status = true;
72
+ if (!$invoice->getIsPaid() && !$this->getIsTransactionPending()) {
73
+ // attempt to capture: this can trigger "is_transaction_pending"
74
+ $this->getMethodInstance()->setStore($order->getStoreId())->capture($this, $amountToCapture);
75
+
76
+ $transaction = $this->_addTransaction(
77
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE,
78
+ $invoice,
79
+ true
80
+ );
81
+
82
+ if ($this->getIsTransactionPending()) {
83
+ $message = Mage::helper('sales')->__('Capturing amount of %s is pending approval on gateway.', $this->_formatPrice($amountToCapture));
84
+ $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
85
+ if ($this->getIsFraudDetected()) {
86
+ $status = Mage_Sales_Model_Order::STATUS_FRAUD;
87
+ }
88
+ $invoice->setIsPaid(false);
89
+ } else { // normal online capture: invoice is marked as "paid"
90
+ $message = Mage::helper('sales')->__('Captured amount of %s online.', $this->_formatPrice($amountToCapture));
91
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
92
+ $invoice->setIsPaid(true);
93
+ $this->_updateTotals(array('base_amount_paid_online' => $amountToCapture));
94
+ }
95
+ if ($order->isNominal()) {
96
+ $message = $this->_prependMessage(Mage::helper('sales')->__('Nominal order registered.'));
97
+ } else {
98
+ $message = $this->_prependMessage($message);
99
+ $message = $this->_appendTransactionToMessage($transaction, $message);
100
+ }
101
+ $order->setState($state, $status, $message);
102
+ $this->getMethodInstance()->processInvoice($invoice, $this); // should be deprecated
103
+ return $this;
104
+ }
105
+ Mage::throwException(
106
+ Mage::helper('sales')->__('The transaction "%s" cannot be captured yet.', $invoice->getTransactionId())
107
+ );
108
+ }
109
+ }
app/code/community/Bss/Autoinvoice/etc/config.xml CHANGED
@@ -30,7 +30,7 @@
30
  <config>
31
  <modules>
32
  <Bss_Autoinvoice>
33
- <version>1.0.8</version>
34
  </Bss_Autoinvoice>
35
  </modules>
36
  <global>
@@ -38,6 +38,11 @@
38
  <bss_autoinvoice>
39
  <class>Bss_Autoinvoice_Model</class>
40
  </bss_autoinvoice>
 
 
 
 
 
41
  </models>
42
  <helpers>
43
  <autoinvoice>
30
  <config>
31
  <modules>
32
  <Bss_Autoinvoice>
33
+ <version>1.0.9</version>
34
  </Bss_Autoinvoice>
35
  </modules>
36
  <global>
38
  <bss_autoinvoice>
39
  <class>Bss_Autoinvoice_Model</class>
40
  </bss_autoinvoice>
41
+ <sales>
42
+ <rewrite>
43
+ <order_payment>Bss_Autoinvoice_Model_Order_Payment</order_payment>
44
+ </rewrite>
45
+ </sales>
46
  </models>
47
  <helpers>
48
  <autoinvoice>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>auto-invoice-free-extension</name>
4
- <version>1.0.8</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -12,14 +12,11 @@
12
  - Enable automatic invoice and shipment generation based on payment methods.&#xD;
13
  - Automatically create and change order status.&#xD;
14
  - Send invoice e-mail to customer.</description>
15
- <notes>New Released:&#xD;
16
- - Enable automatic invoice and shipment generation based on payment methods.&#xD;
17
- - Automatically create and change order status.&#xD;
18
- - Send invoice e-mail to customer.</notes>
19
  <authors><author><name>Bss Commerce</name><user>Nguyen</user><email>support@bsscommerce.com</email></author></authors>
20
  <date>2016-03-28</date>
21
- <time>03:10:58</time>
22
- <contents><target name="magecommunity"><dir name="Bss"><dir name="Autoinvoice"><dir name="Helper"><file name="Data.php" hash="8ce5939b6474072e209331e0f6977515"/></dir><dir name="Model"><file name="Observer.php" hash="f38e0bad2741e029263953f6fdacad45"/></dir><dir name="etc"><file name="config.xml" hash="2ffa6736fc56b0c7c8a28fac15da16ce"/><file name="system.xml" hash="019d677c196419846d7b3b95d0e6c5d4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bss_Autoinvoice.xml" hash="fea148ebae4c57b86273790f57423702"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>4.0.0</min><max>7.0.3</max></php></required></dependencies>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>auto-invoice-free-extension</name>
4
+ <version>1.0.9</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
12
  - Enable automatic invoice and shipment generation based on payment methods.&#xD;
13
  - Automatically create and change order status.&#xD;
14
  - Send invoice e-mail to customer.</description>
15
+ <notes>- fix bugs with paypal and credit card payment method</notes>
 
 
 
16
  <authors><author><name>Bss Commerce</name><user>Nguyen</user><email>support@bsscommerce.com</email></author></authors>
17
  <date>2016-03-28</date>
18
+ <time>08:17:02</time>
19
+ <contents><target name="magecommunity"><dir name="Bss"><dir name="Autoinvoice"><dir name="Helper"><file name="Data.php" hash="69b4eaeb4e1eda64f89acde46b731b82"/></dir><dir name="Model"><file name="Observer.php" hash="d7ee3089bfa9a9efc09ee082d9496434"/><dir name="Order"><file name="Payment.php" hash="514bd7e4143a08f3331178fa457f86ae"/></dir></dir><dir name="etc"><file name="config.xml" hash="c03ec04a8948268e1c54a6df9b7b02fc"/><file name="system.xml" hash="019d677c196419846d7b3b95d0e6c5d4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bss_Autoinvoice.xml" hash="fea148ebae4c57b86273790f57423702"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>4.0.0</min><max>7.0.3</max></php></required></dependencies>
22
  </package>