ZooZ_payment - Version 2.0.8

Version Notes

Upgraded with commit and refund functionality

Download this release

Release Info

Developer ZooZ Payments
Extension ZooZ_payment
Version 2.0.8
Comparing to
See all releases


Code changes from version 2.0.3 to 2.0.8

app/code/community/ZooZ/ZoozPayment/Helper/Data.php CHANGED
@@ -1,5 +1,28 @@
1
  <?php
2
- class ZooZ_ZoozPayment_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
1
  <?php
2
+
3
+ class ZooZ_ZoozPayment_Helper_Data extends Mage_Core_Helper_Abstract {
4
+
5
+ public function getTax() {
6
+ $totals = Mage::getSingleton("checkout/session")->getQuote()->getTotals(); //Total object
7
+ if (isset($totals['tax']) && $totals['tax']->getValue()) {
8
+ return $totals['tax']->getValue();
9
+ } else {
10
+ return 0;
11
+ }
12
+ }
13
+
14
+ public function getshipping() {
15
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
16
+ return $shipping = $quote->getShippingAddress()->getShippingAmount();
17
+ }
18
+
19
+ public function getdiscount() {
20
+ $quote = Mage::getSingleton("checkout/session")->getQuote(); //Total object
21
+ Mage::log('Data.php -- Get discount - getSubtotalWithDiscount: ' . $quote->getSubtotalWithDiscount() . ' subtotal:' . $quote->getSubtotal());
22
+
23
+ return (float) $quote->getSubtotal() - $quote->getSubtotalWithDiscount();
24
+
25
+ }
26
+
27
  }
28
 
