Popular_Payments_Snap_HostedPayments - Version 2.0.0

Version Notes

Added Card Storing support.

Download this release

Release Info

Developer Popular Payments
Extension Popular_Payments_Snap_HostedPayments
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.0.0 to 2.0.0

Files changed (31) hide show
  1. app/code/local/Evo/HostedPayments/Block/Form.php +8 -0
  2. app/code/local/Evo/HostedPayments/Block/Info.php +23 -0
  3. app/code/local/Evo/HostedPayments/Block/Storedcards.php +83 -0
  4. app/code/local/Evo/HostedPayments/Model/Payment.php +134 -52
  5. app/code/local/Evo/HostedPayments/Model/Resource/Storedcard.php +43 -0
  6. app/code/local/Evo/HostedPayments/Model/Resource/Storedcard/Collection.php +43 -0
  7. app/code/local/Evo/HostedPayments/Model/Storedcard.php +57 -0
  8. app/code/local/Evo/HostedPayments/controllers/IndexController.php +89 -0
  9. app/code/local/Evo/HostedPayments/controllers/ProcessingController.php +24 -14
  10. app/code/local/Evo/HostedPayments/etc/config.xml +5 -7
  11. app/code/local/Evo/HostedPayments/etc/system.xml +54 -0
  12. app/code/local/Evo/HostedPayments/sql/hostedpayments_setup/install-0.1.0.php +17 -17
  13. app/code/local/Evo/HostedPayments/sql/hostedpayments_setup/upgrade-1.0.0-2.0.0.php +76 -0
  14. app/design/frontend/base/default/layout/evohostedpayments.xml +28 -1
  15. app/design/frontend/base/default/template/evo/form.phtml +36 -0
  16. app/design/frontend/base/default/template/evo/info.phtml +18 -9
  17. app/design/frontend/base/default/template/evo/storedcards.phtml +92 -0
  18. app/etc/modules/Evo_HostedPayments.xml +2 -0
  19. app/locale/en_US/Evo_HostedPayments.csv +21 -1
  20. app/locale/es_ES/Evo_HostedPayments.csv +21 -1
  21. lib/hostedpayments/evosnap_api.php +375 -46
  22. lib/hostedpayments/evosnap_tools.php +47 -13
  23. lib/hostedpayments/index.php +1 -0
  24. lib/hostedpayments/model/subscription.php +2 -2
  25. lib/hostedpayments/model/token.php +6 -0
  26. lib/hostedpayments/model/token_checkout.php +50 -0
  27. package.xml +7 -7
  28. skin/frontend/base/default/images/evo/cc_amex.png +0 -0
  29. skin/frontend/base/default/images/evo/cc_discover.png +0 -0
  30. skin/frontend/base/default/images/evo/cc_mc.png +0 -0
  31. skin/frontend/base/default/images/evo/cc_visa.png +0 -0
app/code/local/Evo/HostedPayments/Block/Form.php CHANGED
@@ -43,5 +43,13 @@ class Evo_HostedPayments_Block_Form extends Mage_Payment_Block_Form
43
  {
44
  $this->setTemplate('evo/form.phtml');
45
  parent::_construct();
 
 
 
 
 
 
 
 
46
  }
47
  }
43
  {
44
  $this->setTemplate('evo/form.phtml');
45
  parent::_construct();
46
+ $this->_initCreditCards();
47
+ }
48
+
49
+ private function _initCreditCards(){
50
+ $cards = Mage::getResourceModel('hostedpayments/storedcard_collection')->addFieldToSelect('*')
51
+ ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
52
+ ->addFieldToFilter('acct_exp', array('gteq' => date('Y-m-d')));
53
+ $this->setStoredCards($cards);
54
  }
55
  }
app/code/local/Evo/HostedPayments/Block/Info.php CHANGED
@@ -56,4 +56,27 @@ class Evo_HostedPayments_Block_Info extends Mage_Payment_Block_Info
56
  return $result;
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
56
  return $result;
57
  }
58
 
59
+ /**
60
+ * Retrieves stored card data.
61
+ * @return Mage_Core_Model_Abstract
62
+ */
63
+ public function getStoredCardData() {
64
+ $tokenId = (int) $this->getInfo()->getAdditionalInformation('token_id');
65
+
66
+ if($tokenId && ($tokenId > 0)){
67
+ return Mage::getModel('hostedpayments/storedcard')->load($tokenId);
68
+ }
69
+ return false;
70
+ }
71
+
72
+ /**
73
+ * Tests if the card data is going to be saved in EVO Snap*.
74
+ * @return boolean
75
+ */
76
+ public function isCardSaved() {
77
+ $tokenId = (int) $this->getInfo()->getAdditionalInformation('token_id');
78
+ return ($this->getInfo()->getAdditionalInformation('create_token') === 'true') &&
79
+ !($tokenId && ($tokenId > 0));
80
+ }
81
+
82
  }
app/code/local/Evo/HostedPayments/Block/Storedcards.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2016 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * EVO Snap* Stored Cards Block.
31
+ *
32
+ * @category EVO
33
+ * @package Evo
34
+ * @copyright Copyright (c) 2016 EVO Snap* (http://www.evosnap.com)
35
+ * @license EVO Payments International EULA
36
+ */
37
+ class Evo_HostedPayments_Block_Storedcards extends Mage_Core_Block_Template
38
+ {
39
+ /**
40
+ * Varien constructor
41
+ */
42
+ protected function _construct()
43
+ {
44
+ parent::_construct();
45
+ $this->setTemplate('evo/storedcards.phtml');
46
+ $storedcards = Mage::getResourceModel('hostedpayments/storedcard_collection')->addFieldToSelect('*')
47
+ ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId());
48
+
49
+ $this->setStoredCards($storedcards);
50
+ }
51
+
52
+ protected function _prepareLayout()
53
+ {
54
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'hostedpayments.storedcards.pager')
55
+ ->setCollection($this->getStoredCards());
56
+ $pager->setShowAmounts(false);
57
+ $this->setChild('pager', $pager);
58
+ $this->getStoredCards()->load();
59
+ return parent::_prepareLayout();
60
+ }
61
+
62
+ /**
63
+ * Generates Pager code.
64
+ * @return Ambigous <string, multitype:>
65
+ */
66
+ public function getPagerHtml()
67
+ {
68
+ return $this->getChildHtml('pager');
69
+ }
70
+
71
+ /**
72
+ * Retrieves back URL.
73
+ * @return Ambigous <string, mixed>
74
+ */
75
+ public function getBackUrl()
76
+ {
77
+ if ($this->getRefererUrl()) {
78
+ return $this->getRefererUrl();
79
+ }
80
+ return $this->getUrl('customer/account/', array('_secure'=>true));
81
+ }
82
+
83
+ }
app/code/local/Evo/HostedPayments/Model/Payment.php CHANGED
@@ -63,7 +63,26 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
63
  protected $_code = 'hostedpayments';
64
  protected $_formBlockType = 'hostedpayments/form';
65
  protected $_infoBlockType = 'hostedpayments/info';
66
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Retrieve model helper
69
  *
@@ -86,18 +105,6 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
86
  return Mage::getSingleton('checkout/session');
87
  }
88
 
89
- /**
90
- * Get current quote
91
- *
92
- * @return Mage_Sales_Model_Quote
93
- */
94
- public function getQuote()
95
- {
96
- Mage::log(" --- Snap* Hosted Payments API : getQuote --- ");
97
- return $this->getCheckout()->getQuote();
98
- }
99
-
100
-
101
  /**
102
  * Get order model
103
  *
@@ -141,7 +148,7 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
141
  */
142
  public function getOrderPlaceRedirectUrl()
143
  {
144
- return Mage::getUrl('hostedpayments/processing/pay');
145
  }
146
 
147
  /**
@@ -192,7 +199,7 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
192
  $paymentUrl = $hostedpayment->getUrl();
193
 
194
  if(!isset($paymentUrl) || trim($paymentUrl) == '' ){
195
- $paymentUrl = EvoSnapApi::getOrderCheckoutUrl($this->_getOrderCheckout(),
196
  $this->getTrigger3ds(), $this->getHostedPaymentsConfiguration());
197
 
198
  $order->addStatusToHistory($order->getStatus(), Mage::helper('hostedpayments')->__('Customer was redirected to the Snap* Hosted Payments Checkout for payment.'));
@@ -258,17 +265,48 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
258
  }
259
 
260
  /**
261
- * Cancels order.
262
  */
263
  public function payOrder($snapOrder){
264
  $order = $this->getOrder();
265
 
 
 
 
 
266
  $order->getPayment()->setTransactionId($this->_getTransactionId($snapOrder));
267
  $order->getPayment()->capture(null);
268
  $order->save();
269
  $this->_clearHostedpaymentUrl($order->getRealOrderId());
270
  }
271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  private function _clearHostedpaymentUrl($order_id){
273
  $hostedpayment = Mage::getModel('hostedpayments/hostedpayment');
274
  $hostedpayment->load($order_id, 'order_id');
@@ -279,14 +317,8 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
279
 
280
  private function _getTransactionId($snapOrder){
281
  $result = null;
282
- if(is_array($snapOrder->transactions)){
283
- for($i = count($snapOrder->transactions) - 1; $i >= 0; $i--){
284
- $txn = $snapOrder->transactions[$i];
285
- if($txn->txn_action == 'sale'){
286
- $result = $txn->txn_id;
287
- $i = -1;
288
- }
289
- }
290
  }
291
 
292
  return $result;
@@ -306,43 +338,20 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
306
  $checkout->cancel_url = $checkout->return_url;
307
  $checkout->auto_return = true;
308
  $checkout->checkout_layout = $layout;
309
- $checkout->create_token = false;
310
  $checkout->language = EvoSnapTools::getLanguage(Mage::app()->getLocale()->getLocale()->getLanguage());
311
 
312
- $billing = $mOrder->getBillingAddress();
313
- $shipping = $mOrder->getShippingAddress();
314
-
315
  $customer = new SnapCustomer();
316
 
317
  $customer->first_name = $mOrder->getCustomerFirstname();
318
  $customer->last_name = $mOrder->getCustomerLastname();
319
  $customer->email = $mOrder->getCustomerEmail();
320
- $customer->phone = $billing->getTelephone();
321
 
322
  $checkout->customer = $customer;
323
 
324
- $order = new SnapOrder();
325
- $checkout->order = $order;
326
-
327
- $order->id = $this->_getOrderId($this->getConfigData('order_prefix'), $mOrder->getRealOrderId());
328
- $order->total_subtotal = $mOrder->getSubtotal();
329
- $order->total_discount = abs($mOrder->getDiscountAmount());
330
- $order->total_shipping = $mOrder->getShippingAmount();
331
- $order->total_tax = $mOrder->getTaxAmount();
332
- $order->total = $mOrder->getBaseGrandTotal();
333
- $order->currency_code = $mOrder->getOrderCurrencyCode();
334
-
335
- $products = $mOrder->getAllItems();
336
- for($i = 0; $i < count($products); $i++) {
337
- $order_lines[$i] = $this->_getOrderItem($products[$i]);
338
- }
339
- $order->lines = $order_lines;
340
-
341
- $order->billto_address = $this->_getAddress($billing);
342
- if(!empty($shipping)){
343
- $order->shipto_address = $this->_getAddress($billing);
344
- }
345
-
346
  return $checkout;
347
  }
348
 
@@ -383,7 +392,7 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
383
  }
384
 
