Ensygnia_Onescan - Version 1.0.5

Version Notes

Version 1.0.5 of the Onescan Payment Plugin extension.

Changelog
---------------

1.0.5
Allows merchant to specify the image that will be displayed on the device during a purchase.

Under certain circumstances the tax calculation was rounding incorrectly making a £0.01 difference between the actual payment and what was recorded in Magento - fixed.

1.0.4
Incorrect compatibility information shown on Magento Connect - fixed.

1.0.3
Corrected error in layout file preventing Onescan logo from being shown on the admin pages.

1.0.2
Incorrect postage applied where minimum order value applies. Fixed.

Tax missing from individual items in admin sales/orders list. Fixed.

Orders not marked as paid and invoice not created in admin. Fixed.

Onescan was being listed as payment method option on the standard checkout page, resulting in orders potentially being placed with no payment being taken. If a customer uses Onescan to pay, they never get to that part of the checkout process so it makes no sense to have Onescan listed as a payment method there. This has been removed so now the only way for Onescan to be selected as a payment method is for the padlock to be scanned as intended.

1.0.1
Fixed potential installation problem.

1.0.0
Initial version.

Download this release

Release Info

Developer Ensygnia
Extension Ensygnia_Onescan
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

app/code/local/Ensygnia/Onescan/Helper/Data.php CHANGED
@@ -127,15 +127,18 @@
127
  }
128
 
129
  public function getSessionFromBasketUrl() {
130
- return Mage::getUrl('onescan/index/createsessionfrombasket');
 
131
  }
132
 
133
  public function getLoginSessionUrl() {
134
- return Mage::getUrl('onescan/index/createloginsession');
 
135
  }
136
 
137
  public function getRegistrationSessionUrl() {
138
- return Mage::getUrl('onescan/index/createregistrationsession');
 
139
  }
140
  }
141
  ?>
127
  }
128
 
129
  public function getSessionFromBasketUrl() {
130
+ return str_ireplace(array('http://','https://'),'//',
131
+ Mage::getUrl('onescan/index/createsessionfrombasket'));
132
  }
133
 
134
  public function getLoginSessionUrl() {
135
+ return str_ireplace(array('http://','https://'),'//',
136
+ Mage::getUrl('onescan/index/createloginsession'));
137
  }
138
 
139
  public function getRegistrationSessionUrl() {
140
+ return str_ireplace(array('http://','https://'),'//',
141
+ Mage::getUrl('onescan/index/createregistrationsession'));
142
  }
143
  }
144
  ?>