app/code/community/ZooZ/ZoozPayment/Model/Estimate.php CHANGED
@@ -1,238 +1,238 @@
1
- <?php
2
-
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- *
13
- * @category EcomDev
14
- * @package Lotus_Getshipping
15
- * @copyright Copyright (c) 2010 Ecommerce Developer Blog (http://www.ecomdev.org)
16
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
- */
18
-
19
- /**
20
- * Estimate model
21
- *
22
- */
23
- class ZooZ_ZoozPayment_Model_Estimate {
24
-
25
- /**
26
- * Customer object,
27
- * if customer isn't logged in it quals to false
28
- *
29
- * @var Mage_Customer_Model_Customer|boolean
30
- */
31
- protected $_customer = null;
32
-
33
- /**
34
- * Sales quote object to add products for shipping estimation
35
- *
36
- * @var Mage_Sales_Model_Quote
37
- */
38
- protected $_quote = null;
39
-
40
- /**
41
- * Product model
42
- *
43
- * @var Mage_Catalog_Model_Product
44
- */
45
- protected $_product = array();
46
-
47
- /**
48
- * Estimation result
49
- *
50
- * @var array
51
- */
52
- protected $_result = array();
53
-
54
- /**
55
- * Delivery address information
56
- *
57
- * @var array
58
- */
59
- protected $_addressInfo = null;
60
-
61
- /**
62
- * Set address info for estimation
63
- *
64
- * @param array $info
65
- * @return Lotus_Getshipping_Model_Estimate
66
- */
67
- public function setAddressInfo($info) {
68
- $this->_addressInfo = $info;
69
- return $this;
70
- }
71
-
72
- /**
73
- * Retrieve address information
74
- *
75
- * @return boolean
76
- */
77
- public function getAddressInfo() {
78
- return $this->_addressInfo;
79
- }
80
-
81
- /**
82
- * Set a product for the estimation
83
- *
84
- * @param Mage_Catalog_Model_Product $product
85
- * @return Lotus_Getshipping_Model_Estimate
86
- */
87
- public function setProduct($product) {
88
- $this->_product[] = $product;
89
- return $this;
90
- }
91
-
92
- /**
93
- * Retrieve product for the estimation
94
- */
95
- public function getProduct() {
96
- return $this->_product;
97
- }
98
-
99
- /**
100
- * Retrieve shipping rate result
101
- *
102
- * @return array|null
103
- */
104
- public function getResult() {
105
-
106
- return $this->_result;
107
- }
108
-
109
- /**
110
- * Retrieve list of shipping rates
111
- *
112
- * @param Mage_Catalog_Model_Product $product
113
- * @param array $info
114
- * @param array $address
115
- * @return Lotus_Getshipping_Model_Estimate
116
- */
117
- public function estimate() {
118
- $products = $this->getProduct();
119
- foreach ($products as $product) {
120
- $addToCartInfo = (array) $product->getAddToCartInfo();
121
- $addressInfo = (array) $this->getAddressInfo();
122
- if (!($product instanceof Mage_Catalog_Model_Product) || !$product->getId()) {
123
- Mage::throwException(
124
- Mage::helper('zoozpayment')->__('Please specify a valid product')
125
- );
126
- }
127
-
128
- if (!isset($addressInfo['country_id'])) {
129
- Mage::throwException(
130
- Mage::helper('zoozpayment')->__('Please specify a country')
131
- );
132
- }
133
-
134
- if (empty($addressInfo['cart'])) {
135
- $this->resetQuote();
136
- }
137
- $shippingAddress = $this->getQuote()->getShippingAddress();
138
-
139
- $shippingAddress->setCountryId($addressInfo['country_id']);
140
-
141
- if (isset($addressInfo['region_id'])) {
142
- $shippingAddress->setRegionId($addressInfo['region_id']);
143
- }
144
-
145
- if (isset($addressInfo['postcode'])) {
146
- $shippingAddress->setPostcode($addressInfo['postcode']);
147
- }
148
-
149
- if (isset($addressInfo['region'])) {
150
- $shippingAddress->setRegion($addressInfo['region']);
151
- }
152
-
153
- if (isset($addressInfo['city'])) {
154
- $shippingAddress->setCity($addressInfo['city']);
155
- }
156
-
157
- $shippingAddress->setCollectShippingRates(true);
158
-
159
- if (isset($addressInfo['coupon_code'])) {
160
- $this->getQuote()->setCouponCode($addressInfo['coupon_code']);
161
- }
162
-
163
- $request = new Varien_Object($addToCartInfo);
164
-
165
- if ($product->getStockItem()) {
166
- $minimumQty = $product->getStockItem()->getMinSaleQty();
167
- if ($minimumQty > 0 && $request->getQty() < $minimumQty) {
168
- $request->setQty($minimumQty);
169
- }
170
- }
171
-
172
- $result = $this->getQuote()->addProduct($product, $request);
173
- }
174
- if (is_string($result)) {
175
- Mage::throwException($result);
176
- }
177
-
178
- Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item' => $result, 'product' => $product));
179
-
180
- $this->getQuote()->collectTotals();
181
- $this->_result = $shippingAddress->getGroupedAllShippingRates();
182
- return $this;
183
- }
184
-
185
- /**
186
- * Retrieve sales quote object
187
- *
188
- * @return Mage_Sales_Model_Quote
189
- */
190
- public function getQuote() {
191
- if ($this->_quote === null) {
192
- $addressInfo = $this->getAddressInfo();
193
- if (!empty($addressInfo['cart'])) {
194
- $quote = Mage::getSingleton('checkout/session')->getQuote();
195
- } else {
196
- $quote = Mage::getModel('sales/quote');
197
- }
198
-
199
- $this->_quote = $quote;
200
- }
201
-
202
- return $this->_quote;
203
- }
204
-
205
- /**
206
- * Reset quote object
207
- *
208
- * @return Lotus_Getshipping_Model_Estimate
209
- */
210
- public function resetQuote() {
211
- $this->getQuote()->removeAllAddresses();
212
-
213
- if ($this->getCustomer()) {
214
- $this->getQuote()->setCustomer($this->getCustomer());
215
- }
216
-
217
- return $this;
218
- }
219
-
220
- /**
221
- * Retrieve currently logged in customer,
222
- * if customer isn't logged it returns false
223
- *
224
- * @return Mage_Customer_Model_Customer|boolean
225
- */
226
- public function getCustomer() {
227
- if ($this->_customer === null) {
228
- $customerSession = Mage::getSingleton('customer/session');
229
- if ($customerSession->isLoggedIn()) {
230
- $this->_customer = $customerSession->getCustomer();
231
- } else {
232
- $this->_customer = false;
233
- }
234
- }
235
- return $this->_customer;
236
- }
237
-
238
- }
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * @category EcomDev
14
+ * @package Lotus_Getshipping
15
+ * @copyright Copyright (c) 2010 Ecommerce Developer Blog (http://www.ecomdev.org)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ /**
20
+ * Estimate model
21
+ *
22
+ */
23
+ class ZooZ_ZoozPayment_Model_Estimate {
24
+
25
+ /**
26
+ * Customer object,
27
+ * if customer isn't logged in it quals to false
28
+ *
29
+ * @var Mage_Customer_Model_Customer|boolean
30
+ */
31
+ protected $_customer = null;
32
+
33
+ /**
34
+ * Sales quote object to add products for shipping estimation
35
+ *
36
+ * @var Mage_Sales_Model_Quote
37
+ */
38
+ protected $_quote = null;
39
+
40
+ /**
41
+ * Product model
42
+ *
43
+ * @var Mage_Catalog_Model_Product
44
+ */
45
+ protected $_product = array();
46
+
47
+ /**
48
+ * Estimation result
49
+ *
50
+ * @var array
51
+ */
52
+ protected $_result = array();
53
+
54
+ /**
55
+ * Delivery address information
56
+ *
57
+ * @var array
58
+ */
59
+ protected $_addressInfo = null;
60
+
61
+ /**
62
+ * Set address info for estimation
63
+ *
64
+ * @param array $info
65
+ * @return Lotus_Getshipping_Model_Estimate
66
+ */
67
+ public function setAddressInfo($info) {
68
+ $this->_addressInfo = $info;
69
+ return $this;
70
+ }
71
+
72
+ /**
73
+ * Retrieve address information
74
+ *
75
+ * @return boolean
76
+ */
77
+ public function getAddressInfo() {
78
+ return $this->_addressInfo;
79
+ }
80
+
81
+ /**
82
+ * Set a product for the estimation
83
+ *
84
+ * @param Mage_Catalog_Model_Product $product
85
+ * @return Lotus_Getshipping_Model_Estimate
86
+ */
87
+ public function setProduct($product) {
88
+ $this->_product[] = $product;
89
+ return $this;
90
+ }
91
+
92
+ /**
93
+ * Retrieve product for the estimation
94
+ */
95
+ public function getProduct() {
96
+ return $this->_product;
97
+ }
98
+
99
+ /**
100
+ * Retrieve shipping rate result
101
+ *
102
+ * @return array|null
103
+ */
104
+ public function getResult() {
105
+
106
+ return $this->_result;
107
+ }
108
+
109
+ /**
110
+ * Retrieve list of shipping rates
111
+ *
112
+ * @param Mage_Catalog_Model_Product $product
113
+ * @param array $info
114
+ * @param array $address
115
+ * @return Lotus_Getshipping_Model_Estimate
116
+ */
117
+ public function estimate() {
118
+ $products = $this->getProduct();
119
+ foreach ($products as $product) {
120
+ $addToCartInfo = (array) $product->getAddToCartInfo();
121
+ $addressInfo = (array) $this->getAddressInfo();
122
+ if (!($product instanceof Mage_Catalog_Model_Product) || !$product->getId()) {
123
+ Mage::throwException(
124
+ Mage::helper('zoozpayment')->__('Please specify a valid product')
125
+ );
126
+ }
127
+
128
+ if (!isset($addressInfo['country_id'])) {
129
+ Mage::throwException(
130
+ Mage::helper('zoozpayment')->__('Please specify a country')
131
+ );
132
+ }
133
+
134
+ if (empty($addressInfo['cart'])) {
135
+ $this->resetQuote();
136
+ }
137
+ $shippingAddress = $this->getQuote()->getShippingAddress();
138
+
139
+ $shippingAddress->setCountryId($addressInfo['country_id']);
140
+
141
+ if (isset($addressInfo['region_id'])) {
142
+ $shippingAddress->setRegionId($addressInfo['region_id']);
143
+ }
144
+
145
+ if (isset($addressInfo['postcode'])) {
146
+ $shippingAddress->setPostcode($addressInfo['postcode']);
147
+ }
148
+
149
+ if (isset($addressInfo['region'])) {
150
+ $shippingAddress->setRegion($addressInfo['region']);
151
+ }
152
+
153
+ if (isset($addressInfo['city'])) {
154
+ $shippingAddress->setCity($addressInfo['city']);
155
+ }
156
+
157
+ $shippingAddress->setCollectShippingRates(true);
158
+
159
+ if (isset($addressInfo['coupon_code'])) {
160
+ $this->getQuote()->setCouponCode($addressInfo['coupon_code']);
161
+ }
162
+
163
+ $request = new Varien_Object($addToCartInfo);
164
+
165
+ if ($product->getStockItem()) {
166
+ $minimumQty = $product->getStockItem()->getMinSaleQty();
167
+ if ($minimumQty > 0 && $request->getQty() < $minimumQty) {
168
+ $request->setQty($minimumQty);
169
+ }
170
+ }
171
+
172
+ $result = $this->getQuote()->addProduct($product, $request);
173
+ }
174
+ if (is_string($result)) {
175
+ Mage::throwException($result);
176
+ }
177
+
178
+ Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item' => $result, 'product' => $product));
179
+
180
+ $this->getQuote()->collectTotals();
181
+ $this->_result = $shippingAddress->getGroupedAllShippingRates();
182
+ return $this;
183
+ }
184
+
185
+ /**
186
+ * Retrieve sales quote object
187
+ *
188
+ * @return Mage_Sales_Model_Quote
189
+ */
190
+ public function getQuote() {
191
+ if ($this->_quote === null) {
192
+ $addressInfo = $this->getAddressInfo();
193
+ if (!empty($addressInfo['cart'])) {
194
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
195
+ } else {
196
+ $quote = Mage::getModel('sales/quote');
197
+ }
198
+
199
+ $this->_quote = $quote;
200
+ }
201
+
202
+ return $this->_quote;
203
+ }
204
+
205
+ /**
206
+ * Reset quote object
207
+ *
208
+ * @return Lotus_Getshipping_Model_Estimate
209
+ */
210
+ public function resetQuote() {
211
+ $this->getQuote()->removeAllAddresses();
212
+
213
+ if ($this->getCustomer()) {
214
+ $this->getQuote()->setCustomer($this->getCustomer());
215
+ }
216
+
217
+ return $this;
218
+ }
219
+
220
+ /**
221
+ * Retrieve currently logged in customer,
222
+ * if customer isn't logged it returns false
223
+ *
224
+ * @return Mage_Customer_Model_Customer|boolean
225
+ */
226
+ public function getCustomer() {
227
+ if ($this->_customer === null) {
228
+ $customerSession = Mage::getSingleton('customer/session');
229
+ if ($customerSession->isLoggedIn()) {
230
+ $this->_customer = $customerSession->getCustomer();
231
+ } else {
232
+ $this->_customer = false;
233
+ }
234
+ }
235
+ return $this->_customer;
236
+ }
237
+
238
+ }
app/code/community/ZooZ/ZoozPayment/Model/Observer.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento Enterprise Edition
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Magento Enterprise Edition License
9
+ * that is bundled with this package in the file LICENSE_EE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.magentocommerce.com/license/enterprise-edition
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Mage
23
+ * @package Mage_Tax
24
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://www.magentocommerce.com/license/enterprise-edition
26
+ */
27
+
28
+ /**
29
+ * Tax Event Observer
30
+ *
31
+ * @author Magento Core Team <core@magentocommerce.com>
32
+ */
33
+ class ZooZ_ZoozPayment_Model_Observer {
34
+
35
+ /**
36
+ * Put quote address tax information into order
37
+ *
38
+ * @param Varien_Event_Observer $observer
39
+ */
40
+ public function salesEventConvertQuoteAddressToOrder(Varien_Event_Observer $observer) {
41
+ $address = $observer->getEvent()->getAddress();
42
+ $order = $observer->getEvent()->getOrder();
43
+
44
+ $taxes = $address->getAppliedTaxes();
45
+ if (is_array($taxes)) {
46
+ if (is_array($order->getAppliedTaxes())) {
47
+ $taxes = array_merge($order->getAppliedTaxes(), $taxes);
48
+ }
49
+ $order->setAppliedTaxes($taxes);
50
+ $order->setConvertingFromQuote(true);
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Save order tax information
56
+ *
57
+ * @param Varien_Event_Observer $observer
58
+ */
59
+ public function salesEventOrderAfterSave(Varien_Event_Observer $observer) {
60
+ $order = $observer->getEvent()->getOrder();
61
+
62
+ if (!$order->getConvertingFromQuote() || $order->getAppliedTaxIsSaved()) {
63
+ return;
64
+ }
65
+
66
+ $getTaxesForItems = $order->getQuote()->getTaxesForItems();
67
+ $taxes = $order->getAppliedTaxes();
68
+
69
+ $ratesIdQuoteItemId = array();
70
+ if (!is_array($getTaxesForItems)) {
71
+ $getTaxesForItems = array();
72
+ }
73
+ foreach ($getTaxesForItems as $quoteItemId => $taxesArray) {
74
+ foreach ($taxesArray as $rates) {
75
+ if (count($rates['rates']) == 1) {
76
+ $ratesIdQuoteItemId[$rates['id']][] = array(
77
+ 'id' => $quoteItemId,
78
+ 'percent' => $rates['percent'],
79
+ 'code' => $rates['rates'][0]['code']
80
+ );
81
+ } else {
82
+ $percentDelta = $rates['percent'];
83
+ $percentSum = 0;
84
+ foreach ($rates['rates'] as $rate) {
85
+ $ratesIdQuoteItemId[$rates['id']][] = array(
86
+ 'id' => $quoteItemId,
87
+ 'percent' => $rate['percent'],
88
+ 'code' => $rate['code']
89
+ );
90
+ $percentSum += $rate['percent'];
91
+ }
92
+
93
+ if ($percentDelta != $percentSum) {
94
+ $delta = $percentDelta - $percentSum;
95
+ foreach ($ratesIdQuoteItemId[$rates['id']] as &$rateTax) {
96
+ if ($rateTax['id'] == $quoteItemId) {
97
+ $rateTax['percent'] = (($rateTax['percent'] / $percentSum) * $delta) + $rateTax['percent'];
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+
105
+ foreach ($taxes as $id => $row) {
106
+ foreach ($row['rates'] as $tax) {
107
+ if (is_null($row['percent'])) {
108
+ $baseRealAmount = $row['base_amount'];
109
+ } else {
110
+ if ($row['percent'] == 0 || $tax['percent'] == 0) {
111
+ continue;
112
+ }
113
+ $baseRealAmount = $row['base_amount'] / $row['percent'] * $tax['percent'];
114
+ }
115
+ $hidden = (isset($row['hidden']) ? $row['hidden'] : 0);
116
+ $data = array(
117
+ 'order_id' => $order->getId(),
118
+ 'code' => $tax['code'],
119
+ 'title' => $tax['title'],
120
+ 'hidden' => $hidden,
121
+ 'percent' => $tax['percent'],
122
+ 'priority' => $tax['priority'],
123
+ 'position' => $tax['position'],
124
+ 'amount' => $row['amount'],
125
+ 'base_amount' => $row['base_amount'],
126
+ 'process' => $row['process'],
127
+ 'base_real_amount' => $baseRealAmount,
128
+ );
129
+
130
+ $result = Mage::getModel('tax/sales_order_tax')->setData($data)->save();
131
+
132
+ if (isset($ratesIdQuoteItemId[$id])) {
133
+ foreach ($ratesIdQuoteItemId[$id] as $quoteItemId) {
134
+ if ($quoteItemId['code'] == $tax['code']) {
135
+ $item = $order->getItemByQuoteItemId($quoteItemId['id']);
136
+ if ($item) {
137
+ $define = 'FIX_' . $item->getId() . '_' . $result->getTaxId();
138
+ if (!defined($define) || constant($define) != true) {
139
+ $data = array(
140
+ 'item_id' => $item->getId(),
141
+ 'tax_id' => $result->getTaxId(),
142
+ 'tax_percent' => $quoteItemId['percent']
143
+ );
144
+ Mage::getModel('tax/sales_order_tax_item')->setData($data)->save();
145
+ define($define, true);
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ $order->setAppliedTaxIsSaved(true);
155
+ }
156
+
157
+ /**
158
+ * Prepare select which is using to select index data for layered navigation
159
+ *
160
+ * @param Varien_Event_Observer $observer
161
+ * @return Mage_Tax_Model_Observer
162
+ */
163
+ public function prepareCatalogIndexPriceSelect(Varien_Event_Observer $observer) {
164
+ $table = $observer->getEvent()->getTable();
165
+ $response = $observer->getEvent()->getResponseObject();
166
+ $select = $observer->getEvent()->getSelect();
167
+ $storeId = $observer->getEvent()->getStoreId();
168
+
169
+ $additionalCalculations = $response->getAdditionalCalculations();
170
+ $calculation = Mage::helper('tax')->getPriceTaxSql(
171
+ $table . '.min_price', $table . '.tax_class_id'
172
+ );
173
+
174
+ if (!empty($calculation)) {
175
+ $additionalCalculations[] = $calculation;
176
+ $response->setAdditionalCalculations($additionalCalculations);
177
+ /**
178
+ * Tax class presented in price index table
179
+ */
180
+ //Mage::helper('tax')->joinTaxClass($select, $storeId, $table);
181
+ }
182
+
183
+ return $this;
184
+ }
185
+
186
+ /**
187
+ * Add tax percent values to product collection items
188
+ *
189
+ * @param Varien_Event_Observer $observer
190
+ * @return Mage_Tax_Model_Observer
191
+ */
192
+ public function addTaxPercentToProductCollection($observer) {
193
+ $helper = Mage::helper('tax');
194
+ $collection = $observer->getEvent()->getCollection();
195
+ $store = $collection->getStoreId();
196
+ if (!$helper->needPriceConversion($store)) {
197
+ return $this;
198
+ }
199
+
200
+ if ($collection->requireTaxPercent()) {
201
+ $request = Mage::getSingleton('tax/calculation')->getRateRequest();
202
+ foreach ($collection as $item) {
203
+ if (null === $item->getTaxClassId()) {
204
+ $item->setTaxClassId($item->getMinimalTaxClassId());
205
+ }
206
+ if (!isset($classToRate[$item->getTaxClassId()])) {
207
+ $request->setProductClassId($item->getTaxClassId());
208
+ $classToRate[$item->getTaxClassId()] = Mage::getSingleton('tax/calculation')->getRate($request);
209
+ }
210
+ $item->setTaxPercent($classToRate[$item->getTaxClassId()]);
211
+ }
212
+ }
213
+ return $this;
214
+ }
215
+
216
+ /**
217
+ * Refresh sales tax report statistics for last day
218
+ *
219
+ * @param Mage_Cron_Model_Schedule $schedule
220
+ * @return Mage_Tax_Model_Observer
221
+ */
222
+ public function aggregateSalesReportTaxData($schedule) {
223
+ Mage::app()->getLocale()->emulate(0);
224
+ $currentDate = Mage::app()->getLocale()->date();
225
+ $date = $currentDate->subHour(25);
226
+ Mage::getResourceModel('tax/report_tax')->aggregate($date);
227
+ Mage::app()->getLocale()->revert();
228
+ return $this;
229
+ }
230
+
231
+ /**
232
+ * Reset extra tax amounts on quote addresses before recollecting totals
233
+ *
234
+ * @param Varien_Event_Observer $observer
235
+ * @return Mage_Tax_Model_Observer
236
+ */
237
+ public function quoteCollectTotalsBefore(Varien_Event_Observer $observer) {
238
+ /* @var $quote Mage_Sales_Model_Quote */
239
+ $quote = $observer->getEvent()->getQuote();
240
+ foreach ($quote->getAllAddresses() as $address) {
241
+ $address->setExtraTaxAmount(0);
242
+ $address->setBaseExtraTaxAmount(0);
243
+ }
244
+ return $this;
245
+ }
246
+
247
+ }
app/code/community/ZooZ/ZoozPayment/Model/Order.php CHANGED
@@ -1,316 +1,191 @@
1
- <?php
2
-
3
- class ZooZ_ZoozPayment_Model_Order extends Mage_Core_Model_Abstract {
4
-
5
- public function saveOrder($info = null, $giftInfo = null) {
6
- try {
7
-
8
- $session = Mage::getSingleton("customer/session");
9
- $customer = $session->getCustomer();
10
- $customer = Mage::getModel('customer/customer')->load($customer->getId());
11
-
12
- $notLogin = false;
13
- $storeId = Mage::app()->getStore()->getId();
14
-
15
- if (Mage::getSingleton('customer/session')->IsLoggedIn()) {
16
- $customer = Mage::getModel('customer/customer')->load($customer->getId());
17
- $storeId = $customer->getStoreId();
18
- $notLogin = true;
19
- }
20
- //Mage::log("login status");
21
- //Mage::log($notLogin);
22
- // Mage::log("login status");
23
- $transaction = Mage::getModel('core/resource_transaction');
24
- $reservedOrderId = Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($storeId);
25
-
26
- $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
27
- $order = Mage::getModel('sales/order')
28
- ->setIncrementId($reservedOrderId)
29
- ->setStoreId($storeId)
30
- ->setQuoteId(0)
31
- ->setGlobal_currency_code($currency_code)
32
- ->setBase_currency_code($currency_code)
33
- ->setStore_currency_code($currency_code)
34
- ->setOrder_currency_code($currency_code);
35
- // if return gift message
36
- // get value from $info
37
- $return_gift = true;
38
- #Mage::log($info);
39
- if ($return_gift) {
40
- $gift_customer = 0;
41
- if ($customer->getId()) {
42
- $gift_customer = $customer->getId();
43
- }
44
-
45
- //$Mage::log($info);
46
-
47
- //$Mage::log($info['gift']['message']);
48
-
49
- $model = Mage::getModel('giftmessage/message');
50
- $model->setCustomerId(0);
51
- $model->setSender($giftInfo['from']);
52
- $model->setRecipient($giftInfo['to']);
53
- $model->setMessage($giftInfo['message']);
54
- $model->save();
55
- $gift_id = $model->getId();
56
- }
57
- // if return gift message
58
- if ($notLogin) {
59
- // set Customer data
60
- $order->setCustomer_email($customer->getEmail())
61
- ->setCustomerFirstname($customer->getFirstname())
62
- ->setCustomerLastname($customer->getLastname())
63
- ->setCustomerGroupId($customer->getGroupId())
64
- ->setCustomer_is_guest(0)
65
- ->setCustomer($customer);
66
- } else {
67
- // set Customer data
68
- $order->setCustomer_email('non-customer@gmail.com')
69
- ->setCustomerFirstname('No')
70
- ->setCustomerLastname('Name')
71
- ->setCustomerGroupId(0)
72
- ->setCustomer_is_guest(1);
73
- //->setCustomer($customer);
74
- if ($info != null) {
75
- $user = $info->user;
76
- $order->setCustomer_email($user->email)
77
- ->setCustomerFirstname($user->firstName)
78
- ->setCustomerLastname($user->lastName)
79
- ->setCustomerGroupId(0);
80
- }
81
- }
82
- if ($info != null) {
83
-
84
- $shippingAddress = Mage::getModel('sales/order_address');
85
- $shipp_address = $info->shippingAddress;
86
- // $country_id = Mage::getModel('directory/country')->load($info->country)->getCountryId();
87
- $shippingAddress->setStoreId($storeId)
88
- ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
89
- ->setCustomerId($customer->getId())
90
- ->setFirstname($shipp_address->firstName)
91
- ->setLastname($shipp_address->lastName)
92
- ->setStreet($shipp_address->street)
93
- ->setCity($shipp_address->city)
94
- ->setCountry_id($shipp_address->countryCode)
95
- ->setRegion($shipp_address->state)
96
- ->setPostcode($shipp_address->zipCode)
97
- ->setTelephone($user->phoneNumber);
98
- if ($notLogin) {
99
-
100
- $billing = $customer->getDefaultBillingAddress();
101
- if ($billing) {
102
- $billingAddress = Mage::getModel('sales/order_address');
103
- $billingAddress->setStoreId($storeId)
104
- ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
105
- ->setFirstname($billing->getFirstname())
106
- ->setMiddlename($billing->getMiddlename())
107
- ->setLastname($billing->getLastname())
108
- ->setStreet($billing->getStreet())
109
- ->setCity($billing->getCity())
110
- ->setCountry_id($billing->getCountryId())
111
- ->setRegion($billing->getRegion())
112
- ->setPostcode($billing->getPostcode());
113
-
114
- $order->setBillingAddress($billingAddress);
115
- $order->setShippingAddress($shippingAddress);
116
- } else {
117
- $billingAddress = clone $shippingAddress;
118
- $shippingAddress->setSameAsBilling(true);
119
- $order->setBillingAddress($billingAddress);
120
- $order->setShippingAddress($shippingAddress);
121
- }
122
- } else {
123
-
124
- $billingAddress = clone $shippingAddress;
125
- $shippingAddress->setSameAsBilling(true);
126
- $order->setBillingAddress($billingAddress);
127
- $order->setShippingAddress($shippingAddress);
128
- }
129
- } else if ($notLogin) {
130
- // set Billing Address
131
- $billing = $customer->getDefaultBillingAddress();
132
- $billingAddress = Mage::getModel('sales/order_address');
133
- if ($billing) {
134
- $billingAddress->setStoreId($storeId)
135
- ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
136
- ->setCustomerId($customer->getId())
137
- ->setCustomerAddressId($customer->getDefaultBilling())
138
- ->setCustomer_address_id($billing->getEntityId())
139
- ->setPrefix($billing->getPrefix())
140
- ->setFirstname($billing->getFirstname())
141
- ->setMiddlename($billing->getMiddlename())
142
- ->setLastname($billing->getLastname())
143
- ->setSuffix($billing->getSuffix())
144
- ->setCompany($billing->getCompany())
145
- ->setStreet($billing->getStreet())
146
- ->setCity($billing->getCity())
147
- ->setCountry_id($billing->getCountryId())
148
- ->setRegion($billing->getRegion())
149
- ->setRegion_id($billing->getRegionId())
150
- ->setPostcode($billing->getPostcode())
151
- ->setTelephone($billing->getTelephone())
152
- ->setFax($billing->getFax());
153
- $order->setBillingAddress($billingAddress);
154
- } else {
155
- $order->setBillingAddress($this->cloneAddress());
156
- }
157
-
158
-
159
- $shipping = $customer->getDefaultShippingAddress();
160
- $shippingAddress = Mage::getModel('sales/order_address');
161
- if ($shipping) {
162
- $shippingAddress->setStoreId($storeId)
163
- ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
164
- ->setCustomerId($customer->getId())
165
- ->setCustomerAddressId($customer->getDefaultShipping())
166
- ->setCustomer_address_id($shipping->getEntityId())
167
- ->setPrefix($shipping->getPrefix())
168
- ->setFirstname($shipping->getFirstname())
169
- ->setMiddlename($shipping->getMiddlename())
170
- ->setLastname($shipping->getLastname())
171
- ->setSuffix($shipping->getSuffix())
172
- ->setCompany($shipping->getCompany())
173
- ->setStreet($shipping->getStreet())
174
- ->setCity($shipping->getCity())
175
- ->setCountry_id($shipping->getCountryId())
176
- ->setRegion($shipping->getRegion())
177
- ->setRegion_id($shipping->getRegionId())
178
- ->setPostcode($shipping->getPostcode())
179
- ->setTelephone($shipping->getTelephone())
180
- ->setFax($shipping->getFax());
181
- $order->setShippingAddress($shippingAddress);
182
- } else {
183
- if ($billing) {
184
- $shippingAddress = clone $billingAddress;
185
- $shippingAddress->setSameAsBilling(false);
186
-
187
- $order->setShippingAddress($shippingAddress)
188
- ->setShipping_method('freeshipping_freeshipping')
189
- ->setShippingDescription($this->getCarrierName('freeshipping'));
190
- } else {
191
- $billingAddress = $this->cloneAddress();
192
- $shippingAddress = clone $billingAddress;
193
- $shippingAddress->setSameAsBilling(false);
194
-
195
- $order->setShippingAddress($shippingAddress);
196
- }
197
- }
198
- } else {
199
-
200
- $billingAddress = $this->cloneAddress();
201
- $order->setBillingAddress($billingAddress);
202
-
203
- $shippingAddress = clone $billingAddress;
204
- $shippingAddress->setSameAsBilling(true);
205
-
206
- $order->setShippingAddress($shippingAddress);
207
- }
208
-
209
- $orderPayment = Mage::getModel('sales/order_payment')
210
- ->setStoreId($storeId)
211
- ->setCustomerPaymentId(0)
212
- ->setMethod('zoozpayment')
213
- ->setPo_number(' - ');
214
- $order->setPayment($orderPayment);
215
-
216
- $convertQuoteObj = Mage::getSingleton('sales/convert_quote');
217
-
218
- $cart = Mage::helper('checkout/cart')->getCart();
219
- $items = $cart->getQuote()->getAllVisibleItems();
220
- $subTotal = 0;
221
- $baseSubTotal = 0;
222
-
223
- foreach ($items as $item) {
224
- $itemdata = $item->getData();
225
-
226
- $orderItem = $convertQuoteObj->itemToOrderItem($item);
227
-
228
- $options = array();
229
- if ($productOptions = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct())) {
230
- $options = $productOptions;
231
- }
232
- if ($addOptions = $item->getOptionByCode('additional_options')) {
233
- $options['additional_options'] = unserialize($addOptions->getValue());
234
- }
235
- if ($options) {
236
- $orderItem->setProductOptions($options);
237
- }
238
- if ($item->getParentItem()) {
239
- $orderItem->setParentItem($orderObj->getItemByQuoteItemId($item->getParentItem()->getId()));
240
- }
241
-
242
- $subTotal += $itemdata['row_total'];
243
- $baseSubTotal += $itemdata['base_row_total'];
244
- $order->addItem($orderItem);
245
- }
246
-
247
-
248
-
249
- $shipping_price = $info->shippingAmount;
250
- $shipping_name = $info->shippingMethod;
251
- $shipping_carrier_name = $info->shippingCarrierName;
252
- $shipping_carrier_code = $info->shippingCarrierCode;
253
- $order->setSubtotal($subTotal)
254
- ->setShippingMethod($shipping_carrier_code)
255
- ->setShippingDescription($shipping_name . " (" . $shipping_carrier_name .")")
256
- ->setBaseShippingAmount($shipping_price)
257
- ->setShippingAmount($shipping_price)
258
- ->setBaseSubtotal($baseSubTotal + $shipping_price)
259
- ->setBaseTotalDue($subTotal + $shipping_price)
260
- ->setGrandTotal($subTotal + $shipping_price)
261
- ->setBaseGrandTotal($baseSubTotal);
262
-
263
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
264
- $order->setGiftMessageId($gift_id);
265
- $transaction->addObject($order);
266
- $transaction->addCommitCallback(array($order, 'place'));
267
- $transaction->addCommitCallback(array($order, 'save'));
268
- $transaction->save();
269
-
270
- //print_r($quote->getId()); die;
271
-
272
- $session = Mage::getSingleton('checkout/session');
273
- $session->setLastRealOrderId($order->getIncrementId());
274
- $session->setLastSuccessQuoteId($session->getQuote()->getId());
275
- $session->setLastQuoteId($session->getQuote()->getId());
276
- $session->setLastOrderId($order->getId());
277
-
278
-
279
-
280
- $cart2 = Mage::getSingleton('checkout/cart');
281
- $cart2->init();
282
- $cart2->truncate();
283
- $cart2->save();
284
- $cart2->getItems()->clear()->save();
285
- //
286
-
287
-
288
-
289
-
290
- Mage::log('zooz payment success');
291
- } catch (Exception $ex) {
292
- Mage::log($ex->getMessage());
293
- }
294
- }
295
-
296
- public function cloneAddress() {
297
- // set Billing Address
298
- $addressData = array(
299
- 'firstname' => 'Test',
300
- 'lastname' => 'Test',
301
- 'street' => 'Sample Street 10',
302
- 'city' => 'Somewhere',
303
- 'postcode' => '123456',
304
- 'telephone' => '123456',
305
- 'country_id' => 'US',
306
- 'region_id' => 12, // id from directory_country_region table
307
- );
308
-
309
- $tempAddress = Mage::getModel('sales/order_address')
310
- ->setData($addressData)
311
- ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING);
312
-
313
- return $tempAddress;
314
- }
315
-
316
- }
1
+ <?php
2
+
3
+ class ZooZ_ZoozPayment_Model_Order extends Mage_Core_Model_Abstract {
4
+
5
+ public function saveOrder($info = null, $giftInfo = null) {
6
+ try {
7
+
8
+ $shipping_price = $info->shippingAmount;
9
+ $shipping_name = $info->shippingMethod;
10
+ $shipping_carrier_name = $info->shippingCarrierName;
11
+
12
+ $shipping_carrier_code = $info->shippingCarrierCode;
13
+ Mage::log($shipping_name);
14
+ Mage::log($shipping_carrier_name);
15
+ Mage::log($shipping_carrier_code);
16
+ Mage::log($shipping_price);
17
+ $session = Mage::getSingleton("customer/session");
18
+ $customer_session = $session->getCustomer();
19
+ $customer = Mage::getModel('customer/customer')->load($customer_session->getId());
20
+ $notLogin = false;
21
+ $storeId = Mage::app()->getStore()->getId();
22
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
23
+ $quote->save();
24
+
25
+ Mage::log("quote sub:" . $quote->getSubtotalWithDiscount());
26
+ if (Mage::getSingleton('customer/session')->IsLoggedIn()) {
27
+ $customer = Mage::getModel('customer/customer')->load($customer->getId());
28
+ $storeId = $customer->getStoreId();
29
+ $notLogin = true;
30
+ }
31
+ if ($info != null) {
32
+ /* Have Return Info Shipping Address */
33
+ Mage::log("Have Return Info Shipping Address");
34
+ $user = $info->user;
35
+
36
+ $shippingAddress = $quote->getShippingAddress();
37
+ $shipp_address = $info->shippingAddress;
38
+ Mage::log($shipp_address);
39
+ $phone_number = $user->phoneNumber;
40
+ if ($phone_number == '') {
41
+ $phone_number = "0987654321";
42
+ }
43
+ $shippingAddress->setStoreId($storeId)
44
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
45
+ ->setCustomerId($customer->getId())
46
+ ->setFirstname($shipp_address->firstName)
47
+ ->setLastname($shipp_address->lastName)
48
+ ->setStreet($shipp_address->street)
49
+ ->setCity($shipp_address->city)
50
+ ->setCountryId($shipp_address->countryCode)
51
+ ->setRegion($shipp_address->state)
52
+ ->setPostcode($shipp_address->zipCode)
53
+ ->setTelephone($phone_number);
54
+ $shippingAddress->setShippingMethod($shipping_name);
55
+ $shippingAddress->setShippingDescription($shipping_name . " (" . $shipping_carrier_name . ")");
56
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates();
57
+
58
+ if ($notLogin) {
59
+ /* Is Customer Login */
60
+ Mage::log("Is Customer Login");
61
+ $billing = $customer->getDefaultBillingAddress();
62
+ if ($billing) {
63
+ $billingAddress = $quote->getBillingAddress();
64
+ $billingAddress
65
+ ->setFirstname($billing->getFirstname())
66
+ ->setLastname($billing->getLastname())
67
+ ->setStreet($billing->getStreet())
68
+ ->setCity($billing->getCity())
69
+ ->setCountryId($billing->getCountryId())
70
+ ->setPostcode($billing->getPostcode());
71
+ $billingAddress->setRegionId($billing->getRegionId());// != "" ? $billing->getRegion() : $shipp_address->state);
72
+ $billingAddress->setTelephone($billing->getTelephone() != "" ? $billing->getTelephone() : $phone_number);
73
+
74
+ $quote->setBillingAddress($billingAddress);
75
+ $quote->setShippingAddress($shippingAddress);
76
+ } else {
77
+ $billingAddress = $quote->getBillingAddress();
78
+ $billingAddress
79
+ ->setFirstname($shipp_address->firstName)
80
+ ->setLastname($shipp_address->lastName)
81
+ ->setStreet($shipp_address->street)
82
+ ->setCity($shipp_address->city)
83
+ ->setCountryId($shipp_address->countryCode)
84
+ ->setRegion($shipp_address->state)
85
+ ->setPostcode($shipp_address->zipCode)
86
+ ->setTelephone($phone_number);
87
+
88
+ // $shippingAddress->setSameAsBilling(true);
89
+ $quote->setShippingAddress($shippingAddress);
90
+ $quote->setBillingAddress($billingAddress);
91
+ }
92
+ } else {
93
+ /* Customer Is Not Login */
94
+ Mage::log(" Customer Is Not Login");
95
+ $billingAddress = $quote->getBillingAddress();
96
+ $billingAddress->setFirstname($shipp_address->firstName)
97
+ ->setLastname($shipp_address->lastName)
98
+ ->setStreet($shipp_address->street)
99
+ ->setCity($shipp_address->city)
100
+ ->setCountryId($shipp_address->countryCode)
101
+ ->setRegion($shipp_address->state)
102
+ ->setPostcode($shipp_address->zipCode)
103
+ ->setTelephone($phone_number);
104
+ $shippingAddress->setSameAsBilling(true);
105
+ $quote->setCustomerIsGuest(1)
106
+ ->setCustomerEmail($user->email)
107
+ ->setCustomerFirstname($shipp_address->firstName)
108
+ ->setCustomerLastname($shipp_address->lastName)
109
+ ->setCustomerGroupId(0)
110
+ ->setCustomerIsGuest(1);
111
+ $quote->setBillingAddress($billingAddress);
112
+ $quote->setShippingAddress($shippingAddress);
113
+ }
114
+ }
115
+ $quote->save();
116
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
117
+ $session = Mage::getSingleton('checkout/session');
118
+ $giftcartcheck = false;
119
+
120
+ $payment = $quote->getPayment();
121
+ $payment->setMethod('zoozpayment');
122
+ Mage::log("quote sub1:" . $quote->getSubtotalWithDiscount());
123
+ $quote->collectTotals();
124
+ Mage::log("quote sub2:" . $quote->getSubtotalWithDiscount());
125
+ $service = Mage::getModel('sales/service_quote', $quote);
126
+ $service->submitAll();
127
+ $order = $service->getOrder();
128
+ if (!$order) {
129
+ return;
130
+ }
131
+
132
+
133
+ if ($giftInfo != null && $giftInfo != "") {
134
+ $gift_customer = 0;
135
+ if ($customer->getId()) {
136
+ $gift_customer = $customer->getId();
137
+ }
138
+ //$Mage::log($info);
139
+ //$Mage::log($info['gift']['message']);
140
+
141
+ $model = Mage::getModel('giftmessage/message');
142
+ $model->setCustomerId(0);
143
+ $model->setSender($giftInfo['from']);
144
+ $model->setRecipient($giftInfo['to']);
145
+ $model->setMessage($giftInfo['message']);
146
+ $model->save();
147
+ $gift_id = $model->getId();
148
+ $order->setGiftMessageId($gift_id);
149
+ }
150
+ $session = Mage::getSingleton('checkout/session');
151
+ $session->setLastRealOrderId($order->getIncrementId());
152
+ $session->setLastSuccessQuoteId($session->getQuote()->getId());
153
+ $session->setLastQuoteId($session->getQuote()->getId());
154
+ $session->setLastOrderId($order->getId());
155
+
156
+
157
+
158
+ $cart2 = Mage::getSingleton('checkout/cart');
159
+ $cart2->init();
160
+ $cart2->truncate();
161
+ $cart2->save();
162
+ $cart2->getItems()->clear()->save();
163
+ //
164
+ $order->save();
165
+ Mage::log('zooz payment success');
166
+ } catch (Exception $ex) {
167
+ Mage::log($ex->getMessage());
168
+ }
169
+ }
170
+
171
+ public function cloneAddress() {
172
+ // set Billing Address
173
+ $addressData = array(
174
+ 'firstname' => 'Test',
175
+ 'lastname' => 'Test',
176
+ 'street' => 'Sample Street 10',
177
+ 'city' => 'Somewhere',
178
+ 'postcode' => '123456',
179
+ 'telephone' => '123456',
180
+ 'country_id' => 'US',
181
+ 'region_id' => 12, // id from directory_country_region table
182
+ );
183
+
184
+ $tempAddress = Mage::getModel('sales/order_address')
185
+ ->setData($addressData)
186
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING);
187
+
188
+ return $tempAddress;
189
+ }
190
+
191
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ZooZ/ZoozPayment/Model/Source/Action.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ZooZ_ZoozPayment_Model_Source_Action {
4
+
5
+ public function toOptionArray() {
6
+ return array(
7
+ array(
8
+ 'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE,
9
+ 'label' => Mage::helper('core')->__('Authorize')
10
+ ),
11
+ array(
12
+ 'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE,
13
+ 'label' => Mage::helper('core')->__('Authorize & Capture')
14
+ )
15
+ );
16
+ }
17
+
18
+ }
app/code/community/ZooZ/ZoozPayment/Model/Source/Status.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ZooZ_ZoozPayment_Model_Source_Status
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array(
8
+ 'value' => Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
9
+ 'label' => Mage::helper('core')->__('Pending')
10
+ ),
11
+ array(
12
+ 'value' => Mage_Sales_Model_Order::STATE_PROCESSING,
13
+ 'label' => Mage::helper('core')->__('Processing')
14
+ )
15
+
16
+ );
17
+ }
18
+ }
app/code/community/ZooZ/ZoozPayment/Model/Standard.php CHANGED
@@ -1,588 +1,739 @@
1
- <?php
2
-
3
- require_once(Mage::getBaseDir('lib') . '/zooz/zooz.extended.server.api.php');
4
-
5
- class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract {
6
-
7
- protected $_code = 'zoozpayment';
8
- protected $_isInitializeNeeded = true;
9
- protected $_canUseInternal = false;
10
- protected $_canUseForMultishipping = false;
11
-
12
- /**
13
- * Return Order place redirect url
14
- *
15
- * @return string
16
- */
17
- public function getOrderPlaceRedirectUrl() {
18
- //when you click on place order you will be redirected on this url, if you don't want this action remove this method
19
- return Mage::getUrl('zoozpayment/standard/redirect', array('_secure' => true));
20
- }
21
-
22
- public function getAppUniqueId() {
23
- return $config = Mage::getStoreConfig('payment/zoozpayment/app_unique_id');
24
- }
25
-
26
- public function getAppKey() {
27
- return $config = Mage::getStoreConfig('payment/zoozpayment/app_key');
28
- }
29
-
30
- public function getIsSandBox() {
31
- return $config = Mage::getStoreConfig('payment/zoozpayment/sandbox_flag');
32
- }
33
-
34
- public function getSandboxUrl(){
35
- return $config = Mage::getStoreConfig('payment/zoozpayment/zooz_sandbox_url');
36
- }
37
-
38
- public function getProductionUrl(){
39
- return $config = Mage::getStoreConfig('payment/zoozpayment/zooz_production_url');
40
- }
41
-
42
- /**
43
- * Instantiate state and set it to state object
44
- * @param string $paymentAction
45
- * @param Varien_Object
46
- */
47
- public function initialize($paymentAction, $stateObject) {
48
- $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
49
- $stateObject->setState($state);
50
- $stateObject->setStatus('pending_payment');
51
- $stateObject->setIsNotified(false);
52
- }
53
-
54
- public function processing($start = false) {
55
- if ($start == true) {
56
-
57
- $postFields = $this->getPostFieldFromCart();
58
- } else {
59
- $postFields = $this->getPostField();
60
- }
61
- if ($postFields != '') {
62
- // Flag to indicate whether sandbox environment should be used
63
- $isSandbox = false;
64
- if ($this->getIsSandBox()) {
65
- $isSandbox = true;
66
- }
67
-
68
- $url;
69
- $zoozServer;
70
-
71
- if ($isSandbox == true) {
72
-
73
- $zoozServer = $this->getSandboxUrl();
74
- $url = $zoozServer . "/mobile/SecuredWebServlet";
75
- } else {
76
-
77
- $zoozServer = $this->getProductionUrl();
78
- $url = $zoozServer . "/mobile/SecuredWebServlet";
79
- }
80
-
81
- if (!function_exists('curl_init')) {
82
- Mage::getSingleton('checkout/session')->addError('Sorry cURL is not installed!');
83
- return Mage::getUrl('checkout/cart');
84
- }
85
-
86
- // OK cool - then let's create a new cURL resource handle
87
- $ch = curl_init();
88
-
89
- // Now set some options
90
- // Set URL
91
- curl_setopt($ch, CURLOPT_URL, $url);
92
-
93
- //Header fields: ZooZUniqueID, ZooZAppKey, ZooZResponseType
94
- $header = array('ZooZUniqueID: ' . $this->getAppUniqueId(), 'ZooZAppKey: ' . $this->getAppKey(), 'ZooZResponseType: NVP');
95
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
96
-
97
- // If it is a post request
98
- curl_setopt($ch, CURLOPT_POST, 1);
99
-
100
- // Timeout in seconds
101
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
102
-
103
- // If you are experiencing issues recieving the token on the sandbox environment, please set this option
104
- if ($isSandbox) {
105
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
106
- }
107
-
108
- //Mandatory POST fields: cmd, amount, currencyCode
109
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
110
-
111
- ob_start();
112
-
113
- curl_exec($ch);
114
-
115
- $result = ob_get_contents();
116
-
117
- ob_end_clean();
118
-
119
- curl_close($ch);
120
-
121
- parse_str($result);
122
-
123
-
124
- if ($statusCode == 0) {
125
-
126
- // Get token from ZooZ server
127
- $trimmedSessionToken = rtrim($sessionToken, "\n");
128
-
129
- // Send token back to page
130
- if ($start == true) {
131
- $success = Mage::getUrl('zoozpayment/standard/successexpress');
132
- } else {
133
- $success = Mage::getUrl('zoozpayment/standard/success');
134
- }
135
-
136
- $cancel = Mage::getUrl('zoozpayment/standard/cancel');
137
-
138
- $redirect = $zoozServer . "/mobile/mobileweb/zooz-checkout.jsp?";
139
- $redirect .= "token=" . $trimmedSessionToken;
140
- $redirect .= "&uniqueID=" . $this->getAppUniqueId();
141
- $redirect .= "&largeViewport=true";
142
- $redirect .= "&returnUrl=" . $success;
143
- $redirect .= "&cancelUrl=" . $cancel;
144
- $redirect .= "&isShippingRequired=false";
145
-
146
- // process order
147
- $session = Mage::getSingleton('checkout/session');
148
- $session->setZoozQuoteId($session->getQuoteId());
149
-
150
- //Mage::log($redirect);
151
- return $redirect;
152
-
153
- $session->unsQuoteId();
154
- $session->unsRedirectUrl();
155
- } else if (isset($errorMessage)) {
156
- Mage::getSingleton('checkout/session')->addError("Error to open transaction to ZooZ server. " . $errorMessage);
157
- return Mage::getUrl('checkout/cart');
158
- }
159
- //Close the cURL resource, and free system resources
160
- } else {
161
- return Mage::getUrl('checkout/cart');
162
- }
163
- }
164
-
165
- public function ajaxprocessing($start = false) {
166
- if ($start == true) {
167
-
168
- $postFields = $this->getPostFieldFromCart();
169
- } else {
170
- $postFields = $this->getPostField();
171
- }
172
-
173
-
174
- if ($postFields != '') {
175
- $postFields.="&featureProvider=102";
176
- $postFields.="&dynamicShippingUrl=" . Mage::getUrl('zoozpayment/estimate/index');
177
- if (Mage::getStoreConfig('sales/gift_options/allow_order', null)) {
178
- $postFields.="&providerSupportedFeatures=[100,104]";
179
- } else {
180
- $postFields.="&providerSupportedFeatures=[104]";
181
- }
182
-
183
- // Mage::log($postFields);
184
-
185
-
186
-
187
- // Flag to indicate whether sandbox environment should be used
188
- $isSandbox = false;
189
- if ($this->getIsSandBox()) {
190
- $isSandbox = true;
191
- }
192
-
193
- $url;
194
- $zoozServer;
195
-
196
- if ($isSandbox == true) {
197
-
198
- $zoozServer = $this->getSandboxUrl();
199
- $url = $zoozServer . "/mobile/SecuredWebServlet";
200
- } else {
201
-
202
- $zoozServer = $this->getProductionUrl();
203
- $url = $zoozServer . "/mobile/SecuredWebServlet";
204
- }
205
-
206
- // is cURL installed yet?
207
-
208
- if (!function_exists('curl_init')) {
209
- Mage::getSingleton('checkout/session')->addError('Sorry cURL is not installed!');
210
- return Mage::getUrl('checkout/cart');
211
- }
212
-
213
- // OK cool - then let's create a new cURL resource handle
214
- $ch = curl_init();
215
-
216
- // Now set some options
217
- // Set URL
218
- curl_setopt($ch, CURLOPT_URL, $url);
219
-
220
- //Header fields: ZooZUniqueID, ZooZAppKey, ZooZResponseType
221
- $header = array('ZooZUniqueID: ' . $this->getAppUniqueId(), 'ZooZAppKey: ' . $this->getAppKey(), 'ZooZResponseType: NVP');
222
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
223
-
224
- // If it is a post request
225
- curl_setopt($ch, CURLOPT_POST, 1);
226
-
227
- // Timeout in seconds
228
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
229
-
230
- // If you are experiencing issues recieving the token on the sandbox environment, please set this option
231
- if ($isSandbox) {
232
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
233
- }
234
-
235
- //Mandatory POST fields: cmd, amount, currencyCode
236
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
237
-
238
- ob_start();
239
-
240
- curl_exec($ch);
241
-
242
- $result = ob_get_contents();
243
-
244
- ob_end_clean();
245
-
246
- curl_close($ch);
247
-
248
- parse_str($result);
249
-
250
- // Mage::log($result);
251
-
252
- if ($statusCode == 0) {
253
- // Get token from ZooZ server
254
- $trimmedSessionToken = rtrim($sessionToken, "\n");
255
-
256
- $session = Mage::getSingleton('checkout/session');
257
- $session->setZoozQuoteId($session->getQuoteId());
258
- if ($start == true)
259
- $typecheckout = 1;
260
- else
261
- $typecheckout = 0;
262
- Mage::getSingleton('core/session')->setZooztype($typecheckout);
263
- return $trimmedSessionToken;
264
- //return $trimmedSessionToken;
265
- // Send token back to page
266
- } else if (isset($errorMessage)) {
267
- Mage::getSingleton('checkout/session')->addError("Error to open transaction to ZooZ server. " . $errorMessage);
268
- return Mage::getUrl('checkout/cart');
269
- }
270
- // Close the cURL resource, and free system resources
271
- } else {
272
-
273
- return Mage::getUrl('checkout/cart');
274
- }
275
- }
276
-
277
- public function getPostFieldFromCart() {
278
-
279
- //Mage::log("getPostFieldFromCart");
280
- $postFields = "";
281
- $cart = Mage::helper('checkout/cart')->getCart();
282
- $itemsCount = $cart->getItemsCount();
283
-
284
- if ($itemsCount > 0) {
285
- $data = $cart->getQuote()->getData();
286
-
287
- //Mage::log($data);
288
- // cmd
289
- $postFields .= "cmd=openTrx";
290
- $postFields .= "&amount=" . $data['grand_total'];
291
- $postFields .= "&currencyCode=" . $data['quote_currency_code'];
292
- //$postFields .= "&taxAmount=".$data['tax_amount'];
293
- //shipping
294
- $carrier = Mage::helper('zoozpayment/carrier');
295
- $carrier->setCarrier('freeshipping');
296
- $carrier_temp = '';
297
- $carrier_temp_0 = '';
298
- if ($carrier->check()) {
299
- $carrier_temp_0 = "{name:'" . $carrier->getAllowedMethods() . "', price: " . (float) $carrier->getAllowedPrice() . "}";
300
- $carrier_temp.=$carrier_temp_0;
301
- }
302
- $carrier->setCarrier('flatrate');
303
- $carrier_temp_1 = '';
304
- if ($carrier->check()) {
305
- $cart = Mage::helper('checkout/cart')->getCart();
306
- $items = $cart->getQuote()->getAllVisibleItems();
307
- $total = 0;
308
- $price_total = 0;
309
- foreach ($items as $item) {
310
- $total+=$item->getQty();
311
- // $price_total+= $item->getPrice()*$item->getQty();
312
- }
313
- if ($carrier->getAllowedType() == "I") {
314
- $price = $total * (float) $carrier->getAllowedPrice();
315
- } elseif ($carrier->getAllowedType() == "O") {
316
- $price = (float) $carrier->getAllowedPrice();
317
- } else {
318
- $price = 0;
319
- }
320
- if ($carrier->getAllowedHandlingType() == 'F') {
321
- $price_handing = (float) $carrier->getAllowedHandlingFee();
322
- $price_handing = number_format($price_handing, 2);
323
- }
324
- if ($carrier->getAllowedHandlingType() == 'P') {
325
-
326
- $price_handing = ((float) $carrier->getAllowedHandlingFee() * $price) / 100;
327
- $price_handing = number_format($price_handing, 2);
328
- }
329
- $price = $price + $price_handing;
330
- $carrier_temp_1 = "{name:'" . $carrier->getAllowedMethods() . "', price: " . $price . "}";
331
- if ($carrier_temp != '')
332
- $carrier_temp.="," . $carrier_temp_1;
333
- else
334
- $carrier_temp = $carrier_temp_1;
335
- }
336
-
337
- $postFields.="&isShippingRequired=true";
338
- if ($carrier_temp != '') {
339
- $postFields.= "&shippingMethods=[" . $carrier_temp . "]";
340
- } else {
341
- $postFields.="&isShippingRequired=false";
342
- }
343
- //shipping
344
- //
345
- // customer
346
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
347
-
348
- /* Get the customer data */
349
- $customer = Mage::getSingleton('customer/session')->getCustomer();
350
- /* Get the customer's first name */
351
- $firstname = $customer->getFirstname();
352
- /* Get the customer's last name */
353
- $lastname = $customer->getLastname();
354
- /* Get the customer's email address */
355
- $email = $customer->getEmail();
356
- $_billingData = $customer->getDefaultBillingAddress();
357
- $_shippingData = $customer->getDefaultShippingAddress();
358
-
359
- $postFields .= "&user.idNumber=" . $customer->getId();
360
- $postFields .= "&user.email=" . $email;
361
- $postFields .= "&user.firstName=" . $firstname;
362
- $postFields .= "&user.lastName=" . $lastname;
363
- if (is_object($_billingData)) {
364
- $postFields .= "&user.phone.phoneNumber=" . $_billingData->getTelephone();
365
- }
366
-
367
-
368
- //$postFields .= "&user.additionalDetails=Payment for ".$data['entity_id'];
369
- //Billing and Shipping
370
- if (is_object($_billingData)) {
371
- $postFields .= "&billingAddress.firstName=" . $_billingData['firstname'];
372
- $postFields .= "&billingAddress.lastName=" . $_billingData['lastname'];
373
- //$postFields .= "&billingAddress.phone.countryCode=USA";
374
- //$postFields .= "&billingAddress.phone.number=1222323".$_billingData['telephone'];
375
- $postFields .= "&billingAddress.street=" . $_billingData['street'];
376
- $postFields .= "&billingAddress.city=" . $_billingData['city'];
377
- //$postFields .= "&billingAddress.state=22";
378
- $postFields .= "&billingAddress.state=".$_billingData['region'];
379
- $postFields .= "&billingAddress.country=" . $_billingData['country_id'];
380
- $postFields .= "&billingAddress.zipCode=" . $_billingData['postcode'];
381
- }
382
-
383
- // shipping address
384
- if (is_object($_shippingData)) {
385
- $postFields .= "&shippingAddress.firstName=" . $_shippingData['firstname'];
386
- $postFields .= "&shippingAddress.lastName=" . $_shippingData['lastname'];
387
- //$postFields .= "&shippingAddress.phone.countryCode=2323";
388
- //$postFields .= "&shippingAddress.phone.number=232323".$_shippingData['telephone'];
389
- $postFields .= "&shippingAddress.street=" . $_shippingData['street'];
390
- $postFields .= "&shippingAddress.city=" . $_shippingData['city'];
391
- //$postFields .= "&shippingAddress.state=22";
392
- $postFields .= "&shippingAddress.state=".$_shippingData['region'];
393
- $postFields .= "&shippingAddress.country=" . $_shippingData['country_id'];
394
- $postFields .= "&shippingAddress.zipCode=" . $_shippingData['postcode'];
395
- }
396
- } else {
397
-
398
- }
399
- // invoice
400
- $postFields .= "&invoice.number=" . $data['entity_id'];
401
- $postFields .= "&invoice.additionalDetails=" . $data['entity_id'] . ': $' . $data['base_grand_total'];
402
-
403
- // items
404
- $cartItems = $cart->getQuote()->getAllVisibleItems();
405
- $i = 1;
406
- $tax = 0;
407
- foreach ($cartItems as $item) {
408
- $itemdata = $item->getData();
409
-
410
- $postFields .= "&invoice.items(" . $i . ").id=" . $itemdata['product_id'];
411
- $postFields .= "&invoice.items(" . $i . ").name=" . $itemdata['name'];
412
- $postFields .= "&invoice.items(" . $i . ").quantity=" . $itemdata['qty'];
413
- $postFields .= "&invoice.items(" . $i . ").price=" . $itemdata['price'];
414
- $tax += ($item->getData('tax_percent') * $itemdata['price'] * $itemdata['qty']) / 100;
415
- $i++;
416
- }
417
- }
418
-
419
- $postFields .= "&taxAmount=" . $tax;
420
-
421
- //Mage::log($postFields);
422
- return $postFields;
423
- }
424
-
425
- public function getPostField() {
426
- //Mage::log("getPostField");
427
- $postFields = "";
428
- $session = Mage::getSingleton('checkout/session');
429
- $session->setQuoteId($session->getZoozQuoteId(true));
430
- if ($session->getLastRealOrderId()) {
431
- $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
432
- if ($order->getId()) {
433
- $_orderData = $order->getData();
434
- $_shippingData = $order->getShippingAddress()->getData();
435
- $_billingData = $order->getBillingAddress()->getData();
436
-
437
- // cmd
438
- $postFields .= "cmd=openTrx";
439
- $postFields .= "&amount=" . $_orderData['grand_total'];
440
- $postFields .= "&currencyCode=" . $_orderData['order_currency_code'];
441
- $postFields .= "&taxAmount=" . $_orderData['tax_amount'];
442
- $postFields.="&isShippingRequired=false";
443
- // customer
444
- $postFields .= "&user.idNumber=" . $_orderData['customer_id'];
445
- $postFields .= "&user.email=" . $_orderData['customer_email'];
446
- $postFields .= "&user.firstName=" . $_orderData['customer_firstname'];
447
- $postFields .= "&user.lastName=" . $_orderData['customer_lastname'];
448
- $postFields .= "&user.phone.phoneNumber=" . $_shippingData['telephone'];
449
- $postFields .= "&user.additionalDetails=Payment for Invoice #" . $_orderData['increment_id'];
450
-
451
- // invoice
452
- $postFields .= "&invoice.number=" . $_orderData['increment_id'];
453
- $postFields .= "&invoice.additionalDetails=" . $_orderData['shipping_description'] . ': $' . $_orderData['shipping_amount'];
454
-
455
- // items
456
- $items = $order->getAllItems();
457
- $i = 1;
458
- foreach ($items as $itemId => $item) {
459
- $postFields .= "&invoice.items(" . $i . ").id=" . $item->getProductId();
460
- $postFields .= "&invoice.items(" . $i . ").name=" . $item->getName();
461
- $postFields .= "&invoice.items(" . $i . ").quantity=" . $item->getQtyToInvoice();
462
- $postFields .= "&invoice.items(" . $i . ").price=" . $item->getPrice();
463
- $i++;
464
- }
465
-
466
- // billing address
467
- $postFields .= "&billingAddress.firstName=" . $_billingData['firstname'];
468
- $postFields .= "&billingAddress.lastName=" . $_billingData['lastname'];
469
- $postFields .= "&billingAddress.phone.countryCode=USA";
470
- $postFields .= "&billingAddress.phone.number=1222323" . $_billingData['telephone'];
471
- $postFields .= "&billingAddress.street=" . $_billingData['street'];
472
- $postFields .= "&billingAddress.city=" . $_billingData['city'];
473
- //$postFields .= "&billingAddress.state=22";
474
- $postFields .= "&billingAddress.state=".$_billingData['region'];
475
- $postFields .= "&billingAddress.country=" . $_billingData['country_id'];
476
- $postFields .= "&billingAddress.zipCode=" . $_billingData['postcode'];
477
-
478
- // shipping address
479
- $postFields .= "&shippingAddress.firstName=" . $_shippingData['firstname'];
480
- $postFields .= "&shippingAddress.lastName=" . $_shippingData['lastname'];
481
- $postFields .= "&shippingAddress.phone.countryCode=2323";
482
- $postFields .= "&shippingAddress.phone.number=232323" . $_shippingData['telephone'];
483
- $postFields .= "&shippingAddress.street=" . $_shippingData['street'];
484
- $postFields .= "&shippingAddress.city=" . $_shippingData['city'];
485
- //$postFields .= "&shippingAddress.state=22";
486
- $postFields .= "&shippingAddress.state=".$_shippingData['region'];
487
- $postFields .= "&shippingAddress.country=" . $_shippingData['country_id'];
488
- $postFields .= "&shippingAddress.zipCode=" . $_shippingData['postcode'];
489
- }
490
- }
491
-
492
-
493
- return $postFields;
494
- }
495
-
496
- public function successprocessing() {
497
- // Flag to indicate whether sandbox environment should be used
498
- $isSandbox = false;
499
-
500
- if ($this->getIsSandBox()) {
501
- $isSandbox = true;
502
- }
503
-
504
- $url;
505
-
506
- if ($isSandbox == true) {
507
-
508
- $zoozServer = $this->getSandboxUrl();
509
- $url = $zoozServer . "/mobile/SecuredWebServlet";
510
- } else {
511
-
512
- $zoozServer = $this->getProductionUrl();
513
- $url = $zoozServer . "/mobile/SecuredWebServlet";
514
- }
515
- // is cURL installed yet?
516
-
517
- if (!function_exists('curl_init')) {
518
- Mage::getSingleton('checkout/session')->addError('Sorry cURL is not installed!');
519
- return Mage::getUrl('checkout/cart');
520
- }
521
-
522
- // OK cool - then let's create a new cURL resource handle
523
- $ch = curl_init();
524
-
525
- // Now set some options
526
- // Set URL
527
- curl_setopt($ch, CURLOPT_URL, $url);
528
-
529
- //Header fields: ZooZUniqueID, ZooZAppKey, ZooZResponseType
530
- $header = array('ZooZUniqueID: ' . $this->getAppUniqueId(), 'ZooZAppKey: ' . $this->getAppKey(), 'ZooZResponseType: NVP');
531
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
532
-
533
- // If it is a post request
534
- curl_setopt($ch, CURLOPT_POST, 1);
535
-
536
- // Timeout in seconds
537
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
538
-
539
- // If you are experiencing issues recieving the token on the sandbox environment, please set this option
540
- if ($isSandbox) {
541
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
542
- }
543
-
544
- $params = Mage::app()->getRequest()->getParams();
545
-
546
- $transactionID = $params['transactionID'];
547
-
548
- $sessionToken = $params['sessionToken'];
549
-
550
- curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=verifyTrx&transactionID=" . $transactionID);
551
-
552
- ob_start();
553
-
554
- curl_exec($ch);
555
-
556
- $result = ob_get_contents();
557
-
558
- ob_end_clean();
559
-
560
- parse_str($result);
561
-
562
- curl_close($ch);
563
-
564
- // create order with billding return
565
- $zooz_useremail = Mage::getStoreConfig('payment/zoozpayment/zooz_useremail');
566
- $zooz_serverkey = Mage::getStoreConfig('payment/zoozpayment/zooz_serverkey');
567
-
568
- if ($isSandbox) {
569
- $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, true);
570
- } else {
571
- $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, false);
572
- }
573
- //
574
- //$info = $zooz->getTransactionDetailsByTransactionID('4QQ6RIRDNNKI7GN37JLHI7BSAI');
575
-
576
- $info = $zooz->getTransactionDetailsByTransactionID($transactionID);
577
-
578
- //Get Gift information from Params
579
- $giftInfo = $params['gift'];
580
-
581
- //
582
- Mage::getModel('zoozpayment/order')->saveOrder($info,$giftInfo);
583
- // create order with billding return
584
- //Mage::log($result);
585
- return $statusCode;
586
- }
587
-
588
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once(Mage::getBaseDir('lib') . '/zooz/zooz.extended.server.api.php');
4
+
5
+ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract {
6
+
7
+ protected $_code = 'zoozpayment';
8
+ protected $_isInitializeNeeded = true;
9
+ protected $_canUseInternal = false;
10
+ protected $_canUseForMultishipping = true;
11
+ protected $_canAuthorize = true;
12
+ protected $_canCapture = true;
13
+ protected $_canRefund = true;
14
+ protected $_canRefundInvoicePartial = true;
15
+ protected $_canCapturePartial = true;
16
+
17
+ # protected $_canVoid = true;
18
+
19
+ public function canCapture() {
20
+ return $this->_canCapture;
21
+ }
22
+
23
+ public function canCapturePartial() {
24
+ return $this->_canCapturePartial;
25
+ }
26
+
27
+ public function initialize($paymentAction, $stateObject) {
28
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
29
+ $stateObject->setState($state);
30
+ $stateObject->setStatus('pending_payment');
31
+ $stateObject->setIsNotified(false);
32
+ }
33
+
34
+ public function canRefund() {
35
+ return $this->_canRefund;
36
+ }
37
+
38
+ public function canRefundInvoicePartial() {
39
+ return $this->_canRefundInvoicePartial;
40
+ }
41
+
42
+ public function refund(Varien_Object $payment, $amount) {
43
+ $isSandbox = false;
44
+ if ($this->getIsSandBox()) {
45
+ $isSandbox = true;
46
+ }
47
+ $zooz_useremail = Mage::getStoreConfig('payment/zoozpayment/zooz_useremail');
48
+ $zooz_serverkey = Mage::getStoreConfig('payment/zoozpayment/zooz_serverkey');
49
+
50
+ if ($isSandbox) {
51
+ $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, true);
52
+ } else {
53
+ $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, false);
54
+ }
55
+
56
+ // $info = $zooz->getTransactionDetailsByTransactionID($payment->getLastTransId());
57
+
58
+ if ($zooz->refundTransaction($payment->getLastTransId(), $amount)) {
59
+ $payment->setTransactionId($payment->getLastTransId());
60
+ $payment->setIsTransactionClosed(false);
61
+ $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED);
62
+ } else {
63
+ $this->showException('Error in you refund request');
64
+ }
65
+ return $this;
66
+ }
67
+
68
+ public function capture(Varien_Object $payment, $amount) {
69
+ //code execute to getway
70
+ //commitTransaction($transactionID, $amount=NULL, $invoice=NULL)
71
+ $isSandbox = false;
72
+ if ($this->getIsSandBox()) {
73
+ $isSandbox = true;
74
+ }
75
+ $zooz_useremail = Mage::getStoreConfig('payment/zoozpayment/zooz_useremail');
76
+ $zooz_serverkey = Mage::getStoreConfig('payment/zoozpayment/zooz_serverkey');
77
+
78
+ if ($isSandbox) {
79
+ $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, true);
80
+ } else {
81
+ $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, false);
82
+ }
83
+
84
+ if($amount == 0){
85
+ $payment->setTransactionId($payment->getLastTransId());
86
+ $payment->setIsTransactionClosed(false);
87
+ $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED);
88
+
89
+ }else if ($zooz->commitTransaction($payment->getLastTransId(), $amount)) {
90
+ $payment->setTransactionId($payment->getLastTransId());
91
+ $payment->setIsTransactionClosed(false);
92
+ $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED);
93
+ }
94
+ return $this;
95
+ }
96
+
97
+ /**
98
+ * Return Order place redirect url
99
+ *
100
+ * @return string
101
+ */
102
+ public function getOrderPlaceRedirectUrl() {
103
+ //when you click on place order you will be redirected on this url, if you don't want this action remove this method
104
+ return Mage::getUrl('zoozpayment/standard/redirect', array('_secure' => true));
105
+ }
106
+
107
+ public function getAppUniqueId() {
108
+ return $config = Mage::getStoreConfig('payment/zoozpayment/app_unique_id');
109
+ }
110
+
111
+ public function getAppKey() {
112
+ return $config = Mage::getStoreConfig('payment/zoozpayment/app_key');
113
+ }
114
+
115
+ public function getIsSandBox() {
116
+ return $config = Mage::getStoreConfig('payment/zoozpayment/sandbox_flag');
117
+ }
118
+
119
+ public function getSandboxUrl() {
120
+ return $config = Mage::getStoreConfig('payment/zoozpayment/zooz_sandbox_url');
121
+ }
122
+
123
+ public function getProductionUrl() {
124
+ return $config = Mage::getStoreConfig('payment/zoozpayment/zooz_production_url');
125
+ }
126
+
127
+ /**
128
+ * Instantiate state and set it to state object
129
+ * @param string $paymentAction
130
+ * @param Varien_Object
131
+ */
132
+ public function processing($start = false) {
133
+ if ($start == true) {
134
+
135
+ $postFields = $this->getPostFieldFromCart();
136
+ } else {
137
+ $postFields = $this->getPostField();
138
+ }
139
+ if ($postFields != '') {
140
+ // Flag to indicate whether sandbox environment should be used
141
+ $isSandbox = false;
142
+ if ($this->getIsSandBox()) {
143
+ $isSandbox = true;
144
+ }
145
+
146
+ $url;
147
+ $zoozServer;
148
+
149
+ if ($isSandbox == true) {
150
+
151
+ $zoozServer = $this->getSandboxUrl();
152
+ $url = $zoozServer . "/mobile/SecuredWebServlet";
153
+ } else {
154
+
155
+ $zoozServer = $this->getProductionUrl();
156
+ $url = $zoozServer . "/mobile/SecuredWebServlet";
157
+ }
158
+
159
+ if (!function_exists('curl_init')) {
160
+ Mage::getSingleton('checkout/session')->addError('Sorry cURL is not installed!');
161
+ return Mage::getUrl('checkout/cart');
162
+ }
163
+
164
+ // OK cool - then let's create a new cURL resource handle
165
+ $ch = curl_init();
166
+
167
+ // Now set some options
168
+ // Set URL
169
+ curl_setopt($ch, CURLOPT_URL, $url);
170
+
171
+ //Header fields: ZooZUniqueID, ZooZAppKey, ZooZResponseType
172
+ $header = array('ZooZUniqueID: ' . $this->getAppUniqueId(), 'ZooZAppKey: ' . $this->getAppKey(), 'ZooZResponseType: NVP');
173
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
174
+
175
+ // If it is a post request
176
+ curl_setopt($ch, CURLOPT_POST, 1);
177
+
178
+ // Timeout in seconds
179
+ curl_setopt($ch, CURLOPT_TIMEOUT, 10);
180
+
181
+ // If you are experiencing issues recieving the token on the sandbox environment, please set this option
182
+ if ($isSandbox) {
183
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
184
+ }
185
+
186
+ //Mandatory POST fields: cmd, amount, currencyCode
187
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
188
+
189
+ ob_start();
190
+
191
+ curl_exec($ch);
192
+
193
+ $result = ob_get_contents();
194
+
195
+ ob_end_clean();
196
+
197
+ curl_close($ch);
198
+
199
+ parse_str($result);
200
+
201
+
202
+ if ($statusCode == 0) {
203
+
204
+ // Get token from ZooZ server
205
+ $trimmedSessionToken = rtrim($sessionToken, "\n");
206
+
207
+ // Send token back to page
208
+ if ($start == true) {
209
+ $success = Mage::getUrl('zoozpayment/standard/successexpress');
210
+ } else {
211
+ $success = Mage::getUrl('zoozpayment/standard/success');
212
+ }
213
+
214
+ $cancel = Mage::getUrl('zoozpayment/standard/cancel');
215
+
216
+ $redirect = $zoozServer . "/mobile/mobileweb/zooz-checkout.jsp?";
217
+ $redirect .= "token=" . $trimmedSessionToken;
218
+ $redirect .= "&uniqueID=" . $this->getAppUniqueId();
219
+ $redirect .= "&largeViewport=true";
220
+ $redirect .= "&returnUrl=" . $success;
221
+ $redirect .= "&cancelUrl=" . $cancel;
222
+ $redirect .= "&isShippingRequired=false";
223
+
224
+ // process order
225
+ $session = Mage::getSingleton('checkout/session');
226
+ $session->setZoozQuoteId($session->getQuoteId());
227
+
228
+ //Mage::log($redirect);
229
+ return $redirect;
230
+
231
+ $session->unsQuoteId();
232
+ $session->unsRedirectUrl();
233
+ } else if (isset($errorMessage)) {
234
+ Mage::getSingleton('checkout/session')->addError("Error to open transaction to ZooZ server. " . $errorMessage);
235
+ return Mage::getUrl('checkout/cart');
236
+ }
237
+ //Close the cURL resource, and free system resources
238
+ } else {
239
+ return Mage::getUrl('checkout/cart');
240
+ }
241
+ }
242
+
243
+ public function ajaxprocessing($start = false) {
244
+ if ($start == true) {
245
+
246
+ $postFields = $this->getPostFieldFromCart();
247
+ } else {
248
+ $postFields = $this->getPostField();
249
+ }
250
+ if (Mage::getSingleton('customer/session')->IsLoggedIn()) {
251
+ $session = Mage::getSingleton("customer/session");
252
+ $customer = $session->getCustomer();
253
+ $customerLoginID = $customer->getId();
254
+ $postFields.="&customerLoginID=$customerLoginID";
255
+ }
256
+
257
+ if ($postFields != '') {
258
+
259
+ $postFields.="&dynamicShippingUrl=" . Mage::getUrl('zoozpayment/estimate/index');
260
+ if (Mage::getStoreConfig('sales/gift_options/allow_order', null)) {
261
+ $postFields.="&providerSupportedFeatures=[100,104]";
262
+ } else {
263
+ $postFields.="&providerSupportedFeatures=[104]";
264
+ }
265
+ //Mage::log($postFields);
266
+ //die($postFields);
267
+ // Flag to indicate whether sandbox environment should be used
268
+ $isSandbox = false;
269
+ if ($this->getIsSandBox()) {
270
+ $isSandbox = true;
271
+ }
272
+
273
+ $url;
274
+ $zoozServer;
275
+
276
+ if ($isSandbox == true) {
277
+
278
+ $zoozServer = $this->getSandboxUrl();
279
+ $url = $zoozServer . "/mobile/SecuredWebServlet";
280
+ } else {
281
+
282
+ $zoozServer = $this->getProductionUrl();
283
+ $url = $zoozServer . "/mobile/SecuredWebServlet";
284
+ }
285
+
286
+ // is cURL installed yet?
287
+
288
+ if (!function_exists('curl_init')) {
289
+ Mage::getSingleton('checkout/session')->addError('Sorry cURL is not installed!');
290
+ return Mage::getUrl('checkout/cart');
291
+ }
292
+
293
+ // OK cool - then let's create a new cURL resource handle
294
+ $ch = curl_init();
295
+
296
+ // Now set some options
297
+ // Set URL
298
+ curl_setopt($ch, CURLOPT_URL, $url);
299
+
300
+ //Header fields: ZooZUniqueID, ZooZAppKey, ZooZResponseType
301
+ $header = array('ZooZUniqueID: ' . $this->getAppUniqueId(), 'ZooZAppKey: ' . $this->getAppKey(), 'ZooZResponseType: NVP');
302
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
303
+
304
+ // If it is a post request
305
+ curl_setopt($ch, CURLOPT_POST, 1);
306
+
307
+ // Timeout in seconds
308
+ curl_setopt($ch, CURLOPT_TIMEOUT, 10);
309
+
310
+ // If you are experiencing issues recieving the token on the sandbox environment, please set this option
311
+ if ($isSandbox) {
312
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
313
+ }
314
+
315
+ //Mandatory POST fields: cmd, amount, currencyCode
316
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
317
+
318
+ ob_start();
319
+
320
+ curl_exec($ch);
321
+
322
+ $result = ob_get_contents();
323
+
324
+ ob_end_clean();
325
+
326
+ curl_close($ch);
327
+
328
+ parse_str($result);
329
+
330
+ // Mage::log($result);
331
+
332
+ if ($statusCode == 0) {
333
+ // Get token from ZooZ server
334
+ $trimmedSessionToken = rtrim($sessionToken, "\n");
335
+
336
+ $session = Mage::getSingleton('checkout/session');
337
+ $session->setZoozQuoteId($session->getQuoteId());
338
+ if ($start == true)
339
+ $typecheckout = 1;
340
+ else
341
+ $typecheckout = 0;
342
+ Mage::getSingleton('core/session')->setZooztype($typecheckout);
343
+ return $trimmedSessionToken;
344
+ //return $trimmedSessionToken;
345
+ // Send token back to page
346
+ } else if (isset($errorMessage)) {
347
+ Mage::getSingleton('checkout/session')->addError("Error to open transaction to ZooZ server. " . $errorMessage);
348
+ return Mage::getUrl('checkout/cart');
349
+ }
350
+ // Close the cURL resource, and free system resources
351
+ } else {
352
+
353
+ return Mage::getUrl('checkout/cart');
354
+ }
355
+ }
356
+
357
+ protected function _getCart() {
358
+ return Mage::getSingleton('checkout/cart');
359
+ }
360
+
361
+ public function getPostFieldFromCart() {
362
+
363
+ //Mage::log("getPostFieldFromCart");
364
+ $postFields = "";
365
+ // $cart = Mage::helper('checkout/cart')->getCart();
366
+ $cart = $this->_getCart();
367
+ $cart->save();
368
+
369
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
370
+
371
+ $session = Mage::getSingleton('checkout/session');
372
+
373
+
374
+
375
+ $itemsCount = $cart->getItemsCount();
376
+
377
+ if ($itemsCount > 0) {
378
+ $data = $cart->getQuote()->getData();
379
+
380
+ //Mage::log($data);
381
+ // cmd
382
+ $amount = $data['grand_total'] - Mage::helper('zoozpayment')->getshipping();
383
+ $postFields .= "cmd=openTrx";
384
+ $postFields .= "&amount=" . $amount;
385
+ $postFields .= "&currencyCode=" . $data['quote_currency_code'];
386
+ //$postFields .= "&taxAmount=".$data['tax_amount'];
387
+ //shipping
388
+ $carrier = Mage::helper('zoozpayment/carrier');
389
+ $carrier->setCarrier('freeshipping');
390
+ $carrier_temp = '';
391
+ $carrier_temp_0 = '';
392
+ if ($carrier->check()) {
393
+ $carrier_temp_0 = "{name:'" . $carrier->getAllowedMethods() . "', price: " . (float) $carrier->getAllowedPrice() . "}";
394
+ $carrier_temp.=$carrier_temp_0;
395
+ }
396
+ $carrier->setCarrier('flatrate');
397
+ $carrier_temp_1 = '';
398
+ if ($carrier->check()) {
399
+ $cart = Mage::helper('checkout/cart')->getCart();
400
+ $items = $cart->getQuote()->getAllVisibleItems();
401
+ $total = 0;
402
+ $price_total = 0;
403
+ foreach ($items as $item) {
404
+ $total+=$item->getQty();
405
+ // $price_total+= $item->getPrice()*$item->getQty();
406
+ }
407
+ if ($carrier->getAllowedType() == "I") {
408
+ $price = $total * (float) $carrier->getAllowedPrice();
409
+ } elseif ($carrier->getAllowedType() == "O") {
410
+ $price = (float) $carrier->getAllowedPrice();
411
+ } else {
412
+ $price = 0;
413
+ }
414
+ if ($carrier->getAllowedHandlingType() == 'F') {
415
+ $price_handing = (float) $carrier->getAllowedHandlingFee();
416
+ $price_handing = number_format($price_handing, 2);
417
+ }
418
+ if ($carrier->getAllowedHandlingType() == 'P') {
419
+
420
+ $price_handing = ((float) $carrier->getAllowedHandlingFee() * $price) / 100;
421
+ $price_handing = number_format($price_handing, 2);
422
+ }
423
+ $price = $price + $price_handing;
424
+ $carrier_temp_1 = "{name:'" . $carrier->getAllowedMethods() . "', price: " . $price . "}";
425
+ if ($carrier_temp != '')
426
+ $carrier_temp.="," . $carrier_temp_1;
427
+ else
428
+ $carrier_temp = $carrier_temp_1;
429
+ }
430
+ $postFields.="&isShippingRequired=true";
431
+ if ($carrier_temp != '') {
432
+ $postFields.= "&shippingMethods=[" . $carrier_temp . "]";
433
+ } else {
434
+ $postFields.="&isShippingRequired=false";
435
+ }
436
+ //shipping
437
+ //
438
+ // customer
439
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
440
+
441
+ /* Get the customer data */
442
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
443
+ /* Get the customer's first name */
444
+ $firstname = $customer->getFirstname();
445
+ /* Get the customer's last name */
446
+ $lastname = $customer->getLastname();
447
+ /* Get the customer's email address */
448
+ $email = $customer->getEmail();
449
+ $_billingData = $customer->getDefaultBillingAddress();
450
+ $_shippingData = $customer->getDefaultShippingAddress();
451
+
452
+ $postFields .= "&user.idNumber=" . $customer->getId();
453
+ $postFields .= "&user.email=" . $email;
454
+ $postFields .= "&user.firstName=" . $firstname;
455
+ $postFields .= "&user.lastName=" . $lastname;
456
+ if (is_object($_billingData)) {
457
+ $postFields .= "&user.phone.phoneNumber=" . $_billingData->getTelephone();
458
+ }
459
+
460
+
461
+ //$postFields .= "&user.additionalDetails=Payment for ".$data['entity_id'];
462
+ //Billing and Shipping
463
+ if (is_object($_billingData)) {
464
+ $postFields .= "&billingAddress.firstName=" . $_billingData['firstname'];
465
+ $postFields .= "&billingAddress.lastName=" . $_billingData['lastname'];
466
+ //$postFields .= "&billingAddress.phone.countryCode=USA";
467
+ //$postFields .= "&billingAddress.phone.number=1222323".$_billingData['telephone'];
468
+ $postFields .= "&billingAddress.street=" . $_billingData['street'];
469
+ $postFields .= "&billingAddress.city=" . $_billingData['city'];
470
+ //$postFields .= "&billingAddress.state=22";
471
+ $postFields .= "&billingAddress.state=" . $_billingData['region'];
472
+ $postFields .= "&billingAddress.country=" . $_billingData['country_id'];
473
+ $postFields .= "&billingAddress.zipCode=" . $_billingData['postcode'];
474
+ }
475
+
476
+ // shipping address
477
+ if (is_object($_shippingData)) {
478
+ $postFields .= "&shippingAddress.firstName=" . $_shippingData['firstname'];
479
+ $postFields .= "&shippingAddress.lastName=" . $_shippingData['lastname'];
480
+ //$postFields .= "&shippingAddress.phone.countryCode=2323";
481
+ //$postFields .= "&shippingAddress.phone.number=232323".$_shippingData['telephone'];
482
+ $postFields .= "&shippingAddress.street=" . $_shippingData['street'];
483
+ $postFields .= "&shippingAddress.city=" . $_shippingData['city'];
484
+ //$postFields .= "&shippingAddress.state=22";
485
+ $postFields .= "&shippingAddress.state=" . $_shippingData['region'];
486
+ $postFields .= "&shippingAddress.country=" . $_shippingData['country_id'];
487
+ $postFields .= "&shippingAddress.zipCode=" . $_shippingData['postcode'];
488
+ }
489
+ } else {
490
+
491
+ }
492
+ // invoice
493
+ $postFields .= "&invoice.number=" . $data['entity_id'];
494
+ $postFields .= "&invoice.additionalDetails=" . $data['entity_id'] . ': $' . $data['base_grand_total'];
495
+
496
+ // items
497
+ $cartItems = $cart->getQuote()->getAllVisibleItems();
498
+ $i = 1;
499
+ // $tax = 0;
500
+ foreach ($cartItems as $item) {
501
+ $itemdata = $item->getData();
502
+
503
+ $postFields .= "&invoice.items(" . $i . ").id=" . $itemdata['product_id'];
504
+ $postFields .= "&invoice.items(" . $i . ").name=" . $itemdata['name'];
505
+ $postFields .= "&invoice.items(" . $i . ").quantity=" . $itemdata['qty'];
506
+ $postFields .= "&invoice.items(" . $i . ").price=" . $itemdata['price'];
507
+ // $tax += ($item->getData('tax_percent') * $itemdata['price'] * $itemdata['qty']) / 100;
508
+ $i++;
509
+ }
510
+
511
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
512
+
513
+ $coupon_code = $quote->getCouponCode();
514
+ $discount = Mage::helper('zoozpayment')->getdiscount();
515
+
516
+ // $discount = $quote->getSubtotal() - $quote->getSubtotalWithDiscount();
517
+ /*
518
+ $postFields .= "&invoice.items(" . $i . ").id=-i";
519
+ $postFields .= "&invoice.items(" . $i . ").name=Discount";
520
+ $postFields .= "&invoice.items(" . $i . ").quantity=" . 1;
521
+ $postFields .= "&invoice.items(" . $i . ").price=-" . $data['subtotal'];
522
+ $i += 1;
523
+ */
524
+
525
+ if ($discount != '' && $discount > 0) {
526
+ $postFields .= "&invoice.items(" . $i . ").id=-i";
527
+ $postFields .= "&invoice.items(" . $i . ").name=Discount";
528
+ $postFields .= "&invoice.items(" . $i . ").quantity=" . 1;
529
+ $postFields .= "&invoice.items(" . $i . ").price=-" . $discount;
530
+ $i += 1;
531
+ }
532
+
533
+ if (isset($code) && $code != '') {
534
+
535
+ $postFields .= "&invoice.items(" . $i . ").id=-i";
536
+ $postFields .= "&invoice.items(" . $i . ").quantity=" . 1;
537
+ $postFields .= "&invoice.items(" . $i . ").price=-" . $amount;
538
+ }
539
+ }
540
+ $tax = $discount = Mage::helper('zoozpayment')->getTax();
541
+ $postFields .= "&taxAmount=" . $tax;
542
+
543
+ // if (isset($code) && $code != '') {
544
+ $postFields.="&featureProvider=102";
545
+ // }
546
+
547
+
548
+
549
+ return $postFields;
550
+ }
551
+
552
+ public function getPostField() {
553
+
554
+ $postFields = "";
555
+ $session = Mage::getSingleton('checkout/session');
556
+ $session->setQuoteId($session->getZoozQuoteId(true));
557
+ if ($session->getLastRealOrderId()) {
558
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
559
+ if ($order->getId()) {
560
+ $_orderData = $order->getData();
561
+ $_shippingData = $order->getShippingAddress()->getData();
562
+ $_billingData = $order->getBillingAddress()->getData();
563
+
564
+ // cmd
565
+ $postFields .= "cmd=openTrx";
566
+ $postFields .= "&amount=" . $_orderData['grand_total'];
567
+ $postFields .= "&currencyCode=" . $_orderData['order_currency_code'];
568
+ $postFields .= "&taxAmount=" . $_orderData['tax_amount'];
569
+ $postFields.="&isShippingRequired=false";
570
+ // customer
571
+ $postFields .= "&user.idNumber=" . $_orderData['customer_id'];
572
+ $postFields .= "&user.email=" . $_orderData['customer_email'];
573
+ $postFields .= "&user.firstName=" . $_orderData['customer_firstname'];
574
+ $postFields .= "&user.lastName=" . $_orderData['customer_lastname'];
575
+ $postFields .= "&user.phone.phoneNumber=" . $_shippingData['telephone'];
576
+ $postFields .= "&user.additionalDetails=Payment for Invoice #" . $_orderData['increment_id'];
577
+
578
+ // invoice
579
+ $postFields .= "&invoice.number=" . $_orderData['increment_id'];
580
+ $postFields .= "&invoice.additionalDetails=" . $_orderData['shipping_description'] . ': $' . $_orderData['shipping_amount'];
581
+
582
+ // items
583
+ $items = $order->getAllItems();
584
+ $i = 1;
585
+ foreach ($items as $itemId => $item) {
586
+ $postFields .= "&invoice.items(" . $i . ").id=" . $item->getProductId();
587
+ $postFields .= "&invoice.items(" . $i . ").name=" . $item->getName();
588
+ $postFields .= "&invoice.items(" . $i . ").quantity=" . $item->getQtyToInvoice();
589
+ $postFields .= "&invoice.items(" . $i . ").price=" . $item->getPrice();
590
+ $i++;
591
+ }
592
+
593
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
594
+ $coupon_code = $quote->getCouponCode();
595
+ $discount = $quote->getSubtotal() - $quote->getSubtotalWithDiscount();
596
+
597
+ if ($coupon_code != '') {
598
+ $postFields .= "&invoice.items(" . $i . ").id=" . $i;
599
+ $postFields .= "&invoice.items(" . $i . ").name=Discount";
600
+ $postFields .= "&invoice.items(" . $i . ").quantity=" . 1;
601
+ $postFields .= "&invoice.items(" . $i . ").price=" . $discount;
602
+ }
603
+
604
+
605
+ if ($code != '') {
606
+
607
+ $postFields .= "&invoice.items(" . $i . ").id=" . $i;
608
+ $postFields .= "&invoice.items(" . $i . ").quantity=" . 1;
609
+ $postFields .= "&invoice.items(" . $i . ").price=-" . $amount;
610
+ }
611
+
612
+ // billing address
613
+ $postFields .= "&billingAddress.firstName=" . $_billingData['firstname'];
614
+ $postFields .= "&billingAddress.lastName=" . $_billingData['lastname'];
615
+ $postFields .= "&billingAddress.phone.countryCode=USA";
616
+ $postFields .= "&billingAddress.phone.number=1222323" . $_billingData['telephone'];
617
+ $postFields .= "&billingAddress.street=" . $_billingData['street'];
618
+ $postFields .= "&billingAddress.city=" . $_billingData['city'];
619
+ //$postFields .= "&billingAddress.state=22";
620
+ $postFields .= "&billingAddress.state=" . $_billingData['region'];
621
+ $postFields .= "&billingAddress.country=" . $_billingData['country_id'];
622
+ $postFields .= "&billingAddress.zipCode=" . $_billingData['postcode'];
623
+
624
+ // shipping address
625
+ $postFields .= "&shippingAddress.firstName=" . $_shippingData['firstname'];
626
+ $postFields .= "&shippingAddress.lastName=" . $_shippingData['lastname'];
627
+ $postFields .= "&shippingAddress.phone.countryCode=2323";
628
+ $postFields .= "&shippingAddress.phone.number=232323" . $_shippingData['telephone'];
629
+ $postFields .= "&shippingAddress.street=" . $_shippingData['street'];
630
+ $postFields .= "&shippingAddress.city=" . $_shippingData['city'];
631
+ //$postFields .= "&shippingAddress.state=22";
632
+ $postFields .= "&shippingAddress.state=" . $_shippingData['region'];
633
+ $postFields .= "&shippingAddress.country=" . $_shippingData['country_id'];
634
+ $postFields .= "&shippingAddress.zipCode=" . $_shippingData['postcode'];
635
+ }
636
+ }
637
+
638
+
639
+ return $postFields;
640
+ }
641
+
642
+ public function successprocessing() {
643
+ // Flag to indicate whether sandbox environment should be used
644
+ $isSandbox = false;
645
+
646
+ if ($this->getIsSandBox()) {
647
+ $isSandbox = true;
648
+ }
649
+
650
+ $url;
651
+
652
+ if ($isSandbox == true) {
653
+
654
+ $zoozServer = $this->getSandboxUrl();
655
+ $url = $zoozServer . "/mobile/SecuredWebServlet";
656
+ } else {
657
+
658
+ $zoozServer = $this->getProductionUrl();
659
+ $url = $zoozServer . "/mobile/SecuredWebServlet";
660
+ }
661
+ // is cURL installed yet?
662
+
663
+ if (!function_exists('curl_init')) {
664
+ Mage::getSingleton('checkout/session')->addError('Sorry cURL is not installed!');
665
+ return Mage::getUrl('checkout/cart');
666
+ }
667
+
668
+ // OK cool - then let's create a new cURL resource handle
669
+ $ch = curl_init();
670
+
671
+ // Now set some options
672
+ // Set URL
673
+ curl_setopt($ch, CURLOPT_URL, $url);
674
+
675
+ //Header fields: ZooZUniqueID, ZooZAppKey, ZooZResponseType
676
+ $header = array('ZooZUniqueID: ' . $this->getAppUniqueId(), 'ZooZAppKey: ' . $this->getAppKey(), 'ZooZResponseType: NVP');
677
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
678
+
679
+ // If it is a post request
680
+ curl_setopt($ch, CURLOPT_POST, 1);
681
+
682
+ // Timeout in seconds
683
+ curl_setopt($ch, CURLOPT_TIMEOUT, 10);
684
+
685
+ // If you are experiencing issues recieving the token on the sandbox environment, please set this option
686
+ if ($isSandbox) {
687
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
688
+ }
689
+
690
+ $params = Mage::app()->getRequest()->getParams();
691
+
692
+ $transactionID = $params['transactionID'];
693
+
694
+ $sessionToken = $params['sessionToken'];
695
+
696
+ curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=verifyTrx&transactionID=" . $transactionID);
697
+
698
+ ob_start();
699
+
700
+ curl_exec($ch);
701
+
702
+ $result = ob_get_contents();
703
+
704
+ ob_end_clean();
705
+
706
+ parse_str($result);
707
+
708
+ curl_close($ch);
709
+
710
+ // create order with billding return
711
+ $zooz_useremail = Mage::getStoreConfig('payment/zoozpayment/zooz_useremail');
712
+ $zooz_serverkey = Mage::getStoreConfig('payment/zoozpayment/zooz_serverkey');
713
+
714
+ if ($isSandbox) {
715
+ $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, true);
716
+ } else {
717
+ $zooz = new ZooZExtendedServerAPI($zooz_useremail, $zooz_serverkey, false);
718
+ }
719
+ //
720
+ //$info = $zooz->getTransactionDetailsByTransactionID('4QQ6RIRDNNKI7GN37JLHI7BSAI');
721
+
722
+ $info = $zooz->getTransactionDetailsByTransactionID($transactionID);
723
+
724
+ //Get Gift information from Params
725
+
726
+ if (isset($params['gift']) && $params['gift'] != '')
727
+ $giftInfo = $params['gift'];
728
+ else
729
+ $giftInfo = null;
730
+ //
731
+ Mage::getModel('zoozpayment/order')->saveOrder($info, $giftInfo);
732
+ // create order with billding return
733
+ //Mage::log($result);
734
+ Mage::getSingleton('core/session')->setZoozInfo($info);
735
+
736
+ return $statusCode;
737
+ }
738
+
739
+ }
app/code/community/ZooZ/ZoozPayment/controllers/EstimateController.php CHANGED
@@ -29,54 +29,113 @@ class ZooZ_ZoozPayment_EstimateController extends Mage_Catalog_ProductController
29
  *
30
  * Initializes the product and passes data to estimate model in block
31
  */
32
- public function addProduct() {
33
- return $this->_initProduct('');
34
- }
35
 
36
- protected function _initProduct($productId) {
37
  $params = new Varien_Object();
38
- return Mage::helper('catalog/product')->initProduct($productId, $this, $params);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
41
  public function indexAction() {
42
- // $pro = $this->addProduct();
 
 
 
 
 
43
 
44
- // $data_json = $this->getRequest()->getPost('data');
45
- // $data_json = $this->getRequest()->getContent();
46
- $data_json = file_get_contents('php://input');
47
- Mage::log($data_json);
48
- $variable_post = json_decode($data_json);
 
49
  $arr_addressinfo = get_object_vars($variable_post->estimate);
50
  $arr_cart = $variable_post->cart;
51
  $this->getResponse()->setHeader('Content-type', 'application/json');
 
52
  $this->loadLayout(false);
53
  $block = $this->getLayout()->getBlock('shipping.estimate.result');
54
-
55
  if ($block) {
56
-
57
  $estimate = $block->getEstimate();
58
  foreach ($arr_cart as $pro) {
59
- $product = $this->_initProduct($pro->invoiceItemId);
60
- if ($pro->options) {
61
-
 
 
 
 
 
 
 
62
  $params = get_object_vars($pro->options);
63
  $pro_cart = array('product' => $pro->invoiceItemId, 'qty' => $pro->qty, 'options' => $params);
64
-
65
  } else {
66
-
67
  $pro_cart = array('product' => $pro->invoiceItemId, 'qty' => $pro->qty);
68
-
69
  }
70
-
71
  $product->setAddToCartInfo($pro_cart);
72
- $estimate->setProduct($product);
73
- Mage::unregister('current_category');
74
- Mage::unregister('current_product');
75
- Mage::unregister('product');
76
  }
77
  ///$addressInfo = $arr_addressinfo;
78
- $addressConvert = array("city"=> $arr_addressinfo["city"],"region_id"=>$arr_addressinfo["stateName"],"postcode"=>$arr_addressinfo["zipCode"],"country_id"=>$arr_addressinfo["countryCode"]);
79
-
80
  $estimate->setAddressInfo((array) $addressConvert);
81
  $block->getSession()->setFormValues($addressConvert);
82
  try {
29
  *
30
  * Initializes the product and passes data to estimate model in block
31
  */
32
+ protected $productId;
 
 
33
 
34
+ protected function _initProduct() {
35
  $params = new Varien_Object();
36
+ $productId = $this->productId;
37
+ //return Mage::helper('catalog/product')->initProduct($productId, $this, $params);
38
+ return Mage::getModel('catalog/product')->load($productId);
39
+ }
40
+
41
+ public function quoteAction() {
42
+ echo $discount = Mage::helper('zoozpayment')->getdiscount();
43
+ die();
44
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
45
+ $payment = $quote->getPayment();
46
+
47
+ $payment->setMethod('zoozpayment');
48
+ //
49
+ $quote->collectTotals();
50
+ $service = Mage::getModel('sales/service_quote', $quote);
51
+ $service->submitAll();
52
+ //
53
+ $cart = Mage::helper('checkout/cart')->getCart();
54
+ $data = $cart->getQuote()->getData();
55
+
56
+ //$quote = Mage::getSingleton('checkout/session')->getQuote();
57
+ // print_r($quote->getData());
58
+ // $rewardsQuote = Mage::getSingleton('rewards/session')->getQuote();
59
+ // print_r($rewardsQuote);
60
+ // $cart = Mage::getSingleton('checkout/cart');
61
+ // $rewardsQuote = Mage::getModel('rewards/sales_quote');
62
+ //
63
+ // $rewardsQuote->updateItemCatalogPoints( $cart->getQuote() );
64
+ //
65
+ // $cart->getQuote ()->collectTotals ();
66
+ // $cart->getQuote ()->getShippingAddress ()->setCollectShippingRates ( true );
67
+ // $cart->getQuote ()->getShippingAddress ()->collectShippingRates();
68
+ //
69
+ // $rewardsQuote->updateDisabledEarnings( $cart->getQuote() );
70
+ // $cart = Mage::getSingleton('checkout/cart');
71
+ // $rewardsQuote->updateItemCatalogPoints($cart->getQuote());
72
+ // $rewardsQuote->setPointsSpending('500');
73
+ // $cart = Mage::getSingleton('checkout/cart');
74
+ // $rewardsQuote = Mage::getModel('rewards/sales_quote');
75
+ //
76
+ // $rewardsQuote->updateItemCatalogPoints($cart->getQuote());
77
+ //
78
+ // $cart->getQuote()->collectTotals();
79
+ // $cart->getQuote()->getShippingAddress()->setCollectShippingRates(true);
80
+ // $cart->getQuote()->getShippingAddress()->collectShippingRates();
81
+ //
82
+ // $rewardsQuote->updateDisabledEarnings($cart->getQuote());
83
+ // echo $rewardsQuote->getTotalPointsSpendingAsStringList()."kkkk";
84
+ // print_r($rewardsQuote->updateShoppingCartPoints($cart));
85
+ //magento.zooz.com/magentoe/index.php/zoozpayment/index/test/
86
  }
87
 
88
  public function indexAction() {
89
+ Mage::log("Received Estimate controller index action");
90
+ $data_json = $this->getRequest()->getPost('data');
91
+ if ($data_json == '') {
92
+ $data_json = file_get_contents('php://input');
93
+ }
94
+ Mage::log("Json received" . $data_json);
95
 
96
+
97
+ if ($data_json == '') {
98
+ Mage::log("Could not receive data.");
99
+ return;
100
+ }
101
+ $variable_post = json_decode($data_json);
102
  $arr_addressinfo = get_object_vars($variable_post->estimate);
103
  $arr_cart = $variable_post->cart;
104
  $this->getResponse()->setHeader('Content-type', 'application/json');
105
+ Mage::log("Loading layout");
106
  $this->loadLayout(false);
107
  $block = $this->getLayout()->getBlock('shipping.estimate.result');
108
+ Mage::log("Block receieved");
109
  if ($block) {
110
+
111
  $estimate = $block->getEstimate();
112
  foreach ($arr_cart as $pro) {
113
+ Mage::log("Itterating product ID: " . $pro->invoiceItemId);
114
+ if ($pro->invoiceItemId == '-i') {
115
+ continue;
116
+ }
117
+
118
+ $this->productId = $pro->invoiceItemId;
119
+
120
+ $product = $this->_initProduct($pro->invoiceItemId);
121
+ if (isset($pro->options) && $pro->options != '') {
122
+
123
  $params = get_object_vars($pro->options);
124
  $pro_cart = array('product' => $pro->invoiceItemId, 'qty' => $pro->qty, 'options' => $params);
 
125
  } else {
126
+
127
  $pro_cart = array('product' => $pro->invoiceItemId, 'qty' => $pro->qty);
 
128
  }
129
+
130
  $product->setAddToCartInfo($pro_cart);
131
+ $estimate->setProduct($product);
132
+ Mage::unregister('current_category');
133
+ Mage::unregister('current_product');
134
+ Mage::unregister('product');
135
  }
136
  ///$addressInfo = $arr_addressinfo;
137
+ $addressConvert = array("city" => isset($arr_addressinfo["city"]) ? $arr_addressinfo["city"] : "", "region_id" => isset($arr_addressinfo["stateName"]) ? $arr_addressinfo["stateName"] : "", "postcode" => isset($arr_addressinfo["zipCode"]) ? $arr_addressinfo["zipCode"] : "", "country_id" => isset($arr_addressinfo["countryCode"]) ? $arr_addressinfo["countryCode"] : "");
138
+ Mage::log("Address converted");
139
  $estimate->setAddressInfo((array) $addressConvert);
140
  $block->getSession()->setFormValues($addressConvert);
141
  try {
app/code/community/ZooZ/ZoozPayment/controllers/IndexController.php CHANGED
@@ -1,8 +1,70 @@
1
  <?php
2
- class ZooZ_ZoozPayment_IndexController extends Mage_Core_Controller_Front_Action{
 
 
3
  //public function IndexAction() {
4
  //$this->getResponse()->setRedirect(Mage::getUrl('', array('_secure' => true)));
5
  //}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  public function IndexAction() {
8
  $this->loadLayout();
@@ -21,6 +83,6 @@ class ZooZ_ZoozPayment_IndexController extends Mage_Core_Controller_Front_Action
21
  ));
22
 
23
  $this->renderLayout();
 
24
 
25
- }
26
- }
1
  <?php
2
+
3
+ class ZooZ_ZoozPayment_IndexController extends Mage_Core_Controller_Front_Action {
4
+
5
  //public function IndexAction() {
6
  //$this->getResponse()->setRedirect(Mage::getUrl('', array('_secure' => true)));
7
  //}
8
+ public function testAction() {
9
+ // $tempAddress = Mage::getModel('sales/quote_address')->load(596 );
10
+ // $quote = Mage::getSingleton('checkout/session')->getQuote();
11
+ // echo $giftcardAmount = $quote->getGiftCardsAmountUsed();
12
+ // die();
13
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
14
+ print_r($quote->getData());
15
+ die();
16
+ $coupon_code = $quote->getCouponCode();
17
+ $oCoupon = Mage::getModel('salesrule/coupon')->load($coupon_code, 'code');
18
+ $oRule = Mage::getModel('salesrule/rule')->load($oCoupon->getRuleId());
19
+ $oRule->getName();
20
+ die();
21
+ $date = new DateTime('now');
22
+ echo $date->format('Y-m-d H:i:s');
23
+ die();
24
+ $card_history = Mage::getModel('enterprise_giftcardaccount/history');
25
+ $card_history->setGiftcardaccountId();
26
+ $card_history->setUpdatedAt();
27
+ $card_history->setAction(1);
28
+ $card_history->setBalanceAmount();
29
+ $card_history->setAdditionalInfo();
30
+ $card_history->setBalanceDelta();
31
+
32
+ print_r($card_history->getData());
33
+
34
+ die();
35
+ $_card = Mage::getModel('enterprise_giftcardaccount/giftcardaccount')->load(1);
36
+ $_card->setBalance(80);
37
+ $_card->save();
38
+ print_r($_card->getData());
39
+ //
40
+ die();
41
+ $giftcart_s = 'a:1:{i:0;a:4:{s:1:"i";s:1:"2";s:1:"c";s:12:"02DQ9T1K0Y0V";s:1:"a";d:17;s:2:"ba";s:7:"17.0000";}}';
42
+ $giftcart = unserialize($giftcart_s);
43
+ $temp_1 = $giftcart[0];
44
+ $temp_1['authorized'] = $temp_1['a'];
45
+ $temp_2[] = $temp_1;
46
+ $giftcart_auth = serialize($temp_2);
47
+
48
+ die();
49
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
50
+ $shippingAddress = $quote->getShippingAddress();
51
+ // $shippingAddress->setShippingMethod(freeshipping_freeshipping);
52
+ // $shippingAddress->save();
53
+ print_r($shippingAddress->getData());
54
+ echo "Dev";
55
+ // $quote = Mage::getSingleton('checkout/session')->getQuote();
56
+ //
57
+ // $cart = unserialize($quote->getGiftCards());
58
+ //
59
+ // echo $quote->getGiftCardsAmount();
60
+ // echo $quote->getBaseGiftCardsAmount();
61
+ // echo $quote->getGiftCardsAmountUsed();
62
+ // echo $quote->getBaseGiftCardsAmountUsed();
63
+ // print_r($quote->getData());
64
+ // a:1:{i:0;a:5:{s:1:"i";s:1:"2";s:1:"c";s:12:"02DQ9T1K0Y0V";s:1:"a";d:252;s:2:"ba";d:252;s:10:"authorized";d:252;}}
65
+ // echo $giftcardAmount = $quote->getGiftCardsAmountUsed();
66
+ // die();
67
+ }
68
 
69
  public function IndexAction() {
70
  $this->loadLayout();
83
  ));
84
 
85
  $this->renderLayout();
86
+ }
87
 
88
+ }
 
app/code/community/ZooZ/ZoozPayment/controllers/StandardController.php CHANGED
@@ -1,83 +1,115 @@
1
  <?php
 
2
  class ZooZ_ZoozPayment_StandardController extends Mage_Core_Controller_Front_Action {
3
- public function indexAction() {
4
- $this->getResponse()->setRedirect(Mage::getUrl('', array('_secure' => true)));
 
5
  }
6
 
7
- public function redirectAction() {
8
-
9
- $trimmedSessionToken = Mage::getModel('zoozpayment/standard')->ajaxprocessing();
10
- if($trimmedSessionToken != '') {
11
-
12
- $this->getResponse()->setRedirect(Mage::getUrl('zoozpayment').'?token='.$trimmedSessionToken);
13
- }
14
  }
15
 
16
  public function successexpressAction() {
17
-
18
  $statusCode = Mage::getModel('zoozpayment/standard')->successprocessing();
19
-
20
- if ($statusCode == 0) {
21
 
22
- $session = Mage::getSingleton('checkout/session');
23
- $session->setQuoteId($session->getZoozQuoteId(true));
24
- if ($session->getLastRealOrderId()) {
25
- $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
26
- if ($order->getId()) {
27
- $order->setState(Mage_Sales_Model_Order::STATE_NEW, true)->save();
28
- }
29
- }
30
- $this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
31
- } else {
32
- $session = Mage::getSingleton('checkout/session');
33
- $session->setQuoteId($session->getZoozQuoteId(true));
34
- if ($session->getLastRealOrderId()) {
35
- $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
36
- if ($order->getId()) {
37
- $order->cancel()->save();
38
- }
39
- }
40
- $params = Mage::app()->getRequest()->getParams();
41
-
42
- Mage::getSingleton('checkout/session')->addError($params['errorMessage']);
43
- $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
44
- }
45
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
-
48
  public function successAction() {
49
-
50
- $statusCode = Mage::getModel('zoozpayment/standard')->successprocessing();
51
-
52
- if ($statusCode == 0) {
53
- $session = Mage::getSingleton('checkout/session');
54
- $session->setQuoteId($session->getZoozQuoteId(true));
55
- if ($session->getLastRealOrderId()) {
56
- $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
57
- if ($order->getId()) {
58
- $order->setState(Mage_Sales_Model_Order::STATE_NEW, true)->save();
59
- }
60
- }
61
-
62
- $this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
63
- } else {
64
- $session = Mage::getSingleton('checkout/session');
65
- $session->setQuoteId($session->getZoozQuoteId(true));
66
- if ($session->getLastRealOrderId()) {
67
- $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
68
- if ($order->getId()) {
69
- $order->cancel()->save();
70
- }
71
- }
72
- $params = Mage::app()->getRequest()->getParams();
73
-
74
- Mage::getSingleton('checkout/session')->addError($params['errorMessage']);
75
- $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
76
- }
77
-
78
  }
79
-
80
-
81
  function cancelAction() {
82
  $session = Mage::getSingleton('checkout/session');
83
  $session->setQuoteId($session->getZoozQuoteId(true));
@@ -87,32 +119,33 @@ class ZooZ_ZoozPayment_StandardController extends Mage_Core_Controller_Front_Act
87
  $order->cancel()->save();
88
  }
89
  }
90
-
91
  $params = Mage::app()->getRequest()->getParams();
92
  Mage::log($params);
93
- Mage::getSingleton('checkout/session')->addError($params['errorMessage']);
94
- $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
95
  }
96
-
97
  function ajaxstartAction() {
98
- $trimmedSessionToken = Mage::getModel('zoozpayment/standard')->ajaxprocessing(true);
99
- if($trimmedSessionToken != '') {
100
-
101
- echo "var data = {'token' : '" . $trimmedSessionToken . "'}";
102
-
103
- return;
104
- }
 
105
  }
106
-
107
  function startAction() {
108
-
109
- $url = Mage::getModel('zoozpayment/standard')->processing(true);
110
- if($url) {
111
- Mage::getModel('zoozpayment/order')->saveOrder();
112
- $this->getResponse()->setRedirect($url);
113
- } else {
114
- $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
115
- }
116
-
117
  }
118
- }
 
1
  <?php
2
+
3
  class ZooZ_ZoozPayment_StandardController extends Mage_Core_Controller_Front_Action {
4
+
5
+ public function indexAction() {
6
+ $this->getResponse()->setRedirect(Mage::getUrl('', array('_secure' => true)));
7
  }
8
 
9
+ public function redirectAction() {
10
+
11
+ $trimmedSessionToken = Mage::getModel('zoozpayment/standard')->ajaxprocessing();
12
+ if ($trimmedSessionToken != '') {
13
+
14
+ $this->getResponse()->setRedirect(Mage::getUrl('zoozpayment') . '?token=' . $trimmedSessionToken);
15
+ }
16
  }
17
 
18
  public function successexpressAction() {
19
+
20
  $statusCode = Mage::getModel('zoozpayment/standard')->successprocessing();
21
+ if ($statusCode == 0) {
 
22
 
23
+ $session = Mage::getSingleton('checkout/session');
24
+ $session->setQuoteId($session->getZoozQuoteId(true));
25
+ if ($session->getLastRealOrderId()) {
26
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
27
+ if ($order->getId()) {
28
+ // $status = Mage::getStoreConfig('payment/zoozpayment/order_status');
29
+ $grandtotal = Mage::getSingleton('core/session')->getZoozGrandTotal();
30
+ $info = Mage::getSingleton('core/session')->getZoozInfo();
31
+ $payment = $order->getPayment();
32
+ $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED)
33
+ ->setTransactionId($info->transactionID)
34
+ ->setStatusDescription('Payment was successful.')
35
+ ->setAdditionalData(serialize(''))
36
+ ->setIsTransactionClosed('')
37
+ ->authorize(true, $grandtotal)
38
+ ->save();
39
+ $order->setPayment($payment);
40
+ $order->save(); //Save details in order
41
+ if (Mage::getStoreConfig('payment/zoozpayment/payment_action') == "authorize_capture") {
42
+ try {
43
+ if (!$order->canInvoice()) {
44
+ Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
45
+ }
46
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
47
+ if (!$invoice->getTotalQty()) {
48
+ Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
49
+ }
50
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
51
+ $invoice->register();
52
+ $transactionSave = Mage::getModel('core/resource_transaction')
53
+ ->addObject($invoice)
54
+ ->addObject($invoice->getOrder());
55
+ $transactionSave->save();
56
+ } catch (Mage_Core_Exception $e) {
57
+
58
+ }
59
+ }
60
+ Mage::getSingleton('core/session')->unsZoozGrandTotal();
61
+ Mage::getSingleton('core/session')->unsZoozInfo();
62
+ // $order->setState($status, true)->save();
63
+ }
64
+ }
65
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
66
+ } else {
67
+ $session = Mage::getSingleton('checkout/session');
68
+ $session->setQuoteId($session->getZoozQuoteId(true));
69
+ if ($session->getLastRealOrderId()) {
70
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
71
+ if ($order->getId()) {
72
+ $order->cancel()->save();
73
+ }
74
+ }
75
+ $params = Mage::app()->getRequest()->getParams();
76
+
77
+ Mage::getSingleton('checkout/session')->addError($params['errorMessage']);
78
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
79
+ }
80
  }
81
+
82
  public function successAction() {
83
+
84
+ $statusCode = Mage::getModel('zoozpayment/standard')->successprocessing();
85
+
86
+ if ($statusCode == 0) {
87
+ $session = Mage::getSingleton('checkout/session');
88
+ $session->setQuoteId($session->getZoozQuoteId(true));
89
+ if ($session->getLastRealOrderId()) {
90
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
91
+ if ($order->getId()) {
92
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW, true)->save();
93
+ }
94
+ }
95
+
96
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
97
+ } else {
98
+ $session = Mage::getSingleton('checkout/session');
99
+ $session->setQuoteId($session->getZoozQuoteId(true));
100
+ if ($session->getLastRealOrderId()) {
101
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
102
+ if ($order->getId()) {
103
+ $order->cancel()->save();
104
+ }
105
+ }
106
+ $params = Mage::app()->getRequest()->getParams();
107
+
108
+ Mage::getSingleton('checkout/session')->addError($params['errorMessage']);
109
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
110
+ }
 
111
  }
112
+
 
113
  function cancelAction() {
114
  $session = Mage::getSingleton('checkout/session');
115
  $session->setQuoteId($session->getZoozQuoteId(true));
119
  $order->cancel()->save();
120
  }
121
  }
