Ensygnia_Onescan - Version 1.0.13

Version Notes

Version 1.0.13 of the Onescan Payment Extension.

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

1.0.13
Check Magento admin settings to determine whether prices sent to the Onescanner's device should include tax.

Improved efficiency of extension code.

Modified shipping tax calculation to round down so that the amount displayed on the Onescanner's device matches the amount calculated by Magento.

1.0.12
Check Magento database to determine whether country of delivery requires state/region to be present.

Added a new field to the configuration menu that allows the Magento store administrator to specify the message that is sent to the Onescanner's device if the state/region is not recognised.

In some circumstances, the wrong delivery method was being stored in the Magento database

1.0.11
Potential installation issue with some Magento instances fixed.

1.0.10
Purchase failure where delivery is to a country in which Magento requires state/region information to be present - fixed.

Configurable error message added if the Magento store cannot deliver the Onescanner's order to the address supplied by Onescan.

The incorrect URL was being used for the redirect after a successful order in some Magento store configurations - fixed.

1.0.9
Under certain circumstances, shipping charges were being added twice - fixed.

1.0.8
Incorrect country code used in some Magento installations - fixed.

Compatibility issue reported when installing into latest version of Magento - fixed.

1.0.7
Prevented jQuery conflict for older versions of Magento

1.0.6
Potential installation issue with some Magento instances fixed.

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.13
Comparing to
See all releases


Code changes from version 1.0.12 to 1.0.13

