Ensygnia_Onescan - Version 1.0.10

Version Notes

Version 1.0.10 of the Onescan Payment Plugin extension.

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

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
Syntax error corrected

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


Code changes from version 1.0.9 to 1.0.10

app/code/local/Ensygnia/Onescan/Model/Callback/Purchase.php CHANGED
@@ -1,461 +1,495 @@
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
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
151
- $cart->setQuoteId($quoteid);
152
- $quote=$cart->getQuote();
153
-
154
- /*if ($quote->getCouponCode() != '') {
155
- $c = Mage::getResourceModel('salesrule/rule_collection');
156
- $c->getSelect()->where("code=?", $quote->getCouponCode());
157
- foreach ($c->getItems() as $item) {
158
- $coupon = $item;
159
- }
160
- if ($coupon->getSimpleFreeShipping() > 0) {
161
- $quote->getShippingAddress()->setShippingMethod($this->_shippingCode)->save();
162
- return true;
163
- }
164
- }*/
165
- try {
166
- if ($quote->getShippingAddress()->getCountryId() == '') {
167
- $quote->getShippingAddress()->setCountryId($address->CountryCode);
168
- }
169
- if ($quote->getShippingAddress()->getPostcode() == '') {
170
- $quote->getShippingAddress()->setPostcode($address->Postcode);
171
- }
172
- $quote->getShippingAddress()->collectTotals();
173
- $quote->getShippingAddress()->setCollectShippingRates(true);
174
- $quote->getShippingAddress()->collectShippingRates();
175
- $rates = $quote->getShippingAddress()->getShippingRatesCollection();
176
- }
177
- catch (Mage_Core_Exception $e) {
178
- Mage::getSingleton('checkout/session')->addError($e->getMessage());
179
- }
180
- catch (Exception $e) {
181
- Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Load customer quote error'));
182
- }
183
-
184
- $allowedRates=array();
185
- $lowestPrice=99999;
186
- foreach ($rates as $rate){
187
- $rateCode=$rate->getCode();
188
- if($quote->getShippingAddress()->collectShippingRates()->getShippingRateByCode($rateCode)){
189
- $allowedRates[$rateCode]=$rate; //Using $rateCode as key removes duplicates
190
- }
191
-
192
- //Set the lowest rate as the default
193
- if($rate->getPrice()<$lowestPrice){
194
- $lowestPrice=$rate->getPrice();
195
- $defaultCode=$rateCode;
196
- }
197
- }
198
-
199
- $purchaseCharges->DeliveryOptions = array();
200
- $taxCalculation = Mage::getModel('tax/calculation');
201
- $request = $taxCalculation->getRateRequest(null,null,null,$quote->getStore());
202
- $taxRateId = Mage::getStoreConfig('tax/classes/shipping_tax_class',$quote->getStore());
203
- $shippingTaxPercent = $taxCalculation->getRate($request->setProductClassId($taxRateId));
204
-
205
- $defaultIndex=0;
206
- foreach ($rates as $rate) {
207
- $amount=$rate->getPrice();
208
- if(is_numeric($amount)){
209
- $option=new DeliveryOption();
210
- $option->Code = $rate->getCode();
211
- $option->Description = $rate->getMethodDescription();
212
- if($option->Code==$defaultCode){
213
- $option->IsDefault = true;
214
- $defaultIndex=count($purchaseCharges->DeliveryOptions);
215
- }
216
- $option->Label = $rate->getMethodTitle();
217
- $option->Charge = new Charge();
218
- $option->Charge->TotalAmount = $amount;
219
- $option->Charge->Tax = $amount-($amount*100)/(100+$shippingTaxPercent);
220
- $option->Charge->BaseAmount = $amount-$option->Charge->Tax;
221
- $purchaseCharges->DeliveryOptions[]=$option;
222
- }
223
- }
224
-
225
- //Make sure the default rate is listed first
226
- $option=$purchaseCharges->DeliveryOptions[$defaultIndex];
227
- $purchaseCharges->DeliveryOptions[$defaultIndex]=$purchaseCharges->DeliveryOptions[0];
228
- $purchaseCharges->DeliveryOptions[0]=$option;
229
-
230
- $onescanModel->setId($sessionData[0]['sessiondata_id']);
231
- $onescanModel->setSessionid($process->SessionState()->SessionID);
232
- $onescanModel->setQuoteid($quoteid);
233
- $onescanModel->setCustomerid($sessionData[0]['customerid']);
234
- $onescanModel->setShippingmethod($option->Code);
235
- $onescanModel->setShippingamount($option->Charge->TotalAmount * 100);//Floating point numbers are being stored as integers!
236
- $onescanModel->setShippingtax($option->Charge->Tax * 100);//Floating point numbers are being stored as integers!
237
- $onescanModel->save();
238
- }
239
-
240
- public function BuildPurchasePayload($sessionID) {
241
- $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
242
- $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
243
- $onescanData->load();
244
- $sessionData=$onescanData->getData();
245
- $quoteid=$sessionData[0]['quoteid'];
246
-
247
- $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
248
- $cart->setQuoteId($quoteid);
249
-
250
- $quote=$cart->getQuote();
251
- $quote->reserveOrderId();
252
- $quote->save();
253
-
254
- $storeid=$quote->getStoreId();
255
- $totals=$quote->getTotals();
256
-
257
- $payload = new PurchasePayload();
258
- $payload->RequiresDeliveryAddress = true;
259
- $payload->MerchantName = Mage::app()->getStore()->getFrontendName();
260
- $payload->MerchantTransactionID = GUID();
261
- $payload->PurchaseDescription = Mage::getStoreConfig('onescantab/general/onescan_basket-name');
262
-
263
- if(isset($totals['tax']) && $totals['tax']->getValue()) {
264
- $payload->Tax = $totals['tax']->getValue();
265
- } else {
266
- $payload->Tax = 0;
267
- }
268
- $payload->ProductAmount = $totals['subtotal']->getValue()-$payload->Tax;
269
- $payload->PaymentAmount = $totals['subtotal']->getValue();
270
- $payload->Currency = Mage::app()->getStore($storeid)->getCurrentCurrencyCode();
271
-
272
- $payload->Requires = new PaymentOptIns();
273
-
274
- $payload->Requires->Surcharges = false;
275
- $payload->Requires->DeliveryOptions=true;
276
-
277
- $payload->ImageData = Mage::getStoreConfig('onescantab/general/onescan_basket-logo-url');
278
-
279
- return $payload;
280
- }
281
-
282
- public function BuildOrderAccepted($process) {
283
- $sessionState=$process->SessionState();
284
- $sessionID = $sessionState->SessionID;
285
-
286
- $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
287
- $onescanData->addFieldToFilter('sessionid', array('like' => $process->SessionState()->SessionID));
288
- $onescanData->load();
289
- $sessionData=$onescanData->getData();
290
-
291
- $quoteid=$sessionData[0]['quoteid'];
292
- $customerid=$sessionData[0]['customerid'];
293
- $shippingMethod=$sessionData[0]['shippingmethod'];
294
- $shippingAmount=round($sessionData[0]['shippingamount'],2,PHP_ROUND_HALF_DOWN)/100;//Floating point numbers are being stored as integers!
295
- $shippingTax=round($sessionData[0]['shippingtax'],2,PHP_ROUND_HALF_DOWN)/100;//Floating point numbers are being stored as integers!
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
- $addressData = array(
382
- 'firstname' => $process->PaymentConfirmation->FirstName,
383
- 'lastname' => $process->PaymentConfirmation->LastName,
384
- 'street' => $process->PaymentConfirmation->DeliveryAddress->AddressLine1 . ', ' . $process->PaymentConfirmation->DeliveryAddress->AddressLine2,
385
- 'city' => $process->PaymentConfirmation->DeliveryAddress->Town,
386
- 'postcode' => $process->PaymentConfirmation->DeliveryAddress->Postcode,
387
- 'telephone' => '0',
388
- 'country_id' => $process->PaymentConfirmation->DeliveryAddress->CountryCode,
389
- //*** NEED TO SET CORRECT REGION ID ***//
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->getShippingAddress()->collectTotals();
401
- //$quote->collectTotals();
402
-
403
- $quote->getPayment()->importData(array('method' => 'onescan'));
404
-
405
- foreach($quote->getAllItems() as $item){
406
- $totalPrice=round($item->getProduct()->getFinalPrice(),2,PHP_ROUND_HALF_DOWN)*$item->getQty();
407
- $taxAmount=round($totalPrice-$item->getPrice(),2,PHP_ROUND_HALF_DOWN);
408
- $item->setTaxAmount($taxAmount);
409
- $item->setTaxPercent(round($taxAmount*100/($totalPrice-$taxAmount),2));
410
- }
411
-
412
- //Add postage to quote
413
- $totals['grand_total']->setValue(round($totals['grand_total']->getValue(),2,PHP_ROUND_HALF_DOWN));
414
-
415
- $quote->setIsActive(0);
416
- $quote->save();
417
-
418
- $service = Mage::getModel('sales/service_quote', $quote);
419
- $service->submitAll();
420
-
421
- $order = $service->getOrder();
422
- $order->setShippingMethod($shippingMethod);
423
-
424
- $amountCharged=$process->PaymentConfirmation->AmountCharged;
425
- $order ->setSubtotal($amountCharged->BasketAmount)
426
- ->setSubtotalIncludingTax($amountCharged->BasePaymentAmount)
427
- ->setBaseSubtotal($amountCharged->BasketAmount)
428
- ->setGrandTotal($amountCharged->PaymentAmount)
429
- ->setBaseGrandTotal($amountCharged->PaymentAmount)
430
- ->setBaseTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN))
431
- ->setTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN));
432
-
433
- $order->getPayment()->capture(null);
434
-
435
- $order->place();
436
- $order->save();
437
- $order->sendNewOrderEmail();
438
-
439
- $quote->setIsActive(false);
440
- $quote->delete();
441
-
442
- $orderAccepted = new OrderAcceptedPayload();
443
- $orderAccepted->ReceiptId = $process->ProcessId();
444
- $orderAccepted->OrderId = $order->getIncrementId();
445
-
446
- return $orderAccepted;
447
- }
448
-
449
- public function randomPassword() {
450
- $alphabet = "abcdefghijkmnopqrstuwxyzABCDEFGHJKLMNPQRSTUWXYZ23456789";
451
- $pass='';
452
-
453
- for ($i = 0; $i < 8; $i++) {
454
- $n = rand(0, strlen($alphabet)-1);
455
- $pass .= $alphabet[$n];
456
- }
457
-
458
- return $pass;
459
- }
460
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  ?>
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
+ return parent::handle();
70
+ }
71
+
72
+ /// <summary>
73
+ /// Build some extra information about further charges.
74
+ /// </summary>
75
+ public function BuildAdditionalCharges($process) {
76
+ $additionalChargesContext = $process->AdditionalChargesContext;
77
+ $requires=$process->PurchaseInfo->Requires;
78
+ $purchaseCharges = new AdditionalChargesPayload();
79
+
80
+ if ($requires->DeliveryOptions && !empty($additionalChargesContext->DeliveryAddress)){
81
+ if(!$this->AddDeliveryCharges($additionalChargesContext->DeliveryAddress,$purchaseCharges,$process)){
82
+ $purchaseCharges->AddressNotSupported=1;
83
+ $purchaseCharges->AddressNotSupportedReason=Mage::getStoreConfig('onescantab/general/onescan_cannot-deliver-message');
84
+ }
85
+ }
86
+
87
+ if ($requires->Surcharges && !empty($additionalChargesContext->PaymentMethod)){
88
+ if(!$this->AddPaymentMethodCharges($additionalChargesContext->PaymentMethod,$purchaseCharges,$process)){
89
+ //REPORT SURCHARGES ERROR TO DEVICE;
90
+ }
91
+ }
92
+
93
+ return $purchaseCharges;
94
+ }
95
+
96
+ /// <summary>
97
+ /// Add charges for the specified payment method.
98
+ /// </summary>
99
+ public function AddPaymentMethodCharges($paymentMethod,$purchaseCharges,$process) {
100
+ switch ($paymentMethod->PaymentMethodType) {
101
+ case 'CreditCard':
102
+ $this->HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process);
103
+ break;
104
+ case 'OnescanPlay':
105
+ $this->HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process);
106
+ break;
107
+ }
108
+ return true;
109
+ }
110
+
111
+ /// <summary>
112
+ /// Handle charges for the onescan test card.
113
+ /// </summary>
114
+ public function HandlePlayCardCharges($paymentMethod,$purchaseCharges,$process) {
115
+ $cardDetails = $paymentMethod->CardInformation;
116
+
117
+ $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
118
+ $purchaseCharges->PaymentMethodCharge->Code = "PLAY";
119
+ $purchaseCharges->PaymentMethodCharge->Description = "The onescan play card attracts a £1 surcharge";
120
+ $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
121
+ $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = 1.00;
122
+ $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
123
+ $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = 1.00;
124
+ }
125
+
126
+ /// <summary>
127
+ /// Handle charges for credit cards
128
+ /// </summary>
129
+ public function HandleCreditCardCharges($paymentMethod,$purchaseCharges,$process) {
130
+ $cardDetails = $paymentMethod->CardInformation;
131
+
132
+ if ($cardDetails->PaymentSystemCode == "VISA") {
133
+
134
+ $surcharge = round($process->PurchaseInfo->PaymentAmount * 0.01, 2);
135
+
136
+ $purchaseCharges->PaymentMethodCharge = new PaymentMethodCharge();
137
+ $purchaseCharges->PaymentMethodCharge->Code = "VISA";
138
+ $purchaseCharges->PaymentMethodCharge->Description = "Paying with a credit card attracts a 1% charge";
139
+ $purchaseCharges->PaymentMethodCharge->Charge = new Charge();
140
+ $purchaseCharges->PaymentMethodCharge->Charge->BaseAmount = $surcharge;
141
+ $purchaseCharges->PaymentMethodCharge->Charge->Tax = 0;
142
+ $purchaseCharges->PaymentMethodCharge->Charge->TotalAmount = $surcharge;
143
+ }
144
+ }
145
+
146
+ /// <summary>
147
+ /// Add delivery charges for the specified address.
148
+ /// </summary>
149
+ public function AddDeliveryCharges($address,$purchaseCharges,$process) {
150
+ $onescanModel=Mage::getModel('onescan/sessiondata');
151
+ $onescanData = $onescanModel->getCollection();
152
+ $onescanData->addFieldToFilter('sessionid', array('like' => $process->SessionState()->SessionID));
153
+ $onescanData->load();
154
+ $sessionData=$onescanData->getData();
155
+ $quoteid=$sessionData[0]['quoteid'];
156
+
157
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
158
+ $cart->setQuoteId($quoteid);
159
+ $quote=$cart->getQuote();
160
+
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($address->CountryCode);
175
+ }
176
+ if ($quote->getShippingAddress()->getPostcode() == '') {
177
+ $quote->getShippingAddress()->setPostcode($address->Postcode);
178
+ }
179
+ $quote->getShippingAddress()->collectTotals();
180
+ $quote->getShippingAddress()->setCollectShippingRates(true);
181
+ $quote->getShippingAddress()->collectShippingRates();
182
+ $rates = $quote->getShippingAddress()->getShippingRatesCollection();
183
+ }
184
+ catch (Mage_Core_Exception $e) {
185
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
186
+ }
187
+ catch (Exception $e) {
188
+ Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Load customer quote error'));
189
+ }
190
+
191
+ $allowedRates=array();
192
+ $lowestPrice=99999;
193
+ foreach ($rates as $rate){
194
+ $rateCode=$rate->getCode();
195
+ if($quote->getShippingAddress()->collectShippingRates()->getShippingRateByCode($rateCode)){
196
+ $allowedRates[$rateCode]=$rate; //Using $rateCode as key removes duplicates
197
+ }
198
+
199
+ //Set the lowest rate as the default
200
+ if($rate->getPrice()<$lowestPrice){
201
+ $lowestPrice=$rate->getPrice();
202
+ $defaultCode=$rateCode;
203
+ }
204
+ }
205
+
206
+ $purchaseCharges->DeliveryOptions = array();
207
+ $taxCalculation = Mage::getModel('tax/calculation');
208
+ $request = $taxCalculation->getRateRequest(null,null,null,$quote->getStore());
209
+ $taxRateId = Mage::getStoreConfig('tax/classes/shipping_tax_class',$quote->getStore());
210
+ $shippingTaxPercent = $taxCalculation->getRate($request->setProductClassId($taxRateId));
211
+
212
+ $defaultIndex=0;
213
+ foreach ($rates as $rate) {
214
+ $amount=$rate->getPrice();
215
+ if(is_numeric($amount)){
216
+ $option=new DeliveryOption();
217
+ $option->Code = $rate->getCode();
218
+ $option->Description = $rate->getMethodDescription();//CheckThis
219
+ if($option->Code==$defaultCode){
220
+ $option->IsDefault = true;
221
+ $defaultIndex=count($purchaseCharges->DeliveryOptions);
222
+ }
223
+ $option->Label = $rate->getMethodTitle();
224
+ $option->Charge = new Charge();
225
+ $option->Charge->TotalAmount = $amount;
226
+ $option->Charge->Tax = $amount-($amount*100)/(100+$shippingTaxPercent);
227
+ $option->Charge->BaseAmount = $amount-$option->Charge->Tax;
228
+ $purchaseCharges->DeliveryOptions[]=$option;
229
+ }
230
+ }
231
+
232
+ if(count($purchaseCharges->DeliveryOptions)==0){
233
+ //NO SHIPPING RATES AVAILABLE FOR THIS ORDER
234
+ return false;
235
+ }
236
+
237
+ //Make sure the default rate is listed first
238
+ $option=$purchaseCharges->DeliveryOptions[$defaultIndex];
239
+ $purchaseCharges->DeliveryOptions[$defaultIndex]=$purchaseCharges->DeliveryOptions[0];
240
+ $purchaseCharges->DeliveryOptions[0]=$option;
241
+
242
+ $onescanModel->setId($sessionData[0]['sessiondata_id']);
243
+ $onescanModel->setSessionid($process->SessionState()->SessionID);
244
+ $onescanModel->setQuoteid($quoteid);
245
+ $onescanModel->setCustomerid($sessionData[0]['customerid']);
246
+ $onescanModel->setShippingmethod($option->Code);
247
+ $onescanModel->setShippingamount($option->Charge->TotalAmount * 100);//Floating point numbers are being stored as integers!
248
+ $onescanModel->setShippingtax($option->Charge->Tax * 100);//Floating point numbers are being stored as integers!
249
+ $onescanModel->save();
250
+
251
+ return true;
252
+ }
253
+
254
+ public function BuildPurchasePayload($sessionID) {
255
+ $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
256
+ $onescanData->addFieldToFilter('sessionid', array('like' => $sessionID));
257
+ $onescanData->load();
258
+ $sessionData=$onescanData->getData();
259
+ $quoteid=$sessionData[0]['quoteid'];
260
+
261
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
262
+ $cart->setQuoteId($quoteid);
263
+
264
+ $quote=$cart->getQuote();
265
+ $quote->reserveOrderId();
266
+ $quote->save();
267
+
268
+ $storeid=$quote->getStoreId();
269
+ $totals=$quote->getTotals();
270
+
271
+ $payload = new PurchasePayload();
272
+ $payload->RequiresDeliveryAddress = true;
273
+ $payload->MerchantName = Mage::app()->getStore()->getFrontendName();
274
+ $payload->MerchantTransactionID = GUID();
275
+ $payload->PurchaseDescription = Mage::getStoreConfig('onescantab/general/onescan_basket-name');
276
+
277
+ if(isset($totals['tax']) && $totals['tax']->getValue()) {
278
+ $payload->Tax = $totals['tax']->getValue();
279
+ } else {
280
+ $payload->Tax = 0;
281
+ }
282
+ $payload->ProductAmount = $totals['subtotal']->getValue()-$payload->Tax;
283
+ $payload->PaymentAmount = $totals['subtotal']->getValue();
284
+ $payload->Currency = Mage::app()->getStore($storeid)->getCurrentCurrencyCode();
285
+
286
+ $payload->Requires = new PaymentOptIns();
287
+
288
+ $payload->Requires->Surcharges = false;
289
+ $payload->Requires->DeliveryOptions=true;
290
+
291
+ $payload->ImageData = Mage::getStoreConfig('onescantab/general/onescan_basket-logo-url');
292
+
293
+ return $payload;
294
+ }
295
+
296
+ public function BuildOrderAccepted($process) {
297
+ $sessionState=$process->SessionState();
298
+ $sessionID = $sessionState->SessionID;
299
+
300
+ $onescanData = Mage::getModel('onescan/sessiondata')->getCollection();
301
+ $onescanData->addFieldToFilter('sessionid', array('like' => $process->SessionState()->SessionID));
302
+ $onescanData->load();
303
+ $sessionData=$onescanData->getData();
304
+
305
+ $quoteid=$sessionData[0]['quoteid'];
306
+ $customerid=$sessionData[0]['customerid'];
307
+ $shippingMethod=$sessionData[0]['shippingmethod'];
308
+ $shippingAmount=round($sessionData[0]['shippingamount'],2,PHP_ROUND_HALF_DOWN)/100;//Floating point numbers are being stored as integers!
309
+ $shippingTax=round($sessionData[0]['shippingtax'],2,PHP_ROUND_HALF_DOWN)/100;//Floating point numbers are being stored as integers!
310
+
311
+ $cart=Mage::getModel('checkout/cart')->getCheckoutSession();
312
+ $cart->setQuoteId($quoteid);
313
+ $totals=$cart->getQuote()->getTotals();
314
+ $quote=$cart->getQuote();
315
+
316
+ //TEMPORARY FIX FOR BLANK FIRST AND LAST NAMES
317
+ if ($process->PaymentConfirmation->FirstName=="") {
318
+ $process->PaymentConfirmation->FirstName="First";
319
+ }
320
+ if ($process->PaymentConfirmation->LastName=="") {
321
+ $process->PaymentConfirmation->LastName="Last";
322
+ }
323
+
324
+ if ($customerid) {
325
+ // We are already logged in:
326
+ $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->load($customerid);
327
+ $quote->assignCustomer($customer);
328
+ } else {
329
+ $loginTokens = Mage::getModel('onescan/logintokens')->getCollection();
330
+ $loginTokens->addFieldToFilter('onescantoken', array('like' => $process->UserToken));
331
+ $loginTokens->load();
332
+ $details=$loginTokens->getData();
333
+ $customer = Mage::getModel('customer/customer');
334
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
335
+ if (empty($details)) {
336
+ //We do not recognise the user token, so we create an account and log in
337
+ $customer->loadByEmail($process->PaymentConfirmation->UserEmail);
338
+
339
+ if(!$customer->getId()) {
340
+ //New customer registration
341
+ $customer->setEmail($process->PaymentConfirmation->UserEmail);
342
+ $customer->setFirstname($process->PaymentConfirmation->FirstName);
343
+ $customer->setLastname($process->PaymentConfirmation->LastName);
344
+ $customer->setPassword($this->randomPassword());
345
+ try {
346
+ $customer->save();
347
+ if (Mage::getStoreConfig('onescantab/general/onescan_skip-confirmation') || !$customer->isConfirmationRequired()) {
348
+ $customer->setConfirmation(null);
349
+ $customer->save();
350
+ $customer->sendNewAccountEmail(
351
+ 'registered',
352
+ '',
353
+ Mage::app()->getStore()->getId()
354
+ );
355
+ $confirmMessage=false;
356
+ } else {
357
+ $customer->sendNewAccountEmail(
358
+ 'confirmation',
359
+ $session->getBeforeAuthUrl(),
360
+ Mage::app()->getStore()->getId()
361
+ );
362
+ $confirmMessage=true;
363
+ }
364
+
365
+ $newToken=Mage::getModel('onescan/logintokens');
366
+ $newToken->setOnescantoken($process->UserToken);
367
+ $newToken->setMagentouserid($customer->getId());
368
+ $newToken->save();
369
+
370
+ $message=Mage::getStoreConfig('onescantab/general/onescan_register-success-message');
371
+
372
+ if ($confirmMessage) {
373
+ $value=Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
374
+ $message = Mage::helper('customer')->__(Mage::getStoreConfig('onescantab/general/onescan_email-not-confirmed-message'),$value);
375
+ }
376
+
377
+ LocalDataFactory::storeObject($sessionID,$customer->getId());
378
+ LocalDataFactory::storeObject($sessionID . '-message',$message);
379
+ }
380
+ catch (Mage_Core_Exception $e) {
381
+ LocalDataFactory::storeObject($sessionID . '-message',$e->getMessage());
382
+ }
383
+ } else { //Email address recognised so redirect to login page
384
+ LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_email-exists-message'));
385
+ }
386
+ } else {
387
+ //We recognise the user token, so we can log in
388
+ $customer->load($details[0]['magentouserid']);
389
+ LocalDataFactory::storeObject($sessionID,$details[0]['magentouserid']);
390
+ LocalDataFactory::storeObject($sessionID . '-message',Mage::getStoreConfig('onescantab/general/onescan_login-success-message'));
391
+ }
392
+ $quote->assignCustomer($customer);
393
+ }
394
+
395
+ $addressData = array(
396
+ 'firstname' => $process->PaymentConfirmation->FirstName,
397
+ 'lastname' => $process->PaymentConfirmation->LastName,
398
+ 'street' => $process->PaymentConfirmation->DeliveryAddress->AddressLine1 . ', ' . $process->PaymentConfirmation->DeliveryAddress->AddressLine2,
399
+ 'city' => $process->PaymentConfirmation->DeliveryAddress->Town,
400
+ 'postcode' => $process->PaymentConfirmation->DeliveryAddress->Postcode,
401
+ 'telephone' => '0',
402
+ 'country_id' => $process->PaymentConfirmation->DeliveryAddress->CountryCode,
403
+ );
404
+
405
+ $regions=Mage::getModel('directory/region')
406
+ ->getResourceCollection()
407
+ ->addCountryFilter($process->PaymentConfirmation->DeliveryAddress->CountryCode)
408
+ ->load();
409
+
410
+ $regionMatch=false;
411
+ foreach($regions as $region){
412
+ $regionName=$region->default_name;
413
+ $regionId=$region->region_id;
414
+ if(stripos($region->default_name,$process->PaymentConfirmation->DeliveryAddress->County)!==false ||
415
+ strcasecmp($process->PaymentConfirmation->DeliveryAddress->County,$region->code)==0 ||
416
+ //Use first region if county is empty
417
+ $process->PaymentConfirmation->DeliveryAddress->County==''){
418
+ $addressData['region']=$region->default_name;
419
+ $addressData['region_id']=$region->region_id;
420
+ $regionMatch=true;
421
+ break;
422
+ }
423
+ }
424
+ if(!$regionMatch){
425
+ $addressData['region']=$regionName;
426
+ $addressData['region_id']=$regionId;
427
+ }
428
+
429
+ $billingAddress = $quote->getBillingAddress()->addData($addressData);
430
+ $shippingAddress = $quote->getShippingAddress()->addData($addressData);
431
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
432
+ ->setShippingMethod($shippingMethod)
433
+ ->setPaymentMethod('onescan');
434
+
435
+ $quote->getShippingAddress()->collectTotals();
436
+
437
+ $quote->getPayment()->importData(array('method' => 'onescan'));
438
+
439
+ foreach($quote->getAllItems() as $item){
440
+ $totalPrice=round($item->getProduct()->getFinalPrice(),2,PHP_ROUND_HALF_DOWN)*$item->getQty();
441
+ $taxAmount=round($totalPrice-$item->getPrice(),2,PHP_ROUND_HALF_DOWN);
442
+ $item->setTaxAmount($taxAmount);
443
+ $item->setTaxPercent(round($taxAmount*100/($totalPrice-$taxAmount),2));
444
+ }
445
+
446
+ //Add postage to quote
447
+ $totals['grand_total']->setValue(round($totals['grand_total']->getValue(),2,PHP_ROUND_HALF_DOWN));
448
+
449
+ $quote->setIsActive(0);
450
+ $quote->save();
451
+
452
+ $service = Mage::getModel('sales/service_quote', $quote);
453
+ $service->submitAll();
454
+
455
+ $order = $service->getOrder();
456
+ $order->setShippingMethod($shippingMethod);
457
+
458
+ $amountCharged=$process->PaymentConfirmation->AmountCharged;
459
+ $order ->setSubtotal($amountCharged->BasketAmount)
460
+ ->setSubtotalIncludingTax($amountCharged->BasePaymentAmount)
461
+ ->setBaseSubtotal($amountCharged->BasketAmount)
462
+ ->setGrandTotal($amountCharged->PaymentAmount)
463
+ ->setBaseGrandTotal($amountCharged->PaymentAmount)
464
+ ->setBaseTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN))
465
+ ->setTaxAmount(round($amountCharged->BasketTax+$shippingTax,2,PHP_ROUND_HALF_DOWN));
466
+
467
+ $order->getPayment()->capture(null);
468
+
469
+ $order->place();
470
+ $order->save();
471
+ $order->sendNewOrderEmail();
472
+
473
+ $quote->setIsActive(false);
474
+ $quote->delete();
475
+
476
+ $orderAccepted = new OrderAcceptedPayload();
477
+ $orderAccepted->ReceiptId = $process->ProcessId();
478
+ $orderAccepted->OrderId = $order->getIncrementId();
479
+
480
+ return $orderAccepted;
481
+ }
482
+
483
+ public function randomPassword() {
484
+ $alphabet = "abcdefghijkmnopqrstuwxyzABCDEFGHJKLMNPQRSTUWXYZ23456789";
485
+ $pass='';
486
+
487
+ for ($i = 0; $i < 8; $i++) {
488
+ $n = rand(0, strlen($alphabet)-1);
489
+ $pass .= $alphabet[$n];
490
+ }
491
+
492
+ return $pass;
493
+ }
494
+ }
495
  ?>