385
  private function _getOrderId($order_prefix, $id_order){
386
- if(isset($order_prefix)){
387
  $result = $order_prefix.$id_order;
388
  }else{
389
  $result = $id_order;
@@ -393,6 +402,79 @@ class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstrac
393
  }
394
 
395
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  /**
397
  * prepare params array to send it to gateway page via POST
398
  *
63
  protected $_code = 'hostedpayments';
64
  protected $_formBlockType = 'hostedpayments/form';
65
  protected $_infoBlockType = 'hostedpayments/info';
66
+
67
+ /**
68
+ * Assign data to info model instance
69
+ *
70
+ * @param mixed $data
71
+ * @return Mage_Payment_Model_Info
72
+ */
73
+ public function assignData($data)
74
+ {
75
+ if (!($data instanceof Varien_Object)) {
76
+ $data = new Varien_Object($data);
77
+ }
78
+
79
+ $info = $this->getInfoInstance();
80
+ $info->setAdditionalInformation('token_id', $data->getTokenId());
81
+ $info->setAdditionalInformation('create_token', $data->getCreateToken());
82
+
83
+ return $this;
84
+ }
85
+
86
  /**
87
  * Retrieve model helper
88
  *
105
  return Mage::getSingleton('checkout/session');
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  /**
109
  * Get order model
110
  *
148
  */
149
  public function getOrderPlaceRedirectUrl()
150
  {
151
+ return Mage::getUrl('hostedpayments/processing/pay');
152
  }
153
 
154
  /**
199
  $paymentUrl = $hostedpayment->getUrl();
200
 
201
  if(!isset($paymentUrl) || trim($paymentUrl) == '' ){
202
+ $paymentUrl = EvoSnapApi::getCheckoutUrl($this->_getOrderCheckout(),
203
  $this->getTrigger3ds(), $this->getHostedPaymentsConfiguration());
204
 
205
  $order->addStatusToHistory($order->getStatus(), Mage::helper('hostedpayments')->__('Customer was redirected to the Snap* Hosted Payments Checkout for payment.'));
265
  }
266
 
267
  /**
268
+ * Pays order.
269
  */
270
  public function payOrder($snapOrder){
271
  $order = $this->getOrder();
272
 
273
+ if($this->_isCardSaved()){
274
+ $this->_saveCard($snapOrder);
275
+ }
276
+
277
  $order->getPayment()->setTransactionId($this->_getTransactionId($snapOrder));
278
  $order->getPayment()->capture(null);
279
  $order->save();
280
  $this->_clearHostedpaymentUrl($order->getRealOrderId());
281
  }
282
 
283
+ private function _saveCard($snapOrder){
284
+ $token = $snapOrder->payment_transaction;
285
+ $order = $this->getOrder();
286
+
287
+ $storedCard = Mage::getModel('hostedpayments/storedcard');
288
+ $storedCard->setCustomerId($order->getCustomerId());
289
+ $storedCard->setTokenId($snapOrder->merchant_order_id.'-ODT-1');
290
+ $storedCard->setAcctName($token->acct_name);
291
+ $storedCard->setAcctNum(substr($token->acct_num,-4,4));
292
+ $storedCard->setAcctExp(strtotime($token->acct_exp));
293
+ $storedCard->setAcctType($token->acct_type);
294
+ $storedCard->setCurrencyCode($token->currency_code);
295
+ $storedCard->setDataChanges(true);
296
+ $storedCard->save();
297
+ }
298
+
299
+ /**
300
+ * Pays order.
301
+ */
302
+ private function _payOrder($transactionId){
303
+ $order = $this->getOrder();
304
+
305
+ $order->getPayment()->setTransactionId($transactionId);
306
+ $order->getPayment()->capture(null);
307
+ $order->save();
308
+ }
309
+
310
  private function _clearHostedpaymentUrl($order_id){
311
  $hostedpayment = Mage::getModel('hostedpayments/hostedpayment');
312
  $hostedpayment->load($order_id, 'order_id');
317
 
318
  private function _getTransactionId($snapOrder){
319
  $result = null;
320
+ if($snapOrder->payment_transaction){
321
+ $result = $snapOrder->payment_transaction->txn_id;
 
 
 
 
 
 
322
  }
323
 
324
  return $result;
338
  $checkout->cancel_url = $checkout->return_url;
339
  $checkout->auto_return = true;
340
  $checkout->checkout_layout = $layout;
341
+ $checkout->create_token = $this->_isCardSaved();
342
  $checkout->language = EvoSnapTools::getLanguage(Mage::app()->getLocale()->getLocale()->getLanguage());
343
 
 
 
 
344
  $customer = new SnapCustomer();
345
 
346
  $customer->first_name = $mOrder->getCustomerFirstname();
347
  $customer->last_name = $mOrder->getCustomerLastname();
348
  $customer->email = $mOrder->getCustomerEmail();
349
+ $customer->phone = $mOrder->getBillingAddress()->getTelephone();
350
 
351
  $checkout->customer = $customer;
352
 
353
+ $checkout->order = $this->_getSnapOrder();
354
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  return $checkout;
356
  }
357
 
392
  }
393
 
394
  private function _getOrderId($order_prefix, $id_order){
395
+ if(!empty($order_prefix)){
396
  $result = $order_prefix.$id_order;
397
  }else{
398
  $result = $id_order;
402
  }
403
 
404
 
405
+ /**
406
+ * Retrieves stored card data.
407
+ * @return Mage_Core_Model_Abstract
408
+ */
409
+ public function getStoredCardData() {
410
+ $tokenId = (int) $this->getInfoInstance()->getAdditionalInformation('token_id');
411
+
412
+ if($tokenId && ($tokenId > 0)){
413
+ return Mage::getModel('hostedpayments/storedcard')->load($tokenId);
414
+ }
415
+
416
+ return false;
417
+ }
418
+
419
+ /**
420
+ * Tests if the card data is going to be saved in EVO Snap*.
421
+ * @return boolean
422
+ */
423
+ private function _isCardSaved() {
424
+ $tokenId = (int) $this->getInfoInstance()->getAdditionalInformation('token_id');
425
+ return (boolean)($this->getInfoInstance()->getAdditionalInformation('create_token') === 'true') &&
426
+ !($tokenId && ($tokenId > 0));
427
+ }
428
+
429
+ /**
430
+ * Gets order checkout object.
431
+ * @return SnapCheckoutAbstract
432
+ */
433
+ private function _getSnapOrder(){
434
+ $mOrder = $this->getOrder();
435
+
436
+ $order = new SnapOrder();
437
+
438
+ $order->id = $this->_getOrderId($this->getConfigData('order_prefix'), $mOrder->getRealOrderId());
439
+ $order->total_subtotal = $mOrder->getSubtotal();
440
+ $order->total_discount = abs($mOrder->getDiscountAmount());
441
+ $order->total_shipping = $mOrder->getShippingAmount();
442
+ $order->total_tax = $mOrder->getTaxAmount();
443
+ $order->total = $mOrder->getBaseGrandTotal();
444
+ $order->currency_code = $mOrder->getOrderCurrencyCode();
445
+
446
+ $products = $mOrder->getAllItems();
447
+ for($i = 0; $i < count($products); $i++) {
448
+ $order_lines[$i] = $this->_getOrderItem($products[$i]);
449
+ }
450
+ $order->lines = $order_lines;
451
+
452
+ $billing = $mOrder->getBillingAddress();
453
+ $shipping = $mOrder->getShippingAddress();
454
+
455
+ $order->billto_address = $this->_getAddress($billing);
456
+ if(!empty($shipping)){
457
+ $order->shipto_address = $this->_getAddress($billing);
458
+ }
459
+
460
+ return $order;
461
+ }
462
+
463
+ /**
464
+ * Pays the order with the specified token.
465
+ *
466
+ * @param Storedcard $storedCard
467
+ */
468
+ public function payWithToken($storedCard)
469
+ {
470
+ if(!$this->getConfigData('store_cards')){
471
+ throw new Mage_Payment_Model_Info_Exception(Mage::helper('hostedpayments')->__('Card Store is disabled. Please contact support.'));
472
+ }
473
+ $order = $this->_getSnapOrder();
474
+ $snapOrder = EvoSnapApi::processTokenOrder($storedCard->getTokenId(), $order, $this->getHostedPaymentsConfiguration());
475
+ $this->_payOrder($snapOrder['txn_id']);
476
+ }
477
+
478
  /**
479
  * prepare params array to send it to gateway page via POST
480
  *
app/code/local/Evo/HostedPayments/Model/Resource/Storedcard.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2016 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * EVO Snap* Hosted Payments Stored Card Resource model collection class.
31
+ *
32
+ * @category EVO
33
+ * @package Evo
34
+ * @copyright Copyright (c) 2016 EVO Snap* (http://www.evosnap.com)
35
+ * @license EVO Payments International EULA
36
+ */
37
+ class Evo_HostedPayments_Model_Resource_Storedcard extends Mage_Core_Model_Resource_Db_Abstract
38
+ {
39
+ protected function _construct()
40
+ {
41
+ $this->_init("hostedpayments/storedcard", "id");
42
+ }
43
+ }
app/code/local/Evo/HostedPayments/Model/Resource/Storedcard/Collection.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2016 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * EVO Snap* Hosted Payments Stored Card model class.
31
+ *
32
+ * @category EVO
33
+ * @package Evo
34
+ * @copyright Copyright (c) 2016 EVO Snap* (http://www.evosnap.com)
35
+ * @license EVO Payments International EULA
36
+ */
37
+ class Evo_HostedPayments_Model_Resource_StoredCard_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
38
+ {
39
+ protected function _construct()
40
+ {
41
+ $this->_init("hostedpayments/storedcard");
42
+ }
43
+ }
app/code/local/Evo/HostedPayments/Model/Storedcard.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2016 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * EVO Snap* Hosted Payments Stored Card Resource model class.
31
+ *
32
+ * @category EVO
33
+ * @package Evo
34
+ * @copyright Copyright (c) 2016 EVO Snap* (http://www.evosnap.com)
35
+ * @license EVO Payments International EULA
36
+ */
37
+ class Evo_HostedPayments_Model_Storedcard extends Mage_Core_Model_Abstract
38
+ {
39
+ protected function _construct()
40
+ {
41
+ $this->_init("hostedpayments/storedcard");
42
+ }
43
+
44
+ /**
45
+ * Retrieves PAN formated.
46
+ */
47
+ public function getPan(){
48
+ return '************'.$this->getAcctNum();
49
+ }
50
+
51
+ /**
52
+ * Retrieves expiration date formated.
53
+ */
54
+ public function getExpirationDate(){
55
+ return date('m/y', strtotime($this->getAcctExp()));
56
+ }
57
+ }
app/code/local/Evo/HostedPayments/controllers/IndexController.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2016 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * EVO Snap* Hosted Payments processing class.
31
+ *
32
+ * @category EVO
33
+ * @package Evo
34
+ * @copyright Copyright (c) 2016 EVO Snap* (http://www.evosnap.com)
35
+ * @license EVO Payments International EULA
36
+ */
37
+ class Evo_HostedPayments_IndexController extends Mage_Core_Controller_Front_Action {
38
+
39
+ /**
40
+ * Action predispatch
41
+ *
42
+ * Check customer authentication for some actions
43
+ */
44
+ public function preDispatch()
45
+ {
46
+ parent::preDispatch();
47
+ $action = $this->getRequest()->getActionName();
48
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
49
+
50
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
51
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
52
+ }
53
+ }
54
+
55
+ /**
56
+ * List stored cards action.
57
+ */
58
+ public function indexAction() {
59
+ $this->loadLayout();
60
+ $this->renderLayout();
61
+ }
62
+
63
+ /**
64
+ * Deletes a stored card.
65
+ */
66
+ public function deleteAction()
67
+ {
68
+ $storedCardId = $this->getRequest()->getParam('id', false);
69
+
70
+ if ($storedCardId) {
71
+ $storedCard = Mage::getModel('hostedpayments/storedcard')->load($storedCardId);
72
+
73
+ // Validate card_id <=> customer_id
74
+ if ($storedCard->getCustomerId() != Mage::getSingleton('customer/session')->getCustomerId()) {
75
+ Mage::getSingleton('core/session')->addError($this->__('The stored card does not belong to this customer.'));
76
+ $this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
77
+ return;
78
+ }
79
+
80
+ try {
81
+ $storedCard->delete();
82
+ Mage::getSingleton('core/session')->addSuccess($this->__('The stored card has been deleted.'));
83
+ } catch (Exception $e){
84
+ Mage::getSingleton('core/session')->addException($e, $this->__('An error occurred while deleting the stored card.'));
85
+ }
86
+ }
87
+ $this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
88
+ }
89
+ }
app/code/local/Evo/HostedPayments/controllers/ProcessingController.php CHANGED
@@ -71,8 +71,10 @@ class Evo_HostedPayments_ProcessingController extends Mage_Core_Controller_Front
71
  */
72
  public function payAction()
73
  {
 
74
  try {
75
  $session = $this->_getCheckout();
 
76
 
77
  $orderId = $this->getRequest()->getParam('id');
78
 
@@ -93,23 +95,34 @@ class Evo_HostedPayments_ProcessingController extends Mage_Core_Controller_Front
93
 
94
  $paymentInst = $order->getPayment()->getMethodInstance();
95
 
96
- $paymentUrl = $paymentInst->getPaymentUrl();
97
- $session->setEvoPaymentUrl($paymentUrl);
98
- $useIframe = $paymentInst->getCheckoutLayout() === 'iframe';
99
- $session->setEvoUseIframe($useIframe);
 
 
 
 
 
 
 
100
  }
101
 
102
- if($useIframe){
103
- $this->loadLayout();
104
- $this->getLayout()->getBlock('hostedpayments.iframe')->setPaymentUrl($paymentUrl);
105
- $this->renderLayout();
106
- }else{
107
- $this->_redirectUrl($paymentUrl);
 
 
 
 
108
  }
109
 
110
  $session->unsQuoteId();
111
  $session->unsLastRealOrderId();
112
- } catch (HostedPayments_Exception $e) {
113
  Mage::log('Hosted Payments Error: '.$e->getMessage(), Zend_Log::ERR);
114
  $this->_redirect('customer/account');
115
  }
@@ -172,9 +185,6 @@ class Evo_HostedPayments_ProcessingController extends Mage_Core_Controller_Front
172
  Mage::log($aResponse);
173
  }
174
 
175
- /**
176
- * Evo returns POST variables to this action
177
- */
178
  private function _successAction(Mage_Sales_Model_Order $order)
179
  {
180
  $session = $this->_getCheckout();
71
  */
72
  public function payAction()
73
  {
74
+ $order = null;
75
  try {
76
  $session = $this->_getCheckout();
77
+ $paid = false;
78
 
79
  $orderId = $this->getRequest()->getParam('id');
80
 
95
 
96
  $paymentInst = $order->getPayment()->getMethodInstance();
97
 
98
+ $storedCard = $paymentInst->getStoredCardData();
99
+
100
+ if($storedCard){
101
+ $paymentInst->payWithToken($storedCard);
102
+ $paid = true;
103
+ }else{
104
+ $paymentUrl = $paymentInst->getPaymentUrl();
105
+ $session->setEvoPaymentUrl($paymentUrl);
106
+ $useIframe = $paymentInst->getCheckoutLayout() === 'iframe';
107
+ $session->setEvoUseIframe($useIframe);
108
+ }
109
  }
110
 
111
+ if($paid){
112
+ $this->_successAction($paymentInst->getOrder());
113
+ }else{
114
+ if($useIframe){
115
+ $this->loadLayout();
116
+ $this->getLayout()->getBlock('hostedpayments.iframe')->setPaymentUrl($paymentUrl);
117
+ $this->renderLayout();
118
+ }else{
119
+ $this->_redirectUrl($paymentUrl);
120
+ }
121
  }
122
 
123
  $session->unsQuoteId();
124
  $session->unsLastRealOrderId();
125
+ } catch (Exception $e) {
126
  Mage::log('Hosted Payments Error: '.$e->getMessage(), Zend_Log::ERR);
127
  $this->_redirect('customer/account');
128
  }
185
  Mage::log($aResponse);
186
  }
187
 
 
 
 
188
  private function _successAction(Mage_Sales_Model_Order $order)
189
  {
190
  $session = $this->_getCheckout();
app/code/local/Evo/HostedPayments/etc/config.xml CHANGED
@@ -31,7 +31,7 @@
31
  <config>
32
  <modules>
33
  <Evo_HostedPayments>
34
- <version>1.0.0</version>
35
  </Evo_HostedPayments>
36
  </modules>
37
  <global>
@@ -46,6 +46,9 @@
46
  <hostedpayment>
47
  <table>evo_hostedpayments</table>
48
  </hostedpayment>
 
 
 
49
  </entities>
50
  </hostedpayments_resource>
51
  </models>
@@ -83,16 +86,11 @@
83
  <hostedpayments>
84
  <class>Evo_HostedPayments_Block</class>
85
  </hostedpayments>
86
- <payment>
87
- <rewrite>
88
- <payment_form>Evo_Payment_Block_Form</payment_form>
89
- </rewrite>
90
- </payment>
91
  </blocks>
92
  </global>
93
  <frontend>
94
  <secure_url>
95
- <hostedpayments_processing>/hostedpayments/processing</hostedpayments_processing>
96
  </secure_url>
97
  <routers>
98
  <hostedpayments>
31
  <config>
32
  <modules>
33
  <Evo_HostedPayments>
34
+ <version>2.0.0</version>
35
  </Evo_HostedPayments>
36
  </modules>
37
  <global>
46
  <hostedpayment>
47
  <table>evo_hostedpayments</table>
48
  </hostedpayment>
49
+ <storedcard>
50
+ <table>evo_storedcards</table>
51
+ </storedcard>
52
  </entities>
53
  </hostedpayments_resource>
54
  </models>
86
  <hostedpayments>
87
  <class>Evo_HostedPayments_Block</class>
88
  </hostedpayments>
 
 
 
 
 
89
  </blocks>
90
  </global>
91
  <frontend>
92
  <secure_url>
93
+ <hostedpayments_processing>/hostedpayments/</hostedpayments_processing>
94
  </secure_url>
95
  <routers>
96
  <hostedpayments>
app/code/local/Evo/HostedPayments/etc/system.xml CHANGED
@@ -120,6 +120,60 @@
120
  <show_in_website>1</show_in_website>
121
  <show_in_store>1</show_in_store>
122
  </order_prefix>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  </fields>
124
  </hostedpayments>
125
  </groups>
120
  <show_in_website>1</show_in_website>
121
  <show_in_store>1</show_in_store>
122
  </order_prefix>
123
+ <store_cards translate="label comment">
124
+ <label>Store Cards</label>
125
+ <comment>Let customers store their Cards into Snap*.</comment>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>adminhtml/system_config_source_yesno</source_model>
128
+ <sort_order>9</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ </store_cards>
133
+ <stored_cards_policy translate="label comment">
134
+ <label>Stored Cards Policy</label>
135
+ <comment>URL to the page in your store that contains the Policy applied to the Card Storing system.</comment>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>10</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ </stored_cards_policy>
142
+ <allowspecific translate="label">
143
+ <label>Payment from Applicable Countries</label>
144
+ <frontend_type>allowspecific</frontend_type>
145
+ <sort_order>50</sort_order>
146
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>0</show_in_store>
150
+ </allowspecific>
151
+ <specificcountry translate="label">
152
+ <label>Payment from Specific Countries</label>
153
+ <frontend_type>multiselect</frontend_type>
154
+ <sort_order>51</sort_order>
155
+ <source_model>adminhtml/system_config_source_country</source_model>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>0</show_in_store>
159
+ <can_be_empty>1</can_be_empty>
160
+ </specificcountry>
161
+ <min_order_total translate="label">
162
+ <label>Minimum Order Total</label>
163
+ <frontend_type>text</frontend_type>
164
+ <sort_order>98</sort_order>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>0</show_in_store>
168
+ </min_order_total>
169
+ <max_order_total translate="label">
170
+ <label>Maximum Order Total</label>
171
+ <frontend_type>text</frontend_type>
172
+ <sort_order>99</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>0</show_in_store>
176
+ </max_order_total>
177
  </fields>
178
  </hostedpayments>
179
  </groups>
app/code/local/Evo/HostedPayments/sql/hostedpayments_setup/install-0.1.0.php CHANGED
@@ -38,22 +38,22 @@
38
  $installer = $this;
39
  $installer->startSetup();
40
  $table = $installer->getConnection()->newTable($installer->getTable('hostedpayments/hostedpayment'))
41
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
42
- 'unsigned' => true,
43
- 'nullable' => false,
44
- 'primary' => true,
45
- 'identity' => true,
46
- ), 'Entity ID')
47
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
48
- 'nullable' => false,
49
- 'unique' => true,
50
- ), 'Order ID')
51
- ->addColumn('url', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
52
- 'nullable' => false,
53
- ), 'Payment URL')
54
- ->addColumn('prefix', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
55
- 'nullable' => true
56
- ), 'Order ID Prefix')
57
- ->setComment('Snap* Hosted Payments URLs table');
58
  $installer->getConnection()->createTable($table);