app/code/local/Ensygnia/Onescan/Model/Callback/Purchase.php CHANGED
@@ -1,457 +1,471 @@
1
- <?php
2
- /*
3
- Ensygnia Onescan extension
4
- Copyright (C) 2014 Ensygnia Ltd
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
- require_once(Mage::getBaseDir('lib') . "/Onescan/login/LocalDataFactory.php");
20
-
21
- class Ensygnia_Onescan_Model_Callback_Purchase extends Ensygnia_Onescan_Model_Callback_Abstract {
22
- public function getConfigReference() {
23
- return 'onescan/config_purchase';
24
- }
25
-
26
- public function handle() {
27
- $settings = $this->getConfig()->getSettings();
28
- if (isset($_GET['basket'])) {
29
- $settings->OnescanCallbackURL .= '?basket=' . $_GET['basket'];
30
- }
31
-
32
- $onescanMessage = Onescan::ReadMessage($settings);
33
-
34
- $purchaseProcess = new OnescanPurchaseProcess();
35
- $nextAction = $purchaseProcess->DecodePurchaseMessage($onescanMessage);
36
- $sessionState = $purchaseProcess->SessionState();
37
-
38
- switch ($nextAction)
39
- {
40
- case PurchaseAction::StartPayment:
41
- Mage::log('Start Payment');
42
- $purchasePayload = $this->BuildPurchasePayload($sessionState->SessionID);
43
- $purchaseProcess->ProcessStartPurchase($purchasePayload);
44
- break;
45
- case PurchaseAction::AdditionalCharges:
46
- Mage::log('Additional Charges');
47
- $purchaseProcess->DecodeAdditionalChargesRequest($onescanMessage);
48
- $additionalChargesPayload = $this->BuildAdditionalCharges($purchaseProcess);
49
- $purchaseProcess->ProcessAdditionalCharges($additionalChargesPayload);
50
- break;
51
- case PurchaseAction::PaymentConfirmed:
52
- Mage::log('Payment Confirmed');
53
- $purchaseProcess->DecodePaymentConfirmed($onescanMessage);
54
- $orderAcceptedPayload = $this->BuildOrderAccepted($purchaseProcess);
55
- $purchaseProcess->ProcessPaymentConfirmed($orderAcceptedPayload);
56
- break;
57
- case PurchaseAction::PaymentFailed:
58
- Mage::log('Payment Failed');
59
- $purchaseProcess->ProcessPaymentFailed();
60
- break;
61
- case PurchaseAction::PaymentCancelled:
62
- Mage::log('Payment Cancelled');
63
- $purchaseProcess->ProcessPaymentCancelled();
64
- break;
65
- }
66
-
67
- $responseMessage = $purchaseProcess->EncodeOutcome();
68
-
69
- Onescan::SendMessage($responseMessage,$settings);
70
-
71
- return parent::handle();
72
- }
73
-
74
- /// <summary>
75
- /// Build some extra information about further charges.
76
- /// </summary>
77
- public function BuildAdditionalCharges($process) {
78
- $additionalChargesContext = $process->AdditionalChargesContext;
79
- $requires=$process->PurchaseInfo->Requires;
80
- $purchaseCharges = new AdditionalChargesPayload();
81
-
82
- if ($requires->DeliveryOptions && !empty($additionalChargesContext->DeliveryAddress))
83
- $this->AddDeliveryCharges($additionalChargesContext->DeliveryAddress,$purchaseCharges,$process);
84
-
85
- if ($requires->Surcharges && !empty($additionalChargesContext->PaymentMethod))
86
- $this->AddPaymentMethodCharges($additionalChargesContext->PaymentMethod,$purchaseCharges,$process);
87
-
88
- return $purchaseCharges;
89
- }
90
-
91
- /// <summary>
92
- /// Add charges for the specified payment method.
93
- /// </summary>
94
- public function AddPaymentMethodCharges($paymentMethod,$purchaseCharges,$process) {
95
- switch ($paymentMethod->PaymentMethodType) {
96
- case 'CreditCard':
97
- $this->HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process);
98
- break;
99
- case 'OnescanPlay':
100
- $this->HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process);
101
- break;
102
- }
103
- }
104
-
105
- /// <summary>
106
- /// Handle charges for the onescan test card.
107
- /// </summary>
108
- public function HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process) {
109
- $cardDetails = $paymentMethod->CardInformation;
110
-
111
- $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
112
- $purchaseCharges->PaymentMethodCharge->Code = "PLAY";
113
- $purchaseCharges->PaymentMethodCharge->Description = "The onescan play card attracts a £1 surcharge";
114
- $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
115
- $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = 1.00;
116
- $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
117
- $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = 1.00;
118
- }
119
-
120
- /// <summary>
121
- /// Handle charges for credit cards
122
- /// </summary>
123
- public function HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process) {
124
- $cardDetails = $paymentMethod->CardInformation;
125
-
126
- if ($cardDetails->PaymentSystemCode == "VISA") {
127
-
128
- $surcharge = round($process->PurchaseInfo->PaymentAmount * 0.01, 2);
129
-
130
- $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
131
- $purchaseCharges->PaymentMethodCharge->Code = "VISA";
132
- $purchaseCharges->PaymentMethodCharge->Description = "Paying with a credit card attracts a 1% charge";
133
- $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
134
- $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = $surcharge;
135
- $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
136
- $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = $surcharge;
137
- }
138
- }
139
-
140
- /// <summary>
141
- /// Add delivery charges for the specified address.
142
- /// </summary>
143
- public function AddDeliveryCharges($address,$purchaseCharges,$process) {
144
- $onescanModel=Mage::getModel('onescan/sessiondata');
145
- $onescanData = $onescanModel->getCollection();
146
- $onescanData->addFieldToFilter('sessionid', array('like' => $process->SessionState()->SessionID));
147
- $onescanData->load();
148
- $sessionData=$onescanData->getData();
149
- $quoteid=$sessionData[0]['quoteid'];
150
-
151
- /*if (Mage::registry('checkout_addShipping')) {
152
- Mage::unregister('checkout_addShipping');
153
- return;
154
- }
155
- Mage::register('checkout_addShipping',true);*/
156
-
157
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
158
- $cart->setQuoteId($quoteid);
159
- $quote=$cart->getQuote();
160
-
161
- $countryCode=Mage::app()->getLocale()->getCountryTranslation(Mage::getStoreConfig('general/country/default'));
162
- /*if ($quote->getCouponCode() != '') {
163
- $c = Mage::getResourceModel('salesrule/rule_collection');
164
- $c->getSelect()->where("code=?", $quote->getCouponCode());
165
- foreach ($c->getItems() as $item) {
166
- $coupon = $item;
167
- }
168
- if ($coupon->getSimpleFreeShipping() > 0) {
169
- $quote->getShippingAddress()->setShippingMethod($this->_shippingCode)->save();
170
- return true;
171
- }
172
- }*/
173
- try {
174
- if ($quote->getShippingAddress()->getCountryId() == '') {
175
- $quote->getShippingAddress()->setCountryId($countryCode);
176
- }
177
- $quote->collectTotals();
178
-
179
- $quote->getShippingAddress()->setCollectShippingRates(true);
180
- $quote->getShippingAddress()->collectShippingRates();
181
- $rates = $quote->getShippingAddress()->getShippingRatesCollection();
182
- }
183
- catch (Mage_Core_Exception $e) {
184
- Mage::getSingleton('checkout/session')->addError($e->getMessage());
185
- }
186
- catch (Exception $e) {
187
- Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Load customer quote error'));
188
- }
189
-
190
- $allowedRates=array();
191
- $lowestPrice=99999;
192
- foreach ($rates as $rate){
193
- $rateCode=$rate->getCode();
194
- if($quote->getShippingAddress()->collectShippingRates()->getShippingRateByCode($rateCode)){
195
- $allowedRates[$rateCode]=$rate; //Using $rateCode as key removes duplicates
196
- }
197
-
198
- //Set the lowest rate as the default
199
- if($rate->getPrice()<$lowestPrice){
200
- $lowestPrice=$rate->getPrice();
201
- $defaultCode=$rateCode;
202
- }
203
- }
204
-
205
- $purchaseCharges->DeliveryOptions = array();
206
-
207
- foreach ($rates as $rate) {
208
- $option=new DeliveryOption();
209
- $option->Code = $rate->getCode();
210
- $option->Description = $rate->getMethodDescription();
211
- if($option->Code==$defaultCode){
212
- $option->IsDefault = true;
213
- $defaultIndex=count($purchaseCharges->DeliveryOptions);
214
- }
215
- $option->Label = $rate->getMethodTitle();
216
- $option->Charge = new Charge();
217
- $amount=$rate->getPrice();
218
- $option->Charge->BaseAmount = $rate->getPrice();
219
- $option->Charge->Tax = 0;
220
- $option->Charge->TotalAmount = $rate->getPrice();
221
- $purchaseCharges->DeliveryOptions[]=$option;
222
- }
223
-
224
- //Make sure the default rate is listed first
225
- $option=$purchaseCharges->DeliveryOptions[$defaultIndex];
226
- $purchaseCharges->DeliveryOptions[$defaultIndex]=$purchaseCharges->DeliveryOptions[0];
227
- $purchaseCharges->DeliveryOptions[0]=$option;
228
-
229
- $onescanModel->setId($sessionData[0]['sessiondata_id']);
230
- $onescanModel->setSessionid($process->SessionState()->SessionID);
231
- $onescanModel->setQuoteid($quoteid);
232
- $onescanModel->setCustomerid($sessionData[0]['customerid']);
233
- $onescanModel->setShippingmethod($option->Code);
234
- $onescanModel->setShippingrate($option->Charge->TotalAmount);
235
- $onescanModel->save();
236
- }
237
-
238
- public function BuildPurchasePayload($sessionID) {
239
- $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
240
- $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
241
- $onescanData->load();
242
- $sessionData=$onescanData->getData();
243
- $quoteid=$sessionData[0]['quoteid'];
244
-
245
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
246
- $cart->setQuoteId($quoteid);
247
-
248
- $quote=$cart->getQuote();
249
- $quote->reserveOrderId();
250
- $quote->save();
251
-
252
- $storeid=$quote->getStoreId();
253
- $totals=$quote->getTotals();
254
-
255
- $payload = new PurchasePayload();
256
- $payload->RequiresDeliveryAddress = true;
257
- $payload->MerchantName = Mage::app()->getStore()->getFrontendName();
258
- $payload->MerchantTransactionID = GUID();
259
- $payload->PurchaseDescription = Mage::getStoreConfig('onescantab/general/onescan_basket-name');
260
-
261
- if(isset($totals['tax']) && $totals['tax']->getValue()) {
262
- $payload->Tax = $totals['tax']->getValue();
263
- } else {
264
- $payload->Tax = 0;
265
- }
266
- $payload->ProductAmount = $totals['subtotal']->getValue()-$payload->Tax;
267
- $payload->PaymentAmount = $totals['grand_total']->getValue();
268
- $payload->Currency = Mage::app()->getStore($storeid)->getCurrentCurrencyCode();
269
-
270
- $payload->Requires = new PaymentOptIns();
271
-
272
- $payload->Requires->Surcharges = false;
273
- $payload->Requires->DeliveryOptions=true;
274
- $filename = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/' .
275
- Mage::getSingleton('core/design_package')->getPackageName() . '/' .
276
- Mage::getSingleton('core/design_package')->getTheme('frontend') . '/' .
277
- Mage::getStoreConfig('design/header/logo_src');
278
- $payload->ImageData = base64_encode(file_get_contents($filename));
279
-
280
- return $payload;
281
- }
282
-
283
- public function BuildOrderAccepted($process) {
284
- $sessionState=$process->SessionState();
285
- $sessionID = $sessionState->SessionID;
286
-
287
- $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
288
- $onescanData->addFieldToFilter('sessionid', array('like' => $process->SessionState()->SessionID));
289
- $onescanData->load();
290
- $sessionData=$onescanData->getData();
291
-
292
- $quoteid=$sessionData[0]['quoteid'];
293
- $customerid=$sessionData[0]['customerid'];
294
- $shippingMethod=$sessionData[0]['shippingmethod'];
295
- $shippingRate=$sessionData[0]['shippingrate'];
296
-
297
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
298
- $cart->setQuoteId($quoteid);
299
- $totals=$cart->getQuote()->getTotals();
300
- $quote=$cart->getQuote();
301
-
302
- //TEMPORARY FIX FOR BLANK FIRST AND LAST NAMES
303
- if ($process->PaymentConfirmation->FirstName=="") {
304
- $process->PaymentConfirmation->FirstName="First";
305
- }
306
- if ($process->PaymentConfirmation->LastName=="") {
307
- $process->PaymentConfirmation->LastName="Last";
308
- }
309
-
310
- if ($customerid) {
311
- // We are already logged in:
312
- $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->load($customerid);
313
- $quote->assignCustomer($customer);
314
- } else {
315
- $loginTokens = Mage::getModel('onescan/logintokens')->getCollection();
316
- $loginTokens->addFieldToFilter('onescantoken', array('like' => $process->UserToken));
317
- $loginTokens->load();
318
- $details=$loginTokens->getData();
319
- $customer = Mage::getModel('customer/customer');
320
- $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
321
- if (empty($details)) {
322
- //We do not recognise the user token, so we create an account and log in
323
- $customer->loadByEmail($process->PaymentConfirmation->UserEmail);
324
-
325
- if(!$customer->getId()) {
326
- //New customer registration
327
- $customer->setEmail($process->PaymentConfirmation->UserEmail);
328
- $customer->setFirstname($process->PaymentConfirmation->FirstName);
329
- $customer->setLastname($process->PaymentConfirmation->LastName);
330
- $customer->setPassword($this->randomPassword());
331
- try {
332
- $customer->save();
333
- if (Mage::getStoreConfig('onescantab/general/onescan_skip-confirmation') || !$customer->isConfirmationRequired()) {
334
- $customer->setConfirmation(null);
335
- $customer->save();
336
- $customer->sendNewAccountEmail(
337
- 'registered',
338
- '',
339
- Mage::app()->getStore()->getId()
340
- );
341
- $confirmMessage=false;
342
- } else {
343
- $customer->sendNewAccountEmail(
344
- 'confirmation',
345
- $session->getBeforeAuthUrl(),
346
- Mage::app()->getStore()->getId()
347
- );
348
- $confirmMessage=true;
349
- }
350
-
351
- $newToken=Mage::getModel('onescan/logintokens');
352
- $newToken->setOnescantoken($process->UserToken);
353
- $newToken->setMagentouserid($customer->getId());
354
- $newToken->save();
355
-
356
- $message=Mage::getStoreConfig('onescantab/general/onescan_register-success-message');
357
-
358
- if ($confirmMessage) {
359
- $value=Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
360
- $message = Mage::helper('customer')->__(Mage::getStoreConfig('onescantab/general/onescan_email-not-confirmed-message'),$value);
361
- }
362
-
363
- LocalDataFactory::storeObject($sessionID,$customer->getId());
364
- LocalDataFactory::storeObject($sessionID . '-message',$message);
365
- }
366
- catch (Mage_Core_Exception $e) {
367
- LocalDataFactory::storeObject($sessionID . '-message',$e->getMessage());
368
- }
369
- } else { //Email address recognised so redirect to login page
370
- LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_email-exists-message'));
371
- }
372
- } else {
373
- //We recognise the user token, so we can log in
374
- $customer->load($details[0]['magentouserid']);
375
- LocalDataFactory::storeObject($sessionID,$details[0]['magentouserid']);
376
- LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_login-success-message'));
377
- }
378
- $quote->assignCustomer($customer);
379
- }
380
-
381
- $country=Mage::app()->getLocale()->getCountryTranslation(Mage::getStoreConfig('general/country/default'));
382
- $addressData = array(
383
- 'firstname' => $process->PaymentConfirmation->FirstName,
384
- 'lastname' => $process->PaymentConfirmation->LastName,
385
- 'street' => $process->PaymentConfirmation->DeliveryAddress->AddressLine1 . ', ' . $process->PaymentConfirmation->DeliveryAddress->AddressLine2,
386
- 'city' => $process->PaymentConfirmation->DeliveryAddress->Town,
387
- 'postcode' => $process->PaymentConfirmation->DeliveryAddress->Postcode,
388
- 'telephone' => '0',
389
- 'country_id' => $country,
390
- 'region_id' => 0,
391
- );
392
- $quote->getShippingAddress()->collectTotals();
393
-
394
- $billingAddress = $quote->getBillingAddress()->addData($addressData);
395
- $shippingAddress = $quote->getShippingAddress()->addData($addressData);
396
- $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
397
- ->setShippingMethod($shippingMethod)
398
- ->setPaymentMethod('onescan');
399
-
400
- $quote->collectTotals();
401
-
402
- $quote->getPayment()->importData(array('method' => 'onescan'));
403
-
404
- foreach($quote->getAllItems() as $item){
405
- $totalPrice=$item->getProduct()->getFinalPrice()*$item->getQty();
406
- $taxAmount=$totalPrice-$item->getPrice();
407
- $item->setTaxAmount($taxAmount);
408
- $item->setTaxPercent(round($taxAmount*100/($totalPrice-$taxAmount),2));
409
- }
410
-
411
- //Add postage to quote
412
- $totals['grand_total']->setValue(round($totals['grand_total']->getValue()+$shippingRate,2,PHP_ROUND_HALF_DOWN));
413
-
414
- $quote->setIsActive(0);
415
- $quote->save();
416
-
417
- $service = Mage::getModel('sales/service_quote', $quote);
418
- $service->submitAll();
419
- $order = $service->getOrder();
420
-
421
- //$order->setShippingMethod($shippingMethod);
422
-
423
- if(isset($totals['tax']) && $totals['tax']->getValue()) {
424
- $order->setTaxAmount(round($totals['tax']->getValue(),2,PHP_ROUND_HALF_DOWN));
425
- $order->setBaseTaxAmount(round($totals['tax']->getValue(),2,PHP_ROUND_HALF_DOWN));
426
- $order->setGrandTotal(round($totals['grand_total']->getValue(),2,PHP_ROUND_HALF_DOWN));
427
- $order->setBaseGrandTotal(round($totals['grand_total']->getValue(),2,PHP_ROUND_HALF_DOWN));
428
- }
429
-
430
- $order->getPayment()->capture(NULL);
431
-
432
- $order->place();
433
- $order->save();
434
- $order->sendNewOrderEmail();
435
-
436
- $quote->setIsActive(false);
437
- $quote->delete();
438
-
439
- $orderAccepted = new OrderAcceptedPayload();
440
- $orderAccepted->ReceiptId = $process->ProcessId();
441
- $orderAccepted->OrderId = $order->getIncrementId();
442
- return $orderAccepted;
443
- }
444
-
445
- public function randomPassword() {
446
- $alphabet = "abcdefghijkmnopqrstuwxyzABCDEFGHJKLMNPQRSTUWXYZ23456789";
447
- $pass='';
448
-
449
- for ($i = 0; $i < 8; $i++) {
450
- $n = rand(0, strlen($alphabet)-1);
451
- $pass .= $alphabet[$n];
452
- }
453
-
454
- return $pass;
455
- }
456
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
  ?>