app/code/local/Ensygnia/Onescan/etc/config.xml CHANGED
@@ -1,120 +1,121 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
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
- <config>
20
- <modules>
21
- <Ensygnia_Onescan>
22
- <version>1.0.9</version>
23
- </Ensygnia_Onescan>
24
- </modules>
25
- <global>
26
- <helpers>
27
- <onescan>
28
- <class>Ensygnia_Onescan_Helper</class>
29
- </onescan>
30
- </helpers>
31
- <blocks>
32
- <onescan>
33
- <class>Ensygnia_Onescan_Block</class>
34
- </onescan>
35
- </blocks>
36
- <resources>
37
- <onescan_setup>
38
- <setup>
39
- <module>Ensygnia_Onescan</module>
40
- <class>Ensygnia_Onescan_Model_Resource_Setup</class>
41
- </setup>
42
- </onescan_setup>
43
- </resources>
44
- <models>
45
- <onescan>
46
- <class>Ensygnia_Onescan_Model</class>
47
- <resourceModel>onescan_resource</resourceModel>
48
- </onescan>
49
- <onescan_resource>
50
- <class>Ensygnia_Onescan_Model_Resource</class>
51
- <entities>
52
- <sessiondata>
53
- <table>onescan_session_data</table>
54
- </sessiondata>
55
- <logintokens>
56
- <table>onescan_login_tokens</table>
57
- </logintokens>
58
- </entities>
59
- </onescan_resource>
60
- </models>
61
- </global>
62
- <default>
63
- <onescantab>
64
- <general>
65
- <enabled>1</enabled>
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>
73
- <onescan_login-success-message>You have successfully logged in using Onescan.</onescan_login-success-message>
74
- <onescan_email-not-confirmed-message>This account is not confirmed. &lt;a href="%s"&gt;Click here&lt;/a&gt; to resend confirmation email.</onescan_email-not-confirmed-message>
75
- <onescan_customer-deleted-message>We cannot find your account on our system. Please use Onescan to create a new account.</onescan_customer-deleted-message>
76
- <onescan_basket-name>Shopping Basket</onescan_basket-name>
77
- <show_on_cart_page>1</show_on_cart_page>
78
- <show_on_mini_cart>1</show_on_mini_cart>
79
- <show_now_accepting>1</show_now_accepting>
80
- </general>
81
- </onescantab>
82
- <payment>
83
- <onescan>
84
- <active>1</active>
85
- <model>onescan/method_onescan</model>
86
- <order_status>processing</order_status>
87
- <title>Onescan</title>
88
- <allowspecific>0</allowspecific>
89
- <group>offline</group>
90
- </onescan>
91
- </payment>
92
- </default>
93
- <frontend>
94
- <routers>
95
- <onescan>
96
- <use>standard</use>
97
- <args>
98
- <module>Ensygnia_Onescan</module>
99
- <frontName>onescan</frontName>
100
- </args>
101
- </onescan>
102
- </routers>
103
- <layout>
104
- <updates>
105
- <emc>
106
- <file>onescan.xml</file>
107
- </emc>
108
- </updates>
109
- </layout>
110
- </frontend>
111
- <adminhtml>
112
- <layout>
113
- <updates>
114
- <onescan>
115
- <file>onescan.xml</file>
116
- </onescan>
117
- </updates>
118
- </layout>
119
- </adminhtml>
 