59
  $installer->endSetup();
38
  $installer = $this;
39
  $installer->startSetup();
40
  $table = $installer->getConnection()->newTable($installer->getTable('hostedpayments/hostedpayment'))
41
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
42
+ 'unsigned' => true,
43
+ 'nullable' => false,
44
+ 'primary' => true,
45
+ 'identity' => true,
46
+ ), 'Entity ID')
47
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
48
+ 'nullable' => false,
49
+ 'unique' => true,
50
+ ), 'Order ID')
51
+ ->addColumn('url', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
52
+ 'nullable' => false,
53
+ ), 'Payment URL')
54
+ ->addColumn('prefix', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
55
+ 'nullable' => true
56
+ ), 'Order ID Prefix')
57
+ ->setComment('Snap* Hosted Payments URLs table');
58
  $installer->getConnection()->createTable($table);
59
  $installer->endSetup();
app/code/local/Evo/HostedPayments/sql/hostedpayments_setup/upgrade-1.0.0-2.0.0.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2016 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * EVO Snap* Hosted Payments Upgrade script.
31
+ *
32
+ * @category EVO
33
+ * @package Evo
34
+ * @copyright Copyright (c) 2016 EVO Snap* (http://www.evosnap.com)
35
+ * @license EVO Payments International EULA
36
+ */
37
+ $installer = $this;
38
+ $installer->startSetup();
39
+ $table = $installer->getConnection()->newTable($installer->getTable('hostedpayments/storedcard'))
40
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
41
+ 'unsigned' => true,
42
+ 'nullable' => false,
43
+ 'primary' => true,
44
+ 'identity' => true,
45
+ ), 'Entity ID')
46
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
47
+ 'nullable' => false,
48
+ 'unique' => true,
49
+ ), 'Customer ID')
50
+ ->addColumn('token_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array(
51
+ 'nullable' => false,
52
+ 'unique' => true,
53
+ ), 'Token ID')
54
+ ->addColumn('acct_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
55
+ 'nullable' => false,
56
+ ), 'Account Name')
57
+ ->addColumn('acct_num', Varien_Db_Ddl_Table::TYPE_TEXT, 4, array(
58
+ 'nullable' => false,
59
+ ), 'Account Number')
60
+ ->addColumn('acct_exp', Varien_Db_Ddl_Table::TYPE_DATE, null, array(
61
+ 'nullable' => false,
62
+ ), 'Account Type')
63
+ ->addColumn('acct_type', Varien_Db_Ddl_Table::TYPE_TEXT, 16, array(
64
+ 'nullable' => false,
65
+ ), 'Account Type')
66
+ ->addColumn('currency_code', Varien_Db_Ddl_Table::TYPE_TEXT, 3, array(
67
+ 'nullable' => true
68
+ ), 'Currency Code')
69
+ ->addIndex($installer->getIdxName('hostedpayments/storedcard', array('customer_id')),
70
+ array('customer_id'))
71
+ ->addForeignKey($installer->getFkName('hostedpayments/storedcard', 'customer_id', 'customer/entity', 'entity_id'),
72
+ 'customer_id', $installer->getTable('customer/entity'), 'entity_id',
73
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
74
+ ->setComment('Snap* Hosted Payments Stored Cards table');
75
+ $installer->getConnection()->createTable($table);
76
+ $installer->endSetup();
app/design/frontend/base/default/layout/evohostedpayments.xml CHANGED
@@ -17,7 +17,7 @@
17
  * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
18
  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
19
  * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
20
- * Computer Software--Licensing clause at NASA FAR supplement
21
  * 16-52.227-86; or their equivalent.
22
  *
23
  * Information in this software is subject to change without notice
@@ -29,6 +29,10 @@
29
 
30
  -->
31
  <layout version="0.1.0">
 
 
 
 
32
  <hostedpayments_processing_pay translate="label">
33
  <label>Snap* Hosted Payments Checkout</label>
34
  <!-- Mage_Checkout -->
@@ -43,6 +47,9 @@
43
  </reference>
44
  </hostedpayments_processing_pay>
45
 
 
 
 
46
  <hostedpayments_processing_return translate="label">
47
  <label>Snap* Hosted Payments Checkout</label>
48
  <!-- Mage_Checkout -->
@@ -56,4 +63,24 @@
56
  <block type="hostedpayments/iframevalidation" name="hostedpayments.iframevalidation" template="evo/iframevalidation.phtml" />
57
  </reference>
58
  </hostedpayments_processing_return>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  </layout>
17
  * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
18
  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
19
  * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
20
+ * Computer Software - Licensing clause at NASA FAR supplement
21
  * 16-52.227-86; or their equivalent.
22
  *
23
  * Information in this software is subject to change without notice
29
 
30
  -->
31
  <layout version="0.1.0">
32
+
33
+ <!--
34
+ Payment action.
35
+ -->
36
  <hostedpayments_processing_pay translate="label">
37
  <label>Snap* Hosted Payments Checkout</label>
38
  <!-- Mage_Checkout -->
47
  </reference>
48
  </hostedpayments_processing_pay>
49
 
50
+ <!--
51
+ Return from Hostped Payments.
52
+ -->
53
  <hostedpayments_processing_return translate="label">
54
  <label>Snap* Hosted Payments Checkout</label>
55
  <!-- Mage_Checkout -->
63
  <block type="hostedpayments/iframevalidation" name="hostedpayments.iframevalidation" template="evo/iframevalidation.phtml" />
64
  </reference>
65
  </hostedpayments_processing_return>
66
+
67
+ <!--
68
+ Customer account pages, rendered for all tabs in dashboard
69
+ -->
70
+
71
+ <customer_account>
72
+ <!-- Evo_HostedPayments -->
73
+ <reference name="customer_account_navigation">
74
+ <action method="addLink" translate="label" module="hostedpayments" ifconfig="payment/hostedpayments/store_cards"><name>hostedpayments_storedcards</name><path>hostedpayments/</path><label>Popular Payments - Stored Cards</label></action>
75
+ </reference>
76
+ </customer_account>
77
+
78
+ <hostedpayments_index_index translate="label">
79
+ <label>Customer My Account Stored Cards</label>
80
+ <update handle="customer_account"/>
81
+ <reference name="my.account.wrapper">
82
+ <block type="hostedpayments/storedcards" name="hostedpayments_storedcards" />
83
+ </reference>
84
+ </hostedpayments_index_index>
85
+
86
  </layout>
app/design/frontend/base/default/template/evo/form.phtml CHANGED
@@ -37,3 +37,39 @@
37
  ?>
38
  <?php $_code=$this->getMethodCode() ?>
39
  <p style="vertical-align: middle;"><img class="credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/brand-logos.png')?>" alt="<?php echo $this->__('Credit Card Logos') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" /><strong style="display: inline-block; vertical-align: middle;"><?php echo $this->__('Pay by VISA, MasterCard or Maestro') ?></strong></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  ?>
38
  <?php $_code=$this->getMethodCode() ?>
39
  <p style="vertical-align: middle;"><img class="credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/brand-logos.png')?>" alt="<?php echo $this->__('Credit Card Logos') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" /><strong style="display: inline-block; vertical-align: middle;"><?php echo $this->__('Pay by VISA, MasterCard or Maestro') ?></strong></p>
40
+ <?php if($this->getMethod()->getConfigData('store_cards') && Mage::getSingleton('customer/session')->isLoggedIn()): ?>
41
+
42
+ <?php
43
+ $storedCards = $this->getStoredCards();
44
+ ?>
45
+ <div class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
46
+ <?php if($storedCards->getSize()): ?>
47
+
48
+ <?php
49
+ $cardCounter = 0;
50
+ foreach ($storedCards as $storedCard) {
51
+ $radioId = ''
52
+ ?>
53
+ <div>
54
+ <input id="card<?php echo $cardCounter ?>" type="radio" name="payment[token_id]" value="<?php echo $storedCard->getData('id') ?>" <?php if($cardCounter == 0): ?> checked="checked" <?php endif; ?>/>
55
+ <label for="card<?php echo $cardCounter ?>"><img src="<?php echo $this->getSkinUrl('images/evo/cc_'.strtolower($storedCard->getData('acct_type')).'.png') ?>" /><?php echo $this->htmlEscape($storedCard->getData('acct_name')) ?> / <?php echo $this->htmlEscape($storedCard->getPan()) ?> (<?php echo $storedCard->getExpirationDate() ?>)</label>
56
+ </div>
57
+ <?php
58
+ $cardCounter++;
59
+ }
60
+ ?>
61
+ <div>
62
+ <input id="card<?php echo $cardCounter ?>" type="radio" name="payment[token_id]" value="-1" />
63
+ <label for="card<?php echo $cardCounter ?>"><?php echo $this->__('Pay with a new card') ?></label>
64
+ <input id="saveCreditCard" type="checkbox" name="payment[create_token]" value="true" />
65
+ <label for="saveCreditCard"><?php echo $this->__('Store card data for future purchases.') ?> <a href="<?php echo $this->getMethod()->getConfigData('stored_cards_policy') ?>" style="margin-top: 0;"><?php echo $this->__('Privacy Policy') ?></a></label>
66
+ </div>
67
+
68
+ <?php else: ?>
69
+ <div>
70
+ <input id="saveCreditCard" type="checkbox" name="payment[create_token]" value="true" />
71
+ <label for="saveCreditCard"><?php echo $this->__('Store card data for future purchases.') ?> <a href="<?php echo $this->getMethod()->getConfigData('stored_cards_policy') ?>" style="margin-top: 0;"><?php echo $this->__('Privacy Policy') ?></a></label>
72
+ </div>
73
+ <?php endif; ?>
74
+ </div>
75
+ <?php endif; ?>
app/design/frontend/base/default/template/evo/info.phtml CHANGED
@@ -36,12 +36,21 @@
36
  */
37
  ?>
38
  <p style="vertical-align: middle;"><img class="credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/brand-logos.png')?>" alt="<?php echo $this->__('Credit Card Logos') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" /><strong style="display: inline-block; vertical-align: middle;"><?php echo $this->__('Pay by VISA, MasterCard or Maestro') ?></strong></p>
39
- <?php
40
- $paymentLink = $this->_getPaymentLink();
41
-
42
- if($paymentLink !== null){
43
- ?>
44
- <p><a class="hostedpayments-resume-link" href="<?php echo $paymentLink ?>"><strong><?php echo $this->__('Resume Payment')?></strong></a></p>
45
- <?php
46
- }
47
- ?>
 
 
 
 
 
 
 
 
 
36
  */
37
  ?>
38
  <p style="vertical-align: middle;"><img class="credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/brand-logos.png')?>" alt="<?php echo $this->__('Credit Card Logos') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" /><strong style="display: inline-block; vertical-align: middle;"><?php echo $this->__('Pay by VISA, MasterCard or Maestro') ?></strong></p>
39
+ <?php if(!($this->getInfo()->getOrder())): ?>
40
+ <?php
41
+ $savedCard = $this->isCardSaved();
42
+ $storedCard = $savedCard? null : $this->getStoredCardData();
43
+ ?>
44
+ <?php if($savedCard): ?>
45
+ <p><?php echo $this->__('The card data used in this payment will be stored for future purchases.')?></strong></p>
46
+ <?php elseif(!empty($storedCard)): ?>
47
+ <p><img class="credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/cc_'.strtolower($storedCard->getData('acct_type')).'.png') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" /><?php echo $this->htmlEscape($storedCard->getData('acct_name')) ?> / <?php echo $this->htmlEscape($storedCard->getPan()) ?> (<?php echo $storedCard->getExpirationDate() ?>)</p>
48
+ <?php endif; ?>
49
+ <?php else: ?>
50
+ <?php
51
+ $paymentLink = $this->_getPaymentLink();
52
+ ?>
53
+ <?php if($paymentLink !== null): ?>
54
+ <p><a class="hostedpayments-resume-link" href="<?php echo $paymentLink ?>"><strong><?php echo $this->__('Resume Payment')?></strong></a></p>
55
+ <?php endif; ?>
56
+ <?php endif; ?>
app/design/frontend/base/default/template/evo/storedcards.phtml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2016 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * EVO Snap* Stored Cards View.
31
+ *
32
+ * @category EVO
33
+ * @package Evo
34
+ * @copyright Copyright (c) 2016 EVO Snap* (http://www.evosnap.com)
35
+ * @license EVO Payments International EULA
36
+ */
37
+ ?>
38
+ <?php $_storedcards = $this->getStoredCards(); ?>
39
+ <div class="page-title">
40
+ <h1><?php echo $this->__('My Stored Cards') ?></h1>
41
+ </div>
42
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
43
+ <?php echo $this->getPagerHtml(); ?>
44
+ <?php if($_storedcards->getSize()): ?>
45
+ <table class="data-table" id="my-cards-table">
46
+ <col />
47
+ <col />
48
+ <col width="1">
49
+ <col width="1" />
50
+ <thead>
51
+ <tr>
52
+ <th><?php echo $this->__('Name') ?></th>
53
+ <th><?php echo $this->__('Card Number') ?></th>
54
+ <th><?php echo $this->__('Exp. date') ?></th>
55
+ <th>&nbsp;</th>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <?php $_odd = ''; ?>
60
+ <?php foreach ($_storedcards as $_storedcard): ?>
61
+ <tr>
62
+ <td><?php echo $_storedcard->getAcctName() ?></td>
63
+ <td><img class="ssc-credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/cc_'.strtolower($_storedcard->getAcctType()).'.png') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" />
64
+ <?php echo $_storedcard->getPan() ?></td>
65
+ <td><span class="nobr"><?php echo $_storedcard->getExpirationDate() ?></span></td>
66
+ <td class="a-center">
67
+ <span class="nobr">
68
+ <a href="#" onclick="return deleteStoredCard(<?php echo $_storedcard->getId() ?>);"><?php echo $this->__('Delete Card') ?></a>
69
+ </span>
70
+ </td>
71
+ </tr>
72
+ <?php endforeach; ?>
73
+ </tbody>
74
+ </table>
75
+ <script type="text/javascript">decorateTable('my-cards-table');</script>
76
+ <?php echo $this->getPagerHtml(); ?>
77
+ <?php else: ?>
78
+ <p><?php echo $this->__('You have no stored cards.'); ?></p>
79
+ <?php endif ?>
80
+
81
+ <div class="buttons-set">
82
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
83
+ </div>
84
+
85
+ <script type="text/javascript">
86
+ function deleteStoredCard(storedCardId) {
87
+ if(confirm('<?php echo Mage::helper('core')->jsQuoteEscape($this->__('Are you sure you want to delete this stored card?')) ?>')) {
88
+ window.location='<?php echo $this->getUrl("hostedpayments/index/delete") ?>id/'+storedCardId;
89
+ }
90
+ return false;
91
+ }
92
+ </script>
app/etc/modules/Evo_HostedPayments.xml CHANGED
@@ -35,6 +35,8 @@
35
  <codePool>local</codePool>
36
  <depends>
37
  <Mage_Payment />
 
 
38
  </depends>
39
  </Evo_HostedPayments>
40
  </modules>
35
  <codePool>local</codePool>
36
  <depends>
37
  <Mage_Payment />
38
+ <Mage_Cms/>
39
+ <Mage_Customer/>
40
  </depends>
41
  </Evo_HostedPayments>
42
  </modules>
app/locale/en_US/Evo_HostedPayments.csv CHANGED
@@ -16,4 +16,24 @@
16
  "Order Prefix","Order Prefix"
17
  "Order Prefix sent to Snap* Hosted Payments.","Order Prefix sent to Snap* Hosted Payments."
18
  "Resume Payment","Resume Payment"
19
- "Credit Card Logos","Credit Card Logos"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  "Order Prefix","Order Prefix"
17
  "Order Prefix sent to Snap* Hosted Payments.","Order Prefix sent to Snap* Hosted Payments."
18
  "Resume Payment","Resume Payment"
19
+ "Credit Card Logos","Credit Card Logos"
20
+ "Store Cards","Store Cards"
21
+ "Let customers store their Cards into Snap*.","Let customers store their Cards into Snap*."
22
+ "Stored Cards Policy","Stored Cards Policy"
23
+ "URL to the page in your store that contains the Policy applied to the Card Storing system.","URL to the page in your store that contains the Policy applied to the Card Storing system."
24
+ "Popular Payments - Stored Cards","Popular Payments - Stored Cards"
25
+ "Customer My Account Stored Cards","Customer My Account Stored Cards"
26
+ "My Stored Cards","My Stored Cards"
27
+ "Card Number","Card Number"
28
+ "Exp. date","Exp. date"
29
+ "Delete Card","Delete Card"
30
+ "You have no stored cards.","You have no stored cards."
31
+ "The stored card does not belong to this customer.","The stored card does not belong to this customer."
32
+ "The stored card has been deleted.","The stored card has been deleted."
33
+ "An error occurred while deleting the stored card.","An error occurred while deleting the stored card."
34
+ "Are you sure you want to delete this stored card?","Are you sure you want to delete this stored card?"
35
+ "Pay with a new card","Pay with a new card"
36
+ "Store card data for future purchases.","Store card data for future purchases."
37
+ "Privacy Policy","Privacy Policy"
38
+ "The card data used in this payment will be stored for future purchases.","The card data used in this payment will be stored for future purchases."
39
+ "Card Store is disabled. Please contact support.","Card Store is disabled. Please contact support."
app/locale/es_ES/Evo_HostedPayments.csv CHANGED
@@ -16,4 +16,24 @@
16
  "Order Prefix","Prefijo del Pedido"
17
  "Order Prefix sent to Snap* Hosted Payments.","Prefijo del Pedido enviado a Snap* Hosted Payments."
18
  "Resume Payment","Completar Pago"
19
- "Credit Card Logos","Marcas de las Tarjetas de Crédito"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  "Order Prefix","Prefijo del Pedido"
17
  "Order Prefix sent to Snap* Hosted Payments.","Prefijo del Pedido enviado a Snap* Hosted Payments."
18
  "Resume Payment","Completar Pago"
19
+ "Credit Card Logos","Marcas de las Tarjetas de Crédito"
20
+ "Store Cards","Almacenar Tarjetas"
21
+ "Let customers store their Cards into Snap*.","Permitir a los clientes almacenar sus tarjetas en Snap*."
22
+ "Stored Cards Policy","Política de Almacenamiento de Tarjetas"
23
+ "URL to the page in your store that contains the Policy applied to the Card Storing system.","URL a la página de su tienda que contiene la Política aplicada al sistema de Almacenamiento de Tarjetas."
24
+ "Popular Payments - Stored Cards","Popular Payments - Tarjetas Almacenadas"
25
+ "Customer My Account Stored Cards","Cliente Mi Cuenta Tarjetas Almacenadas"
26
+ "My Stored Cards","Mis tarjetas almacenadas"
27
+ "Card Number","Número de Tarjeta"
28
+ "Exp. date","Caducidad"
29
+ "Delete Card","Eliminar Tarjeta"
30
+ "You have no stored cards.","No tiene tarjetas almacenadas."
31
+ "The stored card does not belong to this customer.","La tarjeta indicada no pertenece a este cliente."
32
+ "The stored card has been deleted.","Los datos de la tarjeta han sido eliminados."
33
+ "An error occurred while deleting the stored card.","Ha ocurrido un error al eliminar los datos de la tarjeta."
34
+ "Are you sure you want to delete this stored card?","Los datos de la tarjeta serán eliminados, ¿está usted seguro?"
35
+ "Pay with a new card","Pagar con una tarjeta nueva"
36
+ "Store card data for future purchases.","Guardar los datos de la tarjeta para futuras compras."
37
+ "Privacy Policy","Política de Privacidad"
38
+ "The card data used in this payment will be stored for future purchases.","Los datos de la tarjeta utilizada en este pago serán almacenados para futuras compras."
39
+ "Card Store is disabled. Please contact support.","El almacenamiento de tarjetas está deshabilitado. Por favor, póngase en contacto con el soporte."
lib/hostedpayments/evosnap_api.php CHANGED
@@ -37,7 +37,7 @@ class EvoSnapApi
37
  * Retrieves orders.
38
  * @param array $params request parameters.
39
  * @param HostedPayments $cfg Hosted Payments Configuration.
40
- * @return the order status.
41
  */
42
  public static function getOrders($params, $cfg){
43
  $aPost = EvoSnapApi::getEvoSnapOrdersPost($params, $cfg->code, $cfg->key);
@@ -53,7 +53,7 @@ class EvoSnapApi
53
  $aPost = array(
54
  'action' => 'get_orders',
55
  'code' => $code,
56
- 'return' => 'json',
57
  );
58
  $aPost['mac'] = EvoSnapApi::getOrdersMac($aPost, $key);
59
  $aPost = array_merge($aPost, $params);
@@ -63,7 +63,7 @@ class EvoSnapApi
63
  private static function getOrdersMac($aPost, $key){
64
  $aMACParams = array(
65
  'code' => $aPost['code'],
66
- 'action' => $aPost['action'],
67
  );
68
 
69
  return EvoSnapTools::getMac($aMACParams, $key);
@@ -73,7 +73,7 @@ class EvoSnapApi
73
  * Retrieves an order.
74
  * @param string $id the order ID.
75
  * @param HostedPayments $cfg Hosted Payments Configuration.
76
- * @return the order status.
77
  */
78
  public static function getOrder($id, $cfg){
79
  $aPost = EvoSnapApi::getEvoSnapOrderPost($id, $cfg->code, $cfg->key);
@@ -106,7 +106,7 @@ class EvoSnapApi
106
  * Gets order status.
107
  * @param string $id the order ID.
108
  * @param HostedPayments $cfg Hosted Payments Configuration.
109
- * @return the order status.
110
  */
111
  public static function getOrderStatus($id, $cfg){
112
  $order = EvoSnapApi::getOrder($id, $cfg);
@@ -125,7 +125,7 @@ class EvoSnapApi
125
  'action' => 'get_order',
126
  'code' => $code,
127
  'merchant_order_id' => $id,
128
- 'return' => 'json',
129
  );
130
  $aPost['mac'] = EvoSnapApi::getOrderMac($aPost, $key);
131
 
@@ -143,12 +143,13 @@ class EvoSnapApi
143
  }
144
 
145
  /**
146
- * Gets checkout order
147
- * @param SnapOrder_Checkout $order the order checkout.
148
  * @param float $trigger3ds value that triggers 3D secure.
149
  * @param HostedPayments $cfg Hosted Payments Configuration.
 
150
  */
151
- public static function getOrderCheckoutUrl($order, $trigger3ds, $cfg) {
152
  $aPost = EvoSnapApi::getEvoSnapCehckoutPost($order, $trigger3ds, $cfg->code, $cfg->key);
153
  $result = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(true), $cfg->environment);
154
  if ($result ['success'] != false) {
@@ -160,7 +161,7 @@ class EvoSnapApi
160
 
161
  /**
162
  *
163
- * @param SnapOrder_Checkout $checkout
164
  * @param float $trigger3ds
165
  * @param string $code
166
  * @param string $key
@@ -179,49 +180,109 @@ class EvoSnapApi
179
  'email' => EvoSnapTools::getString($customer->email, 50)
180
  );
181
 
182
- $order = $checkout->order;
183
- $aOrder = array(
184
- 'merchant_order_id' => EvoSnapTools::getString($order->id, 255),
185
- 'total_subtotal' => EvoSnapTools::getNumber($order->total_subtotal),
186
- 'total_tax' => EvoSnapTools::getNumber($order->total_tax),
187
- 'total_shipping' => EvoSnapTools::getNumber($order->total_shipping),
188
- 'total_discount' => EvoSnapTools::getNumber($order->total_discount),
189
- 'total' => EvoSnapTools::getNumber($order->total),
190
- 'ship_method' => EvoSnapTools::getString($order->ship_method),
191
- 'currency_code' => EvoSnapTools::getString($order->currency_code),
192
- 'enable_3d' => EvoSnapTools::getBoolean(isset($trigger3ds) && ($checkout->order->total >= $trigger3ds))
193
- );
194
-
195
- $aOrderLines = array();
196
- $products = $order->lines;
197
- for($i = 0; $i < count($products); $i++) {
198
- $aOrderLines[$i] = EvoSnapApi::getOrderItem($products[$i]);
199
- }
200
-
201
- $aOrder = array_merge($aOrder, EvoSnapTools::getAddress('billto', $order->billto_address));
202
- if(isset($order->shipto_address)){
203
- $aOrder = array_merge($aOrder, EvoSnapTools::getAddress('shipto', $order->shipto_address));
204
- }
205
-
206
  $aPost = array(
207
  'action' => $checkout->getAction(),
208
  'code' => $code,
209
  'customer' => $aCustomer,
210
- 'order' => $aOrder,
211
- 'order_item' => $aOrderLines,
212
  'return_url' => $returnUrl,
213
  'cancel_url' => $cancelUrl,
214
- 'auto_return' => '1',
215
  'checkout_layout' => $checkout->checkout_layout,
216
- 'language' => $checkout->language
 
217
  );
218
- $aPost['mac'] = EvoSnapApi::getOrderCheckoutMac($aPost, $key);
 
 
 
 
 
 
 
 
219
 
220
  return $aPost;
221
  }
222
 
223
  /**
224
- *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  * @param OrderLine $orderItem
226
  * @return array
227
  */
@@ -236,15 +297,35 @@ class EvoSnapApi
236
  );
237
  }
238
 
239
- private static function getOrderCheckoutMac($aPost, $key){
240
  $aMACParams = array(
241
  'code' => $aPost['code'],
242
- 'email' => $aPost['customer']['email'],
243
- 'order_total_subtotal' => $aPost['order']['total_subtotal'],
244
- 'order_total' => $aPost['order']['total'],
245
- 'merchant_order_id' => $aPost['order']['merchant_order_id']
246
  );
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  return EvoSnapTools::getMac($aMACParams, $key);
249
  }
250
 
@@ -254,7 +335,7 @@ class EvoSnapApi
254
  * @param string $txnId the transaction ID.
255
  * @param float $amount the amount to credit, null value defaults to original transaction amount.
256
  * @param HostedPayments $cfg Hosted Payments Configuration.
257
- * @return the order status.
258
  */
259
  public static function creditOrder($id, $txnId, $amount, $cfg){
260
  $aPost = EvoSnapApi::getEvoSnapCreditOrderPost($id, $txnId, $amount,
@@ -294,4 +375,252 @@ class EvoSnapApi
294
 
295
  return EvoSnapTools::getMac($aMACParams, $key);
296
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  }
37
  * Retrieves orders.
38
  * @param array $params request parameters.
39
  * @param HostedPayments $cfg Hosted Payments Configuration.
40
+ * @return array the orders.
41
  */
42
  public static function getOrders($params, $cfg){
43
  $aPost = EvoSnapApi::getEvoSnapOrdersPost($params, $cfg->code, $cfg->key);
53
  $aPost = array(
54
  'action' => 'get_orders',
55
  'code' => $code,
56
+ 'return' => 'json'
57
  );
58
  $aPost['mac'] = EvoSnapApi::getOrdersMac($aPost, $key);
59
  $aPost = array_merge($aPost, $params);
63
  private static function getOrdersMac($aPost, $key){
64
  $aMACParams = array(
65
  'code' => $aPost['code'],
66
+ 'action' => $aPost['action']
67
  );
68
 
69
  return EvoSnapTools::getMac($aMACParams, $key);
73
  * Retrieves an order.
74
  * @param string $id the order ID.
75
  * @param HostedPayments $cfg Hosted Payments Configuration.
76
+ * @return mixed the order.
77
  */
78
  public static function getOrder($id, $cfg){
79
  $aPost = EvoSnapApi::getEvoSnapOrderPost($id, $cfg->code, $cfg->key);
106
  * Gets order status.
107
  * @param string $id the order ID.
108
  * @param HostedPayments $cfg Hosted Payments Configuration.
109
+ * @return string the order status.
110
  */
111
  public static function getOrderStatus($id, $cfg){
112
  $order = EvoSnapApi::getOrder($id, $cfg);
125
  'action' => 'get_order',
126
  'code' => $code,
127
  'merchant_order_id' => $id,
128
+ 'return' => 'json'
129
  );
130
  $aPost['mac'] = EvoSnapApi::getOrderMac($aPost, $key);
131
 
143
  }
144
 
145
  /**
146
+ * Gets checkout URL from Hosted Payments.
147
+ * @param SnapCheckoutAbstract $order the order checkout.
148
  * @param float $trigger3ds value that triggers 3D secure.
149
  * @param HostedPayments $cfg Hosted Payments Configuration.
150
+ * @return string the checkout URL.
151
  */
152
+ public static function getCheckoutUrl($order, $trigger3ds, $cfg) {
153
  $aPost = EvoSnapApi::getEvoSnapCehckoutPost($order, $trigger3ds, $cfg->code, $cfg->key);
154
  $result = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(true), $cfg->environment);
155
  if ($result ['success'] != false) {
161
 
162
  /**
163
  *
164
+ * @param SnapCheckoutAbstract $checkout
165
  * @param float $trigger3ds
166
  * @param string $code
167
  * @param string $key
180
  'email' => EvoSnapTools::getString($customer->email, 50)
181
  );
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  $aPost = array(
184
  'action' => $checkout->getAction(),
185
  'code' => $code,
186
  'customer' => $aCustomer,
 
 
187
  'return_url' => $returnUrl,
188
  'cancel_url' => $cancelUrl,
189
+ 'auto_return' => EvoSnapTools::getBoolean($checkout->auto_return),
190
  'checkout_layout' => $checkout->checkout_layout,
191
+ 'language' => $checkout->language,
192
+ 'create_token' => EvoSnapTools::getBoolean($checkout->create_token)
193
  );
194
+
195
+ if(property_exists($checkout, 'order') && !empty($checkout->order)){
196
+ $aPost = array_merge($aPost, EvoSnapApi::getOrderPost($checkout->order, $trigger3ds));
197
+ }
198
+ if(property_exists($checkout, 'subscription') && !empty($checkout->subscription)){
199
+ $aPost = array_merge($aPost, EvoSnapApi::getSubscriptionPost($checkout->subscription, $trigger3ds));
200
+ }
201
+
202
+ $aPost['mac'] = EvoSnapApi::getCheckoutMac($aPost, $key);
203
 
204
  return $aPost;
205
  }
206
 
207
  /**
208
+ * Gets order post
209
+ * @param SnapOrder $order
210
+ * @param float $trigger3ds
211
+ * @return array
212
+ */
213
+ private static function getOrderPost($order, $trigger3ds){
214
+ $aOrder = array(
215
+ 'merchant_order_id' => EvoSnapTools::getString($order->id, 255),
216
+ 'total_subtotal' => EvoSnapTools::getNumber($order->total_subtotal),
217
+ 'total_tax' => EvoSnapTools::getNumber($order->total_tax),
218
+ 'total_shipping' => EvoSnapTools::getNumber($order->total_shipping),
219
+ 'total_discount' => EvoSnapTools::getNumber($order->total_discount),
220
+ 'total' => EvoSnapTools::getNumber($order->total),
221
+ 'ship_method' => EvoSnapTools::getString($order->ship_method),
222
+ 'currency_code' => EvoSnapTools::getString($order->currency_code),
223
+ 'enable_3d' => EvoSnapTools::getBoolean(isset($trigger3ds) && ($order->total >= $trigger3ds))
224
+ );
225
+
226
+ $aOrderLines = array();
227
+ $products = $order->lines;
228
+ for($i = 0; $i < count($products); $i++) {
229
+ $aOrderLines[$i] = EvoSnapApi::getOrderItem($products[$i]);
230
+ }
231
+
232
+ $aOrder = array_merge($aOrder, EvoSnapTools::getAddress('billto', $order->billto_address));
233
+ if(isset($order->shipto_address)){
234
+ $aOrder = array_merge($aOrder, EvoSnapTools::getAddress('shipto', $order->shipto_address));
235
+ }
236
+
237
+ return array('order' => $aOrder, 'order_item' => $aOrderLines);
238
+ }
239
+
240
+ /**
241
+ * Gets subscription post
242
+ * @param SnapSubscription $subscription
243
+ * @param float $trigger3ds
244
+ * @return array
245
+ */
246
+ private static function getSubscriptionPost($subscription, $trigger3ds){
247
+ $aSubscription = array(
248
+ 'merchant_subscription_id' => EvoSnapTools::getString($subscription->id, 255),
249
+ 'interval_length' => $subscription->interval_length,
250
+ 'interval_unit' => $subscription->interval_unit,
251
+ 'start_date' => $subscription->start_date,
252
+ 'total_occurrences' => $subscription->total_occurrences,
253
+ 'trial_occurrences' => $subscription->trial_occurrences,
254
+ 'auto_process' => $subscription->auto_process,
255
+ 'total_subtotal' => EvoSnapTools::getNumber($subscription->total_subtotal),
256
+ 'total_tax' => EvoSnapTools::getNumber($subscription->total_tax),
257
+ 'total_shipping' => EvoSnapTools::getNumber($subscription->total_shipping),
258
+ 'total_discount' => EvoSnapTools::getNumber($subscription->total_discount),
259
+ 'total' => EvoSnapTools::getNumber($subscription->total),
260
+ 'trial_amount' => EvoSnapTools::getNumber($subscription->trial_amount),
261
+ 'ship_method' => EvoSnapTools::getString($subscription->ship_method),
262
+ 'currency_code' => EvoSnapTools::getString($subscription->currency_code),
263
+ 'enable_3d' => EvoSnapTools::getBoolean(isset($trigger3ds) && ($subscription->total >= $trigger3ds))
264
+ );
265
+
266
+ if($subscription->trial_occurrences && ($subscription->trial_occurrences > 0)){
267
+ $aSubscription['trial_occurrences'] = $subscription->trial_occurrences;
268
+ $aSubscription['trial_amount'] = $subscription->trial_amount;
269
+ }
270
+
271
+ $aSubscriptionLines = array();
272
+ $products = $subscription->lines;
273
+ for($i = 0; $i < count($products); $i++) {
274
+ $aSubscriptionLines[$i] = EvoSnapApi::getOrderItem($products[$i]);
275
+ }
276
+
277
+ $aSubscription = array_merge($aSubscription, EvoSnapTools::getAddress('billto', $subscription->billto_address));
278
+ if(isset($subscription->shipto_address)){
279
+ $aSubscription = array_merge($aSubscription, EvoSnapTools::getAddress('shipto', $subscription->shipto_address));
280
+ }
281
+
282
+ return array('sub' => $aSubscription, 'sub_item' => $aSubscriptionLines);
283
+ }
284
+
285
+ /**
286
  * @param OrderLine $orderItem
287
  * @return array
288
  */
297
  );
298
  }
299
 
300
+ private static function getCheckoutMac($aPost, $key){
301
  $aMACParams = array(
302
  'code' => $aPost['code'],
303
+ 'email' => $aPost['customer']['email']
 
 
 
304
  );
305
 
306
+ if(array_key_exists('order', $aPost)){
307
+ $aOrderMACParams = array(
308
+ 'order_total_subtotal' => $aPost['order']['total_subtotal'],
309
+ 'order_total' => $aPost['order']['total'],
310
+ 'merchant_order_id' => $aPost['order']['merchant_order_id']
311
+ );
312
+
313
+ $aMACParams = array_merge($aMACParams, $aOrderMACParams);
314
+ }
315
+
316
+ if(array_key_exists('sub', $aPost)){
317
+ $aSubMACParams = array(
318
+ 'sub_total_subtotal' => $aPost['sub']['total_subtotal'],
319
+ 'sub_total_occurrences' => $aPost['sub']['total_occurrences'],
320
+ 'sub_total' => $aPost['sub']['total'],
321
+ 'sub_trial_amount' => $aPost['sub']['trial_amount'],
322
+ 'sub_trial_occurrences' => $aPost['sub']['trial_occurrences'],
323
+ 'merchant_subscription_id' => $aPost['sub']['merchant_subscription_id']
324
+ );
325
+
326
+ $aMACParams = array_merge($aMACParams, $aSubMACParams);
327
+ }
328
+
329
  return EvoSnapTools::getMac($aMACParams, $key);
330
  }
331
 
335
  * @param string $txnId the transaction ID.
336
  * @param float $amount the amount to credit, null value defaults to original transaction amount.
337
  * @param HostedPayments $cfg Hosted Payments Configuration.
338
+ * @return string the transaction ID.
339
  */
340
  public static function creditOrder($id, $txnId, $amount, $cfg){
341
  $aPost = EvoSnapApi::getEvoSnapCreditOrderPost($id, $txnId, $amount,
375
 
376
  return EvoSnapTools::getMac($aMACParams, $key);
377
  }
378
+
379
+ /**
380
+ * Retrieves callbacks.
381
+ * @param array $params request parameters.
382
+ * @param HostedPayments $cfg Hosted Payments Configuration.
383
+ * @return array the callback list.
384
+ */
385
+ public static function getCallbacks($params, $cfg){
386
+ $aPost = EvoSnapApi::getEvoSnapCallbacksPost($params, $cfg->code, $cfg->key);
387
+ $orders = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(false), $cfg->environment);
388
+ if ($orders ['success'] != false) {
389
+ return $orders['results'];
390
+ } else {
391
+ throw new HostedPayments_Exception($orders['message']);
392
+ }
393
+ }
394
+
395
+ private static function getEvoSnapCallbacksPost($params, $code, $key){
396
+ $aPost = array(
397
+ 'action' => 'get_callbacks',
398
+ 'code' => $code,
399
+ 'return' => 'json'
400
+ );
401
+ $aPost['mac'] = EvoSnapApi::getCallbacksMac($aPost, $key);
402
+ $aPost = array_merge($aPost, $params);
403
+ return $aPost;
404
+ }
405
+
406
+ private static function getCallbacksMac($aPost, $key){
407
+ $aMACParams = array(
408
+ 'code' => $aPost['code'],
409
+ 'action' => $aPost['action']
410
+ );
411
+
412
+ return EvoSnapTools::getMac($aMACParams, $key);
413
+ }
414
+
415
+ /**
416
+ * Gets checkout token
417
+ * @param SnapToken_Checkout $token the token checkout.
418
+ * @param boolean $enable3d enable 3D secure.
419
+ * @param HostedPayments $cfg Hosted Payments Configuration.
420
+ * @return string the checkout URL.
421
+ */
422
+ public static function getTokenCheckoutUrl($token, $enable3d, $cfg) {
423
+ $aPost = EvoSnapApi::getEvoSnapTokenCehckoutPost($token, $enable3d, $cfg->code, $cfg->key);
424
+ $result = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(true), $cfg->environment);
425
+ if ($result ['success'] != false) {
426
+ return $result ['url'];
427
+ } else {
428
+ throw new HostedPayments_Exception($result['message']);
429
+ }
430
+ }
431
+
432
+ /**
433
+ *
434
+ * @param SnapToken_Checkout $checkout
435
+ * @param boolean $enable3d
436
+ * @param string $code
437
+ * @param string $key
438
+ * @return array
439
+ */
440
+ private static function getEvoSnapTokenCehckoutPost($checkout, $enable3d, $code, $key){
441
+ $returnUrl = $checkout->return_url;
442
+ $cancelUrl = $checkout->cancel_url;
443
+
444
+ $customer = $checkout->customer;
445
+ $aCustomer = array(
446
+ 'merchant_customer_id' => $customer->id,
447
+ 'first_name' =>EvoSnapTools::getString($customer->first_name),
448
+ 'last_name' => EvoSnapTools::getString($customer->last_name),
449
+ 'phone' => EvoSnapTools::getString($customer->phone, 15),
450
+ 'email' => EvoSnapTools::getString($customer->email, 50)
451
+ );
452
+
453
+ $token = $checkout->token;
454
+ $aToken = array(
455
+ 'merchant_token_id' => EvoSnapTools::getString($token->id, 255),
456
+ 'currency_code' => EvoSnapTools::getString($token->currency_code),
457
+ 'auth_amount' => EvoSnapTools::getNumber($token->auth_amount),
458
+ 'enable_3d' => EvoSnapTools::getBoolean($enable3d)
459
+ );
460
+
461
+ $aToken = array_merge($aToken, EvoSnapTools::getAddress('billto', $token->billto_address));
462
+
463
+ $aPost = array(
464
+ 'action' => $checkout->getAction(),
465
+ 'code' => $code,
466
+ 'customer' => $aCustomer,
467
+ 'token' => $aToken,
468
+ 'return_url' => $returnUrl,
469
+ 'cancel_url' => $cancelUrl,
470
+ 'auto_return' => '1',
471
+ 'checkout_layout' => $checkout->checkout_layout,
472
+ 'language' => $checkout->language
473
+ );
474
+ $aPost['mac'] = EvoSnapApi::getTokenCheckoutMac($aPost, $key);
475
+
476
+ return $aPost;
477
+ }
478
+
479
+ private static function getTokenCheckoutMac($aPost, $key){
480
+ $aMACParams = array(
481
+ 'code' => $aPost['code'],
482
+ 'email' => $aPost['customer']['email'],
483
+ 'merchant_order_id' => $aPost['token']['merchant_token_id']
484
+ );
485
+
486
+ return EvoSnapTools::getMac($aMACParams, $key);
487
+ }
488
+
489
+ /**
490
+ * Retrieves tokens.
491
+ * @param array $params request parameters.
492
+ * @param HostedPayments $cfg Hosted Payments Configuration.
493
+ * @return array the orders.
494
+ */
495
+ public static function getTokens($params, $cfg){
496
+ $aPost = EvoSnapApi::getEvoSnapTokensPost($params, $cfg->code, $cfg->key);
497
+ $tokens = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(false), $cfg->environment);
498
+ if ($tokens ['success'] != false) {
499
+ return $tokens['tokens'];
500
+ } else {
501
+ throw new HostedPayments_Exception($tokens['message']);
502
+ }
503
+ }
504
+
505
+ private static function getEvoSnapTokensPost($params, $code, $key){
506
+ $aPost = array(
507
+ 'action' => 'get_tokens',
508
+ 'code' => $code,
509
+ 'return' => 'json'
510
+ );
511
+ $aPost['mac'] = EvoSnapApi::getTokensMac($aPost, $key);
512
+ $aPost = array_merge($aPost, $params);
513
+ return $aPost;
514
+ }
515
+
516
+ private static function getTokensMac($aPost, $key){
517
+ $aMACParams = array(
518
+ 'code' => $aPost['code'],
519
+ 'action' => $aPost['action'],
520
+ );
521
+
522
+ return EvoSnapTools::getMac($aMACParams, $key);
523
+ }
524
+
525
+ /**
526
+ * Retrieves a token.
527
+ * @param string $id the token ID.
528
+ * @param HostedPayments $cfg Hosted Payments Configuration.
529
+ * @return mixed the token.
530
+ */
531
+ public static function getToken($id, $cfg){
532
+ $aPost = EvoSnapApi::getEvoSnapTokenPost($id, $cfg->code, $cfg->key);
533
+ $token = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(false), $cfg->environment);
534
+ if ($token ['success'] != false) {
535
+ return $token['token'];
536
+ } else {
537
+ throw new HostedPayments_Exception($token['message']);
538
+ }
539
+ }
540
+
541
+ private static function getEvoSnapTokenPost($id, $code, $key){
542
+ $aPost = array(
543
+ 'action' => 'get_token',
544
+ 'code' => $code,
545
+ 'merchant_token_id' => $id,
546
+ 'return' => 'json'
547
+ );
548
+ $aPost['mac'] = EvoSnapApi::getTokenMac($aPost, $key);
549
+
550
+ return $aPost;
551
+ }
552
+
553
+ private static function getTokenMac($aPost, $key){
554
+ $aMACParams = array(
555
+ 'code' => $aPost['code'],
556
+ 'action' => $aPost['action'],
557
+ 'merchant_token_id' => $aPost['merchant_token_id']
558
+ );
559
+
560
+ return EvoSnapTools::getMac($aMACParams, $key);
561
+ }
562
+
563
+ /**
564
+ * Process a token order.
565
+ * @param string $id the token ID.
566
+ * @param SnapOrder $order the order.
567
+ * @param HostedPayments $cfg Hosted Payments Configuration.
568
+ * @return mixed the token.
569
+ */
570
+ public static function processTokenOrder($id, $order, $cfg){
571
+ $aPost = EvoSnapApi::getEvoSnapProcessTokenOrderPost($id, $order, $cfg->code, $cfg->key);
572
+ $token = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(false), $cfg->environment);
573
+ if ($token ['success'] != false) {
574
+ return $token;
575
+ } else {
576
+ throw new HostedPayments_Exception($token['message']);
577
+ }
578
+ }
579
+
580
+ private static function getEvoSnapProcessTokenOrderPost($id, $order, $code, $key){
581
+ $aOrder = array(
582
+ 'merchant_order_id' => EvoSnapTools::getString($order->id, 255),
583
+ 'total_subtotal' => EvoSnapTools::getNumber($order->total_subtotal),
584
+ 'total_tax' => EvoSnapTools::getNumber($order->total_tax),
585
+ 'total_shipping' => EvoSnapTools::getNumber($order->total_shipping),
586
+ 'total_discount' => EvoSnapTools::getNumber($order->total_discount),
587
+ 'total' => EvoSnapTools::getNumber($order->total),
588
+ 'ship_method' => EvoSnapTools::getString($order->ship_method)
589
+ );
590
+
591
+ $aOrderLines = array();
592
+ $products = $order->lines;
593
+ for($i = 0; $i < count($products); $i++) {
594
+ $aOrderLines[$i] = EvoSnapApi::getOrderItem($products[$i]);
595
+ }
596
+
597
+ $aOrder = array_merge($aOrder, EvoSnapTools::getAddress('billto', $order->billto_address));
598
+ if(isset($order->shipto_address)){
599
+ $aOrder = array_merge($aOrder, EvoSnapTools::getAddress('shipto', $order->shipto_address));
600
+ }
601
+
602
+ $aPost = array(
603
+ 'action' => 'process_token',
604
+ 'code' => $code,
605
+ 'merchant_token_id' => $id,
606
+ 'token_order' => $aOrder,
607
+ 'token_order_item' => $aOrderLines,
608
+ 'return' => 'json'
609
+ );
610
+
611
+ $aPost['mac'] = EvoSnapApi::getProcessTokenOrderMac($aPost, $key);
612
+
613
+ return $aPost;
614
+ }
615
+
616
+ private static function getProcessTokenOrderMac($aPost, $key){
617
+ $aMACParams = array(
618
+ 'code' => $aPost['code'],
619
+ 'action' => $aPost['action'],
620
+ 'merchant_token_id' => $aPost['merchant_token_id']
621
+ );
622
+
623
+ return EvoSnapTools::getMac($aMACParams, $key);
624
+ }
625
+
626
  }
