Checkout - Version 1.0.0.4

Version Notes

First preview release

Download this release

Release Info

Developer Sekur.me
Extension Checkout
Version 1.0.0.4
Comparing to
See all releases


Version 1.0.0.4

Files changed (36) hide show
  1. app/code/community/Sekurme/Block/General/Failed.php +16 -0
  2. app/code/community/Sekurme/Block/General/Shortcut.php +29 -0
  3. app/code/community/Sekurme/Block/Shortcut.php +31 -0
  4. app/code/community/Sekurme/Helper/Data.php +11 -0
  5. app/code/community/Sekurme/Model/Express.php +453 -0
  6. app/code/community/Sekurme/Model/Mysql4/Setup.php +12 -0
  7. app/code/community/Sekurme/Model/System/Config/Source/Paymentaction.php +20 -0
  8. app/code/community/Sekurme/Model/System/Config/Source/Paymentmethod.php +33 -0
  9. app/code/community/Sekurme/controllers/SekurclientController.php +383 -0
  10. app/code/community/Sekurme/controllers/StandardController.php +484 -0
  11. app/code/community/Sekurme/etc/config.xml +135 -0
  12. app/code/community/Sekurme/etc/system.xml +117 -0
  13. app/code/community/Sekurme/sql/sekurme_setup/mysql4-install-1.0.0.1.php +63 -0
  14. app/code/local/Sekurme/Clearoldcartproducts/Model/Observer.php +29 -0
  15. app/code/local/Sekurme/Clearoldcartproducts/etc/config.xml +22 -0
  16. app/code/local/Sekurme/Shippingdestination/Model/Observer.php +50 -0
  17. app/code/local/Sekurme/Shippingdestination/etc/config.xml +25 -0
  18. app/code/local/Sekurme/Shippingdestination/etc/system.xml +41 -0
  19. app/code/local/Sekurme/Shopping/controllers/Checkout/CartController.php +160 -0
  20. app/code/local/Sekurme/Shopping/etc/config.xml +27 -0
  21. app/design/frontend/base/default/template/checkout/cart/shipping.phtml +144 -0
  22. app/design/frontend/base/default/template/page/html/head.phtml +50 -0
  23. app/design/frontend/default/default/layout/sekurme.xml +17 -0
  24. app/design/frontend/default/default/layout/shopping.xml +6 -0
  25. app/design/frontend/default/default/template/checkout/cart/shipping.phtml +144 -0
  26. app/design/frontend/default/default/template/sekurme/shortcut/failed.phtml +43 -0
  27. app/design/frontend/default/default/template/sekurme/shortcut/shortcutmid.phtml +102 -0
  28. app/etc/modules/Sekurme.xml +14 -0
  29. app/etc/modules/Sekurme_Clearoldcartproducts.xml +9 -0
  30. app/etc/modules/Sekurme_Shippingdestination.xml +9 -0
  31. app/etc/modules/Sekurme_Shopping.xml +9 -0
  32. app/locale/en_US/Mage_Sekurme.csv +9 -0
  33. package.xml +19 -0
  34. skin/frontend/default/default/images/sekurme/Normal.jpg +0 -0
  35. skin/frontend/default/default/images/sekurme/loading.gif +0 -0
  36. 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,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ //Total Amount