120
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
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
+ <config>
20
+ <modules>
21
+ <Ensygnia_Onescan>
22
+ <version>1.0.10</version>
23
+ </Ensygnia_Onescan>
24
+ </modules>
25
+ <global>
26
+ <helpers>
27
+ <onescan>
28
+ <class>Ensygnia_Onescan_Helper</class>
29
+ </onescan>
30
+ </helpers>
31
+ <blocks>
32
+ <onescan>
33
+ <class>Ensygnia_Onescan_Block</class>
34
+ </onescan>
35
+ </blocks>
36
+ <resources>
37
+ <onescan_setup>
38
+ <setup>
39
+ <module>Ensygnia_Onescan</module>
40
+ <class>Ensygnia_Onescan_Model_Resource_Setup</class>
41
+ </setup>
42
+ </onescan_setup>
43
+ </resources>
44
+ <models>
45
+ <onescan>
46
+ <class>Ensygnia_Onescan_Model</class>
47
+ <resourceModel>onescan_resource</resourceModel>
48
+ </onescan>
49
+ <onescan_resource>
50
+ <class>Ensygnia_Onescan_Model_Resource</class>
51
+ <entities>
52
+ <sessiondata>
53
+ <table>onescan_session_data</table>
54
+ </sessiondata>
55
+ <logintokens>
56
+ <table>onescan_login_tokens</table>
57
+ </logintokens>
58
+ </entities>
59
+ </onescan_resource>
60
+ </models>
61
+ </global>
62
+ <default>
63
+ <onescantab>
64
+ <general>
65
+ <enabled>1</enabled>
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>
73
+ <onescan_cannot-deliver-message>We cannot deliver your order to the address you supplied.</onescan_cannot-deliver-message>
74
+ <onescan_login-success-message>You have successfully logged in using Onescan.</onescan_login-success-message>
75
+ <onescan_email-not-confirmed-message>This account is not confirmed. &lt;a href="%s"&gt;Click here&lt;/a&gt; to resend confirmation email.</onescan_email-not-confirmed-message>
76
+ <onescan_customer-deleted-message>We cannot find your account on our system. Please use Onescan to create a new account.</onescan_customer-deleted-message>
77
+ <onescan_basket-name>Shopping Basket</onescan_basket-name>
78
+ <show_on_cart_page>1</show_on_cart_page>
79
+ <show_on_mini_cart>1</show_on_mini_cart>
80
+ <show_now_accepting>1</show_now_accepting>
81
+ </general>
82
+ </onescantab>
83
+ <payment>
84
+ <onescan>
85
+ <active>1</active>
86
+ <model>onescan/method_onescan</model>
87
+ <order_status>processing</order_status>
88
+ <title>Onescan</title>
89
+ <allowspecific>0</allowspecific>
90
+ <group>offline</group>
91
+ </onescan>
92
+ </payment>
93
+ </default>
94
+ <frontend>
95
+ <routers>
96
+ <onescan>
97
+ <use>standard</use>
98
+ <args>
99
+ <module>Ensygnia_Onescan</module>
100
+ <frontName>onescan</frontName>
101
+ </args>
102
+ </onescan>
103
+ </routers>
104
+ <layout>
105
+ <updates>
106
+ <emc>
107
+ <file>onescan.xml</file>
108
+ </emc>
109
+ </updates>
110
+ </layout>
111
+ </frontend>
112
+ <adminhtml>
113
+ <layout>
114
+ <updates>
115
+ <onescan>
116
+ <file>onescan.xml</file>
117
+ </onescan>
118
+ </updates>
119
+ </layout>
120
+ </adminhtml>
121
  </config>