lib/hostedpayments/evosnap_tools.php CHANGED
@@ -41,12 +41,13 @@ class EvoSnapTools
41
  * @return array the resulting call.
42
  */
43
  public static function callEvoSnap($params, $url, $verifySsl = true){
 
44
  $rCurl = curl_init ();
45
  curl_setopt ( $rCurl, CURLOPT_URL, $url );
46
  curl_setopt ( $rCurl, CURLOPT_SSL_VERIFYPEER, $verifySsl );
47
  curl_setopt ( $rCurl, CURLOPT_RETURNTRANSFER, 1 );
48
  curl_setopt ( $rCurl, CURLOPT_POST, true );
49
- curl_setopt ( $rCurl, CURLOPT_POSTFIELDS, EvoSnapTools::encodeRequest ( $params ) );
50
 
51
  $result = ( array ) json_decode ( curl_exec ( $rCurl ) );
52
 
@@ -96,6 +97,36 @@ class EvoSnapTools
96
  return implode('&', $aFields);
97
  }
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  /**
100
  * Gets a valid String to send to EVO Snap*.
101
  * @param string $s the String to format.
@@ -121,7 +152,7 @@ class EvoSnapTools
121
  * @return string
122
  */
123
  public static function getBoolean($b){
124
- return $b? 1 : 0;
125
  }
