Version Notes
Change Log:
* Change order status on Notification
* HC-173 Notification awaiting dispatch of goods
* HC-173 Log all parameters for notification request
* HC-211 Inbound notification sent to PBF
* HC-212 Configurable product isProductEligible price
* HC-213 Shipping price is inconsistent with different Tax settings than default
* Finance Available from: exit the loop at 30 to avoid long page load times on large collections.
* Rounding issues because the price is stored as float
* HC-200 Address flag disabled
Download this release
Release Info
Developer | Sandor Czettner |
Extension | HC_PayByFinance |
Version | 1.0.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.5.2 to 1.0.5.3
- app/code/local/HC/PayByFinance/Block/Adminhtml/Version.php +1 -1
- app/code/local/HC/PayByFinance/Helper/Cart.php +1 -1
- app/code/local/HC/PayByFinance/Helper/Data.php +3 -2
- app/code/local/HC/PayByFinance/Helper/Notification.php +29 -12
- app/code/local/HC/PayByFinance/Model/Calculator.php +4 -2
- app/code/local/HC/PayByFinance/Model/Observer.php +74 -3
- app/code/local/HC/PayByFinance/Model/Sales/Order/Creditmemo/Financeamount.php +4 -2
- app/code/local/HC/PayByFinance/Model/Sales/Order/Invoice/Financeamount.php +4 -2
- app/code/local/HC/PayByFinance/Model/Sales/Quote/Financeamount.php +1 -1
- app/code/local/HC/PayByFinance/Model/Sales/Quote/Totalcost.php +2 -2
- app/code/local/HC/PayByFinance/Model/Sessionobserver.php +1 -1
- app/code/local/HC/PayByFinance/controllers/CheckoutController.php +3 -3
- app/code/local/HC/PayByFinance/controllers/NotificationController.php +5 -0
- app/code/local/HC/PayByFinance/etc/config.xml +18 -1
- app/code/local/HC/PayByFinance/etc/system.xml +6 -12
- app/design/frontend/base/default/layout/paybyfinance.xml +2 -0
- package.xml +14 -6
app/code/local/HC/PayByFinance/Block/Adminhtml/Version.php
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
*/
|
29 |
class HC_PayByFinance_Block_Adminhtml_Version extends Mage_Adminhtml_Block_Template
|
30 |
{
|
31 |
-
const PATCH_LEVEL =
|
32 |
|
33 |
protected $_template = "paybyfinance/version.phtml";
|
34 |
|
28 |
*/
|
29 |
class HC_PayByFinance_Block_Adminhtml_Version extends Mage_Adminhtml_Block_Template
|
30 |
{
|
31 |
+
const PATCH_LEVEL = 3;
|
32 |
|
33 |
protected $_template = "paybyfinance/version.phtml";
|
34 |
|
app/code/local/HC/PayByFinance/Helper/Cart.php
CHANGED
@@ -66,7 +66,7 @@ class HC_PayByFinance_Helper_Cart extends Mage_Core_Helper_Data
|
|
66 |
|
67 |
$shippingAddress = Mage::getModel('checkout/cart')->getQuote()->getShippingAddress();
|
68 |
if (Mage::getStoreConfig($helper::XML_PATH_INCLUDE_SHIPPING)) {
|
69 |
-
$additional += $shippingAddress->
|
70 |
}
|
71 |
$additional += $shippingAddress->getDiscountAmount();
|
72 |
$additional -= $shippingAddress->getGiftCardsAmount();
|
66 |
|
67 |
$shippingAddress = Mage::getModel('checkout/cart')->getQuote()->getShippingAddress();
|
68 |
if (Mage::getStoreConfig($helper::XML_PATH_INCLUDE_SHIPPING)) {
|
69 |
+
$additional += $shippingAddress->getShippingInclTax();
|
70 |
}
|
71 |
$additional += $shippingAddress->getDiscountAmount();
|
72 |
$additional -= $shippingAddress->getGiftCardsAmount();
|
app/code/local/HC/PayByFinance/Helper/Data.php
CHANGED
@@ -35,7 +35,6 @@ class HC_PayByFinance_Helper_Data extends Mage_Core_Helper_Data
|
|
35 |
const XML_PATH_INCLUDE_SHIPPING = 'hc_paybyfinance/general/include_shipping';
|
36 |
const XML_PATH_ADDRESS_CHECKED = 'hc_paybyfinance/general/address_checked';
|
37 |
const XML_PATH_WIZARD = 'hc_paybyfinance/general/wizard';
|
38 |
-
const XML_PATH_PROCESS_ORDER = 'hc_paybyfinance/general/process_order';
|
39 |
const XML_PATH_STATUS_ACCEPTED = 'hc_paybyfinance/order_status/accepted';
|
40 |
const XML_PATH_STATUS_REFERRED = 'hc_paybyfinance/order_status/referred';
|
41 |
const XML_PATH_STATUS_DECLINED = 'hc_paybyfinance/order_status/declined';
|
@@ -157,8 +156,10 @@ class HC_PayByFinance_Helper_Data extends Mage_Core_Helper_Data
|
|
157 |
|| $item instanceof Mage_Sales_Model_Order_Item
|
158 |
) {
|
159 |
$product = $item->getProduct();
|
|
|
160 |
} elseif ($item instanceof Mage_Catalog_Model_Product) {
|
161 |
$product = $item;
|
|
|
162 |
}
|
163 |
|
164 |
if ($product->getPaybyfinanceEnable() == $options::VALUES_DISABLE) {
|
@@ -182,7 +183,7 @@ class HC_PayByFinance_Helper_Data extends Mage_Core_Helper_Data
|
|
182 |
return false;
|
183 |
}
|
184 |
$minPriceProduct = Mage::getStoreConfig($helper::XML_PATH_MINIMUM_PRICE_PRODUCT);
|
185 |
-
if ($
|
186 |
return false;
|
187 |
}
|
188 |
|
35 |
const XML_PATH_INCLUDE_SHIPPING = 'hc_paybyfinance/general/include_shipping';
|
36 |
const XML_PATH_ADDRESS_CHECKED = 'hc_paybyfinance/general/address_checked';
|
37 |
const XML_PATH_WIZARD = 'hc_paybyfinance/general/wizard';
|
|
|
38 |
const XML_PATH_STATUS_ACCEPTED = 'hc_paybyfinance/order_status/accepted';
|
39 |
const XML_PATH_STATUS_REFERRED = 'hc_paybyfinance/order_status/referred';
|
40 |
const XML_PATH_STATUS_DECLINED = 'hc_paybyfinance/order_status/declined';
|
156 |
|| $item instanceof Mage_Sales_Model_Order_Item
|
157 |
) {
|
158 |
$product = $item->getProduct();
|
159 |
+
$price = $item->getPrice();
|
160 |
} elseif ($item instanceof Mage_Catalog_Model_Product) {
|
161 |
$product = $item;
|
162 |
+
$price = $product->getFinalPrice();
|
163 |
}
|
164 |
|
165 |
if ($product->getPaybyfinanceEnable() == $options::VALUES_DISABLE) {
|
183 |
return false;
|
184 |
}
|
185 |
$minPriceProduct = Mage::getStoreConfig($helper::XML_PATH_MINIMUM_PRICE_PRODUCT);
|
186 |
+
if ($price < $minPriceProduct) {
|
187 |
return false;
|
188 |
}
|
189 |
|
app/code/local/HC/PayByFinance/Helper/Notification.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
class HC_PayByFinance_Helper_Notification extends Mage_Core_Helper_Data
|
30 |
{
|
31 |
|
32 |
-
|
33 |
'PENDING' => 'An Application decision has not yet been reached.',
|
34 |
'ACCEPT' => 'The application has been accepted.',
|
35 |
'DECLINE' => 'The application has been declined.',
|
@@ -94,17 +94,34 @@ class HC_PayByFinance_Helper_Notification extends Mage_Core_Helper_Data
|
|
94 |
$orderState = $orderStatus = Mage_Sales_Model_Order::STATE_CANCELED;
|
95 |
}
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
$message = "<strong>Hitachi Capital Pay By Finance"
|
29 |
class HC_PayByFinance_Helper_Notification extends Mage_Core_Helper_Data
|
30 |
{
|
31 |
|
32 |
+
protected $statuses = array(
|
33 |
'PENDING' => 'An Application decision has not yet been reached.',
|
34 |
'ACCEPT' => 'The application has been accepted.',
|
35 |
'DECLINE' => 'The application has been declined.',
|
94 |
$orderState = $orderStatus = Mage_Sales_Model_Order::STATE_CANCELED;
|
95 |
}
|
96 |
|
97 |
+
switch ($status) {
|
98 |
+
case 'ACCEPT':
|
99 |
+
case 'CONDITIONAL_ACCEPT':
|
100 |
+
if (array_key_exists('goodsDispatched', $parameters)
|
101 |
+
&& $parameters['goodsDispatched'] == 'N'
|
102 |
+
) {
|
103 |
+
$message .= ' Awaiting dispatch of goods. authorisationNumber: '
|
104 |
+
. $parameters['authorisationNumber'];
|
105 |
+
$orderState = $orderStatus = Mage_Sales_Model_Order::STATE_PROCESSING;
|
106 |
+
$order->setTotalPaid(
|
107 |
+
$order->getTotalPaid() + abs($order->getFinanceAmount())
|
108 |
+
);
|
109 |
+
$order->setBaseTotalPaid(
|
110 |
+
$order->getBaseTotalPaid() + abs($order->getFinanceAmount())
|
111 |
+
);
|
112 |
+
} else {
|
113 |
+
$orderStatus = Mage::getStoreConfig($helper::XML_PATH_STATUS_ACCEPTED);
|
114 |
+
}
|
115 |
+
break;
|
116 |
+
case 'DECLINE':
|
117 |
+
$orderStatus = Mage::getStoreConfig($helper::XML_PATH_STATUS_DECLINED);
|
118 |
+
break;
|
119 |
+
case 'REFER':
|
120 |
+
$orderStatus = Mage::getStoreConfig($helper::XML_PATH_STATUS_REFERRED);
|
121 |
+
break;
|
122 |
+
case 'FATAL_ERROR':
|
123 |
+
$orderStatus = Mage::getStoreConfig($helper::XML_PATH_STATUS_ERROR);
|
124 |
+
break;
|
125 |
}
|
126 |
|
127 |
$message = "<strong>Hitachi Capital Pay By Finance"
|
app/code/local/HC/PayByFinance/Model/Calculator.php
CHANGED
@@ -133,7 +133,9 @@ class HC_PayByFinance_Model_Calculator extends Varien_Object
|
|
133 |
$depositAmount = ($amount - $discount - $giftcard) * ($deposit / 100);
|
134 |
$depositAmount = round($depositAmount, 2);
|
135 |
$financeAmount = $amount - $depositAmount - $discount - $giftcard;
|
136 |
-
|
|
|
|
|
137 |
|
138 |
if ($service->getType() == 32) {
|
139 |
$monthlyPayment = $this->calcMonthlyPaymentInterestFree($financeAmount);
|
@@ -179,7 +181,7 @@ class HC_PayByFinance_Model_Calculator extends Varien_Object
|
|
179 |
$depositAmount = ($price) * ($service->getDeposit() / 100);
|
180 |
$depositAmount = round($depositAmount, 2);
|
181 |
$financeAmount = $price - $depositAmount;
|
182 |
-
$financeAmount =
|
183 |
|
184 |
if ($service->getType() == 32) {
|
185 |
$installment = $this->calcMonthlyPaymentInterestFree($financeAmount, $service);
|
133 |
$depositAmount = ($amount - $discount - $giftcard) * ($deposit / 100);
|
134 |
$depositAmount = round($depositAmount, 2);
|
135 |
$financeAmount = $amount - $depositAmount - $discount - $giftcard;
|
136 |
+
// Rounding issues workaround: convert to string first.
|
137 |
+
// Note it would be better to use BCMath as an additional dependency.
|
138 |
+
$financeAmount = intval((string) ($financeAmount * 100)) / 100;
|
139 |
|
140 |
if ($service->getType() == 32) {
|
141 |
$monthlyPayment = $this->calcMonthlyPaymentInterestFree($financeAmount);
|
181 |
$depositAmount = ($price) * ($service->getDeposit() / 100);
|
182 |
$depositAmount = round($depositAmount, 2);
|
183 |
$financeAmount = $price - $depositAmount;
|
184 |
+
$financeAmount = intval((string) ($financeAmount * 100)) / 100;
|
185 |
|
186 |
if ($service->getType() == 32) {
|
187 |
$installment = $this->calcMonthlyPaymentInterestFree($financeAmount, $service);
|
app/code/local/HC/PayByFinance/Model/Observer.php
CHANGED
@@ -67,7 +67,7 @@ class HC_PayByFinance_Model_Observer
|
|
67 |
$helper::XML_PATH_INCLUDE_SHIPPING
|
68 |
);
|
69 |
if ($includeShipping) {
|
70 |
-
$shippingCost = $
|
71 |
$eligibleAmount += $shippingCost;
|
72 |
}
|
73 |
|
@@ -98,7 +98,7 @@ class HC_PayByFinance_Model_Observer
|
|
98 |
*
|
99 |
* @return void
|
100 |
*/
|
101 |
-
public function
|
102 |
{
|
103 |
$quoteItem = $observer->getQuoteItem();
|
104 |
$product = $observer->getProduct();
|
@@ -130,6 +130,71 @@ class HC_PayByFinance_Model_Observer
|
|
130 |
$order->save();
|
131 |
}
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
/**
|
134 |
* Checkout success event to redirect to Hitachi
|
135 |
*
|
@@ -228,15 +293,21 @@ class HC_PayByFinance_Model_Observer
|
|
228 |
$helper = Mage::helper('paybyfinance');
|
229 |
$calculator = Mage::getModel('paybyfinance/calculator');
|
230 |
|
|
|
231 |
$collection = $observer->getCollection();
|
232 |
-
|
233 |
foreach ($collection as $product) {
|
|
|
|
|
|
|
|
|
234 |
if ($helper->isProductEligible($product)) {
|
235 |
$product->setData('has_finance', true);
|
236 |
$minInstallment = $calculator->getLowestMonthlyInstallment($product->getPrice());
|
237 |
$product->setData('finance_from_price', $minInstallment);
|
238 |
}
|
239 |
}
|
|
|
240 |
}
|
241 |
|
242 |
}
|
67 |
$helper::XML_PATH_INCLUDE_SHIPPING
|
68 |
);
|
69 |
if ($includeShipping) {
|
70 |
+
$shippingCost = $order->getShippingInclTax();
|
71 |
$eligibleAmount += $shippingCost;
|
72 |
}
|
73 |
|
98 |
*
|
99 |
* @return void
|
100 |
*/
|
101 |
+
public function salesQuoteItemSetPaybyfinanceEnable($observer)
|
102 |
{
|
103 |
$quoteItem = $observer->getQuoteItem();
|
104 |
$product = $observer->getProduct();
|
130 |
$order->save();
|
131 |
}
|
132 |
|
133 |
+
/**
|
134 |
+
* Sending inbound notification as documented in Section 3 of the specs.
|
135 |
+
*
|
136 |
+
* @param Varien_Event_Observer $observer Observer object
|
137 |
+
*
|
138 |
+
* @return void
|
139 |
+
*/
|
140 |
+
public function orderShipmentAfterSave(Varien_Event_Observer $observer)
|
141 |
+
{
|
142 |
+
$order = $observer->getEvent()->getShipment()->getOrder();
|
143 |
+
$applicationNo = $order->getFinanceApplicationNo();
|
144 |
+
if (empty($applicationNo)) {
|
145 |
+
return;
|
146 |
+
} else {
|
147 |
+
$this->inboundNotification($order, 'G');
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Send inbound notification when order is cancelled. Section 3 of the specs.
|
153 |
+
*
|
154 |
+
* @param Varien_Event_Observer $observer Observer object
|
155 |
+
*
|
156 |
+
* @return void
|
157 |
+
*/
|
158 |
+
public function orderPaymentCancel(Varien_Event_Observer $observer)
|
159 |
+
{
|
160 |
+
$order = $observer->getPayment()->getOrder();
|
161 |
+
$applicationNo = $order->getFinanceApplicationNo();
|
162 |
+
if (empty($applicationNo)) {
|
163 |
+
return;
|
164 |
+
} else {
|
165 |
+
$this->inboundNotification($order, 'C');
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Inbound notification to be used from the above functions
|
171 |
+
*
|
172 |
+
* @param Mage_Sales_Model_Order $order Order
|
173 |
+
* @param string $status 'G' or 'C'
|
174 |
+
*
|
175 |
+
* @return void
|
176 |
+
*/
|
177 |
+
protected function inboundNotification($order, $status)
|
178 |
+
{
|
179 |
+
$applicationNo = $order->getFinanceApplicationNo();
|
180 |
+
$helper = Mage::helper('paybyfinance');
|
181 |
+
$data = array(
|
182 |
+
'status' => $status,
|
183 |
+
'applicationNo' => $order->getFinanceApplicationNo(),
|
184 |
+
);
|
185 |
+
$post = Mage::getModel('paybyfinance/post');
|
186 |
+
$post->setPostAdapter(Mage::getStoreConfig($helper::XML_PATH_CONNECTION_MODE));
|
187 |
+
|
188 |
+
$post->setNotificationData($data);
|
189 |
+
$response = $post->post();
|
190 |
+
$helper->log(
|
191 |
+
'Inbound notification for order: ' . $order->getId() . "\n"
|
192 |
+
. $helper->arrayDump($post->getPostAdapter()->getPostData()) . "\n"
|
193 |
+
. 'Response: ' . $response,
|
194 |
+
'post'
|
195 |
+
);
|
196 |
+
}
|
197 |
+
|
198 |
/**
|
199 |
* Checkout success event to redirect to Hitachi
|
200 |
*
|
293 |
$helper = Mage::helper('paybyfinance');
|
294 |
$calculator = Mage::getModel('paybyfinance/calculator');
|
295 |
|
296 |
+
Varien_Profiler::start('hc_paybyfinance_collection_load_after');
|
297 |
$collection = $observer->getCollection();
|
298 |
+
$count = 0;
|
299 |
foreach ($collection as $product) {
|
300 |
+
// Exit the loop at 30 to avoid long page load times on large collections.
|
301 |
+
if ($count++ > 30) {
|
302 |
+
break;
|
303 |
+
}
|
304 |
if ($helper->isProductEligible($product)) {
|
305 |
$product->setData('has_finance', true);
|
306 |
$minInstallment = $calculator->getLowestMonthlyInstallment($product->getPrice());
|
307 |
$product->setData('finance_from_price', $minInstallment);
|
308 |
}
|
309 |
}
|
310 |
+
Varien_Profiler::stop('hc_paybyfinance_collection_load_after');
|
311 |
}
|
312 |
|
313 |
}
|
app/code/local/HC/PayByFinance/Model/Sales/Order/Creditmemo/Financeamount.php
CHANGED
@@ -54,9 +54,11 @@ class HC_PayByFinance_Model_Sales_Order_Creditmemo_FInanceamount
|
|
54 |
$creditmemo->setFinanceAmount($amount);
|
55 |
$creditmemo->setBaseFinanceAmount($order->getBaseFinanceAmount());
|
56 |
|
57 |
-
$creditmemo->setGrandTotal(
|
|
|
|
|
58 |
$creditmemo->setBaseGrandTotal(
|
59 |
-
$creditmemo->getBaseGrandTotal()
|
60 |
);
|
61 |
|
62 |
return $this;
|
54 |
$creditmemo->setFinanceAmount($amount);
|
55 |
$creditmemo->setBaseFinanceAmount($order->getBaseFinanceAmount());
|
56 |
|
57 |
+
$creditmemo->setGrandTotal(
|
58 |
+
$creditmemo->getGrandTotal() - abs($creditmemo->getFinanceAmount())
|
59 |
+
);
|
60 |
$creditmemo->setBaseGrandTotal(
|
61 |
+
$creditmemo->getBaseGrandTotal() - abs($creditmemo->getBaseFinanceAmount())
|
62 |
);
|
63 |
|
64 |
return $this;
|
app/code/local/HC/PayByFinance/Model/Sales/Order/Invoice/Financeamount.php
CHANGED
@@ -54,9 +54,11 @@ class HC_PayByFinance_Model_Sales_Order_Invoice_Financeamount
|
|
54 |
$invoice->setFinanceAmount($amount);
|
55 |
$invoice->setBaseFinanceAmount($order->getBaseFinanceAmount());
|
56 |
|
57 |
-
$invoice->setGrandTotal(
|
|
|
|
|
58 |
$invoice->setBaseGrandTotal(
|
59 |
-
$invoice->getBaseGrandTotal()
|
60 |
);
|
61 |
|
62 |
return $this;
|
54 |
$invoice->setFinanceAmount($amount);
|
55 |
$invoice->setBaseFinanceAmount($order->getBaseFinanceAmount());
|
56 |
|
57 |
+
$invoice->setGrandTotal(
|
58 |
+
$invoice->getGrandTotal() - abs($invoice->getFinanceAmount())
|
59 |
+
);
|
60 |
$invoice->setBaseGrandTotal(
|
61 |
+
$invoice->getBaseGrandTotal() - abs($invoice->getBaseFinanceAmount())
|
62 |
);
|
63 |
|
64 |
return $this;
|
app/code/local/HC/PayByFinance/Model/Sales/Quote/Financeamount.php
CHANGED
@@ -73,7 +73,7 @@ class HC_PayByFinance_Model_Sales_Quote_Financeamount
|
|
73 |
|
74 |
$shippingCost = 0;
|
75 |
if ($includeShipping) {
|
76 |
-
$shippingCost = $address->
|
77 |
}
|
78 |
|
79 |
|
73 |
|
74 |
$shippingCost = 0;
|
75 |
if ($includeShipping) {
|
76 |
+
$shippingCost = $address->getShippingInclTax();
|
77 |
}
|
78 |
|
79 |
|
app/code/local/HC/PayByFinance/Model/Sales/Quote/Totalcost.php
CHANGED
@@ -59,8 +59,8 @@ class HC_PayByFinance_Model_Sales_Quote_Totalcost
|
|
59 |
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
60 |
{
|
61 |
$session = Mage::getSingleton('paybyfinance/session');
|
62 |
-
$amount = $address->
|
63 |
-
+ $address->
|
64 |
+ $address->getDiscountAmount()
|
65 |
- $address->getGiftCardsAmount();
|
66 |
if ($session->getData('enabled') && $address->getAddressType() == 'shipping') {
|
59 |
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
60 |
{
|
61 |
$session = Mage::getSingleton('paybyfinance/session');
|
62 |
+
$amount = $address->getSubtotalInclTax()
|
63 |
+
+ $address->getShippingInclTax()
|
64 |
+ $address->getDiscountAmount()
|
65 |
- $address->getGiftCardsAmount();
|
66 |
if ($session->getData('enabled') && $address->getAddressType() == 'shipping') {
|
app/code/local/HC/PayByFinance/Model/Sessionobserver.php
CHANGED
@@ -55,7 +55,7 @@ class HC_PayByFinance_Model_Sessionobserver
|
|
55 |
$minAmount = $service->getMinAmount();
|
56 |
|
57 |
if ($includeShipping) {
|
58 |
-
$shippingCost = $address->
|
59 |
$eligibleAmount += $shippingCost;
|
60 |
}
|
61 |
|
55 |
$minAmount = $service->getMinAmount();
|
56 |
|
57 |
if ($includeShipping) {
|
58 |
+
$shippingCost = $address->getShippingInclTax();
|
59 |
$eligibleAmount += $shippingCost;
|
60 |
}
|
61 |
|
app/code/local/HC/PayByFinance/controllers/CheckoutController.php
CHANGED
@@ -55,7 +55,7 @@ class HC_PayByFinance_CheckoutController extends Mage_Core_Controller_Front_Acti
|
|
55 |
$includeShipping = Mage::getStoreConfig($helper::XML_PATH_INCLUDE_SHIPPING);
|
56 |
$shippingCost = 0;
|
57 |
if ($includeShipping) {
|
58 |
-
$shippingCost = $order->
|
59 |
}
|
60 |
$mode = Mage::getStoreConfig($helper::XML_PATH_CONNECTION_MODE);
|
61 |
|
@@ -84,8 +84,8 @@ class HC_PayByFinance_CheckoutController extends Mage_Core_Controller_Front_Acti
|
|
84 |
$productCount++;
|
85 |
}
|
86 |
|
87 |
-
if ($includeShipping && $order->
|
88 |
-
$shippingCost = $order->
|
89 |
$additionalItems++;
|
90 |
$productsInForm['gc' . ($productCount) ] = 'sc';
|
91 |
$productsInForm['pc' . ($productCount)] = 'sc';
|
55 |
$includeShipping = Mage::getStoreConfig($helper::XML_PATH_INCLUDE_SHIPPING);
|
56 |
$shippingCost = 0;
|
57 |
if ($includeShipping) {
|
58 |
+
$shippingCost = $order->getShippingInclTax();
|
59 |
}
|
60 |
$mode = Mage::getStoreConfig($helper::XML_PATH_CONNECTION_MODE);
|
61 |
|
84 |
$productCount++;
|
85 |
}
|
86 |
|
87 |
+
if ($includeShipping && $order->getShippingInclTax() > 0) {
|
88 |
+
$shippingCost = $order->getShippingInclTax();
|
89 |
$additionalItems++;
|
90 |
$productsInForm['gc' . ($productCount) ] = 'sc';
|
91 |
$productsInForm['pc' . ($productCount)] = 'sc';
|
app/code/local/HC/PayByFinance/controllers/NotificationController.php
CHANGED
@@ -60,6 +60,11 @@ class HC_PayByFinance_NotificationController extends Mage_Core_Controller_Front_
|
|
60 |
die();
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
$notificationHelper = Mage::helper('paybyfinance/notification');
|
64 |
$result = $notificationHelper->processOrder($order, $parameters);
|
65 |
|
60 |
die();
|
61 |
}
|
62 |
|
63 |
+
$helper->log(
|
64 |
+
'Notification for order: ' . $orderId . "\n" . $helper->arrayDump($parameters),
|
65 |
+
'notification'
|
66 |
+
);
|
67 |
+
|
68 |
$notificationHelper = Mage::helper('paybyfinance/notification');
|
69 |
$result = $notificationHelper->processOrder($order, $parameters);
|
70 |
|
app/code/local/HC/PayByFinance/etc/config.xml
CHANGED
@@ -175,6 +175,24 @@
|
|
175 |
</paybyfinance_salesordersaveObserver>
|
176 |
</observers>
|
177 |
</sales_order_save_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
<paypal_prepare_line_items>
|
179 |
<observers>
|
180 |
<hc_paypalpreparelineitemsObserver>
|
@@ -262,7 +280,6 @@
|
|
262 |
<include_shipping>1</include_shipping>
|
263 |
<address_checked>0</address_checked>
|
264 |
<wizard>0</wizard>
|
265 |
-
<process_order>PAID</process_order>
|
266 |
</general>
|
267 |
<order_status>
|
268 |
<accepted>finance_accepted</accepted>
|
175 |
</paybyfinance_salesordersaveObserver>
|
176 |
</observers>
|
177 |
</sales_order_save_after>
|
178 |
+
<sales_order_shipment_save_after>
|
179 |
+
<observers>
|
180 |
+
<paybyfinance_salesordershipmentsaveObserver>
|
181 |
+
<type>singleton</type>
|
182 |
+
<class>paybyfinance/observer</class>
|
183 |
+
<method>orderShipmentAfterSave</method>
|
184 |
+
</paybyfinance_salesordershipmentsaveObserver>
|
185 |
+
</observers>
|
186 |
+
</sales_order_shipment_save_after>
|
187 |
+
<sales_order_payment_cancel>
|
188 |
+
<observers>
|
189 |
+
<paybyfinance_salesorderCancel>
|
190 |
+
<type>singleton</type>
|
191 |
+
<class>paybyfinance/observer</class>
|
192 |
+
<method>orderPaymentCancel</method>
|
193 |
+
</paybyfinance_salesorderCancel>
|
194 |
+
</observers>
|
195 |
+
</sales_order_payment_cancel>
|
196 |
<paypal_prepare_line_items>
|
197 |
<observers>
|
198 |
<hc_paypalpreparelineitemsObserver>
|
280 |
<include_shipping>1</include_shipping>
|
281 |
<address_checked>0</address_checked>
|
282 |
<wizard>0</wizard>
|
|
|
283 |
</general>
|
284 |
<order_status>
|
285 |
<accepted>finance_accepted</accepted>
|
app/code/local/HC/PayByFinance/etc/system.xml
CHANGED
@@ -76,7 +76,11 @@
|
|
76 |
<show_in_website>1</show_in_website>
|
77 |
<show_in_store>1</show_in_store>
|
78 |
</include_shipping>
|
79 |
-
|
|
|
|
|
|
|
|
|
80 |
<label>Address checked</label>
|
81 |
<comment>
|
82 |
If enabled then this means that the e-tailer has checked the address
|
@@ -91,7 +95,7 @@
|
|
91 |
<show_in_default>1</show_in_default>
|
92 |
<show_in_website>1</show_in_website>
|
93 |
<show_in_store>1</show_in_store>
|
94 |
-
</address_checked
|
95 |
<wizard>
|
96 |
<label>Responsive credit wizard</label>
|
97 |
<comment>The credit wizard works well on all screen sizes, from mobile phones to desktops</comment>
|
@@ -102,16 +106,6 @@
|
|
102 |
<show_in_website>1</show_in_website>
|
103 |
<show_in_store>1</show_in_store>
|
104 |
</wizard>
|
105 |
-
<process_order>
|
106 |
-
<label>Process orders after received status</label>
|
107 |
-
<comment>Hitachi Capital sends statuses in notification, then this status will process the order</comment>
|
108 |
-
<frontend_type>select</frontend_type>
|
109 |
-
<source_model>paybyfinance/config_source_notification_status</source_model>
|
110 |
-
<sort_order>9</sort_order>
|
111 |
-
<show_in_default>1</show_in_default>
|
112 |
-
<show_in_website>1</show_in_website>
|
113 |
-
<show_in_store>1</show_in_store>
|
114 |
-
</process_order>
|
115 |
</fields>
|
116 |
</general>
|
117 |
<order_status>
|
76 |
<show_in_website>1</show_in_website>
|
77 |
<show_in_store>1</show_in_store>
|
78 |
</include_shipping>
|
79 |
+
<!-- This is on the roadmap and will require 3
|
80 |
+
additional fields to be added to the extension and the
|
81 |
+
eTailer shop before a Y can be passed to PBF. HC-200 -->
|
82 |
+
|
83 |
+
<!--address_checked translate="label">
|
84 |
<label>Address checked</label>
|
85 |
<comment>
|
86 |
If enabled then this means that the e-tailer has checked the address
|
95 |
<show_in_default>1</show_in_default>
|
96 |
<show_in_website>1</show_in_website>
|
97 |
<show_in_store>1</show_in_store>
|
98 |
+
</address_checked-->
|
99 |
<wizard>
|
100 |
<label>Responsive credit wizard</label>
|
101 |
<comment>The credit wizard works well on all screen sizes, from mobile phones to desktops</comment>
|
106 |
<show_in_website>1</show_in_website>
|
107 |
<show_in_store>1</show_in_store>
|
108 |
</wizard>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
</fields>
|
110 |
</general>
|
111 |
<order_status>
|
app/design/frontend/base/default/layout/paybyfinance.xml
CHANGED
@@ -4,10 +4,12 @@
|
|
4 |
<!-- Add this to your template in order to enable PBF template modifications -->
|
5 |
<!-- Or check the referenced templates and add the changes to your template -->
|
6 |
<!-- If you have any problems with the templates, comment out this section -->
|
|
|
7 |
<checkout_cart_index>
|
8 |
<reference name="checkout.cart">
|
9 |
<!-- Use setTemplate for Magento 1.8 and below -->
|
10 |
<action method="setTemplate"><value>checkout/cart-pbf.phtml</value></action>
|
|
|
11 |
<action method="setCartTemplate"><value>checkout/cart-pbf.phtml</value></action>
|
12 |
|
13 |
</reference>
|
4 |
<!-- Add this to your template in order to enable PBF template modifications -->
|
5 |
<!-- Or check the referenced templates and add the changes to your template -->
|
6 |
<!-- If you have any problems with the templates, comment out this section -->
|
7 |
+
<!-- to see how it behaves -->
|
8 |
<checkout_cart_index>
|
9 |
<reference name="checkout.cart">
|
10 |
<!-- Use setTemplate for Magento 1.8 and below -->
|
11 |
<action method="setTemplate"><value>checkout/cart-pbf.phtml</value></action>
|
12 |
+
<!-- Use setCartTemplate for Magento 1.9.0.1 and above -->
|
13 |
<action method="setCartTemplate"><value>checkout/cart-pbf.phtml</value></action>
|
14 |
|
15 |
</reference>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>HC_PayByFinance</name>
|
4 |
-
<version>1.0.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.healthywebsites.co.uk/license.html">Healthy Websites</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,19 @@
|
|
9 |
<summary>Hitachi Capital Pay By Finance</summary>
|
10 |
<description>Hitachi Capital Pay By Finance</description>
|
11 |
<notes>Change Log:
|
12 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<authors><author><name>Sandor Czettner</name><user>MAG000003395</user><email>support@healthywebsites.co.uk</email></author><author><name>Alistair Macneil</name><user>MAG000006529</user><email>support@healthywebsites.co.uk</email></author><author><name>Rhuaridh Clark</name><user>MAG002562063</user><email>support@healthywebsites.co.uk</email></author></authors>
|
14 |
-
<date>2015-06-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magelocal"><dir><dir name="HC"><dir name="PayByFinance"><dir name="Block"><dir name="Adminhtml"><dir name="Paybyfinance"><file name="Redirect.php" hash="b7aadc98068529d4fb08219a83b2e69b"/><dir name="Service"><dir name="Edit"><file name="Form.php" hash="19f94b6405f5ec45510022c5aff868c2"/><dir name="Tab"><file name="Form.php" hash="77316baf7e8d387037007b97067fff8b"/></dir><file name="Tabs.php" hash="5af9151c310841d8dd0b6f7e8f984625"/></dir><file name="Edit.php" hash="d73f958b0abaebff8aff703f650c5a01"/><file name="Grid.php" hash="38f482f561c0be60b8a7ac6f49e74df9"/></dir><file name="Service.php" hash="26112ba2733a9db951addfef4e0152e8"/></dir><file name="Version.php" hash="
|
17 |
<compatible/>
|
18 |
-
<dependencies><required><php><min>5.4.26</min><max>5.6.
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>HC_PayByFinance</name>
|
4 |
+
<version>1.0.5.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.healthywebsites.co.uk/license.html">Healthy Websites</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Hitachi Capital Pay By Finance</summary>
|
10 |
<description>Hitachi Capital Pay By Finance</description>
|
11 |
<notes>Change Log:
|
12 |
+
* Change order status on Notification
|
13 |
+
* HC-173 Notification awaiting dispatch of goods
|
14 |
+
* HC-173 Log all parameters for notification request
|
15 |
+
* HC-211 Inbound notification sent to PBF
|
16 |
+
* HC-212 Configurable product isProductEligible price
|
17 |
+
* HC-213 Shipping price is inconsistent with different Tax settings than default
|
18 |
+
* Finance Available from: exit the loop at 30 to avoid long page load times on large collections.
|
19 |
+
* Rounding issues because the price is stored as float
|
20 |
+
* HC-200 Address flag disabled</notes>
|
21 |
<authors><author><name>Sandor Czettner</name><user>MAG000003395</user><email>support@healthywebsites.co.uk</email></author><author><name>Alistair Macneil</name><user>MAG000006529</user><email>support@healthywebsites.co.uk</email></author><author><name>Rhuaridh Clark</name><user>MAG002562063</user><email>support@healthywebsites.co.uk</email></author></authors>
|
22 |
+
<date>2015-06-29</date>
|
23 |
+
<time>12:04:29</time>
|
24 |
+
<contents><target name="magelocal"><dir><dir name="HC"><dir name="PayByFinance"><dir name="Block"><dir name="Adminhtml"><dir name="Paybyfinance"><file name="Redirect.php" hash="b7aadc98068529d4fb08219a83b2e69b"/><dir name="Service"><dir name="Edit"><file name="Form.php" hash="19f94b6405f5ec45510022c5aff868c2"/><dir name="Tab"><file name="Form.php" hash="77316baf7e8d387037007b97067fff8b"/></dir><file name="Tabs.php" hash="5af9151c310841d8dd0b6f7e8f984625"/></dir><file name="Edit.php" hash="d73f958b0abaebff8aff703f650c5a01"/><file name="Grid.php" hash="38f482f561c0be60b8a7ac6f49e74df9"/></dir><file name="Service.php" hash="26112ba2733a9db951addfef4e0152e8"/></dir><file name="Version.php" hash="795735b46cabe7354fbfd7e38f3b9285"/></dir><dir name="Checkout"><file name="Redirect.php" hash="30f1cf1f682abc985e872619b67a86d7"/></dir><dir name="Product"><dir name="List"><file name="Finance.php" hash="a9dd554c1c95fc4c912f71ab3ac94d2c"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Totals.php" hash="1fe522dd0d6a4c890374b2602b840d3b"/></dir></dir><file name="Selector.php" hash="cec4b9a148b8b06458bddc03f3a7747d"/><file name="Status.php" hash="338f52aa781e3e7703862e180339a1aa"/></dir><dir name="Helper"><file name="Cart.php" hash="b26ae9571db19b3efea4a78e841d254c"/><file name="Checkout.php" hash="2e5c242b333cda10fa0993b036b9cbf4"/><file name="Data.php" hash="0991540aba6fad1638bd8482d3f6a7f4"/><file name="Notification.php" hash="c1274345f71edbf3e11de180704aaec2"/></dir><dir name="Model"><file name="Calculator.php" hash="3da169913ae3de9bf6c4128969fbb195"/><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Product"><file name="Finance.php" hash="68dfc0233403f61c82aa62009cdd2da7"/><file name="Type.php" hash="4494b3f46eddc7455e363281072df315"/></dir></dir><dir name="Cms"><file name="Block.php" hash="a4302b47926c40f480ea84f81420070f"/></dir><file name="Connectionmode.php" hash="a734e5ae89d3dd72ba80c97b358d3923"/><dir name="Notification"><file name="Status.php" hash="0e9792c4ea7e27e61472d60e07227c5e"/></dir><file name="Type.php" hash="ce4604dccb55c6ce450fd34d4fa8ad4d"/></dir></dir><file name="Log.php" hash="446fc48510a09b279ad725bf87b839ff"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="6ebe6b95b2565601cd77f1d4db264ff4"/></dir><file name="Log.php" hash="914cb47c3274c2cce6a3913302a2d4e3"/><dir name="Service"><file name="Collection.php" hash="c68147d484d42d4b6b6f4fedc2ac6cc7"/></dir><file name="Service.php" hash="3dac2e956f57c9a1467e52a0f008fefd"/></dir><file name="Observer.php" hash="64066be77b9d9c873dab30cf1870da63"/><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="5d1f7b687e2ca293ac1dc0c0425d1b8f"/></dir><dir name="Hostedpro"><file name="Request.php" hash="11ba073df9037d899eecb211c062d5f5"/></dir></dir><dir name="PaypalUk"><dir name="Api"><file name="Nvp.php" hash="49ba8cbd3145939a3d78e4964d1fe27e"/></dir></dir><dir name="Post"><file name="Abstract.php" hash="f6eeda7e77637957a68071f10b9954ce"/><file name="Live.php" hash="dd7b6a145f11ac7e5521541ba9a04111"/><file name="Simulation.php" hash="cb9b14475150e9303cd92831bb1eff6d"/><file name="Test.php" hash="749fb1a3384695e9f24f2fbf5fd82d47"/><file name="Unittest.php" hash="fe5d5590d720d4d2c824bcaf3ca83e55"/></dir><file name="Post.php" hash="c45665581817d711048d37bed0ecb67b"/><dir name="Resource"><file name="Setup.php" hash="c20cba205135fbfb01055518102b4681"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Financeamount.php" hash="0ab402b6f55a4b9d13d0cafb36b6280f"/></dir><dir name="Invoice"><file name="Financeamount.php" hash="40d2be0622ac85e7776ce102b7de9e29"/></dir></dir><dir name="Quote"><file name="Financeamount.php" hash="85eba4714b45677e5e97fd8227c22a06"/><file name="Totalcost.php" hash="f7b360b6fd09029fd48c47c2be803d97"/></dir></dir><file name="Service.php" hash="5cc3d5959b8e08b11ca754da67776efd"/><file name="Session.php" hash="c2cdc285f6297ad2dc100973022ec6d4"/><file name="Sessionobserver.php" hash="dea217f14aacc3829e61cc667ae70c19"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Paybyfinance"><file name="RedirectController.php" hash="8098982cfa01371e3427d0b7a8da6829"/><file name="ServiceController.php" hash="0f394469d41e6b37f9f39d3e666a719f"/></dir></dir><file name="CheckoutController.php" hash="e35b1ab01af610c5fd8ab24eda4ee8e2"/><file name="NotificationController.php" hash="95bd98bea5c92763d2755a3e2bc65e4b"/><file name="SelectorController.php" hash="42a24424f721f425fca70de6dbeff767"/><file name="SessionController.php" hash="b3756993e0d8e6e49434354c824f837e"/><file name="StatusController.php" hash="9e8681654954590f2694780f18ab0675"/></dir><dir name="etc"><file name="adminhtml.xml" hash="216df222a5f5d9fdcf29c238cfd78bd5"/><file name="config.xml" hash="a71b684587ac03540a7af3f7944230c1"/><file name="system.xml" hash="823f5f8b6377e5fe66433604a58c0e53"/></dir><dir name="sql"><dir name="paybyfinance_setup"><dir name="html"><file name="abandoned.html" hash="424f900dbddc267f7dac72e67752df25"/><file name="accepted.html" hash="5a12318275410a8bf62d7508422d9503"/><file name="declined.html" hash="bd3e7565c3d98645629d9f6274e4bf24"/><file name="error.html" hash="4a448b052f101b2648dfe84423ad1313"/><file name="information.html" hash="b364458ba3d9ad7579fa4935e3449b46"/><file name="page-finance-options.html" hash="d6786a27e4bf82a73e3134df0f98888b"/><file name="referred.html" hash="5955befddbb2e274f350ba71458b6151"/></dir><file name="mysql4-install-1.0.5.php" hash="80b3cacf2011248d9e283b8cc9130ccc"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="35e40e56f4eaa482cf76861bf268b9d7"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="f88bb5dae696c130c0038c05e86dfd9c"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="abd3f7c7e68120a6bcad82470f62db25"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="2cc09a77b0c36f2f0a2bdce97ba0f50d"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="paybyfinance"><dir><dir name="catalog"><dir name="product"><dir name="list"><file name="finance.phtml" hash="30f6500bc535bdf851ff6d5768e383dc"/></dir></dir></dir><dir name="sales"><dir name="order"><file name="totals.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir><file name="form.phtml" hash="6f583d5629e39fe564d4b86535242c7a"/><file name="selector-no.phtml" hash="b54c570f68254a2e879464a0b761c7db"/><file name="selector.phtml" hash="2a4c293be0ec3b13d40a6080725dd8eb"/><file name="status.phtml" hash="9e02cb668c470d72612bccc09e34c51a"/></dir><dir name="checkout"><dir name="cart"><file name="totals-pbf.phtml" hash="f14878e618aa3c8943f3728128aadaa6"/></dir><dir name="onepage"><dir name="review"><file name="info-pbf.phtml" hash="e4c7c70c798f1956ae7aaa5c09114fab"/><file name="totals-pbf.phtml" hash="f26e488359433c3814a1cd416006869a"/></dir></dir><file name="cart-pbf.phtml" hash="9f6b1873ed02e5e2ae1966e3e5a1910d"/></dir></dir><dir name="layout"><file name="paybyfinance.xml" hash="f541883d7e115794fcde3b0a4ac1bb3d"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="paybyfinance.xml" hash="6dd419ed31a10c3fc409a5a58f89fe01"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="paybyfinance"><file name="checkout.js" hash="21051d8691dd773427d3e761403896ab"/><file name="functions.js" hash="98c27381b3f7eaeaa845271dbe763f05"/><file name="slider.js" hash="16d83f4f0faa449276c926d2afac75fb"/></dir></dir><dir name="css"><file name="paybyfinance.css" hash="25d02dc5cf228662c30d908d7c2f1356"/><file name="paybyfinance-ie8.css" hash="a6be9c7af8b95300bc62e4fe9ef252ac"/></dir><dir name="images"><dir name="paybyfinance"><file name="bullet.png" hash="ea2baab34b2eb7d0aacb7a67d5b080f1"/><file name="pointer-toggle.png" hash="e661d42aed7a5562f75828312c7a635a"/><file name="pointer.png" hash="68c58b28d6ebd77d415f8666c301a199"/><file name="progress.png" hash="6d46a109cc9e38a663678918142d89f2"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="HC_PayByFinance.xml" hash="7cbf54af53b5b2fe9047988444fd407c"/></dir></dir></target></contents>
|
25 |
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.4.26</min><max>5.6.10</max></php></required></dependencies>
|
27 |
</package>
|