app/code/local/Ensygnia/Onescan/etc/system.xml CHANGED
@@ -117,11 +117,20 @@
117
  <show_in_website>1</show_in_website>
118
  <show_in_store>1</show_in_store>
119
  </onescan_email-exists-message>
 
 
 
 
 
 
 
 
 
120
  <onescan_login-success-message translate="label comment">
121
  <label>Login Success Message</label>
122
  <comment>Message to show after a successful login</comment>
123
  <frontend_type>text</frontend_type>
124
- <sort_order>80</sort_order>
125
  <show_in_default>1</show_in_default>
126
  <show_in_website>1</show_in_website>
127
  <show_in_store>1</show_in_store>
@@ -130,7 +139,7 @@
130
  <label>Email Not Confirmed Message</label>
131
  <comment>Message to show after a login attempt when email address has not been confirmed (use %s for resend email URL).</comment>
132
  <frontend_type>text</frontend_type>
133
- <sort_order>90</sort_order>
134
  <show_in_default>1</show_in_default>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>1</show_in_store>
@@ -139,7 +148,7 @@
139
  <label>Customer Deleted Message</label>
140
  <comment>Message to show after a login attempt when customer no longer exists.</comment>
141
  <frontend_type>text</frontend_type>
142
- <sort_order>90</sort_order>
143
  <show_in_default>1</show_in_default>