126
 
127
  /**
@@ -141,17 +172,20 @@ class EvoSnapTools
141
  */
142
  public static function getAddress($prefix, $address){
143
  $aAddress = array();
144
- $aAddress[$prefix.'_company'] = EvoSnapTools::getString($address->company);
145
- $aAddress[$prefix.'_first_name'] = EvoSnapTools::getString($address->first_name);
146
- $aAddress[$prefix.'_last_name'] = EvoSnapTools::getString($address->last_name);
147
- $aAddress[$prefix.'_po_box_number'] = EvoSnapTools::getString($address->po_box_number);
148
- $aAddress[$prefix.'_address1'] = EvoSnapTools::getString($address->address1);
149
- $aAddress[$prefix.'_address2'] = EvoSnapTools::getString($address->address2);
150
- $aAddress[$prefix.'_house_number'] = EvoSnapTools::getString($address->house_number);
151
- $aAddress[$prefix.'_city'] = EvoSnapTools::getString($address->city);
152
- $aAddress[$prefix.'_zipcode'] = EvoSnapTools::getZipCode($address->zipcode);
153
- $aAddress[$prefix.'_country'] = $address->country;
154
- $aAddress[$prefix.'_state'] = $address->state;
 
 
 
155
 
156
  return $aAddress;
157
  }