1
+ <?php
2
+ /*
3
+ Ensygnia Onescan extension
4
+ Copyright (C) 2014 Ensygnia Ltd
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+ require_once(Mage::getBaseDir('lib') . "/Onescan/login/LocalDataFactory.php");
20
+
21
+ class Ensygnia_Onescan_Model_Callback_Purchase extends Ensygnia_Onescan_Model_Callback_Abstract {
22
+ public function getConfigReference() {
23
+ return 'onescan/config_purchase';
24
+ }
25
+
26
+ public function handle() {
27
+ $settings = $this->getConfig()->getSettings();
28
+ if (isset($_GET['basket'])) {
29
+ $settings->OnescanCallbackURL .= '?basket=' . $_GET['basket'];
30
+ }
31
+
32
+ $onescanMessage = Onescan::ReadMessage($settings);
33
+
34
+ $purchaseProcess = new OnescanPurchaseProcess();
35
+ $nextAction = $purchaseProcess->DecodePurchaseMessage($onescanMessage);
36
+ $sessionState = $purchaseProcess->SessionState();
37
+
38
+ switch ($nextAction)
39
+ {
40
+ case PurchaseAction::StartPayment:
41
+ //Mage::log('Start Payment');
42
+ $purchasePayload = $this->BuildPurchasePayload($sessionState->SessionID);
43
+ $purchaseProcess->ProcessStartPurchase($purchasePayload);
44
+ break;
45
+ case PurchaseAction::AdditionalCharges:
46
+ //Mage::log('Additional Charges');
47
+ $purchaseProcess->DecodeAdditionalChargesRequest($onescanMessage);
48
+ $additionalChargesPayload = $this->BuildAdditionalCharges($purchaseProcess);
49
+ $purchaseProcess->ProcessAdditionalCharges($additionalChargesPayload);
50
+ break;
51
+ case PurchaseAction::PaymentConfirmed:
52
+ //Mage::log('Payment Confirmed');
53
+ $purchaseProcess->DecodePaymentConfirmed($onescanMessage);
54
+ $orderAcceptedPayload = $this->BuildOrderAccepted($purchaseProcess);
55
+ $purchaseProcess->ProcessPaymentConfirmed($orderAcceptedPayload);
56
+ break;
57
+ case PurchaseAction::PaymentFailed:
58
+ //Mage::log('Payment Failed');
59
+ $purchaseProcess->ProcessPaymentFailed();
60
+ break;
61
+ case PurchaseAction::PaymentCancelled:
62
+ //Mage::log('Payment Cancelled');
63
+ $purchaseProcess->ProcessPaymentCancelled();
64
+ break;
65
+ }
66
+ $responseMessage = $purchaseProcess->EncodeOutcome();
67
+
68
+ Onescan::SendMessage($responseMessage,$settings);
69
+
70
+ return parent::handle();
71
+ }
72
+
73
+ /// <summary>
74
+ /// Build some extra information about further charges.
75
+ /// </summary>
76
+ public function BuildAdditionalCharges($process) {
77
+ $additionalChargesContext = $process->AdditionalChargesContext;
78
+ $requires=$process->PurchaseInfo->Requires;
79
+ $purchaseCharges = new AdditionalChargesPayload();
80
+
81
+ if ($requires->DeliveryOptions && !empty($additionalChargesContext->DeliveryAddress))
82
+ $this->AddDeliveryCharges($additionalChargesContext->DeliveryAddress,$purchaseCharges,$process);
83
+
84
+ if ($requires->Surcharges && !empty($additionalChargesContext->PaymentMethod))
85
+ $this->AddPaymentMethodCharges($additionalChargesContext->PaymentMethod,$purchaseCharges,$process);
86
+
87
+ return $purchaseCharges;
88
+ }
89
+
90
+ /// <summary>
91
+ /// Add charges for the specified payment method.
92
+ /// </summary>
93
+ public function AddPaymentMethodCharges($paymentMethod,$purchaseCharges,$process) {
94
+ switch ($paymentMethod->PaymentMethodType) {
95
+ case 'CreditCard':
96
+ $this->HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process);
97
+ break;
98
+ case 'OnescanPlay':
99
+ $this->HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process);
100
+ break;
101
+ }
102
+ }
103
+
104
+ /// <summary>
105
+ /// Handle charges for the onescan test card.
106
+ /// </summary>
107
+ public function HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process) {
108
+ $cardDetails = $paymentMethod->CardInformation;
109
+
110
+ $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
111
+ $purchaseCharges->PaymentMethodCharge->Code = "PLAY";
112
+ $purchaseCharges->PaymentMethodCharge->Description = "The onescan play card attracts a £1 surcharge";
113
+ $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
114
+ $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = 1.00;
115
+ $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
116
+ $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = 1.00;
117
+ }
118
+
119
+ /// <summary>
120
+ /// Handle charges for credit cards
121
+ /// </summary>
122
+ public function HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process) {
123
+ $cardDetails = $paymentMethod->CardInformation;
124
+
125
+ if ($cardDetails->PaymentSystemCode == "VISA") {
126
+
127
+ $surcharge = round($process->PurchaseInfo->PaymentAmount * 0.01, 2);
128
+
129
+ $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
130
+ $purchaseCharges->PaymentMethodCharge->Code = "VISA";
131
+ $purchaseCharges->PaymentMethodCharge->Description = "Paying with a credit card attracts a 1% charge";
132
+ $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
133
+ $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = $surcharge;
134
+ $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
135
+ $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = $surcharge;
136
+ }
137
+ }
138
+
139
+ /// <summary>
140
+ /// Add delivery charges for the specified address.
141
+ /// </summary>
142
+ public function AddDeliveryCharges($address,$purchaseCharges,$process) {
143
+ $onescanModel=Mage::getModel('onescan/sessiondata');
144
+ $onescanData = $onescanModel->getCollection();
145
+ $onescanData->addFieldToFilter('sessionid', array('like' => $process->SessionState()->SessionID));
146
+ $onescanData->load();
147
+ $sessionData=$onescanData->getData();
148
+ $quoteid=$sessionData[0]['quoteid'];
149
+
150
+ /*if (Mage::registry('checkout_addShipping')) {
151
+ Mage::unregister('checkout_addShipping');
152
+ return;
153
+ }
154
+ Mage::register('checkout_addShipping',true);*/
155
+
156
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
157
+ $cart->setQuoteId($quoteid);
158
+ $quote=$cart->getQuote();
159
+
160
+ $countryCode=Mage::app()->getLocale()->getCountryTranslation(Mage::getStoreConfig('general/country/default'));
161
+ /*if ($quote->getCouponCode() != '') {
162
+ $c = Mage::getResourceModel('salesrule/rule_collection');
163
+ $c->getSelect()->where("code=?", $quote->getCouponCode());
164
+ foreach ($c->getItems() as $item) {
165
+ $coupon = $item;
166
+ }
167
+ if ($coupon->getSimpleFreeShipping() > 0) {
168
+ $quote->getShippingAddress()->setShippingMethod($this->_shippingCode)->save();
169
+ return true;
170
+ }
171
+ }*/
172
+ try {
173
+ if ($quote->getShippingAddress()->getCountryId() == '') {
174
+ $quote->getShippingAddress()->setCountryId($countryCode);
175
+ }
176
+ $quote->collectTotals();
177
+
178
+ $quote->getShippingAddress()->setCollectShippingRates(true);
179
+ $quote->getShippingAddress()->collectShippingRates();
180
+ $rates = $quote->getShippingAddress()->getShippingRatesCollection();
181
+ }
182
+ catch (Mage_Core_Exception $e) {
183
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
184
+ }
185
+ catch (Exception $e) {
186
+ Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Load customer quote error'));
187
+ }
188
+
189
+ $allowedRates=array();
190
+ $lowestPrice=99999;
191
+ foreach ($rates as $rate){
192
+ $rateCode=$rate->getCode();
193
+ if($quote->getShippingAddress()->collectShippingRates()->getShippingRateByCode($rateCode)){
194
+ $allowedRates[$rateCode]=$rate; //Using $rateCode as key removes duplicates
195
+ }
196
+
197
+ //Set the lowest rate as the default
198
+ if($rate->getPrice()<$lowestPrice){
199
+ $lowestPrice=$rate->getPrice();
200
+ $defaultCode=$rateCode;
201
+ }
202
+ }
203
+
204
+ $purchaseCharges->DeliveryOptions = array();
205
+ $taxCalculation = Mage::getModel('tax/calculation');
206
+ $request = $taxCalculation->getRateRequest(null,null,null,$quote->getStore());
207
+ $taxRateId = Mage::getStoreConfig('tax/classes/shipping_tax_class',$quote->getStore());
208
+ $shippingTaxPercent = $taxCalculation->getRate($request->setProductClassId($taxRateId));
209
+
210
+ $defaultIndex=0;
211
+ foreach ($rates as $rate) {
212
+ $amount=$rate->getPrice();
213
+ if(is_numeric($amount)){
214
+ $option=new DeliveryOption();
215
+ $option->Code = $rate->getCode();
216
+ $option->Description = $rate->getMethodDescription();
217
+ if($option->Code==$defaultCode){
218
+ $option->IsDefault = true;
219
+ $defaultIndex=count($purchaseCharges->DeliveryOptions);
220
+ }
221
+ $option->Label = $rate->getMethodTitle();
222
+ $option->Charge = new Charge();
223
+ $option->Charge->TotalAmount = $amount;
224
+ $option->Charge->Tax = $amount-($amount*100)/(100+$shippingTaxPercent);
225
+ $option->Charge->BaseAmount = $amount-$option->Charge->Tax;
226
+ $purchaseCharges->DeliveryOptions[]=$option;
227
+ }
228
+ }
229
+
230
+ //Make sure the default rate is listed first
231
+ $option=$purchaseCharges->DeliveryOptions[$defaultIndex];
232
+ $purchaseCharges->DeliveryOptions[$defaultIndex]=$purchaseCharges->DeliveryOptions[0];
233
+ $purchaseCharges->DeliveryOptions[0]=$option;
234
+
235
+ $onescanModel->setId($sessionData[0]['sessiondata_id']);
236
+ $onescanModel->setSessionid($process->SessionState()->SessionID);
237
+ $onescanModel->setQuoteid($quoteid);
238
+ $onescanModel->setCustomerid($sessionData[0]['customerid']);
239
+ $onescanModel->setShippingmethod($option->Code);
240
+ $onescanModel->setShippingamount($option->Charge->TotalAmount * 100);//Floating point numbers are being stored as integers!
241
+ $onescanModel->setShippingtax($option->Charge->Tax * 100);//Floating point numbers are being stored as integers!
242
+ $onescanModel->save();
243
+ }
244
+
245
+ public function BuildPurchasePayload($sessionID) {
246
+ $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
247
+ $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
248
+ $onescanData->load();
249
+ $sessionData=$onescanData->getData();
250
+ $quoteid=$sessionData[0]['quoteid'];
251
+
252
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
253
+ $cart->setQuoteId($quoteid);
254
+
255
+ $quote=$cart->getQuote();
256
+ $quote->reserveOrderId();
257
+ $quote->save();
258
+
259
+ $storeid=$quote->getStoreId();
260
+ $totals=$quote->getTotals();
261
+
262
+ $payload = new PurchasePayload();
263
+ $payload->RequiresDeliveryAddress = true;
264
+ $payload->MerchantName = Mage::app()->getStore()->getFrontendName();
265
+ $payload->MerchantTransactionID = GUID();
266
+ $payload->PurchaseDescription = Mage::getStoreConfig('onescantab/general/onescan_basket-name');
267
+
268
+ if(isset($totals['tax']) && $totals['tax']->getValue()) {
269
+ $payload->Tax = $totals['tax']->getValue();
270
+ } else {
271
+ $payload->Tax = 0;
272
+ }
273
+ $payload->ProductAmount = $totals['subtotal']->getValue()-$payload->Tax;
274
+ $payload->PaymentAmount = $totals['grand_total']->getValue();
275
+ $payload->Currency = Mage::app()->getStore($storeid)->getCurrentCurrencyCode();
276
+
277
+ $payload->Requires = new PaymentOptIns();
278
+
279
+ $payload->Requires->Surcharges = false;
280
+ $payload->Requires->DeliveryOptions=true;
281
+
282
+ $payload->ImageData = Mage::getStoreConfig('onescantab/general/onescan_basket-logo-url');
283
+
284
+ return $payload;
285
+ }
286
+
287
+ public function BuildOrderAccepted($process) {
288
+ $sessionState=$process->SessionState();
289
+ $sessionID = $sessionState->SessionID;
290
+
291
+ $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
292
+ $onescanData->addFieldToFilter('sessionid', array('like' => $process->SessionState()->SessionID));
293
+ $onescanData->load();
294
+ $sessionData=$onescanData->getData();
295
+
296
+ $quoteid=$sessionData[0]['quoteid'];
297
+ $customerid=$sessionData[0]['customerid'];
298
+ $shippingMethod=$sessionData[0]['shippingmethod'];
299
+ $shippingAmount=round($sessionData[0]['shippingamount'],2,PHP_ROUND_HALF_DOWN)/100;//Floating point numbers are being stored as integers!
300
+ $shippingTax=round($sessionData[0]['shippingtax'],2,PHP_ROUND_HALF_DOWN)/100;//Floating point numbers are being stored as integers!
301
+
302
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
303
+ $cart->setQuoteId($quoteid);
304
+ $totals=$cart->getQuote()->getTotals();
305
+ $quote=$cart->getQuote();
306
+
307
+ //TEMPORARY FIX FOR BLANK FIRST AND LAST NAMES
308
+ if ($process->PaymentConfirmation->FirstName=="") {
309
+ $process->PaymentConfirmation->FirstName="First";
310
+ }
311
+ if ($process->PaymentConfirmation->LastName=="") {
312
+ $process->PaymentConfirmation->LastName="Last";
313
+ }
314
+
315
+ if ($customerid) {
316
+ // We are already logged in:
317
+ $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->load($customerid);
318
+ $quote->assignCustomer($customer);
319
+ } else {
320
+ $loginTokens = Mage::getModel('onescan/logintokens')->getCollection();
321
+ $loginTokens->addFieldToFilter('onescantoken', array('like' => $process->UserToken));
322
+ $loginTokens->load();
323
+ $details=$loginTokens->getData();
324
+ $customer = Mage::getModel('customer/customer');
325
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
326
+ if (empty($details)) {
327
+ //We do not recognise the user token, so we create an account and log in
328
+ $customer->loadByEmail($process->PaymentConfirmation->UserEmail);
329
+
330
+ if(!$customer->getId()) {
331
+ //New customer registration
332
+ $customer->setEmail($process->PaymentConfirmation->UserEmail);
333
+ $customer->setFirstname($process->PaymentConfirmation->FirstName);
334
+ $customer->setLastname($process->PaymentConfirmation->LastName);
335
+ $customer->setPassword($this->randomPassword());
336
+ try {
337
+ $customer->save();
338
+ if (Mage::getStoreConfig('onescantab/general/onescan_skip-confirmation') || !$customer->isConfirmationRequired()) {
339
+ $customer->setConfirmation(null);
340
+ $customer->save();
341
+ $customer->sendNewAccountEmail(
342
+ 'registered',
343
+ '',
344
+ Mage::app()->getStore()->getId()
345
+ );
346
+ $confirmMessage=false;
347
+ } else {
348
+ $customer->sendNewAccountEmail(
349
+ 'confirmation',
350
+ $session->getBeforeAuthUrl(),
351
+ Mage::app()->getStore()->getId()
352
+ );
353
+ $confirmMessage=true;
354
+ }
355
+
356
+ $newToken=Mage::getModel('onescan/logintokens');
357
+ $newToken->setOnescantoken($process->UserToken);
358
+ $newToken->setMagentouserid($customer->getId());
359
+ $newToken->save();
360
+
361
+ $message=Mage::getStoreConfig('onescantab/general/onescan_register-success-message');
362
+
363
+ if ($confirmMessage) {
364
+ $value=Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
365
+ $message = Mage::helper('customer')->__(Mage::getStoreConfig('onescantab/general/onescan_email-not-confirmed-message'),$value);
366
+ }
367
+
368
+ LocalDataFactory::storeObject($sessionID,$customer->getId());
369
+ LocalDataFactory::storeObject($sessionID . '-message',$message);
370
+ }
371
+ catch (Mage_Core_Exception $e) {
372
+ LocalDataFactory::storeObject($sessionID . '-message',$e->getMessage());
373
+ }
374
+ } else { //Email address recognised so redirect to login page
375
+ LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_email-exists-message'));
376
+ }
377
+ } else {
378
+ //We recognise the user token, so we can log in
379
+ $customer->load($details[0]['magentouserid']);
380
+ LocalDataFactory::storeObject($sessionID,$details[0]['magentouserid']);
381
+ LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_login-success-message'));
382
+ }
383
+ $quote->assignCustomer($customer);
384
+ }
385
+
386
+ $country=Mage::app()->getLocale()->getCountryTranslation(Mage::getStoreConfig('general/country/default'));
387
+ $addressData = array(
388
+ 'firstname' => $process->PaymentConfirmation->FirstName,
389
+ 'lastname' => $process->PaymentConfirmation->LastName,
390
+ 'street' => $process->PaymentConfirmation->DeliveryAddress->AddressLine1 . ', ' . $process->PaymentConfirmation->DeliveryAddress->AddressLine2,
391
+ 'city' => $process->PaymentConfirmation->DeliveryAddress->Town,
392
+ 'postcode' => $process->PaymentConfirmation->DeliveryAddress->Postcode,
393
+ 'telephone' => '0',
394
+ 'country_id' => $country,
395
+ 'region_id' => 0,
396
+ );
397
+ $quote->getShippingAddress()->collectTotals();
398
+
399
+ $billingAddress = $quote->getBillingAddress()->addData($addressData);
400
+ $shippingAddress = $quote->getShippingAddress()->addData($addressData);
401
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
402
+ ->setShippingMethod($shippingMethod)
403
+ ->setPaymentMethod('onescan');
404
+
405
+ $quote->collectTotals();
406
+
407
+ $quote->getPayment()->importData(array('method' => 'onescan'));
408
+
409
+ foreach($quote->getAllItems() as $item){
410
+ $totalPrice=round($item->getProduct()->getFinalPrice(),2,PHP_ROUND_HALF_DOWN)*$item->getQty();
411
+ $taxAmount=round($totalPrice-$item->getPrice(),2,PHP_ROUND_HALF_DOWN);
412
+ $item->setTaxAmount($taxAmount);
413
+ $item->setTaxPercent(round($taxAmount*100/($totalPrice-$taxAmount),2));
414
+ }
415
+
416
+ //Add postage to quote
417
+ $totals['grand_total']->setValue(round($totals['grand_total']->getValue(),2,PHP_ROUND_HALF_DOWN));
418
+
419
+ $quote->setIsActive(0);
420
+ $quote->save();
421
+
422
+ $service = Mage::getModel('sales/service_quote', $quote);
423
+ $service->submitAll();
424
+ $order = $service->getOrder();
425
+
426
+ $order->setShippingMethod($shippingMethod);
427
+
428
+ $amountCharged=$process->PaymentConfirmation->AmountCharged;
429
+ $order ->setSubtotal($amountCharged->BasketAmount)
430
+ ->setSubtotalIncludingTax($amountCharged->BasePaymentAmount)
431
+ ->setBaseSubtotal($amountCharged->BasketAmount)
432
+ ->setGrandTotal($amountCharged->PaymentAmount)
433
+ ->setBaseGrandTotal($amountCharged->PaymentAmount)
434
+ ->setBaseTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN))
435
+ ->setTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN));
436
+
437
+
438
+ /*$order->setTaxAmount($process->PaymentConfirmation->AmountCharged->BasketTax+$shippingTax);
439
+ $order->setBaseTaxAmount($process->PaymentConfirmation->AmountCharged->BasketTax+$shippingTax);
440
+ $order->setSubtotalIncludingTax($process->PaymentConfirmation->Amou)
441
+ $order->setGrandTotal($process->PaymentConfirmation->AmountCharged->PaymentAmount);
442
+ $order->setBaseGrandTotal($process->PaymentConfirmation->AmountCharged->PaymentAmount);*/
443
+
444
+ $order->getPayment()->capture();
445
+
446
+ $order->place();
447
+ $order->save();
448
+ $order->sendNewOrderEmail();
449
+
450
+ $quote->setIsActive(false);
451
+ $quote->delete();
452
+
453
+ $orderAccepted = new OrderAcceptedPayload();
454
+ $orderAccepted->ReceiptId = $process->ProcessId();
455
+ $orderAccepted->OrderId = $order->getIncrementId();
456
+ return $orderAccepted;
457
+ }
458
+
459
+ public function randomPassword() {
460
+ $alphabet = "abcdefghijkmnopqrstuwxyzABCDEFGHJKLMNPQRSTUWXYZ23456789";
461
+ $pass='';
462
+
463
+ for ($i = 0; $i < 8; $i++) {
464
+ $n = rand(0, strlen($alphabet)-1);
465
+ $pass .= $alphabet[$n];
466
+ }
467
+
468
+ return $pass;
469
+ }
470
+ }
471
  ?>