144
  <show_in_website>1</show_in_website>
145
  <show_in_store>1</show_in_store>
@@ -148,7 +157,7 @@
148
  <label>Shopping Basket Name</label>
149
  <comment>The name of the shopping basket that appears on the Onescanner's device.</comment>
150
  <frontend_type>text</frontend_type>
151
- <sort_order>100</sort_order>
152
  <show_in_default>1</show_in_default>
153
  <show_in_website>1</show_in_website>
154
  <show_in_store>1</show_in_store>
@@ -158,7 +167,7 @@
158
  <comment>Display the Onescan padlock on the cart page.</comment>
159
  <frontend_type>select</frontend_type>
160
  <source_model>adminhtml/system_config_source_yesno</source_model>
161
- <sort_order>110</sort_order>
162
  <show_in_default>1</show_in_default>
163
  <show_in_website>1</show_in_website>
164
  <show_in_store>1</show_in_store>
@@ -168,7 +177,7 @@
168
  <comment>Display the Onescan padlock in the mini cart.</comment>
169
  <frontend_type>select</frontend_type>
170
  <source_model>adminhtml/system_config_source_yesno</source_model>
171
- <sort_order>120</sort_order>
172
  <show_in_default>1</show_in_default>
173
  <show_in_website>1</show_in_website>