122
+
123
  $params = Mage::app()->getRequest()->getParams();
124
  Mage::log($params);
125
+ Mage::getSingleton('checkout/session')->addError($params['errorMessage']);
126
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
127
  }
128
+
129
  function ajaxstartAction() {
130
+
131
+ $trimmedSessionToken = Mage::getModel('zoozpayment/standard')->ajaxprocessing(true);
132
+ if ($trimmedSessionToken != '') {
133
+
134
+ echo "var data = {'token' : '" . $trimmedSessionToken . "'}";
135
+
136
+ return;
137
+ }
138
  }
139
+
140
  function startAction() {
141
+
142
+ $url = Mage::getModel('zoozpayment/standard')->processing(true);
143
+ if ($url) {
144
+ Mage::getModel('zoozpayment/order')->saveOrder();
145
+ $this->getResponse()->setRedirect($url);
146
+ } else {
147
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
148
+ }
 
149
  }
150
+
151
+ }
app/code/community/ZooZ/ZoozPayment/etc/config.xml CHANGED
@@ -16,6 +16,12 @@
16
  <zoozpayment>
17
  <class>ZooZ_ZoozPayment_Model</class>
18
  </zoozpayment>
 
 
 
 
 
 
19
  </models>
20
  <helpers>
21
  <zoozpayment>
