Version Notes
- Fix orderPayment
Download this release
Release Info
Developer | Jonas Ostir |
Extension | Lightspeed_Restaurant_POS_connector |
Version | 0.4.0 |
Comparing to | |
See all releases |
Code changes from version 0.3.0 to 0.4.0
app/code/local/Lightspeed/Syncproducts/Helper/Api.php
CHANGED
@@ -208,10 +208,10 @@ class Lightspeed_Syncproducts_Helper_Api extends Mage_Core_Helper_Abstract{
|
|
208 |
}
|
209 |
}
|
210 |
|
211 |
-
public function updateOrder($customerId, $posiosId, $
|
212 |
$this->logPatch('Updating order with posiosId: ' . $posiosId . ' to payment status: ' . $status);
|
213 |
|
214 |
-
$response = $this->patch(self::ONLINE_ORDERING, "customer/" . $customerId . "/order/" . $posiosId, array("
|
215 |
$this->logPut($response);
|
216 |
|
217 |
if($response["status"] == 200){
|
208 |
}
|
209 |
}
|
210 |
|
211 |
+
public function updateOrder($customerId, $posiosId, $status) {
|
212 |
$this->logPatch('Updating order with posiosId: ' . $posiosId . ' to payment status: ' . $status);
|
213 |
|
214 |
+
$response = $this->patch(self::ONLINE_ORDERING, "customer/" . $customerId . "/order/" . $posiosId, array("status" => $status), true, null);
|
215 |
$this->logPut($response);
|
216 |
|
217 |
if($response["status"] == 200){
|
app/code/local/Lightspeed/Syncproducts/Model/Order/Observer.php
CHANGED
@@ -53,6 +53,9 @@ class Lightspeed_Syncproducts_Model_Order_Observer {
|
|
53 |
}
|
54 |
|
55 |
$orderWithTaxes = $this->createOrderWithTaxes($magentoOrder);
|
|
|
|
|
|
|
56 |
$orderItems = $orderWithTaxes[0];
|
57 |
$orderTaxInfo = $this->getOrderTaxInfo($magentoOrder, $orderWithTaxes[1]);
|
58 |
$order["orderItems"] = $orderItems;
|
@@ -76,6 +79,16 @@ class Lightspeed_Syncproducts_Model_Order_Observer {
|
|
76 |
$this->log('Order synced');
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
protected function getEstablishmentId($magentoOrder) {
|
80 |
$useEstablishment = false;
|
81 |
$establishmentField = Mage::getStoreConfig('lightspeed_settings/lightspeed_establishments/lightspeed_establishment_field');
|
@@ -189,24 +202,15 @@ class Lightspeed_Syncproducts_Model_Order_Observer {
|
|
189 |
$customerId = $customer->getData('posiosId');
|
190 |
$posiosId = $magentoOrder->getData("posiosId");
|
191 |
|
192 |
-
|
193 |
-
$payment = Mage::helper('lightspeed_syncproducts/api')->getPaymentType($paymentId);
|
194 |
-
|
195 |
-
$orderPayment = array(
|
196 |
-
"amount" => (float)$magentoOrder->getGrandTotal(),
|
197 |
-
"paymentTypeId"=>(int)$payment->id,
|
198 |
-
"paymentTypeTypeId"=>(int)$payment->typeId
|
199 |
-
);
|
200 |
-
Mage::helper('lightspeed_syncproducts/api')->updateOrder($customerId, $posiosId, $orderPayment, $status);
|
201 |
}
|
202 |
|
203 |
private function getDeliveryTimestamp($order) {
|
204 |
|
205 |
try {
|
206 |
-
$deliveryTimeHelper = Mage::helper('deliverytime');
|
207 |
$deliveryTimeModel = Mage::getModel("deliverytime/deliverytime");
|
208 |
|
209 |
-
if ($deliveryTimeModel
|
210 |
$deliveryDateTime = Mage::getSingleton('checkout/session')->getData('delivery_time_data');
|
211 |
date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));
|
212 |
return date(DATE_ATOM, strtotime($deliveryDateTime["delivery_date"] . " " . $deliveryDateTime["time_start"]));
|
53 |
}
|
54 |
|
55 |
$orderWithTaxes = $this->createOrderWithTaxes($magentoOrder);
|
56 |
+
|
57 |
+
$order["orderPayment"] = $this->getOrderPayment($paymentMethod, $magentoOrder);
|
58 |
+
|
59 |
$orderItems = $orderWithTaxes[0];
|
60 |
$orderTaxInfo = $this->getOrderTaxInfo($magentoOrder, $orderWithTaxes[1]);
|
61 |
$order["orderItems"] = $orderItems;
|
79 |
$this->log('Order synced');
|
80 |
}
|
81 |
|
82 |
+
protected function getOrderPayment($paymentMethod, $magentoOrder) {
|
83 |
+
$paymentId = Mage::getStoreConfig('lightspeed_settings/lightspeed_payment/lightspeed_payment_'.$paymentMethod);
|
84 |
+
$payment = Mage::helper('lightspeed_syncproducts/api')->getPaymentType($paymentId);
|
85 |
+
return array(
|
86 |
+
"amount" => (float)$magentoOrder->getGrandTotal(),
|
87 |
+
"paymentTypeId"=>(int)$payment->id,
|
88 |
+
"paymentTypeTypeId"=>(int)$payment->typeId
|
89 |
+
);
|
90 |
+
}
|
91 |
+
|
92 |
protected function getEstablishmentId($magentoOrder) {
|
93 |
$useEstablishment = false;
|
94 |
$establishmentField = Mage::getStoreConfig('lightspeed_settings/lightspeed_establishments/lightspeed_establishment_field');
|
202 |
$customerId = $customer->getData('posiosId');
|
203 |
$posiosId = $magentoOrder->getData("posiosId");
|
204 |
|
205 |
+
Mage::helper('lightspeed_syncproducts/api')->updateOrder($customerId, $posiosId, $status);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
}
|
207 |
|
208 |
private function getDeliveryTimestamp($order) {
|
209 |
|
210 |
try {
|
|
|
211 |
$deliveryTimeModel = Mage::getModel("deliverytime/deliverytime");
|
212 |
|
213 |
+
if ($deliveryTimeModel) {
|
214 |
$deliveryDateTime = Mage::getSingleton('checkout/session')->getData('delivery_time_data');
|
215 |
date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));
|
216 |
return date(DATE_ATOM, strtotime($deliveryDateTime["delivery_date"] . " " . $deliveryDateTime["time_start"]));
|
package.xml
CHANGED
@@ -1,19 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Lightspeed_Restaurant_POS_connector</name>
|
4 |
-
<version>0.
|
5 |
<stability>devel</stability>
|
6 |
<license>Commercial Agreement</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>The Lightspeed Restaurant POS connector will allow magento to send and sync products / orders to the point of sale.</summary>
|
10 |
<description>The Lightspeed Restaurant POS connector will allow magento to send and sync products / orders to the point of sale.</description>
|
11 |
-
<notes>-
|
12 |
-
|
13 |
-
<
|
14 |
-
<
|
15 |
-
<
|
16 |
-
<contents><target name="magelocal"><dir name="Lightspeed"><dir name="Syncproducts"><dir name="Block"><file name="Establishmentfields.php" hash="97031eaa7c37a349cd5a1fb34c2ef408"/><file name="Monitor.php" hash="3f5b0f22ccb4a508f5cea3ab272e7f5e"/><file name="Paymentfields.php" hash="1265f7f5477387d1305d688b8c9d4d66"/><file name="Shippingfields.php" hash="8ef23f94d7a1f2b3ddbbd6a72a53e2ca"/><file name="Synccustomers.php" hash="7c710f95acef3f772dcb3d99a86d2fb7"/><file name="Syncproducts.php" hash="d1cef88b211b51864b3d61ac3225c1f7"/></dir><dir name="Helper"><file name="Api.php" hash="475b3fcecb01aecab6c96e592c5f2108"/><file name="Data.php" hash="1b25115bfc303bf13112ba02b3e211ec"/><file name="Import.php" hash="b72beea8f9f4df95cb17cf637a16bc16"/><file name="SyncProcess.php" hash="a90b9c943c7d35a5f3f3a5859306ba0a"/></dir><dir name="Model"><dir name="Category"><file name="Source.php" hash="826a55675a2f84f88d1fb45c572f022d"/></dir><dir name="Log"><file name="Log.php" hash="44a15a74ace916156472a7ea85b44957"/><dir name="Resource"><file name="Collection.php" hash="2693857dad446782543b1bbfe54e7114"/><file name="Log.php" hash="246eacb54d9d9398c91d0477833c20d8"/><file name="Setup.php" hash="9c1aa20cd2403572f19c8a50d5711f68"/></dir></dir><dir name="Order"><file name="Observer.php" hash="5975091aa444ff110b67bd4b14f8785b"/></dir><dir name="Payment"><file name="Source.php" hash="f451b12b2716f5687bc3a079dc5fb1a9"/></dir><dir name="Product"><file name="Source.php" hash="64d037c61587b54a98d590e415274027"/></dir><dir name="Tax"><file name="Source.php" hash="5245dccc5ae49e4b1a4ec4244e64e6d8"/></dir></dir><dir name="controllers"><file name="MonitorController.php" hash="350f99f12713cabda2675522ad9248ab"/><file name="SynccustomersController.php" hash="a83143a92eb5c9721074d0dc6ce20f65"/><file name="SyncproductsController.php" hash="fc61e8127fb64e78d0ae307340ad37ad"/></dir><dir name="etc"><file name="adminhtml.xml" hash="59f6515ebb69f3c751b9a7d148ac2abe"/><file name="config.xml" hash="3f2f2170440995ad26da3d9ddef04f92"/><file name="system.xml" hash="a8237da4d81857880fd9242461c5b81b"/></dir><dir name="sql"><dir name="syncproducts_setup"><file name="mysql4-install-1.0.0.0.1.php" hash="56fa3461cebee665b11d43ee52aff996"/><file name="mysql4-install-1.0.0.0.2.php" hash="98e81da9b27ec7b587d3c20451b2e075"/><file name="mysql4-install-1.0.0.0.3.php" hash="b48a3bfc685e76fd3ca902bfdd04bc86"/><file name="mysql4-install-1.0.0.0.4.php" hash="d860a4c8912619a1bd6566e8c61bb4b0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lightspeed_syncproducts.xml" hash="71f0b81a015e007c1b5e03a7f58a5088"/></dir><dir name="template"><dir name="lightspeed"><file name="categories.phtml" hash="6c2905f729f186fddd0d4eb5b68acb65"/><dir><dir name="customers"><file name="check.phtml" hash="daec9f837cdbb9c740843672e745ac4b"/><file name="sync.phtml" hash="e55c4578f669ac024a88f4c5e0bcc5e9"/></dir><dir name="monitor"><file name="monitor.phtml" hash="e6bde218ec87e7e383cccb71aac6ece0"/></dir></dir><file name="page.phtml" hash="e71bbcda4da5107373a9b7cc6bf1bdf4"/><file name="products.phtml" hash="6b20fad1fb16ad9d081085c2336337e7"/><file name="sync.phtml" hash="b38023e87be3b1633817c56f8b213bdf"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Lightspeed_Syncproducts.xml" hash="c39d8144a47c5842170eedf2ef4f8a3a"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.3.10</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Lightspeed_Restaurant_POS_connector</name>
|
4 |
+
<version>0.4.0</version>
|
5 |
<stability>devel</stability>
|
6 |
<license>Commercial Agreement</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>The Lightspeed Restaurant POS connector will allow magento to send and sync products / orders to the point of sale.</summary>
|
10 |
<description>The Lightspeed Restaurant POS connector will allow magento to send and sync products / orders to the point of sale.</description>
|
11 |
+
<notes>- Fix orderPayment</notes>
|
12 |
+
<authors><author><name>Jonas Ostir</name><user>Jonas</user><email>Jonas.Ostir@lightspeedhq.com</email></author><author><name>Jasper Decaestecker</name><user>Jasper</user><email>Jasper.Decaestecker@lightspeedhq.com</email></author></authors>
|
13 |
+
<date>2016-05-20</date>
|
14 |
+
<time>07:21:08</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Lightspeed"><dir name="Syncproducts"><dir name="Block"><file name="Establishmentfields.php" hash="97031eaa7c37a349cd5a1fb34c2ef408"/><file name="Monitor.php" hash="3f5b0f22ccb4a508f5cea3ab272e7f5e"/><file name="Paymentfields.php" hash="1265f7f5477387d1305d688b8c9d4d66"/><file name="Shippingfields.php" hash="8ef23f94d7a1f2b3ddbbd6a72a53e2ca"/><file name="Synccustomers.php" hash="7c710f95acef3f772dcb3d99a86d2fb7"/><file name="Syncproducts.php" hash="d1cef88b211b51864b3d61ac3225c1f7"/></dir><dir name="Helper"><file name="Api.php" hash="5d2aeebe6c798a4e110e6112a85e7a15"/><file name="Data.php" hash="1b25115bfc303bf13112ba02b3e211ec"/><file name="Import.php" hash="b72beea8f9f4df95cb17cf637a16bc16"/><file name="SyncProcess.php" hash="a90b9c943c7d35a5f3f3a5859306ba0a"/></dir><dir name="Model"><dir name="Category"><file name="Source.php" hash="826a55675a2f84f88d1fb45c572f022d"/></dir><dir name="Log"><file name="Log.php" hash="44a15a74ace916156472a7ea85b44957"/><dir name="Resource"><file name="Collection.php" hash="2693857dad446782543b1bbfe54e7114"/><file name="Log.php" hash="246eacb54d9d9398c91d0477833c20d8"/><file name="Setup.php" hash="9c1aa20cd2403572f19c8a50d5711f68"/></dir></dir><dir name="Order"><file name="Observer.php" hash="d2129928a8784e29aba916fe5f13f77e"/></dir><dir name="Payment"><file name="Source.php" hash="f451b12b2716f5687bc3a079dc5fb1a9"/></dir><dir name="Product"><file name="Source.php" hash="64d037c61587b54a98d590e415274027"/></dir><dir name="Tax"><file name="Source.php" hash="5245dccc5ae49e4b1a4ec4244e64e6d8"/></dir></dir><dir name="controllers"><file name="MonitorController.php" hash="350f99f12713cabda2675522ad9248ab"/><file name="SynccustomersController.php" hash="a83143a92eb5c9721074d0dc6ce20f65"/><file name="SyncproductsController.php" hash="fc61e8127fb64e78d0ae307340ad37ad"/></dir><dir name="etc"><file name="adminhtml.xml" hash="59f6515ebb69f3c751b9a7d148ac2abe"/><file name="config.xml" hash="3f2f2170440995ad26da3d9ddef04f92"/><file name="system.xml" hash="a8237da4d81857880fd9242461c5b81b"/></dir><dir name="sql"><dir name="syncproducts_setup"><file name="mysql4-install-1.0.0.0.1.php" hash="56fa3461cebee665b11d43ee52aff996"/><file name="mysql4-install-1.0.0.0.2.php" hash="98e81da9b27ec7b587d3c20451b2e075"/><file name="mysql4-install-1.0.0.0.3.php" hash="b48a3bfc685e76fd3ca902bfdd04bc86"/><file name="mysql4-install-1.0.0.0.4.php" hash="d860a4c8912619a1bd6566e8c61bb4b0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lightspeed_syncproducts.xml" hash="71f0b81a015e007c1b5e03a7f58a5088"/></dir><dir name="template"><dir name="lightspeed"><file name="categories.phtml" hash="6c2905f729f186fddd0d4eb5b68acb65"/><dir><dir name="customers"><file name="check.phtml" hash="daec9f837cdbb9c740843672e745ac4b"/><file name="sync.phtml" hash="e55c4578f669ac024a88f4c5e0bcc5e9"/></dir><dir name="monitor"><file name="monitor.phtml" hash="e6bde218ec87e7e383cccb71aac6ece0"/></dir></dir><file name="page.phtml" hash="e71bbcda4da5107373a9b7cc6bf1bdf4"/><file name="products.phtml" hash="6b20fad1fb16ad9d081085c2336337e7"/><file name="sync.phtml" hash="b38023e87be3b1633817c56f8b213bdf"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Lightspeed_Syncproducts.xml" hash="c39d8144a47c5842170eedf2ef4f8a3a"/></dir></target></contents>
|
|
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.10</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|