Version Notes
1-Click Mobile Web Payments for mobile enabled mCommerce. Patented QR Payments for eCommerce checkout.
Download this release
Release Info
Developer | Sekur.me |
Extension | Express_Checkout_with_sekurme |
Version | 1.0.0.7 |
Comparing to | |
See all releases |
Version 1.0.0.7
- app/code/community/Sekurme/Block/General/Failed.php +16 -0
- app/code/community/Sekurme/Block/General/Shortcut.php +29 -0
- app/code/community/Sekurme/Block/Shortcut.php +31 -0
- app/code/community/Sekurme/Helper/Data.php +11 -0
- app/code/community/Sekurme/Model/Express.php +462 -0
- app/code/community/Sekurme/Model/Mysql4/Setup.php +12 -0
- app/code/community/Sekurme/Model/System/Config/Source/Paymentaction.php +20 -0
- app/code/community/Sekurme/Model/System/Config/Source/Paymentmethod.php +33 -0
- app/code/community/Sekurme/controllers/SekurclientController.php +392 -0
- app/code/community/Sekurme/controllers/StandardController.php +684 -0
- app/code/community/Sekurme/etc/config.xml +135 -0
- app/code/community/Sekurme/etc/system.xml +117 -0
- app/code/community/Sekurme/sql/sekurme_setup/mysql4-install-1.0.0.1.php +63 -0
- app/code/local/Sekurme/Clearoldcartproducts/Model/Observer.php +29 -0
- app/code/local/Sekurme/Clearoldcartproducts/etc/config.xml +22 -0
- app/code/local/Sekurme/Shippingdestination/Model/Observer.php +50 -0
- app/code/local/Sekurme/Shippingdestination/etc/config.xml +25 -0
- app/code/local/Sekurme/Shippingdestination/etc/system.xml +41 -0
- app/code/local/Sekurme/Shopping/controllers/Checkout/CartController.php +160 -0
- app/code/local/Sekurme/Shopping/etc/config.xml +27 -0
- app/design/frontend/base/default/template/checkout/cart/shipping.phtml +144 -0
- app/design/frontend/base/default/template/page/html/head.phtml +50 -0
- app/design/frontend/default/default/layout/sekurme.xml +17 -0
- app/design/frontend/default/default/layout/shopping.xml +6 -0
- app/design/frontend/default/default/template/checkout/shipping.phtml +144 -0
- app/design/frontend/default/default/template/sales/order/info.phtml +101 -0
- app/design/frontend/default/default/template/sekurme/shortcut/failed.phtml +43 -0
- app/design/frontend/default/default/template/sekurme/shortcut/shortcutmid.phtml +102 -0
- app/etc/modules/Sekurme.xml +14 -0
- app/etc/modules/Sekurme_Clearoldcartproducts.xml +9 -0
- app/etc/modules/Sekurme_Shippingdestination.xml +9 -0
- app/etc/modules/Sekurme_Shopping.xml +9 -0
- app/locale/en_US/Mage_Sekurme.csv +9 -0
- package.xml +18 -0
- skin/frontend/default/default/images/sekurme/Normal.jpg +0 -0
- skin/frontend/default/default/images/sekurme/loading.gif +0 -0
- skin/frontend/default/default/images/sekurme/sekurme_logo.png +0 -0
app/code/community/Sekurme/Block/General/Failed.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by Span Infotech, ravindra.singh@spanservices.com
|
5 |
+
* http://www.spansystems.com
|
6 |
+
**/
|
7 |
+
|
8 |
+
class Sekurme_Block_General_Failed extends Mage_Core_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$this->setTemplate('sekurme/shortcut/failed.phtml');
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Sekurme/Block/General/Shortcut.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sekurme_Block_General_Shortcut extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
protected $_shouldRender = true;
|
6 |
+
protected $_checkoutpage = 'sekurme/checkout/zipcode';
|
7 |
+
|
8 |
+
|
9 |
+
protected function _beforeToHtml()
|
10 |
+
{
|
11 |
+
$country = Mage::getModel('sekurme/express')->getConfigData('acc_origin');
|
12 |
+
$cart = Mage::getModel('sekurme/express')->getConfigData('express_button_checkout');
|
13 |
+
$side = Mage::getModel('sekurme/express')->getConfigData('express_button_checkout_sidebar');
|
14 |
+
$prod = Mage::getModel('sekurme/express')->getConfigData('express_button_product');
|
15 |
+
$this->setcheckoutexpress($this->getUrl($this->_checkoutpage))->setCountry($country)
|
16 |
+
->setAllowedProduct($prod)->setAllowedCart($cart)->setAllowedSidebar($side)
|
17 |
+
->setimgcheckoutBr($this->getSkinUrl('images/sekurme/sekurme_logo.png'))->setimgcheckoutAr($this->getSkinUrl('images/sekurme/sekurme_logo.png'));
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _toHtml()
|
21 |
+
{
|
22 |
+
return parent::_toHtml();
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
?>
|
app/code/community/Sekurme/Block/Shortcut.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Sekurme_Block_Shortcut extends Mage_Core_Block_Template
|
5 |
+
{
|
6 |
+
protected $_shouldRender = true;
|
7 |
+
protected $_checkoutpage = 'sekurme/checkout';
|
8 |
+
protected $_addcart = 'sekurme/checkout/addcart';
|
9 |
+
|
10 |
+
|
11 |
+
public function _construct()
|
12 |
+
{
|
13 |
+
Mage::log('Sekurme_Block_Shortcut');
|
14 |
+
|
15 |
+
}
|
16 |
+
protected function _beforeToHtml()
|
17 |
+
{
|
18 |
+
$this->setcheckoutexpress($this->getUrl($this->_checkoutpage))->setMpAddCart('sekurme/checkout/addcart')
|
19 |
+
->setimgcheckout($this->getSkinUrl('images/sekurme/sekurme_logo.png'));
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _toHtml()
|
23 |
+
{
|
24 |
+
return parent::_toHtml();
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
?>
|
app/code/community/Sekurme/Helper/Data.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by Span Infotech, ravindra.singh@spanservices.com
|
5 |
+
* http://www.spansystems.com
|
6 |
+
**/
|
7 |
+
|
8 |
+
class Sekurme_Helper_Data extends Mage_Payment_Helper_Data
|
9 |
+
{
|
10 |
+
|
11 |
+
}
|
app/code/community/Sekurme/Model/Express.php
ADDED
@@ -0,0 +1,462 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by SEKUR.me
|
5 |
+
* http://www.sekur.me
|
6 |
+
**/
|
7 |
+
|
8 |
+
class Sekurme_Model_Express extends Mage_Payment_Model_Method_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
const PAYMENT_TYPE_AUTH = 'PHONE';
|
12 |
+
const PAYMENT_TYPE_SALE = 'SALE';
|
13 |
+
protected $_code = 'sekurme';
|
14 |
+
protected $_formBlockType = 'sekurme/express_shortcutmid';
|
15 |
+
|
16 |
+
protected $_isGateway = true;
|
17 |
+
protected $_canOrder = true;
|
18 |
+
protected $_canAuthorize = true;
|
19 |
+
protected $_canCapture = true;
|
20 |
+
protected $_canCapturePartial = true;
|
21 |
+
protected $_canRefund = true;
|
22 |
+
protected $_canRefundInvoicePartial = true;
|
23 |
+
protected $_canVoid = true;
|
24 |
+
protected $_canUseInternal = true;
|
25 |
+
protected $_canUseCheckout = true;
|
26 |
+
protected $_canUseForMultishipping = true;
|
27 |
+
protected $_canFetchTransactionInfo = true;
|
28 |
+
protected $_canCreateBillingAgreement = true;
|
29 |
+
protected $_canReviewPayment = true;
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
protected function _construct()
|
34 |
+
{
|
35 |
+
$this->_init('sekurme/express');
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get Sekurme session namespace
|
40 |
+
*
|
41 |
+
* @return Mage_Sekurme_Model_Session
|
42 |
+
*/
|
43 |
+
public function getSession()
|
44 |
+
{
|
45 |
+
return Mage::getSingleton('sekurme/session');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get checkout session namespace
|
50 |
+
*
|
51 |
+
* @return Mage_Checkout_Model_Session
|
52 |
+
*/
|
53 |
+
public function getCheckout()
|
54 |
+
{
|
55 |
+
return Mage::getSingleton('checkout/session');
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Get current quote
|
60 |
+
*
|
61 |
+
* @return Mage_Sales_Model_Quote
|
62 |
+
*/
|
63 |
+
public function getQuote()
|
64 |
+
{
|
65 |
+
return $this->getCheckout()->getQuote();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getCheckoutCart()
|
69 |
+
{
|
70 |
+
return Mage::getSingleton('checkout/cart');
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Using internal pages for input payment data
|
75 |
+
*
|
76 |
+
* @return bool
|
77 |
+
*/
|
78 |
+
public function canUseInternal()
|
79 |
+
{
|
80 |
+
return false;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Using for multiple shipping address
|
85 |
+
*
|
86 |
+
* @return bool
|
87 |
+
*/
|
88 |
+
public function canUseForMultishipping()
|
89 |
+
{
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
public function createFormBlock($name)
|
94 |
+
{
|
95 |
+
$block = $this->getLayout()->createBlock('sekurme/shortcut_form', $name)
|
96 |
+
->setMethod('sekurme_express')
|
97 |
+
->setPayment($this->getPayment())
|
98 |
+
->setTemplate('sekurme/express/form.phtml');
|
99 |
+
|
100 |
+
return $block;
|
101 |
+
}
|
102 |
+
|
103 |
+
public function validate()
|
104 |
+
{
|
105 |
+
parent::validate();
|
106 |
+
return $this;
|
107 |
+
}
|
108 |
+
|
109 |
+
public function onOrderValidate(Mage_Sales_Model_Order_Payment $payment)
|
110 |
+
{
|
111 |
+
return $this;
|
112 |
+
}
|
113 |
+
|
114 |
+
public function onInvoiceCreate(Mage_Sales_Model_Invoice_Payment $payment)
|
115 |
+
{
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
public function getOrderPlaceRedirectUrl() {
|
120 |
+
|
121 |
+
return Mage::getUrl('sekurme/checkout/redirect', array('_secure' => true));
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Get country collection
|
126 |
+
* @return array
|
127 |
+
*/
|
128 |
+
|
129 |
+
public function getCountryCollection()
|
130 |
+
{
|
131 |
+
$countryCollection = Mage::getModel('directory/country_api')->items();
|
132 |
+
return $countryCollection;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Get region collection
|
137 |
+
* @param string $countryCode
|
138 |
+
* @return array
|
139 |
+
*/
|
140 |
+
public function getRegionCollection($countryCode)
|
141 |
+
{
|
142 |
+
$regionCollection = Mage::getModel('directory/region_api')->items($countryCode);
|
143 |
+
return $regionCollection;
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
public function getShippingEstimate($productId,$productQty,$countryId,$postcode ) {
|
148 |
+
|
149 |
+
$quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getStore('default')->getId());
|
150 |
+
$_product = Mage::getModel('catalog/product')->load($productId);
|
151 |
+
|
152 |
+
$_product->getStockItem()->setUseConfigManageStock(false);
|
153 |
+
$_product->getStockItem()->setManageStock(false);
|
154 |
+
|
155 |
+
$quote->addProduct($_product, $productQty);
|
156 |
+
$quote->getShippingAddress()->setCountryId($countryId)->setPostcode($postcode);
|
157 |
+
$quote->getShippingAddress()->collectTotals();
|
158 |
+
$quote->getShippingAddress()->setCollectShippingRates(true);
|
159 |
+
$quote->getShippingAddress()->collectShippingRates();
|
160 |
+
|
161 |
+
$_rates = $quote->getShippingAddress()->getShippingRatesCollection();
|
162 |
+
|
163 |
+
$shippingRates = array();
|
164 |
+
foreach ($_rates as $_rate):
|
165 |
+
if($_rate->getPrice() > 0) {
|
166 |
+
$shippingRates[] = array("Title" => $_rate->getMethodTitle(), "Price" => $_rate->getPrice());
|
167 |
+
}
|
168 |
+
endforeach;
|
169 |
+
|
170 |
+
return $shippingRates;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
//Calculate Sales Tax based on Zip Code
|
175 |
+
public function getSalesTax()
|
176 |
+
{
|
177 |
+
$shippingAddress = $this->getCheckoutCart()->getQuote()->getShippingAddress();
|
178 |
+
|
179 |
+
$shippingPostcode = $shippingAddress->getData("postcode");
|
180 |
+
|
181 |
+
$shippingCountryID = $shippingAddress->getData('country_id');
|
182 |
+
|
183 |
+
$zipcode = $shippingPostcode;
|
184 |
+
|
185 |
+
$country = $shippingCountryID;
|
186 |
+
|
187 |
+
// Update the cart's quote.
|
188 |
+
|
189 |
+
|
190 |
+
$shippingAddress->setCountryId($country)->setPostcode($zipcode)->setCollectShippingrates(true);
|
191 |
+
|
192 |
+
$this->getCheckoutCart()->save();
|
193 |
+
|
194 |
+
// Find if our shipping has been included.
|
195 |
+
$rates = $shippingAddress->collectShippingRates()->getGroupedAllShippingRates();
|
196 |
+
|
197 |
+
$qualifies = false;
|
198 |
+
foreach ($rates as $carrier) {
|
199 |
+
foreach ($carrier as $rate) {
|
200 |
+
if ($rate->getMethod() === 'whiteglove') {
|
201 |
+
$qualifies = true;
|
202 |
+
break;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
// Calculate Shipping Cost
|
210 |
+
public function getShippingCost()
|
211 |
+
|
212 |
+
{
|
213 |
+
|
214 |
+
// Total Object
|
215 |
+
$totals = $this->getCheckout()->getQuote()->getTotals();
|
216 |
+
|
217 |
+
// Calculate Shipping Cost
|
218 |
+
$totalKeys = array('shipping');
|
219 |
+
|
220 |
+
foreach ($totalKeys as $totalKey) {
|
221 |
+
|
222 |
+
if (isset($totals[$totalKey]))
|
223 |
+
|
224 |
+
$shippingcost = $totals[$totalKey]->getData('value');
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
if(empty($shippingcost)){
|
229 |
+
|
230 |
+
$shippingQuote = Mage::getSingleton('checkout/session')->getQuote();
|
231 |
+
$shippingAddress = $shippingQuote->getShippingAddress();
|
232 |
+
//Find if our shipping has been included.
|
233 |
+
$rates = $shippingAddress->getGroupedAllShippingRates();
|
234 |
+
|
235 |
+
$qualifies = false;
|
236 |
+
|
237 |
+
foreach ($rates as $carrier) {
|
238 |
+
foreach ($carrier as $rate) {
|
239 |
+
$shipDetail[] = array('code'=>$rate->getCode(), 'price'=>$rate->getPrice());
|
240 |
+
|
241 |
+
}
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
$minVal = PHP_INT_MAX;
|
246 |
+
$maxVal = 0;
|
247 |
+
foreach ($shipDetail as $shipArray) {
|
248 |
+
$minVal = min($minVal, $shipArray['price']);
|
249 |
+
$maxVal = max($maxVal, $shipArray['price']);
|
250 |
+
}
|
251 |
+
|
252 |
+
$shippingPrice = $minVal;
|
253 |
+
|
254 |
+
foreach ($shipDetail as $inner) {
|
255 |
+
if ($inner['price'] == $minVal) {
|
256 |
+
$result = $inner['code'];
|
257 |
+
|
258 |
+
break;
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
$shippingMethod = $result;
|
263 |
+
|
264 |
+
$shippingcost = $shippingPrice;
|
265 |
+
|
266 |
+
$shippingQuote->getShippingAddress()->setShippingAmount($shippingPrice);
|
267 |
+
$shippingQuote->getShippingAddress()->setBaseShippingAmount($shippingPrice);
|
268 |
+
$shippingQuote->getShippingAddress()->setShippingMethod($shippingMethod)/*->collectTotals()*/->save();
|
269 |
+
|
270 |
+
}
|
271 |
+
|
272 |
+
return $shippingcost;
|
273 |
+
|
274 |
+
}
|
275 |
+
|
276 |
+
//Calculate Amount
|
277 |
+
|
278 |
+
public function getTotalAmount()
|
279 |
+
{
|
280 |
+
|
281 |
+
// Caculate total items in cart
|
282 |
+
$totalItemsInCart = $this->getCheckoutCart()->getItemsCount();
|
283 |
+
|
284 |
+
//Total Object
|
285 |
+
$totals = $this->getCheckout()->getQuote()->getTotals();
|
286 |
+
|
287 |
+
//Subtotal value
|
288 |
+
$subtotal = $totals["subtotal"]->getValue();
|
289 |
+
|
290 |
+
// Grandtotal value
|
291 |
+
$grandtotal = $totals["grand_total"]->getValue();
|
292 |
+
|
293 |
+
//Discount value if applied
|
294 |
+
if(isset($totals['discount']) && $totals['discount']->getValue()) {
|
295 |
+
|
296 |
+
$discount = $totals['discount']->getValue();
|
297 |
+
|
298 |
+
} else {
|
299 |
+
|
300 |
+
$discount = "";
|
301 |
+
|
302 |
+
}
|
303 |
+
|
304 |
+
//Tax value if present
|
305 |
+
if(isset($totals['tax']) && $totals['tax']->getValue()) {
|
306 |
+
|
307 |
+
$tax = $totals['tax']->getValue();
|
308 |
+
|
309 |
+
} else {
|
310 |
+
|
311 |
+
$tax = "";
|
312 |
+
}
|
313 |
+
|
314 |
+
$shippingcost = $this->getShippingCost();
|
315 |
+
|
316 |
+
|
317 |
+
$totalAmount = $grandtotal;
|
318 |
+
|
319 |
+
return $totalAmount;
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
+
//Get the order increment id
|
325 |
+
public function getLastIncrementedOrderId()
|
326 |
+
{
|
327 |
+
|
328 |
+
$orders = Mage::getModel('sales/order')->getCollection()->setOrder('created_at','DESC')->setPageSize(1)->setCurPage(1);
|
329 |
+
|
330 |
+
$orderId = $orders->getFirstItem()->getEntityId();
|
331 |
+
|
332 |
+
$inc_order_id = Mage::getModel('sales/order')->load($orderId);
|
333 |
+
|
334 |
+
$last_order_id = $inc_order_id['increment_id']+'1';
|
335 |
+
|
336 |
+
return $last_order_id;
|
337 |
+
}
|
338 |
+
|
339 |
+
|
340 |
+
// Initialize StartTransaction Request
|
341 |
+
public function initalize() {
|
342 |
+
|
343 |
+
error_reporting('0');
|
344 |
+
|
345 |
+
//Total Amount
|
346 |
+
$totalAmount = $this->getTotalAmount();
|
347 |
+
|
348 |
+
//Get the config data
|
349 |
+
$sekurmeurl = htmlspecialchars($this->getConfigData('sekurmeurl'))."MT/SekurServer_StartTransaction";
|
350 |
+
$companyID = htmlspecialchars($this->getConfigData('merchantnumber'));
|
351 |
+
$storeAuth = htmlspecialchars($this->getConfigData('md5key'));
|
352 |
+
$storeID = htmlspecialchars($this->getConfigData('storeid'));
|
353 |
+
|
354 |
+
$quote_id = time();
|
355 |
+
|
356 |
+
// Check for HTTP & HTTPS protocol
|
357 |
+
|
358 |
+
$phoneURL = Mage::getUrl('sekurme/standard/complete');
|
359 |
+
|
360 |
+
//echo $sekurmeurl;
|
361 |
+
|
362 |
+
$input_xml = '<SekurStartTransactionRequest>
|
363 |
+
<SekurAction>10</SekurAction>
|
364 |
+
<CompanyID>'.$companyID.'</CompanyID>
|
365 |
+
<StoreID>'.$storeID.'</StoreID>
|
366 |
+
<StoreAuth>'.$storeAuth.'</StoreAuth>
|
367 |
+
<Amount>'.$totalAmount.'</Amount>
|
368 |
+
<UserID/>
|
369 |
+
<EtxnId>'.$quote_id.'</EtxnId>
|
370 |
+
<BILL_PAY_1/>
|
371 |
+
<BILL_PAY_2/>
|
372 |
+
<BILL_PAY_3/>
|
373 |
+
<BILL_PAY_4/>
|
374 |
+
<BILL_PAY_5/>
|
375 |
+
<BILL_PAY_6/>
|
376 |
+
<BILL_PAY_7/>
|
377 |
+
<BILL_PAY_8/>
|
378 |
+
<BILL_PAY_9/>
|
379 |
+
<APP_DATA_DESTINATION>MOBILE</APP_DATA_DESTINATION>
|
380 |
+
<APP_DATA_CONTROL>1CLICK</APP_DATA_CONTROL>
|
381 |
+
<APP_DATA>'.$phoneURL.'</APP_DATA>
|
382 |
+
</SekurStartTransactionRequest>
|
383 |
+
';
|
384 |
+
|
385 |
+
$service_url = $sekurmeurl;
|
386 |
+
|
387 |
+
$curl = curl_init($service_url);
|
388 |
+
|
389 |
+
//echo '<pre>'; print_r($curl_post_data);
|
390 |
+
|
391 |
+
curl_setopt($curl, CURLOPT_URL,$service_url);
|
392 |
+
curl_setopt($curl, CURLOPT_VERBOSE, 1);
|
393 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
394 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
395 |
+
curl_setopt($curl, CURLOPT_POST, 1);
|
396 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
397 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
|
398 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $input_xml);
|
399 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
|
400 |
+
|
401 |
+
$curl_response = curl_exec($curl);
|
402 |
+
|
403 |
+
if ($curl_response === false) {
|
404 |
+
|
405 |
+
$info = curl_getinfo($curl);
|
406 |
+
|
407 |
+
curl_close($curl);
|
408 |
+
|
409 |
+
//echo 'Error occured during connection with SEKUR.me server.';
|
410 |
+
}
|
411 |
+
|
412 |
+
curl_close($curl);
|
413 |
+
|
414 |
+
$resvalues = explode(" ", strip_tags($curl_response));
|
415 |
+
|
416 |
+
$errorCode = trim(strip_tags($resvalues["2"]));
|
417 |
+
$statusMsg = trim(strip_tags($resvalues["10"]));
|
418 |
+
$eTxnID = trim(strip_tags($resvalues["8"]));
|
419 |
+
$tssID = trim(strip_tags($resvalues["6"]));
|
420 |
+
$qr_URL = trim(strip_tags($resvalues["4"]));
|
421 |
+
|
422 |
+
$data = array(
|
423 |
+
'id' => '',
|
424 |
+
'eTxnID'=> "'".trim(strip_tags($resvalues["8"]))."'",
|
425 |
+
'tssID' => "'".trim(strip_tags($resvalues["6"]))."'",
|
426 |
+
'paymentAction' => "'".$this->getConfigData('paymentaction')."'",
|
427 |
+
'status' => '0',
|
428 |
+
'statusMessage' => "'".trim(strip_tags($resvalues["10"]))."'",
|
429 |
+
'errorCode' => "'".trim(strip_tags($resvalues["2"]))."'",
|
430 |
+
'qr_URL' => "'".trim(strip_tags($resvalues["4"]))."'",
|
431 |
+
'date' => 'NOW()',
|
432 |
+
);
|
433 |
+
|
434 |
+
|
435 |
+
$query = "SELECT eTxnID FROM sekurmeorderstatus WHERE eTxnID=".$data[eTxnID];
|
436 |
+
$dataValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
|
437 |
+
|
438 |
+
|
439 |
+
if($dataValue['0']['eTxnID'] != $eTxnID){
|
440 |
+
|
441 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
442 |
+
$write->query("INSERT INTO sekurmeorderstatus (Id,eTxnID,tssID,companyID,storeID,customer_id,email_id,sekurID,cc_flat_id,
|
443 |
+
paymentAction,payStatus,transactionID,status,statusMessage,errorCode,qr_URL,date)
|
444 |
+
VALUES('',$data[eTxnID],$data[tssID],'NULL','NULL','NULL','NULL','NULL','NULL',
|
445 |
+
$data[paymentAction],'NULL','NULL',$data[status],$data[statusMessage],$data[errorCode],$data[qr_URL],$data[date])");
|
446 |
+
|
447 |
+
}else{
|
448 |
+
|
449 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
450 |
+
$write->query('UPDATE sekurmeorderstatus set tssID = "'.$tssID. '",'.'qr_URL = "'.$qr_URL.'" where eTxnID = "'. $eTxnID . '"');
|
451 |
+
|
452 |
+
}
|
453 |
+
|
454 |
+
return $curl_response;
|
455 |
+
|
456 |
+
}
|
457 |
+
|
458 |
+
|
459 |
+
}
|
460 |
+
|
461 |
+
|
462 |
+
?>
|
app/code/community/Sekurme/Model/Mysql4/Setup.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by Span Infotech, ravindra.singh@spanservices.com
|
5 |
+
* http://www.spansystems.com
|
6 |
+
**/
|
7 |
+
|
8 |
+
class Sekurme_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
|
9 |
+
{
|
10 |
+
|
11 |
+
}
|
12 |
+
?>
|
app/code/community/Sekurme/Model/System/Config/Source/Paymentaction.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by Span Infotech, ravindra.singh@spanservices.com
|
5 |
+
* http://www.spansystems.com
|
6 |
+
**/
|
7 |
+
|
8 |
+
class Sekurme_Model_System_Config_Source_Paymentaction
|
9 |
+
{
|
10 |
+
|
11 |
+
public function toOptionArray()
|
12 |
+
{
|
13 |
+
return array(
|
14 |
+
array('value'=>1, 'label'=>Mage::helper('adminhtml')->__('Phone')),
|
15 |
+
array('value'=>2, 'label'=>Mage::helper('adminhtml')->__('Authorize')),
|
16 |
+
array('value'=>3, 'label'=>Mage::helper('adminhtml')->__('AuhorizeAndCapture')),
|
17 |
+
);
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/community/Sekurme/Model/System/Config/Source/Paymentmethod.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by SEKUR.me
|
5 |
+
* http://www.sekur.me
|
6 |
+
**/
|
7 |
+
|
8 |
+
class Sekurme_Model_System_Config_Source_Paymentmethod
|
9 |
+
{
|
10 |
+
|
11 |
+
|
12 |
+
public function getActivPaymentMethods()
|
13 |
+
{
|
14 |
+
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
|
15 |
+
$methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('--Select Payment Mode--')));
|
16 |
+
foreach ($payments as $paymentCode=>$paymentModel) {
|
17 |
+
$paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
|
18 |
+
if(!preg_match("/(?:paypal)/", $paymentCode, $matches)){
|
19 |
+
$methods[$paymentCode] = array(
|
20 |
+
'label' => $paymentTitle,
|
21 |
+
'value' => $paymentCode,
|
22 |
+
);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
return $methods;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
return $this->getActivPaymentMethods();
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Sekurme/controllers/SekurclientController.php
ADDED
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by SEKUR.me
|
5 |
+
* http://www.sekur.me
|
6 |
+
**/
|
7 |
+
|
8 |
+
class Sekurme_SekurclientController extends Mage_Core_Controller_Front_Action
|
9 |
+
{
|
10 |
+
|
11 |
+
|
12 |
+
protected function _expireAjax()
|
13 |
+
{
|
14 |
+
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
|
15 |
+
$this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
|
16 |
+
exit;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @return Mage_Sekurme_Model_Standard
|
22 |
+
*/
|
23 |
+
public function getStandard()
|
24 |
+
{
|
25 |
+
return Mage::getSingleton('sekurme/sekurclient');
|
26 |
+
}
|
27 |
+
/**
|
28 |
+
* Get region collection
|
29 |
+
* @param string $countryCode
|
30 |
+
* @return array
|
31 |
+
*/
|
32 |
+
public function getRegionCollection($regionCode, $countryCode)
|
33 |
+
{
|
34 |
+
$regionModel = Mage::getModel('directory/region')->loadByCode($regionCode, $countryCode);
|
35 |
+
$regionId = $regionModel->getId();
|
36 |
+
return $regionId;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function cc_encrypt($str)
|
40 |
+
{
|
41 |
+
$EncKey = "25c6c7dd"; //For security
|
42 |
+
$block = mcrypt_get_block_size('des', 'ecb');
|
43 |
+
if (($pad = $block - (strlen($str) % $block)) < $block) {
|
44 |
+
$str .= str_repeat(chr($pad), $pad);
|
45 |
+
}
|
46 |
+
return base64_encode(mcrypt_encrypt(MCRYPT_DES, $EncKey, $str, MCRYPT_MODE_ECB));
|
47 |
+
}
|
48 |
+
|
49 |
+
public function loginUser( $email, $password )
|
50 |
+
{
|
51 |
+
/** @var $session Mage_Customer_Model_Session */
|
52 |
+
$session = Mage::getSingleton( 'customer/session' );
|
53 |
+
|
54 |
+
try
|
55 |
+
{
|
56 |
+
$session->login( $email, $password );
|
57 |
+
$session->setCustomerAsLoggedIn( $session->getCustomer() );
|
58 |
+
return true;
|
59 |
+
}
|
60 |
+
catch( Exception $e )
|
61 |
+
{
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
//sekurClient_ProcessPayment
|
67 |
+
public function sekurClient_processPaymentAction()
|
68 |
+
{
|
69 |
+
|
70 |
+
// Get the response
|
71 |
+
$paymentbody = file_get_contents('php://input');
|
72 |
+
|
73 |
+
// parse response data
|
74 |
+
$xml = simplexml_load_string($paymentbody);
|
75 |
+
|
76 |
+
// CC Data
|
77 |
+
$AUTH_KEY_1 = $xml->AUTH_KEY_1;
|
78 |
+
$AUTH_KEY_2 = $xml->AUTH_KEY_2;
|
79 |
+
$eTxnID = $xml->eTxnID;
|
80 |
+
$AMOUNT = $xml->AMOUNT;
|
81 |
+
$CURRENCY = $xml->CURRENCY;
|
82 |
+
$ACCOUNT_NUMBER = $this->cc_encrypt(trim($xml->ACCOUNT_NUMBER));
|
83 |
+
$LAST_4DIGIT = "XXXX-XXXX-XXXX-".substr($xml->ACCOUNT_NUMBER,-4,4);
|
84 |
+
$EXP_MONTH = substr($xml->EXP_MONTH,0,-4);
|
85 |
+
$EXP_YEAR = substr($xml->EXP_MONTH,2);
|
86 |
+
$CC_CID_ENC = $this->cc_encrypt(trim($xml->CVC));
|
87 |
+
$NAME_ON_CARD = urldecode($xml->NAME_ON_CARD);
|
88 |
+
$BILLING_NAME = $xml->BILLING_NAME;
|
89 |
+
$BILLING_STREET = $xml->BILLING_STREET;
|
90 |
+
$BILLING_CITY = $xml->BILLING_CITY;
|
91 |
+
$BILLING_STATE = $xml->BILLING_STATE;
|
92 |
+
$BILLING_ZIP = $xml->BILLING_ZIP;
|
93 |
+
$BILLING_COUNTRY = $xml->BILLING_COUNTRY;
|
94 |
+
|
95 |
+
$dbquery = "SELECT eTxnID FROM customer_flat_quote_payment WHERE eTxnID=".$eTxnID;
|
96 |
+
$processValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($dbquery);
|
97 |
+
|
98 |
+
//Check the credit card type info
|
99 |
+
$creditNum = trim($xml->ACCOUNT_NUMBER);
|
100 |
+
|
101 |
+
switch ($creditNum[0]) {
|
102 |
+
case 3:
|
103 |
+
$type = "AE";
|
104 |
+
break;
|
105 |
+
case 4:
|
106 |
+
$type = "VI";
|
107 |
+
break;
|
108 |
+
case 5:
|
109 |
+
$type = "MC";
|
110 |
+
break;
|
111 |
+
case 6:
|
112 |
+
$type = "DI";
|
113 |
+
break;
|
114 |
+
default:
|
115 |
+
$type = "Others";
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
if($processValue['0']['eTxnID'] != $eTxnID){
|
121 |
+
|
122 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
123 |
+
$write->query("INSERT INTO customer_flat_quote_payment(cc_flat_id,eTxnID,created_at,updated_at,amount,currency,billing_name,billing_street,
|
124 |
+
billing_city,billing_state,billing_zip,billing_country,
|
125 |
+
cc_type,cc_number_enc,cc_last4,cc_cid_enc,cc_owner,cc_exp_month,cc_exp_year)
|
126 |
+
VALUES('','$eTxnID','NOW()','','$AMOUNT','$CURRENCY','$BILLING_NAME','$BILLING_STREET',
|
127 |
+
'$BILLING_CITY','$BILLING_STATE','$BILLING_ZIP','$BILLING_COUNTRY',
|
128 |
+
'$type','$ACCOUNT_NUMBER','$LAST_4DIGIT','$CC_CID_ENC','$NAME_ON_CARD','$EXP_MONTH','$EXP_YEAR')");
|
129 |
+
|
130 |
+
$selectquery = "SELECT cc_flat_id FROM customer_flat_quote_payment WHERE eTxnID=".$eTxnID;
|
131 |
+
$ccValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($selectquery);
|
132 |
+
|
133 |
+
$update = Mage::getSingleton('core/resource')->getConnection('core_write');
|
134 |
+
$update->query('UPDATE sekurmeorderstatus set cc_flat_id = "'.$ccValue['0']['cc_flat_id']. '" where eTxnID = "'.$eTxnID .'"');
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
$fp = fopen('/var/www/html/furniture_store/processpayment.txt', 'w+');
|
139 |
+
fwrite($fp, "Account Number=>".$ACCOUNT_NUMBER."\n");
|
140 |
+
fwrite($fp, "Last Digit=>".$LAST_4DIGIT."\n");
|
141 |
+
fwrite($fp, "Exp Month=>".$EXP_MONTH."\n");
|
142 |
+
fwrite($fp, "Exp Year=>".$EXP_YEAR."\n");
|
143 |
+
fwrite($fp, "Name On Card=>".$NAME_ON_CARD."\n");
|
144 |
+
fwrite($fp, "Amount=>".$AMOUNT."\n");
|
145 |
+
fclose($fp);
|
146 |
+
|
147 |
+
// Send The Response
|
148 |
+
$response = '<'.'?xml version="1.0" encoding="utf-8"?'.'>';
|
149 |
+
$response.= '<SekurProcessVerificationResponse><ErrorCode>0</ErrorCode>';
|
150 |
+
$response = $response.'<StatusMessage>Success</StatusMessage></SekurProcessVerificationResponse>';
|
151 |
+
header("Content-type: text/xml; charset=utf-8");
|
152 |
+
echo $response;
|
153 |
+
|
154 |
+
}
|
155 |
+
|
156 |
+
//sekurClient_ProcessPaymentVerificationAndShipping
|
157 |
+
public function sekurClient_processPaymentVerificationAndShippingAction()
|
158 |
+
{
|
159 |
+
|
160 |
+
// Get the response
|
161 |
+
$shippingbody = file_get_contents('php://input');
|
162 |
+
|
163 |
+
// parse response data
|
164 |
+
$shippingxml = simplexml_load_string($shippingbody);
|
165 |
+
|
166 |
+
$session = Mage::getSingleton('core/session', array('name' => 'frontend'));
|
167 |
+
|
168 |
+
// User Data
|
169 |
+
$CompanyID = $shippingxml->CompanyID;
|
170 |
+
$StoreID = $shippingxml->StoreID;
|
171 |
+
$TSSID = $shippingxml->TSSID;
|
172 |
+
$ETXNID = $shippingxml->ETXNID;
|
173 |
+
$First = $shippingxml->First;
|
174 |
+
$Last = $shippingxml->Last;
|
175 |
+
$eMail = $shippingxml->eMail;
|
176 |
+
$AuthorizationStatus = $shippingxml->AuthorizationStatus;
|
177 |
+
$PayStatus = $shippingxml->PayStatus;
|
178 |
+
$PGReturnCode = $shippingxml->PGReturnCode;
|
179 |
+
$PGReturnMsg = $shippingxml->PGReturnMsg;
|
180 |
+
$PGAuthCode = $shippingxml->PGAuthCode;
|
181 |
+
$PGTransactionID = $shippingxml->PGTransactionID;
|
182 |
+
$PaymentAmount = $shippingxml->PaymentAmount;
|
183 |
+
$Phone = $shippingxml->Phone;
|
184 |
+
$SekurID = $shippingxml->SekurID;
|
185 |
+
|
186 |
+
// Billing Address Details
|
187 |
+
$Bill_First = $shippingxml->Bill_First;
|
188 |
+
$Bill_Last = $shippingxml->Bill_Last;
|
189 |
+
$Bill_Address = $shippingxml->Bill_Address;
|
190 |
+
$Bill_City = $shippingxml->Bill_City;
|
191 |
+
$Bill_State = $shippingxml->Bill_State;
|
192 |
+
$Bill_Zip = $shippingxml->Bill_Zip;
|
193 |
+
$Bill_Country = $shippingxml->Bill_Country;
|
194 |
+
|
195 |
+
if($Bill_Country == 'USA')
|
196 |
+
{
|
197 |
+
$Bill_Country_Id = 'US';
|
198 |
+
|
199 |
+
}elseif($Bill_Country == 'CAN')
|
200 |
+
{
|
201 |
+
$Bill_Country_Id = 'CA';
|
202 |
+
}
|
203 |
+
|
204 |
+
// Shipping Address Details
|
205 |
+
$Ship_First = $shippingxml->Ship_First;
|
206 |
+
$Ship_Last = $shippingxml->Ship_Last;
|
207 |
+
$Ship_Address = $shippingxml->Ship_Address;
|
208 |
+
$Ship_City = $shippingxml->Ship_City;
|
209 |
+
$Ship_State = $shippingxml->Ship_State;
|
210 |
+
$Ship_Zip = $shippingxml->Ship_Zip;
|
211 |
+
$Ship_Country = $shippingxml->Ship_Country;
|
212 |
+
|
213 |
+
|
214 |
+
if($Ship_Country == 'USA')
|
215 |
+
{
|
216 |
+
$Ship_Country_Id = 'US';
|
217 |
+
|
218 |
+
}elseif($Ship_Country == 'CAN')
|
219 |
+
{
|
220 |
+
$Ship_Country_Id = 'CA';
|
221 |
+
}
|
222 |
+
|
223 |
+
// Bill Pay Details
|
224 |
+
$BILL_PAY_1 = $shippingxml->BILL_PAY_1;
|
225 |
+
$BILL_PAY_2 = $shippingxml->BILL_PAY_2;
|
226 |
+
|
227 |
+
$Bill_Region_Id = $this->getRegionCollection($Bill_State, $Bill_Country_Id);
|
228 |
+
$Ship_Region_Id = $this->getRegionCollection($Ship_State, $Ship_Country_Id);
|
229 |
+
|
230 |
+
// Create customer if not exit
|
231 |
+
$customer_email = $eMail;
|
232 |
+
$customer_fname = $First;
|
233 |
+
$customer_lname = $Last;
|
234 |
+
$passwordLength = 10; // the lenght of autogenerated password
|
235 |
+
|
236 |
+
$customer = Mage::getModel('customer/customer');
|
237 |
+
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
|
238 |
+
$customer->loadByEmail($customer_email);
|
239 |
+
$customer_id = $customer->getId();
|
240 |
+
|
241 |
+
|
242 |
+
/*
|
243 |
+
* Check if the email exist on the system.
|
244 |
+
* If YES, it will not create a user account.
|
245 |
+
*/
|
246 |
+
|
247 |
+
|
248 |
+
if(!$customer->getId()) {
|
249 |
+
|
250 |
+
//setting data such as email, firstname, lastname, and password
|
251 |
+
|
252 |
+
$email = $customer->setEmail($customer_email);
|
253 |
+
$customer->setFirstname($customer_fname);
|
254 |
+
$customer->setLastname($customer_lname);
|
255 |
+
$password = $customer->setPassword($customer->generatePassword($passwordLength));
|
256 |
+
|
257 |
+
try{
|
258 |
+
//the save the data and send the new account email.
|
259 |
+
$customer->save();
|
260 |
+
$customer->setConfirmation(null);
|
261 |
+
$customer->save();
|
262 |
+
$customer->setStatus(1);
|
263 |
+
|
264 |
+
//Get the current customer ID & set the billing address
|
265 |
+
$billaddress = Mage::getModel("customer/address");
|
266 |
+
$billaddress->setCustomerId($customer->getId());
|
267 |
+
$billaddress->setFirstname($Bill_First);
|
268 |
+
$billaddress->setLastname($Bill_Last);
|
269 |
+
$billaddress->setCountryId($Bill_Country_Id); //Country code here
|
270 |
+
$billaddress->setStreet($Bill_Address);
|
271 |
+
$billaddress->setPostcode($Bill_Zip);
|
272 |
+
$billaddress->setCity($Bill_City);
|
273 |
+
$billaddress->setState($Bill_Region_Id);
|
274 |
+
$billaddress->setTelephone($Phone);
|
275 |
+
$billaddress->setIsDefaultBilling('1');
|
276 |
+
$billaddress->save();
|
277 |
+
|
278 |
+
//Get the current customer ID & set the billing address
|
279 |
+
$shipaddress = Mage::getModel("customer/address");
|
280 |
+
$shipaddress->setCustomerId($customer->getId());
|
281 |
+
$shipaddress->setFirstname($Ship_First);
|
282 |
+
$shipaddress->setLastname($Ship_Last);
|
283 |
+
$shipaddress->setCountryId($Ship_Country_Id); //Country code here
|
284 |
+
$shipaddress->setStreet($Ship_Address);
|
285 |
+
$shipaddress->setPostcode($Ship_Zip);
|
286 |
+
$shipaddress->setCity($Ship_City);
|
287 |
+
$shipaddress->setState($Ship_Region_Id);
|
288 |
+
$shipaddress->setTelephone($Phone);
|
289 |
+
$shipaddress->setIsDefaultShipping('1');
|
290 |
+
$shipaddress->save();
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
catch(Exception $ex){
|
295 |
+
|
296 |
+
Mage::log($e->getMessage());
|
297 |
+
}
|
298 |
+
|
299 |
+
}else{
|
300 |
+
|
301 |
+
$selectquery = "SELECT * FROM customer_flat_quote_payment WHERE eTxnID=".$ETXNID;
|
302 |
+
$billValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($selectquery);
|
303 |
+
|
304 |
+
if($billValue['0']['billing_country'] =='USA')
|
305 |
+
{
|
306 |
+
$billValue['0']['billing_countryId'] = 'US';
|
307 |
+
}
|
308 |
+
|
309 |
+
$customer = Mage::getModel('customer/customer')->load($customer->getId());
|
310 |
+
|
311 |
+
$dataBilling = array(
|
312 |
+
'firstname' => $Bill_First,
|
313 |
+
'lastname' => $Bill_Last,
|
314 |
+
'street' => array($Bill_Address),
|
315 |
+
'city' => $Bill_City,
|
316 |
+
'region' => $Bill_State,
|
317 |
+
'region_id' => $Bill_Region_Id,
|
318 |
+
'postcode' => $Bill_Zip,
|
319 |
+
'country_id' => $Bill_Country_Id,
|
320 |
+
'telephone' => $Phone,
|
321 |
+
);
|
322 |
+
|
323 |
+
$dataShipping = array(
|
324 |
+
'firstname' => $Ship_First,
|
325 |
+
'lastname' => $Ship_Last,
|
326 |
+
'street' => array($Ship_Address),
|
327 |
+
'city' => $Ship_City,
|
328 |
+
'region' => $Ship_State,
|
329 |
+
'region_id' => $Ship_Region_Id,
|
330 |
+
'postcode' => $Ship_Zip,
|
331 |
+
'country_id' => $Ship_Country_Id,
|
332 |
+
'telephone' => $Phone,
|
333 |
+
);
|
334 |
+
$customerAddress = Mage::getModel('customer/address');
|
335 |
+
// Check for the shipping address
|
336 |
+
if ($defaultShippingId = $customer->getDefaultShipping()){
|
337 |
+
$customerAddress->load($defaultShippingId);
|
338 |
+
} else {
|
339 |
+
$customerAddress
|
340 |
+
->setCustomerId($customer->getId())
|
341 |
+
->setIsDefaultShipping('1')
|
342 |
+
->setSaveInAddressBook('1');
|
343 |
+
|
344 |
+
$customer->addAddress($customerAddress);
|
345 |
+
}
|
346 |
+
|
347 |
+
$customerAddress1 = Mage::getModel('customer/address');
|
348 |
+
// check for the bliing address
|
349 |
+
if ($defaultBillingId = $customer->getDefaultBilling()){
|
350 |
+
$customerAddress1->load($defaultBillingId);
|
351 |
+
} else {
|
352 |
+
$customerAddress1
|
353 |
+
->setCustomerId($customer->getId())
|
354 |
+
->setIsDefaultBilling('1')
|
355 |
+
->setSaveInAddressBook('1');
|
356 |
+
|
357 |
+
$customer->addAddress($customerAddress);
|
358 |
+
}
|
359 |
+
|
360 |
+
|
361 |
+
try {
|
362 |
+
$customerAddress->addData($dataShipping)->save();
|
363 |
+
$customerAddress1->addData($dataBilling)->save();
|
364 |
+
|
365 |
+
} catch(Exception $e){
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
$update = Mage::getSingleton('core/resource')->getConnection('core_write');
|
372 |
+
$update->query('UPDATE sekurmeorderstatus set companyID = "'.$CompanyID. '",'.'storeID = "'.$StoreID.'",'.'customer_id = "'.$customer_id.'",'.'email_id ="'.$eMail.'",
|
373 |
+
'.'sekurID = "'.$SekurID.'",'.'payStatus = "'.$PayStatus.'",'.'transactionID = "'.$PGTransactionID.'" where eTxnID = "'. $ETXNID . '"');
|
374 |
+
|
375 |
+
|
376 |
+
|
377 |
+
// Send The Response
|
378 |
+
$shipresponse = '<'.'?xml version="1.0" encoding="utf-8"?'.'>';
|
379 |
+
$shipresponse.= '<SekurProcessVerificationResponse><ErrorCode>0</ErrorCode>';
|
380 |
+
$shipresponse = $shipresponse.'<StatusMessage>Success</StatusMessage></SekurProcessVerificationResponse>';
|
381 |
+
header("Content-type: text/xml; charset=utf-8");
|
382 |
+
|
383 |
+
echo $shipresponse;
|
384 |
+
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
|
389 |
+
function clean_up_response($response) {
|
390 |
+
return simplexml_load_string(html_entity_decode($response));
|
391 |
+
}
|
392 |
+
}
|
app/code/community/Sekurme/controllers/StandardController.php
ADDED
@@ -0,0 +1,684 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by SEKUR.me
|
5 |
+
* http://www.sekur.me
|
6 |
+
**/
|
7 |
+
class Sekurme_StandardController extends Mage_Core_Controller_Front_Action
|
8 |
+
{
|
9 |
+
protected function _expireAjax()
|
10 |
+
{
|
11 |
+
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
|
12 |
+
$this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
|
13 |
+
exit;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @Clear shopping cart data
|
19 |
+
*/
|
20 |
+
|
21 |
+
protected function ClearCart()
|
22 |
+
{
|
23 |
+
foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
|
24 |
+
Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @Clear customer CC data
|
30 |
+
*/
|
31 |
+
protected function removeCCInfo($etxnID)
|
32 |
+
{
|
33 |
+
|
34 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
35 |
+
$connection->beginTransaction();
|
36 |
+
|
37 |
+
$__condition = array($connection->quoteInto('eTxnID=?', $etxnID));
|
38 |
+
$query = $connection->delete('customer_flat_quote_payment', $__condition);
|
39 |
+
|
40 |
+
$connection->commit();
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @return Mage_Sekurme_Model_Standard
|
46 |
+
*/
|
47 |
+
public function getStandard()
|
48 |
+
{
|
49 |
+
return Mage::getSingleton('sekurme/standard');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* When a customer fails payment from SEKUR.me.
|
54 |
+
**/
|
55 |
+
public function failedAction()
|
56 |
+
{
|
57 |
+
//
|
58 |
+
// Load layout
|
59 |
+
//
|
60 |
+
$this->loadLayout();
|
61 |
+
$this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('sekurme/general_failed'));
|
62 |
+
$this->renderLayout();
|
63 |
+
}
|
64 |
+
|
65 |
+
//
|
66 |
+
// Changes the order status after payment is made
|
67 |
+
//
|
68 |
+
public function setOrderStatusAfterPayment()
|
69 |
+
{
|
70 |
+
|
71 |
+
//
|
72 |
+
// Load the payment object
|
73 |
+
//
|
74 |
+
|
75 |
+
$standard = Mage::getModel('sekurme/express');
|
76 |
+
|
77 |
+
//
|
78 |
+
// Load the order object from the get orderid parameter
|
79 |
+
//
|
80 |
+
|
81 |
+
$order = Mage::getModel('sales/order');
|
82 |
+
$order->loadByIncrementId($_GET['etxnId']);
|
83 |
+
|
84 |
+
//
|
85 |
+
// Set the status to the new payex status after payment
|
86 |
+
// and save to database
|
87 |
+
//
|
88 |
+
|
89 |
+
$order->addStatusToHistory($standard->getConfigData('order_status_after_payment'), '', true);
|
90 |
+
$order->setStatus($standard->getConfigData('order_status_after_payment'));
|
91 |
+
$order->save();
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
//
|
96 |
+
// Remove from stock (if used)
|
97 |
+
//
|
98 |
+
public function removeFromStock()
|
99 |
+
{
|
100 |
+
//
|
101 |
+
// Load the payment object
|
102 |
+
//
|
103 |
+
$standard = Mage::getModel('sekurme/express');
|
104 |
+
|
105 |
+
//
|
106 |
+
// Load the order object from the get orderid parameter
|
107 |
+
//
|
108 |
+
$order = Mage::getModel('sales/order');
|
109 |
+
$order->loadByIncrementId($_GET['etxnId']);
|
110 |
+
|
111 |
+
$items = $order->getAllItems();
|
112 |
+
if ($items) {
|
113 |
+
foreach($items as $item) {
|
114 |
+
$quantity = $item->getQtyOrdered();
|
115 |
+
$product_id = $item->getProductId();
|
116 |
+
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_id);
|
117 |
+
$stock->setQty($stock->getQty()-$quantity);
|
118 |
+
$stock->save();
|
119 |
+
continue;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
public function confirmOrder($quoteId, $paymentData) {
|
125 |
+
|
126 |
+
|
127 |
+
$_customer = Mage::getSingleton('customer/session')->getCustomer();
|
128 |
+
|
129 |
+
$cart = Mage::helper('checkout')->getQuote();
|
130 |
+
|
131 |
+
//get default billing address from session
|
132 |
+
$customerAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
|
133 |
+
|
134 |
+
//if we have a default billing addreess, try gathering its values into variables we need
|
135 |
+
if ($customerAddressId){
|
136 |
+
$address = Mage::getModel('customer/address')->load($customerAddressId);
|
137 |
+
$street = $address->getStreet();
|
138 |
+
$city = $address->getCity();
|
139 |
+
$postcode = $address->getPostcode();
|
140 |
+
$phoneNumber = $address->getTelephone();
|
141 |
+
$countryId = $address->getCountryId();
|
142 |
+
$regionId = $address->getRegionId();
|
143 |
+
// otherwise, setup some custom entry values so we don't have a bunch of confusing un-descriptive orders in the backend
|
144 |
+
}else{
|
145 |
+
$address = 'No address';
|
146 |
+
$street = 'No street';
|
147 |
+
$city = 'No City';
|
148 |
+
$postcode = 'No post code';
|
149 |
+
$phoneNumber = 'No phone';
|
150 |
+
$countryId = 'No country';
|
151 |
+
$regionId = 'No region';
|
152 |
+
}
|
153 |
+
|
154 |
+
//Start a new order quote and assign current customer to it.
|
155 |
+
$quoteObj = Mage::getModel('sales/quote')->load($quoteId);
|
156 |
+
|
157 |
+
$quoteObj->assignCustomer($_customer);
|
158 |
+
|
159 |
+
$shippingMethod = $quoteObj->getShippingAddress();
|
160 |
+
|
161 |
+
//Add address array to both billing AND shipping address objects.
|
162 |
+
$billingAddress = $quoteObj->getBillingAddress()->addData($addressData);
|
163 |
+
$shippingAddress = $quoteObj->getShippingAddress()->addData($addressData);
|
164 |
+
|
165 |
+
|
166 |
+
$items = $quoteObj->getAllItems();
|
167 |
+
|
168 |
+
$itemArr = array();
|
169 |
+
|
170 |
+
foreach($items as $itemVal)
|
171 |
+
{
|
172 |
+
$itemArr = $itemVal;
|
173 |
+
}
|
174 |
+
|
175 |
+
if(empty($itemArr))
|
176 |
+
{
|
177 |
+
|
178 |
+
?>
|
179 |
+
<script type="text/javascript">
|
180 |
+
window.onload = function() {
|
181 |
+
if(!window.location.hash) {
|
182 |
+
window.location = window.location + '#loaded';
|
183 |
+
window.location.reload();
|
184 |
+
}
|
185 |
+
}
|
186 |
+
</script>
|
187 |
+
|
188 |
+
<?php
|
189 |
+
//Detect special conditions devices
|
190 |
+
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
|
191 |
+
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
|
192 |
+
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
|
193 |
+
|
194 |
+
//do something with this information
|
195 |
+
if( $iPod || $iPhone || $iPad ){
|
196 |
+
$this->_redirectUrl(Mage::getBaseUrl());
|
197 |
+
}else {
|
198 |
+
exit;
|
199 |
+
}
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
$shipping = $quoteObj->getShippingAddress()->getShippingAmount();
|
204 |
+
|
205 |
+
$shippingAmount = $cart->getShippingAddress()->getData('shipping_amount');
|
206 |
+
|
207 |
+
if(empty($shippingAmount))
|
208 |
+
{
|
209 |
+
$shippingAmount = $shipping;
|
210 |
+
}
|
211 |
+
|
212 |
+
$taxAmount = $cart->getShippingAddress()->getData('tax_amount');
|
213 |
+
|
214 |
+
$quoteObj->getShippingAddress()->setTaxAmount($taxAmount); //set the total of tax
|
215 |
+
$quoteObj->getShippingAddress()->setBaseTaxAmount($taxAmount); //set the total of tax
|
216 |
+
$quoteObj->getShippingAddress()->setShippingAmount($shippingAmount); //set the shipping price with taxes
|
217 |
+
$quoteObj->getShippingAddress()->setBaseShippingAmount($shippingAmount); //set the shipping price with taxes
|
218 |
+
|
219 |
+
$tax_amount = $quoteObj->getShippingAddress()->getData('tax_amount');
|
220 |
+
$shipping_amount = $quoteObj->getShippingAddress()->getData('shipping_amount');
|
221 |
+
|
222 |
+
$quoteObj->reserveOrderId();
|
223 |
+
$quoteObj->collectTotals();
|
224 |
+
|
225 |
+
// set payment method
|
226 |
+
$quotePaymentObj = $quoteObj->getPayment();
|
227 |
+
$quotePaymentObj->setMethod($paymentData['method']);
|
228 |
+
$quoteObj->setPayment($quotePaymentObj);
|
229 |
+
|
230 |
+
// convert quote to order
|
231 |
+
$convertQuoteObj = Mage::getSingleton('sales/convert_quote');
|
232 |
+
$orderObj = $convertQuoteObj->addressToOrder($quoteObj->getShippingAddress());
|
233 |
+
$orderPaymentObj = $convertQuoteObj->paymentToOrderPayment($quotePaymentObj);
|
234 |
+
|
235 |
+
//Set the Shipping Amount To OrderObj
|
236 |
+
$orderObj->setShippingAmount($shipping_amount);
|
237 |
+
$orderObj->setBaseShippingAmount($shipping_amount);
|
238 |
+
|
239 |
+
//Set the Tax Amount To OrderObj
|
240 |
+
$orderObj->setTaxAmount($tax_amount);
|
241 |
+
$orderObj->setBaseTaxAmount($tax_amount);
|
242 |
+
|
243 |
+
// Assign Looged In Customer Address
|
244 |
+
|
245 |
+
$orderObj->setBillingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getBillingAddress()));
|
246 |
+
|
247 |
+
$orderObj->setShippingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getShippingAddress()));
|
248 |
+
|
249 |
+
$orderObj->setPayment($convertQuoteObj->paymentToOrderPayment($quoteObj->getPayment()));
|
250 |
+
|
251 |
+
if ($paymentData) {
|
252 |
+
|
253 |
+
$orderObj->getPayment()->setCcNumber($paymentData['ccNumber']);
|
254 |
+
$orderObj->getPayment()->setCcOwner($paymentData['ccOwner']);
|
255 |
+
$orderObj->getPayment()->setCcType($paymentData['ccType']);
|
256 |
+
$orderObj->getPayment()->setCcExpMonth($paymentData['ccExpMonth']);
|
257 |
+
$orderObj->getPayment()->setCcExpYear($paymentData['ccExpYear']);
|
258 |
+
$orderObj->getPayment()->setCcLast4(substr($paymentData['ccNumber'],-4));
|
259 |
+
|
260 |
+
}
|
261 |
+
|
262 |
+
foreach ($items as $item) {
|
263 |
+
//@var $item Mage_Sales_Model_Quote_Item
|
264 |
+
$orderItem = $convertQuoteObj->itemToOrderItem($item);
|
265 |
+
if ($item->getParentItem()) {
|
266 |
+
|
267 |
+
$orderItem->setParentItem($orderObj->getItemByQuoteItemId($item->getParentItem()->getId()));
|
268 |
+
|
269 |
+
}
|
270 |
+
|
271 |
+
$orderObj->addItem($orderItem);
|
272 |
+
|
273 |
+
}
|
274 |
+
$orderObj->setCanShipPartiallyItem(false);
|
275 |
+
|
276 |
+
$totalDue = $orderObj->getTotalDue();
|
277 |
+
|
278 |
+
//$orderObj->sendNewOrderEmail();
|
279 |
+
|
280 |
+
try {
|
281 |
+
|
282 |
+
$orderObj->place(); //calls _placePayment
|
283 |
+
$orderObj->save();
|
284 |
+
|
285 |
+
}catch (Exception $e){
|
286 |
+
|
287 |
+
Mage::register('payment_error', "bank");
|
288 |
+
Mage::register('code', "Payment");
|
289 |
+
Mage::register('desc', "Order not places successfully, incorrect credit card details.");
|
290 |
+
$this->failedAction();
|
291 |
+
return;
|
292 |
+
}
|
293 |
+
|
294 |
+
$orderObj->load(Mage::getSingleton('sales/order')->getLastOrderId());
|
295 |
+
$lastOrderId = $orderObj->getIncrementId();
|
296 |
+
|
297 |
+
$sessionQuote = Mage::getSingleton('checkout/session');
|
298 |
+
|
299 |
+
//prepare session to success page
|
300 |
+
Mage::getSingleton("checkout/session")
|
301 |
+
->setLastQuoteId($sessionQuote->getQuoteId())
|
302 |
+
->setLastSuccessQuoteId($sessionQuote->getQuoteId())
|
303 |
+
->setLastOrderId($orderObj->getId())
|
304 |
+
->setLastRealOrderId($orderObj->getIncrementId());
|
305 |
+
|
306 |
+
|
307 |
+
/***************EMAIL*****************/
|
308 |
+
$orderObj->loadByIncrementId($lastOrderId);
|
309 |
+
|
310 |
+
try{
|
311 |
+
|
312 |
+
//echo "Trying to send an mail";
|
313 |
+
//$emailed = $orderObj->sendNewOrderEmail();
|
314 |
+
//$quote->delete();
|
315 |
+
|
316 |
+
}catch (Exception $ex){
|
317 |
+
|
318 |
+
//echo "Failed to send a confirmation mail";
|
319 |
+
|
320 |
+
}
|
321 |
+
/***************EMAIL*****************/
|
322 |
+
|
323 |
+
return $lastOrderId;
|
324 |
+
|
325 |
+
}
|
326 |
+
|
327 |
+
public function createOrderAuthAction($quoteId, $paymentMethod, $paymentData)
|
328 |
+
{
|
329 |
+
|
330 |
+
$_customer = Mage::getSingleton('customer/session')->getCustomer();
|
331 |
+
|
332 |
+
$cart = Mage::helper('checkout')->getQuote();
|
333 |
+
|
334 |
+
//get default billing address from session
|
335 |
+
$customerAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
|
336 |
+
|
337 |
+
//if we have a default billing addreess, try gathering its values into variables we need
|
338 |
+
if ($customerAddressId){
|
339 |
+
$address = Mage::getModel('customer/address')->load($customerAddressId);
|
340 |
+
$street = $address->getStreet();
|
341 |
+
$city = $address->getCity();
|
342 |
+
$postcode = $address->getPostcode();
|
343 |
+
$phoneNumber = $address->getTelephone();
|
344 |
+
$countryId = $address->getCountryId();
|
345 |
+
$regionId = $address->getRegionId();
|
346 |
+
// otherwise, setup some custom entry values so we don't have a bunch of confusing un-descriptive orders in the backend
|
347 |
+
}else{
|
348 |
+
$address = 'No address';
|
349 |
+
$street = 'No street';
|
350 |
+
$city = 'No City';
|
351 |
+
$postcode = 'No post code';
|
352 |
+
$phoneNumber = 'No phone';
|
353 |
+
$countryId = 'No country';
|
354 |
+
$regionId = 'No region';
|
355 |
+
}
|
356 |
+
|
357 |
+
//Start a new order quote and assign current customer to it.
|
358 |
+
$quoteObj = Mage::getModel('sales/quote')->load($quoteId);
|
359 |
+
|
360 |
+
$quoteObj->assignCustomer($_customer);
|
361 |
+
|
362 |
+
$shippingMethod = $quoteObj->getShippingAddress();
|
363 |
+
|
364 |
+
//Add address array to both billing AND shipping address objects.
|
365 |
+
$billingAddress = $quoteObj->getBillingAddress()->addData($addressData);
|
366 |
+
$shippingAddress = $quoteObj->getShippingAddress()->addData($addressData);
|
367 |
+
|
368 |
+
$items = $quoteObj->getAllItems();
|
369 |
+
|
370 |
+
$itemArr = array();
|
371 |
+
|
372 |
+
foreach($items as $itemVal)
|
373 |
+
{
|
374 |
+
$itemArr = $itemVal;
|
375 |
+
}
|
376 |
+
|
377 |
+
if(empty($itemArr))
|
378 |
+
{
|
379 |
+
|
380 |
+
?>
|
381 |
+
<script type="text/javascript">
|
382 |
+
window.onload = function() {
|
383 |
+
if(!window.location.hash) {
|
384 |
+
window.location = window.location + '#loaded';
|
385 |
+
window.location.reload();
|
386 |
+
}
|
387 |
+
}
|
388 |
+
</script>
|
389 |
+
|
390 |
+
<?php
|
391 |
+
//Detect special conditions devices
|
392 |
+
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
|
393 |
+
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
|
394 |
+
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
|
395 |
+
|
396 |
+
//do something with this information
|
397 |
+
if( $iPod || $iPhone || $iPad ){
|
398 |
+
$this->_redirectUrl(Mage::getBaseUrl());
|
399 |
+
}else {
|
400 |
+
exit;
|
401 |
+
}
|
402 |
+
|
403 |
+
}
|
404 |
+
|
405 |
+
$quoteObj->reserveOrderId();
|
406 |
+
|
407 |
+
// set payment method
|
408 |
+
$quotePaymentObj = $quoteObj->getPayment(); // Mage_Sales_Model_Quote_Payment
|
409 |
+
$quotePaymentObj->setMethod($paymentMethod);
|
410 |
+
$quoteObj->setPayment($quotePaymentObj);
|
411 |
+
|
412 |
+
// convert quote to order
|
413 |
+
$convertQuoteObj = Mage::getSingleton('sales/convert_quote');
|
414 |
+
|
415 |
+
$orderObj = $convertQuoteObj->addressToOrder($quoteObj->getShippingAddress());
|
416 |
+
|
417 |
+
$orderPaymentObj = $convertQuoteObj->paymentToOrderPayment($quotePaymentObj);
|
418 |
+
|
419 |
+
// convert quote addresses
|
420 |
+
$orderObj->setBillingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getBillingAddress()));
|
421 |
+
$orderObj->setShippingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getShippingAddress()));
|
422 |
+
|
423 |
+
// set payment options
|
424 |
+
$orderObj->setPayment($convertQuoteObj->paymentToOrderPayment($quoteObj->getPayment()));
|
425 |
+
if ($paymentData) {
|
426 |
+
$orderObj->getPayment()->setCcNumber($paymentData['ccNumber']);
|
427 |
+
//$orderObj->getPayment()->setCcOwner($paymentData['ccOwner']);
|
428 |
+
$orderObj->getPayment()->setCcType($paymentData['ccType']);
|
429 |
+
$orderObj->getPayment()->setCcExpMonth($paymentData['ccExpMonth']);
|
430 |
+
$orderObj->getPayment()->setCcExpYear($paymentData['ccExpYear']);
|
431 |
+
$orderObj->getPayment()->setCcLast4(substr($paymentData['ccNumber'],-4));
|
432 |
+
}
|
433 |
+
// convert quote items
|
434 |
+
foreach ($items as $item) {
|
435 |
+
// @var $item Mage_Sales_Model_Quote_Item
|
436 |
+
$orderItem = $convertQuoteObj->itemToOrderItem($item);
|
437 |
+
|
438 |
+
$options = array();
|
439 |
+
if ($productOptions = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct())) {
|
440 |
+
|
441 |
+
$options = $productOptions;
|
442 |
+
}
|
443 |
+
if ($addOptions = $item->getOptionByCode('additional_options')) {
|
444 |
+
$options['additional_options'] = unserialize($addOptions->getValue());
|
445 |
+
}
|
446 |
+
if ($options) {
|
447 |
+
$orderItem->setProductOptions($options);
|
448 |
+
}
|
449 |
+
if ($item->getParentItem()) {
|
450 |
+
$orderItem->setParentItem($orderObj->getItemByQuoteItemId($item->getParentItem()->getId()));
|
451 |
+
}
|
452 |
+
$orderObj->addItem($orderItem);
|
453 |
+
}
|
454 |
+
|
455 |
+
$orderObj->setCanShipPartiallyItem(false);
|
456 |
+
|
457 |
+
try {
|
458 |
+
$orderObj->place();
|
459 |
+
$orderObj->save();
|
460 |
+
|
461 |
+
$orderObj->load(Mage::getSingleton('sales/order')->getLastOrderId());
|
462 |
+
$lastOrderId = $orderObj->getIncrementId();
|
463 |
+
|
464 |
+
$sessionQuote = Mage::getSingleton('checkout/session');
|
465 |
+
|
466 |
+
//prepare session to success page
|
467 |
+
Mage::getSingleton("checkout/session")
|
468 |
+
->setLastQuoteId($sessionQuote->getQuoteId())
|
469 |
+
->setLastSuccessQuoteId($sessionQuote->getQuoteId())
|
470 |
+
->setLastOrderId($orderObj->getId())
|
471 |
+
->setLastRealOrderId($orderObj->getIncrementId());
|
472 |
+
|
473 |
+
|
474 |
+
/***************EMAIL*****************/
|
475 |
+
$orderObj->loadByIncrementId($lastOrderId);
|
476 |
+
|
477 |
+
try{
|
478 |
+
|
479 |
+
//echo "Trying to send an mail";
|
480 |
+
//$emailed = $orderObj->sendNewOrderEmail();
|
481 |
+
//$quote->delete();
|
482 |
+
|
483 |
+
}catch (Exception $ex){
|
484 |
+
|
485 |
+
//echo "Failed to send a confirmation mail";
|
486 |
+
|
487 |
+
}
|
488 |
+
|
489 |
+
} catch (Exception $e){
|
490 |
+
Mage::log($e->getMessage());
|
491 |
+
Mage::log($e->getTraceAsString());
|
492 |
+
$lastOrderId = $e->getMessage();
|
493 |
+
$lastOrderId .='Payment_Error';
|
494 |
+
}
|
495 |
+
//$orderObj->save();
|
496 |
+
//$orderObj->sendNewOrderEmail();
|
497 |
+
//return $orderObj->getId();
|
498 |
+
|
499 |
+
/***************EMAIL*****************/
|
500 |
+
return $lastOrderId;
|
501 |
+
|
502 |
+
}
|
503 |
+
|
504 |
+
// Decrypt string
|
505 |
+
public function cc_decrypt($str)
|
506 |
+
{
|
507 |
+
$EncKey = "25c6c7dd";
|
508 |
+
$str = mcrypt_decrypt(MCRYPT_DES, $EncKey, base64_decode($str), MCRYPT_MODE_ECB);
|
509 |
+
# Strip padding out.
|
510 |
+
$block = mcrypt_get_block_size('des', 'ecb');
|
511 |
+
$pad = ord($str[($len = strlen($str)) - 1]);
|
512 |
+
if ($pad && $pad < $block && preg_match(
|
513 |
+
'/' . chr($pad) . '{' . $pad . '}$/', $str
|
514 |
+
)
|
515 |
+
) {
|
516 |
+
return substr($str, 0, strlen($str) - $pad);
|
517 |
+
}
|
518 |
+
return $str;
|
519 |
+
}
|
520 |
+
|
521 |
+
public function completeAction()
|
522 |
+
|
523 |
+
{
|
524 |
+
|
525 |
+
$session = Mage::getSingleton('checkout/session');
|
526 |
+
|
527 |
+
$standard = Mage::getModel('sekurme/express');
|
528 |
+
|
529 |
+
$quoteId = $session->getQuoteId();
|
530 |
+
|
531 |
+
$ETXNID = $_GET['eTxnID'];
|
532 |
+
|
533 |
+
$selectquery = "SELECT * FROM sekurmeorderstatus WHERE eTxnID=".$ETXNID;
|
534 |
+
|
535 |
+
$customerInfo = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($selectquery);
|
536 |
+
|
537 |
+
//Get customer data
|
538 |
+
$customer = Mage::getModel('customer/customer');
|
539 |
+
|
540 |
+
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
|
541 |
+
|
542 |
+
$customer->loadByEmail(trim($customerInfo['0']['email_id']));
|
543 |
+
|
544 |
+
Mage::getSingleton('core/session', array('name' => 'frontend'));
|
545 |
+
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
|
546 |
+
|
547 |
+
|
548 |
+
$customAddress = Mage::getModel('customer/address');
|
549 |
+
|
550 |
+
$customerId = $customer->getId();
|
551 |
+
|
552 |
+
$ccquery = "SELECT * FROM customer_flat_quote_payment WHERE eTxnID=".$ETXNID;
|
553 |
+
$ccValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($ccquery);
|
554 |
+
|
555 |
+
$last4Digit = trim($this->cc_decrypt($ccValue['0']['cc_number_enc']));
|
556 |
+
|
557 |
+
$last4Num = substr($last4Digit,-4,4);
|
558 |
+
|
559 |
+
$expYear = trim($ccValue['0']['cc_exp_year']);
|
560 |
+
|
561 |
+
$last2Num = substr($expYear,2);
|
562 |
+
|
563 |
+
$paymentMethod = Mage::getStoreConfig('payment/sekurme/paymentmethod');
|
564 |
+
|
565 |
+
$paymentData = array(
|
566 |
+
'method' => $paymentMethod,
|
567 |
+
'ccType' => trim($ccValue['0']['cc_type']),
|
568 |
+
'ccOwner' => trim($ccValue['0']['cc_owner']),
|
569 |
+
'ccNumber' => trim($this->cc_decrypt($ccValue['0']['cc_number_enc'])),
|
570 |
+
'ccExpMonth' => trim($ccValue['0']['cc_exp_month']),
|
571 |
+
'ccExpYear' => trim($ccValue['0']['cc_exp_year']),
|
572 |
+
'CcLast4' => $last4Num
|
573 |
+
|
574 |
+
);
|
575 |
+
|
576 |
+
try{
|
577 |
+
if($paymentMethod == 'authorizenet'){
|
578 |
+
$getID = $this->createOrderAuthAction($quoteId, $paymentMethod, $paymentData);
|
579 |
+
}else{
|
580 |
+
$getID = $this->confirmOrder($quoteId, $paymentData);
|
581 |
+
}
|
582 |
+
|
583 |
+
}catch (Exception $e) {
|
584 |
+
|
585 |
+
$this->failedAction();
|
586 |
+
return;
|
587 |
+
|
588 |
+
}
|
589 |
+
|
590 |
+
$this->removeCCInfo($ETXNID);
|
591 |
+
|
592 |
+
$params = array('_query' => array('orderID' => $getID));
|
593 |
+
|
594 |
+
$this->_redirect('sekurme/standard/success/',$params);
|
595 |
+
|
596 |
+
}
|
597 |
+
|
598 |
+
public function successAction()
|
599 |
+
{
|
600 |
+
|
601 |
+
$getID = $_GET['orderID'];
|
602 |
+
$session = Mage::getSingleton('checkout/session');
|
603 |
+
$session->setPayexStandardQuoteId($session->getQuoteId());
|
604 |
+
|
605 |
+
$order = Mage::getModel('sales/order');
|
606 |
+
$order_id = Mage::getSingleton("checkout/session")->getLastRealOrderId();
|
607 |
+
$order->loadByIncrementId($order_id);
|
608 |
+
|
609 |
+
if (strpos($getID,'Payment_Error') !== false) {
|
610 |
+
$msg = explode('Payment_Error',$getID);
|
611 |
+
}
|
612 |
+
|
613 |
+
//
|
614 |
+
// Load the order number
|
615 |
+
if (Mage::getSingleton('checkout/session')->getLastOrderId() && (isset($_GET["orderID"])) && Mage::getSingleton('checkout/session')->getLastOrderId() == $_GET["orderID"]) {
|
616 |
+
$order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
617 |
+
|
618 |
+
} else {
|
619 |
+
|
620 |
+
if (isset($_GET["orderID"])) {
|
621 |
+
|
622 |
+
$order->loadByIncrementId((int)$_GET["orderID"]);
|
623 |
+
|
624 |
+
}
|
625 |
+
else
|
626 |
+
{
|
627 |
+
Mage::register('payment_error', "bank");
|
628 |
+
if(empty($msg[0]))
|
629 |
+
{
|
630 |
+
Mage::register('desc', "Your purchase has not been completed using the selected card.
|
631 |
+
<br/> Your bank declined our attempt to authorize your card.");
|
632 |
+
}else{
|
633 |
+
Mage::register('desc', $msg[0]);
|
634 |
+
}
|
635 |
+
$this->failedAction();
|
636 |
+
return;
|
637 |
+
}
|
638 |
+
}
|
639 |
+
|
640 |
+
//
|
641 |
+
// Validate the order and send email confirmation if enabled
|
642 |
+
if(!$order->getId()){
|
643 |
+
|
644 |
+
Mage::register('payment_error', "order_error");
|
645 |
+
if(empty($msg[0]))
|
646 |
+
{
|
647 |
+
Mage::register('desc', "There was a problem creating your order. Please try again, or contact customer service for more help.");
|
648 |
+
}else{
|
649 |
+
Mage::register('desc', $msg[0]);
|
650 |
+
}
|
651 |
+
$this->failedAction();
|
652 |
+
return;
|
653 |
+
}
|
654 |
+
|
655 |
+
// Send email order confirmation
|
656 |
+
//
|
657 |
+
|
658 |
+
$order->load($order->getId());
|
659 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
|
660 |
+
//$order->sendOrderUpdateEmail();
|
661 |
+
|
662 |
+
$order->save();
|
663 |
+
|
664 |
+
$this->ClearCart();
|
665 |
+
|
666 |
+
$params = array('order_id' => $order->getId());
|
667 |
+
|
668 |
+
Mage::getSingleton('checkout/cart')->truncate();
|
669 |
+
|
670 |
+
$this->_redirect('sales/order/view/',$params);
|
671 |
+
|
672 |
+
//$this->_redirect('checkout/onepage/success');
|
673 |
+
|
674 |
+
}
|
675 |
+
|
676 |
+
function clean_up_response($response) {
|
677 |
+
|
678 |
+
return simplexml_load_string(html_entity_decode($response));
|
679 |
+
|
680 |
+
}
|
681 |
+
|
682 |
+
|
683 |
+
|
684 |
+
}
|
app/code/community/Sekurme/etc/config.xml
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme>
|
5 |
+
<version>1.0.0.1</version>
|
6 |
+
</Sekurme>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<sekurme>
|
11 |
+
<class>Sekurme_Model</class>
|
12 |
+
<resourceModel>Sekurme_mysql4</resourceModel>
|
13 |
+
</sekurme>
|
14 |
+
<sekurme_mysql4>
|
15 |
+
<class>Sekurme_Model_Mysql4</class>
|
16 |
+
<entities>
|
17 |
+
<api_debug><table>sekurme_api_debug</table></api_debug>
|
18 |
+
</entities>
|
19 |
+
</sekurme_mysql4>
|
20 |
+
|
21 |
+
</models>
|
22 |
+
<resources>
|
23 |
+
<sekurme_setup>
|
24 |
+
<setup>
|
25 |
+
<module>Sekurme</module>
|
26 |
+
<class>Sekurme_Model_Mysql4_Setup</class>
|
27 |
+
</setup>
|
28 |
+
<connection>
|
29 |
+
<use>core_setup</use>
|
30 |
+
</connection>
|
31 |
+
</sekurme_setup>
|
32 |
+
<sekurme_write>
|
33 |
+
<connection>
|
34 |
+
<use>core_write</use>
|
35 |
+
</connection>
|
36 |
+
</sekurme_write>
|
37 |
+
<sekurme_read>
|
38 |
+
<connection>
|
39 |
+
<use>core_read</use>
|
40 |
+
</connection>
|
41 |
+
</sekurme_read>
|
42 |
+
</resources>
|
43 |
+
|
44 |
+
<helpers>
|
45 |
+
<sekurme>
|
46 |
+
<class>Sekurme_Helper</class>
|
47 |
+
</sekurme>
|
48 |
+
</helpers>
|
49 |
+
|
50 |
+
<blocks>
|
51 |
+
<sekurme><class>Sekurme_Block</class></sekurme>
|
52 |
+
</blocks>
|
53 |
+
</global>
|
54 |
+
<frontend>
|
55 |
+
|
56 |
+
<routers>
|
57 |
+
<sekurme>
|
58 |
+
<use>standard</use>
|
59 |
+
<args>
|
60 |
+
<module>Sekurme</module>
|
61 |
+
<frontName>sekurme</frontName>
|
62 |
+
</args>
|
63 |
+
</sekurme>
|
64 |
+
</routers>
|
65 |
+
|
66 |
+
|
67 |
+
<layout>
|
68 |
+
|
69 |
+
<updates>
|
70 |
+
<sekurme>
|
71 |
+
<file>sekurme.xml</file>
|
72 |
+
</sekurme>
|
73 |
+
</updates>
|
74 |
+
|
75 |
+
</layout>
|
76 |
+
|
77 |
+
<translate>
|
78 |
+
<modules>
|
79 |
+
<sekurme>
|
80 |
+
<files>
|
81 |
+
<default>Mage_Sekurme.csv</default>
|
82 |
+
</files>
|
83 |
+
</sekurme>
|
84 |
+
</modules>
|
85 |
+
</translate>
|
86 |
+
|
87 |
+
|
88 |
+
</frontend>
|
89 |
+
<adminhtml>
|
90 |
+
<translate>
|
91 |
+
<modules>
|
92 |
+
<Sekurme>
|
93 |
+
<files>
|
94 |
+
<default>Sekurme.csv</default>
|
95 |
+
</files>
|
96 |
+
</Sekurme>
|
97 |
+
</modules>
|
98 |
+
</translate>
|
99 |
+
<acl>
|
100 |
+
<resources>
|
101 |
+
<admin>
|
102 |
+
<children>
|
103 |
+
<system>
|
104 |
+
<children>
|
105 |
+
<config>
|
106 |
+
<children>
|
107 |
+
<sekurme>
|
108 |
+
<title>Sekurme Section</title>
|
109 |
+
</sekurme>
|
110 |
+
</children>
|
111 |
+
</config>
|
112 |
+
</children>
|
113 |
+
</system>
|
114 |
+
</children>
|
115 |
+
</admin>
|
116 |
+
</resources>
|
117 |
+
</acl>
|
118 |
+
</adminhtml>
|
119 |
+
|
120 |
+
<default>
|
121 |
+
<sekurme>
|
122 |
+
<model>Sekurme_Model_Express</model>
|
123 |
+
<subtitle>Enter sub title</subtitle>
|
124 |
+
<storeid>Enter Store ID</storeid>
|
125 |
+
<active>1</active>
|
126 |
+
<sort_order>1</sort_order>
|
127 |
+
<merchantnumber>Enter Company ID</merchantnumber>
|
128 |
+
<sekurmeurl>Enter SEKUR.me Online Url</sekurmeurl>
|
129 |
+
<express_button_checkout>1</express_button_checkout>
|
130 |
+
<paymentmethod></paymentmethod>
|
131 |
+
<paymentaction>1</paymentaction>
|
132 |
+
</sekurme>
|
133 |
+
</default>
|
134 |
+
|
135 |
+
</config>
|
app/code/community/Sekurme/etc/system.xml
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment translate="label" module="payment">
|
5 |
+
<groups>
|
6 |
+
<sekurme translate="label">
|
7 |
+
<label><![CDATA[Express Checkout With SEKUR.me]]></label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>1</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>0</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<express_button_checkout translate="label">
|
15 |
+
<label>Enable</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
<comment>
|
23 |
+
<![CDATA[
|
24 |
+
Enable Express Checkout with SEKUR.me, the fastest checkout process. Increase your conversions, your repeat sales and your revenues.
|
25 |
+
]]>
|
26 |
+
</comment>
|
27 |
+
</express_button_checkout>
|
28 |
+
<subtitle translate="label">
|
29 |
+
<label><![CDATA[Sub Title]]></label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>3</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>0</show_in_store>
|
35 |
+
</subtitle>
|
36 |
+
<storeid translate="label">
|
37 |
+
<label><![CDATA[Store ID]]></label>
|
38 |
+
<comment><![CDATA[Use SEKUR.me provided Store ID.]]></comment>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>4</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>0</show_in_store>
|
44 |
+
</storeid>
|
45 |
+
<merchantnumber translate="label">
|
46 |
+
<label><![CDATA[Company ID]]></label>
|
47 |
+
<comment><![CDATA[Use SEKUR.me provided Company ID.]]></comment>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>5</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>0</show_in_store>
|
53 |
+
</merchantnumber>
|
54 |
+
<md5key translate="label">
|
55 |
+
<label><![CDATA[SEKUR.me Authorization Key]]></label>
|
56 |
+
<comment><![CDATA[Use SEKUR.me provided Authorization Key.]]></comment>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>6</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>0</show_in_store>
|
62 |
+
</md5key>
|
63 |
+
<sekurmeurl translate="label">
|
64 |
+
<label><![CDATA[SEKUR.me Online Url. Here you can insert your test url. Remember to change the url here to the live one when testing is finished. This is provided by SEKUR.me.]]></label>
|
65 |
+
<frontend_type>text</frontend_type>
|
66 |
+
<sort_order>7</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>0</show_in_store>
|
70 |
+
</sekurmeurl>
|
71 |
+
|
72 |
+
<paymentmethod translate="label">
|
73 |
+
<label><![CDATA[Payment Mode]]></label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<sort_order>8</sort_order>
|
76 |
+
<source_model>sekurme/system_config_source_paymentmethod</source_model>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>0</show_in_store>
|
80 |
+
<comment><![CDATA[Make sure that the selected payment mode is activated; otherwise, SEKUR.me payment method will work in the unilateral mode.]]></comment>
|
81 |
+
</paymentmethod>
|
82 |
+
|
83 |
+
<order_status translate="label">
|
84 |
+
<label><![CDATA[Order Status before payment]]></label>
|
85 |
+
<frontend_type>select</frontend_type>
|
86 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
87 |
+
<sort_order>9</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>0</show_in_store>
|
91 |
+
</order_status>
|
92 |
+
|
93 |
+
<order_status_after_payment translate="label">
|
94 |
+
<label><![CDATA[Order Status after payment]]></label>
|
95 |
+
<frontend_type>select</frontend_type>
|
96 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
97 |
+
<sort_order>10</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>0</show_in_store>
|
101 |
+
</order_status_after_payment>
|
102 |
+
<paymentaction translate="label">
|
103 |
+
<label><![CDATA[Payment Action]]></label>
|
104 |
+
<frontend_type>select</frontend_type>
|
105 |
+
<source_model>sekurme/system_config_source_paymentaction</source_model>
|
106 |
+
<sort_order>11</sort_order>
|
107 |
+
<show_in_default>2</show_in_default>
|
108 |
+
<show_in_website>2</show_in_website>
|
109 |
+
<show_in_store>0</show_in_store>
|
110 |
+
</paymentaction>
|
111 |
+
|
112 |
+
</fields>
|
113 |
+
</sekurme>
|
114 |
+
</groups>
|
115 |
+
</payment>
|
116 |
+
</sections>
|
117 |
+
</config>
|
app/code/community/Sekurme/sql/sekurme_setup/mysql4-install-1.0.0.1.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by Span Infotech, ravindra.singh@spanservices.com
|
5 |
+
* http://www.spansystems.com
|
6 |
+
**/
|
7 |
+
|
8 |
+
$installer = $this;
|
9 |
+
|
10 |
+
$installer->startSetup();
|
11 |
+
|
12 |
+
$installer->run("
|
13 |
+
|
14 |
+
delete from {$installer->getTable('core_resource')} where code = 'sekurme_setup';
|
15 |
+
|
16 |
+
CREATE TABLE IF NOT EXISTS `customer_flat_quote_payment` (
|
17 |
+
`cc_flat_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'CC Flat Id',
|
18 |
+
`eTxnID` int(11) DEFAULT NULL COMMENT 'eTxnID',
|
19 |
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Created At',
|
20 |
+
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Updated At',
|
21 |
+
`amount` float DEFAULT NULL COMMENT 'Amount',
|
22 |
+
`currency` varchar(10) DEFAULT NULL COMMENT 'Currency',
|
23 |
+
`billing_name` varchar(255) DEFAULT NULL COMMENT 'Billing Name',
|
24 |
+
`billing_street` varchar(255) DEFAULT NULL COMMENT 'Billing Street',
|
25 |
+
`billing_city` varchar(30) DEFAULT NULL COMMENT 'Billing City',
|
26 |
+
`billing_state` varchar(30) DEFAULT NULL COMMENT 'Billing State',
|
27 |
+
`billing_zip` int(10) DEFAULT NULL COMMENT 'Billing Zip',
|
28 |
+
`billing_country` varchar(30) DEFAULT NULL COMMENT 'Billing Country',
|
29 |
+
`cc_type` varchar(255) DEFAULT NULL COMMENT 'Cc Type',
|
30 |
+
`cc_number_enc` varchar(255) DEFAULT NULL COMMENT 'Cc Number Enc',
|
31 |
+
`cc_last4` varchar(255) DEFAULT NULL COMMENT 'Cc Last4',
|
32 |
+
`cc_cid_enc` varchar(255) DEFAULT NULL COMMENT 'Cc Cid Enc',
|
33 |
+
`cc_owner` varchar(255) DEFAULT NULL COMMENT 'Cc Owner',
|
34 |
+
`cc_exp_month` smallint(5) unsigned DEFAULT '0' COMMENT 'Cc Exp Month',
|
35 |
+
`cc_exp_year` smallint(5) unsigned DEFAULT '0' COMMENT 'Cc Exp Year',
|
36 |
+
PRIMARY KEY (`cc_flat_id`)
|
37 |
+
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Customer Flat Quote Payment' AUTO_INCREMENT=1 ;
|
38 |
+
|
39 |
+
CREATE TABLE IF NOT EXISTS `sekurmeorderstatus` (
|
40 |
+
`Id` int(11) NOT NULL AUTO_INCREMENT,
|
41 |
+
`eTxnID` varchar(30) NOT NULL,
|
42 |
+
`tssID` varchar(30) NOT NULL,
|
43 |
+
`companyID` varchar(50) NOT NULL,
|
44 |
+
`storeID` varchar(50) NOT NULL,
|
45 |
+
`customer_id` int(11) NOT NULL,
|
46 |
+
`email_id` varchar(80) NOT NULL,
|
47 |
+
`sekurID` varchar(50) NOT NULL,
|
48 |
+
`cc_flat_id` int(11) NOT NULL,
|
49 |
+
`paymentAction` varchar(30) NOT NULL,
|
50 |
+
`payStatus` int(5) NOT NULL,
|
51 |
+
`transactionID` int(10) NOT NULL,
|
52 |
+
`status` int(5) NOT NULL COMMENT '0 = unpaid, 1 = paid',
|
53 |
+
`statusMessage` varchar(20) NOT NULL,
|
54 |
+
`errorCode` int(5) NOT NULL,
|
55 |
+
`qr_URL` text NOT NULL,
|
56 |
+
`date` datetime NOT NULL,
|
57 |
+
PRIMARY KEY (`Id`)
|
58 |
+
)ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
|
59 |
+
|
60 |
+
");
|
61 |
+
|
62 |
+
|
63 |
+
$installer->endSetup();
|
app/code/local/Sekurme/Clearoldcartproducts/Model/Observer.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sekurme_Clearoldcartproducts_Model_Observer extends Mage_Checkout_Model_Session
|
3 |
+
{
|
4 |
+
public function loadCustomerQuote() {
|
5 |
+
|
6 |
+
$customerQuote = Mage:: getModel('sales/quote')
|
7 |
+
->setStoreId(Mage:: app()->getStore()->getId())
|
8 |
+
->loadByCustomer(Mage:: getSingleton('customer/session')->getCustomerId());
|
9 |
+
if ($customerQuote->getId() && $this->getQuoteId() != $customerQuote->getId()) {
|
10 |
+
foreach ($customerQuote->getAllItems() as $item) {
|
11 |
+
$item->isDeleted(true);
|
12 |
+
if ($item->getHasChildren()) {
|
13 |
+
foreach ($item->getChildren() as $child) {
|
14 |
+
$child->isDeleted(true);
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
18 |
+
$customerQuote->collectTotals()->save();
|
19 |
+
}
|
20 |
+
else {
|
21 |
+
$this->getQuote()->getBillingAddress();
|
22 |
+
$this->getQuote()->getShippingAddress();
|
23 |
+
$this->getQuote()->setCustomer(Mage:: getSingleton('customer/session')->getCustomer())
|
24 |
+
->setTotalsCollectedFlag(false)->collectTotals()->save();
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/local/Sekurme/Clearoldcartproducts/etc/config.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version = "1.0" ?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme_Clearoldcartproducts>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Sekurme_Clearoldcartproducts>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<events>
|
10 |
+
<sales_quote_merge_before>
|
11 |
+
<observers>
|
12 |
+
<sekurme_clearoldcartproducts_observer>
|
13 |
+
<type>singleton</type>
|
14 |
+
<class>Sekurme_Clearoldcartproducts_Model_Observer</class>
|
15 |
+
<method>loadCustomerQuote</method>
|
16 |
+
</sekurme_clearoldcartproducts_observer>
|
17 |
+
</observers>
|
18 |
+
</sales_quote_merge_before>
|
19 |
+
</events>
|
20 |
+
</global>
|
21 |
+
</config>
|
22 |
+
|
app/code/local/Sekurme/Shippingdestination/Model/Observer.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by SEKUR.me
|
5 |
+
* http://www.sekur.me
|
6 |
+
**/
|
7 |
+
class Sekurme_Shippingdestination_Model_Observer {
|
8 |
+
public function handleCollect($observer) {
|
9 |
+
if (!Mage::getStoreConfig('shipping/origin/applydefaultstoemptyquote'))
|
10 |
+
return $this;
|
11 |
+
|
12 |
+
$quote = $observer->getEvent()->getQuote();
|
13 |
+
$shippingAddress = $quote->getShippingAddress();
|
14 |
+
$billingAddress = $quote->getBillingAddress();
|
15 |
+
$saveQuote = false;
|
16 |
+
if (!$shippingAddress->getCountryId()) {
|
17 |
+
$country = Mage::getStoreConfig('shipping/origin/country_id');
|
18 |
+
$state = Mage::getStoreConfig('shipping/origin/region_id');
|
19 |
+
$postcode = Mage::getStoreConfig('shipping/origin/postcode');
|
20 |
+
$method = Mage::getStoreConfig('shipping/origin/shippingmethod');
|
21 |
+
|
22 |
+
$shippingAddress
|
23 |
+
->setCountryId($country)
|
24 |
+
->setRegionId($state)
|
25 |
+
->setPostcode($postcode)
|
26 |
+
->setShippingMethod($method)
|
27 |
+
->setCollectShippingRates(true);
|
28 |
+
$shippingAddress->save();
|
29 |
+
|
30 |
+
$saveQuote = true;
|
31 |
+
}
|
32 |
+
if (Mage::getStoreConfig('shipping/origin/applydefaultstobillingaddress') && !$billingAddress->getCountryId()) {
|
33 |
+
$country = Mage::getStoreConfig('shipping/origin/country_id');
|
34 |
+
$state = Mage::getStoreConfig('shipping/origin/region_id');
|
35 |
+
$postcode = Mage::getStoreConfig('shipping/origin/postcode');
|
36 |
+
|
37 |
+
$billingAddress
|
38 |
+
->setCountryId($country)
|
39 |
+
->setRegionId($state)
|
40 |
+
->setPostcode($postcode);
|
41 |
+
|
42 |
+
$saveQuote = true;
|
43 |
+
|
44 |
+
$quote->save();
|
45 |
+
}
|
46 |
+
if ($saveQuote)
|
47 |
+
$quote->save();
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
}
|
app/code/local/Sekurme/Shippingdestination/etc/config.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme_Shippingdestination>
|
5 |
+
<version>1.3.0</version>
|
6 |
+
</Sekurme_Shippingdestination>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<shippingdestination>
|
11 |
+
<class>Sekurme_Shippingdestination_Model</class>
|
12 |
+
</shippingdestination>
|
13 |
+
</models>
|
14 |
+
<events>
|
15 |
+
<sales_quote_collect_totals_before>
|
16 |
+
<observers>
|
17 |
+
<sekurme_shippingdestination>
|
18 |
+
<class>shippingdestination/observer</class>
|
19 |
+
<method>handleCollect</method>
|
20 |
+
</sekurme_shippingdestination>
|
21 |
+
</observers>
|
22 |
+
</sales_quote_collect_totals_before>
|
23 |
+
</events>
|
24 |
+
</global>
|
25 |
+
</config>
|
app/code/local/Sekurme/Shippingdestination/etc/system.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<shipping>
|
5 |
+
<groups>
|
6 |
+
<origin translate="label">
|
7 |
+
<fields>
|
8 |
+
<applydefaultstoemptyquote translate="label">
|
9 |
+
<label>Apply defaults to empty quote</label>
|
10 |
+
<frontend_type>select</frontend_type>
|
11 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
12 |
+
<sort_order>100</sort_order>
|
13 |
+
<show_in_default>1</show_in_default>
|
14 |
+
<show_in_website>1</show_in_website>
|
15 |
+
<show_in_store>1</show_in_store>
|
16 |
+
</applydefaultstoemptyquote>
|
17 |
+
<applydefaultstobillingaddress translate="label">
|
18 |
+
<label>Apply defaults to billing address</label>
|
19 |
+
<frontend_type>select</frontend_type>
|
20 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
21 |
+
<sort_order>101</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
</applydefaultstobillingaddress>
|
26 |
+
<shippingmethod>
|
27 |
+
<label>Default shipping method</label>
|
28 |
+
<frontend_type>select</frontend_type>
|
29 |
+
<source_model>adminhtml/system_config_source_shipping_allmethods</source_model>
|
30 |
+
<sort_order>110</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</shippingmethod>
|
35 |
+
</fields>
|
36 |
+
</origin>
|
37 |
+
</groups>
|
38 |
+
</shipping>
|
39 |
+
</sections>
|
40 |
+
</config>
|
41 |
+
|
app/code/local/Sekurme/Shopping/controllers/Checkout/CartController.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SEKUR.me Payment Module
|
4 |
+
* Created by SEKUR.me
|
5 |
+
* http://www.sekur.me
|
6 |
+
**/
|
7 |
+
require_once 'Mage/Checkout/controllers/CartController.php';
|
8 |
+
class Sekurme_Shopping_Checkout_CartController extends Mage_Checkout_CartController
|
9 |
+
{
|
10 |
+
|
11 |
+
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
$cart = $this->_getCart();
|
15 |
+
|
16 |
+
|
17 |
+
if ($cart->getQuote()->getItemsCount()) {
|
18 |
+
$cart->init();
|
19 |
+
$cart->save();
|
20 |
+
|
21 |
+
if (!$this->_getQuote()->validateMinimumAmount()) {
|
22 |
+
$warning = Mage::getStoreConfig('sales/minimum_order/description');
|
23 |
+
$cart->getCheckoutSession()->addNotice($warning);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
// Compose array of messages to add
|
28 |
+
$messages = array();
|
29 |
+
foreach ($cart->getQuote()->getMessages() as $message) {
|
30 |
+
if ($message) {
|
31 |
+
$messages[] = $message;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
$cart->getCheckoutSession()->addUniqueMessages($messages);
|
35 |
+
|
36 |
+
/**
|
37 |
+
* if customer enteres shopping cart we should mark quote
|
38 |
+
* as modified bc he can has checkout page in another window.
|
39 |
+
*/
|
40 |
+
$this->_getSession()->setCartWasUpdated(true);
|
41 |
+
|
42 |
+
Varien_Profiler::start(__METHOD__ . 'cart_display');
|
43 |
+
$this
|
44 |
+
->loadLayout()
|
45 |
+
->_initLayoutMessages('checkout/session')
|
46 |
+
->_initLayoutMessages('catalog/session')
|
47 |
+
->getLayout()->getBlock('head')->setTitle($this->__('Shopping Cart'));
|
48 |
+
$this->renderLayout();
|
49 |
+
|
50 |
+
Varien_Profiler::stop(__METHOD__ . 'cart_display');
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
/* Initialize shipping information
|
57 |
+
*/
|
58 |
+
public function estimatePostAction()
|
59 |
+
{
|
60 |
+
|
61 |
+
$country = (string) $this->getRequest()->getParam('country_id');
|
62 |
+
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
|
63 |
+
$regionId = (string) $this->getRequest()->getParam('region_id');
|
64 |
+
|
65 |
+
if(empty($regionId)){
|
66 |
+
|
67 |
+
$regionInfo = "SELECT * FROM tax_calculation_rate WHERE tax_postcode='".$postcode."*'";
|
68 |
+
|
69 |
+
$regionVal = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($regionInfo);
|
70 |
+
|
71 |
+
if(!empty($regionVal['0']['tax_region_id']))
|
72 |
+
{
|
73 |
+
$regionId = $regionVal['0']['tax_region_id'];
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
$city = (string) $this->getRequest()->getParam('estimate_city');
|
78 |
+
|
79 |
+
$region = (string) $this->getRequest()->getParam('region');
|
80 |
+
|
81 |
+
$this->_getQuote()->getShippingAddress()
|
82 |
+
->setCountryId($country)
|
83 |
+
->setCity($city)
|
84 |
+
->setPostcode($postcode)
|
85 |
+
->setRegionId($regionId)
|
86 |
+
->setRegion($region)
|
87 |
+
->setCollectShippingRates(true);
|
88 |
+
$this->_getQuote()->save();
|
89 |
+
|
90 |
+
$this->estimateUpdatePostAction();
|
91 |
+
|
92 |
+
$this->_goBack();
|
93 |
+
}
|
94 |
+
|
95 |
+
/*
|
96 |
+
**true, display
|
97 |
+
**false, don't display
|
98 |
+
**/
|
99 |
+
public function isDisplayMsg()
|
100 |
+
{
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
|
104 |
+
public function estimateUpdatePostAction()
|
105 |
+
{
|
106 |
+
$code = (string) $this->getRequest()->getParam('estimate_method');
|
107 |
+
|
108 |
+
if (!empty($code)) {
|
109 |
+
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
|
110 |
+
}else{
|
111 |
+
|
112 |
+
$shippingQuote = Mage::getSingleton('checkout/session')->getQuote();
|
113 |
+
$shippingAddress = $shippingQuote->getShippingAddress();
|
114 |
+
//Find if our shipping has been included.
|
115 |
+
//$rates = $shippingAddress->collectShippingRates()->getGroupedAllShippingRates();
|
116 |
+
$rates = $shippingAddress->getGroupedAllShippingRates();
|
117 |
+
|
118 |
+
$qualifies = false;
|
119 |
+
|
120 |
+
foreach ($rates as $carrier) {
|
121 |
+
foreach ($carrier as $rate) {
|
122 |
+
$shipDetail[] = array('code'=>$rate->getCode(), 'price'=>$rate->getPrice());
|
123 |
+
//print_r($rate->getData());
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
//$shippingInfo = min($shipDetail);
|
129 |
+
|
130 |
+
$minVal = PHP_INT_MAX;
|
131 |
+
$maxVal = 0;
|
132 |
+
foreach ($shipDetail as $shipArray) {
|
133 |
+
$minVal = min($minVal, $shipArray['price']);
|
134 |
+
$maxVal = max($maxVal, $shipArray['price']);
|
135 |
+
}
|
136 |
+
|
137 |
+
$shippingPrice = $minVal;
|
138 |
+
|
139 |
+
foreach ($shipDetail as $inner) {
|
140 |
+
if ($inner['price'] == $minVal) {
|
141 |
+
$result = $inner['code'];
|
142 |
+
// or to get the whole inner array:
|
143 |
+
// $result = $inner;
|
144 |
+
break;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
$shippingMethod = $result;
|
149 |
+
|
150 |
+
$this->_getQuote()->getShippingAddress()->setShippingAmount($shippingPrice);
|
151 |
+
$this->_getQuote()->getShippingAddress()->setBaseShippingAmount($shippingPrice);
|
152 |
+
$this->_getQuote()->getShippingAddress()->setShippingMethod($shippingMethod)/*->collectTotals()*/->save();
|
153 |
+
|
154 |
+
Mage::getSingleton('checkout/session')->resetCheckout();
|
155 |
+
|
156 |
+
}
|
157 |
+
$this->_goBack();
|
158 |
+
}
|
159 |
+
}
|
160 |
+
?>
|
app/code/local/Sekurme/Shopping/etc/config.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme_Shopping>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Sekurme_Shopping>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<rewrite>
|
10 |
+
<sekurme_shopping_checkout_cart>
|
11 |
+
<from><![CDATA[#^/checkout/cart/#]]></from>
|
12 |
+
<to>/shopping/checkout_cart/</to>
|
13 |
+
</sekurme_shopping_checkout_cart>
|
14 |
+
</rewrite>
|
15 |
+
</global>
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<sekurme_shopping>
|
19 |
+
<use>standard</use>
|
20 |
+
<args>
|
21 |
+
<module>Sekurme_Shopping</module>
|
22 |
+
<frontName>shopping</frontName>
|
23 |
+
</args>
|
24 |
+
</sekurme_shopping>
|
25 |
+
</routers>
|
26 |
+
</frontend>
|
27 |
+
</config>
|
app/design/frontend/base/default/template/checkout/cart/shipping.phtml
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
|
28 |
+
<?php /** @var $this Mage_Checkout_Block_Cart_Shipping */ ?>
|
29 |
+
<div class="shipping">
|
30 |
+
<h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
|
31 |
+
<div class="shipping-form">
|
32 |
+
<form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
|
33 |
+
<p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
|
34 |
+
<ul class="form-list">
|
35 |
+
<li>
|
36 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
37 |
+
<div class="input-box">
|
38 |
+
<?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
|
39 |
+
</div>
|
40 |
+
</li>
|
41 |
+
<?php //if($this->getStateActive()): ?>
|
42 |
+
<li>
|
43 |
+
<label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
|
44 |
+
<div class="input-box">
|
45 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
|
46 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
47 |
+
</select>
|
48 |
+
<script type="text/javascript">
|
49 |
+
//<![CDATA[
|
50 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
|
51 |
+
//]]>
|
52 |
+
</script>
|
53 |
+
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getEstimateRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
|
54 |
+
</div>
|
55 |
+
</li>
|
56 |
+
<?php //endif; ?>
|
57 |
+
<?php if($this->getCityActive()): ?>
|
58 |
+
<li>
|
59 |
+
<label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
|
60 |
+
<div class="input-box">
|
61 |
+
<input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->escapeHtml($this->getEstimateCity()) ?>" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<?php endif; ?>
|
65 |
+
<li>
|
66 |
+
<label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
|
67 |
+
<div class="input-box">
|
68 |
+
<input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" onblur="coShippingMethodForm.submit();" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />
|
69 |
+
</div>
|
70 |
+
</li>
|
71 |
+
</ul>
|
72 |
+
<div class="buttons-set">
|
73 |
+
<button type="button" title="<?php echo $this->__('Get a Quote') ?>" onclick="coShippingMethodForm.submit()" class="button"><span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
|
74 |
+
</div>
|
75 |
+
</form>
|
76 |
+
<script type="text/javascript">
|
77 |
+
//<![CDATA[
|
78 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
|
79 |
+
//]]>
|
80 |
+
</script>
|
81 |
+
|
82 |
+
<?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
|
83 |
+
<form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
|
84 |
+
<dl class="sp-methods">
|
85 |
+
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
|
86 |
+
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
|
87 |
+
<dd>
|
88 |
+
<ul>
|
89 |
+
<?php foreach ($_rates as $_rate): ?>
|
90 |
+
<li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
|
91 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
92 |
+
<?php echo $this->escapeHtml($_rate->getErrorMessage()) ?>
|
93 |
+
<?php else: ?>
|
94 |
+
<input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
|
95 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
|
96 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
97 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
98 |
+
<?php echo $_excl; ?>
|
99 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
100 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
101 |
+
<?php endif; ?>
|
102 |
+
</label>
|
103 |
+
<?php endif ?>
|
104 |
+
</li>
|
105 |
+
<?php endforeach; ?>
|
106 |
+
</ul>
|
107 |
+
</dd>
|
108 |
+
<?php endforeach; ?>
|
109 |
+
</dl>
|
110 |
+
<div class="buttons-set">
|
111 |
+
<button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do" value="<?php echo $this->__('Update Total') ?>"><span><span><?php echo $this->__('Update Total') ?></span></span></button>
|
112 |
+
</div>
|
113 |
+
</form>
|
114 |
+
<?php endif; ?>
|
115 |
+
<script type="text/javascript">
|
116 |
+
//<![CDATA[
|
117 |
+
var coShippingMethodForm = new VarienForm('shipping-zip-form');
|
118 |
+
var coShippingMethodFormList = new VarienForm('co-shipping-method-form');
|
119 |
+
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
|
120 |
+
|
121 |
+
coShippingMethodForm.submit = function () {
|
122 |
+
|
123 |
+
var country = $F('country');
|
124 |
+
var optionalZip = false;
|
125 |
+
|
126 |
+
for (i=0; i < countriesWithOptionalZip.length; i++) {
|
127 |
+
if (countriesWithOptionalZip[i] == country) {
|
128 |
+
optionalZip = true;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
if (optionalZip) {
|
132 |
+
$('postcode').removeClassName('required-entry');
|
133 |
+
}
|
134 |
+
else {
|
135 |
+
$('postcode').addClassName('required-entry');
|
136 |
+
}
|
137 |
+
VarienForm.prototype.submit.bind(coShippingMethodFormList)();
|
138 |
+
return VarienForm.prototype.submit.bind(coShippingMethodForm)();
|
139 |
+
|
140 |
+
}
|
141 |
+
//]]>
|
142 |
+
</script>
|
143 |
+
</div>
|
144 |
+
</div>
|
app/design/frontend/base/default/template/page/html/head.phtml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
|
28 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
29 |
+
<meta http-equiv="X-Frame-Options" content="ALLOWALL">
|
30 |
+
<title><?php echo $this->getTitle() ?></title>
|
31 |
+
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
|
32 |
+
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
|
33 |
+
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
|
34 |
+
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
|
35 |
+
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
|
36 |
+
|
37 |
+
|
38 |
+
<!--[if lt IE 7]>
|
39 |
+
<script type="text/javascript">
|
40 |
+
//<![CDATA[
|
41 |
+
var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
|
42 |
+
var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
|
43 |
+
//]]>
|
44 |
+
</script>
|
45 |
+
<![endif]-->
|
46 |
+
<script src="<?php echo $this->getSkinUrl('js/jquery.xdomainrequest.min.js'); ?>" type="text/javascript"></script>
|
47 |
+
<?php echo $this->getCssJsHtml() ?>
|
48 |
+
<?php echo $this->getChildHtml() ?>
|
49 |
+
<?php echo $this->helper('core/js')->getTranslatorScript() ?>
|
50 |
+
<?php echo $this->getIncludes() ?>
|
app/design/frontend/default/default/layout/sekurme.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<checkout_cart_index>
|
3 |
+
<reference name="checkout.cart.top_methods">
|
4 |
+
<!--<block type="sekurme/general_shortcut" template="sekurme/shortcut/shortcuttop.phtml" before="-" name="sekurme_shortcut_topo" />-->
|
5 |
+
</reference>
|
6 |
+
|
7 |
+
<reference name="checkout.cart.methods">
|
8 |
+
<block type="sekurme/general_shortcut" template="sekurme/shortcut/shortcutmid.phtml" before="-" name="sekurme_shortcut_base" />
|
9 |
+
</reference>
|
10 |
+
|
11 |
+
<reference name="checkout.cart.shipping">
|
12 |
+
<block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
|
13 |
+
</reference>
|
14 |
+
|
15 |
+
</checkout_cart_index>
|
16 |
+
</layout>
|
17 |
+
|
app/design/frontend/default/default/layout/shopping.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<sekurme_shopping_checkout_cart_index>
|
3 |
+
<update handle="checkout_cart_index"/>
|
4 |
+
</sekurme_shopping_checkout_cart_index>
|
5 |
+
</layout>
|
6 |
+
|
app/design/frontend/default/default/template/checkout/shipping.phtml
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
|
28 |
+
<?php /** @var $this Mage_Checkout_Block_Cart_Shipping */ ?>
|
29 |
+
<div class="shipping">
|
30 |
+
<h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
|
31 |
+
<div class="shipping-form">
|
32 |
+
<form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
|
33 |
+
<p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
|
34 |
+
<ul class="form-list">
|
35 |
+
<li>
|
36 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
37 |
+
<div class="input-box">
|
38 |
+
<?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
|
39 |
+
</div>
|
40 |
+
</li>
|
41 |
+
<?php //if($this->getStateActive()): ?>
|
42 |
+
<li>
|
43 |
+
<label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
|
44 |
+
<div class="input-box">
|
45 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
|
46 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
47 |
+
</select>
|
48 |
+
<script type="text/javascript">
|
49 |
+
//<![CDATA[
|
50 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
|
51 |
+
//]]>
|
52 |
+
</script>
|
53 |
+
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getEstimateRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
|
54 |
+
</div>
|
55 |
+
</li>
|
56 |
+
<?php //endif; ?>
|
57 |
+
<?php if($this->getCityActive()): ?>
|
58 |
+
<li>
|
59 |
+
<label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
|
60 |
+
<div class="input-box">
|
61 |
+
<input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->escapeHtml($this->getEstimateCity()) ?>" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<?php endif; ?>
|
65 |
+
<li>
|
66 |
+
<label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
|
67 |
+
<div class="input-box">
|
68 |
+
<input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" onblur="coShippingMethodForm.submit();" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />
|
69 |
+
</div>
|
70 |
+
</li>
|
71 |
+
</ul>
|
72 |
+
<div class="buttons-set">
|
73 |
+
<button type="button" title="<?php echo $this->__('Get a Quote') ?>" onclick="coShippingMethodForm.submit()" class="button"><span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
|
74 |
+
</div>
|
75 |
+
</form>
|
76 |
+
<script type="text/javascript">
|
77 |
+
//<![CDATA[
|
78 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
|
79 |
+
//]]>
|
80 |
+
</script>
|
81 |
+
|
82 |
+
<?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
|
83 |
+
<form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
|
84 |
+
<dl class="sp-methods">
|
85 |
+
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
|
86 |
+
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
|
87 |
+
<dd>
|
88 |
+
<ul>
|
89 |
+
<?php foreach ($_rates as $_rate): ?>
|
90 |
+
<li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
|
91 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
92 |
+
<?php echo $this->escapeHtml($_rate->getErrorMessage()) ?>
|
93 |
+
<?php else: ?>
|
94 |
+
<input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
|
95 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
|
96 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
97 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
98 |
+
<?php echo $_excl; ?>
|
99 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
100 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
101 |
+
<?php endif; ?>
|
102 |
+
</label>
|
103 |
+
<?php endif ?>
|
104 |
+
</li>
|
105 |
+
<?php endforeach; ?>
|
106 |
+
</ul>
|
107 |
+
</dd>
|
108 |
+
<?php endforeach; ?>
|
109 |
+
</dl>
|
110 |
+
<div class="buttons-set">
|
111 |
+
<button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do" value="<?php echo $this->__('Update Total') ?>"><span><span><?php echo $this->__('Update Total') ?></span></span></button>
|
112 |
+
</div>
|
113 |
+
</form>
|
114 |
+
<?php endif; ?>
|
115 |
+
<script type="text/javascript">
|
116 |
+
//<![CDATA[
|
117 |
+
var coShippingMethodForm = new VarienForm('shipping-zip-form');
|
118 |
+
var coShippingMethodFormList = new VarienForm('co-shipping-method-form');
|
119 |
+
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
|
120 |
+
|
121 |
+
coShippingMethodForm.submit = function () {
|
122 |
+
|
123 |
+
var country = $F('country');
|
124 |
+
var optionalZip = false;
|
125 |
+
|
126 |
+
for (i=0; i < countriesWithOptionalZip.length; i++) {
|
127 |
+
if (countriesWithOptionalZip[i] == country) {
|
128 |
+
optionalZip = true;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
if (optionalZip) {
|
132 |
+
$('postcode').removeClassName('required-entry');
|
133 |
+
}
|
134 |
+
else {
|
135 |
+
$('postcode').addClassName('required-entry');
|
136 |
+
}
|
137 |
+
VarienForm.prototype.submit.bind(coShippingMethodFormList)();
|
138 |
+
return VarienForm.prototype.submit.bind(coShippingMethodForm)();
|
139 |
+
|
140 |
+
}
|
141 |
+
//]]>
|
142 |
+
</script>
|
143 |
+
</div>
|
144 |
+
</div>
|
app/design/frontend/default/default/template/sales/order/info.phtml
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php /** @var $this Mage_Sales_Block_Order_Info */ ?>
|
28 |
+
<?php $_order = $this->getOrder() ?>
|
29 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
30 |
+
<div class="page-title title-buttons">
|
31 |
+
<h1><?php echo $this->__('Order #%s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h1>
|
32 |
+
<?php echo $this->getChildHtml('buttons') ?>
|
33 |
+
</div>
|
34 |
+
<?php echo $this->getStatusHistoryRssUrl($_order) ?>
|
35 |
+
<dl class="order-info">
|
36 |
+
<dt><?php echo $this->__('About This Order:') ?></dt>
|
37 |
+
<dd>
|
38 |
+
<?php $_links = $this->getLinks(); ?>
|
39 |
+
<ul id="order-info-tabs">
|
40 |
+
<?php foreach ($_links as $_link): ?>
|
41 |
+
<?php if($_link->getUrl()): ?>
|
42 |
+
<li><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
|
43 |
+
<?php else: ?>
|
44 |
+
<li class="current"><?php echo $_link->getLabel() ?></li>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php endforeach; ?>
|
47 |
+
</ul>
|
48 |
+
<script type="text/javascript">decorateGeneric($('order-info-tabs').select('LI'),['first','last']);</script>
|
49 |
+
</dd>
|
50 |
+
</dl>
|
51 |
+
<p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
|
52 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
53 |
+
<div class="col2-set order-info-box">
|
54 |
+
<div class="col-1">
|
55 |
+
<div class="box">
|
56 |
+
<div class="box-title">
|
57 |
+
<h2><?php echo $this->__('Shipping Address') ?></h2>
|
58 |
+
</div>
|
59 |
+
<div class="box-content">
|
60 |
+
<address><?php echo $_order->getShippingAddress()->format('html') ?></address>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
<div class="col-2">
|
65 |
+
<div class="box">
|
66 |
+
<div class="box-title">
|
67 |
+
<h2><?php echo $this->__('Shipping Method') ?></h2>
|
68 |
+
</div>
|
69 |
+
<div class="box-content">
|
70 |
+
<?php if ($_order->getShippingDescription()): ?>
|
71 |
+
<?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
|
72 |
+
<?php else: ?>
|
73 |
+
<p><?php echo $this->helper('sales')->__('No shipping information available'); ?></p>
|
74 |
+
<?php endif; ?>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
<?php endif; ?>
|
80 |
+
<div class="col2-set order-info-box">
|
81 |
+
<div class="col-1">
|
82 |
+
<div class="box">
|
83 |
+
<div class="box-title">
|
84 |
+
<h2><?php echo $this->__('Billing Address') ?></h2>
|
85 |
+
</div>
|
86 |
+
<div class="box-content">
|
87 |
+
<address><?php echo $_order->getBillingAddress()->format('html') ?></address>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
<div class="col-2">
|
92 |
+
<div class="box box-payment">
|
93 |
+
<div class="box-title">
|
94 |
+
<h2><?php echo $this->__('Payment Method') ?></h2>
|
95 |
+
</div>
|
96 |
+
<div class="box-content">
|
97 |
+
<?php echo $this->getPaymentInfoHtml() ?>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
</div>
|
app/design/frontend/default/default/template/sekurme/shortcut/failed.phtml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style>
|
2 |
+
.error-msg-sekur{line-height:20px;color:#ff0000;}
|
3 |
+
.payment-name{font-size:16px;}
|
4 |
+
</style>
|
5 |
+
<script type="text/javascript">
|
6 |
+
window.onload=function() {
|
7 |
+
function countdown() {
|
8 |
+
if ( typeof countdown.counter == 'undefined' ) {
|
9 |
+
countdown.counter = 5; // initial count
|
10 |
+
}
|
11 |
+
if(countdown.counter > 0) {
|
12 |
+
document.getElementById('count').innerHTML = countdown.counter--;
|
13 |
+
setTimeout(countdown, 1000);
|
14 |
+
}
|
15 |
+
else {
|
16 |
+
location.href = '<?php echo Mage::getUrl("checkout/cart") ?>';
|
17 |
+
}
|
18 |
+
}
|
19 |
+
countdown();
|
20 |
+
};
|
21 |
+
</script>
|
22 |
+
<?php
|
23 |
+
$standard = Mage::getModel('sekurme/express');
|
24 |
+
?>
|
25 |
+
<h1 class="payment-name"><?php echo $this->__('SEKURME_LABEL_1'); ?></h1>
|
26 |
+
|
27 |
+
<div><?php echo $this->__('SEKURME_LABEL_7'); ?>
|
28 |
+
<?php
|
29 |
+
if (Mage::registry('payment_error') != "") {
|
30 |
+
if ((Mage::registry('payment_error') == "bank") || (Mage::registry('payment_error') == "order_error")) {
|
31 |
+
?>
|
32 |
+
<p>
|
33 |
+
<?php echo Mage::registry('code'); ?>
|
34 |
+
</p>
|
35 |
+
<p class="error-msg-sekur">
|
36 |
+
<?php echo Mage::registry('desc'); ?>
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
</p>
|
42 |
+
<p><h2>You will be redirected to the shopping cart page in <span id="count"></span> seconds</h2></p>
|
43 |
+
</div>
|
app/design/frontend/default/default/template/sekurme/shortcut/shortcutmid.phtml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//
|
3 |
+
// Load the Sekurme online object
|
4 |
+
//
|
5 |
+
$standard = Mage::getModel('sekurme/express');
|
6 |
+
$subtitle = Mage::getStoreConfig('payment/sekurme/subtitle');
|
7 |
+
$sekurmeConfigURL = htmlspecialchars(Mage::getStoreConfig('payment/sekurme/sekurmeurl'));
|
8 |
+
?>
|
9 |
+
<script src="<?php echo $sekurmeConfigURL; ?>Scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
|
10 |
+
<script src="<?php echo $sekurmeConfigURL; ?>Scripts/SekurMe.js" type="text/javascript"></script>
|
11 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $sekurmeConfigURL; ?>Styles/SekurMePopup.css" />
|
12 |
+
|
13 |
+
<script type="text/javascript">
|
14 |
+
|
15 |
+
// Alert message
|
16 |
+
function validateQuoteForm(){
|
17 |
+
var postcode = document.getElementById("postcode");
|
18 |
+
var region_id = document.getElementById("region_id");
|
19 |
+
/*if(postcode.value == "" )
|
20 |
+
{
|
21 |
+
alert( "Please enter your zip/postal code to complete your order with SEKUR.me Express Checkout." );
|
22 |
+
postcode.style.border = "solid 1px red";
|
23 |
+
region_id.style.border = "solid 1px red";
|
24 |
+
postcode.style.background = "white";
|
25 |
+
postcode.focus();
|
26 |
+
|
27 |
+
return false;
|
28 |
+
} */
|
29 |
+
return( true );
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
</script>
|
34 |
+
<?php
|
35 |
+
//
|
36 |
+
// Initialize the payment
|
37 |
+
//
|
38 |
+
$Url = $standard->initalize();
|
39 |
+
|
40 |
+
$values = explode(" ", strip_tags($Url));
|
41 |
+
$errorCode = trim(strip_tags($values["2"]));
|
42 |
+
|
43 |
+
switch ($errorCode) {
|
44 |
+
case 1:
|
45 |
+
$message = "CompanyID Error";
|
46 |
+
break;
|
47 |
+
case 2:
|
48 |
+
$message = "StoreID Error";
|
49 |
+
break;
|
50 |
+
case 4:
|
51 |
+
$message = "Bad Authorization Status";
|
52 |
+
break;
|
53 |
+
case 5:
|
54 |
+
$message = "Store Authorization Error";
|
55 |
+
break;
|
56 |
+
case 6:
|
57 |
+
$message = "SekurAction � Unsupported Action";
|
58 |
+
break;
|
59 |
+
case 7:
|
60 |
+
$message = "Invalid Amount";
|
61 |
+
break;
|
62 |
+
case 8:
|
63 |
+
$message = "Invalid or Empty UserID";
|
64 |
+
break;
|
65 |
+
case 9:
|
66 |
+
$message = "Invalid Transaction ID";
|
67 |
+
break;
|
68 |
+
case 1000:
|
69 |
+
$message = "General Error";
|
70 |
+
break;
|
71 |
+
default:
|
72 |
+
$message = "Unknown error";
|
73 |
+
break;
|
74 |
+
}
|
75 |
+
?>
|
76 |
+
|
77 |
+
|
78 |
+
<?php
|
79 |
+
if ($this->getAllowedCart() == 1){
|
80 |
+
|
81 |
+
if($errorCode == 0){
|
82 |
+
|
83 |
+
?>
|
84 |
+
<div style="vertical-align: top; margin-top: 0px;" class="sekurme-panel">
|
85 |
+
<div id="sekurMeDiv"></div>
|
86 |
+
<script>
|
87 |
+
var tssidValue = '<?php echo trim(strip_tags($values["6"])); ?>';
|
88 |
+
var etxnIdValue = '<?php echo trim(strip_tags($values["8"])); ?>';
|
89 |
+
var qrUrl = '<?php echo trim(strip_tags($values["4"])); ?>';
|
90 |
+
var buttonType = "expresspay";
|
91 |
+
SekurMe.configure("sekurMeDiv", tssidValue, etxnIdValue, qrUrl, buttonType,validateQuoteForm);
|
92 |
+
</script>
|
93 |
+
</div>
|
94 |
+
<div style="float:left; font-size:12px;padding:5px 0px 5px 0px;"><?php echo $subtitle; ?></div>
|
95 |
+
<div> </div>
|
96 |
+
|
97 |
+
<?php }else{ ?>
|
98 |
+
<div>SEKUR.me express checkout payment services are currently unavailable! Error message code - "<?php echo $errorCode; ?>"!</div>
|
99 |
+
<?php } ?>
|
100 |
+
|
101 |
+
<?php }; ?>
|
102 |
+
|
app/etc/modules/Sekurme.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Paygate/>
|
9 |
+
<Mage_Checkout/>
|
10 |
+
<Mage_Sales/>
|
11 |
+
</depends>
|
12 |
+
</Sekurme>
|
13 |
+
</modules>
|
14 |
+
</config>
|
app/etc/modules/Sekurme_Clearoldcartproducts.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme_Clearoldcartproducts>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Sekurme_Clearoldcartproducts>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Sekurme_Shippingdestination.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme_Shippingdestination>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Sekurme_Shippingdestination>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Sekurme_Shopping.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sekurme_Shopping>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Sekurme_Shopping>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/Mage_Sekurme.csv
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
SEKURME_LABEL_1,Express Checkout with SEKUR.me
|
2 |
+
SEKURME_LABEL_2,Online payment with available payment methods processed by SEKUR.me
|
3 |
+
SEKURME_LABEL_3,The payment was <b>not</b> approved by SEKUR.me.<br><br>The payment was rejected with errorcode:
|
4 |
+
SEKURME_LABEL_4,SEKUR.me payment information
|
5 |
+
SEKURME_LABEL_5,Transaction number:
|
6 |
+
SEKURME_LABEL_6,Payment date:
|
7 |
+
SEKURME_LABEL_7,There is not registered any payment for this order yet!
|
8 |
+
SEKURME_LABEL_8,http://www.sekur.me
|
9 |
+
SEKURME_LABEL_9,Visit SEKUR.me Website
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Express_Checkout_with_sekurme</name>
|
4 |
+
<version>1.0.0.7</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>1-Click Mobile Web Payments for mobile enabled m-Commerce.</summary>
|
10 |
+
<description>1-Click Mobile Web Payments for mobile enabled m-Commerce.</description>
|
11 |
+
<notes>1-Click Mobile Web Payments for mobile enabled mCommerce. Patented QR Payments for eCommerce checkout.</notes>
|
12 |
+
<authors><author><name>Sekur.me</name><user>Jack</user><email>jack@septium.com</email></author></authors>
|
13 |
+
<date>2014-09-11</date>
|
14 |
+
<time>07:54:03</time>
|
15 |
+
<contents><target name="magecommunity"><dir><dir name="Sekurme"><dir name="Block"><dir name="General"><file name="Failed.php" hash="e28afe5f7b53f2540d0177e7a4a7862c"/><file name="Shortcut.php" hash="bb4e91d255e567b7568db4b1fa0f6059"/></dir><file name="Shortcut.php" hash="ff0b40ae24e11c5d7c45fa00363c5aad"/></dir><dir name="Helper"><file name="Data.php" hash="277bf06cd12d611ab82b24499c7a6625"/></dir><dir name="Model"><file name="Express.php" hash="ef162b8e8dff1f7b00957cd8f34156e9"/><dir name="Mysql4"><file name="Setup.php" hash="855f77b6ef625f38ea7f353d493cad47"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Paymentaction.php" hash="26d02e2aabe091bc657777df42876b63"/><file name="Paymentmethod.php" hash="e4f8ed886faf8cd6a9d9cf5f94fe8b7c"/></dir></dir></dir></dir><dir name="controllers"><file name="SekurclientController.php" hash="61689d609c80f9b2a86e1de764225c29"/><file name="StandardController.php" hash="4cf10174c22dec3d683d75fcade495b2"/></dir><dir name="etc"><file name="config.xml" hash="9a11cb41344d4e2e70871a3191b787bd"/><file name="system.xml" hash="917057c06abca5aa73c506281a6eebfe"/></dir><dir name="sql"><dir name="sekurme_setup"><file name="mysql4-install-1.0.0.1.php" hash="f85d9f1ccba6c719b36f4b84346486cf"/></dir></dir></dir></dir></target><target name="magelocal"><dir><dir name="Sekurme"><dir name="Clearoldcartproducts"><dir name="Model"><file name="Observer.php" hash="5a63ddc0751ad8ef5193df6279183925"/></dir><dir name="etc"><file name="config.xml" hash="d6dfaf4ea13ff5367d68191e865a8918"/></dir></dir><dir name="Shippingdestination"><dir name="Model"><file name="Observer.php" hash="35afb8408931af38028f70a3f7e31de1"/></dir><dir name="etc"><file name="config.xml" hash="0eced4f122f7bd1209c5145d8e3cbb7c"/><file name="system.xml" hash="01c6b17a05967d7ff018977e43edc10a"/></dir></dir><dir name="Shopping"><dir name="controllers"><dir name="Checkout"><file name="CartController.php" hash="6e7caf8b836480b6f518540b7b8dcaab"/></dir></dir><dir name="etc"><file name="config.xml" hash="4a69c3024f49514e861fe4565155a52d"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Sekurme.xml" hash="0bf1dc5950e2ce3ed3f19634a22010ab"/><file name="Sekurme_Clearoldcartproducts.xml" hash="61f2f8c8a978eec285dca6926a2ce6e6"/><file name="Sekurme_Shippingdestination.xml" hash="4f87039d83b4bf70d8cf810ba6baf28d"/><file name="Sekurme_Shopping.xml" hash="9e8bca4abdf99e12ff1257c6b16482ed"/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="sekurme.xml" hash="c98ff11ecfe724b04376b084edd8607a"/><file name="shopping.xml" hash="2dbcf0f994e6b6380ae546f59dbd302b"/></dir><dir name="template"><dir name="checkout"><file name="shipping.phtml" hash="d83ba20378f330a1741436dc426483a9"/></dir><dir name="sales"><dir name="order"><file name="info.phtml" hash="f6b376d27ce8737ef78d35049bc77afa"/></dir></dir><dir name="sekurme"><dir name="shortcut"><file name="failed.phtml" hash="3de6407ed2764555a25505641b8abe81"/><file name="shortcutmid.phtml" hash="64d369a079b11065d61f8e0ca56fe948"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="page"><dir name="html"><file name="head.phtml" hash="157d7e8ce45629cd3d662ee6b9603a89"/></dir></dir><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="d83ba20378f330a1741436dc426483a9"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Mage_Sekurme.csv" hash="ac60a7cc23a8d82996dee10903ee9fb8"/></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><dir name="sekurme"><file name="Normal.jpg" hash="a8756291e0882f168a5f23f9bb006b26"/><file name="loading.gif" hash="6497a3e2e21faa7ff29f535a5f97502d"/><file name="sekurme_logo.png" hash="881a541638bd41d3542d85e136da5e3f"/></dir></dir></dir></dir></dir></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/default/default/images/sekurme/Normal.jpg
ADDED
Binary file
|
skin/frontend/default/default/images/sekurme/loading.gif
ADDED
Binary file
|
skin/frontend/default/default/images/sekurme/sekurme_logo.png
ADDED
Binary file
|