16
  <zoozpayment>
17
  <class>ZooZ_ZoozPayment_Model</class>
18
  </zoozpayment>
19
+ <tax>
20
+ <rewrite>
21
+ <!-- Model -->
22
+ <observer>ZooZ_ZoozPayment_Model_Observer</observer>
23
+ </rewrite>
24
+ </tax>
25
  </models>
26
  <helpers>
27
  <zoozpayment>
app/code/community/ZooZ/ZoozPayment/etc/system.xml CHANGED
@@ -28,10 +28,18 @@
28
  <show_in_website>1</show_in_website>
29
  <show_in_store>1</show_in_store>
30
  </title>
 
 
 
 
 
 
 
 
31
  <order_status translate="label">
32
  <label>New Order Status</label>
33
  <frontend_type>select</frontend_type>
34
- <source_model>adminhtml/system_config_source_order_status</source_model>
35
  <sort_order>30</sort_order>
36
  <show_in_default>1</show_in_default>
37
  <show_in_website>1</show_in_website>
28
  <show_in_website>1</show_in_website>
29
  <show_in_store>1</show_in_store>
30
  </title>
31
+ <payment_action translate="label">
32
+ <label>Payment Action</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>zoozpayment/source_action</source_model>
35
+ <sort_order>21</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ </payment_action>
39
  <order_status translate="label">