174
  <show_in_store>1</show_in_store>
@@ -178,7 +187,7 @@
178
  <comment>Display the "Now accepting Onescan" block.</comment>
179
  <frontend_type>select</frontend_type>
180
  <source_model>adminhtml/system_config_source_yesno</source_model>
181
- <sort_order>130</sort_order>
182
  <show_in_default>1</show_in_default>
183
  <show_in_website>1</show_in_website>
184
  <show_in_store>1</show_in_store>
117
  <show_in_website>1</show_in_website>
118
  <show_in_store>1</show_in_store>
119
  </onescan_email-exists-message>
120
+ <onescan_cannot-deliver-message translate="label comment">
121
+ <label>Cannot Deliver Message</label>
122
+ <comment>Error message that is shown on the Onescanner's device if the order cannot be delivered to the address that they supplied</comment>
123
+ <frontend_type>text</frontend_type>
124
+ <sort_order>80</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ </onescan_cannot-deliver-message>
129
  <onescan_login-success-message translate="label comment">
130
  <label>Login Success Message</label>
131
  <comment>Message to show after a successful login</comment>
132
  <frontend_type>text</frontend_type>
133
+ <sort_order>90</sort_order>
134
  <show_in_default>1</show_in_default>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>1</show_in_store>
139
  <label>Email Not Confirmed Message</label>
140
  <comment>Message to show after a login attempt when email address has not been confirmed (use %s for resend email URL).</comment>
141
  <frontend_type>text</frontend_type>
142
+ <sort_order>100</sort_order>
143
  <show_in_default>1</show_in_default>
144
  <show_in_website>1</show_in_website>
145
  <show_in_store>1</show_in_store>
148
  <label>Customer Deleted Message</label>
149
  <comment>Message to show after a login attempt when customer no longer exists.</comment>
150
  <frontend_type>text</frontend_type>
151
+ <sort_order>110</sort_order>
152
  <show_in_default>1</show_in_default>
153
  <show_in_website>1</show_in_website>
154
  <show_in_store>1</show_in_store>
157
  <label>Shopping Basket Name</label>
158
  <comment>The name of the shopping basket that appears on the Onescanner's device.</comment>
159
  <frontend_type>text</frontend_type>
160
+ <sort_order>120</sort_order>
161
  <show_in_default>1</show_in_default>
162
  <show_in_website>1</show_in_website>
163
  <show_in_store>1</show_in_store>
167
  <comment>Display the Onescan padlock on the cart page.</comment>