app/code/local/Ensygnia/Onescan/etc/adminhtml.xml CHANGED
@@ -1,3 +1,4 @@
 
1
  <!--
2
  Ensygnia Onescan extension
3
  Copyright (C) 2014 Ensygnia Ltd
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
app/code/local/Ensygnia/Onescan/etc/config.xml CHANGED
@@ -1,3 +1,4 @@
 
1
  <!--
2
  Ensygnia Onescan extension
3
  Copyright (C) 2014 Ensygnia Ltd
@@ -18,7 +19,7 @@
18
  <config>
19
  <modules>
20
  <Ensygnia_Onescan>
21
- <version>1.0.2</version>
22
  </Ensygnia_Onescan>
23
  </modules>
24
  <global>
@@ -65,6 +66,7 @@
65
  <onescan_account></onescan_account>
66
  <onescan_secret></onescan_secret>
67
  <onescan_serverurl>https://liveservice.ensygnia.net/api/PartnerGateway/1/</onescan_serverurl>
 
68
  <onescan_register-success-message>You have successfully registered using Onescan. We have sent you an email with your login details should you ever need to log in "manually".</onescan_register-success-message>
69
  <onescan_skip-confirmation>1</onescan_skip-confirmation>
70
  <onescan_email-exists-message>Email address already registered, please log in using Onescan.</onescan_email-exists-message>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