40
  <label>New Order Status</label>
41
  <frontend_type>select</frontend_type>
42
+ <source_model>zoozpayment/source_status</source_model>
43
  <sort_order>30</sort_order>
44
  <show_in_default>1</show_in_default>
45
  <show_in_website>1</show_in_website>
app/design/frontend/default/default/template/zoozpayment/index.phtml CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
- die('dev');
3
  $token = Mage::app()->getRequest()->getParam('token');
4
  if($token != ''):
5
  ?>
1
  <?php
 
2
  $token = Mage::app()->getRequest()->getParam('token');
3
  if($token != ''):
4
  ?>
app/design/frontend/default/default/template/zoozpayment/result.phtml CHANGED
@@ -8,17 +8,18 @@ if ($this->getResult()) {
8
  foreach ($_rates as $_rate) {
9
  if (!$_rate->getErrorMessage()) {
10
  $rate_name = $_rate->getMethodTitle();
 
 
11
  $arr[] = array('name' => $rate_name, 'price' => $_rate->getPrice());
12
  }
13
  }
14
- $response[] = array('carrierName' => $this->getCarrierName($code),'carrierCode' => $code, 'rates' => $arr);
 
 
 
 
 
 
15
  }
16
- if(count($arr) == 0)
17
- {
18
- $result[] = array('error'=>true,'message'=>'There is no shipping method available for this address.');
19
- echo json_encode($result);
20
- }
21
- else { echo json_encode($response); }
22
-
23
  }