app/code/local/Ensygnia/Onescan/Model/Callback/Purchase.php CHANGED
@@ -1,578 +1,562 @@
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
- //Callback entry point
27
- public function handle() {
28
- $settings = $this->getConfig()->getSettings();
29
- if (isset($_GET['basket'])) {
30
- $settings->OnescanCallbackURL .= '?basket=' . $_GET['basket'];
31
- }
32
-
33
- $onescanMessage = Onescan::ReadMessage($settings);
34
- //Mage::log('Message: ' . print_r($onescanMessage,true));
35
-
36
- $purchaseProcess = new OnescanPurchaseProcess();
37
- $nextAction = $purchaseProcess->DecodePurchaseMessage($onescanMessage);
38
- $sessionState = $purchaseProcess->SessionState();
39
-
40
- switch ($nextAction)
41
- {
42
- case PurchaseAction::StartPayment:
43
- //Mage::log('Start Payment');
44
- $purchasePayload = $this->BuildPurchasePayload($sessionState->SessionID);
45
- $purchaseProcess->ProcessStartPurchase($purchasePayload);
46
- break;
47
- case PurchaseAction::AdditionalCharges:
48
- //Mage::log('Additional Charges');
49
- $purchaseProcess->DecodeAdditionalChargesRequest($onescanMessage);
50
- $additionalChargesPayload = $this->BuildAdditionalCharges($purchaseProcess);
51
- $purchaseProcess->ProcessAdditionalCharges($additionalChargesPayload);
52
- break;
53
- case PurchaseAction::PaymentConfirmed:
54
- //Mage::log('Payment Confirmed');
55
- $purchaseProcess->DecodePaymentConfirmed($onescanMessage);
56
- $orderAcceptedPayload = $this->BuildOrderAccepted($purchaseProcess);
57
- $purchaseProcess->ProcessPaymentConfirmed($orderAcceptedPayload);
58
- break;
59
- case PurchaseAction::PaymentFailed:
60
- //Mage::log('Payment Failed');
61
- $purchaseProcess->ProcessPaymentFailed();
62
- break;
63
- case PurchaseAction::PaymentCancelled:
64
- //Mage::log('Payment Cancelled');
65
- $purchaseProcess->ProcessPaymentCancelled();
66
- break;
67
- }
68
- $responseMessage = $purchaseProcess->EncodeOutcome();
69
- //Mage::log('Response: ' . print_r($responseMessage,true));
70
-
71
- Onescan::SendMessage($responseMessage,$settings);
72
- return parent::handle();
73
- }
74
-
75
- /// <summary>
76
- /// Build some extra information about further charges.
77
- /// </summary>
78
- private function BuildAdditionalCharges($process) {
79
- $additionalChargesContext = $process->AdditionalChargesContext;
80
- $requires=$process->PurchaseInfo->Requires;
81
- $purchaseCharges = new AdditionalChargesPayload();
82
-
83
- if ($requires->DeliveryOptions && !empty($additionalChargesContext->DeliveryAddress)){
84
- $deliveryChargesResponse=$this->AddDeliveryCharges($additionalChargesContext->DeliveryAddress,$purchaseCharges,$process);
85
- if($deliveryChargesResponse!==true){
86
- $purchaseCharges->AddressNotSupported=1;
87
- $purchaseCharges->AddressNotSupportedReason=$deliveryChargesResponse;
88
- }
89
- }
90
-
91
- //Surcharges not yet supported
92
- /*if ($requires->Surcharges && !empty($additionalChargesContext->PaymentMethod)){
93
- if(!$this->AddPaymentMethodCharges($additionalChargesContext->PaymentMethod,$purchaseCharges,$process)){
94
- //REPORT SURCHARGES ERROR TO DEVICE;
95
- }
96
- }*/
97
-
98
- return $purchaseCharges;
99
- }
100
-
101
- /// <summary>
102
- /// Add charges for the specified payment method.
103
- /// </summary>
104
- private function AddPaymentMethodCharges($paymentMethod,$purchaseCharges,$process) {
105
- //Surcharges not yet supported, this sample function never gets called
106
- switch ($paymentMethod->PaymentMethodType) {
107
- case 'CreditCard':
108
- $this->HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process);
109
- break;
110
- case 'OnescanPlay':
111
- $this->HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process);
112
- break;
113
- }
114
- return true;
115
- }
116
-
117
- /// <summary>
118
- /// Handle charges for the onescan test card.
119
- /// </summary>
120
- private function HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process) {
121
- //Surcharges not yet supported, this sample function never gets called
122
- $cardDetails = $paymentMethod->CardInformation;
123
-
124
- $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
125
- $purchaseCharges->PaymentMethodCharge->Code = "PLAY";
126
- $purchaseCharges->PaymentMethodCharge->Description = "The onescan play card attracts a £1 surcharge";
127
- $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
128
- $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = 1.00;
129
- $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
130
- $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = 1.00;
131
- }
132
-
133
- /// <summary>
134
- /// Handle charges for credit cards
135
- /// </summary>
136
- private function HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process) {
137
- //Surcharges not yet supported, this sample function never gets called
138
- $cardDetails = $paymentMethod->CardInformation;
139
-
140
- if ($cardDetails->PaymentSystemCode == "VISA") {
141
-
142
- $surcharge = round($process->PurchaseInfo->PaymentAmount * 0.01, 2);
143
-
144
- $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
145
- $purchaseCharges->PaymentMethodCharge->Code = "VISA";
146
- $purchaseCharges->PaymentMethodCharge->Description = "Paying with a credit card attracts a 1% charge";
147
- $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
148
- $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = $surcharge;
149
- $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
150
- $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = $surcharge;
151
- }
152
- }
153
-
154
- /// <summary>
155
- /// Add delivery charges for the specified address.
156
- /// </summary>
157
- private function AddDeliveryCharges($address,$purchaseCharges,$process) {
158
- //Retreive quote from database
159
- $quote=$this->MagentoRetrieveQuote($process->SessionState()->SessionID);
160
-
161
- //Retrieve allowed shipping rates.
162
- $shippingError=false;
163
- $allowedRates=$this->MagentoGetShippingRates($quote,$shippingError,$address);
164
-
165
- //If retrieval of shipping rates was unsuccessful, return the error.
166
- if($shippingError!==false){
167
- return $shippingError;
168
- }
169
-
170
- //Get shipping tax rate
171
- $taxCalculation = Mage::getModel('tax/calculation');
172
- $request = $taxCalculation->getRateRequest(null,null,null,$quote->getStore());
173
- $taxRateId = Mage::getStoreConfig('tax/classes/shipping_tax_class',$quote->getStore());
174
- $shippingTaxPercent = $taxCalculation->getRate($request->setProductClassId($taxRateId));
175
-
176
- //Build delivery options array to pass back to Onescan
177
- $purchaseCharges->DeliveryOptions = array();
178
- foreach ($allowedRates as $rate) {
179
- $amount=$rate->getPrice();
180
- if(is_numeric($amount)){
181
- $option=new DeliveryOption();
182
- $option->Code = $rate->getCode();
183
- $option->Description = $rate->getMethodDescription();
184
- //Setting default option is not yet supported in the Onescan extension
185
- /*if($option->Code==$defaultCode){
186
- $option->IsDefault = true;
187
- }*/
188
- $option->Label = $rate->getMethodTitle();
189
- $option->Charge = new Charge();
190
- $option->Charge->TotalAmount = $amount;
191
- $option->Charge->Tax = $amount-($amount*100)/(100+$shippingTaxPercent);
192
- $option->Charge->BaseAmount = $amount-$option->Charge->Tax;
193
- $purchaseCharges->DeliveryOptions[]=$option;
194
- }
195
- }
196
-
197
- if(count($purchaseCharges->DeliveryOptions)==0){
198
- //No shipping rates available for this order, return an error
199
- return Mage::getStoreConfig('onescantab/general/onescan_cannot-deliver-message');
200
- }
201
-
202
- //Retreive Onescan data from database
203
- $sessionID = $process->SessionState()->SessionID;
204
-
205
- $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
206
- $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
207
- $onescanData->load();
208
- $sessionData=$onescanData->getData();
209
-
210
- //Save details to Onescan database tables for later retrieval
211
- $onescanModel=Mage::getModel('onescan/sessiondata');
212
- $onescanModel->setId($sessionData[0]['sessiondata_id']);
213
- $onescanModel->setSessionid($process->SessionState()->SessionID);
214
- $onescanModel->setQuoteid($quote->getId());
215
- $onescanModel->setCustomerid($sessionData[0]['customerid']);
216
- $onescanModel->setShippingtax($shippingTaxPercent);
217
- $onescanModel->save();
218
-
219
- return true;
220
- }
221
-
222
- /// <summary>
223
- /// Build purchase payload.
224
- /// </summary>
225
- private function BuildPurchasePayload($sessionID) {
226
- //Retreive quote from database and reserve order id
227
- $quote=$this->MagentoRetrieveQuote($sessionID);
228
- $quote->reserveOrderId();
229
- $quote->save();
230
-
231
- //Retreive prices from quote
232
- $storeid=$quote->getStoreId();
233
- $totals=$quote->getTotals();
234
-
235
- //Build Onescan payload from quote data
236
- $payload = new PurchasePayload();
237
- $payload->RequiresDeliveryAddress = true;
238
- $payload->MerchantName = Mage::app()->getStore()->getFrontendName();
239
- $payload->MerchantTransactionID = GUID();
240
- $payload->PurchaseDescription = Mage::getStoreConfig('onescantab/general/onescan_basket-name');
241
-
242
- if(isset($totals['tax']) && $totals['tax']->getValue()) {
243
- $payload->Tax = $totals['tax']->getValue();
244
- } else {
245
- $payload->Tax = 0;
246
- }
247
- $payload->ProductAmount = $totals['subtotal']->getValue()-$payload->Tax;
248
- $payload->PaymentAmount = $totals['subtotal']->getValue();
249
- $payload->Currency = Mage::app()->getStore($storeid)->getCurrentCurrencyCode();
250
-
251
- $payload->Requires = new PaymentOptIns();
252
-
253
- $payload->Requires->Surcharges = false;
254
- $payload->Requires->DeliveryOptions=true;
255
-
256
- $payload->ImageData = Mage::getStoreConfig('onescantab/general/onescan_basket-logo-url');
257
-
258
- return $payload;
259
- }
260
-
261
- /// <summary>
262
- /// Build order accepted payload.
263
- /// </summary>
264
- private function BuildOrderAccepted($process) {
265
- //Retreive Onescan data from database
266
- $sessionID = $process->SessionState()->SessionID;
267
-
268
- $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
269
- $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
270
- $onescanData->load();
271
- $sessionData=$onescanData->getData();
272
-
273
- $quoteid=$sessionData[0]['quoteid'];
274
- $customerid=$sessionData[0]['customerid'];
275
- $shippingTaxRate=$sessionData[0]['shippingtax'];
276
-
277
- //If FirstName or LastName are blank, Magento can't proceed with order
278
- if ($process->PaymentConfirmation->FirstName=="") {
279
- $process->PaymentConfirmation->FirstName="First";
280
- }
281
- if ($process->PaymentConfirmation->LastName=="") {
282
- $process->PaymentConfirmation->LastName="Last";
283
- }
284
-
285
- //Make sure we have an account and are logged in to Magento
286
- $this->MagentoLogin($customerid,$quoteid);
287
-
288
- //Place the order
289
- $orderId=$this->MagentoPlaceOrder($process,$shippingTaxRate,$quoteid);
290
-
291
- //Pass data back to Onescan
292
- $orderAccepted = new OrderAcceptedPayload();
293
- $orderAccepted->ReceiptId = $process->ProcessId();
294
- $orderAccepted->OrderId = $orderId;
295
-
296
- return $orderAccepted;
297
- }
298
-
299
- //Create random password for "manual" login
300
- private function randomPassword() {
301
- $alphabet = "abcdefghijkmnopqrstuwxyzABCDEFGHJKLMNPQRSTUWXYZ23456789";
302
- $pass='';
303
-
304
- for ($i = 0; $i < 8; $i++) {
305
- $n = rand(0, strlen($alphabet)-1);
306
- $pass .= $alphabet[$n];
307
- }
308
-
309
- return $pass;
310
- }
311
-
312
- private function MagentoRetrieveQuote($sessionID){
313
- //Retrieve quote from database
314
- $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
315
- $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
316
- $onescanData->load();
317
- $sessionData=$onescanData->getData();
318
- $quoteid=$sessionData[0]['quoteid'];
319
-
320
- //Retreive quote
321
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
322
- $cart->setQuoteId($quoteid);
323
-
324
- return $cart->getQuote();
325
- }
326
-
327
- protected function MagentoLogin($customerid,$quoteid){
328
- //Retreive quote from database
329
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
330
- $cart->setQuoteId($quoteid);
331
- $totals=$cart->getQuote()->getTotals();
332
- $quote=$cart->getQuote();
333
-
334
- if ($customerid) {
335
- // We are already logged in:
336
- $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->load($customerid);
337
- $quote->assignCustomer($customer);
338
- } else {
339
- //Determine whether Onescan user token is recognised
340
- $loginTokens = Mage::getModel('onescan/logintokens')->getCollection();
341
- $loginTokens->addFieldToFilter('onescantoken', array('like' => $process->UserToken));
342
- $loginTokens->load();
343
- $details=$loginTokens->getData();
344
- $customer = Mage::getModel('customer/customer');
345
- $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
346
- if (empty($details)) {
347
- //We do not recognise the user token, so we create an account and log in
348
- $customer->loadByEmail($process->PaymentConfirmation->UserEmail);
349
-
350
- if(!$customer->getId()) {
351
- //New customer registration
352
- $customer->setEmail($process->PaymentConfirmation->UserEmail);
353
- $customer->setFirstname($process->PaymentConfirmation->FirstName);
354
- $customer->setLastname($process->PaymentConfirmation->LastName);
355
- $customer->setPassword($this->randomPassword());
356
- try {
357
- $customer->save();
358
- //Determine whether email confirmation is required then set up account and send appropriate email
359
- if (Mage::getStoreConfig('onescantab/general/onescan_skip-confirmation') || !$customer->isConfirmationRequired()) {
360
- $customer->setConfirmation(null);
361
- $customer->save();
362
- $customer->sendNewAccountEmail(
363
- 'registered',
364
- '',
365
- Mage::app()->getStore()->getId()
366
- );
367
- $confirmMessage=false;
368
- } else {
369
- $customer->sendNewAccountEmail(
370
- 'confirmation',
371
- $session->getBeforeAuthUrl(),
372
- Mage::app()->getStore()->getId()
373
- );
374
- $confirmMessage=true;
375
- }
376
-
377
- //Store the Onescan user token in the database and associate it with the Magento account
378
- $newToken=Mage::getModel('onescan/logintokens');
379
- $newToken->setOnescantoken($process->UserToken);
380
- $newToken->setMagentouserid($customer->getId());
381
- $newToken->save();
382
-
383
- $message=Mage::getStoreConfig('onescantab/general/onescan_register-success-message');
384
-
385
- if ($confirmMessage) {
386
- $value=Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
387
- $message = Mage::helper('customer')->__(Mage::getStoreConfig('onescantab/general/onescan_email-not-confirmed-message'),$value);
388
- }
389
-
390
- LocalDataFactory::storeObject($sessionID,$customer->getId());
391
- LocalDataFactory::storeObject($sessionID . '-message',$message);
392
- }
393
- catch (Mage_Core_Exception $e) {
394
- LocalDataFactory::storeObject($sessionID . '-message',$e->getMessage());
395
- }
396
- } else {
397
- //Email address recognised so redirect to login page
398
- LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_email-exists-message'));
399
- }
400
- } else {
401
- //We recognise the user token, so we can log in
402
- $customer->load($details[0]['magentouserid']);
403
- LocalDataFactory::storeObject($sessionID,$details[0]['magentouserid']);
404
- LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_login-success-message'));
405
- }
406
- $quote->assignCustomer($customer);
407
- }
408
- }
409
-
410
- protected function MagentoPlaceOrder($process,$shippingTaxRate,$quoteid){
411
- //Retreive quote from database
412
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
413
- $cart->setQuoteId($quoteid);
414
- $totals=$cart->getQuote()->getTotals();
415
- $quote=$cart->getQuote();
416
-
417
- //Calculate shipping values.
418
- $shippingMethod=$process->PaymentConfirmation->DeliveryMethodCode;
419
- $totalShippingAmount=$process->PaymentConfirmation->AmountCharged->PostageAmount;
420
- $shippingTax=$totalShippingAmount-($totalShippingAmount*100)/(100+$shippingTaxRate);
421
- $shippingAmount=$totalShippingAmount-$shippingTax;
422
-
423
- //Add customer name to the quote, along with billing address and shipping address.
424
- $quote->setcustomerfirstname($process->PaymentConfirmation->FirstName);
425
- $quote->setcustomerlastname($process->PaymentConfirmation->LastName);
426
-
427
- $addressData=$quote->getBillingAddress()->getData();
428
- $addressData['firstname']=$process->PaymentConfirmation->FirstName;
429
- $addressData['lastname']=$process->PaymentConfirmation->LastName;
430
- $billingAddress = $quote->getBillingAddress()->setData($addressData);
431
-
432
- $addressData=$quote->getShippingAddress()->getData();
433
- $addressData['firstname']=$process->PaymentConfirmation->FirstName;
434
- $addressData['lastname']=$process->PaymentConfirmation->LastName;
435
- $shippingAddress = $quote->getShippingAddress()->setData($addressData);
436
-
437
- //Set shipping and payment methods for order
438
- $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
439
- ->setShippingMethod($shippingMethod)
440
- ->setPaymentMethod('onescan');
441
-
442
- $quote->getShippingAddress()->collectTotals();
443
-
444
- $quote->getPayment()->importData(array('method' => 'onescan'));
445
-
446
- foreach($quote->getAllItems() as $item){
447
- $totalPrice=round($item->getProduct()->getFinalPrice(),2,PHP_ROUND_HALF_DOWN)*$item->getQty();
448
- $taxAmount=round($totalPrice-$item->getPrice(),2,PHP_ROUND_HALF_DOWN);
449
- $item->setTaxAmount($taxAmount);
450
- $item->setTaxPercent(round($taxAmount*100/($totalPrice-$taxAmount),2));
451
- }
452
-
453
- //Add postage to quote
454
- $totals['grand_total']->setValue(round($totals['grand_total']->getValue(),2,PHP_ROUND_HALF_DOWN));
455
-
456
- $quote->setIsActive(0);
457
- $quote->save();
458
-
459
- //Create order from quote
460
- $service = Mage::getModel('sales/service_quote', $quote);
461
- $service->submitAll();
462
-
463
- $order = $service->getOrder();
464
- $order->setShippingMethod($shippingMethod);
465
-
466
- $amountCharged=$process->PaymentConfirmation->AmountCharged;
467
- $order ->setSubtotal($amountCharged->BasketAmount)
468
- ->setSubtotalIncludingTax($amountCharged->BasePaymentAmount)
469
- ->setBaseSubtotal($amountCharged->BasketAmount)
470
- ->setGrandTotal($amountCharged->PaymentAmount)
471
- ->setBaseGrandTotal($amountCharged->PaymentAmount)
472
- ->setBaseTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN))
473
- ->setTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN));
474
-
475
- $order->getPayment()->capture(null);
476
-
477
- $order->place();
478
- $order->save();
479
- $order->sendNewOrderEmail();
480
-
481
- $quote->setIsActive(false);
482
- $quote->delete();
483
-
484
- return $order->getIncrementId();
485
- }
486
-
487
- protected function MagentoGetShippingRates($quote,$shippingError,$address){
488
- //Coupons not yet supported, sample code for reference
489
- /*if ($quote->getCouponCode() != '') {
490
- $c = Mage::getResourceModel('salesrule/rule_collection');
491
- $c->getSelect()->where("code=?", $quote->getCouponCode());
492
- foreach ($c->getItems() as $item) {
493
- $coupon = $item;
494
- }
495
- if ($coupon->getSimpleFreeShipping() > 0) {
496
- $quote->getShippingAddress()->setShippingMethod($this->_shippingCode)->save();
497
- return true;
498
- }
499
- }*/
500
-
501
- //Add address to quote
502
- try {
503
- $addressData = array(
504
- 'street' => $address->AddressLine1 . ', ' . $address->AddressLine2,
505
- 'city' => $address->Town,
506
- 'postcode' => $address->Postcode,
507
- 'telephone' => '0',
508
- 'country_id' => $address->CountryCode,
509
- );
510
-
511
- //Check to see if region/state is required for the delivery country
512
- $requiredStates=explode(',',Mage::getStoreConfig('general/region/state_required', Mage::app()->getStore()));
513
- if(in_array($address->CountryCode,$requiredStates)){
514
- $regions=Mage::getModel('directory/region')
515
- ->getResourceCollection()
516
- ->addCountryFilter($address->CountryCode)
517
- ->load();
518
-
519
- //Ensure we have a valid region/state as either the full name or two letter abbreviation
520
- $regionMatch=false;
521
- //Check if supplied county text appears within full region name
522
- foreach($regions as $region){
523
- if(stripos($region->default_name,$address->County)!==false
524
- //Use first region if county is empty to allow testing with early version of Onscan app
525
- || $address->County==''){
526
- $addressData['region']=$region->default_name;
527
- $addressData['region_id']=$region->region_id;
528
- $regionMatch=true;
529
- break;
530
- }
531
- }
532
- //If supplied county is two characters long, check if we match the two letter region abbreviation
533
- if(strlen($address->County)==2){
534
- foreach($regions as $region){
535
- if(strcasecmp($address->County,$region->code)==0){
536
- $addressData['region']=$region->default_name;
537
- $addressData['region_id']=$region->region_id;
538
- $regionMatch=true;
539
- break;
540
- }
541
- }
542
- }
543
- if(!$regionMatch){
544
- //Region not found, return an error
545
- return Mage::getStoreConfig('onescantab/general/onescan_unknown-region-message');
546
- }
547
- }
548
-
549
- $billingAddress = $quote->getBillingAddress()->addData($addressData);
550
- $shippingAddress = $quote->getShippingAddress()->addData($addressData);
551
-
552
- //Get valid shipping rates for this address
553
- $quote->getShippingAddress()->collectTotals();
554
- $quote->getShippingAddress()->setCollectShippingRates(true);
555
- $quote->getShippingAddress()->collectShippingRates();
556
- $rates = $quote->getShippingAddress()->getShippingRatesCollection();
557
- }
558
- catch (Mage_Core_Exception $e) {
559
- Mage::getSingleton('checkout/session')->addError($e->getMessage());
560
- }
561
- catch (Exception $e) {
562
- Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Load customer quote error'));
563
- }
564
-
565
- $quote->save();
566
-
567
- $allowedRates=array();
568
- foreach ($rates as $rate){
569
- $rateCode=$rate->getCode();
570
- if($quote->getShippingAddress()->collectShippingRates()->getShippingRateByCode($rateCode)){
571
- $allowedRates[$rateCode]=$rate; //Using $rateCode as key removes duplicates
572
- }
573
- }
574
-
575
- return $allowedRates;
576
- }
577
- }
578
  ?>
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
+ //Callback entry point
27
+ public function handle() {
28
+ $settings = $this->getConfig()->getSettings();
29
+ if (isset($_GET['basket'])) {
30
+ $settings->OnescanCallbackURL .= '?basket=' . $_GET['basket'];
31
+ }
32
+
33
+ $onescanMessage = Onescan::ReadMessage($settings);
34
+ //Mage::log('Message: ' . print_r($onescanMessage,true));
35
+
36
+ $purchaseProcess = new OnescanPurchaseProcess();
37
+ $nextAction = $purchaseProcess->DecodePurchaseMessage($onescanMessage);
38
+ $sessionState = $purchaseProcess->SessionState();
39
+
40
+ switch ($nextAction)
41
+ {
42
+ case PurchaseAction::StartPayment:
43
+ //Mage::log('Start Payment');
44
+ $purchasePayload = $this->BuildPurchasePayload($sessionState->SessionID);
45
+ $purchaseProcess->ProcessStartPurchase($purchasePayload);
46
+ break;
47
+ case PurchaseAction::AdditionalCharges:
48
+ //Mage::log('Additional Charges');
49
+ $purchaseProcess->DecodeAdditionalChargesRequest($onescanMessage);
50
+ $additionalChargesPayload = $this->BuildAdditionalCharges($purchaseProcess);
51
+ $purchaseProcess->ProcessAdditionalCharges($additionalChargesPayload);
52
+ break;
53
+ case PurchaseAction::PaymentConfirmed:
54
+ //Mage::log('Payment Confirmed');
55
+ $purchaseProcess->DecodePaymentConfirmed($onescanMessage);
56
+ $orderAcceptedPayload = $this->BuildOrderAccepted($purchaseProcess);
57
+ $purchaseProcess->ProcessPaymentConfirmed($orderAcceptedPayload);
58
+ break;
59
+ case PurchaseAction::PaymentFailed:
60
+ //Mage::log('Payment Failed');
61
+ $purchaseProcess->ProcessPaymentFailed();
62
+ break;
63
+ case PurchaseAction::PaymentCancelled:
64
+ //Mage::log('Payment Cancelled');
65
+ $purchaseProcess->ProcessPaymentCancelled();
66
+ break;
67
+ }
68
+ $responseMessage = $purchaseProcess->EncodeOutcome();
69
+ //Mage::log('Response: ' . print_r($responseMessage,true));
70
+
71
+ Onescan::SendMessage($responseMessage,$settings);
72
+ return parent::handle();
73
+ }
74
+
75
+ /// <summary>
76
+ /// Build some extra information about further charges.
77
+ /// </summary>
78
+ private function BuildAdditionalCharges($process) {
79
+ $additionalChargesContext = $process->AdditionalChargesContext;
80
+ $requires=$process->PurchaseInfo->Requires;
81
+ $purchaseCharges = new AdditionalChargesPayload();
82
+
83
+ if ($requires->DeliveryOptions && !empty($additionalChargesContext->DeliveryAddress)){
84
+ $deliveryChargesResponse=$this->AddDeliveryCharges($additionalChargesContext->DeliveryAddress,$purchaseCharges,$process);
85
+ if($deliveryChargesResponse!==true){
86
+ $purchaseCharges->AddressNotSupported=1;
87
+ $purchaseCharges->AddressNotSupportedReason=$deliveryChargesResponse;
88
+ }
89
+ }
90
+
91
+ //Surcharges not yet supported
92
+ /*if ($requires->Surcharges && !empty($additionalChargesContext->PaymentMethod)){
93
+ if(!$this->AddPaymentMethodCharges($additionalChargesContext->PaymentMethod,$purchaseCharges,$process)){
94
+ //REPORT SURCHARGES ERROR TO DEVICE;
95
+ }
96
+ }*/
97
+
98
+ return $purchaseCharges;
99
+ }
100
+
101
+ /// <summary>
102
+ /// Add charges for the specified payment method.
103
+ /// </summary>
104
+ private function AddPaymentMethodCharges($paymentMethod,$purchaseCharges,$process) {
105
+ //Surcharges not yet supported, this sample function never gets called
106
+ switch ($paymentMethod->PaymentMethodType) {
107
+ case 'CreditCard':
108
+ $this->HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process);
109
+ break;
110
+ case 'OnescanPlay':
111
+ $this->HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process);
112
+ break;
113
+ }
114
+ return true;
115
+ }
116
+
117
+ /// <summary>
118
+ /// Handle charges for the onescan test card.
119
+ /// </summary>
120
+ private function HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process) {
121
+ //Surcharges not yet supported, this sample function never gets called
122
+ $cardDetails = $paymentMethod->CardInformation;
123
+
124
+ $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
125
+ $purchaseCharges->PaymentMethodCharge->Code = "PLAY";
126
+ $purchaseCharges->PaymentMethodCharge->Description = "The onescan play card attracts a 1 surcharge";
127
+ $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
128
+ $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = 1.00;
129
+ $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
130
+ $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = 1.00;
131
+ }
132
+
133
+ /// <summary>
134
+ /// Handle charges for credit cards
135
+ /// </summary>
136
+ private function HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process) {
137
+ //Surcharges not yet supported, this sample function never gets called
138
+ $cardDetails = $paymentMethod->CardInformation;
139
+
140
+ if ($cardDetails->PaymentSystemCode == "VISA") {
141
+
142
+ $surcharge = round($process->PurchaseInfo->PaymentAmount * 0.01, 2);
143
+
144
+ $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
145
+ $purchaseCharges->PaymentMethodCharge->Code = "VISA";
146
+ $purchaseCharges->PaymentMethodCharge->Description = "Paying with a credit card attracts a 1% charge";
147
+ $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
148
+ $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = $surcharge;
149
+ $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
150
+ $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = $surcharge;
151
+ }
152
+ }
153
+
154
+ /// <summary>
155
+ /// Add delivery charges for the specified address.
156
+ /// </summary>
157
+ private function AddDeliveryCharges($address,$purchaseCharges,$process) {
158
+ //Retreive quote from database
159
+ $quote=$this->MagentoRetrieveQuote($process->SessionState()->SessionID);
160
+
161
+ //Retrieve allowed shipping rates.
162
+ $shippingError=false;
163
+ $allowedRates=$this->MagentoGetShippingRates($quote,$shippingError,$address);
164
+
165
+ //If retrieval of shipping rates was unsuccessful, return the error.
166
+ if($shippingError!==false){
167
+ return $shippingError;
168
+ }
169
+
170
+ //Get shipping tax rate
171
+ $taxCalculation = Mage::getModel('tax/calculation');
172
+ $request = $taxCalculation->getRateRequest(null,null,null,$quote->getStore());
173
+ $taxRateId = Mage::getStoreConfig('tax/classes/shipping_tax_class',$quote->getStore());
174
+ $shippingTaxPercent = $taxCalculation->getRate($request->setProductClassId($taxRateId));
175
+
176
+ //Build delivery options array to pass back to Onescan
177
+ $purchaseCharges->DeliveryOptions = array();
178
+ foreach ($allowedRates as $rate) {
179
+ $amount=$rate->getPrice();
180
+ if(is_numeric($amount)){
181
+ $option=new DeliveryOption();
182
+ $option->Code = $rate->getCode();
183
+ $option->Description = $rate->getMethodDescription();
184
+ //Setting default option is not yet supported in the Onescan extension
185
+ /*if($option->Code==$defaultCode){
186
+ $option->IsDefault = true;
187
+ }*/
188
+ $option->Label = $rate->getMethodTitle();
189
+ $option->Charge = new Charge();
190
+ $option->Charge->TotalAmount = $amount;
191
+ //Round shipping tax down
192
+ $option->Charge->Tax = floor(($amount-$amount/(1+$shippingTaxPercent/100))*100)/100;
193
+ if(Mage::getStoreConfig('tax/display/type',Mage::app()->getStore())==1){
194
+ //Show price excluding tax
195
+ $option->Charge->BaseAmount = $amount-$option->Charge->Tax;
196
+ }else{
197
+ //Show price including tax
198
+ $option->Charge->BaseAmount = $amount;
199
+ }
200
+ $option->Charge->BaseAmount = $amount;
201
+ $purchaseCharges->DeliveryOptions[]=$option;
202
+ }
203
+ }
204
+
205
+ if(count($purchaseCharges->DeliveryOptions)==0){
206
+ //No shipping rates available for this order, return an error
207
+ return Mage::getStoreConfig('onescantab/general/onescan_cannot-deliver-message');
208
+ }
209
+
210
+ //Retreive Onescan data from database
211
+ $sessionID = $process->SessionState()->SessionID;
212
+
213
+ $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
214
+ $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
215
+ $onescanData->load();
216
+ $sessionData=$onescanData->getData();
217
+
218
+ //Save details to Onescan database tables for later retrieval
219
+ $onescanModel=Mage::getModel('onescan/sessiondata');
220
+ $onescanModel->setId($sessionData[0]['sessiondata_id']);
221
+ $onescanModel->setSessionid($process->SessionState()->SessionID);
222
+ $onescanModel->setQuoteid($quote->getId());
223
+ $onescanModel->setCustomerid($sessionData[0]['customerid']);
224
+ $onescanModel->save();
225
+
226
+ return true;
227
+ }
228
+
229
+ /// <summary>
230
+ /// Build purchase payload.
231
+ /// </summary>
232
+ private function BuildPurchasePayload($sessionID) {
233
+ //Retreive quote from database and reserve order id
234
+ $quote=$this->MagentoRetrieveQuote($sessionID);
235
+ $quote->reserveOrderId();
236
+ $quote->save();
237
+
238
+ //Retreive prices from quote
239
+ $storeid=$quote->getStoreId();
240
+ $totals=$quote->getTotals();
241
+
242
+ //Build Onescan payload from quote data
243
+ $payload = new PurchasePayload();
244
+ $payload->RequiresDeliveryAddress = true;
245
+ $payload->MerchantName = Mage::app()->getStore()->getFrontendName();
246
+ $payload->MerchantTransactionID = GUID();
247
+ $payload->PurchaseDescription = Mage::getStoreConfig('onescantab/general/onescan_basket-name');
248
+
249
+ if(isset($totals['tax']) && $totals['tax']->getValue()) {
250
+ $payload->Tax = $totals['tax']->getValue();
251
+ } else {
252
+ $payload->Tax = 0;
253
+ }
254
+
255
+ if(Mage::getStoreConfig('tax/display/type',Mage::app()->getStore())==1){
256
+ //Show price excluding tax
257
+ $payload->ProductAmount = $totals['subtotal']->getValue()-$payload->Tax;
258
+ }else{
259
+ //Show price including tax
260
+ $payload->ProductAmount = $totals['subtotal']->getValue();
261
+ }
262
+ $payload->PaymentAmount = $totals['subtotal']->getValue();
263
+ $payload->Currency = Mage::app()->getStore($storeid)->getCurrentCurrencyCode();
264
+
265
+ $payload->Requires = new PaymentOptIns();
266
+
267
+ $payload->Requires->Surcharges = false;
268
+ $payload->Requires->DeliveryOptions=true;
269
+
270
+ $payload->ImageData = Mage::getStoreConfig('onescantab/general/onescan_basket-logo-url');
271
+
272
+ return $payload;
273
+ }
274
+
275
+ /// <summary>
276
+ /// Build order accepted payload.
277
+ /// </summary>
278
+ private function BuildOrderAccepted($process) {
279
+ //Retreive Onescan data from database
280
+ $sessionID = $process->SessionState()->SessionID;
281
+
282
+ $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
283
+ $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
284
+ $onescanData->load();
285
+ $sessionData=$onescanData->getData();
286
+
287
+ $quoteid=$sessionData[0]['quoteid'];
288
+ $customerid=$sessionData[0]['customerid'];
289
+
290
+ //If FirstName or LastName are blank, Magento can't proceed with order
291
+ if ($process->PaymentConfirmation->FirstName=="") {
292
+ $process->PaymentConfirmation->FirstName="First";
293
+ }
294
+ if ($process->PaymentConfirmation->LastName=="") {
295
+ $process->PaymentConfirmation->LastName="Last";
296
+ }
297
+
298
+ //Make sure we have an account and are logged in to Magento
299
+ $this->MagentoLogin($customerid,$quoteid,$process);
300
+
301
+ //Place the order
302
+ $orderId=$this->MagentoPlaceOrder($process,$quoteid);
303
+
304
+ //Pass data back to Onescan
305
+ $orderAccepted = new OrderAcceptedPayload();
306
+ $orderAccepted->ReceiptId = $process->ProcessId();
307
+ $orderAccepted->OrderId = $orderId;
308
+
309
+ return $orderAccepted;
310
+ }
311
+
312
+ //Create random password for "manual" login
313
+ private function randomPassword() {
314
+ $alphabet = "abcdefghijkmnopqrstuwxyzABCDEFGHJKLMNPQRSTUWXYZ23456789";
315
+ $pass='';
316
+
317
+ for ($i = 0; $i < 8; $i++) {
318
+ $n = rand(0, strlen($alphabet)-1);
319
+ $pass .= $alphabet[$n];
320
+ }
321
+
322
+ return $pass;
323
+ }
324
+
325
+ private function MagentoRetrieveQuote($sessionID){
326
+ //Retrieve quote from database
327
+ $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
328
+ $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
329
+ $onescanData->load();
330
+ $sessionData=$onescanData->getData();
331
+ $quoteid=$sessionData[0]['quoteid'];
332
+
333
+ //Retreive quote
334
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
335
+ $cart->setQuoteId($quoteid);
336
+
337
+ return $cart->getQuote();
338
+ }
339
+
340
+ protected function MagentoLogin($customerid,$quoteid,$process){
341
+ //Retreive quote from database
342
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
343
+ $cart->setQuoteId($quoteid);
344
+ $quote=$cart->getQuote();
345
+ $sessionID=$process->SessionState()->SessionID;
346
+
347
+ if ($customerid) {
348
+ // We are already logged in:
349
+ $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->load($customerid);
350
+ $quote->assignCustomer($customer);
351
+ } else {
352
+ //Determine whether Onescan user token is recognised
353
+ $loginTokens = Mage::getModel('onescan/logintokens')->getCollection();
354
+ $loginTokens->addFieldToFilter('onescantoken', array('like' => $process->UserToken));
355
+ $loginTokens->load();
356
+ $details=$loginTokens->getData();
357
+ $customer = Mage::getModel('customer/customer');
358
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
359
+ if (empty($details)) {
360
+ //We do not recognise the user token, so we create an account and log in
361
+ $customer->loadByEmail($process->PaymentConfirmation->UserEmail);
362
+
363
+ if(!$customer->getId()) {
364
+ //New customer registration
365
+ $customer->setEmail($process->PaymentConfirmation->UserEmail);
366
+ $customer->setFirstname($process->PaymentConfirmation->FirstName);
367
+ $customer->setLastname($process->PaymentConfirmation->LastName);
368
+ $customer->setPassword($this->randomPassword());
369
+ try {
370
+ $customer->save();
371
+ //Determine whether email confirmation is required then set up account and send appropriate email
372
+ if (Mage::getStoreConfig('onescantab/general/onescan_skip-confirmation') || !$customer->isConfirmationRequired()) {
373
+ $customer->setConfirmation(null);
374
+ $customer->save();
375
+ $customer->sendNewAccountEmail(
376
+ 'registered',
377
+ '',
378
+ Mage::app()->getStore()->getId()
379
+ );
380
+ $confirmMessage=false;
381
+ } else {
382
+ $customer->sendNewAccountEmail(
383
+ 'confirmation',
384
+ $session->getBeforeAuthUrl(),
385
+ Mage::app()->getStore()->getId()
386
+ );
387
+ $confirmMessage=true;
388
+ }
389
+
390
+ //Store the Onescan user token in the database and associate it with the Magento account
391
+ $newToken=Mage::getModel('onescan/logintokens');
392
+ $newToken->setOnescantoken($process->UserToken);
393
+ $newToken->setMagentouserid($customer->getId());
394
+ $newToken->save();
395
+
396
+ $message=Mage::getStoreConfig('onescantab/general/onescan_register-success-message');
397
+
398
+ if ($confirmMessage) {
399
+ $value=Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
400
+ $message = Mage::helper('customer')->__(Mage::getStoreConfig('onescantab/general/onescan_email-not-confirmed-message'),$value);
401
+ }
402
+
403
+ LocalDataFactory::storeObject($sessionID,$customer->getId());
404
+ LocalDataFactory::storeObject($sessionID . '-message',$message);
405
+ }
406
+ catch (Mage_Core_Exception $e) {
407
+ LocalDataFactory::storeObject($sessionID . '-message',$e->getMessage());
408
+ }
409
+ } else {
410
+ //Email address recognised so redirect to login page
411
+ LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_email-exists-message'));
412
+ }
413
+ } else {
414
+ //We recognise the user token, so we can log in
415
+ $customer->load($details[0]['magentouserid']);
416
+ LocalDataFactory::storeObject($sessionID,$details[0]['magentouserid']);
417
+ LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_login-success-message'));
418
+ }
419
+ $quote->assignCustomer($customer);
420
+ }
421
+ }
422
+
423
+ protected function MagentoPlaceOrder($process,$quoteid){
424
+ //Retreive quote from database
425
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
426
+ $cart->setQuoteId($quoteid);
427
+ $quote=$cart->getQuote();
428
+
429
+ //Add customer name to the quote, along with billing address and shipping address.
430
+ $quote->setcustomerfirstname($process->PaymentConfirmation->FirstName);
431
+ $quote->setcustomerlastname($process->PaymentConfirmation->LastName);
432
+
433
+ $addressData=$quote->getBillingAddress()->getData();
434
+ $addressData['firstname']=$process->PaymentConfirmation->FirstName;
435
+ $addressData['lastname']=$process->PaymentConfirmation->LastName;
436
+ $billingAddress = $quote->getBillingAddress()->setData($addressData);
437
+
438
+ $addressData=$quote->getShippingAddress()->getData();
439
+ $addressData['firstname']=$process->PaymentConfirmation->FirstName;
440
+ $addressData['lastname']=$process->PaymentConfirmation->LastName;
441
+ $shippingAddress = $quote->getShippingAddress()->setData($addressData);
442
+
443
+ //Set shipping and payment methods for order
444
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
445
+ ->setShippingMethod($process->PaymentConfirmation->DeliveryMethodCode)
446
+ ->setPaymentMethod('onescan');
447
+
448
+ $quote->getPayment()->importData(array('method' => 'onescan'));
449
+
450
+ //Create order from quote
451
+ $service = Mage::getModel('sales/service_quote', $quote);
452
+ $service->submitAll();
453
+ $order = $service->getOrder();
454
+
455
+ //Add payment to order
456
+ $payment = $order->getPayment();
457
+ $payment->setTransactionId($process->PaymentConfirmation->GatewayTransactionId)
458
+ ->setCurrencyCode($order->getBaseCurrencyCode())
459
+ ->setPreparedMessage('Comment')
460
+ ->setIsTransactionClosed(0)
461
+ ->registerCaptureNotification($process->PaymentConfirmation->AmountCharged->PaymentAmount);
462
+ $order->save();
463
+
464
+ //Delete quote
465
+ $quote->setIsActive(false);
466
+ $quote->delete();
467
+
468
+ return $order->getIncrementId();
469
+ }
470
+
471
+ protected function MagentoGetShippingRates($quote,$shippingError,$address){
472
+ //Coupons not yet supported, sample code for reference
473
+ /*if ($quote->getCouponCode() != '') {
474
+ $c = Mage::getResourceModel('salesrule/rule_collection');
475
+ $c->getSelect()->where("code=?", $quote->getCouponCode());
476
+ foreach ($c->getItems() as $item) {
477
+ $coupon = $item;
478
+ }
479
+ if ($coupon->getSimpleFreeShipping() > 0) {
480
+ $quote->getShippingAddress()->setShippingMethod($this->_shippingCode)->save();
481
+ return true;
482
+ }
483
+ }*/
484
+
485
+ //Add address to quote
486
+ try {
487
+ $addressData = array(
488
+ 'street' => $address->AddressLine1 . ', ' . $address->AddressLine2,
489
+ 'city' => $address->Town,
490
+ 'postcode' => $address->Postcode,
491
+ 'telephone' => '0',
492
+ 'country_id' => $address->CountryCode,
493
+ );
494
+
495
+ //Check to see if region/state is required for the delivery country
496
+ $requiredStates=explode(',',Mage::getStoreConfig('general/region/state_required', Mage::app()->getStore()));
497
+ if(in_array($address->CountryCode,$requiredStates)){
498
+ $regions=Mage::getModel('directory/region')
499
+ ->getResourceCollection()
500
+ ->addCountryFilter($address->CountryCode)
501
+ ->load();
502
+
503
+ //Ensure we have a valid region/state as either the full name or two letter abbreviation
504
+ $regionMatch=false;
505
+ //Check if supplied county text appears within full region name
506
+ foreach($regions as $region){
507
+ if(stripos($region->default_name,$address->County)!==false
508
+ //Use first region if county is empty to allow testing with early version of Onscan app
509
+ || $address->County==''){
510
+ $addressData['region']=$region->default_name;
511
+ $addressData['region_id']=$region->region_id;
512
+ $regionMatch=true;
513
+ break;
514
+ }
515
+ }
516
+ //If supplied county is two characters long, check if we match the two letter region abbreviation
517
+ if(strlen($address->County)==2){
518
+ foreach($regions as $region){
519
+ if(strcasecmp($address->County,$region->code)==0){
520
+ $addressData['region']=$region->default_name;
521
+ $addressData['region_id']=$region->region_id;
522
+ $regionMatch=true;
523
+ break;
524
+ }
525
+ }
526
+ }
527
+ if(!$regionMatch){
528
+ //Region not found, return an error
529
+ return Mage::getStoreConfig('onescantab/general/onescan_unknown-region-message');
530
+ }
531
+ }
532
+
533
+ $billingAddress = $quote->getBillingAddress()->addData($addressData);
534
+ $shippingAddress = $quote->getShippingAddress()->addData($addressData);
535
+
536
+ //Get valid shipping rates for this address
537
+ $quote->getShippingAddress()->collectTotals();
538
+ $quote->getShippingAddress()->setCollectShippingRates(true);
539
+ $quote->getShippingAddress()->collectShippingRates();
540
+ $rates = $quote->getShippingAddress()->getShippingRatesCollection();
541
+ }
542
+ catch (Mage_Core_Exception $e) {
543
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
544
+ }
545
+ catch (Exception $e) {
546
+ Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Load customer quote error'));
547
+ }
548
+
549
+ $quote->save();
550
+
551
+ $allowedRates=array();
552
+ foreach ($rates as $rate){
553
+ $rateCode=$rate->getCode();
554
+ if($quote->getShippingAddress()->collectShippingRates()->getShippingRateByCode($rateCode)){
555
+ $allowedRates[$rateCode]=$rate; //Using $rateCode as key removes duplicates
556
+ }
557
+ }
558
+
559
+ return $allowedRates;
560
+ }
561
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
  ?>