41
  * @return array the resulting call.
42
  */
43
  public static function callEvoSnap($params, $url, $verifySsl = true){
44
+ $fparams = EvoSnapTools::filterArray($params);
45
  $rCurl = curl_init ();
46
  curl_setopt ( $rCurl, CURLOPT_URL, $url );
47
  curl_setopt ( $rCurl, CURLOPT_SSL_VERIFYPEER, $verifySsl );
48
  curl_setopt ( $rCurl, CURLOPT_RETURNTRANSFER, 1 );
49
  curl_setopt ( $rCurl, CURLOPT_POST, true );
50
+ curl_setopt ( $rCurl, CURLOPT_POSTFIELDS, EvoSnapTools::encodeRequest($fparams) );
51
 
52
  $result = ( array ) json_decode ( curl_exec ( $rCurl ) );
53
 
97
  return implode('&', $aFields);
98
  }
99
 
100
+ /**
101
+ * Filters an array removing false items.
102
+ * @param array $a the array to filter.
103
+ * @return array the resulting array.
104
+ */
105
+ public static function filterArray($a)
106
+ {
107
+ foreach ($a as &$value) {
108
+ if (is_array($value)) {
109
+ $value = EvoSnapTools::filterArray($value);
110
+ }
111
+ }
112
+
113
+ return array_filter($a,array('EvoSnapTools', 'valueTest'));
114
+ }
115
+
116
+ public static function valueTest($value){
117
+ $result = true;
118
+
119
+ if(is_string($value)){
120
+ $result = trim($value) !== '';
121
+ }else if(is_array($value)){
122
+ $result = !empty($value);
123
+ }else{
124
+ $result = !(is_null($value) || ($value === false));
125
+ }
126
+
127
+ return $result;
128
+ }
129
+
130
  /**
131
  * Gets a valid String to send to EVO Snap*.
132
  * @param string $s the String to format.
152
  * @return string
153
  */