24
  ?>
8
  foreach ($_rates as $_rate) {
9
  if (!$_rate->getErrorMessage()) {
10
  $rate_name = $_rate->getMethodTitle();
11
+ //
12
+ $rate_name = $_rate->getCode();
13
  $arr[] = array('name' => $rate_name, 'price' => $_rate->getPrice());
14
  }
15
  }
16
+ $response[] = array('carrierName' => $this->getCarrierName($code), 'carrierCode' => $code, 'rates' => $arr);
17
+ }
18
+ if (count($arr) == 0) {
19
+ $result[] = array('error' => true, 'message' => 'There is no shipping method available for this address.');
20
+ echo json_encode($result);
21
+ } else {
22
+ echo json_encode($response);
23
  }
 
 
 
 
 
 
 
24
  }
25
  ?>
app/design/frontend/default/default/template/zoozpayment/shortcut-checkout.phtml CHANGED
@@ -1,6 +1,6 @@
1
  <a id="zooz-payment-link" style="background-color: #679100; padding: 10px; color: white; font-size: small;" href="<?php echo $this->getUrl('zoozpayment/standard/ajaxstart');?>" onclick='return localDoZooz(this);' >Checkout
2
  </a>
3
- <img id="zooz-payment-loading" class="zooz-payment-loading" style="display: none; margin-left: 10px;" src="<?php echo $this->getSkinUrl('zooz/images/loading.gif');?>" alt="loading" title="loading" />
4
  <style>