app/code/local/Ensygnia/Onescan/etc/config.xml CHANGED
@@ -19,7 +19,7 @@
19
  <config>
20
  <modules>
21
  <Ensygnia_Onescan>
22
- <version>1.0.12</version>
23
  </Ensygnia_Onescan>
24
  </modules>
25
  <global>
19
  <config>
20
  <modules>
21
  <Ensygnia_Onescan>
22
+ <version>1.0.13</version>
23
  </Ensygnia_Onescan>
24
  </modules>
25
  <global>
lib/Onescan/login/LocalDataFactory.php CHANGED
@@ -1,37 +1,43 @@
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
- class LocalDataFactory {
20
-
21
- public static function removeStoredObject($signature) {
22
- return (unlink(sys_get_temp_dir() . '/' . $signature));
23
- }
24
-
25
- public static function getStoredObject($signature) {
26
- if ($data = file_get_contents(sys_get_temp_dir() . '/' . $signature)) {
27
- $obj = @unserialize($data);
28
- return $obj;
29
- }
30
- return false;
31
- }
32
-
33
- public static function storeObject($signature, $obj) {
34
- file_put_contents(sys_get_temp_dir() . '/' . $signature,serialize($obj));
35
- }
36
- }
 
 
 
 
 
 
37
  ?>
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
+ class LocalDataFactory {
20
+
21
+ public static function removeStoredObject($signature) {
22
+ if(file_exists(sys_get_temp_dir() . '/' . $signature)){
23
+ return (unlink(sys_get_temp_dir() . '/' . $signature));
24
+ }else{
25
+ return false;
26
+ }
27
+ }
28
+
29
+ public static function getStoredObject($signature) {
30
+ if(!file_exists(sys_get_temp_dir() . '/' . $signature)){
31
+ return false;
32
+ }elseif($data = file_get_contents(sys_get_temp_dir() . '/' . $signature)) {
33
+ $obj = @unserialize($data);
34
+ return $obj;
35
+ }
36
+ return false;
37
+ }
38
+
39
+ public static function storeObject($signature, $obj) {
40
+ file_put_contents(sys_get_temp_dir() . '/' . $signature,serialize($obj));
41
+ }
42
+ }
43
  ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ensygnia_Onescan</name>