344
+ $totalAmount = $this->getTotalAmount();
345
+
346
+ //Get the config data
347
+ $sekurmeurl = htmlspecialchars($this->getConfigData('sekurmeurl'))."MT/SekurServer_StartTransaction";
348
+ $companyID = htmlspecialchars($this->getConfigData('merchantnumber'));
349
+ $storeAuth = htmlspecialchars($this->getConfigData('md5key'));
350
+ $storeID = htmlspecialchars($this->getConfigData('storeid'));
351
+
352
+ $quote_id = time();
353
+
354
+ //echo $sekurmeurl;
355
+
356
+ $input_xml = '<SekurStartTransactionRequest>
357
+ <SekurAction>10</SekurAction>
358
+ <CompanyID>'.$companyID.'</CompanyID>
359
+ <StoreID>'.$storeID.'</StoreID>
360
+ <StoreAuth>'.$storeAuth.'</StoreAuth>
361
+ <Amount>'.$totalAmount.'</Amount>
362
+ <UserID/>
363
+ <EtxnId>'.$quote_id.'</EtxnId>
364
+ <BILL_PAY_1/>
365
+ <BILL_PAY_2/>
366
+ <BILL_PAY_3/>
367
+ <BILL_PAY_4/>
368
+ <BILL_PAY_5/>
369
+ <BILL_PAY_6/>
370
+ <BILL_PAY_7/>
371
+ <BILL_PAY_8/>
372
+ <BILL_PAY_9/>
373
+ </SekurStartTransactionRequest>
374
+ ';
375
+
376
+ $service_url = $sekurmeurl;
377
+
378
+ $curl = curl_init($service_url);
379
+
380
+ //echo '<pre>'; print_r($curl_post_data);
381
+
382
+ curl_setopt($curl, CURLOPT_URL,$service_url);
383
+ curl_setopt($curl, CURLOPT_VERBOSE, 1);
384
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
385
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
386
+ curl_setopt($curl, CURLOPT_POST, 1);
387
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
388
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
389
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $input_xml);
390
+ curl_setopt($curl, CURLOPT_TIMEOUT, 10);
391
+
392
+ $curl_response = curl_exec($curl);
393
+
394
+ if ($curl_response === false) {
395
+
396
+ $info = curl_getinfo($curl);
397
+
398
+ curl_close($curl);
399
+
400
+ //echo 'Error occured during connection with SEKUR.me server.';
401
+ }
402
+
403
+ curl_close($curl);
404
+
405
+ $resvalues = explode(" ", strip_tags($curl_response));
406
+
407
+ $errorCode = trim(strip_tags($resvalues["2"]));
408
+ $statusMsg = trim(strip_tags($resvalues["10"]));
409
+ $eTxnID = trim(strip_tags($resvalues["8"]));
410
+ $tssID = trim(strip_tags($resvalues["6"]));
411
+ $qr_URL = trim(strip_tags($resvalues["4"]));
412
+
413
+ $data = array(
414
+ 'id' => '',
415
+ 'eTxnID'=> "'".trim(strip_tags($resvalues["8"]))."'",
416
+ 'tssID' => "'".trim(strip_tags($resvalues["6"]))."'",
417
+ 'paymentAction' => "'".$this->getConfigData('paymentaction')."'",
418
+ 'status' => '0',
419
+ 'statusMessage' => "'".trim(strip_tags($resvalues["10"]))."'",
420
+ 'errorCode' => "'".trim(strip_tags($resvalues["2"]))."'",
421
+ 'qr_URL' => "'".trim(strip_tags($resvalues["4"]))."'",
422
+ 'date' => 'NOW()',
423
+ );
424
+
425
+
426
+ $query = "SELECT eTxnID FROM sekurmeorderstatus WHERE eTxnID=".$data[eTxnID];
427
+ $dataValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
428
+
429
+
430
+ if($dataValue['0']['eTxnID'] != $eTxnID){
431
+
432
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
433
+ $write->query("INSERT INTO sekurmeorderstatus (Id,eTxnID,tssID,companyID,storeID,customer_id,email_id,sekurID,cc_flat_id,
434
+ paymentAction,payStatus,transactionID,status,statusMessage,errorCode,qr_URL,date)
435
+ VALUES('',$data[eTxnID],$data[tssID],'NULL','NULL','NULL','NULL','NULL','NULL',
436
+ $data[paymentAction],'NULL','NULL',$data[status],$data[statusMessage],$data[errorCode],$data[qr_URL],$data[date])");
437
+
438
+ }else{
439
+
440
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
441
+ $write->query('UPDATE sekurmeorderstatus set tssID = "'.$tssID. '",'.'qr_URL = "'.$qr_URL.'" where eTxnID = "'. $eTxnID . '"');
442
+
443
+ }
444
+
445
+ return $curl_response;
446
+
447
+ }
448
+
449
+
450
+ }
451
+
452
+
453
+ ?>
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,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ // Send The Response
139
+ $response = '<'.'?xml version="1.0" encoding="utf-8"?'.'>';
140
+ $response.= '<SekurProcessVerificationResponse><ErrorCode>0</ErrorCode>';
141
+ $response = $response.'<StatusMessage>Success</StatusMessage></SekurProcessVerificationResponse>';
142
+ header("Content-type: text/xml; charset=utf-8");
143
+ echo $response;
144
+
145
+ }
146
+
147
+ //sekurClient_ProcessPaymentVerificationAndShipping
148
+ public function sekurClient_processPaymentVerificationAndShippingAction()
149
+ {
150
+
151
+ // Get the response
152
+ $shippingbody = file_get_contents('php://input');
153
+
154
+ // parse response data
155
+ $shippingxml = simplexml_load_string($shippingbody);
156
+
157
+ $session = Mage::getSingleton('core/session', array('name' => 'frontend'));
158
+
159
+ // User Data
160
+ $CompanyID = $shippingxml->CompanyID;
161
+ $StoreID = $shippingxml->StoreID;
162
+ $TSSID = $shippingxml->TSSID;
163
+ $ETXNID = $shippingxml->ETXNID;
164
+ $First = $shippingxml->First;
165
+ $Last = $shippingxml->Last;
166
+ $eMail = $shippingxml->eMail;
167
+ $AuthorizationStatus = $shippingxml->AuthorizationStatus;
168
+ $PayStatus = $shippingxml->PayStatus;
169
+ $PGReturnCode = $shippingxml->PGReturnCode;
170
+ $PGReturnMsg = $shippingxml->PGReturnMsg;
171
+ $PGAuthCode = $shippingxml->PGAuthCode;
172
+ $PGTransactionID = $shippingxml->PGTransactionID;
173
+ $PaymentAmount = $shippingxml->PaymentAmount;
174
+ $Phone = $shippingxml->Phone;
175
+ $SekurID = $shippingxml->SekurID;
176
+
177
+ // Billing Address Details
178
+ $Bill_First = $shippingxml->Bill_First;
179
+ $Bill_Last = $shippingxml->Bill_Last;
180
+ $Bill_Address = $shippingxml->Bill_Address;
181
+ $Bill_City = $shippingxml->Bill_City;
182
+ $Bill_State = $shippingxml->Bill_State;
183
+ $Bill_Zip = $shippingxml->Bill_Zip;
184
+ $Bill_Country = $shippingxml->Bill_Country;
185
+
186
+ if($Bill_Country == 'USA')
187
+ {
188
+ $Bill_Country_Id = 'US';
189
+
190
+ }elseif($Bill_Country == 'CAN')
191
+ {
192
+ $Bill_Country_Id = 'CA';
193
+ }
194
+
195
+ // Shipping Address Details
196
+ $Ship_First = $shippingxml->Ship_First;
197
+ $Ship_Last = $shippingxml->Ship_Last;
198
+ $Ship_Address = $shippingxml->Ship_Address;
199
+ $Ship_City = $shippingxml->Ship_City;
200
+ $Ship_State = $shippingxml->Ship_State;
201
+ $Ship_Zip = $shippingxml->Ship_Zip;
202
+ $Ship_Country = $shippingxml->Ship_Country;
203
+
204
+
205
+ if($Ship_Country == 'USA')
206
+ {
207
+ $Ship_Country_Id = 'US';
208
+
209
+ }elseif($Ship_Country == 'CAN')
210
+ {
211
+ $Ship_Country_Id = 'CA';
212
+ }
213
+
214
+ // Bill Pay Details
215
+ $BILL_PAY_1 = $shippingxml->BILL_PAY_1;
216
+ $BILL_PAY_2 = $shippingxml->BILL_PAY_2;
217
+
218
+ $Bill_Region_Id = $this->getRegionCollection($Bill_State, $Bill_Country_Id);
219
+ $Ship_Region_Id = $this->getRegionCollection($Ship_State, $Ship_Country_Id);
220
+
221
+ // Create customer if not exit
222
+ $customer_email = $eMail;
223
+ $customer_fname = $First;
224
+ $customer_lname = $Last;
225
+ $passwordLength = 10; // the lenght of autogenerated password
226
+
227
+ $customer = Mage::getModel('customer/customer');
228
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
229
+ $customer->loadByEmail($customer_email);
230
+ $customer_id = $customer->getId();
231
+
232
+
233
+ /*
234
+ * Check if the email exist on the system.
235
+ * If YES, it will not create a user account.
236
+ */
237
+
238
+
239
+ if(!$customer->getId()) {
240
+
241
+ //setting data such as email, firstname, lastname, and password
242
+
243
+ $email = $customer->setEmail($customer_email);
244
+ $customer->setFirstname($customer_fname);
245
+ $customer->setLastname($customer_lname);
246
+ $password = $customer->setPassword($customer->generatePassword($passwordLength));
247
+
248
+ try{
249
+ //the save the data and send the new account email.
250
+ $customer->save();
251
+ $customer->setConfirmation(null);
252
+ $customer->save();
253
+ $customer->setStatus(1);
254
+
255
+ //Get the current customer ID & set the billing address
256
+ $billaddress = Mage::getModel("customer/address");
257
+ $billaddress->setCustomerId($customer->getId());
258
+ $billaddress->setFirstname($Bill_First);
259
+ $billaddress->setLastname($Bill_Last);
260
+ $billaddress->setCountryId($Bill_Country_Id); //Country code here
261
+ $billaddress->setStreet($Bill_Address);
262
+ $billaddress->setPostcode($Bill_Zip);
263
+ $billaddress->setCity($Bill_City);
264
+ $billaddress->setState($Bill_Region_Id);
265
+ $billaddress->setTelephone($Phone);
266
+ $billaddress->setIsDefaultBilling('1');
267
+ $billaddress->save();
268
+
269
+ //Get the current customer ID & set the billing address
270
+ $shipaddress = Mage::getModel("customer/address");
271
+ $shipaddress->setCustomerId($customer->getId());
272
+ $shipaddress->setFirstname($Ship_First);
273
+ $shipaddress->setLastname($Ship_Last);
274
+ $shipaddress->setCountryId($Ship_Country_Id); //Country code here
275
+ $shipaddress->setStreet($Ship_Address);
276
+ $shipaddress->setPostcode($Ship_Zip);
277
+ $shipaddress->setCity($Ship_City);
278
+ $shipaddress->setState($Ship_Region_Id);
279
+ $shipaddress->setTelephone($Phone);
280
+ $shipaddress->setIsDefaultShipping('1');
281
+ $shipaddress->save();
282
+
283
+ }
284
+
285
+ catch(Exception $ex){
286
+
287
+ Mage::log($e->getMessage());
288
+ }
289
+
290
+ }else{
291
+
292
+ $selectquery = "SELECT * FROM customer_flat_quote_payment WHERE eTxnID=".$ETXNID;
293
+ $billValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($selectquery);
294
+
295
+ if($billValue['0']['billing_country'] =='USA')
296
+ {
297
+ $billValue['0']['billing_countryId'] = 'US';
298
+ }
299
+
300
+ $customer = Mage::getModel('customer/customer')->load($customer->getId());
301
+
302
+ $dataBilling = array(
303
+ 'firstname' => $Bill_First,
304
+ 'lastname' => $Bill_Last,
305
+ 'street' => array($Bill_Address),
306
+ 'city' => $Bill_City,
307
+ 'region' => $Bill_State,
308
+ 'region_id' => $Bill_Region_Id,
309
+ 'postcode' => $Bill_Zip,
310
+ 'country_id' => $Bill_Country_Id,
311
+ 'telephone' => $Phone,
312
+ );
313
+
314
+ $dataShipping = array(
315
+ 'firstname' => $Ship_First,
316
+ 'lastname' => $Ship_Last,
317
+ 'street' => array($Ship_Address),
318
+ 'city' => $Ship_City,
319
+ 'region' => $Ship_State,
320
+ 'region_id' => $Ship_Region_Id,
321
+ 'postcode' => $Ship_Zip,
322
+ 'country_id' => $Ship_Country_Id,
323
+ 'telephone' => $Phone,
324
+ );
325
+ $customerAddress = Mage::getModel('customer/address');
326
+ // Check for the shipping address
327
+ if ($defaultShippingId = $customer->getDefaultShipping()){
328
+ $customerAddress->load($defaultShippingId);
329
+ } else {
330
+ $customerAddress
331
+ ->setCustomerId($customer->getId())
332
+ ->setIsDefaultShipping('1')
333
+ ->setSaveInAddressBook('1');
334
+
335
+ $customer->addAddress($customerAddress);
336
+ }
337
+
338
+ $customerAddress1 = Mage::getModel('customer/address');
339
+ // check for the bliing address
340
+ if ($defaultBillingId = $customer->getDefaultBilling()){
341
+ $customerAddress1->load($defaultBillingId);
342
+ } else {
343
+ $customerAddress1
344
+ ->setCustomerId($customer->getId())
345
+ ->setIsDefaultBilling('1')
346
+ ->setSaveInAddressBook('1');
347
+
348
+ $customer->addAddress($customerAddress);
349
+ }
350
+
351
+
352
+ try {
353
+ $customerAddress->addData($dataShipping)->save();
354
+ $customerAddress1->addData($dataBilling)->save();
355
+
356
+ } catch(Exception $e){
357
+
358
+ }
359
+
360
+ }
361
+
362
+ $update = Mage::getSingleton('core/resource')->getConnection('core_write');
363
+ $update->query('UPDATE sekurmeorderstatus set companyID = "'.$CompanyID. '",'.'storeID = "'.$StoreID.'",'.'customer_id = "'.$customer_id.'",'.'email_id ="'.$eMail.'",
364
+ '.'sekurID = "'.$SekurID.'",'.'payStatus = "'.$PayStatus.'",'.'transactionID = "'.$PGTransactionID.'" where eTxnID = "'. $ETXNID . '"');
365
+
366
+
367
+
368
+ // Send The Response
369
+ $shipresponse = '<'.'?xml version="1.0" encoding="utf-8"?'.'>';
370
+ $shipresponse.= '<SekurProcessVerificationResponse><ErrorCode>0</ErrorCode>';
371
+ $shipresponse = $shipresponse.'<StatusMessage>Success</StatusMessage></SekurProcessVerificationResponse>';
372
+ header("Content-type: text/xml; charset=utf-8");
373
+
374
+ echo $shipresponse;
375
+
376
+
377
+ }
378
+
379
+
380
+ function clean_up_response($response) {
381
+ return simplexml_load_string(html_entity_decode($response));
382
+ }
383
+ }
app/code/community/Sekurme/controllers/StandardController.php ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
190
+ exit;
191
+ }
192
+
193
+ $shipping = $quoteObj->getShippingAddress()->getShippingAmount();
194
+
195
+ $shippingAmount = $cart->getShippingAddress()->getData('shipping_amount');
196
+
197
+ if(empty($shippingAmount))
198
+ {
199
+ $shippingAmount = $shipping;
200
+ }
201
+
202
+ $taxAmount = $cart->getShippingAddress()->getData('tax_amount');
203
+
204
+ $quoteObj->getShippingAddress()->setTaxAmount($taxAmount); //set the total of tax
205
+ $quoteObj->getShippingAddress()->setBaseTaxAmount($taxAmount); //set the total of tax
206
+ $quoteObj->getShippingAddress()->setShippingAmount($shippingAmount); //set the shipping price with taxes
207
+ $quoteObj->getShippingAddress()->setBaseShippingAmount($shippingAmount); //set the shipping price with taxes
208
+
209
+ $tax_amount = $quoteObj->getShippingAddress()->getData('tax_amount');
210
+ $shipping_amount = $quoteObj->getShippingAddress()->getData('shipping_amount');
211
+
212
+ $quoteObj->reserveOrderId();
213
+ $quoteObj->collectTotals();
214
+
215
+ // set payment method
216
+ $quotePaymentObj = $quoteObj->getPayment();
217
+ $quotePaymentObj->setMethod($paymentData['method']);
218
+ $quoteObj->setPayment($quotePaymentObj);
219
+
220
+ // convert quote to order
221
+ $convertQuoteObj = Mage::getSingleton('sales/convert_quote');
222
+ $orderObj = $convertQuoteObj->addressToOrder($quoteObj->getShippingAddress());
223
+ $orderPaymentObj = $convertQuoteObj->paymentToOrderPayment($quotePaymentObj);
224
+
225
+ //Set the Shipping Amount To OrderObj
226
+ $orderObj->setShippingAmount($shipping_amount);
227
+ $orderObj->setBaseShippingAmount($shipping_amount);
228
+
229
+ //Set the Tax Amount To OrderObj
230
+ $orderObj->setTaxAmount($tax_amount);
231
+ $orderObj->setBaseTaxAmount($tax_amount);
232
+
233
+ // Assign Looged In Customer Address
234
+
235
+ $orderObj->setBillingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getBillingAddress()));
236
+
237
+ $orderObj->setShippingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getShippingAddress()));
238
+
239
+ $orderObj->setPayment($convertQuoteObj->paymentToOrderPayment($quoteObj->getPayment()));
240
+
241
+ if ($paymentData) {
242
+
243
+ $orderObj->getPayment()->setCcNumber($paymentData['ccNumber']);
244
+ $orderObj->getPayment()->setCcOwner($paymentData['ccOwner']);
245
+ $orderObj->getPayment()->setCcType($paymentData['ccType']);
246
+ $orderObj->getPayment()->setCcExpMonth($paymentData['ccExpMonth']);
247
+ $orderObj->getPayment()->setCcExpYear($paymentData['ccExpYear']);
248
+ $orderObj->getPayment()->setCcLast4(substr($paymentData['ccNumber'],-4));
249
+
250
+ }
251
+
252
+ foreach ($items as $item) {
253
+ //@var $item Mage_Sales_Model_Quote_Item
254
+ $orderItem = $convertQuoteObj->itemToOrderItem($item);
255
+ if ($item->getParentItem()) {
256
+
257
+ $orderItem->setParentItem($orderObj->getItemByQuoteItemId($item->getParentItem()->getId()));
258
+
259
+ }
260
+
261
+ $orderObj->addItem($orderItem);
262
+
263
+ }
264
+ $orderObj->setCanShipPartiallyItem(false);
265
+
266
+ $totalDue = $orderObj->getTotalDue();
267
+
268
+ //$orderObj->sendNewOrderEmail();
269
+
270
+ try {
271
+
272
+ $orderObj->place(); //calls _placePayment
273
+ $orderObj->save();
274
+
275
+ }catch (Exception $e){
276
+
277
+ Mage::register('payment_error', "bank");
278
+ Mage::register('code', "Payment");
279
+ Mage::register('desc', "Order not places successfully, incorrect credit card details.");
280
+ $this->failedAction();
281
+ return;
282
+ }
283
+
284
+ $orderObj->load(Mage::getSingleton('sales/order')->getLastOrderId());
285
+ $lastOrderId = $orderObj->getIncrementId();
286
+
287
+ $sessionQuote = Mage::getSingleton('checkout/session');
288
+
289
+ //prepare session to success page
290
+ Mage::getSingleton("checkout/session")
291
+ ->setLastQuoteId($sessionQuote->getQuoteId())
292
+ ->setLastSuccessQuoteId($sessionQuote->getQuoteId())
293
+ ->setLastOrderId($orderObj->getId())
294
+ ->setLastRealOrderId($orderObj->getIncrementId());
295
+
296
+
297
+ /***************EMAIL*****************/
298
+ $orderObj->loadByIncrementId($lastOrderId);
299
+
300
+ try{
301
+
302
+ //echo "Trying to send an mail";
303
+ $emailed = $orderObj->sendNewOrderEmail();
304
+ //$quote->delete();
305
+
306
+ }catch (Exception $ex){
307
+
308
+ //echo "Failed to send a confirmation mail";
309
+
310
+ }
311
+ /***************EMAIL*****************/
312
+
313
+ return $lastOrderId;
314
+
315
+ }
316
+
317
+ // Decrypt string
318
+ public function cc_decrypt($str)
319
+ {
320
+ $EncKey = "25c6c7dd";
321
+ $str = mcrypt_decrypt(MCRYPT_DES, $EncKey, base64_decode($str), MCRYPT_MODE_ECB);
322
+ # Strip padding out.
323
+ $block = mcrypt_get_block_size('des', 'ecb');
324
+ $pad = ord($str[($len = strlen($str)) - 1]);
325
+ if ($pad && $pad < $block && preg_match(
326
+ '/' . chr($pad) . '{' . $pad . '}$/', $str
327
+ )
328
+ ) {
329
+ return substr($str, 0, strlen($str) - $pad);
330
+ }
331
+ return $str;
332
+ }
333
+
334
+ public function completeAction()
335
+
336
+ {
337
+
338
+ $session = Mage::getSingleton('checkout/session');
339
+
340
+ $standard = Mage::getModel('sekurme/express');
341
+
342
+ $quoteId = $session->getQuoteId();
343
+
344
+ $ETXNID = $_GET['eTxnID'];
345
+
346
+ $selectquery = "SELECT * FROM sekurmeorderstatus WHERE eTxnID=".$ETXNID;
347
+
348
+ $customerInfo = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($selectquery);
349
+
350
+ //Get customer data
351
+ $customer = Mage::getModel('customer/customer');
352
+
353
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
354
+
355
+ $customer->loadByEmail(trim($customerInfo['0']['email_id']));
356
+
357
+ Mage::getSingleton('core/session', array('name' => 'frontend'));
358
+ Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
359
+
360
+
361
+ $customAddress = Mage::getModel('customer/address');
362
+
363
+ $customerId = $customer->getId();
364
+
365
+ $ccquery = "SELECT * FROM customer_flat_quote_payment WHERE eTxnID=".$ETXNID;
366
+ $ccValue = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($ccquery);
367
+
368
+ $last4Digit = trim($this->cc_decrypt($ccValue['0']['cc_number_enc']));
369
+
370
+ $last4Num = substr($last4Digit,-4,4);
371
+
372
+ $expYear = trim($ccValue['0']['cc_exp_year']);
373
+
374
+ $last2Num = substr($expYear,2);
375
+
376
+ $paymentMethod = Mage::getStoreConfig('payment/sekurme/paymentmethod');
377
+
378
+ $paymentData = array(
379
+ 'method' => $paymentMethod,
380
+ 'ccType' => trim($ccValue['0']['cc_type']),
381
+ 'ccOwner' => trim($ccValue['0']['cc_owner']),
382
+ 'ccNumber' => trim($this->cc_decrypt($ccValue['0']['cc_number_enc'])),
383
+ 'ccExpMonth' => trim($ccValue['0']['cc_exp_month']),
384
+ 'ccExpYear' => trim($ccValue['0']['cc_exp_year']),
385
+ 'CcLast4' => $last4Num
386
+
387
+ );
388
+
389
+
390
+ try{
391
+
392
+ $getID = $this->confirmOrder($quoteId, $paymentData);
393
+
394
+ }catch (Exception $e) {
395
+
396
+ $this->failedAction();
397
+ return;
398
+
399
+ }
400
+
401
+ $this->removeCCInfo($ETXNID);
402
+
403
+ $params = array('_query' => array('orderID' => $getID));
404
+
405
+ $this->_redirect('sekurme/standard/success/',$params);
406
+
407
+
408
+ }
409
+
410
+ public function successAction()
411
+
412
+ {
413
+
414
+ $getID = $_GET['orderID'];
415
+
416
+ $session = Mage::getSingleton('checkout/session');
417
+ $session->setPayexStandardQuoteId($session->getQuoteId());
418
+
419
+ $order = Mage::getModel('sales/order');
420
+ $order_id = Mage::getSingleton("checkout/session")->getLastRealOrderId();
421
+ $order->loadByIncrementId($order_id);
422
+
423
+ //
424
+ // Load the order number
425
+ if (Mage::getSingleton('checkout/session')->getLastOrderId() && (isset($_GET["orderID"])) && Mage::getSingleton('checkout/session')->getLastOrderId() == $_GET["orderID"]) {
426
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
427
+
428
+ } else {
429
+
430
+ if (isset($_GET["orderID"])) {
431
+
432
+ $order->loadByIncrementId((int)$_GET["orderID"]);
433
+
434
+ } else {
435
+
436
+ Mage::register('payment_error', "bank");
437
+ Mage::register('desc', "We're sorry, but purchase has not been completed using the selected card.
438
+ <br/> Your bank declined our attempt to authorize your card.");
439
+ $this->failedAction();
440
+ return;
441
+
442
+ }
443
+
444
+ }
445
+
446
+ //
447
+ // Validate the order and send email confirmation if enabled
448
+ if(!$order->getId()){
449
+
450
+ Mage::register('payment_error', "order_error");
451
+ Mage::register('desc', "We're sorry, there was a problem creating your order. Please try again, or contact customer service for more help.");
452
+ $this->failedAction();
453
+ return;
454
+
455
+ }
456
+
457
+ // Send email order confirmation
458
+ //
459
+
460
+ $order->load($order->getId());
461
+ $order->sendOrderUpdateEmail();
462
+
463
+ $this->ClearCart();
464
+
465
+ $params = array('order_id' => $order->getId());
466
+
467
+ Mage::getSingleton('checkout/cart')->truncate();
468
+
469
+ //Mage::getSingleton('checkout/session')->clear();
470
+
471
+ //$this->_redirect('sales/order/view/',$params);
472
+
473
+ $this->_redirect('checkout/onepage/success');
474
+
475
+
476
+ }
477
+
478
+ function clean_up_response($response) {
479
+
480
+ return simplexml_load_string(html_entity_decode($response));
481
+
482
+ }
483
+
484
+ }
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/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/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>&nbsp;</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,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Checkout</name>
4
+ <version>1.0.0.4</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 mCommerce.&#xD;
10
+ Patented QR Payments for eCommerce checkout.</summary>
11
+ <description>SEKUR.me provides increased conversions and more repeat customers, while giving shoppers a secure and ultra-convenient payment process.</description>
12
+ <notes>First preview release</notes>
13
+ <authors><author><name>Sekur.me</name><user>sekurme</user><email>jack@sekur.me</email></author></authors>
14
+ <date>2014-04-26</date>
15
+ <time>15:24:17</time>
16
+ <contents><target name="magecommunity"><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="92d07ad409b1e00f87db64723b1a03fb"/><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="1d9e60ff464fa07a9d2f12e1f64ce7d0"/><file name="StandardController.php" hash="a687dcf1c770b81570b3f8071b064128"/></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></target><target name="mageetc"><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></target><target name="magelocal"><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></target><target name="mageskin"><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></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="d83ba20378f330a1741436dc426483a9"/></dir></dir><dir name="page"><dir name="html"><file name="head.phtml" hash="157d7e8ce45629cd3d662ee6b9603a89"/></dir></dir></dir></dir></dir><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="sekurme"><dir name="shortcut"><file name="failed.phtml" hash="3de6407ed2764555a25505641b8abe81"/><file name="shortcutmid.phtml" hash="22032a5c485d3d90fcbd694d2e1cad8d"/></dir></dir><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="d83ba20378f330a1741436dc426483a9"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mage_Sekurme.csv" hash="ac60a7cc23a8d82996dee10903ee9fb8"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
19
+ </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