168
  <frontend_type>select</frontend_type>
169
  <source_model>adminhtml/system_config_source_yesno</source_model>
170
+ <sort_order>130</sort_order>
171
  <show_in_default>1</show_in_default>
172
  <show_in_website>1</show_in_website>
173
  <show_in_store>1</show_in_store>
177
  <comment>Display the Onescan padlock in the mini cart.</comment>
178
  <frontend_type>select</frontend_type>
179
  <source_model>adminhtml/system_config_source_yesno</source_model>
180
+ <sort_order>140</sort_order>
181
  <show_in_default>1</show_in_default>
182
  <show_in_website>1</show_in_website>
183
  <show_in_store>1</show_in_store>
187
  <comment>Display the "Now accepting Onescan" block.</comment>
188
  <frontend_type>select</frontend_type>
189
  <source_model>adminhtml/system_config_source_yesno</source_model>
190
+ <sort_order>150</sort_order>
191
  <show_in_default>1</show_in_default>
192
  <show_in_website>1</show_in_website>
193
  <show_in_store>1</show_in_store>
app/design/frontend/base/default/layout/onescan.xml CHANGED
@@ -1,87 +1,84 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
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
- <layout>
20
- <default>
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
- <reference name="before_body_end">
27
- <block type="core/template" name="ensygnia_onescan" as="ensygnia_onescan" template="onescan/scripts.phtml" />
28
- </reference>
29
-
30
- <!-- we don't attach this to anything, it's just created in the root so we can conditionally attach it later -->
31
- <!--block type="core/text_list" name="onescan.container" as="onescan" translate="label"-->
32
- <block type="onescan/login" name="onescan.login" as="onescanlogin" translate="label" template="onescan/login.phtml">
33
- <label>Onescan login module</label>
34
- </block>
35
-
36
- <block type="onescan/register" name="onescan.register" as="onescanregister" translate="label" template="onescan/register.phtml">
37
- <label>Onescan register module</label>
38
- </block>
39
-
40
- <block type="onescan/basket" name="onescan.basket" as="onescanbasket" translate="label" template="onescan/basket.phtml">
41
- <label>Onescan basket module</label>
42
- </block>
43
-
44
- <block type="checkout/cart_totals" name="onescan.cart.totals" as="totals" template="checkout/cart/totals.phtml"></block>
45
-
46
- <block type="onescan/logo" name="onescan.logo" as="onescanlogo" translate="label" template="onescan/logo.phtml">
47
- <label>Onescan logo</label>
48
- </block>
49
- <!--/block-->
50
-
51
- <reference name="right">
52
- <action method="insert" ifconfig="onescantab/general/show_now_accepting"><blockName>onescan.logo</blockName><siblingName>right.reports.product.viewed</siblingName><after>1</after></action>
53
- </reference>
54
-
55
- <reference name="cart_sidebar.extra_actions">
56
- <action method="append" ifconfig="onescantab/general/show_on_mini_cart"><block>onescan.basket</block></action>
57
- </reference>
58
- </default>
59
-
60
- <!--catalog_product_view>
61
- <reference name="content">
62
- <action method="append" ifconfig="onescantab/general/product_move_main"><block>onescan.container</block></action>
63
- </reference>
64
- </catalog_product_view-->
65
-
66
- <checkout_cart_index>
67
- <reference name="checkout.cart.top_methods">
68
- <action method="unsetChildren"/>
69
- </reference>
70
- <reference name="checkout.cart.methods">
71
- <action method="append"><block>onescan.cart.totals</block></action>
72
- <action method="insert" ifconfig="onescantab/general/show_on_cart_page"><block>onescan.basket</block></action>
73
- </reference>
74
- </checkout_cart_index>
75
-
76
- <customer_account_create>
77
- <reference name="customer.form.register.fields.before">
78
- <action method="append"><block>onescan.register</block></action>
79
- </reference>
80
- </customer_account_create>
81
-
82
- <customer_account_login>
83
- <reference name="content">
84
- <action method="append"><block>onescan.login</block></action>
85
- </reference>
86
- </customer_account_login>
87
  </layout>
1
+ <?xml version="1.0" encoding="UTF-8"?>
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
+ <layout>
20
+ <default>
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
+ <reference name="before_body_end">
27
+ <block type="core/template" name="ensygnia_onescan" as="ensygnia_onescan" template="onescan/scripts.phtml" />
28
+ </reference>
29
+
30
+ <block type="onescan/login" name="onescan.login" as="onescanlogin" translate="label" template="onescan/login.phtml">
31
+ <label>Onescan login module</label>
32
+ </block>
33
+
34
+ <block type="onescan/register" name="onescan.register" as="onescanregister" translate="label" template="onescan/register.phtml">
35
+ <label>Onescan register module</label>
36
+ </block>
37
+
38
+ <block type="onescan/basket" name="onescan.basket" as="onescanbasket" translate="label" template="onescan/basket.phtml">
39
+ <label>Onescan basket module</label>
40
+ </block>
41
+
42
+ <block type="checkout/cart_totals" name="onescan.cart.totals" as="totals" template="checkout/cart/totals.phtml"></block>
43
+
44
+ <block type="onescan/logo" name="onescan.logo" as="onescanlogo" translate="label" template="onescan/logo.phtml">
45
+ <label>Onescan logo</label>
46
+ </block>
47
+
48
+ <reference name="right">
49
+ <action method="insert" ifconfig="onescantab/general/show_now_accepting"><blockName>onescan.logo</blockName><siblingName>right.reports.product.viewed</siblingName><after>1</after></action>
50
+ </reference>
51
+
52
+ <reference name="cart_sidebar.extra_actions">
53
+ <action method="append" ifconfig="onescantab/general/show_on_mini_cart"><block>onescan.basket</block></action>
54
+ </reference>
55
+ </default>
56
+
57
+ <!--catalog_product_view>
58
+ <reference name="content">
59
+ <action method="append" ifconfig="onescantab/general/product_move_main"><block>onescan.container</block></action>
60
+ </reference>
61
+ </catalog_product_view-->
62
+
63
+ <checkout_cart_index>
64
+ <reference name="checkout.cart.top_methods">
65
+ <action method="unsetChildren"/>
66
+ </reference>
67
+ <reference name="checkout.cart.methods">
68
+ <action method="append"><block>onescan.cart.totals</block></action>
69
+ <action method="insert" ifconfig="onescantab/general/show_on_cart_page"><block>onescan.basket</block></action>
70
+ </reference>
71
+ </checkout_cart_index>
72
+
73
+ <customer_account_create>
74
+ <reference name="customer.form.register.fields.before">
75
+ <action method="append"><block>onescan.register</block></action>
76
+ </reference>
77
+ </customer_account_create>
78
+
79
+ <customer_account_login>
80
+ <reference name="content">
81
+ <action method="append"><block>onescan.login</block></action>
82
+ </reference>
83
+ </customer_account_login>
 
 
 
84
  </layout>
app/design/frontend/base/default/template/onescan/scripts.phtml CHANGED
@@ -1,3 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <script type="text/javascript" src="//onescanresources.ensygnia.net/onescan/latest/scripts/jquery-1.11.1.min.js"></script>
2
  <script type="text/javascript">jQuery.noConflict();</script>