4
- <version>1.0.12</version>
5
  <stability>stable</stability>
6
  <license uri="https://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
@@ -14,11 +14,18 @@ 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.12 of the Onescan Payment Extension.&#xD;
18
  &#xD;
19
  Changelog&#xD;
20
  ---------------&#xD;
21
  &#xD;
 
 
 
 
 
 
 
22
  1.0.12&#xD;
23
  Check Magento database to determine whether country of delivery requires state/region to be present.&#xD;
24
  &#xD;
@@ -76,9 +83,9 @@ Fixed potential installation problem.&#xD;
76
  1.0.0&#xD;
77
  Initial version.</notes>
78
  <authors><author><name>Ensygnia</name><user>MAG002660123</user><email>paul.newson@ensygnia.com</email></author></authors>
79
- <date>2015-07-03</date>
80
- <time>11:14:14</time>
81
- <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="909e8b124e5a2eccb88bbee5425a0d20"/><file name="Registration.php" hash="7cf4b0cdd39e84e392cecaa38a35bd50"/></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="d2813a606e387f055e16e507d3de453e"/><file name="system.xml" hash="92cb2fbfe0086273b664f181cabb2241"/><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="08887eb2180ac838dcacd73b5cd2ab8b"/><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="3f702507b0dfc4ffd7e6c3e3647ee831"/></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"/><file name="scripts.phtml" hash="e2c4469065c629b34a9280879f9da71e"/></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="e5108485d920ef899003d402f7bd5efd"/><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="22e614add95533cbb8415d030cccfe2e"/></dir></dir></dir></dir></target></contents>
82
  <compatible/>