5
  .cart .title-buttons .checkout-types li { float: none; }
6
  </style>
1
  <a id="zooz-payment-link" style="background-color: #679100; padding: 10px; color: white; font-size: small;" href="<?php echo $this->getUrl('zoozpayment/standard/ajaxstart');?>" onclick='return localDoZooz(this);' >Checkout
2
  </a>
3
+ <img id="zooz-payment-loading" class='zooz-payment-loading' style="display: none; margin-left: 10px;z-index:1000" src="<?php echo $this->getSkinUrl('zooz/images/loading.gif');?>" alt="loading" title="loading" />
4
  <style>
5
  .cart .title-buttons .checkout-types li { float: none; }
6
  </style>
app/etc/modules/ZooZ_ZoozPayment.xml CHANGED
@@ -7,4 +7,4 @@
7
  <version>0.1.0</version>
8
  </ZooZ_ZoozPayment>
9
  </modules>
10
- </config>
7
  <version>0.1.0</version>
8
  </ZooZ_ZoozPayment>
9
  </modules>
10
+ </config>
lib/zooz/zooz.extended.server.api.php CHANGED
@@ -152,11 +152,11 @@
152
  $nvps->add("transactionID", $transactionID);
153
 
154
 
155
-
156
- if (!empty($amount)) {
157
  $nvps->add("amount", $amount);
158
  }