19
  <config>
20
  <modules>
21
  <Ensygnia_Onescan>
22
+ <version>1.0.5</version>
23
  </Ensygnia_Onescan>
24
  </modules>
25
  <global>
66
  <onescan_account></onescan_account>
67
  <onescan_secret></onescan_secret>
68
  <onescan_serverurl>https://liveservice.ensygnia.net/api/PartnerGateway/1/</onescan_serverurl>
69
+ <onescan_basket-logo-url>http://www.ensygnia.com/wp-content/themes/onescan_v3/logo-ensygnia.png</onescan_basket-logo-url>
70
  <onescan_register-success-message>You have successfully registered using Onescan. We have sent you an email with your login details should you ever need to log in "manually".</onescan_register-success-message>
71
  <onescan_skip-confirmation>1</onescan_skip-confirmation>
72
  <onescan_email-exists-message>Email address already registered, please log in using Onescan.</onescan_email-exists-message>
app/code/local/Ensygnia/Onescan/etc/system.xml CHANGED
@@ -1,3 +1,4 @@
 
1
  <!--
2
  Ensygnia Onescan extension
3
  Copyright (C) 2014 Ensygnia Ltd
@@ -79,6 +80,15 @@
79
  <show_in_website>1</show_in_website>
80
  <show_in_store>1</show_in_store>
81
  </onescan_serverurl>
 
 
 
 
 
 
 
 
 
82
  <onescan_register-success-message translate="label comment">
83
  <label>Register Success Message</label>
84
  <comment>Message to show after a successful registration</comment>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
80
  <show_in_website>1</show_in_website>
81
  <show_in_store>1</show_in_store>
82
  </onescan_serverurl>
83
+ <onescan_basket-logo-url translate="label comment">
84
+ <label>Basket Logo URL</label>
85
+ <comment>Basket logo URL - logo to appear on the Onescanner's device, 128px wide works best</comment>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>45</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </onescan_basket-logo-url>
92
  <onescan_register-success-message translate="label comment">
93
  <label>Register Success Message</label>
94
  <comment>Message to show after a successful registration</comment>
app/code/local/Ensygnia/Onescan/etc/widget.xml CHANGED
@@ -1,3 +1,4 @@
 
1
  <!--
2
  Ensygnia Onescan extension