3
  <script type="text/javascript" src="//onescanresources.ensygnia.net/onescan/latest/scripts/onescan.js"></script>
 
 
 
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
+ ?>
20
  <script type="text/javascript" src="//onescanresources.ensygnia.net/onescan/latest/scripts/jquery-1.11.1.min.js"></script>
21
  <script type="text/javascript">jQuery.noConflict();</script>
22
  <script type="text/javascript" src="//onescanresources.ensygnia.net/onescan/latest/scripts/onescan.js"></script>
23
+ <script type="text/javascript">
24
+ var magentobase='<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); ?>';
25
+ </script>
lib/Onescan/purchase/onescan-PurchaseProcess.php CHANGED
@@ -203,15 +203,19 @@
203
  $this->responseMessage->MessageType = "OrderAccepted";
204
  $this->responseMessage->ProcessId = $this->requestMessage->ProcessId;
205
 
206
- $messagePayload = $this->responseMessage->AddNewPayloadItem();
207
- $messagePayload->JsonPayload = json_encode($outcome);
208
- $messagePayload->PayloadName = ProcessOutcome::Name;
 
 
209
 
210
- $confirmPayload = $this->responseMessage->AddNewPayloadItem();
211
- $confirmPayload->JsonPayload = json_encode($orderAccepted);
212
- $confirmPayload->PayloadName = OrderAcceptedPayload::Name;
 
 
213
 
214
- $this->InternalAddOutcome($outcome);
215
 
216
  return $this->responseMessage;
217
  }
203
  $this->responseMessage->MessageType = "OrderAccepted";
204
  $this->responseMessage->ProcessId = $this->requestMessage->ProcessId;
205
 
206
+ if($outcome!=null){
207
+ $messagePayload = $this->responseMessage->AddNewPayloadItem();
208
+ $messagePayload->JsonPayload = json_encode($outcome);
209
+ $messagePayload->PayloadName = ProcessOutcome::Name;
210
+ }
211
 
212
+ if($orderAccepted!=null){
213
+ $confirmPayload = $this->responseMessage->AddNewPayloadItem();
214
+ $confirmPayload->JsonPayload = json_encode($orderAccepted);
215
+ $confirmPayload->PayloadName = OrderAcceptedPayload::Name;
216
+ }
217
 
218
+ //$this->InternalAddOutcome($outcome);
219
 
220
  return $this->responseMessage;
221
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ensygnia_Onescan</name>
4
- <version>1.0.9</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.8 of the Onescan Payment Plugin extension.&#xD;
18
  &#xD;
19
  Changelog&#xD;
20
  ---------------&#xD;
21
  &#xD;
 
 
 
 
 
 
 
22
  1.0.9&#xD;
23
  Under certain circumstances, shipping charges were being added twice - fixed.&#xD;
24
  &#xD;
@@ -59,9 +66,9 @@ Fixed potential installation problem.&#xD;
59
  1.0.0&#xD;
60
  Initial version.</notes>
61
  <authors><author><name>Ensygnia</name><user>MAG002660123</user><email>paul.newson@ensygnia.com</email></author></authors>
62
- <date>2015-06-24</date>
63
- <time>11:32:57</time>
64
- <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="f581b1fc158d218d2890b3bc70e42c4c"/><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="f3ebb787d77bb2e52c67bbd9471a67e7"/><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="9ae2e11e409f7602cd55c0cccba4fb4e"/></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="fd3e885fcded6fbe96ca8ed7a4a4599e"/></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="da58f432f4e49231cf08355406b6f8d6"/></dir></dir></dir></dir></target></contents>
65
  <compatible/>
66
  <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>
67
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ensygnia_Onescan</name>
4
+ <version>1.0.10</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.10 of the Onescan Payment Plugin extension.&#xD;
18
  &#xD;
19
  Changelog&#xD;
20
  ---------------&#xD;
21
  &#xD;
22
+ 1.0.10&#xD;
23
+ Purchase failure where delivery is to a country in which Magento requires state/region information to be present - fixed.&#xD;
24
+ &#xD;
25
+ Configurable error message added if the Magento store cannot deliver the Onescanner's order to the address supplied by Onescan.&#xD;
26
+ &#xD;
27
+ The incorrect URL was being used for the redirect after a successful order in some Magento store configurations - fixed.&#xD;
28
+ &#xD;
29
  1.0.9&#xD;
30
  Under certain circumstances, shipping charges were being added twice - fixed.&#xD;
31
  &#xD;
66
  1.0.0&#xD;
67
  Initial version.</notes>
68
  <authors><author><name>Ensygnia</name><user>MAG002660123</user><email>paul.newson@ensygnia.com</email></author></authors>
69
+ <date>2015-06-25</date>
70
+ <time>14:45:10</time>
71
+ <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="b4c4a7c5b18962537b7837efea5cec52"/><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="84ceeb13eb19f1718ff889d713653dde"/><file name="system.xml" hash="c79ddda9a40da31dd431fbedacdc7263"/><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="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="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>
72
  <compatible/>
73
  <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>
74
  </package>
skin/adminhtml/default/default/onescan/images/Thumbs.db DELETED
Binary file
skin/frontend/base/default/js/onescan.js CHANGED
@@ -1,42 +1,37 @@
1
- /*
2
- Ensygnia Onescan extension
3
- Copyright (C) 2014 Ensygnia Ltd
4
-
5
- This program is free software: you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation, either version 3 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License
16
- along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- */
18
- function postConfirm(basket) {
19
- // Redirect to purchase success page
20
- currentUrl=window.location.toString();
21
- var magentobase=currentUrl.substring(0,currentUrl.indexOf("index.php"));
22
- if (basket==0){
23
- window.location.assign(magentobase + 'index.php/onescan/index/purchasesuccess');
24
- } else {
25
- window.location.assign(magentobase + 'index.php/onescan/index/purchasesuccess/?basket=' + basket);
26
- }
27
- }
28
-
29
- function postFailed() {
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='//onescanresources.ensygnia.net/onescan/latest/scripts/onescan.js';
40
-
41
- var headElement=document.getElementsByTagName('head')[0];
42
- headElement.appendChild(scriptElement);*/
1
+ /*
2
+ Ensygnia Onescan extension
3
+ Copyright (C) 2014 Ensygnia Ltd
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ function postConfirm(basket) {
20
+ // Redirect to purchase success page
21
+ if(typeof(magentobase)=='undefined'){
22
+ window.setTimeout(postConfirm(basket),250);
23
+ }else{
24
+ if (basket==0){
25
+ window.location.assign(magentobase + 'onescan/index/purchasesuccess');
26
+ } else {
27
+ window.location.assign(magentobase + 'onescan/index/purchasesuccess/?basket=' + basket);
28
+ }
29
+ }
30
+ }
31
+
32
+
33
+ function postFailed() {
34
+ // Redirect to failure page
35
+ alert('Failed!');
36
+ //window.location.assign(location.href+'?confirm=false');
37
+ }