154
  public static function getBoolean($b){
155
+ return $b? '1' : '0';
156
  }
157
 
158
  /**
172
  */
173
  public static function getAddress($prefix, $address){
174
  $aAddress = array();
175
+
176
+ if($address){
177
+ $aAddress[$prefix.'_company'] = EvoSnapTools::getString($address->company);
178
+ $aAddress[$prefix.'_first_name'] = EvoSnapTools::getString($address->first_name);
179
+ $aAddress[$prefix.'_last_name'] = EvoSnapTools::getString($address->last_name);
180
+ $aAddress[$prefix.'_po_box_number'] = EvoSnapTools::getString($address->po_box_number);
181
+ $aAddress[$prefix.'_address1'] = EvoSnapTools::getString($address->address1);
182
+ $aAddress[$prefix.'_address2'] = EvoSnapTools::getString($address->address2);
183
+ $aAddress[$prefix.'_house_number'] = EvoSnapTools::getString($address->house_number);
184
+ $aAddress[$prefix.'_city'] = EvoSnapTools::getString($address->city);
185
+ $aAddress[$prefix.'_zipcode'] = EvoSnapTools::getZipCode($address->zipcode);
186
+ $aAddress[$prefix.'_country'] = $address->country;
187
+ $aAddress[$prefix.'_state'] = $address->state;
188
+ }
189
 
190
  return $aAddress;
191
  }
lib/hostedpayments/index.php CHANGED
@@ -45,6 +45,7 @@ include_once(_EVO_HP_ROOT_.'/model/checkout.php');
45
  include_once(_EVO_HP_ROOT_.'/model/order_checkout.php');
46
  include_once(_EVO_HP_ROOT_.'/model/subscription_checkout.php');
47
  include_once(_EVO_HP_ROOT_.'/model/combo_checkout.php');
 
48
 
49
  include_once(_EVO_HP_ROOT_.'/exceptions/hostepayments_exception.php');
50
 
45
  include_once(_EVO_HP_ROOT_.'/model/order_checkout.php');
46
  include_once(_EVO_HP_ROOT_.'/model/subscription_checkout.php');
47
  include_once(_EVO_HP_ROOT_.'/model/combo_checkout.php');
48
+ include_once(_EVO_HP_ROOT_.'/model/token_checkout.php');
49
 
50
  include_once(_EVO_HP_ROOT_.'/exceptions/hostepayments_exception.php');
51
 