83
  <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></max></package></required></dependencies>
84
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ensygnia_Onescan</name>
4
+ <version>1.0.13</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.13 of the Onescan Payment Extension.&#xD;
18
  &#xD;
19
  Changelog&#xD;
20
  ---------------&#xD;
21
  &#xD;
22
+ 1.0.13&#xD;
23
+ Check Magento admin settings to determine whether prices sent to the Onescanner's device should include tax.&#xD;
24
+ &#xD;
25
+ Improved efficiency of extension code.&#xD;
26
+ &#xD;
27
+ Modified shipping tax calculation to round down so that the amount displayed on the Onescanner's device matches the amount calculated by Magento.&#xD;
28
+ &#xD;
29
  1.0.12&#xD;
30
  Check Magento database to determine whether country of delivery requires state/region to be present.&#xD;
31
  &#xD;
83
  1.0.0&#xD;
84
  Initial version.</notes>
85
  <authors><author><name>Ensygnia</name><user>MAG002660123</user><email>paul.newson@ensygnia.com</email></author></authors>
86
+ <date>2015-07-08</date>
87
+ <time>20:05:26</time>
88
+ <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="784b739775a2b9e33e91e6730755a608"/><file name="Registration.php" hash="7cf4b0cdd39e84e392cecaa38a35bd50"/></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="54ad76a6b3ec05ab636f5704d3ae6393"/><file name="system.xml" hash="92cb2fbfe0086273b664f181cabb2241"/><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="08887eb2180ac838dcacd73b5cd2ab8b"/><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="3f702507b0dfc4ffd7e6c3e3647ee831"/></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"/><file name="scripts.phtml" hash="e2c4469065c629b34a9280879f9da71e"/></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="99605095507fb98c2de5dcf57e34411e"/><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="e5108485d920ef899003d402f7bd5efd"/><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="22e614add95533cbb8415d030cccfe2e"/></dir></dir></dir></dir></target></contents>
89
  <compatible/>
90
  <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></max></package></required></dependencies>
91
  </package>
skin/adminhtml/default/default/onescan/images/Thumbs.db DELETED
Binary file