3
  Copyright (C) 2014 Ensygnia Ltd
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
app/code/local/Ensygnia/Onescan/sql/onescan_setup/install-1.0.0.php CHANGED
@@ -1,65 +1,66 @@
1
- <?php
2
- /*
3
- Ensygnia Onescan extension
4
- Copyright (C) 2014 Ensygnia Ltd
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
- $installer = $this;
20
- $installer->startSetup();
21
-
22
- $sessionDataTable = $installer->getConnection()->newTable($installer->getTable('onescan/sessiondata'))
23
- ->addColumn('sessiondata_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
24
- 'unsigned' => true,
25
- 'nullable' => false,
26
- 'primary' => true,
27
- 'identity' => true,
28
- ), 'Session Data ID')
29
- ->addColumn('sessionid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
30
- 'nullable' => false,
31
- ), 'Session ID')
32
- ->addColumn('quoteid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
33
- 'nullable' => false,
34
- ), 'Quote ID')
35
- ->addColumn('customerid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
36
- 'nullable' => true,
37
- ), 'Customer ID')
38
- ->addColumn('shippingmethod', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
39
- 'nullable' => true,
40
- ), 'Shipping Method')
41
- ->addColumn('shippingrate', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
42
- 'unsigned' => true,
43
- 'nullable' => true,
44
- ), 'Shipping Rate')
45
- ->setComment('Ensygnia onescan/sessiondata entity table');
46
- $installer->getConnection()->createTable($sessionDataTable);
47
-
48
- $LoginTokensTable = $installer->getConnection()->newTable($installer->getTable('onescan/logintokens'))
49
- ->addColumn('logintoken_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
50
- 'unsigned' => true,
51
- 'nullable' => false,
52
- 'primary' => true,
53
- 'identity' => true,
54
- ), 'Login Token ID')
55
- ->addColumn('onescantoken', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
56
- 'nullable' => false,
57
- ), 'Onescan Token')
58
- ->addColumn('magentouserid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
59
- 'nullable' => false,
60
- ), 'Magento Userid')
61
- ->setComment('Ensygnia onescan/logintokens entity table');
62
- $installer->getConnection()->createTable($LoginTokensTable);
63
-
64
- $installer->endSetup();
 
65
  ?>
1
+ <?php
2
+ /*
3
+ Ensygnia Onescan extension
4
+ Copyright (C) 2014 Ensygnia Ltd
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+ $installer = $this;
20
+ $installer->startSetup();
21
+
22
+ $sessionDataTable = $installer->getConnection()->newTable($installer->getTable('onescan/sessiondata'))
23
+ ->addColumn('sessiondata_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
24
+ 'unsigned' => true,
25
+ 'nullable' => false,
26
+ 'primary' => true,
27
+ 'identity' => true,
28
+ ), 'Session Data ID')
29
+ ->addColumn('sessionid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
30
+ 'nullable' => false,
31
+ ), 'Session ID')
32
+ ->addColumn('quoteid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
33
+ 'nullable' => false,
34
+ ), 'Quote ID')
35
+ ->addColumn('customerid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
36
+ 'nullable' => true,
37
+ ), 'Customer ID')
38
+ ->addColumn('shippingmethod', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
39
+ 'nullable' => true,
40
+ ), 'Shipping Method')
41
+ ->addColumn($installer->getTable('onescan/sessiondata'),
42
+ 'shippingrate', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
43
+ 'unsigned' => true,
44
+ 'nullable' => false,
45
+ ), 'Shipping Rate')
46
+ ->setComment('Ensygnia onescan/sessiondata entity table');
47
+ $installer->getConnection()->createTable($sessionDataTable);
48
+
49
+ $LoginTokensTable = $installer->getConnection()->newTable($installer->getTable('onescan/logintokens'))
50
+ ->addColumn('logintoken_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
51
+ 'unsigned' => true,
52
+ 'nullable' => false,
53
+ 'primary' => true,
54
+ 'identity' => true,
55
+ ), 'Login Token ID')
56
+ ->addColumn('onescantoken', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
57
+ 'nullable' => false,
58
+ ), 'Onescan Token')
59
+ ->addColumn('magentouserid', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
60
+ 'nullable' => false,
61
+ ), 'Magento Userid')
62
+ ->setComment('Ensygnia onescan/logintokens entity table');
63
+ $installer->getConnection()->createTable($LoginTokensTable);
64
+
65
+ $installer->endSetup();
66
  ?>
app/code/local/Ensygnia/Onescan/sql/onescan_setup/upgrade-1.0.4-1.0.5.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $sessionDataTable = $installer->getConnection()
6
+ ->addColumn($installer->getTable('onescan/sessiondata'),
7
+ 'shippingamount', array(
8
+ 'type' => Varien_Db_Ddl_Table::TYPE_FLOAT,
9
+ 'nullable' => false,
10
+ 'default' => 0,
11
+ 'comment' => 'Shipping Amount'));
12
+ $sessionDataTable = $installer->getConnection()
13
+ ->addColumn($installer->getTable('onescan/sessiondata'),
14
+ 'shippingtax', array(
15
+ 'type' => Varien_Db_Ddl_Table::TYPE_FLOAT,
16
+ 'nullable' => false,
17
+ 'default' => 0,
18
+ 'comment' => 'Shipping Tax'));
19
+
20
+ $installer->endSetup();
21
+ ?>
app/design/adminhtml/default/default/layout/onescan.xml CHANGED
@@ -1,4 +1,4 @@
1
- <?xml version="1.0"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
app/design/frontend/base/default/layout/onescan.xml CHANGED
@@ -1,3 +1,4 @@
 
1
  <!--
2
  Ensygnia Onescan extension
3
  Copyright (C) 2014 Ensygnia Ltd
@@ -20,20 +21,6 @@
20
  <reference name="head">
21
  <action method="addCss" ifconfig="onescantab/general/enabled"><stylesheet>css/onescan.css</stylesheet></action>
22
  <action method="addItem" ifconfig="onescantab/general/enabled"><type>skin_js</type><name>js/onescan.js</name></action>
23
-
24
- <block type="core/text" name="ensygnia.onescan">
25
- <action method="setText" ifconfig="onescantab/general/enabled">
26
- <text>
27
- <![CDATA[
28
- <script type="text/javascript" src="//ensygniaresources.ensygnia.net/onescan/latest/scripts/jquery-1.7.1.min.js"></script>
29
- <script type="text/javascript">
30
- $.noConflict();
31
- </script>
32
- <script type="text/javascript" src="//ensygniaresources.ensygnia.net/onescan/latest/scripts/onescan.js"></script>
33
- ]]>
34
- </text>
35
- </action>
36
- </block>
37
  </reference>
38
 
39
  <!-- we don't attach this to anything, it's just created in the root so we can conditionally attach it later -->
@@ -50,7 +37,7 @@
50
  <label>Onescan basket module</label>
51
  </block>
52
 
53
- <block type="checkout/cart_totals" name="onescan.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
54
 
55
  <block type="onescan/logo" name="onescan.logo" as="onescanlogo" translate="label" template="onescan/logo.phtml">
56
  <label>Onescan logo</label>
@@ -93,4 +80,4 @@
93
  <action method="append"><block>onescan.login</block></action>
94
  </reference>
95
  </customer_account_login>
96
- </layout>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
21
  <reference name="head">
22
  <action method="addCss" ifconfig="onescantab/general/enabled"><stylesheet>css/onescan.css</stylesheet></action>
23
  <action method="addItem" ifconfig="onescantab/general/enabled"><type>skin_js</type><name>js/onescan.js</name></action>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  </reference>
25
 
26
  <!-- we don't attach this to anything, it's just created in the root so we can conditionally attach it later -->
37
  <label>Onescan basket module</label>
38
  </block>
39
 
40
+ <block type="checkout/cart_totals" name="onescan.cart.totals" as="totals" template="checkout/cart/totals.phtml"></block>
41
 
42
  <block type="onescan/logo" name="onescan.logo" as="onescanlogo" translate="label" template="onescan/logo.phtml">
43
  <label>Onescan logo</label>
80
  <action method="append"><block>onescan.login</block></action>
81
  </reference>
82
  </customer_account_login>
83
+ </layout>
app/design/frontend/base/default/template/onescan/basket.phtml CHANGED
@@ -31,8 +31,10 @@
31
 
32
  <div class="block-content">
33
  <?php if ($this->hasItems()) { ?>
34
- <div id="onescanPadlock_basket<?php echo $basketPadlockCount; ?>" class="onescanPadlock_basket onescanpadlock" data-sessionurl="<?php echo $this->getOnescanHelper()->getSessionFromBasketUrl() . '?basket=' . $basketPadlockCount; ?>" data-postconfirm="postConfirm(<?php echo $basketPadlockCount; ?>);" data-postfailed="postFailed();" data-polltarget="<?php echo $this->getOnescanHelper()->getSessionPollUrl(); ?>">
35
-
 
 
36
  </div>
37
  <?php } ?>
38
  </div>
31
 
32
  <div class="block-content">
33
  <?php if ($this->hasItems()) { ?>
34
+ <div id="onescanPadlock_basket<?php echo $basketPadlockCount; ?>" class="onescanPadlock_basket onescanpadlock"
35
+ data-sessionurl="<?php echo $this->getOnescanHelper()->getSessionFromBasketUrl() . '?basket=' . $basketPadlockCount; ?>"
36
+ data-postconfirm="postConfirm(<?php echo $basketPadlockCount; ?>);" data-postfailed="postFailed();"
37
+ data-polltarget="<?php echo $this->getOnescanHelper()->getSessionPollUrl(); ?>" data-nonescan="true">
38
  </div>
39
  <?php } ?>
40
  </div>
app/etc/modules/Ensygnia_Onescan.xml CHANGED
@@ -1,3 +1,4 @@
 
1
  <!--
2
  Ensygnia Onescan extension
3
  Copyright (C) 2014 Ensygnia Ltd
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  Ensygnia Onescan extension
4
  Copyright (C) 2014 Ensygnia Ltd
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ensygnia_Onescan</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="https://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
@@ -14,11 +14,16 @@ No usernames and passwords to remember, no security checks to pass, or tiresome
14
  All while improving the security of your site. And the burden of dealing with sensitive financial information is lifted. Payments are confirmed by a tokenised system: at no point do the details need to be shared.&#xD;
15
  &#xD;
16
  Thanks to Onescan, mobile phones become a secure proof of identity. Online, all customers have to do to login, register or even purchase an item is complete one simple scan. We take all the hassle out of online shopping and tear down the barriers between you and your customers.</description>
17
- <notes>Version 1.0.4 of the Onescan Payment Plugin extension.&#xD;
18
  &#xD;
19
  Changelog&#xD;
20
  ---------------&#xD;
21
  &#xD;
 
 
 
 
 
22
  1.0.4&#xD;
23
  Incorrect compatibility information shown on Magento Connect - fixed.&#xD;
24
  &#xD;
@@ -40,9 +45,9 @@ Fixed potential installation problem.&#xD;
40
  1.0.0&#xD;
41
  Initial version.</notes>
42
  <authors><author><name>Ensygnia</name><user>MAG002660123</user><email>paul.newson@ensygnia.com</email></author></authors>
43
- <date>2015-04-14</date>
44
- <time>11:11:44</time>
45
- <contents><target name="magelocal"><dir name="Ensygnia"><dir name="Onescan"><dir name="Block"><file name="Abstract.php" hash="4488b86743ac3cd970d52a4dc857c4d6"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Cta.php" hash="433c964de85d708af211461033f7a5fc"/></dir></dir></dir><file name="Basket.php" hash="438f95ad093d4b5cde252eb4a8661035"/><file name="Login.php" hash="099ce7a3c3b483e0e509357949d0056d"/><file name="Logo.php" hash="fd58bed8012207372450577b137781ea"/><file name="Register.php" hash="a3ce5e2b5d4cb627f23a6d52dc3f5db9"/><dir name="Widget"><file name="Basket.php" hash="95fad0d733885b0c4651d7e41bc0039c"/><file name="Login.php" hash="225660cace8fc351da454b49d887e124"/><file name="Register.php" hash="89a1492f818fc787cdde4f1adc29702b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e5aa3575cebf0069bbf702bde3cc2625"/></dir><dir name="Model"><dir name="Callback"><file name="Abstract.php" hash="31b73999f34ffd0f7e539d9ed6499cce"/><file name="Login.php" hash="94f1d610a7c56a95e10694b58e84de31"/><file name="Purchase.php" hash="ba099bb96388774ff676edd34bb56c3f"/><file name="Registration.php" hash="24fed90927c3a6b72c1503c2e94bce67"/></dir><dir name="Config"><file name="Abstract.php" hash="9e407f490c53651e5fe6b19c92cb5c1a"/><file name="Login.php" hash="6fbec423b7b3c6d72fa6e3b519163cd8"/><file name="Purchase.php" hash="0bd21ab4d83b48a31aa9003b473ed6db"/><file name="Registration.php" hash="4c39c0ee7690abc16c0519d3c950c5cb"/></dir><file name="Logintokens.php" hash="1a61be2e17f8ef9562cc205d525a473c"/><dir name="Method"><file name="Onescan.php" hash="9700daf18892390d3c6c73d1ad9349a9"/></dir><dir name="Resource"><dir name="Logintokens"><file name="Collection.php" hash="3767dcf1cbe12088186664ef7d1be309"/></dir><file name="Logintokens.php" hash="4f0fd6b83ee508a382a442641a357e31"/><dir name="Sessiondata"><file name="Collection.php" hash="0b62795cd0f7f7b6dba3ecf07599a9f6"/></dir><file name="Sessiondata.php" hash="48c60528f7accbf52da25030a7681fc0"/><file name="Setup.php" hash="e09e39a39405ebd80af368fefa013839"/></dir><file name="Sessiondata.php" hash="f5f6c2f7ea7fc3c6f033d5a5ff3b1666"/></dir><dir name="controllers"><file name="CallbackController.php" hash="dbbaebed3d7f7aa4e1431d22e2f6a541"/><file name="IndexController.php" hash="37d200f846305bed89a853d41e8f2c55"/></dir><dir name="etc"><file name="adminhtml.xml" hash="87b27e9403e9d38cf849a8516d83c7e5"/><file name="config.xml" hash="36ca2359ac9e5b7d753e3f331faacbc1"/><file name="system.xml" hash="55ace4f8c5d677fd6a3531f6ad38d775"/><file name="widget.xml" hash="5c078e20e1698f285b3ad987477a0242"/></dir><file name="license.txt" hash="f075d971a6aa12e3ae52489ef961a7f5"/><dir name="sql"><dir name="onescan_setup"><file name="install-1.0.0.php" hash="5e0c3bc48f935bf61b98bfc245585df8"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="onescan.xml" hash="4e44f091546414567a7503d70cb2ace3"/></dir><dir name="template"><dir name="onescan"><dir name="system"><dir name="config"><file name="cta.phtml" hash="c99b3ce3333dbff286f2156a031f5401"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="onescan.xml" hash="0f3e29adb81c7d3434ee0970abf01cf0"/></dir><dir name="template"><dir name="onescan"><file name="basket.phtml" hash="c6b51ae4a94fdaef74d8c49ef128ceab"/><file name="login.phtml" hash="06e2ba3a1101b46050a65553cf5b2758"/><file name="logo.phtml" hash="29e5cb387d8e2aaf676040a2c25b9596"/><file name="register.phtml" hash="17749f596a966ec18933d0c779b8b56b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ensygnia_Onescan.xml" hash="faca8dc3692eb6fefbf410506dd5f905"/></dir></target><target name="magelib"><dir name="Onescan"><dir name="core"><file name="onescan-Exceptions.php" hash="1733a8f40cdc6fbb7a2c77890f0fd197"/><file name="onescan-GUID.php" hash="732799426a921038f30f1485f5cd7264"/><file name="onescan-HMAC.php" hash="797d68c8879ee9574dcb06770947d19b"/><file name="onescan-HTTPClient.php" hash="59eee1d07c3796ad24126c0c85b35086"/><file name="onescan-Login.php" hash="deaf58a3c6c9bc30a0acc4f10d64ade0"/><file name="onescan-Message.php" hash="f978243be9032897fcf1a288a23ce837"/><file name="onescan-Onescan.php" hash="93120300b4add29f3cd44709d8cc32d6"/><file name="onescan-Process.php" hash="86d8ccd62a5261d86ae7c35a099b5c1f"/><file name="onescan-Session.php" hash="a365d6c0fc9d41f603e88384b0c15fea"/><file name="onescan-SessionState.php" hash="a0b3b8d6d8d433551340ede175d094cc"/><file name="onescan-Settings.php" hash="2c62dcbb810b2d1d02f5773db9184408"/></dir><dir name="login"><file name="LocalDataFactory.php" hash="a49582171443ca73b292317e2128e9ac"/><file name="onescan-LoginProcess.php" hash="c3552a34b51e879c535d7b67d541e0fd"/></dir><dir name="purchase"><file name="onescan-AdditionalChargesPayload.php" hash="cb1f2d49d560e1b46b866dffda932111"/><file name="onescan-CardInformation.php" hash="6c2fd7227533dfe986d93bd8bfeb4c1e"/><file name="onescan-CardType.php" hash="8e7765420c6a0de517949393b7360818"/><file name="onescan-Charge.php" hash="285cc0b1f0708f3a3dbc503447b7c0bd"/><file name="onescan-ConfirmPaymentPayload.php" hash="7eda3538cd471c41976732d462a2d84e"/><file name="onescan-CorePurchaseInfo.php" hash="08d943667c901189edaf8dc22406b7d8"/><file name="onescan-DeliveryOption.php" hash="8580b35f993b668c153b6488a9572bd4"/><file name="onescan-OrderAcceptedPayload.php" hash="c007ac8a0a78e51f516f9456d47c0129"/><file name="onescan-OrderDeclinedPayload.php" hash="1cfd9499b9cb167435a33766a5822909"/><file name="onescan-PaymentMethodCharge.php" hash="35f576d4ba1965a5ffc1155d28ba2ceb"/><file name="onescan-PaymentMethodInformation.php" hash="9c332bf6aa9395ec484a13a771101f94"/><file name="onescan-PaymentMethodType.php" hash="df5296173d5a34e55a425810072192dd"/><file name="onescan-PaymentOptins.php" hash="da07521ee0d52657a776ea8ecb705ac0"/><file name="onescan-PurchaseAction.php" hash="ca494c86fe5548b93ba2876a4e3b7aad"/><file name="onescan-PurchaseCharges.php" hash="1b67b353045ea1f93a7b18d2c1940b94"/><file name="onescan-PurchaseContextPayload.php" hash="0bdf109a37bd5104660d13ee3ea42d42"/><file name="onescan-PurchaseInclude.php" hash="a52385a7ceb5f056367a40eaff2a2d32"/><file name="onescan-PurchasePayload.php" hash="0970da6cfc0907c268218501d24f08d1"/><file name="onescan-PurchaseProcess.php" hash="1e9046c659315532197c05d8259d6686"/><file name="onescan-PurchaseSettings.php" hash="f3c3d6776d5da8a616eb417a9728fe61"/><file name="onescan-UserAddress.php" hash="4e1ec23d74d6f192a1edb31f3e3c9c8e"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="onescan"><dir name="css"><file name="onescan.css" hash="1f758b313e54a8782fcc96e34423caf5"/></dir><dir name="images"><file name="logo-sml.png" hash="af6d80c8d752b68ffff5d2cedd60319f"/><file name="logo.png" hash="ad10933575eaa2f9e379c0aad2ac038e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="onescan.css" hash="c649f4ebbe1ccb865f3582e04b842c34"/></dir><dir name="images"><file name="logo.png" hash="658a845e0e5d71fb94c072680a42c74b"/></dir><dir name="js"><file name="onescan.js" hash="6b0f1194e2bf2c0a1e461f2babf74955"/></dir></dir></dir></dir></target></contents>
46
  <compatible/>
47
  <dependencies><required><php><min>5.2.13</min><max>5.6.1</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0.0</min><max>1.9.0.1</max></package></required></dependencies>
48
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ensygnia_Onescan</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="https://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
14
  All while improving the security of your site. And the burden of dealing with sensitive financial information is lifted. Payments are confirmed by a tokenised system: at no point do the details need to be shared.&#xD;
15
  &#xD;
16
  Thanks to Onescan, mobile phones become a secure proof of identity. Online, all customers have to do to login, register or even purchase an item is complete one simple scan. We take all the hassle out of online shopping and tear down the barriers between you and your customers.</description>
17
+ <notes>Version 1.0.5 of the Onescan Payment Plugin extension.&#xD;
18
  &#xD;
19
  Changelog&#xD;
20
  ---------------&#xD;
21
  &#xD;
22
+ 1.0.5&#xD;
23
+ Allows merchant to specify the image that will be displayed on the device during a purchase.&#xD;
24
+ &#xD;
25
+ Under certain circumstances the tax calculation was rounding incorrectly making a &#xA3;0.01 difference between the actual payment and what was recorded in Magento - fixed.&#xD;
26
+ &#xD;
27
  1.0.4&#xD;
28
  Incorrect compatibility information shown on Magento Connect - fixed.&#xD;
29
  &#xD;
45
  1.0.0&#xD;
46
  Initial version.</notes>
47
  <authors><author><name>Ensygnia</name><user>MAG002660123</user><email>paul.newson@ensygnia.com</email></author></authors>
48
+ <date>2015-06-12</date>
49
+ <time>10:05:06</time>
50
+ <contents><target name="magelocal"><dir name="Ensygnia"><dir name="Onescan"><dir name="Block"><file name="Abstract.php" hash="4488b86743ac3cd970d52a4dc857c4d6"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Cta.php" hash="433c964de85d708af211461033f7a5fc"/></dir></dir></dir><file name="Basket.php" hash="438f95ad093d4b5cde252eb4a8661035"/><file name="Login.php" hash="099ce7a3c3b483e0e509357949d0056d"/><file name="Logo.php" hash="fd58bed8012207372450577b137781ea"/><file name="Register.php" hash="a3ce5e2b5d4cb627f23a6d52dc3f5db9"/><dir name="Widget"><file name="Basket.php" hash="95fad0d733885b0c4651d7e41bc0039c"/><file name="Login.php" hash="225660cace8fc351da454b49d887e124"/><file name="Register.php" hash="89a1492f818fc787cdde4f1adc29702b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="6bf2bcc51f0639615a150835c182b014"/></dir><dir name="Model"><dir name="Callback"><file name="Abstract.php" hash="31b73999f34ffd0f7e539d9ed6499cce"/><file name="Login.php" hash="94f1d610a7c56a95e10694b58e84de31"/><file name="Purchase.php" hash="66833954901854d6f23747b70cf19b71"/><file name="Registration.php" hash="24fed90927c3a6b72c1503c2e94bce67"/></dir><dir name="Config"><file name="Abstract.php" hash="9e407f490c53651e5fe6b19c92cb5c1a"/><file name="Login.php" hash="6fbec423b7b3c6d72fa6e3b519163cd8"/><file name="Purchase.php" hash="0bd21ab4d83b48a31aa9003b473ed6db"/><file name="Registration.php" hash="4c39c0ee7690abc16c0519d3c950c5cb"/></dir><file name="Logintokens.php" hash="1a61be2e17f8ef9562cc205d525a473c"/><dir name="Method"><file name="Onescan.php" hash="9700daf18892390d3c6c73d1ad9349a9"/></dir><dir name="Resource"><dir name="Logintokens"><file name="Collection.php" hash="3767dcf1cbe12088186664ef7d1be309"/></dir><file name="Logintokens.php" hash="4f0fd6b83ee508a382a442641a357e31"/><dir name="Sessiondata"><file name="Collection.php" hash="0b62795cd0f7f7b6dba3ecf07599a9f6"/></dir><file name="Sessiondata.php" hash="48c60528f7accbf52da25030a7681fc0"/><file name="Setup.php" hash="e09e39a39405ebd80af368fefa013839"/></dir><file name="Sessiondata.php" hash="f5f6c2f7ea7fc3c6f033d5a5ff3b1666"/></dir><dir name="controllers"><file name="CallbackController.php" hash="dbbaebed3d7f7aa4e1431d22e2f6a541"/><file name="IndexController.php" hash="37d200f846305bed89a853d41e8f2c55"/></dir><dir name="etc"><file name="adminhtml.xml" hash="42e02288cfa5329abafb1ea0a98ef387"/><file name="config.xml" hash="8307f0b3abb60cd60e8a23c9086419c6"/><file name="system.xml" hash="881c1f7c614e7f9caff425a98460d326"/><file name="widget.xml" hash="2a9946cbc623b75b95eaf6d851d73c52"/></dir><file name="license.txt" hash="f075d971a6aa12e3ae52489ef961a7f5"/><dir name="sql"><dir name="onescan_setup"><file name="install-1.0.0.php" hash="6c106d17dae36837efbecc24cac01cc2"/><file name="upgrade-1.0.4-1.0.5.php" hash="c55d900031db2717429a2e575ed4aa59"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="onescan.xml" hash="419c0333c31ba849f2ed2a8ea57cb823"/></dir><dir name="template"><dir name="onescan"><dir name="system"><dir name="config"><file name="cta.phtml" hash="c99b3ce3333dbff286f2156a031f5401"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="onescan.xml" hash="0d24d8a6d9a5f1a8056101dc65b2036f"/></dir><dir name="template"><dir name="onescan"><file name="basket.phtml" hash="d561c70fd9ea873fa2e25f6bd90df1d4"/><file name="login.phtml" hash="06e2ba3a1101b46050a65553cf5b2758"/><file name="logo.phtml" hash="29e5cb387d8e2aaf676040a2c25b9596"/><file name="register.phtml" hash="17749f596a966ec18933d0c779b8b56b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ensygnia_Onescan.xml" hash="d0d96d5e505006873bdb9c1b4f4c591f"/></dir></target><target name="magelib"><dir name="Onescan"><dir name="core"><file name="onescan-Exceptions.php" hash="1733a8f40cdc6fbb7a2c77890f0fd197"/><file name="onescan-GUID.php" hash="732799426a921038f30f1485f5cd7264"/><file name="onescan-HMAC.php" hash="797d68c8879ee9574dcb06770947d19b"/><file name="onescan-HTTPClient.php" hash="59eee1d07c3796ad24126c0c85b35086"/><file name="onescan-Login.php" hash="deaf58a3c6c9bc30a0acc4f10d64ade0"/><file name="onescan-Message.php" hash="f978243be9032897fcf1a288a23ce837"/><file name="onescan-Onescan.php" hash="93120300b4add29f3cd44709d8cc32d6"/><file name="onescan-Process.php" hash="86d8ccd62a5261d86ae7c35a099b5c1f"/><file name="onescan-Session.php" hash="a365d6c0fc9d41f603e88384b0c15fea"/><file name="onescan-SessionState.php" hash="a0b3b8d6d8d433551340ede175d094cc"/><file name="onescan-Settings.php" hash="2c62dcbb810b2d1d02f5773db9184408"/></dir><dir name="login"><file name="LocalDataFactory.php" hash="a49582171443ca73b292317e2128e9ac"/><file name="onescan-LoginProcess.php" hash="c3552a34b51e879c535d7b67d541e0fd"/></dir><dir name="purchase"><file name="onescan-AdditionalChargesPayload.php" hash="cb1f2d49d560e1b46b866dffda932111"/><file name="onescan-CardInformation.php" hash="6c2fd7227533dfe986d93bd8bfeb4c1e"/><file name="onescan-CardType.php" hash="8e7765420c6a0de517949393b7360818"/><file name="onescan-Charge.php" hash="285cc0b1f0708f3a3dbc503447b7c0bd"/><file name="onescan-ConfirmPaymentPayload.php" hash="7eda3538cd471c41976732d462a2d84e"/><file name="onescan-CorePurchaseInfo.php" hash="08d943667c901189edaf8dc22406b7d8"/><file name="onescan-DeliveryOption.php" hash="8580b35f993b668c153b6488a9572bd4"/><file name="onescan-OrderAcceptedPayload.php" hash="c007ac8a0a78e51f516f9456d47c0129"/><file name="onescan-OrderDeclinedPayload.php" hash="1cfd9499b9cb167435a33766a5822909"/><file name="onescan-PaymentMethodCharge.php" hash="35f576d4ba1965a5ffc1155d28ba2ceb"/><file name="onescan-PaymentMethodInformation.php" hash="9c332bf6aa9395ec484a13a771101f94"/><file name="onescan-PaymentMethodType.php" hash="df5296173d5a34e55a425810072192dd"/><file name="onescan-PaymentOptins.php" hash="da07521ee0d52657a776ea8ecb705ac0"/><file name="onescan-PurchaseAction.php" hash="ca494c86fe5548b93ba2876a4e3b7aad"/><file name="onescan-PurchaseCharges.php" hash="1b67b353045ea1f93a7b18d2c1940b94"/><file name="onescan-PurchaseContextPayload.php" hash="0bdf109a37bd5104660d13ee3ea42d42"/><file name="onescan-PurchaseInclude.php" hash="a52385a7ceb5f056367a40eaff2a2d32"/><file name="onescan-PurchasePayload.php" hash="0970da6cfc0907c268218501d24f08d1"/><file name="onescan-PurchaseProcess.php" hash="1e9046c659315532197c05d8259d6686"/><file name="onescan-PurchaseSettings.php" hash="f3c3d6776d5da8a616eb417a9728fe61"/><file name="onescan-UserAddress.php" hash="4e1ec23d74d6f192a1edb31f3e3c9c8e"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="onescan"><dir name="css"><file name="onescan.css" hash="1f758b313e54a8782fcc96e34423caf5"/></dir><dir name="images"><file name="Thumbs.db" hash="0826f6fc160fc67ee19616235ad7a3c1"/><file name="logo-sml.png" hash="af6d80c8d752b68ffff5d2cedd60319f"/><file name="logo.png" hash="ad10933575eaa2f9e379c0aad2ac038e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="onescan.css" hash="c649f4ebbe1ccb865f3582e04b842c34"/></dir><dir name="images"><file name="logo.png" hash="658a845e0e5d71fb94c072680a42c74b"/></dir><dir name="js"><file name="onescan.js" hash="e0571b453ce6fcbed059ec7fbd967e2b"/></dir></dir></dir></dir></target></contents>
51
  <compatible/>
52
  <dependencies><required><php><min>5.2.13</min><max>5.6.1</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0.0</min><max>1.9.0.1</max></package></required></dependencies>
53
  </package>
skin/adminhtml/default/default/onescan/images/Thumbs.db ADDED
Binary file
skin/frontend/base/default/js/onescan.js CHANGED
@@ -30,4 +30,13 @@ function postFailed() {
30
  // Redirect to failure page
31
  alert('Failed!');
32
  //window.location.assign(location.href+'?confirm=false');
33
- }
 
 
 
 
 
 
 
 
 
30
  // Redirect to failure page
31
  alert('Failed!');
32
  //window.location.assign(location.href+'?confirm=false');
33
+ }
34
+
35
+ //*** Add the onescan script to the head section here as <action method="setText" does not work on some installations ***//
36
+
37
+ var scriptElement=document.createElement('script');
38
+ scriptElement.type='text/javascript';
39
+ scriptElement.src='//ensygniaresources.ensygnia.net/onescan/latest/scripts/onescan.js';
40
+
41
+ var headElement=document.getElementsByTagName('head')[0];
42
+ headElement.appendChild(scriptElement);