159
 
 
160
  if (!empty($invoice)) {
161
  $nvps->add("invoice", json_encode($invoice));
162
  }
@@ -218,14 +218,14 @@
218
  $decoded = json_decode(trim($chResult), TRUE);
219
  //Mage::log($decoded);
220
  if ($decoded['ResponseStatus'] != 0) {
221
- if (!empty($decoded[ResponseObject]) && !empty($decoded[ResponseObject][errorMessage])) {
222
- $errorMsg = $decoded[ResponseObject][errorMessage];
223
- $errorCode = $decoded[ResponseStatus];
224
  }
225
  throw new ZooZException($errorMsg, $errorCode);
226
  }
227
 
228
- return $decoded[ResponseObject];
229
 
230
  }
231
 
152
  $nvps->add("transactionID", $transactionID);
153
 
154
 
155
+ if ($amount != null) {
 
156
  $nvps->add("amount", $amount);
157
  }
158
 
159
+
160
  if (!empty($invoice)) {
161
  $nvps->add("invoice", json_encode($invoice));
162
  }
218
  $decoded = json_decode(trim($chResult), TRUE);
219
  //Mage::log($decoded);
220
  if ($decoded['ResponseStatus'] != 0) {
221
+ if (!empty($decoded['ResponseObject']) && !empty($decoded['ResponseObject']['errorMessage'])) {
222
+ $errorMsg = $decoded['ResponseObject']['errorMessage'];
223
+ $errorCode = $decoded['ResponseStatus'];
224
  }
225
  throw new ZooZException($errorMsg, $errorCode);
226
  }
227
 
228
+ return $decoded['ResponseObject'];
229
 
230
  }
231
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ZooZ_payment</name>
4
- <version>2.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Checkout module for higher conversions</summary>
10
  <description>Zooz is a complete checkout plugin replaces completely the standard UI and handle payment processing and shipping address.</description>
11
- <notes>Fixed bug in shipping method retrieval and country code parsing</notes>
12
  <authors><author><name>ZooZ Payments</name><user>Zooz_Payments</user><email>info@zooz.com</email></author></authors>
13
- <date>2014-01-20</date>
14
- <time>08:47:26</time>
15
- <contents><target name="magecommunity"><dir name="ZooZ"><dir name="ZoozPayment"><dir name="Block"><file name="Abstract.php" hash="0ac3cf5751fad5f6fd8d2240adedb197"/><dir name="Estimate"><file name="Abstract.php" hash="822638b4ec0a3d0f1f39b4d9f673de5e"/><file name="Result.php" hash="e26d7b8acaeb5424a608e43127844140"/></dir><file name="Estimate.php" hash="e16de59381c39d89633b7e3e53ee6028"/><file name="Index.php" hash="bea9161ac24756a7cf0c841ad8411da9"/></dir><dir name="Helper"><file name="Carrier.php" hash="a6482b94fcb7e419a3759171d0267df6"/><file name="Data.php" hash="392f1c937865b8bb79b13d513ac20215"/><file name="Sanbox.php" hash="9521c1d925d462d8e7d78a3318ee3ee0"/></dir><dir name="Model"><file name="Estimate.php" hash="cf4d18a7bccb4d5bedc32624a5841989"/><file name="Order.php" hash="84724f4d4ea28ca32abfaed01608f919"/><file name="Session.php" hash="f2ae892657034ca2d55205f0703eedde"/><file name="Standard.php" hash="a22f9d8ea3763f6ca8c7ba2a8482e292"/></dir><dir name="controllers"><file name="CartController.php" hash="6c1c69df795bece32f6565acfef22f6d"/><file name="EstimateController.php" hash="43a0f009469fdb83af10c73166c282a1"/><file name="IndexController.php" hash="4d7015bb3ac7e1748cde5917bffca1cc"/><file name="StandardController.php" hash="5541c42cb7de2eb4781ace28b15ebb55"/></dir><dir name="etc"><file name="config.xml" hash="43687ff856324ea05a00685062a20e7b"/><file name="system.xml" hash="b6e432e15e121cb067625e1a2876fb1e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ZooZ_ZoozPayment.xml" hash="9f836c89a16d4693f96ae141906cc77d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="zoozpayment.xml" hash="a3eaf1bf8eb27c4e20d0b30814f20d4f"/></dir><dir name="template"><dir name="zoozpayment"><file name="index.phtml" hash="2a9aeeddace7d15b22708b0421a90d5c"/><file name="result.phtml" hash="1699ea96ebd51f2abb3a9913b81fbd44"/><file name="review.phtml" hash="162e8a7f5548d80bfd987bd6ee0877e4"/><file name="shortcut-checkout.phtml" hash="11680817014ac22a1aa57e11e8f5283c"/><file name="shortcut.phtml" hash="11eb2973b1ce3b7c948d8ed233c33bae"/><file name="sidebar.phtml" hash="2a96c03b4100bb88ba3e9e3fcaa8aa8b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="zooz"><dir name="images"><file name="fastcheckout.png" hash="8f53be05b8c4a3903aec32745e9bf263"/><file name="loading.gif" hash="9a8269421303631316be4ab5e34870e1"/></dir><dir name="js"><file name="jquery-1.9.0.min.js" hash="6c4a706b2e324656fb77c0585c1cff55"/><file name="zooz-magento.js" hash="70e716b6bb6c50091d2bdd7bf1fa26b3"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="zooz"><file name="address.php" hash="40af42bf39330383e05c57bd6ba71759"/><file name="invoice.item.php" hash="37803cf953ca2dab2583cc34f80f7844"/><file name="invoice.php" hash="2e75b69bf1592243c70fd90ebaeba41a"/><file name="nvps.php" hash="cffaa4eb22d14af1ea3e69a522e21ad0"/><file name="transaction.details.php" hash="9e7fea0feb69e7468922e6fb8323a489"/><file name="user.details.php" hash="1e571f792f5e87187e1c85172a19c99d"/><file name="zooz.exception.php" hash="dc5a70ef56e64b1bc76f0407c2187f79"/><file name="zooz.extended.server.api.php" hash="3dbed68e102e2082ca99db45df7fef8f"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ZooZ_payment</name>
4
+ <version>2.0.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Checkout module for higher conversions</summary>
10
  <description>Zooz is a complete checkout plugin replaces completely the standard UI and handle payment processing and shipping address.</description>
11
+ <notes>Upgraded with commit and refund functionality</notes>
12
  <authors><author><name>ZooZ Payments</name><user>Zooz_Payments</user><email>info@zooz.com</email></author></authors>
13
+ <date>2014-04-23</date>
14
+ <time>16:26:20</time>
15
+ <contents><target name="magecommunity"><dir name="ZooZ"><dir name="ZoozPayment"><dir name="Block"><file name="Abstract.php" hash="0ac3cf5751fad5f6fd8d2240adedb197"/><dir name="Estimate"><file name="Abstract.php" hash="822638b4ec0a3d0f1f39b4d9f673de5e"/><file name="Result.php" hash="e26d7b8acaeb5424a608e43127844140"/></dir><file name="Estimate.php" hash="e16de59381c39d89633b7e3e53ee6028"/><file name="Index.php" hash="bea9161ac24756a7cf0c841ad8411da9"/></dir><dir name="Helper"><file name="Carrier.php" hash="a6482b94fcb7e419a3759171d0267df6"/><file name="Data.php" hash="7ffe139c5d5b130a9939f0a03604576c"/><file name="Sanbox.php" hash="9521c1d925d462d8e7d78a3318ee3ee0"/></dir><dir name="Model"><file name="Estimate.php" hash="0fc4bfdec840ff3ed9a43c97202e4314"/><file name="Observer.php" hash="e7583aab0d5594c832a86524a8d24be5"/><file name="Order.php" hash="940864d6b424a88f77d96eab97864200"/><file name="Session.php" hash="f2ae892657034ca2d55205f0703eedde"/><dir name="Source"><file name="Action.php" hash="a63cbdc25709c8a73b83001f19da9bdf"/><file name="Status.php" hash="449c28b272bf8c663b8c29e7ff5d5789"/></dir><file name="Standard.php" hash="cfce615a9de0d56f6e6aa373931fec18"/></dir><dir name="controllers"><file name="CartController.php" hash="6c1c69df795bece32f6565acfef22f6d"/><file name="EstimateController.php" hash="4e8b5fcefe3b179d28675971a4f2e746"/><file name="IndexController.php" hash="00854f4a4d1fcc78e02ade0ae244f668"/><file name="StandardController.php" hash="aa40a54c84535d434e3c6c17230f1bb1"/></dir><dir name="etc"><file name="config.xml" hash="d5dc49c2a0bfbc60d062632352928289"/><file name="system.xml" hash="900402e07be9b23378cc3f9207965445"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ZooZ_ZoozPayment.xml" hash="9b5ce2a8c325f210479527a1c0ebd8a9"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="zoozpayment.xml" hash="a3eaf1bf8eb27c4e20d0b30814f20d4f"/></dir><dir name="template"><dir name="zoozpayment"><file name="index.phtml" hash="c5aaccadf9379fb66c2591c060f7abb5"/><file name="result.phtml" hash="924e788ed0c118910ac098488c76324f"/><file name="review.phtml" hash="162e8a7f5548d80bfd987bd6ee0877e4"/><file name="shortcut-checkout.phtml" hash="d86c127a22f05d826997dd122efeeed6"/><file name="shortcut.phtml" hash="11eb2973b1ce3b7c948d8ed233c33bae"/><file name="sidebar.phtml" hash="2a96c03b4100bb88ba3e9e3fcaa8aa8b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="zooz"><dir name="images"><file name="fastcheckout.png" hash="8f53be05b8c4a3903aec32745e9bf263"/><file name="loading.gif" hash="9a8269421303631316be4ab5e34870e1"/></dir><dir name="js"><file name="jquery-1.9.0.min.js" hash="6c4a706b2e324656fb77c0585c1cff55"/><file name="zooz-magento.js" hash="70e716b6bb6c50091d2bdd7bf1fa26b3"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="zooz"><file name="address.php" hash="40af42bf39330383e05c57bd6ba71759"/><file name="invoice.item.php" hash="37803cf953ca2dab2583cc34f80f7844"/><file name="invoice.php" hash="2e75b69bf1592243c70fd90ebaeba41a"/><file name="nvps.php" hash="cffaa4eb22d14af1ea3e69a522e21ad0"/><file name="transaction.details.php" hash="9e7fea0feb69e7468922e6fb8323a489"/><file name="user.details.php" hash="1e571f792f5e87187e1c85172a19c99d"/><file name="zooz.exception.php" hash="dc5a70ef56e64b1bc76f0407c2187f79"/><file name="zooz.extended.server.api.php" hash="f02d08bda2d088c36f34615788111dfd"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>