Version Notes
Zooz checkout
Download this release
Release Info
Developer | ZooZ Payments |
Extension | ZooZ_payment |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.9.1 to 2.0.1
- app/code/community/ZooZ/.DS_Store +0 -0
- app/code/community/ZooZ/ZoozPayment/.DS_Store +0 -0
- app/code/community/ZooZ/ZoozPayment/Block/Abstract.php +70 -0
- app/code/community/ZooZ/ZoozPayment/Block/Estimate.php +95 -0
- app/code/community/ZooZ/ZoozPayment/Block/Estimate/Abstract.php +69 -0
- app/code/community/ZooZ/ZoozPayment/Block/Estimate/Result.php +95 -0
- app/code/community/ZooZ/ZoozPayment/Model/Estimate.php +238 -0
- app/code/community/ZooZ/ZoozPayment/Model/Order.php +10 -11
- app/code/community/ZooZ/ZoozPayment/Model/Session.php +30 -0
- app/code/community/ZooZ/ZoozPayment/Model/Standard.php +21 -16
- app/code/community/ZooZ/ZoozPayment/controllers/EstimateController.php +98 -0
- app/code/community/ZooZ/ZoozPayment/etc/config.xml +6 -0
- app/code/community/ZooZ/ZoozPayment/etc/system.xml +18 -2
- app/design/frontend/default/default/layout/zoozpayment.xml +53 -38
- app/design/frontend/default/default/template/zoozpayment/.DS_Store +0 -0
- app/design/frontend/default/default/template/zoozpayment/index.phtml +1 -0
- app/design/frontend/default/default/template/zoozpayment/result.phtml +18 -0
- app/design/frontend/default/default/template/zoozpayment/shortcut-checkout.phtml +12 -44
- app/design/frontend/default/default/template/zoozpayment/shortcut.phtml +14 -44
- app/design/frontend/default/default/template/zoozpayment/sidebar.phtml +15 -45
- app/etc/modules/ZooZ_ZoozPayment.xml +1 -1
- lib/zooz/transaction.details.php +4 -1
- lib/zooz/zooz.extended.server.api.php +13 -10
- package.xml +6 -6
- skin/frontend/base/default/zooz/.DS_Store +0 -0
- skin/frontend/base/default/zooz/images/.DS_Store +0 -0
- skin/frontend/base/default/zooz/js/zooz-ext-web-ajax.js +0 -389
- skin/frontend/base/default/zooz/js/zooz-magento.js +31 -0
app/code/community/ZooZ/.DS_Store
DELETED
Binary file
|
app/code/community/ZooZ/ZoozPayment/.DS_Store
DELETED
Binary file
|
app/code/community/ZooZ/ZoozPayment/Block/Abstract.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Abstract block for estimate module
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
abstract class ZooZ_ZoozPayment_Block_Abstract extends Mage_Catalog_Block_Product_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected $_estimate = null;
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
protected $_config = null;
|
16 |
+
|
17 |
+
|
18 |
+
protected $_session = null;
|
19 |
+
|
20 |
+
|
21 |
+
protected $_carriers = null;
|
22 |
+
|
23 |
+
public function getEstimate()
|
24 |
+
{
|
25 |
+
if ($this->_estimate === null) {
|
26 |
+
$this->_estimate = Mage::getSingleton('zoozpayment/estimate');
|
27 |
+
}
|
28 |
+
|
29 |
+
return $this->_estimate;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Retrieve configuration model for module
|
34 |
+
*
|
35 |
+
* @return Lotus_Getshipping_Model_Config
|
36 |
+
*/
|
37 |
+
public function getConfig()
|
38 |
+
{
|
39 |
+
if ($this->_config === null) {
|
40 |
+
$this->_config = Mage::getSingleton('zoozpayment/config');
|
41 |
+
}
|
42 |
+
|
43 |
+
return $this->_config;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieve session model object
|
48 |
+
*
|
49 |
+
* @return Lotus_Getshipping_Model_Session
|
50 |
+
*/
|
51 |
+
public function getSession()
|
52 |
+
{
|
53 |
+
|
54 |
+
if ($this->_session === null) {
|
55 |
+
$this->_session = Mage::getSingleton('zoozpayment/session');
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this->_session;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Check is enabled functionality
|
63 |
+
*
|
64 |
+
* @return boolean
|
65 |
+
*/
|
66 |
+
public function isEnabled()
|
67 |
+
{
|
68 |
+
return $this->getConfig()->isEnabled() && !$this->getProduct()->isVirtual();
|
69 |
+
}
|
70 |
+
}
|
app/code/community/ZooZ/ZoozPayment/Block/Estimate.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category EcomDev
|
13 |
+
* @package Lotus_Getshipping
|
14 |
+
* @copyright Copyright (c) 2010 Ecommerce Developer Blog (http://www.ecomdev.org)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Estiamtion results block
|
20 |
+
*
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
class ZooZ_ZoozPayment_Block_Estimate extends ZooZ_ZoozPayment_Block_Abstract
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Retrieves result from estimate model
|
28 |
+
*
|
29 |
+
* @return array|null
|
30 |
+
*/
|
31 |
+
public function getResult()
|
32 |
+
{
|
33 |
+
return $this->getEstimate()->getResult();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Check result existance
|
38 |
+
*
|
39 |
+
* @return boolean
|
40 |
+
*/
|
41 |
+
public function hasResult()
|
42 |
+
{
|
43 |
+
return $this->getResult() !== null;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieve carrier name for shipping rate group
|
48 |
+
*
|
49 |
+
* @param string $code
|
50 |
+
* @return string|null
|
51 |
+
*/
|
52 |
+
public function getCarrierName($code)
|
53 |
+
{
|
54 |
+
$carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($code);
|
55 |
+
if ($carrier) {
|
56 |
+
return $carrier->getConfigData('title');
|
57 |
+
}
|
58 |
+
|
59 |
+
return null;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Retrieve shipping price for current address and rate
|
64 |
+
*
|
65 |
+
* @param decimal $price
|
66 |
+
* @param boolean $flag show include tax price flag
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getShippingPrice($price, $flag)
|
70 |
+
{
|
71 |
+
return $this->formatPrice(
|
72 |
+
$this->helper('tax')->getShippingPrice(
|
73 |
+
$price,
|
74 |
+
$flag,
|
75 |
+
$this->getEstimate()
|
76 |
+
->getQuote()
|
77 |
+
->getShippingAddress()
|
78 |
+
)
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Format price value depends on store settings
|
84 |
+
*
|
85 |
+
* @param decimal $price
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
public function formatPrice($price)
|
89 |
+
{
|
90 |
+
return $this->getEstimate()
|
91 |
+
->getQuote()
|
92 |
+
->getStore()
|
93 |
+
->convertPrice($price, true);
|
94 |
+
}
|
95 |
+
}
|
app/code/community/ZooZ/ZoozPayment/Block/Estimate/Abstract.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Abstract block for estimate module
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
abstract class ZooZ_ZoozPayment_Block_Estimate_Abstract extends Mage_Catalog_Block_Product_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
protected $_estimate = null;
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
protected $_config = null;
|
16 |
+
|
17 |
+
|
18 |
+
protected $_session = null;
|
19 |
+
|
20 |
+
|
21 |
+
protected $_carriers = null;
|
22 |
+
|
23 |
+
public function getEstimate()
|
24 |
+
{
|
25 |
+
if ($this->_estimate === null) {
|
26 |
+
$this->_estimate = Mage::getSingleton('zoozpayment/estimate');
|
27 |
+
}
|
28 |
+
|
29 |
+
return $this->_estimate;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Retrieve configuration model for module
|
34 |
+
*
|
35 |
+
* @return Lotus_Getshipping_Model_Config
|
36 |
+
*/
|
37 |
+
public function getConfig()
|
38 |
+
{
|
39 |
+
if ($this->_config === null) {
|
40 |
+
$this->_config = Mage::getSingleton('zoozpayment/config');
|
41 |
+
}
|
42 |
+
|
43 |
+
return $this->_config;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieve session model object
|
48 |
+
*
|
49 |
+
* @return Lotus_Getshipping_Model_Session
|
50 |
+
*/
|
51 |
+
public function getSession()
|
52 |
+
{
|
53 |
+
if ($this->_session === null) {
|
54 |
+
$this->_session = Mage::getSingleton('zoozpayment/session');
|
55 |
+
}
|
56 |
+
|
57 |
+
return $this->_session;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Check is enabled functionality
|
62 |
+
*
|
63 |
+
* @return boolean
|
64 |
+
*/
|
65 |
+
public function isEnabled()
|
66 |
+
{
|
67 |
+
return $this->getConfig()->isEnabled() && !$this->getProduct()->isVirtual();
|
68 |
+
}
|
69 |
+
}
|
app/code/community/ZooZ/ZoozPayment/Block/Estimate/Result.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category EcomDev
|
13 |
+
* @package Lotus_Getshipping
|
14 |
+
* @copyright Copyright (c) 2010 Ecommerce Developer Blog (http://www.ecomdev.org)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Estiamtion results block
|
20 |
+
*
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
class ZooZ_ZoozPayment_Block_Estimate_Result extends ZooZ_ZoozPayment_Block_Estimate_Abstract
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Retrieves result from estimate model
|
28 |
+
*
|
29 |
+
* @return array|null
|
30 |
+
*/
|
31 |
+
public function getResult()
|
32 |
+
{
|
33 |
+
return $this->getEstimate()->getResult();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Check result existance
|
38 |
+
*
|
39 |
+
* @return boolean
|
40 |
+
*/
|
41 |
+
public function hasResult()
|
42 |
+
{
|
43 |
+
return $this->getResult() !== null;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieve carrier name for shipping rate group
|
48 |
+
*
|
49 |
+
* @param string $code
|
50 |
+
* @return string|null
|
51 |
+
*/
|
52 |
+
public function getCarrierName($code)
|
53 |
+
{
|
54 |
+
$carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($code);
|
55 |
+
if ($carrier) {
|
56 |
+
return $carrier->getConfigData('title');
|
57 |
+
}
|
58 |
+
|
59 |
+
return null;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Retrieve shipping price for current address and rate
|
64 |
+
*
|
65 |
+
* @param decimal $price
|
66 |
+
* @param boolean $flag show include tax price flag
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getShippingPrice($price, $flag)
|
70 |
+
{
|
71 |
+
return $this->formatPrice(
|
72 |
+
$this->helper('tax')->getShippingPrice(
|
73 |
+
$price,
|
74 |
+
$flag,
|
75 |
+
$this->getEstimate()
|
76 |
+
->getQuote()
|
77 |
+
->getShippingAddress()
|
78 |
+
)
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Format price value depends on store settings
|
84 |
+
*
|
85 |
+
* @param decimal $price
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
public function formatPrice($price)
|
89 |
+
{
|
90 |
+
return $this->getEstimate()
|
91 |
+
->getQuote()
|
92 |
+
->getStore()
|
93 |
+
->convertPrice($price, true);
|
94 |
+
}
|
95 |
+
}
|
app/code/community/ZooZ/ZoozPayment/Model/Estimate.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/ZooZ/ZoozPayment/Model/Order.php
CHANGED
@@ -35,6 +35,7 @@ class ZooZ_ZoozPayment_Model_Order extends Mage_Core_Model_Abstract {
|
|
35 |
// if return gift message
|
36 |
// get value from $info
|
37 |
$return_gift = true;
|
|
|
38 |
if ($return_gift) {
|
39 |
$gift_customer = 0;
|
40 |
if ($customer->getId()) {
|
@@ -82,11 +83,7 @@ class ZooZ_ZoozPayment_Model_Order extends Mage_Core_Model_Abstract {
|
|
82 |
|
83 |
$shippingAddress = Mage::getModel('sales/order_address');
|
84 |
$shipp_address = $info->shippingAddress;
|
85 |
-
|
86 |
-
//Mage::log($country_id);
|
87 |
-
//Mage::log($shipp_address->countryCode);
|
88 |
-
// Mage::log("country " . $shipp_address->country);
|
89 |
-
// Mage::log("country " . $shipp_address->countryCode);
|
90 |
$shippingAddress->setStoreId($storeId)
|
91 |
->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
|
92 |
->setCustomerId($customer->getId())
|
@@ -94,7 +91,7 @@ class ZooZ_ZoozPayment_Model_Order extends Mage_Core_Model_Abstract {
|
|
94 |
->setLastname($shipp_address->lastName)
|
95 |
->setStreet($shipp_address->street)
|
96 |
->setCity($shipp_address->city)
|
97 |
-
->setCountry_id($shipp_address->
|
98 |
->setRegion($shipp_address->state)
|
99 |
->setPostcode($shipp_address->zipCode)
|
100 |
->setTelephone($user->phoneNumber);
|
@@ -249,12 +246,14 @@ class ZooZ_ZoozPayment_Model_Order extends Mage_Core_Model_Abstract {
|
|
249 |
|
250 |
|
251 |
|
252 |
-
|
253 |
$shipping_name = $info->shippingMethod;
|
|
|
|
|
254 |
$order->setSubtotal($subTotal)
|
255 |
-
->
|
256 |
-
->setShippingDescription($shipping_name)
|
257 |
-
->setBaseShippingAmount($
|
258 |
->setShippingAmount($shipping_price)
|
259 |
->setBaseSubtotal($baseSubTotal + $shipping_price)
|
260 |
->setBaseTotalDue($subTotal + $shipping_price)
|
@@ -314,4 +313,4 @@ class ZooZ_ZoozPayment_Model_Order extends Mage_Core_Model_Abstract {
|
|
314 |
return $tempAddress;
|
315 |
}
|
316 |
|
317 |
-
}
|
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()) {
|
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())
|
91 |
->setLastname($shipp_address->lastName)
|
92 |
->setStreet($shipp_address->street)
|
93 |
->setCity($shipp_address->city)
|
94 |
+
->setCountry_id($shipp_address->country)
|
95 |
->setRegion($shipp_address->state)
|
96 |
->setPostcode($shipp_address->zipCode)
|
97 |
->setTelephone($user->phoneNumber);
|
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)
|
313 |
return $tempAddress;
|
314 |
}
|
315 |
|
316 |
+
}
|
app/code/community/ZooZ/ZoozPayment/Model/Session.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category EcomDev
|
13 |
+
* @package EcomDev_ProductPageShipping
|
14 |
+
* @copyright Copyright (c) 2010 Ecommerce Developer Blog (http://www.ecomdev.org)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Session model
|
20 |
+
*
|
21 |
+
* Using for saving the form data between estimations
|
22 |
+
*
|
23 |
+
*/
|
24 |
+
class ZooZ_ZoozPayment_Model_Session extends Mage_Core_Model_Session_Abstract
|
25 |
+
{
|
26 |
+
public function __construct()
|
27 |
+
{
|
28 |
+
$this->init('zoozpayment');
|
29 |
+
}
|
30 |
+
}
|
app/code/community/ZooZ/ZoozPayment/Model/Standard.php
CHANGED
@@ -8,7 +8,7 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
8 |
protected $_isInitializeNeeded = true;
|
9 |
protected $_canUseInternal = false;
|
10 |
protected $_canUseForMultishipping = false;
|
11 |
-
|
12 |
/**
|
13 |
* Return Order place redirect url
|
14 |
*
|
@@ -31,6 +31,14 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
31 |
return $config = Mage::getStoreConfig('payment/zoozpayment/sandbox_flag');
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* Instantiate state and set it to state object
|
36 |
* @param string $paymentAction
|
@@ -62,11 +70,11 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
62 |
|
63 |
if ($isSandbox == true) {
|
64 |
|
65 |
-
$zoozServer =
|
66 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
67 |
} else {
|
68 |
|
69 |
-
$zoozServer =
|
70 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
71 |
}
|
72 |
|
@@ -164,11 +172,12 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
164 |
|
165 |
|
166 |
if ($postFields != '') {
|
|
|
|
|
167 |
if (Mage::getStoreConfig('sales/gift_options/allow_order', null)) {
|
168 |
-
$postFields.="&
|
169 |
-
$postFields.="&providerSupportedFeatures=[100]";
|
170 |
} else {
|
171 |
-
$postFields.="&providerSupportedFeatures=";
|
172 |
}
|
173 |
|
174 |
// Mage::log($postFields);
|
@@ -186,11 +195,11 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
186 |
|
187 |
if ($isSandbox == true) {
|
188 |
|
189 |
-
$zoozServer =
|
190 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
191 |
} else {
|
192 |
|
193 |
-
$zoozServer =
|
194 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
195 |
}
|
196 |
|
@@ -238,7 +247,7 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
238 |
|
239 |
parse_str($result);
|
240 |
|
241 |
-
|
242 |
|
243 |
if ($statusCode == 0) {
|
244 |
// Get token from ZooZ server
|
@@ -495,11 +504,11 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
495 |
|
496 |
if ($isSandbox == true) {
|
497 |
|
498 |
-
$zoozServer =
|
499 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
500 |
} else {
|
501 |
|
502 |
-
$zoozServer =
|
503 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
504 |
}
|
505 |
// is cURL installed yet?
|
@@ -567,11 +576,7 @@ class ZooZ_ZoozPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
|
567 |
|
568 |
//Get Gift information from Params
|
569 |
$giftInfo = $params['gift'];
|
570 |
-
|
571 |
-
//die();
|
572 |
-
|
573 |
-
|
574 |
-
//Mage::log($info);
|
575 |
//
|
576 |
Mage::getModel('zoozpayment/order')->saveOrder($info,$giftInfo);
|
577 |
// create order with billding return
|
8 |
protected $_isInitializeNeeded = true;
|
9 |
protected $_canUseInternal = false;
|
10 |
protected $_canUseForMultishipping = false;
|
11 |
+
|
12 |
/**
|
13 |
* Return Order place redirect url
|
14 |
*
|
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
|
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 |
|
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);
|
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 |
|
247 |
|
248 |
parse_str($result);
|
249 |
|
250 |
+
// Mage::log($result);
|
251 |
|
252 |
if ($statusCode == 0) {
|
253 |
// Get token from ZooZ server
|
504 |
|
505 |
if ($isSandbox == true) {
|
506 |
|
507 |
+
$zoozServer = $this->getSandboxUrl();
|
508 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
509 |
} else {
|
510 |
|
511 |
+
$zoozServer = $this->getProductionUrl();
|
512 |
$url = $zoozServer . "/mobile/SecuredWebServlet";
|
513 |
}
|
514 |
// is cURL installed yet?
|
576 |
|
577 |
//Get Gift information from Params
|
578 |
$giftInfo = $params['gift'];
|
579 |
+
|
|
|
|
|
|
|
|
|
580 |
//
|
581 |
Mage::getModel('zoozpayment/order')->saveOrder($info,$giftInfo);
|
582 |
// create order with billding return
|
app/code/community/ZooZ/ZoozPayment/controllers/EstimateController.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 EcomDev_ProductPageShipping
|
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 |
+
require_once 'app/code/core/Mage/Catalog/controllers/ProductController.php';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Estimate shiping controller, passes the request to estimate model
|
22 |
+
* Extended from product controller for supporting of full product initialization
|
23 |
+
*
|
24 |
+
*/
|
25 |
+
class ZooZ_ZoozPayment_EstimateController extends Mage_Catalog_ProductController {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Estimate action
|
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 |
+
|
79 |
+
$addressConvert = array("city"=> $arr_addressinfo["city"],"region_id"=>$arr_addressinfo["stateName"],"postcode"=>$arr_addressinfo["zipCode"],"country_id"=>$arr_addressinfo["countryCode"]);
|
80 |
+
|
81 |
+
$estimate->setAddressInfo((array) $addressConvert);
|
82 |
+
$block->getSession()->setFormValues($addressConvert);
|
83 |
+
try {
|
84 |
+
$estimate->estimate();
|
85 |
+
} catch (Mage_Core_Exception $e) {
|
86 |
+
Mage::getSingleton('catalog/session')->addError($e->getMessage());
|
87 |
+
} catch (Exception $e) {
|
88 |
+
Mage::logException($e);
|
89 |
+
Mage::getSingleton('catalog/session')->addError(
|
90 |
+
Mage::helper('zoozpayment')->__('There was an error during processing your shipping request')
|
91 |
+
);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
$this->_initLayoutMessages('catalog/session');
|
95 |
+
$this->renderLayout();
|
96 |
+
}
|
97 |
+
|
98 |
+
}
|
app/code/community/ZooZ/ZoozPayment/etc/config.xml
CHANGED
@@ -38,6 +38,12 @@
|
|
38 |
<payment_action>sale</payment_action>
|
39 |
<allowspecific>0</allowspecific>
|
40 |
<sort_order>1</sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
</zoozpayment>
|
42 |
</payment>
|
43 |
</default>
|
38 |
<payment_action>sale</payment_action>
|
39 |
<allowspecific>0</allowspecific>
|
40 |
<sort_order>1</sort_order>
|
41 |
+
<zooz_sandbox_url>https://sandbox.zooz.co</zooz_sandbox_url>
|
42 |
+
<zooz_production_url>https://app.zooz.com</zooz_production_url>
|
43 |
+
<app_key>6fe2b3eb-3017-4d84-a5df-c14d675008ae</app_key>
|
44 |
+
<app_unique_id>com.yourcompany.DemoZooZSDK.magento</app_unique_id>
|
45 |
+
<zooz_serverkey>FMJM7QYXIOO2Y55FXBK7GTHUWE</zooz_serverkey>
|
46 |
+
<zooz_useremail>ronen@tactusmobile.com</zooz_useremail>
|
47 |
</zoozpayment>
|
48 |
</payment>
|
49 |
</default>
|
app/code/community/ZooZ/ZoozPayment/etc/system.xml
CHANGED
@@ -79,7 +79,23 @@
|
|
79 |
<show_in_website>1</show_in_website>
|
80 |
<show_in_store>0</show_in_store>
|
81 |
</app_unique_id>
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
<label>Sort Order</label>
|
84 |
<frontend_type>text</frontend_type>
|
85 |
</sort_order>
|
@@ -92,4 +108,4 @@
|
|
92 |
</groups>
|
93 |
</payment>
|
94 |
</sections>
|
95 |
-
</config>
|
79 |
<show_in_website>1</show_in_website>
|
80 |
<show_in_store>0</show_in_store>
|
81 |
</app_unique_id>
|
82 |
+
<zooz_sandbox_url>
|
83 |
+
<label>Zooz sandbox URL</label>
|
84 |
+
<frontend_type>text</frontend_type>
|
85 |
+
<sort_order>130</sort_order>
|
86 |
+
<show_in_default>0</show_in_default>
|
87 |
+
<show_in_website>0</show_in_website>
|
88 |
+
<show_in_store>0</show_in_store>
|
89 |
+
</zooz_sandbox_url>
|
90 |
+
<zooz_production_url>
|
91 |
+
<label>Zooz production URL</label>
|
92 |
+
<frontend_type>text</frontend_type>
|
93 |
+
<sort_order>131</sort_order>
|
94 |
+
<show_in_default>0</show_in_default>
|
95 |
+
<show_in_website>0</show_in_website>
|
96 |
+
<show_in_store>0</show_in_store>
|
97 |
+
</zooz_production_url>
|
98 |
+
<sort_order translate="label">
|
99 |
<label>Sort Order</label>
|
100 |
<frontend_type>text</frontend_type>
|
101 |
</sort_order>
|
108 |
</groups>
|
109 |
</payment>
|
110 |
</sections>
|
111 |
+
</config>
|
app/design/frontend/default/default/layout/zoozpayment.xml
CHANGED
@@ -3,58 +3,73 @@
|
|
3 |
<layout version="0.1.0">
|
4 |
|
5 |
<default>
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<![CDATA[<script type="text/javascript">jQuery.noConflict();</script>]]>
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
<block type="checkout/links" name="checkout_cart_link_zooz">
|
24 |
<action method="addCartLink" ></action>
|
25 |
</block>
|
26 |
-
|
27 |
<reference name="right">
|
28 |
<reference name="cart_sidebar">
|
29 |
-
|
|
|
|
|
30 |
</reference>
|
31 |
</reference>
|
32 |
</default>
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
49 |
<checkout_cart_index>
|
50 |
-
|
51 |
-
|
52 |
</reference>
|
53 |
<reference name="checkout.cart.methods">
|
54 |
-
|
55 |
<remove name="checkout.cart.methods.multishipping"/>
|
56 |
<block type="core/template" name="checkout.cart.methods.zooz.bottom" after="checkout.cart.methods.onepage" template="zoozpayment/shortcut-checkout.phtml" />
|
57 |
</reference>
|
58 |
</checkout_cart_index>
|
|
|
|
|
|
|
|
|
59 |
</layout>
|
60 |
-
|
3 |
<layout version="0.1.0">
|
4 |
|
5 |
<default>
|
6 |
+
<reference name="head">
|
7 |
+
<action method="addItem">
|
8 |
+
<type>skin_js</type>
|
9 |
+
<name>zooz/js/jquery-1.9.0.min.js</name>
|
10 |
+
</action>
|
11 |
+
|
12 |
+
<action method="addItem">
|
13 |
+
<type>skin_js</type>
|
14 |
+
<name>zooz/js/zooz-magento.js</name>
|
15 |
+
</action>
|
16 |
+
<block type="core/text" name="zooz-ext.js"><action method="setText"><text><![CDATA[<script type="text/javascript" src="https://app.zooz.com/mobile/js/zooz-ext-web-ajax.js"></script>]]></text></action></block>
|
17 |
+
<block type="core/text" name="google.cdn.jquery">
|
18 |
+
<action method="setText">
|
19 |
+
<text>
|
20 |
<![CDATA[<script type="text/javascript">jQuery.noConflict();</script>]]>
|
21 |
+
</text>
|
22 |
+
</action>
|
23 |
+
</block>
|
24 |
+
</reference>
|
25 |
+
<reference name="top.links">
|
26 |
+
<remove name="checkout_cart_link"/>
|
27 |
+
</reference>
|
28 |
+
<reference name="top.links">
|
29 |
<block type="checkout/links" name="checkout_cart_link_zooz">
|
30 |
<action method="addCartLink" ></action>
|
31 |
</block>
|
32 |
+
</reference>
|
33 |
<reference name="right">
|
34 |
<reference name="cart_sidebar">
|
35 |
+
<action method="setTemplate">
|
36 |
+
<template>zoozpayment/sidebar.phtml</template>
|
37 |
+
</action>
|
38 |
</reference>
|
39 |
</reference>
|
40 |
</default>
|
41 |
+
<zoozpayment_index_index>
|
42 |
+
<reference name="root">
|
43 |
+
<action method="setTemplate">
|
44 |
+
<template>page/empty.phtml</template>
|
45 |
+
</action>
|
46 |
+
</reference>
|
47 |
+
<reference name="content">
|
48 |
+
<block type="zoozpayment/index" name="zoozpayment_index" template="zoozpayment/index.phtml"/>
|
49 |
+
</reference>
|
50 |
+
</zoozpayment_index_index>
|
51 |
+
|
52 |
+
<catalog_product_view>
|
53 |
+
<reference name="product.info.addtocart">
|
54 |
+
<block type="page/html_wrapper" name="product.info.addtocart.zooz.wrapper" translate="label">
|
55 |
+
<label>Zooz Payment Checkout Shortcut Wrapper</label>
|
56 |
+
<block type="core/template" name="product.info.addtocart.zooz" template="zoozpayment/shortcut.phtml"/>
|
57 |
+
</block>
|
58 |
+
</reference>
|
59 |
+
</catalog_product_view>
|
60 |
<checkout_cart_index>
|
61 |
+
<reference name="checkout.cart.top_methods">
|
62 |
+
<remove name="checkout.cart.methods.onepage"/>
|
63 |
</reference>
|
64 |
<reference name="checkout.cart.methods">
|
65 |
+
<remove name="checkout.cart.methods.onepage"/>
|
66 |
<remove name="checkout.cart.methods.multishipping"/>
|
67 |
<block type="core/template" name="checkout.cart.methods.zooz.bottom" after="checkout.cart.methods.onepage" template="zoozpayment/shortcut-checkout.phtml" />
|
68 |
</reference>
|
69 |
</checkout_cart_index>
|
70 |
+
<zoozpayment_estimate_index>
|
71 |
+
<block type="zoozpayment/estimate" name="shipping.estimate.result" template="zoozpayment/result.phtml" output="toHtml" />
|
72 |
+
</zoozpayment_estimate_index>
|
73 |
+
|
74 |
</layout>
|
75 |
+
|
app/design/frontend/default/default/template/zoozpayment/.DS_Store
DELETED
Binary file
|
app/design/frontend/default/default/template/zoozpayment/index.phtml
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
$token = Mage::app()->getRequest()->getParam('token');
|
3 |
if($token != ''):
|
4 |
?>
|
1 |
<?php
|
2 |
+
die('dev');
|
3 |
$token = Mage::app()->getRequest()->getParam('token');
|
4 |
if($token != ''):
|
5 |
?>
|
app/design/frontend/default/default/template/zoozpayment/result.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ($this->getResult()) {
|
4 |
+
$response = array();
|
5 |
+
foreach ($this->getResult() as $code => $_rates) {
|
6 |
+
|
7 |
+
$arr = array();
|
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 |
+
echo json_encode($response);
|
17 |
+
}
|
18 |
+
?>
|
app/design/frontend/default/default/template/zoozpayment/shortcut-checkout.phtml
CHANGED
@@ -1,51 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (Mage::getStoreConfig('payment/zoozpayment/sandbox_flag')) {
|
4 |
-
$js = "https://sandbox.zooz.co/mobile/js/zooz-ext-web-ajax.js";
|
5 |
-
}else{
|
6 |
-
$js = "https://app.zooz.com/mobile/js/zooz-ext-web-ajax.js";
|
7 |
-
}
|
8 |
-
?>
|
9 |
-
<script src="<?php echo $js; ?>"></script>
|
10 |
-
<a id="zooz-payment-link" href="<?php echo $this->getUrl('zoozpayment/standard/ajaxstart');?>">
|
11 |
-
<img src="<?php echo $this->getSkinUrl('zooz/images/fastcheckout.png');?>" alt="ZooZ Payment" title="ZooZ Payment" />
|
12 |
</a>
|
13 |
<img id="zooz-payment-loading" style="display: none; margin-left: 10px;" src="<?php echo $this->getSkinUrl('zooz/images/loading.gif');?>" alt="loading" title="loading" />
|
14 |
<style>
|
15 |
.cart .title-buttons .checkout-types li { float: none; }
|
16 |
</style>
|
17 |
-
<script
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
<?php endif; ?>
|
28 |
-
jQuery('#zooz-payment-loading').show();
|
29 |
-
jQuery.ajax({
|
30 |
-
type: frm.attr('method'),
|
31 |
-
url: url,
|
32 |
-
data: frm.serialize(),
|
33 |
-
success: function (response) {
|
34 |
-
jQuery('#zooz-payment-loading').hide();
|
35 |
-
eval(response);
|
36 |
-
zoozStartCheckout({
|
37 |
-
token : data.token,
|
38 |
-
uniqueId : "<?php echo Mage::getModel('zoozpayment/standard')->getAppUniqueId(); ?>",
|
39 |
-
isSandbox : sandbox,
|
40 |
-
returnUrl : "<?php echo $this->getUrl('zoozpayment/standard/successexpress');?>",
|
41 |
-
cancelUrl : "<?php echo $this->getUrl('zoozpayment/standard/cancel');?>"
|
42 |
-
|
43 |
-
});
|
44 |
-
}
|
45 |
-
});
|
46 |
return false;
|
47 |
-
|
48 |
-
});
|
49 |
-
|
50 |
</script>
|
51 |
-
|
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" 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>
|
7 |
+
<script type="text/javascript">
|
8 |
+
function localDoZooz(ref){
|
9 |
+
var isSandbox = <?php echo Mage::getModel('zoozpayment/standard')->getIsSandBox(); ?>;
|
10 |
+
var formObject = jQuery('#product_addtocart_form');
|
11 |
+
var url = jQuery(ref).attr('href');
|
12 |
+
var uniqueId = "<?php echo Mage::getModel('zoozpayment/standard')->getAppUniqueId(); ?>";
|
13 |
+
var returnUrl = "<?php echo $this->getUrl('zoozpayment/standard/successexpress');?>";
|
14 |
+
var cancelUrl = "<?php echo $this->getUrl('zoozpayment/standard/cancel');?>";
|
15 |
+
startZooz(isSandbox, formObject, url, uniqueId, returnUrl, cancelUrl);
|
16 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
return false;
|
18 |
+
}
|
|
|
|
|
19 |
</script>
|
|
app/design/frontend/default/default/template/zoozpayment/shortcut.phtml
CHANGED
@@ -1,52 +1,22 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
-
if (Mage::getStoreConfig('payment/zoozpayment/sandbox_flag')) {
|
4 |
-
$js = "https://sandbox.zooz.co/mobile/js/zooz-ext-web-ajax.js";
|
5 |
-
}else{
|
6 |
-
$js = "https://app.zooz.com/mobile/js/zooz-ext-web-ajax.js";
|
7 |
-
}
|
8 |
-
?>
|
9 |
-
<script src="<?php echo $js; ?>"></script>
|
10 |
-
|
11 |
-
|
12 |
<br/>
|
13 |
<br/>
|
14 |
-
<a id="zooz-payment-link" href="<?php echo $this->getUrl('zoozpayment/cart/add')
|
15 |
-
|
16 |
</a>
|
17 |
-
<img id="zooz-payment-loading" style="display: none; margin-left: 10px;" src="<?php echo $this->getSkinUrl('zooz/images/loading.gif')
|
18 |
<script type="text/javascript">
|
19 |
|
20 |
-
jQuery(document).ready(function($){
|
21 |
-
jQuery('#zooz-payment-link').click(function($){
|
22 |
-
var frm = jQuery('#product_addtocart_form');
|
23 |
-
var url = jQuery(this).attr('href');
|
24 |
-
<?php if(Mage::getModel('zoozpayment/standard')->getIsSandBox()): ?>
|
25 |
-
var sandbox = true;
|
26 |
-
<?php else: ?>
|
27 |
-
var sandbox = false;
|
28 |
-
<?php endif; ?>
|
29 |
-
jQuery('#zooz-payment-loading').show();
|
30 |
-
jQuery.ajax({
|
31 |
-
type: frm.attr('method'),
|
32 |
-
url: url,
|
33 |
-
data: frm.serialize(),
|
34 |
-
success: function (response) {
|
35 |
-
jQuery('#zooz-payment-loading').hide();
|
36 |
-
eval(response);
|
37 |
-
zoozStartCheckout({
|
38 |
-
token : data.token,
|
39 |
-
uniqueId : "<?php echo Mage::getModel('zoozpayment/standard')->getAppUniqueId(); ?>",
|
40 |
-
isSandbox : sandbox,
|
41 |
-
returnUrl : "<?php echo $this->getUrl('zoozpayment/standard/successexpress');?>",
|
42 |
-
cancelUrl : "<?php echo $this->getUrl('zoozpayment/standard/cancel');?>"
|
43 |
-
|
44 |
-
});
|
45 |
-
}
|
46 |
-
});
|
47 |
-
return false;
|
48 |
-
});
|
49 |
-
});
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
</script>
|
52 |
-
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<br/>
|
3 |
<br/>
|
4 |
+
<a id="zooz-payment-link" style="float: right; background-color: #679100; padding: 10px; color: white; font-size: small;" href="<?php echo $this->getUrl('zoozpayment/cart/add'); ?>" onclick="return localDoZooz(this);">
|
5 |
+
Quick Checkout
|
6 |
</a>
|
7 |
+
<img id="zooz-payment-loading" style="display: none; margin-left: 10px;" src="<?php echo $this->getSkinUrl('zooz/images/loading.gif'); ?>" alt="loading" title="loading" />
|
8 |
<script type="text/javascript">
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
function localDoZooz(ref){
|
12 |
+
var isSandbox = <?php echo Mage::getModel('zoozpayment/standard')->getIsSandBox(); ?>;
|
13 |
+
var formObject = jQuery('#product_addtocart_form');
|
14 |
+
var url = jQuery(ref).attr('href');
|
15 |
+
var uniqueId = "<?php echo Mage::getModel('zoozpayment/standard')->getAppUniqueId(); ?>";
|
16 |
+
var returnUrl = "<?php echo $this->getUrl('zoozpayment/standard/successexpress');?>";
|
17 |
+
var cancelUrl = "<?php echo $this->getUrl('zoozpayment/standard/cancel');?>";
|
18 |
+
startZooz(isSandbox, formObject, url, uniqueId, returnUrl, cancelUrl);
|
19 |
+
|
20 |
+
return false;
|
21 |
+
}
|
22 |
</script>
|
|
app/design/frontend/default/default/template/zoozpayment/sidebar.phtml
CHANGED
@@ -59,58 +59,28 @@
|
|
59 |
<?php endif ?>
|
60 |
<?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
|
61 |
<div class="actions">
|
62 |
-
|
63 |
-
|
64 |
-
if (Mage::getStoreConfig('payment/zoozpayment/sandbox_flag')) {
|
65 |
-
$js = "https://sandbox.zooz.co/mobile/js/zooz-ext-web-ajax.js";
|
66 |
-
}else{
|
67 |
-
$js = "https://app.zooz.com/mobile/js/zooz-ext-web-ajax.js";
|
68 |
-
}
|
69 |
-
?>
|
70 |
-
<script src="<?php echo $js; ?>"></script>
|
71 |
-
<a id="zooz-payment-link-side-bar" href="<?php echo $this->getUrl('zoozpayment/standard/ajaxstart');?>" style="float: right">
|
72 |
-
<img src="<?php echo $this->getSkinUrl('zooz/images/fastcheckout.png');?>" alt="ZooZ Payment" title="ZooZ Payment" />
|
73 |
</a>
|
74 |
-
<img id="zooz-payment-loading" style="display: none; margin-left: 10px;" src="<?php echo $this->getSkinUrl('zooz/images/loading.gif');?>" alt="loading" title="loading" />
|
|
|
75 |
<style>
|
76 |
.cart .title-buttons .checkout-types li { float: none; }
|
77 |
</style>
|
78 |
-
<script
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
<?php endif; ?>
|
89 |
-
jQuery('#zooz-payment-loading').show();
|
90 |
-
jQuery.ajax({
|
91 |
-
type: frm.attr('method'),
|
92 |
-
url: url,
|
93 |
-
data: frm.serialize(),
|
94 |
-
success: function (response) {
|
95 |
-
jQuery('#zooz-payment-loading').hide();
|
96 |
-
eval(response);
|
97 |
-
zoozStartCheckout({
|
98 |
-
token : data.token,
|
99 |
-
uniqueId : "<?php echo Mage::getModel('zoozpayment/standard')->getAppUniqueId(); ?>",
|
100 |
-
isSandbox : sandbox,
|
101 |
-
returnUrl : "<?php echo $this->getUrl('zoozpayment/standard/successexpress');?>",
|
102 |
-
cancelUrl : "<?php echo $this->getUrl('zoozpayment/standard/cancel');?>"
|
103 |
-
|
104 |
-
});
|
105 |
-
}
|
106 |
-
});
|
107 |
return false;
|
108 |
-
|
109 |
-
});
|
110 |
-
|
111 |
</script>
|
112 |
|
113 |
-
|
114 |
<?php endif ?>
|
115 |
<?php $_items = $this->getRecentItems() ?>
|
116 |
<?php if(count($_items)): ?>
|
59 |
<?php endif ?>
|
60 |
<?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
|
61 |
<div class="actions">
|
62 |
+
<a id="zooz-payment-link-side-bar" onclick='localDoZooz(this)' href="<?php echo $this->getUrl('zoozpayment/standard/ajaxstart');?>" style="float: right; background-color: #679100; padding: 10px; color: white; font-size: small;">Quick checkout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
</a>
|
64 |
+
<img id="zooz-payment-loading-cart" style="display: none; margin-left: 10px;" src="<?php echo $this->getSkinUrl('zooz/images/loading.gif');?>" alt="loading" title="loading" />
|
65 |
+
</div>
|
66 |
<style>
|
67 |
.cart .title-buttons .checkout-types li { float: none; }
|
68 |
</style>
|
69 |
+
<script type="text/javascript">
|
70 |
+
function localDoZooz(ref){
|
71 |
+
var isSandbox = <?php echo Mage::getModel('zoozpayment/standard')->getIsSandBox(); ?>;
|
72 |
+
var formObject = jQuery('#product_addtocart_form');
|
73 |
+
var url = jQuery(ref).attr('href');
|
74 |
+
var uniqueId = "<?php echo Mage::getModel('zoozpayment/standard')->getAppUniqueId(); ?>";
|
75 |
+
var returnUrl = "<?php echo $this->getUrl('zoozpayment/standard/successexpress');?>";
|
76 |
+
var cancelUrl = "<?php echo $this->getUrl('zoozpayment/standard/cancel');?>";
|
77 |
+
startZooz(isSandbox, formObject, url, uniqueId, returnUrl, cancelUrl);
|
78 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
return false;
|
80 |
+
}
|
|
|
|
|
81 |
</script>
|
82 |
|
83 |
+
|
84 |
<?php endif ?>
|
85 |
<?php $_items = $this->getRecentItems() ?>
|
86 |
<?php if(count($_items)): ?>
|
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/transaction.details.php
CHANGED
@@ -24,6 +24,8 @@ class TransactionDetails {
|
|
24 |
public $shippingAddress;
|
25 |
public $shippingMethod;
|
26 |
public $shippingAmount;
|
|
|
|
|
27 |
|
28 |
function __construct($jsonObj) {
|
29 |
|
@@ -56,7 +58,8 @@ class TransactionDetails {
|
|
56 |
}
|
57 |
$this->shippingMethod = $jsonObj[shippingMethod];
|
58 |
$this->shippingAmount = $jsonObj[shippingAmount];
|
59 |
-
|
|
|
60 |
}
|
61 |
|
62 |
|
24 |
public $shippingAddress;
|
25 |
public $shippingMethod;
|
26 |
public $shippingAmount;
|
27 |
+
public $shippingCarrierCode;
|
28 |
+
public $shippingCarrierName;
|
29 |
|
30 |
function __construct($jsonObj) {
|
31 |
|
58 |
}
|
59 |
$this->shippingMethod = $jsonObj[shippingMethod];
|
60 |
$this->shippingAmount = $jsonObj[shippingAmount];
|
61 |
+
$this->shippingCarrierCode = $jsonObj[shippingCarrierCode];
|
62 |
+
$this->shippingCarrierName = $jsonObj[shippingCarrierName];
|
63 |
}
|
64 |
|
65 |
|
lib/zooz/zooz.extended.server.api.php
CHANGED
@@ -10,8 +10,8 @@
|
|
10 |
private $ch;
|
11 |
|
12 |
|
13 |
-
const SANDBOX_URL =
|
14 |
-
const PRODUCTION_URL = "
|
15 |
|
16 |
|
17 |
|
@@ -26,7 +26,6 @@
|
|
26 |
* @throws ZooZException
|
27 |
*/
|
28 |
function __construct($zoozDeveloperId, $zoozServerAPIKey, $isSandbox) {
|
29 |
-
|
30 |
if (!function_exists('curl_init')){
|
31 |
throw new ZooZException('Sorry cURL is not installed!');
|
32 |
}
|
@@ -44,10 +43,11 @@
|
|
44 |
$zoozServer;
|
45 |
|
46 |
if ($isSandbox) {
|
47 |
-
|
|
|
48 |
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
|
49 |
} else {
|
50 |
-
$zoozServer = self::PRODUCTION_URL;
|
51 |
}
|
52 |
|
53 |
$zoozServer .= "/mobile/ExtendedServerAPI";
|
@@ -203,7 +203,8 @@
|
|
203 |
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
|
204 |
$chResult = curl_exec($this->ch);
|
205 |
$chResult = trim($chResult, "\n");
|
206 |
-
|
|
|
207 |
$errorMsg = "Error communicating with ZooZ server, please check your network connection";
|
208 |
|
209 |
$errorCode = -1;
|
@@ -211,10 +212,12 @@
|
|
211 |
if (empty($chResult)) {
|
212 |
throw new ZooZException($errorMsg);
|
213 |
}
|
214 |
-
|
|
|
|
|
215 |
$decoded = json_decode(trim($chResult), TRUE);
|
216 |
-
|
217 |
-
if ($decoded[ResponseStatus] != 0) {
|
218 |
if (!empty($decoded[ResponseObject]) && !empty($decoded[ResponseObject][errorMessage])) {
|
219 |
$errorMsg = $decoded[ResponseObject][errorMessage];
|
220 |
$errorCode = $decoded[ResponseStatus];
|
@@ -234,4 +237,4 @@
|
|
234 |
}
|
235 |
|
236 |
}
|
237 |
-
?>
|
10 |
private $ch;
|
11 |
|
12 |
|
13 |
+
#const SANDBOX_URL = "http://dev.zooz.co:9090";# Mage::getModel('zoozpayment/standard')->getSandboxUrl();
|
14 |
+
#const PRODUCTION_URL = ""; #Mage::getStoreConfig('payment/zoozpayment/zooz_production_url');
|
15 |
|
16 |
|
17 |
|
26 |
* @throws ZooZException
|
27 |
*/
|
28 |
function __construct($zoozDeveloperId, $zoozServerAPIKey, $isSandbox) {
|
|
|
29 |
if (!function_exists('curl_init')){
|
30 |
throw new ZooZException('Sorry cURL is not installed!');
|
31 |
}
|
43 |
$zoozServer;
|
44 |
|
45 |
if ($isSandbox) {
|
46 |
+
#Mage::log(Mage::getModel('zoozpayment/standard')->getSandboxUrl());
|
47 |
+
$zoozServer = Mage::getModel('zoozpayment/standard')->getSandboxUrl(); #self::SANDBOX_URL;
|
48 |
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
|
49 |
} else {
|
50 |
+
$zoozServer = Mage::getModel('zoozpayment/standard')->getProductionUrl(); #self::PRODUCTION_URL;
|
51 |
}
|
52 |
|
53 |
$zoozServer .= "/mobile/ExtendedServerAPI";
|
203 |
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
|
204 |
$chResult = curl_exec($this->ch);
|
205 |
$chResult = trim($chResult, "\n");
|
206 |
+
//Mage::log($chResult);
|
207 |
+
|
208 |
$errorMsg = "Error communicating with ZooZ server, please check your network connection";
|
209 |
|
210 |
$errorCode = -1;
|
212 |
if (empty($chResult)) {
|
213 |
throw new ZooZException($errorMsg);
|
214 |
}
|
215 |
+
|
216 |
+
|
217 |
+
|
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];
|
237 |
}
|
238 |
|
239 |
}
|
240 |
+
?>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ZooZ_payment</name>
|
4 |
-
<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
|
11 |
-
<notes>
|
12 |
<authors><author><name>ZooZ Payments</name><user>Zooz_Payments</user><email>info@zooz.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>13:
|
15 |
-
<contents><target name="magecommunity"><dir name="ZooZ"><dir name="ZoozPayment"><dir name="Block"><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="Order.php" hash="
|
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.1</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>Zooz checkout</notes>
|
12 |
<authors><author><name>ZooZ Payments</name><user>Zooz_Payments</user><email>info@zooz.com</email></author></authors>
|
13 |
+
<date>2014-01-01</date>
|
14 |
+
<time>13:25:35</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="49f8d316ef895172e59bb06a08b48771"/><file name="Session.php" hash="f2ae892657034ca2d55205f0703eedde"/><file name="Standard.php" hash="a7b496d96a63fd8e337eaefdcdb31c38"/></dir><dir name="controllers"><file name="CartController.php" hash="6c1c69df795bece32f6565acfef22f6d"/><file name="EstimateController.php" hash="d8f48c964b95ba71d78f558dc774c345"/><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="f25b728d4924d268872b3c2d53c9dc75"/></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="b307b3fc11f42fc375f640f06d0e1ee4"/><file name="review.phtml" hash="162e8a7f5548d80bfd987bd6ee0877e4"/><file name="shortcut-checkout.phtml" hash="a57de244881f9ebf07809bc3175a597c"/><file name="shortcut.phtml" hash="f4b7bda1ad1fe0756954991fce63295c"/><file name="sidebar.phtml" hash="45376174d8d4e21cb43fc62ced8820c3"/></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="df7d456b95139fdbc4813d288c724142"/></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>
|
skin/frontend/base/default/zooz/.DS_Store
DELETED
Binary file
|
skin/frontend/base/default/zooz/images/.DS_Store
DELETED
Binary file
|
skin/frontend/base/default/zooz/js/zooz-ext-web-ajax.js
DELETED
@@ -1,389 +0,0 @@
|
|
1 |
-
var Zooz = Zooz || {};
|
2 |
-
|
3 |
-
Zooz.zoozServerProduction = "https://app.zooz.com";
|
4 |
-
Zooz.zoozServerSandbox = "https://sandbox.zooz.co";
|
5 |
-
|
6 |
-
Zooz.zoozServerProduction_dev = "http://192.168.1.22:8085";
|
7 |
-
Zooz.zoozServerSandbox_dev = "http://192.168.1.22:8085";
|
8 |
-
|
9 |
-
Zooz.serverProduction_111 = "http://192.168.1.111:8080";
|
10 |
-
Zooz.serverSandbox_111 = "http://192.168.1.111:8090";
|
11 |
-
|
12 |
-
Zooz.serverProduction_dev = "http://dev.zooz.co:8585";
|
13 |
-
Zooz.serverSandbox_dev = "http://dev.zooz.co:8090";
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
Zooz.environemtProduction = Zooz.serverProduction_dev;
|
18 |
-
Zooz.environemtSandbox = Zooz.serverSandbox_dev;
|
19 |
-
/*
|
20 |
-
* The information in this document is proprietary
|
21 |
-
* to TactusMobile and the TactusMobile Product Development.
|
22 |
-
* It may not be used, reproduced or disclosed without
|
23 |
-
* the written approval of the General Manager of
|
24 |
-
* TactusMobile Product Development.
|
25 |
-
*
|
26 |
-
* PRIVILEGED AND CONFIDENTIAL
|
27 |
-
* TACTUS MOBILE PROPRIETARY INFORMATION
|
28 |
-
* REGISTRY SENSITIVE INFORMATION
|
29 |
-
*
|
30 |
-
* Copyright (c) 2010 TactusMobile, Inc. All rights reserved.
|
31 |
-
*/
|
32 |
-
//var spinner;
|
33 |
-
var Zooz = Zooz || {};
|
34 |
-
|
35 |
-
//Zooz.zoozServerProduction = "https://app.zooz.com";
|
36 |
-
//Zooz.zoozServerSandbox = "https://sandbox.zooz.co";
|
37 |
-
//
|
38 |
-
//Zooz.zoozServerProduction_dev = "http://192.168.1.22:8085";
|
39 |
-
//Zooz.zoozServerSandbox_dev = "http://192.168.1.22:8085";
|
40 |
-
//
|
41 |
-
//Zooz.serverProduction_111 = "http://192.168.1.111:8080";
|
42 |
-
//Zooz.serverSandbox_111 = "http://192.168.1.111:8090";
|
43 |
-
//
|
44 |
-
//
|
45 |
-
//
|
46 |
-
//Zooz.environemtProduction = Zooz.zoozServerProduction_dev;
|
47 |
-
//Zooz.environemtSandbox = Zooz.zoozServerSandbox_dev;
|
48 |
-
|
49 |
-
|
50 |
-
Zooz.centerPosition = function(elem, elemWidth, elemHeight) {
|
51 |
-
var e = window
|
52 |
-
, a = 'inner';
|
53 |
-
if (!( 'innerWidth' in window )) {
|
54 |
-
a = 'client';
|
55 |
-
e = document.documentElement || document.body;
|
56 |
-
}
|
57 |
-
|
58 |
-
var width = e[ a + 'Width' ];
|
59 |
-
var height = e[ a + 'Height' ];
|
60 |
-
|
61 |
-
if (width > elemWidth) {
|
62 |
-
elem.style.left = 0.5 * (width - elemWidth) + "px";
|
63 |
-
}
|
64 |
-
|
65 |
-
if (height > elemHeight) {
|
66 |
-
elem.style.top = 0.5 * (height - elemHeight) + "px";
|
67 |
-
}
|
68 |
-
};
|
69 |
-
|
70 |
-
|
71 |
-
var zoozStartCheckout = function(zoozParams) {
|
72 |
-
|
73 |
-
var zoozOverlay;
|
74 |
-
var zoozIframe;
|
75 |
-
var zoozCloseButton;
|
76 |
-
var zoozDialogContainer;
|
77 |
-
var zoozServer;
|
78 |
-
|
79 |
-
var that = this;
|
80 |
-
|
81 |
-
var isIE = navigator.userAgent.match(/MSIE/i);
|
82 |
-
|
83 |
-
var isZoozLive = true;
|
84 |
-
var pingZoozOverlay = function() {
|
85 |
-
setTimeout(function() {
|
86 |
-
if (isZoozLive) {
|
87 |
-
isZoozLive = false;
|
88 |
-
try {
|
89 |
-
zoozIframe.contentWindow.postMessage('check-zooz', zoozServer);
|
90 |
-
pingZoozOverlay();
|
91 |
-
} catch(ex) {
|
92 |
-
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
-
} else {
|
97 |
-
try {
|
98 |
-
if (zoozCloseButton) {
|
99 |
-
closezooz = closeWindow;
|
100 |
-
}
|
101 |
-
|
102 |
-
alert('zooz window is dead');
|
103 |
-
} catch(ex) {
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
}
|
108 |
-
}, 1000);
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
;
|
113 |
-
|
114 |
-
|
115 |
-
var listener = function(event) {
|
116 |
-
if (event.origin !== Zooz.environemtProduction) {
|
117 |
-
return;
|
118 |
-
}
|
119 |
-
if (event.data === 'zooz-alive') {
|
120 |
-
isZoozLive = true;
|
121 |
-
|
122 |
-
} else if (event.data === 'zooz-started') {
|
123 |
-
closezooz = closeByPost;
|
124 |
-
pingZoozOverlay();
|
125 |
-
} else {
|
126 |
-
closeWindow();
|
127 |
-
}
|
128 |
-
|
129 |
-
};
|
130 |
-
|
131 |
-
|
132 |
-
if (window.addEventListener) {
|
133 |
-
|
134 |
-
addEventListener("message", listener, false);
|
135 |
-
} else {
|
136 |
-
attachEvent("onmessage", listener);
|
137 |
-
}
|
138 |
-
|
139 |
-
var closeWindow = function() {
|
140 |
-
console.log('close window');
|
141 |
-
var elem = document.getElementById('zooz-overlay');
|
142 |
-
if (elem) {
|
143 |
-
try {
|
144 |
-
|
145 |
-
|
146 |
-
document.body.removeChild(elem);
|
147 |
-
window.removeEventListener('message', listener, false);
|
148 |
-
// if (zoozParams.closeCallbackFunc) {
|
149 |
-
// zoozParams.closeCallbackFunc();
|
150 |
-
// }
|
151 |
-
delete that;
|
152 |
-
} catch(ex) {
|
153 |
-
|
154 |
-
}
|
155 |
-
}
|
156 |
-
};
|
157 |
-
|
158 |
-
var closeByPost = function() {
|
159 |
-
console.log('close by post');
|
160 |
-
zoozIframe.contentWindow.postMessage('close-zooz', zoozServer);
|
161 |
-
};
|
162 |
-
|
163 |
-
var showzooz = function () {
|
164 |
-
document.getElementById('zooz-overlay').style.visibility = 'visible';
|
165 |
-
document.getElementById('zooz-overlay').style.opacity = '1';
|
166 |
-
};
|
167 |
-
var hidezooz = function() {
|
168 |
-
document.getElementById('zooz-overlay').style.visibility = 'hidden';
|
169 |
-
document.getElementById('zooz-overlay').style.opacity = '0';
|
170 |
-
};
|
171 |
-
var closezooz = closeWindow;
|
172 |
-
// closeByPost;
|
173 |
-
// closeWindow;
|
174 |
-
|
175 |
-
|
176 |
-
if (document.getElementById('zooz-overlay')) {
|
177 |
-
return;
|
178 |
-
}
|
179 |
-
|
180 |
-
if (!zoozParams.token) {
|
181 |
-
alert("Error starting ZooZ checkout: Token is empty");
|
182 |
-
return;
|
183 |
-
}
|
184 |
-
|
185 |
-
if (!zoozParams.uniqueId) {
|
186 |
-
alert("Error starting ZooZ checkout: Unique ID is empty");
|
187 |
-
return;
|
188 |
-
}
|
189 |
-
|
190 |
-
|
191 |
-
if (zoozParams.isSandbox) {
|
192 |
-
zoozServer = Zooz.environemtSandbox;
|
193 |
-
} else {
|
194 |
-
zoozServer = Zooz.environemtProduction;
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
// var pixelRatio = 1;
|
199 |
-
// try {
|
200 |
-
// pixelRatio = window.devicePixelRatio;
|
201 |
-
// } catch (e) {
|
202 |
-
// pixelRatio = 1;
|
203 |
-
// }
|
204 |
-
|
205 |
-
// if (pixelRatio === undefined || pixelRatio == 1) {
|
206 |
-
//
|
207 |
-
// try {
|
208 |
-
// if (!zoozParams.useMobileSize && window.matchMedia("(min-device-width: 540px)").matches && window.matchMedia("(min-device-height: 560px)").matches) {
|
209 |
-
// largeViewport = true;
|
210 |
-
// }
|
211 |
-
// } catch (e) {
|
212 |
-
//
|
213 |
-
// try {
|
214 |
-
// if (window.matchMedia("(min-width: 540px)").matches && window.matchMedia("(min-height: 560px)").matches) {
|
215 |
-
// largeViewport = true;
|
216 |
-
// }
|
217 |
-
// } catch (e) {
|
218 |
-
// var isIE7 = navigator.userAgent.match(/MSIE 7.0/i);
|
219 |
-
// var isIE8 = navigator.userAgent.match(/MSIE 8.0/i);
|
220 |
-
// var isIE9 = navigator.userAgent.match(/MSIE 9.0/i);
|
221 |
-
// var isIEMobile = navigator.userAgent.match(/IEMobile/i);
|
222 |
-
// if (isIE7 || isIE8 || (isIE9 && !isIEMobile)) {
|
223 |
-
// largeViewport = true;
|
224 |
-
// }
|
225 |
-
// }
|
226 |
-
// }
|
227 |
-
//
|
228 |
-
//
|
229 |
-
// }
|
230 |
-
|
231 |
-
|
232 |
-
var isIE8 = navigator.userAgent.match(/MSIE 8.0/i);
|
233 |
-
|
234 |
-
|
235 |
-
var iframeSrc = zoozServer + "/mobile/mobilewebajax/zooz-checkout.jsp?token=" + zoozParams.token + "&uniqueID=" + zoozParams.uniqueId;
|
236 |
-
|
237 |
-
|
238 |
-
// spinner = document.createElement('img');
|
239 |
-
// spinner.src = zoozServer + "/mobile/mobileweb/img/loader_spinner.gif";
|
240 |
-
// spinner.style.position = 'absolute';
|
241 |
-
// spinner.style.zIndex = "99999";
|
242 |
-
// spinner.style.opacity = 0.4;
|
243 |
-
// spinner.style.filter = 'alpha(opacity=40)';
|
244 |
-
// showSpinner();
|
245 |
-
|
246 |
-
if (zoozParams.returnUrl) {
|
247 |
-
iframeSrc += "&returnUrl=" + zoozParams.returnUrl;
|
248 |
-
}
|
249 |
-
|
250 |
-
if (zoozParams.cancelUrl) {
|
251 |
-
iframeSrc += "&cancelUrl=" + zoozParams.cancelUrl;
|
252 |
-
}
|
253 |
-
|
254 |
-
if (zoozParams.rememberMeDefault == false) {
|
255 |
-
iframeSrc += "&uncheckRememberMe=true";
|
256 |
-
}
|
257 |
-
|
258 |
-
if (zoozParams.preferredLanguage) {
|
259 |
-
iframeSrc += "&preferredLanguage=" + zoozParams.preferredLanguage;
|
260 |
-
}
|
261 |
-
|
262 |
-
if (zoozParams.customStylesheet) {
|
263 |
-
iframeSrc += "&customStylesheet=" + zoozParams.customStylesheet;
|
264 |
-
}
|
265 |
-
|
266 |
-
// var div = document.createElement('div');
|
267 |
-
|
268 |
-
|
269 |
-
if (zoozParams.completeCallBackFunc) {
|
270 |
-
iframeSrc += "&callbackDomain=" + window.location.protocol + "//" + window.location.host;
|
271 |
-
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
|
272 |
-
var eventer = window[eventMethod];
|
273 |
-
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
|
274 |
-
|
275 |
-
// Listen to message from child window
|
276 |
-
eventer(messageEvent, function(e) {
|
277 |
-
if (e.origin === zoozServer) {
|
278 |
-
if (zoozOverlay && zoozOverlay.parentNode) {
|
279 |
-
closezooz(zoozOverlay);
|
280 |
-
zoozParams.completeCallBackFunc(e.data);
|
281 |
-
}
|
282 |
-
// if (zoozOverlay && zoozOverlay.parentNode) {
|
283 |
-
// zoozOverlay.parentNode.removeChild(zoozOverlay);
|
284 |
-
// zoozParams.completeCallBackFunc(e.data);
|
285 |
-
// }
|
286 |
-
}
|
287 |
-
}, false);
|
288 |
-
|
289 |
-
}
|
290 |
-
|
291 |
-
if (zoozParams.shippingMethods) {
|
292 |
-
iframeSrc += "&shippingMethods="+ zoozParams.shippingMethods;
|
293 |
-
// for (var shippingMethod in zoozParams.shippingMethods) {
|
294 |
-
// if (zoozParams.shippingMethods.hasOwnProperty(shippingMethod)) {
|
295 |
-
// iframeSrc += "&shippingMethods=" + shippingMethod + "&shippingPrices=" + zoozParams.shippingMethods[shippingMethod];
|
296 |
-
// }
|
297 |
-
// }
|
298 |
-
}
|
299 |
-
|
300 |
-
// Zooz.injectedCode.join()
|
301 |
-
|
302 |
-
// html injection
|
303 |
-
// div.innerHTML = Zooz.injectedCode.join("");
|
304 |
-
// document.body.appendChild(div);
|
305 |
-
// var zoozIframe = document.getElementById('zooz-iframe');
|
306 |
-
// var zoozCloseButton = document.getElementById('zooz-close-button');
|
307 |
-
//
|
308 |
-
// '<div id="zooz-overlay" style="background:rgba(0,0,0,0.6);position:fixed;z-index:999999;width:100%;height:100%;top:0;bottom:0;left:0;right:0;visibility:hidden;opacity:0;transition:all 0.3s ease-out;-webkit-transition:all 0.3s ease-out;-moz-transition:all 0.3s ease-out;-o-transition:all 0.3s ease-out;">',
|
309 |
-
// '<div id="zooz-dialog-container" style="width:650px;background-color:rgba(255,255,255,1);position:fixed;top:50%;left:50%;margin-left:-325px;margin-top:-350px;padding:0;line-height:0;">',
|
310 |
-
// '<div id="zooz-close-button" style="position:absolute;background:url(' + zoozServer + '/mobile/mobilewebajax/img/ico-close.png) no-repeat left top;right:5px;top:8px;width:12px;height:12px;cursor:pointer;"></div>',
|
311 |
-
// '<iframe id="zooz-iframe" allowtransparency="true" frameborder="0" width="650px" height="710px" marginheight="0" marginwidth="0" scrolling="no" ></iframe>',
|
312 |
-
// ' </div>',
|
313 |
-
// '</div>',
|
314 |
-
|
315 |
-
|
316 |
-
zoozOverlay = document.createElement('div');
|
317 |
-
zoozOverlay.id = "zooz-overlay";
|
318 |
-
zoozOverlay.style.cssText = 'position:fixed;z-index:999999;width:100%;height:100%;top:0;bottom:0;left:0;right:0;visibility:hidden;opacity:0;transition:all 0.3s ease-out;-webkit-transition:all 0.3s ease-out;-moz-transition:all 0.3s ease-out;-o-transition:all 0.3s ease-out;';
|
319 |
-
if (!isIE8) {
|
320 |
-
zoozOverlay.style.cssText += 'background:rgba(0,0,0,0.6);';
|
321 |
-
}
|
322 |
-
document.body.appendChild(zoozOverlay);
|
323 |
-
// zoozOverlay.style.background = 'rgba(0,0,0,0.6)';
|
324 |
-
// zoozOverlay.style.position= 'fixed';
|
325 |
-
// zoozOverlay.style.zIndex ='999999' ;
|
326 |
-
// zoozOverlay.style.width='100%';
|
327 |
-
// zoozOverlay.style.height = '100%';
|
328 |
-
// zoozOverlay.style.top = '0';
|
329 |
-
// zoozOverlay.style.bottom = '0';
|
330 |
-
// zoozOverlay.style.left = '0';
|
331 |
-
// zoozOverlay.style.right = '0';
|
332 |
-
// zoozOverlay.style.visibility = 'hidden';
|
333 |
-
// zoozOverlay.style.opacity = '0';
|
334 |
-
// zoozOverlay.style.o -o-transition:all 0.3s ease-out;
|
335 |
-
// zoozOverlay.style.opacity;
|
336 |
-
// zoozOverlay.style.opacity;
|
337 |
-
// zoozOverlay.style.opacity;
|
338 |
-
|
339 |
-
|
340 |
-
zoozDialogContainer = document.createElement('div');
|
341 |
-
zoozDialogContainer.id = 'zooz-dialog-container';
|
342 |
-
zoozDialogContainer.style.cssText = 'width:650px;background-color:#FFFFFF;position:fixed;top:50%;left:50%;margin-left:-325px;margin-top:-350px;padding:0;line-height:0;';
|
343 |
-
zoozOverlay.appendChild(zoozDialogContainer);
|
344 |
-
|
345 |
-
zoozCloseButton = document.createElement('div');
|
346 |
-
zoozCloseButton.id = 'zooz-close-button';
|
347 |
-
zoozCloseButton.style.cssText = "position:absolute;background:url(" + zoozServer + "/mobile/mobilewebajax/img/ico-close.png) no-repeat left top;right:5px;top:8px;width:12px;height:12px;cursor:pointer;";
|
348 |
-
zoozDialogContainer.appendChild(zoozCloseButton);
|
349 |
-
|
350 |
-
zoozIframe = document.createElement('iframe');
|
351 |
-
zoozIframe.id = 'zooz-iframe';
|
352 |
-
zoozIframe.setAttribute('allowtransparency', "true");
|
353 |
-
zoozIframe.setAttribute('frameborder', "0");
|
354 |
-
zoozIframe.setAttribute('width', "650px");
|
355 |
-
zoozIframe.setAttribute('height', "710px");
|
356 |
-
zoozIframe.setAttribute('marginheight', "0");
|
357 |
-
zoozIframe.setAttribute('marginwidth', "0");
|
358 |
-
zoozIframe.setAttribute('scrolling', "no");
|
359 |
-
zoozDialogContainer.appendChild(zoozIframe);
|
360 |
-
|
361 |
-
zoozIframe.setAttribute('src', iframeSrc);
|
362 |
-
zoozCloseButton.onclick = function() {
|
363 |
-
closezooz(zoozOverlay)
|
364 |
-
};
|
365 |
-
// onMouseOver="document.getElementById(\'zooz-close-button\').style.cssText+=\'background-position:left bottom\'"
|
366 |
-
zoozCloseButton.onmouseover = function() {
|
367 |
-
var el = document.getElementById('zooz-close-button');
|
368 |
-
if (el) {
|
369 |
-
el.style.cssText += 'background-position:left bottom';
|
370 |
-
}
|
371 |
-
};
|
372 |
-
zoozCloseButton.onmouseout = function() {
|
373 |
-
var el = document.getElementById('zooz-close-button');
|
374 |
-
if (el) {
|
375 |
-
el.style.cssText += 'background-position:left top';
|
376 |
-
}
|
377 |
-
};
|
378 |
-
|
379 |
-
showzooz();
|
380 |
-
|
381 |
-
|
382 |
-
// if (isIE) {
|
383 |
-
// zoozIframe.attachEvent("onload", onIframeLoad);
|
384 |
-
// } else {
|
385 |
-
// zoozIframe.onload = onIframeLoad();
|
386 |
-
// }
|
387 |
-
|
388 |
-
|
389 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/frontend/base/default/zooz/js/zooz-magento.js
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function startZooz(isSandbox, formObject, url, uniqueId, returnUrl, cancelUrl){
|
2 |
+
var sandbox = (isSandbox==1);
|
3 |
+
var customStyleA = "https://app.zooz.com/ZoozCustomWC3/company/base-styles-a.css";
|
4 |
+
var customStyleB = "https://app.zooz.com/ZoozCustomWC3/company/base-styles-b.css";
|
5 |
+
var customStyle = "";//customStyleB;
|
6 |
+
//DYO.chooseVariation(93);
|
7 |
+
// if(zooz_button_color == 'gold')
|
8 |
+
// customStyle = customStyleB;
|
9 |
+
|
10 |
+
jQuery('#zooz-payment-loading').show();
|
11 |
+
jQuery.ajax({
|
12 |
+
type: formObject.attr('method'),
|
13 |
+
url: url,
|
14 |
+
data: formObject.serialize(),
|
15 |
+
cache: false,
|
16 |
+
success: function (response) {
|
17 |
+
jQuery('#zooz-payment-loading').hide();
|
18 |
+
eval(response);
|
19 |
+
zoozStartCheckout({
|
20 |
+
token : data.token,
|
21 |
+
uniqueId : uniqueId,
|
22 |
+
isSandbox : sandbox,
|
23 |
+
customStylesheet: customStyle,
|
24 |
+
returnUrl : returnUrl,
|
25 |
+
cancelUrl : cancelUrl
|
26 |
+
|
27 |
+
});
|
28 |
+
}
|
29 |
+
});
|
30 |
+
return false;
|
31 |
+
}
|