lib/hostedpayments/model/subscription.php CHANGED
@@ -42,7 +42,7 @@ class SnapSubscription extends SnapOrder {
42
  public $interval_length;
43
 
44
  /**
45
- * Frequency of Subscription Payments: days�, weeks�,�months�, years
46
  * @var string
47
  */
48
  public $interval_unit;
@@ -55,7 +55,7 @@ class SnapSubscription extends SnapOrder {
55
  public $start_date;
56
 
57
  /**
58
- * Total number of Subscription Payments. Specify 9999 for unlimited.
59
  * @var integer
60
  */
61
  public $total_occurrences;
42
  public $interval_length;
43
 
44
  /**
45
+ * Frequency of Subscription Payments: "days", "weeks","months", "years"
46
  * @var string
47
  */
48
  public $interval_unit;
55
  public $start_date;
56
 
57
  /**
58
+ * Total number of Subscription Payments. Specify "9999" for unlimited.
59
  * @var integer
60
  */
61
  public $total_occurrences;
lib/hostedpayments/model/token.php CHANGED
@@ -54,6 +54,12 @@ class SnapToken {
54
  */
55
  public $auth_amount;
56
 
 
 
 
 
 
 
57
  /**
58
  * Metadata.
59
  * @var array
54
  */
55
  public $auth_amount;
56
 
57
+ /**
58
+ * ISO currency code.
59
+ * @var string
60
+ */
61
+ public $currency_code;
62
+
63
  /**
64
  * Metadata.
65
  * @var array
lib/hostedpayments/model/token_checkout.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
4
+ *
5
+ * This software and documentation is subject to and made
6
+ * available only pursuant to the terms of an executed license
7
+ * agreement, and may be used only in accordance with the terms
8
+ * of said agreement. This software may not, in whole or in part,
9
+ * be copied, photocopied, reproduced, translated, or reduced to
10
+ * any electronic medium or machine-readable form without
11
+ * prior consent, in writing, from EVO Payments International, INC.
12
+ *
13
+ * Use, duplication or disclosure by the U.S. Government is subject
14
+ * to restrictions set forth in an executed license agreement
15
+ * and in subparagraph (c)(1) of the Commercial Computer
16
+ * Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
17
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
18
+ * clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
19
+ * Computer Software--Licensing clause at NASA FAR supplement
20
+ * 16-52.227-86; or their equivalent.
21
+ *
22
+ * Information in this software is subject to change without notice
23
+ * and does not represent a commitment on the part of EVO Payments International.
24
+ *
25
+ * Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
26
+ * the software company to properly integrate into thier solution code that best meets thier production needs.
27
+ */
28
+
29
+ /**
30
+ * Token Checkout class.
31
+ *
32
+ * @author Antonio Molinero <antonio.molinero@evopayments.com>
33
+ * @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
34
+ * @license EVO Payments International EULA
35
+ */
36
+ class SnapToken_Checkout extends SnapCheckoutAbstract {
37
+
38
+ /**
39
+ * Token.
40
+ * @var SnapToken
41
+ */
42
+ public $token;
43
+
44
+ /**
45
+ * Retrieves the action to execute.
46
+ */
47
+ public function getAction(){
48
+ return 'token';
49
+ }
50
+ }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Popular_Payments_Snap_HostedPayments</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license>EVO Payments International EULA</license>
7
  <channel>community</channel>
@@ -9,11 +9,11 @@
9
  <summary>Popular Payments - Snap* Hosted Payments</summary>
10
  <description>Hosted Payments is perfect for merchants who want to streamline payments and reduce PCI compliance burden.&#xD;
11
  Offering the fastest way to securely accept payment within your shopping cart, donations website, or online billing application.</description>
12
- <notes>Initial release.</notes>
13
- <authors><author><name>Popular Payments</name><user>popularpayments</user><email>partners@popularpayments.es</email></author></authors>
14
- <date>2015-12-17</date>
15
- <time>09:30:55</time>
16
- <contents><target name="magelocale"><dir name="en_US"><file name="Evo_HostedPayments.csv" hash="258ae48ace276313fbd327c09718d5c6"/></dir><dir name="es_ES"><file name="Evo_HostedPayments.csv" hash="03b8a0cf0a10599a8858ebd52939526f"/></dir></target><target name="magelib"><dir name="hostedpayments"><file name="evosnap_api.php" hash="6b6d6e5747a9b7876e66fef0a206eff6"/><file name="evosnap_constants.php" hash="e4da0c5944f13fd87f5fa8db4aef9c26"/><file name="evosnap_tools.php" hash="91d9978a774582839d8bc524985d1ba3"/><dir name="exceptions"><file name="hostepayments_exception.php" hash="2ab976b824a27fbcf3f1cdc7dea607d8"/></dir><file name="index.php" hash="11af8d661d96429f0d2288a483e7f225"/><dir name="model"><file name="address.php" hash="acbecd3223d913b6c822d83a2bc5fde7"/><file name="checkout.php" hash="fe5f107c6df599665635a4b8feeebd7a"/><file name="combo_checkout.php" hash="48c59f828f1d5d903d4067a29208b2df"/><file name="customer.php" hash="5d193104124d98f81533fefb83ef18e8"/><file name="hostedpayments.php" hash="d2916bc74976532e2f5f05ab244764ba"/><file name="order.php" hash="4ab2632b843187391e602fa7ea01cdeb"/><file name="order_checkout.php" hash="88eed40487ce2a9b24ec50bbfd6238f5"/><file name="order_line.php" hash="27c3701ea5461e63230e1ccda575a2eb"/><file name="subscription.php" hash="ab8199fc8852d271a4160978b0ef7ada"/><file name="subscription_checkout.php" hash="b3f89fd6336f5c57adc39fd0d1bd452b"/><file name="token.php" hash="87cca899cafc5caa5c9a37b31a2fee95"/></dir></dir></target><target name="magelocal"><dir name="Evo"><dir name="HostedPayments"><dir name="Block"><file name="Form.php" hash="413d0f7ecc48334458a6677f634a4fc0"/><file name="Iframe.php" hash="7912a95f2d0536eff4741aa1d4d13de4"/><file name="Iframevalidation.php" hash="111d9833f030fabcb7baa18f926cf9f0"/><file name="Info.php" hash="086ca3365fe27b818900ce805bbcb45c"/></dir><dir name="Helper"><file name="Data.php" hash="c3b73cb701fea4bc08ca4ebe02741fd8"/></dir><dir name="Model"><file name="Hostedpayment.php" hash="807c952986c2461ad7fd9dba45d66dba"/><file name="Payment.php" hash="72f947fbeaaaae429a83239e5658882d"/><dir name="Resource"><dir name="Hostedpayment"><file name="Collection.php" hash="b51a062a9bbfc5a69b1a3b6575991e1a"/></dir><file name="Hostedpayment.php" hash="cc3c32dcebabf4c5b0abd7a2dcbbe924"/><file name="Setup.php" hash="96a49aea7e98d3470f2fb2abe23a53dc"/></dir></dir><dir name="controllers"><file name="ProcessingController.php" hash="143330b3ff1af64194288711c62cb82f"/></dir><dir name="etc"><file name="config.xml" hash="69ba6b12e8726fc7537d61c45f955185"/><file name="system.xml" hash="b42994adda2b2564ca6396bfca114e04"/></dir><dir name="sql"><dir name="hostedpayments_setup"><file name="install-0.1.0.php" hash="08d8b35784c3c8b1a2355022cb4da566"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="evo"><file name="info.phtml" hash="2b3a1b10beabe5c667956ccb85fd1e6e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="evohostedpayments.xml" hash="ff3f05c4e91e1495cf8cc53632d6279d"/></dir><dir name="template"><dir name="evo"><file name="form.phtml" hash="47af0cbfdfb7b2066f3e6d0238b22ef7"/><file name="iframe.phtml" hash="3dc536079f66dae2cc80fd5dd3e5a207"/><file name="iframevalidation.phtml" hash="5060a6563cdeebad96430165b66e44c8"/><file name="info.phtml" hash="63231065d6a007ebfec47a20ae20986b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="evo"><file name="logo.png" hash="a108e448a1066ac4ee0152302998182c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="evo"><file name="brand-logos.png" hash="489b1ad5d5952d60787add247219e2e7"/><file name="cc-logo.png" hash="702b7d0ce2f4748684d79ae2ab7bb33b"/><file name="logo.png" hash="a108e448a1066ac4ee0152302998182c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Evo_HostedPayments.xml" hash="1c8ee1cde5bd6360dfe14e3ee91252ad"/></dir></target></contents>
17
  <compatible/>
18
- <dependencies><required><php><min>5.3.0</min><max>5.9.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Popular_Payments_Snap_HostedPayments</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license>EVO Payments International EULA</license>
7
  <channel>community</channel>
9
  <summary>Popular Payments - Snap* Hosted Payments</summary>
10
  <description>Hosted Payments is perfect for merchants who want to streamline payments and reduce PCI compliance burden.&#xD;
11
  Offering the fastest way to securely accept payment within your shopping cart, donations website, or online billing application.</description>
12
+ <notes>Added Card Storing support.</notes>
13
+ <authors><author><name>Popular Payments</name><user>MAG003183902</user><email>partners@popularpayments.es</email></author></authors>
14
+ <date>2016-02-17</date>
15
+ <time>10:23:47</time>
16
+ <contents><target name="magelocale"><dir name="en_US"><file name="Evo_HostedPayments.csv" hash="9f2b7948d50f366d7299b84c70dacaec"/></dir><dir name="es_ES"><file name="Evo_HostedPayments.csv" hash="7371620977be68a7815b3267365270e5"/></dir></target><target name="magelib"><dir name="hostedpayments"><file name="evosnap_api.php" hash="3acfaa2f6ee27d844d1158d10ae3af74"/><file name="evosnap_constants.php" hash="e4da0c5944f13fd87f5fa8db4aef9c26"/><file name="evosnap_tools.php" hash="3a19a4f82ad7e53ae5c254583b4b250e"/><dir name="exceptions"><file name="hostepayments_exception.php" hash="2ab976b824a27fbcf3f1cdc7dea607d8"/></dir><file name="index.php" hash="8225963442376531af9d07c1e0033d73"/><dir name="model"><file name="address.php" hash="acbecd3223d913b6c822d83a2bc5fde7"/><file name="checkout.php" hash="fe5f107c6df599665635a4b8feeebd7a"/><file name="combo_checkout.php" hash="48c59f828f1d5d903d4067a29208b2df"/><file name="customer.php" hash="5d193104124d98f81533fefb83ef18e8"/><file name="hostedpayments.php" hash="d2916bc74976532e2f5f05ab244764ba"/><file name="order.php" hash="4ab2632b843187391e602fa7ea01cdeb"/><file name="order_checkout.php" hash="88eed40487ce2a9b24ec50bbfd6238f5"/><file name="order_line.php" hash="27c3701ea5461e63230e1ccda575a2eb"/><file name="subscription.php" hash="ba06c80410ce0c6abd61cf465c22b64c"/><file name="subscription_checkout.php" hash="b3f89fd6336f5c57adc39fd0d1bd452b"/><file name="token.php" hash="ef974a1a723fb8f97837ab2643970800"/><file name="token_checkout.php" hash="2537c446276e0f5bc28637a96107e6f2"/></dir></dir></target><target name="magelocal"><dir name="Evo"><dir name="HostedPayments"><dir name="Block"><file name="Form.php" hash="b7be7a4878237927d84897a4dfd095a0"/><file name="Iframe.php" hash="7912a95f2d0536eff4741aa1d4d13de4"/><file name="Iframevalidation.php" hash="111d9833f030fabcb7baa18f926cf9f0"/><file name="Info.php" hash="b0a0ea0128d1c8555a13c4b6655ee49a"/><file name="Storedcards.php" hash="2e93b8dab7065e1658352150260408ae"/></dir><dir name="Helper"><file name="Data.php" hash="c3b73cb701fea4bc08ca4ebe02741fd8"/></dir><dir name="Model"><file name="Hostedpayment.php" hash="807c952986c2461ad7fd9dba45d66dba"/><file name="Payment.php" hash="febaae7b32e71841d1e3583159e01ed5"/><dir name="Resource"><dir name="Hostedpayment"><file name="Collection.php" hash="b51a062a9bbfc5a69b1a3b6575991e1a"/></dir><file name="Hostedpayment.php" hash="cc3c32dcebabf4c5b0abd7a2dcbbe924"/><file name="Setup.php" hash="96a49aea7e98d3470f2fb2abe23a53dc"/><dir name="Storedcard"><file name="Collection.php" hash="7cd9964eaa100ae01cbdb6c2f0f03058"/></dir><file name="Storedcard.php" hash="fe4dd188ed31a50d565eb76b557efeaa"/></dir><file name="Storedcard.php" hash="d479373824cadbf67ea1df98703bddfc"/></dir><dir name="controllers"><file name="IndexController.php" hash="8434f24340f14bd974db9ff8903c00c8"/><file name="ProcessingController.php" hash="83e80186b0eb936aa2aefacd4bcbb073"/></dir><dir name="etc"><file name="config.xml" hash="0800475c54eb456dba9f97e880147d56"/><file name="system.xml" hash="00334349773f7aca84c04388bb81d14a"/></dir><dir name="sql"><dir name="hostedpayments_setup"><file name="install-0.1.0.php" hash="cb2260ecc89512021d3652894adb59c6"/><file name="upgrade-1.0.0-2.0.0.php" hash="8603a72b9f2b8b99a4e07ebe493395be"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="evo"><file name="info.phtml" hash="2b3a1b10beabe5c667956ccb85fd1e6e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="evohostedpayments.xml" hash="667ffe6c187ca5c526f36430d2a3aa1d"/></dir><dir name="template"><dir name="evo"><file name="form.phtml" hash="3aa33e6fbe4201a571a17a62e80dd7bd"/><file name="iframe.phtml" hash="3dc536079f66dae2cc80fd5dd3e5a207"/><file name="iframevalidation.phtml" hash="5060a6563cdeebad96430165b66e44c8"/><file name="info.phtml" hash="cb73d19ba2b3b084178bd066b1f90316"/><file name="storedcards.phtml" hash="1d6497b61c8f32e9a358d81fe2831e14"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="evo"><file name="logo.png" hash="a108e448a1066ac4ee0152302998182c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="evo"><file name="brand-logos.png" hash="489b1ad5d5952d60787add247219e2e7"/><file name="cc-logo.png" hash="702b7d0ce2f4748684d79ae2ab7bb33b"/><file name="cc_amex.png" hash="32f563498a10e29dd3e4d18dd82780cd"/><file name="cc_discover.png" hash="44872f46aedf1c08e8a552b5289816c4"/><file name="cc_mc.png" hash="82f565a75f982e488370914e7831d0c0"/><file name="cc_visa.png" hash="ce09ce1cc27cbf39aaff2415af5021db"/><file name="logo.png" hash="a108e448a1066ac4ee0152302998182c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Evo_HostedPayments.xml" hash="4d2d1bf9a4928f9c7d34fa92a1aa4a61"/></dir></target></contents>
17
  <compatible/>
18
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
skin/frontend/base/default/images/evo/cc_amex.png ADDED
Binary file
skin/frontend/base/default/images/evo/cc_discover.png ADDED
Binary file
skin/frontend/base/default/images/evo/cc_mc.png ADDED
Binary file
skin/frontend/base/default/images/evo/cc_visa.png ADDED
Binary file