Adyen_Payment - Version 2.3.0

Version Notes

Features
#225 HPP payment methods now are generated as seperate payment methods inside Magento
#293 Added Payment method PayByMail
#303 Implemented Cash API and added it as a different payment method (Adyen Cash)
#270 Option to redirect to checkout instead of shopping cart
#304 Added option to connect POS payment to shopper account based on provided email address
#288 #299 Added support for Manual Review
#294 Show installments on order print outs, confirmation emails and admin panel
#284 Added Cronjob that executes notifications that are in the adyen event queue
#283 #246 Added extra validation and restrict length on CVC
#276 Added pending status setting
#273 Added authCode and acquirerReference response into payment overview of the order
#248 Added ReceiptOrderLines to Adyen APP for printing out order details for POS payments
#247 Enable Adyen OneClick for backend order
#245 Refactor the code for Notifications and Result URL with better logging
#244 Added validate Webserver username and password in configuration
#242 Added OneClick payment available for Sepa,Ideal(becomes sepa) and ELV
#241 Added recurring cards to billing agreement of magento

Fixes
#317 POS redirect to app fixes for various browsers
#307 Rewrite POS resultUrl and CheckStatus check
#305 Get RegionCode instead of Region to fix payments for PayPal
#301 Added extra check on pspreference for AUTHORISATION success=false notification (for api payments) before canceling the order
#291 Added support for Comorian Franc (KMF) currency
#290 Added extra validation if modus is corresponding with notification (JSON, HTTP POST)
#285 #243 API fixes for MultiShipping method
#282 Fixes that Boleto pdf is not being generated
#264 Separate ResultAction for POS
#259 Only cancel a order when the payment method is the same as on Magento side
#249 Don't show remember these details for credit cards if user is checking out as a quest
#238 Generated OneClick payments as different payment methods
#237 Fixed that previous button on Adyen HPP will not return in a empty basket when you are not logged in on Magento side
#231 bug fixes, simplified frontend templates, fixes queue
#228 Don't cancel the order if the previous AUTHORISATION event was succesfull
#227 Don't cancel orders on Refused result url (only for Ideal)
#224 Fix JS error when selecting card and Ideal is not available.
#223 Magento API do not send email when order is created. Only when AUTHORISATION notification is received bug
#188 Use POS checkout name based on POS payment method title
#187 Pre fill email in POS express checkout if Payment failes
#79 Added option to disable Klarna after first Klarna payment failed

Download this release

Release Info

Developer Adyen
Extension Adyen_Payment
Version 2.3.0
Comparing to
See all releases


Code changes from version 2.2.2 to 2.3.0

Files changed (123) hide show
  1. app/code/community/Adyen/Payment/.DS_Store +0 -0
  2. app/code/community/Adyen/Payment/Block/Adminhtml/Adyen/Event/Queue/Grid.php +1 -1
  3. app/code/community/Adyen/Payment/Block/Adminhtml/Sales/Order/Renderer/Adyen.php +0 -1
  4. app/code/community/Adyen/Payment/Block/Adminhtml/System/Config/TestWebserverConfiguration.php +95 -0
  5. app/code/community/Adyen/Payment/Block/Checkout/Success.php +1 -3
  6. app/code/community/Adyen/Payment/Block/Form/Boleto.php +27 -13
  7. app/code/community/Adyen/Payment/Block/Form/Cash.php +61 -0
  8. app/code/community/Adyen/Payment/Block/Form/Cc.php +37 -15
  9. app/code/community/Adyen/Payment/Block/Form/Elv.php +27 -14
  10. app/code/community/Adyen/Payment/Block/Form/Hpp.php +35 -14
  11. app/code/community/Adyen/Payment/Block/Form/Ideal.php +57 -0
  12. app/code/community/Adyen/Payment/Block/Form/Oneclick.php +52 -5
  13. app/code/community/Adyen/Payment/Block/Form/Openinvoice.php +33 -19
  14. app/code/community/Adyen/Payment/Block/Form/PayByMail.php +61 -0
  15. app/code/community/Adyen/Payment/Block/Form/Pos.php +31 -13
  16. app/code/community/Adyen/Payment/Block/Form/Sepa.php +91 -35
  17. app/code/community/Adyen/Payment/{Model/Mysql4/Setup.php → Block/Info/Cash.php} +3 -3
  18. app/code/community/Adyen/Payment/Block/Info/Cc.php +4 -0
  19. app/code/community/Adyen/Payment/Block/Info/PayByMail.php +59 -0
  20. app/code/community/Adyen/Payment/Block/PosExpressCheckout.php +37 -0
  21. app/code/community/Adyen/Payment/Block/Redirect.php +202 -28
  22. app/code/community/Adyen/Payment/Block/Sales/Order/Totals.php +16 -20
  23. app/code/community/Adyen/Payment/Helper/Data.php +152 -34
  24. app/code/community/Adyen/Payment/Helper/Payment/Data.php +120 -0
  25. app/code/community/Adyen/Payment/Helper/Pci.php +119 -0
  26. app/code/community/Adyen/Payment/Model/Adyen/Abstract.php +167 -122
  27. app/code/community/Adyen/Payment/Model/Adyen/Boleto.php +1 -0
  28. app/code/community/Adyen/Payment/Model/Adyen/Cash.php +138 -0
  29. app/code/community/Adyen/Payment/Model/Adyen/Cc.php +56 -59
  30. app/code/community/Adyen/Payment/Model/Adyen/Data/Abstract.php +68 -2
  31. app/code/community/Adyen/Payment/Model/Adyen/Data/Address.php +38 -0
  32. app/code/community/Adyen/Payment/Model/Adyen/Data/BillingAddress.php +30 -0
  33. app/code/community/Adyen/Payment/Model/Adyen/Data/DeliveryAddress.php +30 -0
  34. app/code/community/Adyen/Payment/Model/Adyen/Data/ModificationRequest.php +3 -1
  35. app/code/community/Adyen/Payment/Model/Adyen/Data/PaymentRequest.php +66 -18
  36. app/code/community/Adyen/Payment/Model/Adyen/Data/PaymentRequest3d.php +3 -4
  37. app/code/community/Adyen/Payment/Model/Adyen/Elv.php +1 -0
  38. app/code/community/Adyen/Payment/Model/Adyen/Hpp.php +152 -254
  39. app/code/community/Adyen/Payment/Model/Adyen/Ideal.php +55 -0
  40. app/code/community/Adyen/Payment/Model/Adyen/Oneclick.php +56 -60
  41. app/code/community/Adyen/Payment/Model/Adyen/Openinvoice.php +29 -53
  42. app/code/community/Adyen/Payment/Model/Adyen/PayByMail.php +306 -0
  43. app/code/community/Adyen/Payment/Model/Adyen/Pos.php +28 -6
  44. app/code/community/Adyen/Payment/Model/Adyen/Sepa.php +91 -0
  45. app/code/community/Adyen/Payment/Model/Authenticate.php +1 -15
  46. app/code/community/Adyen/Payment/Model/Cronjob.php +77 -0
  47. app/code/community/Adyen/Payment/Model/Event.php +2 -16
  48. app/code/community/Adyen/Payment/Model/Event/Queue.php +1 -3
  49. app/code/community/Adyen/Payment/Model/GetPosOrderStatus.php +142 -0
  50. app/code/community/Adyen/Payment/Model/Observer.php +492 -8
  51. app/code/community/Adyen/Payment/Model/Process.php +2 -1146
  52. app/code/community/Adyen/Payment/Model/ProcessNotification.php +1235 -0
  53. app/code/community/Adyen/Payment/Model/ProcessPosResult.php +236 -0
  54. app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Debug.php +7 -3
  55. app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Debug/Collection.php +5 -2
  56. app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Event.php +3 -28
  57. app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Event/Collection.php +3 -2
  58. app/code/community/Adyen/Payment/Model/{Mysql4/Adyen → Resource}/Event/Queue.php +4 -4
  59. app/code/community/Adyen/Payment/Model/{Mysql4/Adyen → Resource}/Event/Queue/Collection.php +4 -3
  60. app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Order.php +4 -2
  61. app/code/community/Adyen/Payment/Model/Resource/Setup.php +32 -0
  62. app/code/community/Adyen/Payment/Model/Sales/Quote/Address/Total/PaymentInstallmentFee.php +1 -2
  63. app/code/community/Adyen/Payment/Model/Source/CancelRedirect.php +38 -0
  64. app/code/community/Adyen/Payment/Model/Source/CcType.php +5 -1
  65. app/code/community/Adyen/Payment/Model/Source/DefaultPaymentMethods.php +0 -42
  66. app/code/community/Adyen/Payment/Model/Source/Rendermode.php +43 -0
  67. app/code/community/Adyen/Payment/Model/Source/Status/Pending.php +31 -0
  68. app/code/community/Adyen/Payment/Model/ValidateResultUrl.php +221 -0
  69. app/code/community/Adyen/Payment/controllers/Adminhtml/ExportAdyenSettingsController.php +12 -14
  70. app/code/community/Adyen/Payment/controllers/Adminhtml/ValidateWebserverSettingsController.php +85 -0
  71. app/code/community/Adyen/Payment/controllers/CheckoutCashController.php +69 -11
  72. app/code/community/Adyen/Payment/controllers/CheckoutPosController.php +183 -34
  73. app/code/community/Adyen/Payment/controllers/GetInstallmentsController.php +2 -2
  74. app/code/community/Adyen/Payment/controllers/ProcessController.php +255 -62
  75. app/code/community/Adyen/Payment/controllers/SavedCardController.php +19 -1
  76. app/code/community/Adyen/Payment/docs/.DS_Store +0 -0
  77. app/code/community/Adyen/Payment/docs/httpauthentication/cgihtaccess.patch +0 -15
  78. app/code/community/Adyen/Payment/docs/httpauthentication/howto +0 -7
  79. app/code/community/Adyen/Payment/docs/readme +0 -221
  80. app/code/community/Adyen/Payment/docs/test-cards +0 -47
  81. app/code/community/Adyen/Payment/docs/translation/Adyen_Payment.csv +0 -53
  82. app/code/community/Adyen/Payment/docs/translation/Mage_Checkout.csv +0 -1
  83. app/code/community/Adyen/Payment/docs/translation/howto +0 -12
  84. app/code/community/Adyen/Payment/etc/config.xml +76 -20
  85. app/code/community/Adyen/Payment/etc/system.xml +368 -31
  86. app/code/community/Adyen/Payment/sql/adyen_setup/mysql4-upgrade-2.2.2-2.2.2.1.php +35 -0
  87. app/design/adminhtml/default/default/template/adyen/form/oneclick.phtml +196 -0
  88. app/design/adminhtml/default/default/template/adyen/form/sepa.phtml +2 -2
  89. app/design/adminhtml/default/default/template/adyen/info/boleto.phtml +9 -5
  90. app/design/adminhtml/default/default/template/adyen/info/cc.phtml +9 -4
  91. app/design/adminhtml/default/default/template/adyen/info/elv.phtml +9 -6
  92. app/design/adminhtml/default/default/template/adyen/info/hpp.phtml +9 -0
  93. app/design/adminhtml/default/default/template/adyen/info/openinvoice.phtml +8 -4
  94. app/design/adminhtml/default/default/template/adyen/info/pay_by_mail.phtml +68 -0
  95. app/design/adminhtml/default/default/template/adyen/info/pos.phtml +9 -4
  96. app/design/adminhtml/default/default/template/adyen/info/sepa.phtml +9 -6
  97. app/design/adminhtml/default/default/template/adyen/pdf/cc.phtml +5 -1
  98. app/design/adminhtml/default/default/template/adyen/system/config/test_webserver_configuration.phtml +64 -0
  99. app/design/frontend/base/default/layout/adyen.xml +10 -8
  100. app/design/frontend/base/default/template/adyen/checkout/onepage/payment/methods.phtml +0 -173
  101. app/design/frontend/base/default/template/adyen/form/cc.phtml +220 -229
  102. app/design/frontend/base/default/template/adyen/form/hpp.phtml +7 -130
  103. app/design/frontend/base/default/template/adyen/form/ideal.phtml +59 -0
  104. app/design/frontend/base/default/template/adyen/form/oneclick.phtml +167 -363
  105. app/design/frontend/base/default/template/adyen/form/openinvoice.phtml +11 -42
  106. app/design/frontend/base/default/template/adyen/form/pos.phtml +16 -0
  107. app/design/frontend/base/default/template/adyen/form/sepa.phtml +7 -7
  108. app/design/frontend/base/default/template/adyen/info/cc.phtml +3 -0
  109. app/design/frontend/base/default/template/adyen/info/pay_by_mail.phtml +31 -0
  110. app/design/frontend/base/default/template/adyen/pos_express_checkout.phtml +133 -17
  111. app/design/frontend/base/default/template/adyen/saved_cards.phtml +68 -15
  112. app/locale/fr_FR/Adyen_Payment.csv +1 -1
  113. app/locale/nl_NL/Adyen_Payment.csv +29 -24
  114. js/adyen/payment/cc.js +1 -1
  115. js/adyen/payment/epos-device-3.0.0.js +5 -0
  116. package.xml +44 -10
  117. skin/frontend/base/default/css/adyenstyle.css +88 -37
  118. skin/frontend/base/default/images/adyen/creditcard.png +0 -0
  119. skin/frontend/base/default/images/adyen/cup.png +0 -0
  120. skin/frontend/base/default/images/adyen/cup_small.png +0 -0
  121. skin/frontend/base/default/images/adyen/dankort.png +0 -0
  122. skin/frontend/base/default/images/adyen/payshop.png +0 -0
  123. skin/frontend/base/default/images/adyen/poli.png +0 -0
app/code/community/Adyen/Payment/.DS_Store CHANGED
Binary file
app/code/community/Adyen/Payment/Block/Adminhtml/Adyen/Event/Queue/Grid.php CHANGED
@@ -44,7 +44,7 @@ class Adyen_Payment_Block_Adminhtml_Adyen_Event_Queue_Grid extends Mage_Adminhtm
44
  */
45
  protected function _prepareCollection()
46
  {
47
- $collection = Mage::getResourceModel('adyen/adyen_event_queue_collection');
48
  $this->setCollection($collection);
49
  if (!$this->getParam($this->getVarNameSort())) {
50
  $collection->setOrder('event_queue_id', 'desc');
44
  */
45
  protected function _prepareCollection()
46
  {
47
+ $collection = Mage::getResourceModel('adyen/event_queue_collection');
48
  $this->setCollection($collection);
49
  if (!$this->getParam($this->getVarNameSort())) {
50
  $collection->setOrder('event_queue_id', 'desc');
app/code/community/Adyen/Payment/Block/Adminhtml/Sales/Order/Renderer/Adyen.php CHANGED
@@ -34,7 +34,6 @@ class Adyen_Payment_Block_Adminhtml_Sales_Order_Renderer_Adyen extends Mage_Admi
34
  return Mage::helper('adyen')->__('N.A');
35
  default:
36
  return $status;
37
- break;
38
  }
39
  }
40
 
34
  return Mage::helper('adyen')->__('N.A');
35
  default:
36
  return $status;
 
37
  }
38
  }
39
 
app/code/community/Adyen/Payment/Block/Adminhtml/System/Config/TestWebserverConfiguration.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Block_Adminhtml_System_Config_TestWebserverConfiguration extends Mage_Adminhtml_Block_System_Config_Form_Field
29
+ {
30
+
31
+ /**
32
+ * @var string
33
+ */
34
+ protected $_wizardTemplate = 'adyen/system/config/test_webserver_configuration.phtml';
35
+
36
+ /**
37
+ * Set template to itself
38
+ */
39
+ protected function _prepareLayout()
40
+ {
41
+ parent::_prepareLayout();
42
+ if (!$this->getTemplate()) {
43
+ $this->setTemplate($this->_wizardTemplate);
44
+ }
45
+ return $this;
46
+ }
47
+
48
+ /**
49
+ * Unset some non-related element parameters
50
+ *
51
+ * @param Varien_Data_Form_Element_Abstract $element
52
+ * @return string
53
+ */
54
+ public function render(Varien_Data_Form_Element_Abstract $element)
55
+ {
56
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
57
+ return parent::render($element);
58
+ }
59
+
60
+ /**
61
+ * Get the button and scripts contents
62
+ *
63
+ * @param Varien_Data_Form_Element_Abstract $element
64
+ * @return string
65
+ */
66
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
67
+ {
68
+ $originalData = $element->getOriginalData();
69
+ $elementHtmlId = $element->getHtmlId();
70
+ $this->addData(array_merge(
71
+ $this->_getButtonData($elementHtmlId, $originalData)
72
+ ));
73
+ return $this->_toHtml();
74
+ }
75
+
76
+ /**
77
+ * Prepare button data
78
+ *
79
+ * @param string $elementHtmlId
80
+ * @param array $originalData
81
+ * @return array
82
+ */
83
+ protected function _getButtonData($elementHtmlId, $originalData)
84
+ {
85
+ return array(
86
+ 'button_label' => Mage::helper('adyen')->__($originalData['button_label']),
87
+ 'modus' => $originalData['modus'],
88
+ 'html_id' => $elementHtmlId,
89
+ 'url_webserver_validation' => Mage::helper('adminhtml')->getUrl('adminhtml/ValidateWebserverSettings')
90
+ );
91
+ }
92
+
93
+
94
+
95
+ }
app/code/community/Adyen/Payment/Block/Checkout/Success.php CHANGED
@@ -37,7 +37,7 @@ class Adyen_Payment_Block_Checkout_Success extends Mage_Checkout_Block_Onepage_S
37
  {
38
  $this->order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
39
 
40
- if ($this->order->getPayment()->getMethod() == "adyen_boleto")
41
  return true;
42
 
43
  return false;
@@ -61,5 +61,3 @@ class Adyen_Payment_Block_Checkout_Success extends Mage_Checkout_Block_Onepage_S
61
  }
62
 
63
  }
64
-
65
- ?>
37
  {
38
  $this->order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
39
 
40
+ if ($this->order->getPayment() && $this->order->getPayment()->getMethod() == "adyen_boleto")
41
  return true;
42
 
43
  return false;
61
  }
62
 
63
  }
 
 
app/code/community/Adyen/Payment/Block/Form/Boleto.php CHANGED
@@ -27,22 +27,36 @@
27
  */
28
  class Adyen_Payment_Block_Form_Boleto extends Mage_Payment_Block_Form {
29
 
30
- protected function _construct() {
31
- $paymentMethodIcon = $this->getSkinUrl('images/adyen/img_trans.gif');
32
- $label = Mage::helper('adyen')->_getConfigData("title", "adyen_boleto");
 
 
 
 
 
 
 
33
 
34
- $mark = Mage::getConfig()->getBlockClassName('core/template');
35
- $mark = new $mark;
36
- $mark->setTemplate('adyen/payment/payment_method_label.phtml')
37
- ->setPaymentMethodIcon($paymentMethodIcon)
38
- ->setPaymentMethodLabel($label)
39
- ->setPaymentMethodClass("adyen_boleto");
40
 
41
- $this->setTemplate('adyen/form/boleto.phtml')
42
- ->setMethodTitle('')
43
- ->setMethodLabelAfterHtml($mark->toHtml());
 
 
 
 
44
 
45
- parent::_construct();
 
 
 
46
  }
47
 
48
  /**
27
  */
28
  class Adyen_Payment_Block_Form_Boleto extends Mage_Payment_Block_Form {
29
 
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ $this->setTemplate('adyen/form/boleto.phtml');
34
+
35
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
36
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
37
+ $this->setMethodTitle('');
38
+ }
39
+ }
40
 
41
+ public function getMethodLabelAfterHtml()
42
+ {
43
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
44
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
45
+ return '';
46
+ }
47
 
48
+ if (! $this->hasData('_method_label_html')) {
49
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
50
+ 'template' => 'adyen/payment/payment_method_label.phtml',
51
+ 'payment_method_icon' => $this->getSkinUrl('images/adyen/img_trans.gif'),
52
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
53
+ 'payment_method_class' => $this->getMethod()->getCode()
54
+ ));
55
 
56
+ $this->setData('_method_label_html', $labelBlock->toHtml());
57
+ }
58
+
59
+ return $this->getData('_method_label_html');
60
  }
61
 
62
  /**
app/code/community/Adyen/Payment/Block/Form/Cash.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Block_Form_Cash extends Mage_Payment_Block_Form {
29
+
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ // $this->setTemplate('adyen/form/cash.phtml');
34
+
35
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
36
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
37
+ $this->setMethodTitle('');
38
+ }
39
+ }
40
+
41
+ public function getMethodLabelAfterHtml()
42
+ {
43
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
44
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
45
+ return '';
46
+ }
47
+
48
+ if (! $this->hasData('_method_label_html')) {
49
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
50
+ 'template' => 'adyen/payment/payment_method_label.phtml',
51
+ 'payment_method_icon' => $this->getSkinUrl('images/adyen/c_cash.png'),
52
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
53
+ 'payment_method_class' => $this->getMethod()->getCode()
54
+ ));
55
+
56
+ $this->setData('_method_label_html', $labelBlock->toHtml());
57
+ }
58
+
59
+ return $this->getData('_method_label_html');
60
+ }
61
+ }
app/code/community/Adyen/Payment/Block/Form/Cc.php CHANGED
@@ -25,24 +25,46 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Block_Form_Cc extends Mage_Payment_Block_Form_Cc {
 
29
 
30
- protected function _construct() {
 
31
  parent::_construct();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- $paymentMethodIcon = $this->getSkinUrl('images/adyen/img_trans.gif');
34
- $label = Mage::helper('adyen')->_getConfigData("title", "adyen_cc");
 
 
 
 
35
 
36
- $mark = Mage::getConfig()->getBlockClassName('core/template');
37
- $mark = new $mark;
38
- $mark->setTemplate('adyen/payment/payment_method_label.phtml')
39
- ->setPaymentMethodIcon($paymentMethodIcon)
40
- ->setPaymentMethodLabel($label)
41
- ->setPaymentMethodClass("adyen_cc");
42
 
43
- $this->setTemplate('adyen/form/cc.phtml')
44
- ->setMethodTitle('')
45
- ->setMethodLabelAfterHtml($mark->toHtml());
46
  }
47
 
48
  /**
@@ -69,8 +91,8 @@ class Adyen_Payment_Block_Form_Cc extends Mage_Payment_Block_Form_Cc {
69
  return Mage::helper('adyen/installments')->isInstallmentsEnabled();
70
  }
71
 
72
- public function getRecurringType() {
73
- return $this->getMethod()->getRecurringType();
74
  }
75
 
76
  /**
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Block_Form_Cc extends Mage_Payment_Block_Form_Cc
29
+ {
30
 
31
+ protected function _construct()
32
+ {
33
  parent::_construct();
34
+ $this->setTemplate('adyen/form/cc.phtml');
35
+
36
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
37
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
38
+ $this->setMethodTitle('');
39
+ }
40
+ }
41
+
42
+ public function getMethodLabelAfterHtml()
43
+ {
44
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
45
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
46
+ return '';
47
+ }
48
+
49
+ if (! $this->hasData('_method_label_html')) {
50
+ $imgFileName = 'creditcard';
51
+ $result = Mage::getDesign()->getFilename("images/adyen/{$imgFileName}.png", array('_type' => 'skin'));
52
+
53
+ $imageUrl = file_exists($result)
54
+ ? $this->getSkinUrl("images/adyen/{$imgFileName}.png")
55
+ : $this->getSkinUrl("images/adyen/img_trans.gif");
56
 
57
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
58
+ 'template' => 'adyen/payment/payment_method_label.phtml',
59
+ 'payment_method_icon' => $imageUrl,
60
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
61
+ 'payment_method_class' => $this->getMethod()->getCode()
62
+ ));
63
 
64
+ $this->setData('_method_label_html', $labelBlock->toHtml());
65
+ }
 
 
 
 
66
 
67
+ return $this->getData('_method_label_html');
 
 
68
  }
69
 
70
  /**
91
  return Mage::helper('adyen/installments')->isInstallmentsEnabled();
92
  }
93
 
94
+ public function showRememberThisCheckoutbox() {
95
+ return $this->getMethod()->showRememberThisCheckoutbox();
96
  }
97
 
98
  /**
app/code/community/Adyen/Payment/Block/Form/Elv.php CHANGED
@@ -27,22 +27,35 @@
27
  */
28
  class Adyen_Payment_Block_Form_Elv extends Mage_Payment_Block_Form {
29
 
30
- protected function _construct() {
31
- $paymentMethodIcon = $this->getSkinUrl('images/adyen/img_trans.gif');
32
- $label = Mage::helper('adyen')->_getConfigData("title", "adyen_elv");
 
33
 
34
- $mark = Mage::getConfig()->getBlockClassName('core/template');
35
- $mark = new $mark;
36
- $mark->setTemplate('adyen/payment/payment_method_label.phtml')
37
- ->setPaymentMethodIcon($paymentMethodIcon)
38
- ->setPaymentMethodLabel($label)
39
- ->setPaymentMethodClass("adyen_elv");
40
 
41
- $this->setTemplate('adyen/form/elv.phtml')
42
- ->setMethodTitle('')
43
- ->setMethodLabelAfterHtml($mark->toHtml());
 
 
 
44
 
45
- parent::_construct();
46
- }
 
 
 
 
 
 
 
 
47
 
 
 
48
  }
27
  */
28
  class Adyen_Payment_Block_Form_Elv extends Mage_Payment_Block_Form {
29
 
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ $this->setTemplate('adyen/form/elv.phtml');
34
 
35
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
36
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
37
+ $this->setMethodTitle('');
38
+ }
39
+ }
 
40
 
41
+ public function getMethodLabelAfterHtml()
42
+ {
43
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
44
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
45
+ return '';
46
+ }
47
 
48
+ if (! $this->hasData('_method_label_html')) {
49
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
50
+ 'template' => 'adyen/payment/payment_method_label.phtml',
51
+ 'payment_method_icon' => $this->getSkinUrl('images/adyen/img_trans.gif'),
52
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
53
+ 'payment_method_class' => $this->getMethod()->getCode()
54
+ ));
55
+
56
+ $this->setData('_method_label_html', $labelBlock->toHtml());
57
+ }
58
 
59
+ return $this->getData('_method_label_html');
60
+ }
61
  }
app/code/community/Adyen/Payment/Block/Form/Hpp.php CHANGED
@@ -28,28 +28,49 @@
28
  class Adyen_Payment_Block_Form_Hpp extends Mage_Payment_Block_Form {
29
 
30
  protected function _construct() {
31
- $this->setTemplate('adyen/form/hpp.phtml');
32
  parent::_construct();
 
 
 
 
 
 
33
  }
34
 
35
- /**
36
- * Retrieve available payment methods
37
- *
38
- * @return array
39
- */
40
- public function getHppAvailableTypes() {
41
- return $this->getMethod()->getAvailableHPPTypes();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
 
44
  /**
45
  * @since 0.1.0.4
46
  * @return type
47
  */
48
- public function getHppOptionsDisabled() {
 
49
  return $this->getMethod()->getHppOptionsDisabled();
50
  }
51
-
52
- public function getShowIdealLogos() {
53
- return $this->getMethod()->getShowIdealLogos();
54
- }
55
- }
28
  class Adyen_Payment_Block_Form_Hpp extends Mage_Payment_Block_Form {
29
 
30
  protected function _construct() {
 
31
  parent::_construct();
32
+ $this->setTemplate('adyen/form/hpp.phtml');
33
+
34
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
35
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
36
+ $this->setMethodTitle('');
37
+ }
38
  }
39
 
40
+ public function getMethodLabelAfterHtml()
41
+ {
42
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
43
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
44
+ return '';
45
+ }
46
+
47
+ if (! $this->hasData('_method_label_html')) {
48
+ $imgFileName = substr($this->getMethod()->getCode(), 10);
49
+ $result = Mage::getDesign()->getFilename("images/adyen/{$imgFileName}.png", array('_type' => 'skin'));
50
+
51
+ $imageUrl = file_exists($result)
52
+ ? $this->getSkinUrl("images/adyen/{$imgFileName}.png")
53
+ : $this->getSkinUrl("images/adyen/img_trans.gif");
54
+
55
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
56
+ 'template' => 'adyen/payment/payment_method_label.phtml',
57
+ 'payment_method_icon' => $imageUrl,
58
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
59
+ 'payment_method_class' => $this->getMethod()->getCode()
60
+ ));
61
+
62
+ $this->setData('_method_label_html', $labelBlock->toHtml());
63
+ }
64
+
65
+ return $this->getData('_method_label_html');
66
  }
67
 
68
  /**
69
  * @since 0.1.0.4
70
  * @return type
71
  */
72
+ public function getHppOptionsDisabled()
73
+ {
74
  return $this->getMethod()->getHppOptionsDisabled();
75
  }
76
+ }
 
 
 
 
app/code/community/Adyen/Payment/Block/Form/Ideal.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+
29
+
30
+
31
+ /**
32
+ * Class Adyen_Payment_Block_Form_Ideal
33
+ * @method Adyen_Payment_Model_Adyen_Ideal getMethod()
34
+ */
35
+ class Adyen_Payment_Block_Form_Ideal extends Adyen_Payment_Block_Form_Hpp {
36
+
37
+ protected function _construct()
38
+ {
39
+ parent::_construct();
40
+ $this->setTemplate('adyen/form/ideal.phtml');
41
+ }
42
+
43
+ public function getShowIdealLogos()
44
+ {
45
+ return $this->getMethod()->getShowIdealLogos();
46
+ }
47
+
48
+ public function getIssuers()
49
+ {
50
+ return $this->getMethod()->getIssuers();
51
+ }
52
+
53
+ public function getIssuerImageUrl($issuer) {
54
+ $_bankFile = strtoupper(str_replace(" ", '', $issuer['label']));
55
+ return $this->getSkinUrl('images'.DS.'adyen'.DS. $_bankFile . ".png");
56
+ }
57
+ }
app/code/community/Adyen/Payment/Block/Form/Oneclick.php CHANGED
@@ -32,6 +32,44 @@ class Adyen_Payment_Block_Form_Oneclick extends Adyen_Payment_Block_Form_Cc {
32
  $this->setTemplate('adyen/form/oneclick.phtml');
33
  }
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  public function getlistRecurringDetails() {
36
  return $this->getMethod()->getlistRecurringDetails();
37
  }
@@ -40,13 +78,22 @@ class Adyen_Payment_Block_Form_Oneclick extends Adyen_Payment_Block_Form_Cc {
40
  return $this->getMethod()->isNotRecurring();
41
  }
42
 
43
- public function getInstallmentForCreditCardType($ccType) {
44
-
45
- // map $ccType to creditcard type we saved in backend
46
-
47
  $ccType = Mage::helper('adyen/data')->getMagentoCreditCartType($ccType);
48
  $result = Mage::helper('adyen/installments')->getInstallmentForCreditCardType($ccType);
49
-
50
  return $result;
51
  }
 
 
 
 
 
 
 
 
 
 
52
  }
32
  $this->setTemplate('adyen/form/oneclick.phtml');
33
  }
34
 
35
+ public function getMethodLabelAfterHtml()
36
+ {
37
+ $adyenHelper = Mage::helper('adyen');
38
+
39
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
40
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
41
+ return '';
42
+ }
43
+
44
+ if (! $this->hasData('_method_label_html')) {
45
+ $imgFileName = substr($this->getMethod()->getCode(), 10);
46
+
47
+ // get configuration of this specific payment method
48
+ $methodCode = $this->getMethodCode();
49
+
50
+ $varient = $adyenHelper->_getConfigData('variant', $methodCode);
51
+ $last4digits = $adyenHelper->_getConfigData('card_number', $methodCode);
52
+
53
+ $result = Mage::getDesign()->getFilename("images/adyen/{$varient}.png", array('_type' => 'skin'));
54
+
55
+ $imageUrl = file_exists($result)
56
+ ? $this->getSkinUrl("images/adyen/{$varient}.png")
57
+ : $this->getSkinUrl("images/adyen/img_trans.gif");
58
+
59
+
60
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
61
+ 'template' => 'adyen/payment/payment_method_label.phtml',
62
+ 'payment_method_icon' => $imageUrl,
63
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
64
+ 'payment_method_class' => $this->getMethod()->getCode()
65
+ ));
66
+
67
+ $this->setData('_method_label_html', $labelBlock->toHtml());
68
+ }
69
+
70
+ return $this->getData('_method_label_html');
71
+ }
72
+
73
  public function getlistRecurringDetails() {
74
  return $this->getMethod()->getlistRecurringDetails();
75
  }
78
  return $this->getMethod()->isNotRecurring();
79
  }
80
 
81
+ public function getInstallments() {
82
+ $adyenHelper = Mage::helper('adyen');
83
+ $methodCode = $this->getMethodCode();
84
+ $ccType = $adyenHelper->_getConfigData('variant', $methodCode);
85
  $ccType = Mage::helper('adyen/data')->getMagentoCreditCartType($ccType);
86
  $result = Mage::helper('adyen/installments')->getInstallmentForCreditCardType($ccType);
 
87
  return $result;
88
  }
89
+
90
+ public function getRecurringDetails() {
91
+ if(Mage::app()->getStore()->isAdmin()) {
92
+ $storeId = Mage::getSingleton('adminhtml/session_quote')->getStoreId();
93
+ } else {
94
+ $storeId = Mage::app()->getStore()->getStoreId();
95
+ }
96
+ $recurringDetails = Mage::getStoreConfig("payment/".$this->getMethodCode(), $storeId);
97
+ return $recurringDetails;
98
+ }
99
  }
app/code/community/Adyen/Payment/Block/Form/Openinvoice.php CHANGED
@@ -36,24 +36,17 @@ class Adyen_Payment_Block_Form_Openinvoice extends Mage_Payment_Block_Form {
36
  */
37
  protected $_address;
38
 
39
- protected function _construct() {
40
- $paymentMethodIcon = $this->getSkinUrl('images/adyen/img_trans.gif');
41
- $label = Mage::helper('adyen')->_getConfigData("title", "adyen_openinvoice");
42
- // check if klarna or afterpay is selected for showing correct logo
43
- $openinvoiceType = Mage::helper('adyen')->_getConfigData("openinvoicetypes", "adyen_openinvoice");
44
-
45
- $mark = Mage::getConfig()->getBlockClassName('core/template');
46
- $mark = new $mark;
47
- $mark->setTemplate('adyen/payment/payment_method_label.phtml')
48
- ->setPaymentMethodIcon($paymentMethodIcon)
49
- ->setPaymentMethodLabel($label)
50
- ->setPaymentMethodClass("adyen_openinvoice_" . $openinvoiceType);
51
-
52
- $this->setTemplate('adyen/form/openinvoice.phtml')
53
- ->setMethodTitle('')
54
- ->setMethodLabelAfterHtml($mark->toHtml());
55
-
56
- /* Check if the customer is logged in or not */
57
  if (Mage::getSingleton('customer/session')->isLoggedIn()) {
58
 
59
  /* Get the customer data */
@@ -63,8 +56,29 @@ class Adyen_Payment_Block_Form_Openinvoice extends Mage_Payment_Block_Form {
63
  $this->setDate($customer->getDob());
64
  $this->setGender($customer->getGender());
65
  }
 
66
 
67
- parent::_construct();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
69
 
70
 
36
  */
37
  protected $_address;
38
 
39
+ protected function _construct()
40
+ {
41
+ parent::_construct();
42
+ $this->setTemplate('adyen/form/openinvoice.phtml');
43
+
44
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
45
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
46
+ $this->setMethodTitle('');
47
+ }
48
+
49
+ /* Check if the customer is logged in or not */
 
 
 
 
 
 
 
50
  if (Mage::getSingleton('customer/session')->isLoggedIn()) {
51
 
52
  /* Get the customer data */
56
  $this->setDate($customer->getDob());
57
  $this->setGender($customer->getGender());
58
  }
59
+ }
60
 
61
+ public function getMethodLabelAfterHtml()
62
+ {
63
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
64
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
65
+ return '';
66
+ }
67
+
68
+ if (! $this->hasData('_method_label_html')) {
69
+ $openinvoiceType = Mage::helper('adyen')->_getConfigData("openinvoicetypes", "adyen_openinvoice");
70
+
71
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
72
+ 'template' => 'adyen/payment/payment_method_label.phtml',
73
+ 'payment_method_icon' => $this->getSkinUrl('images/adyen/img_trans.gif'),
74
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
75
+ 'payment_method_class' => 'adyen_openinvoice_' . $openinvoiceType
76
+ ));
77
+
78
+ $this->setData('_method_label_html', $labelBlock->toHtml());
79
+ }
80
+
81
+ return $this->getData('_method_label_html');
82
  }
83
 
84
 
app/code/community/Adyen/Payment/Block/Form/PayByMail.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Block_Form_PayByMail extends Mage_Payment_Block_Form {
29
+
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ // $this->setTemplate('adyen/form/cash.phtml');
34
+
35
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
36
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
37
+ $this->setMethodTitle('');
38
+ }
39
+ }
40
+
41
+ public function getMethodLabelAfterHtml()
42
+ {
43
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
44
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
45
+ return '';
46
+ }
47
+
48
+ if (! $this->hasData('_method_label_html')) {
49
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
50
+ 'template' => 'adyen/payment/payment_method_label.phtml',
51
+ 'payment_method_icon' => $this->getSkinUrl('images/adyen/sendEmail.png'),
52
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
53
+ 'payment_method_class' => $this->getMethod()->getCode()
54
+ ));
55
+
56
+ $this->setData('_method_label_html', $labelBlock->toHtml());
57
+ }
58
+
59
+ return $this->getData('_method_label_html');
60
+ }
61
+ }
app/code/community/Adyen/Payment/Block/Form/Pos.php CHANGED
@@ -27,21 +27,39 @@
27
  */
28
  class Adyen_Payment_Block_Form_Pos extends Mage_Payment_Block_Form {
29
 
30
- protected function _construct() {
31
- $paymentMethodIcon = $this->getSkinUrl('images/adyen/img_trans.gif');
32
- $label = Mage::helper('adyen')->_getConfigData("title", "adyen_pos");
 
 
 
 
 
 
 
33
 
34
- $mark = Mage::getConfig()->getBlockClassName('core/template');
35
- $mark = new $mark;
36
- $mark->setTemplate('adyen/payment/payment_method_label.phtml')
37
- ->setPaymentMethodIcon($paymentMethodIcon)
38
- ->setPaymentMethodLabel($label)
39
- ->setPaymentMethodClass("adyen_pos");
40
 
41
- $this->setTemplate('adyen/form/pos.phtml')
42
- ->setMethodTitle('')
43
- ->setMethodLabelAfterHtml($mark->toHtml());
 
 
 
 
44
 
45
- parent::_construct();
 
 
 
 
 
 
 
46
  }
47
  }
27
  */
28
  class Adyen_Payment_Block_Form_Pos extends Mage_Payment_Block_Form {
29
 
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ $this->setTemplate('adyen/form/pos.phtml');
34
+
35
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
36
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
37
+ $this->setMethodTitle('');
38
+ }
39
+ }
40
 
41
+ public function getMethodLabelAfterHtml()
42
+ {
43
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
44
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
45
+ return '';
46
+ }
47
 
48
+ if (! $this->hasData('_method_label_html')) {
49
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
50
+ 'template' => 'adyen/payment/payment_method_label.phtml',
51
+ 'payment_method_icon' => $this->getSkinUrl('images/adyen/img_trans.gif'),
52
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
53
+ 'payment_method_class' => $this->getMethod()->getCode()
54
+ ));
55
 
56
+ $this->setData('_method_label_html', $labelBlock->toHtml());
57
+ }
58
+
59
+ return $this->getData('_method_label_html');
60
+ }
61
+
62
+ public function showRememberThisCheckoutbox() {
63
+ return $this->getMethod()->showRememberThisCheckoutbox();
64
  }
65
  }
app/code/community/Adyen/Payment/Block/Form/Sepa.php CHANGED
@@ -13,11 +13,14 @@
13
  * obtain it through the world-wide-web, please send an email
14
  * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
- * @category Adyen
17
- * @package Adyen_Payment
18
- * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
 
 
 
21
  /**
22
  * @category Payment Gateway
23
  * @package Adyen_Payment
@@ -25,65 +28,118 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Block_Form_Sepa extends Mage_Payment_Block_Form {
 
29
 
30
- protected function _construct() {
31
- $paymentMethodIcon = $this->getSkinUrl('images/adyen/img_trans.gif');
32
- $label = Mage::helper('adyen')->_getConfigData("title", "adyen_sepa");
 
33
 
34
- $mark = Mage::getConfig()->getBlockClassName('core/template');
35
- $mark = new $mark;
36
- $mark->setTemplate('adyen/payment/payment_method_label.phtml')
37
- ->setPaymentMethodIcon($paymentMethodIcon)
38
- ->setPaymentMethodLabel($label)
39
- ->setPaymentMethodClass("adyen_sepa");
40
 
41
- $this->setTemplate('adyen/form/sepa.phtml')
42
- ->setMethodTitle('')
43
- ->setMethodLabelAfterHtml($mark->toHtml());
 
 
 
44
 
45
- parent::_construct();
46
- }
 
 
 
 
 
47
 
 
 
48
 
49
- public function getCountries() {
 
50
 
51
- $sepaCountriesAllowed = array("AT", "BE", "BG", "CH", "CY","CZ","DE","DK","EE","ES","FI","FR",
52
- "GB","GF","GI","GP","GR","HR","HU","IE","IS","IT","LI","LT","LU",
53
- "LV","MC","MQ","MT","NL","NO","PL","PT","RE","RO","SE","SI","SK");
54
 
55
- $countryList = Mage::getResourceModel('directory/country_collection')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  ->loadData()
57
  ->toOptionArray(false);
58
-
59
  $sepaCountries = array();
60
-
61
- foreach($countryList as $key => $country) {
62
-
63
  $value = $country['value'];
64
- if(!in_array($value, $sepaCountriesAllowed)) {
65
  unset($countryList[$key]);
66
  }
67
  }
68
  return $countryList;
69
  }
70
 
71
- public function getShopperCountryId() {
 
 
72
  $country = "";
73
- if(Mage::app()->getStore()->isAdmin())
74
- {
75
  $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
76
  } else {
77
  $quote = Mage::helper('checkout/cart')->getQuote();
78
  }
79
-
80
- if($quote) {
81
  $billingAddress = $quote->getBillingAddress();
82
- if($billingAddress) {
83
  $country = $billingAddress->getCountryId();
84
  }
85
  }
86
  return $country;
87
  }
88
 
 
 
 
 
 
89
  }
13
  * obtain it through the world-wide-web, please send an email
14
  * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+
22
+
23
+
24
  /**
25
  * @category Payment Gateway
26
  * @package Adyen_Payment
28
  * @property Adyen B.V
29
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
30
  */
31
+ class Adyen_Payment_Block_Form_Sepa extends Mage_Payment_Block_Form
32
+ {
33
 
34
+ protected function _construct()
35
+ {
36
+ parent::_construct();
37
+ $this->setTemplate('adyen/form/sepa.phtml');
38
 
39
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
40
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE_IMAGE) {
41
+ $this->setMethodTitle('');
42
+ }
43
+ }
 
44
 
45
+ public function getMethodLabelAfterHtml()
46
+ {
47
+ if (Mage::getStoreConfig('payment/adyen_abstract/title_renderer')
48
+ == Adyen_Payment_Model_Source_Rendermode::MODE_TITLE) {
49
+ return '';
50
+ }
51
 
52
+ if (! $this->hasData('_method_label_html')) {
53
+ $labelBlock = Mage::app()->getLayout()->createBlock('core/template', null, array(
54
+ 'template' => 'adyen/payment/payment_method_label.phtml',
55
+ 'payment_method_icon' => $this->getSkinUrl('images/adyen/img_trans.gif'),
56
+ 'payment_method_label' => Mage::helper('adyen')->getConfigData('title', $this->getMethod()->getCode()),
57
+ 'payment_method_class' => $this->getMethod()->getCode()
58
+ ));
59
 
60
+ $this->setData('_method_label_html', $labelBlock->toHtml());
61
+ }
62
 
63
+ return $this->getData('_method_label_html');
64
+ }
65
 
 
 
 
66
 
67
+ public function getCountries()
68
+ {
69
+ $sepaCountriesAllowed = array(
70
+ "AT",
71
+ "BE",
72
+ "BG",
73
+ "CH",
74
+ "CY",
75
+ "CZ",
76
+ "DE",
77
+ "DK",
78
+ "EE",
79
+ "ES",
80
+ "FI",
81
+ "FR",
82
+ "GB",
83
+ "GF",
84
+ "GI",
85
+ "GP",
86
+ "GR",
87
+ "HR",
88
+ "HU",
89
+ "IE",
90
+ "IS",
91
+ "IT",
92
+ "LI",
93
+ "LT",
94
+ "LU",
95
+ "LV",
96
+ "MC",
97
+ "MQ",
98
+ "MT",
99
+ "NL",
100
+ "NO",
101
+ "PL",
102
+ "PT",
103
+ "RE",
104
+ "RO",
105
+ "SE",
106
+ "SI",
107
+ "SK"
108
+ );
109
+ $countryList = Mage::getResourceModel('directory/country_collection')
110
  ->loadData()
111
  ->toOptionArray(false);
 
112
  $sepaCountries = array();
113
+ foreach ($countryList as $key => $country) {
 
 
114
  $value = $country['value'];
115
+ if (!in_array($value, $sepaCountriesAllowed)) {
116
  unset($countryList[$key]);
117
  }
118
  }
119
  return $countryList;
120
  }
121
 
122
+
123
+ public function getShopperCountryId()
124
+ {
125
  $country = "";
126
+ if (Mage::app()->getStore()->isAdmin()) {
 
127
  $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
128
  } else {
129
  $quote = Mage::helper('checkout/cart')->getQuote();
130
  }
131
+ if ($quote) {
 
132
  $billingAddress = $quote->getBillingAddress();
133
+ if ($billingAddress) {
134
  $country = $billingAddress->getCountryId();
135
  }
136
  }
137
  return $country;
138
  }
139
 
140
+
141
+ public function getBillingAgreements()
142
+ {
143
+ return $this->getMethod()->getBillingAgreementCollection();
144
+ }
145
  }
app/code/community/Adyen/Payment/{Model/Mysql4/Setup.php → Block/Info/Cash.php} RENAMED
@@ -25,6 +25,6 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup {
29
-
30
- }
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Block_Info_Cash extends Mage_Payment_Block_Info {
29
+
30
+ }
app/code/community/Adyen/Payment/Block/Info/Cc.php CHANGED
@@ -44,4 +44,8 @@ class Adyen_Payment_Block_Info_Cc extends Mage_Payment_Block_Info_Cc {
44
  return $this->toHtml();
45
  }
46
 
 
 
 
 
47
  }
44
  return $this->toHtml();
45
  }
46
 
47
+ public function hasInstallments(){
48
+ return Mage::helper('adyen/installments')->isInstallmentsEnabled();
49
+ }
50
+
51
  }
app/code/community/Adyen/Payment/Block/Info/PayByMail.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Block_Info_PayByMail extends Mage_Payment_Block_Info {
29
+
30
+ /**
31
+ * Init default template for block
32
+ */
33
+ protected function _construct() {
34
+ parent::_construct();
35
+ $this->setTemplate('adyen/info/pay_by_mail.phtml');
36
+ }
37
+
38
+
39
+ /**
40
+ * @desc check if the block is loaded in the checkout
41
+ * @return bool
42
+ */
43
+ public function inCheckout() {
44
+ $storeId = Mage::app()->getStore()->getStoreId();
45
+
46
+ $quote = (Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();
47
+
48
+ if($quote->getIsActive())
49
+ {
50
+ return true;
51
+ }
52
+ return false;
53
+ }
54
+ //
55
+ // public function toPdf() {
56
+ // $this->setTemplate('adyen/pdf/cash.phtml');
57
+ // return $this->toHtml();
58
+ // }
59
+ }
app/code/community/Adyen/Payment/Block/PosExpressCheckout.php CHANGED
@@ -38,6 +38,14 @@ class Adyen_Payment_Block_PosExpressCheckout extends Mage_Core_Block_Template
38
  }
39
  }
40
 
 
 
 
 
 
 
 
 
41
  public function hasCashExpressCheckout()
42
  {
43
  // must be login to show this checkout option
@@ -48,4 +56,33 @@ class Adyen_Payment_Block_PosExpressCheckout extends Mage_Core_Block_Template
48
  }
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
38
  }
39
  }
40
 
41
+ public function getExpressCheckoutTitle() {
42
+ return Mage::helper('adyen')->getConfigData("title", "adyen_pos", null);
43
+ }
44
+
45
+ public function getEmailAddressShopper() {
46
+ return Mage::getSingleton('checkout/session')->getAdyenEmailShopper();
47
+ }
48
+
49
  public function hasCashExpressCheckout()
50
  {
51
  // must be login to show this checkout option
56
  }
57
  }
58
 
59
+ public function getCashExpressCheckoutTitle() {
60
+ return Mage::helper('adyen')->getConfigData("title", "adyen_cash", null);
61
+ }
62
+
63
+ public function inKioskMode()
64
+ {
65
+ return Mage::helper('adyen')->getConfigData("express_checkout_kiosk_mode", "adyen_pos", null);
66
+ }
67
+
68
+ public function showExpressCheckoutRecurringCards() {
69
+ return Mage::helper('adyen')->getConfigData("express_checkout_recurring", "adyen_pos", null);
70
+ }
71
+
72
+ public function enabledCashDrawer() {
73
+ return Mage::helper('adyen')->getConfigData("cash_drawer", "adyen_cash", null);
74
+ }
75
+
76
+ public function getCashDrawerPrinterIp() {
77
+ return Mage::helper('adyen')->getConfigData("cash_drawer_printer_ip", "adyen_cash", null);
78
+ }
79
+
80
+ public function getCashDrawerPrinterPort() {
81
+ return Mage::helper('adyen')->_getConfigData("cash_drawer_printer_port", "adyen_pos", null);
82
+ }
83
+
84
+ public function getCashDrawerPrinterDeviceId() {
85
+ return Mage::helper('adyen')->_getConfigData("cash_drawer_printer_device_id", "adyen_pos", null);
86
+ }
87
+
88
  }
app/code/community/Adyen/Payment/Block/Redirect.php CHANGED
@@ -27,6 +27,13 @@
27
  */
28
  class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
29
 
 
 
 
 
 
 
 
30
  protected function _getCheckout() {
31
  return Mage::getSingleton('checkout/session');
32
  }
@@ -43,14 +50,15 @@ class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
43
 
44
  protected function _toHtml() {
45
 
46
- $paymentObject = $this->_getOrder()->getPayment();
47
- $payment = $this->_getOrder()->getPayment()->getMethodInstance();
 
48
 
49
  $html = '<html><head><link rel="stylesheet" type="text/css" href="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/frontend/base/default/css/adyenstyle.css"><script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>';
50
 
51
  // for cash add epson libary to open the cash drawer
52
- $cashDrawer = Mage::helper('adyen')->_getConfigData("cash_drawer", "adyen_pos", null);
53
- if($payment->getCode() == "adyen_hpp" && $paymentObject->getCcType() == "c_cash" && $cashDrawer) {
54
  $jsPath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
55
  $html .= '<script src="'.$jsPath.'adyen/payment/epos-device-2.6.0.js"></script>';
56
  }
@@ -65,8 +73,12 @@ class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
65
  $url = urlencode(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true)."adyen/process/successPos");
66
 
67
  // detect ios or android
68
- $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
69
- $android = stripos($ua,'android');
 
 
 
 
70
 
71
  // extra parameters so that you alway's return these paramters from the application
72
  $extra_paramaters = urlencode("/?originalCustomCurrency=".$adyFields['currencyCode']."&originalCustomAmount=".$adyFields['paymentAmount']. "&originalCustomMerchantReference=".$adyFields['merchantReference'] . "&originalCustomSessionId=".session_id());
@@ -78,17 +90,23 @@ class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
78
  $recurring_parameters = "&recurringContract=".urlencode($adyFields['recurringContract'])."&shopperReference=".urlencode($adyFields['shopperReference']). "&shopperEmail=".urlencode($adyFields['shopperEmail']);
79
  }
80
 
81
- // important url must be the latest parameter before extra parameters! otherwise extra parameters won't return in return url
82
- if($android !== false) { // && stripos($ua,'mobile') !== false) {
83
- // watch out some attributes are different from ios (sessionid and callback_automatic) added start_immediately
84
- $launchlink = "adyen://www.adyen.com/?sessionid=".date('U')."&amount=".$adyFields['paymentAmount']."&currency=".$adyFields['currencyCode']."&description=".$adyFields['merchantReference']. $recurring_parameters . "&start_immediately=1&callback_automatic=1&callback=".$url .$extra_paramaters;
85
- } else {
86
- //$launchlink = "adyen://payment?currency=".$adyFields['currencyCode']."&amount=".$adyFields['paymentAmount']."&description=".$adyFields['merchantReference']."&callback=".$url."&sessionId=".session_id()."&callbackAutomatic=1".$extra_paramaters;
87
- $launchlink = "adyen://payment?sessionId=".session_id()."&amount=".$adyFields['paymentAmount']."&currency=".$adyFields['currencyCode']."&description=".$adyFields['merchantReference']. $recurring_parameters . "&callbackAutomatic=1&callback=".$url .$extra_paramaters;
 
88
  }
89
 
 
 
 
90
  // log the launchlink
91
- Mage::log("Launchlink:".$launchlink, Zend_Log::DEBUG, "adyen_notification.log", true);
 
 
92
 
93
  // call app directly without HPP
94
  $html .= "<div id=\"pos-redirect-page\">
@@ -99,19 +117,20 @@ class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
99
  <div class=\"amount-box\">".
100
  $adyFields['paymentAmountGrandTotal'] .
101
  "<a id=\"launchlink\" href=\"".$launchlink ."\" >Payment</a> ".
102
- "</div>";
103
 
104
  $html .= '<script type="text/javascript">
105
-
106
  function checkStatus() {
107
  $.ajax({
108
  url: "'. $this->getUrl('adyen/process/getOrderStatus', array('_secure'=>true)) . '",
109
  type: "POST",
110
  data: "merchantReference='.$adyFields['merchantReference'] .'",
 
111
  success: function(data) {
112
  if(data == "true") {
113
  // redirect to success page
114
- window.location.href = "'. Mage::getBaseUrl()."adyen/process/success" . '";
115
  } else {
116
  window.location.href = "'. Mage::getBaseUrl()."adyen/process/cancel" . '";
117
  }
@@ -119,15 +138,50 @@ class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
119
  });
120
  }';
121
 
122
- if($android !== false) {
123
- $html .= 'url = document.getElementById(\'launchlink\').href;';
124
- $html .= 'window.location.assign(url);';
125
- $html .= 'window.onfocus = function(){setTimeout("checkStatus()", 500);};';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  } else {
127
- $html .= 'document.getElementById(\'launchlink\').click();';
128
- $html .= 'setTimeout("checkStatus()", 5000);';
 
 
 
 
 
 
 
 
 
 
129
  }
130
- $html .= '</script></div>';
 
 
 
 
131
  } else {
132
  $form = new Varien_Data_Form();
133
  $form->setAction($payment->getFormUrl())
@@ -142,10 +196,11 @@ class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
142
  $html.= $this->__(' ');
143
  $html.= $form->toHtml();
144
 
145
- if($payment->getCode() == "adyen_hpp" && $paymentObject->getCcType() == "c_cash" && $cashDrawer) {
146
- $cashDrawerIp = Mage::helper('adyen')->_getConfigData("cash_drawer_printer_ip", "adyen_pos", null);
147
- $cashDrawerPort = Mage::helper('adyen')->_getConfigData("cash_drawer_printer_port", "adyen_pos", null);
148
- $cashDrawerDeviceId = Mage::helper('adyen')->_getConfigData("cash_drawer_printer_device_id", "adyen_pos", null);
 
149
 
150
  if($cashDrawerIp != '' && $cashDrawerPort != '' && $cashDrawerDeviceId != '') {
151
  $html.= '
@@ -186,4 +241,123 @@ class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
186
  return $html;
187
  }
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  }
27
  */
28
  class Adyen_Payment_Block_Redirect extends Mage_Core_Block_Abstract {
29
 
30
+ /**
31
+ * Collected debug information
32
+ *
33
+ * @var array
34
+ */
35
+ protected $_debugData = array();
36
+
37
  protected function _getCheckout() {
38
  return Mage::getSingleton('checkout/session');
39
  }
50
 
51
  protected function _toHtml() {
52
 
53
+ $order = $this->_getOrder();
54
+ $paymentObject = $order->getPayment();
55
+ $payment = $order->getPayment()->getMethodInstance();
56
 
57
  $html = '<html><head><link rel="stylesheet" type="text/css" href="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/frontend/base/default/css/adyenstyle.css"><script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>';
58
 
59
  // for cash add epson libary to open the cash drawer
60
+ $cashDrawer = $this->_getConfigData("cash_drawer", "adyen_pos", null);
61
+ if($payment->getCode() == "adyen_hpp_c_cash" && $cashDrawer) {
62
  $jsPath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
63
  $html .= '<script src="'.$jsPath.'adyen/payment/epos-device-2.6.0.js"></script>';
64
  }
73
  $url = urlencode(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true)."adyen/process/successPos");
74
 
75
  // detect ios or android
76
+ $userAgent = $_SERVER['HTTP_USER_AGENT'];
77
+ $iPod = stripos($userAgent,"iPod");
78
+ $iPhone = stripos($userAgent,"iPhone");
79
+ $iPad = stripos($userAgent,"iPad");
80
+ $Android = stripos($userAgent,"Android");
81
+ $webOS = stripos($userAgent,"webOS");
82
 
83
  // extra parameters so that you alway's return these paramters from the application
84
  $extra_paramaters = urlencode("/?originalCustomCurrency=".$adyFields['currencyCode']."&originalCustomAmount=".$adyFields['paymentAmount']. "&originalCustomMerchantReference=".$adyFields['merchantReference'] . "&originalCustomSessionId=".session_id());
90
  $recurring_parameters = "&recurringContract=".urlencode($adyFields['recurringContract'])."&shopperReference=".urlencode($adyFields['shopperReference']). "&shopperEmail=".urlencode($adyFields['shopperEmail']);
91
  }
92
 
93
+
94
+
95
+ $addReceiptOrderLines = $this->_getConfigData("add_receipt_order_lines", "adyen_pos", null);
96
+
97
+ $receiptOrderLines = "";
98
+ if($addReceiptOrderLines) {
99
+ $orderLines = base64_encode($this->getReceiptOrderLines($this->_getOrder()));
100
+ $receiptOrderLines = "&receiptOrderLines=" . urlencode($orderLines);
101
  }
102
 
103
+ // important url must be the latest parameter before extra parameters! otherwise extra parameters won't return in return url
104
+ $launchlink = "adyen://payment?sessionId=".session_id()."&amount=".$adyFields['paymentAmount']."&currency=".$adyFields['currencyCode']."&merchantReference=".$adyFields['merchantReference']. $recurring_parameters . $receiptOrderLines . "&callback=".$url . $extra_paramaters;
105
+
106
  // log the launchlink
107
+ $this->_debugData['LaunchLink'] = $launchlink;
108
+ $storeId = $order->getStoreId();
109
+ $this->_debug($storeId);
110
 
111
  // call app directly without HPP
112
  $html .= "<div id=\"pos-redirect-page\">
117
  <div class=\"amount-box\">".
118
  $adyFields['paymentAmountGrandTotal'] .
119
  "<a id=\"launchlink\" href=\"".$launchlink ."\" >Payment</a> ".
120
+ "<span id=\"adyen-redirect-text\">If you stuck on this page please press the payment button</span></div>";
121
 
122
  $html .= '<script type="text/javascript">
123
+ //<![CDATA[
124
  function checkStatus() {
125
  $.ajax({
126
  url: "'. $this->getUrl('adyen/process/getOrderStatus', array('_secure'=>true)) . '",
127
  type: "POST",
128
  data: "merchantReference='.$adyFields['merchantReference'] .'",
129
+ asynchronous: false,
130
  success: function(data) {
131
  if(data == "true") {
132
  // redirect to success page
133
+ window.location.href = "'. Mage::getBaseUrl()."adyen/process/successPosRedirect" . '";
134
  } else {
135
  window.location.href = "'. Mage::getBaseUrl()."adyen/process/cancel" . '";
136
  }
138
  });
139
  }';
140
 
141
+ $expressCheckoutRedirectConnect = $this->_getConfigData("express_checkout_redirect_connect", "adyen_pos", null);
142
+
143
+ if($expressCheckoutRedirectConnect) {
144
+
145
+ if($iPod || $iPhone || $iPad) {
146
+ $html .= 'document.getElementById(\'launchlink\').click();';
147
+ $html .= 'setTimeout("checkStatus()", 5000);';
148
+ } else {
149
+ // android
150
+ $html .= 'var isActive;
151
+ window.onfocus = function () {
152
+ isActive = true;
153
+ };
154
+
155
+ window.onblur = function () {
156
+ isActive = false;
157
+ };
158
+
159
+ // test
160
+ setInterval(function () {
161
+ checkStatus();
162
+ }, 1000);';
163
+ $html .= 'url = document.getElementById(\'launchlink\').href;';
164
+ $html .= 'window.location = url;';
165
+ }
166
  } else {
167
+
168
+ $html .= ' var eventName = "visibilitychange";
169
+ document.addEventListener(eventName,visibilityChanged,false);
170
+ function visibilityChanged() {
171
+ if (document.hidden || document.mozHidden || document.msHidden || document.webkitHidden)
172
+ {
173
+ //Page got hidden; Adyen App called and transaction on terminal triggered
174
+ } else {
175
+ //The page is showing again; Cash Register regained control from Adyen App
176
+ checkStatus();
177
+ }
178
+ }';
179
  }
180
+
181
+ $html .= '
182
+ //]]>
183
+ </script>
184
+ </div>';
185
  } else {
186
  $form = new Varien_Data_Form();
187
  $form->setAction($payment->getFormUrl())
196
  $html.= $this->__(' ');
197
  $html.= $form->toHtml();
198
 
199
+ if($payment->getCode() == "adyen_hpp_c_cash" && $cashDrawer) {
200
+
201
+ $cashDrawerIp = $this->_getConfigData("cash_drawer_printer_ip", "adyen_pos", null);
202
+ $cashDrawerPort = $this->_getConfigData("cash_drawer_printer_port", "adyen_pos", null);
203
+ $cashDrawerDeviceId = $this->_getConfigData("cash_drawer_printer_device_id", "adyen_pos", null);
204
 
205
  if($cashDrawerIp != '' && $cashDrawerPort != '' && $cashDrawerDeviceId != '') {
206
  $html.= '
241
  return $html;
242
  }
243
 
244
+
245
+ /**
246
+ * Log debug data to file
247
+ *
248
+ * @param mixed $debugData
249
+ */
250
+ protected function _debug($storeId)
251
+ {
252
+ if ($this->_getConfigData('debug', 'adyen_abstract', $storeId)) {
253
+ $file = 'adyen_request_pos.log';
254
+ Mage::getModel('core/log_adapter', $file)->log($this->_debugData);
255
+ }
256
+ }
257
+
258
+ private function getReceiptOrderLines($order) {
259
+
260
+ $myReceiptOrderLines = "";
261
+
262
+ // temp
263
+ $currency = $order->getOrderCurrencyCode();
264
+ $formattedAmountValue = Mage::helper('core')->formatPrice($order->getGrandTotal(), false);
265
+
266
+ $formattedAmountValue = Mage::getModel('directory/currency')->format(
267
+ $order->getGrandTotal(),
268
+ array('display'=>Zend_Currency::NO_SYMBOL),
269
+ false
270
+ );
271
+
272
+ $taxAmount = Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount');
273
+ $formattedTaxAmount = Mage::getModel('directory/currency')->format(
274
+ $taxAmount,
275
+ array('display'=>Zend_Currency::NO_SYMBOL),
276
+ false
277
+ );
278
+
279
+ $paymentAmount = "1000";
280
+
281
+ $myReceiptOrderLines .= "---||C\n".
282
+ "====== YOUR ORDER DETAILS ======||CB\n".
283
+ "---||C\n".
284
+ " No. Description |Piece Subtotal|\n";
285
+
286
+ foreach ($order->getItemsCollection() as $item) {
287
+ //skip dummies
288
+ if ($item->isDummy()) continue;
289
+ $singlePriceFormat = Mage::getModel('directory/currency')->format(
290
+ $item->getPriceInclTax(),
291
+ array('display'=>Zend_Currency::NO_SYMBOL),
292
+ false
293
+ );
294
+
295
+ $itemAmount = $item->getPriceInclTax() * (int) $item->getQtyOrdered();
296
+ $itemAmountFormat = Mage::getModel('directory/currency')->format(
297
+ $itemAmount,
298
+ array('display'=>Zend_Currency::NO_SYMBOL),
299
+ false
300
+ );
301
+ $myReceiptOrderLines .= " " . (int) $item->getQtyOrdered() . " " . trim(substr($item->getName(),0, 25)) . "| " . $currency . " " . $singlePriceFormat . " " . $currency . " " . $itemAmountFormat . "|\n";
302
+ }
303
+
304
+ //discount cost
305
+ if($order->getDiscountAmount() > 0 || $order->getDiscountAmount() < 0)
306
+ {
307
+ $discountAmountFormat = Mage::getModel('directory/currency')->format(
308
+ $order->getDiscountAmount(),
309
+ array('display'=>Zend_Currency::NO_SYMBOL),
310
+ false
311
+ );
312
+ $myReceiptOrderLines .= " " . 1 . " " . $this->__('Total Discount') . "| " . $currency . " " . $discountAmountFormat ."|\n";
313
+ }
314
+
315
+ //shipping cost
316
+ if($order->getShippingAmount() > 0 || $order->getShippingTaxAmount() > 0)
317
+ {
318
+ $shippingAmountFormat = Mage::getModel('directory/currency')->format(
319
+ $order->getShippingAmount(),
320
+ array('display'=>Zend_Currency::NO_SYMBOL),
321
+ false
322
+ );
323
+ $myReceiptOrderLines .= " " . 1 . " " . $order->getShippingDescription() . "| " . $currency . " " . $shippingAmountFormat ."|\n";
324
+
325
+ }
326
+
327
+ if($order->getPaymentFeeAmount() > 0) {
328
+ $paymentFeeAmount = Mage::getModel('directory/currency')->format(
329
+ $order->getPaymentFeeAmount(),
330
+ array('display'=>Zend_Currency::NO_SYMBOL),
331
+ false
332
+ );
333
+ $myReceiptOrderLines .= " " . 1 . " " . $this->__('Payment Fee') . "| " . $currency . " " . $paymentFeeAmount ."|\n";
334
+
335
+ }
336
+
337
+ $myReceiptOrderLines .= "|--------|\n".
338
+ "|Order Total: ".$currency." ".$formattedAmountValue."|B\n".
339
+ "|Tax: ".$currency." ".$formattedTaxAmount."|B\n".
340
+ "||C\n";
341
+
342
+ //Cool new header for card details section! Default location is After Header so simply add to Order Details as separator
343
+ $myReceiptOrderLines .= "---||C\n".
344
+ "====== YOUR PAYMENT DETAILS ======||CB\n".
345
+ "---||C\n";
346
+
347
+
348
+ return $myReceiptOrderLines;
349
+
350
+ }
351
+
352
+ /**
353
+ * @param $code
354
+ * @param null $paymentMethodCode
355
+ * @param null $storeId
356
+ * @return mixed
357
+ */
358
+ protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null)
359
+ {
360
+ return Mage::helper('adyen')->getConfigData($code, $paymentMethodCode, $storeId);
361
+ }
362
+
363
  }
app/code/community/Adyen/Payment/Block/Sales/Order/Totals.php CHANGED
@@ -33,32 +33,28 @@ class Adyen_Payment_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Tota
33
 
34
  if (((float)$this->getSource()->getPaymentFeeAmount()) != 0) {
35
  $this->addTotal(
36
- new Varien_Object(
37
- array(
38
- 'code' => 'payment_fee',
39
- 'strong' => false,
40
- 'value' => $this->getSource()->getPaymentFeeAmount(),
41
- 'base_value'=> $this->getSource()->getBasePaymentFeeAmount(),
42
- 'label' => $this->helper('adyen')->__('Payment Fee'),
43
- 'area' => '',
44
- )
45
- ),
46
  'subtotal'
47
  );
48
  }
49
 
50
  if (((float)$this->getSource()->getPaymentInstallmentFeeAmount()) != 0) {
51
  $this->addTotal(
52
- new Varien_Object(
53
- array(
54
- 'code' => 'payment_installment_fee',
55
- 'strong' => false,
56
- 'value' => $this->getSource()->getPaymentInstallmentFeeAmount(),
57
- 'base_value'=> $this->getSource()->getBasePaymentInstallmentFeeAmount(),
58
- 'label' => $this->helper('adyen')->__('Payment Fee Installments'),
59
- 'area' => '',
60
- )
61
- ),
62
  'subtotal'
63
  );
64
  }
33
 
34
  if (((float)$this->getSource()->getPaymentFeeAmount()) != 0) {
35
  $this->addTotal(
36
+ new Varien_Object(array(
37
+ 'code' => 'payment_fee',
38
+ 'strong' => false,
39
+ 'value' => $this->getSource()->getPaymentFeeAmount(),
40
+ 'base_value' => $this->getSource()->getBasePaymentFeeAmount(),
41
+ 'label' => $this->helper('adyen')->__('Payment Fee'),
42
+ 'area' => '',
43
+ )),
 
 
44
  'subtotal'
45
  );
46
  }
47
 
48
  if (((float)$this->getSource()->getPaymentInstallmentFeeAmount()) != 0) {
49
  $this->addTotal(
50
+ new Varien_Object(array(
51
+ 'code' => 'payment_installment_fee',
52
+ 'strong' => false,
53
+ 'value' => $this->getSource()->getPaymentInstallmentFeeAmount(),
54
+ 'base_value'=> $this->getSource()->getBasePaymentInstallmentFeeAmount(),
55
+ 'label' => $this->helper('adyen')->__('Payment Fee Installments'),
56
+ 'area' => '',
57
+ )),
 
 
58
  'subtotal'
59
  );
60
  }
app/code/community/Adyen/Payment/Helper/Data.php CHANGED
@@ -93,8 +93,8 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
93
  }
94
 
95
  public function hasCashExpressCheckout() {
96
- if(Mage::getStoreConfig('payment/adyen_pos/active')) {
97
- return (int) Mage::getStoreConfig('payment/adyen_pos/cash_express_checkout');
98
  }
99
  return false;
100
  }
@@ -146,6 +146,7 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
146
  case "XOF":
147
  case "XPF":
148
  case "GHC":
 
149
  $format = 0;
150
  break;
151
  case "MRO":
@@ -167,6 +168,47 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
167
  return number_format($amount, $format, '', '');
168
  }
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  /*
171
  * creditcard type that is selected is different from creditcard type that we get back from the request
172
  * this function get the magento creditcard type this is needed for getting settings like installments
@@ -193,6 +235,13 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
193
 
194
  public function getRecurringCards($merchantAccount, $customerId, $recurringType) {
195
 
 
 
 
 
 
 
 
196
  // create a arraylist with the cards
197
  $recurringCards = array();
198
 
@@ -230,19 +279,27 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
230
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($request));
231
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
232
 
233
- $result = curl_exec($ch);
 
 
 
 
 
 
 
234
 
235
- if($result === false) {
236
- Mage::log("List recurring is failing error is: " . curl_error($ch), self::DEBUG_LEVEL, 'http-request.log',true);
237
- Mage::throwException(Mage::helper('adyen')->__('List recurring is generating the error see the log'));
238
- } else{
 
239
  /**
240
  * The $result contains a JSON array containing
241
  * the available payment methods for the merchant account.
242
  */
243
 
244
  // convert result to utf8 characters
245
- $result = utf8_encode(urldecode($result));
246
  // convert to array
247
  parse_str($result,$result);
248
 
@@ -252,26 +309,30 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
252
  $key2 = strstr($key, '_');
253
  $keyNumber = str_replace($key2, "", $key);
254
  $keyAttribute = substr($key2, 1);
 
 
 
 
 
 
255
  $recurringCards[$keyNumber][$keyAttribute] = $value;
256
  }
257
  // unset the recurringDetailsResult because this is not a card
258
  unset($recurringCards["recurringDetailsResult"]);
259
-
260
- // filter out all non-creditcards
261
- foreach($recurringCards as $key => $recurringCard) {
262
-
263
- if(!(isset($recurringCard["recurringDetailReference"]) && isset($recurringCard["variant"]) && isset($recurringCard["card_number"])
264
- && isset($recurringCard["card_expiryMonth"]) && isset($recurringCard["card_expiryYear"]))) {
265
-
266
- unset($recurringCards[$key]);
267
- }
268
- }
269
  }
270
  }
 
 
 
 
 
 
 
 
271
  return $recurringCards;
272
  }
273
 
274
- public function removeRecurringCart($merchantAccount, $shopperReference, $recurringDetailReference) {
275
 
276
  // rest call to disable cart
277
  $request = array(
@@ -302,7 +363,7 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
302
  $result = curl_exec($ch);
303
 
304
  if($result === false) {
305
- Mage::log("Disable recurring contract is failing, error is: " . curl_error($ch), self::DEBUG_LEVEL, 'http-request.log',true);
306
  Mage::throwException(Mage::helper('adyen')->__('Disable recurring contract is generating the error see the log'));
307
  } else{
308
 
@@ -310,7 +371,7 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
310
  $result = utf8_encode(urldecode($result));
311
 
312
  if($result != "disableResult.response=[detail-successfully-disabled]") {
313
- Mage::log("Disable contract is not succeeded the response is: " . $result, self::DEBUG_LEVEL, 'http-request.log',true);
314
  return false;
315
  }
316
  return true;
@@ -323,41 +384,61 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
323
  * Used via Payment method.Notice via configuration ofcourse Y or N
324
  * @return boolean true on demo, else false
325
  */
326
- public function getConfigDataDemoMode($storeId = null) {
327
- if ($this->_getConfigData('demoMode', null, $storeId) == 'Y') {
 
328
  return true;
329
  }
330
  return false;
331
  }
332
 
333
- public function getConfigDataWsUserName($storeId = null) {
 
334
  if ($this->getConfigDataDemoMode($storeId)) {
335
- return $this->_getConfigData('ws_username_test', null, $storeId);
336
  }
337
- return $this->_getConfigData('ws_username_live', null, $storeId);
338
  }
339
 
340
- public function getConfigDataWsPassword($storeId = null) {
 
341
  if ($this->getConfigDataDemoMode($storeId)) {
342
- return Mage::helper('core')->decrypt($this->_getConfigData('ws_password_test', null, $storeId));
343
  }
344
- return Mage::helper('core')->decrypt($this->_getConfigData('ws_password_live', null, $storeId));
345
  }
346
 
 
347
  /**
348
- * @desc Give Default settings
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  * @example $this->_getConfigData('demoMode','adyen_abstract')
350
- * @since 0.0.2
 
351
  * @param string $code
 
 
352
  */
353
- public function _getConfigData($code, $paymentMethodCode = null, $storeId = null) {
354
  if (null === $storeId) {
355
  $storeId = Mage::app()->getStore()->getStoreId();
356
  }
357
  if (empty($paymentMethodCode)) {
358
- return Mage::getStoreConfig("payment/adyen_abstract/$code", $storeId);
359
  }
360
- return Mage::getStoreConfig("payment/$paymentMethodCode/$code", $storeId);
361
  }
362
 
363
  // Function to get the client ip address
@@ -394,4 +475,41 @@ class Adyen_Payment_Helper_Data extends Mage_Payment_Helper_Data {
394
  return false;
395
  }
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  }
93
  }
94
 
95
  public function hasCashExpressCheckout() {
96
+ if(Mage::getStoreConfig('payment/adyen_cash/active')) {
97
+ return (int) Mage::getStoreConfig('payment/adyen_cash/cash_express_checkout');
98
  }
99
  return false;
100
  }
146
  case "XOF":
147
  case "XPF":
148
  case "GHC":
149
+ case "KMF":
150
  $format = 0;
151
  break;
152
  case "MRO":
168
  return number_format($amount, $format, '', '');
169
  }
170
 
171
+ public function originalAmount($amount, $currency) {
172
+ // check the format
173
+ switch($currency) {
174
+ case "JPY":
175
+ case "IDR":
176
+ case "KRW":
177
+ case "BYR":
178
+ case "VND":
179
+ case "CVE":
180
+ case "DJF":
181
+ case "GNF":
182
+ case "PYG":
183
+ case "RWF":
184
+ case "UGX":
185
+ case "VUV":
186
+ case "XAF":
187
+ case "XOF":
188
+ case "XPF":
189
+ case "GHC":
190
+ case "KMF":
191
+ $format = 1;
192
+ break;
193
+ case "MRO":
194
+ $format = 10;
195
+ break;
196
+ case "BHD":
197
+ case "JOD":
198
+ case "KWD":
199
+ case "OMR":
200
+ case "LYD":
201
+ case "TND":
202
+ $format = 1000;
203
+ break;
204
+ default:
205
+ $format = 100;
206
+ break;
207
+ }
208
+
209
+ return ($amount / $format);
210
+ }
211
+
212
  /*
213
  * creditcard type that is selected is different from creditcard type that we get back from the request
214
  * this function get the magento creditcard type this is needed for getting settings like installments
235
 
236
  public function getRecurringCards($merchantAccount, $customerId, $recurringType) {
237
 
238
+ $cacheKey = $merchantAccount . "|" . $customerId . "|" . $recurringType;
239
+
240
+ // Load response from cache.
241
+ if ($recurringCards = Mage::app()->getCache()->load($cacheKey)) {
242
+ return unserialize($recurringCards);
243
+ }
244
+
245
  // create a arraylist with the cards
246
  $recurringCards = array();
247
 
279
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($request));
280
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
281
 
282
+ $results = curl_exec($ch);
283
+ $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
284
+
285
+ if ($httpStatus != 200) {
286
+ Mage::throwException(
287
+ Mage::helper('adyen')->__('HTTP Status code %s received, data %s', $httpStatus, $results)
288
+ );
289
+ }
290
 
291
+ if ($results === false) {
292
+ Mage::throwException(
293
+ Mage::helper('adyen')->__('Got an empty response, status code %s', $httpStatus)
294
+ );
295
+ }else{
296
  /**
297
  * The $result contains a JSON array containing
298
  * the available payment methods for the merchant account.
299
  */
300
 
301
  // convert result to utf8 characters
302
+ $result = utf8_encode(urldecode($results));
303
  // convert to array
304
  parse_str($result,$result);
305
 
309
  $key2 = strstr($key, '_');
310
  $keyNumber = str_replace($key2, "", $key);
311
  $keyAttribute = substr($key2, 1);
312
+
313
+ // set ideal to sepadirectdebit because it is and we want to show sepadirectdebit logo
314
+ if($keyAttribute == "variant" && $value == "ideal") {
315
+ $value = 'sepadirectdebit';
316
+ }
317
+
318
  $recurringCards[$keyNumber][$keyAttribute] = $value;
319
  }
320
  // unset the recurringDetailsResult because this is not a card
321
  unset($recurringCards["recurringDetailsResult"]);
 
 
 
 
 
 
 
 
 
 
322
  }
323
  }
324
+
325
+ // Save response to cache.
326
+ Mage::app()->getCache()->save(
327
+ serialize($recurringCards),
328
+ $cacheKey,
329
+ array(Mage_Core_Model_Config::CACHE_TAG),
330
+ 60 * 5 // save for 5 minutes ( and will be removed if payment is done)
331
+ );
332
  return $recurringCards;
333
  }
334
 
335
+ public function removeRecurringCard($merchantAccount, $shopperReference, $recurringDetailReference) {
336
 
337
  // rest call to disable cart
338
  $request = array(
363
  $result = curl_exec($ch);
364
 
365
  if($result === false) {
366
+ Mage::log("Disable recurring contract is failing, error is: " . curl_error($ch), self::DEBUG_LEVEL, 'adyen_http-request.log',true);
367
  Mage::throwException(Mage::helper('adyen')->__('Disable recurring contract is generating the error see the log'));
368
  } else{
369
 
371
  $result = utf8_encode(urldecode($result));
372
 
373
  if($result != "disableResult.response=[detail-successfully-disabled]") {
374
+ Mage::log("Disable contract is not succeeded the response is: " . $result, self::DEBUG_LEVEL, 'adyen_http-request.log',true);
375
  return false;
376
  }
377
  return true;
384
  * Used via Payment method.Notice via configuration ofcourse Y or N
385
  * @return boolean true on demo, else false
386
  */
387
+ public function getConfigDataDemoMode($storeId = null)
388
+ {
389
+ if ($this->getConfigData('demoMode', null, $storeId) == 'Y') {
390
  return true;
391
  }
392
  return false;
393
  }
394
 
395
+ public function getConfigDataWsUserName($storeId = null)
396
+ {
397
  if ($this->getConfigDataDemoMode($storeId)) {
398
+ return $this->getConfigData('ws_username_test', null, $storeId);
399
  }
400
+ return $this->getConfigData('ws_username_live', null, $storeId);
401
  }
402
 
403
+ public function getConfigDataWsPassword($storeId = null)
404
+ {
405
  if ($this->getConfigDataDemoMode($storeId)) {
406
+ return Mage::helper('core')->decrypt($this->getConfigData('ws_password_test', null, $storeId));
407
  }
408
+ return Mage::helper('core')->decrypt($this->getConfigData('ws_password_live', null, $storeId));
409
  }
410
 
411
+
412
  /**
413
+ * @param $code
414
+ * @param null $paymentMethodCode
415
+ * @param null $storeId
416
+ * @deprecated please use getConfigData
417
+ * @return mixed
418
+ */
419
+ public function _getConfigData($code, $paymentMethodCode = null, $storeId = null)
420
+ {
421
+ return $this->getConfigData($code, $paymentMethodCode, $storeId);
422
+ }
423
+
424
+
425
+ /**
426
+ * @desc Give Default settings
427
  * @example $this->_getConfigData('demoMode','adyen_abstract')
428
+ * @since 0.0.2
429
+ *
430
  * @param string $code
431
+ *
432
+ * @return mixed
433
  */
434
+ public function getConfigData($code, $paymentMethodCode = null, $storeId = null) {
435
  if (null === $storeId) {
436
  $storeId = Mage::app()->getStore()->getStoreId();
437
  }
438
  if (empty($paymentMethodCode)) {
439
+ return trim(Mage::getStoreConfig("payment/adyen_abstract/$code", $storeId));
440
  }
441
+ return trim(Mage::getStoreConfig("payment/$paymentMethodCode/$code", $storeId));
442
  }
443
 
444
  // Function to get the client ip address
475
  return false;
476
  }
477
 
478
+
479
+ /**
480
+ * Street format
481
+ * @param type $address
482
+ * @return Varien_Object
483
+ */
484
+ public function getStreet($address) {
485
+ if (empty($address)) return false;
486
+ $street = self::formatStreet($address->getStreet());
487
+ $streetName = $street['0'];
488
+ unset($street['0']);
489
+ // $streetNr = implode('',$street);
490
+ $streetNr = implode(' ',$street);
491
+
492
+ return new Varien_Object(array('name' => $streetName, 'house_number' => $streetNr));
493
+ }
494
+
495
+ /**
496
+ * Fix this one string street + number
497
+ * @example street + number
498
+ * @param type $street
499
+ * @return type $street
500
+ */
501
+ static public function formatStreet($street) {
502
+ if (count($street) != 1) {
503
+ return $street;
504
+ }
505
+ preg_match('/((\s\d{0,10})|(\s\d{0,10}\w{1,3}))$/i', $street['0'], $houseNumber, PREG_OFFSET_CAPTURE);
506
+ if(!empty($houseNumber['0'])) {
507
+ $_houseNumber = trim($houseNumber['0']['0']);
508
+ $position = $houseNumber['0']['1'];
509
+ $streeName = trim(substr($street['0'], 0, $position));
510
+ $street = array($streeName,$_houseNumber);
511
+ }
512
+ return $street;
513
+ }
514
+
515
  }
app/code/community/Adyen/Payment/Helper/Payment/Data.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Adyen_Payment_Helper_Payment_Data extends Mage_Payment_Helper_Data {
22
+
23
+ /**
24
+ * Retrieve method model object
25
+ *
26
+ * @param string $code
27
+ * @return Mage_Payment_Model_Method_Abstract|false
28
+ */
29
+ public function getMethodInstance($code)
30
+ {
31
+ $key = self::XML_PATH_PAYMENT_METHODS.'/'.$code.'/model';
32
+ $class = Mage::getStoreConfig($key);
33
+
34
+ if (! $class && strpos($code, 'adyen_hpp') !== false) {
35
+ $methodCode = substr($code, strlen('adyen_hpp_'));
36
+ Mage::getSingleton('adyen/observer')->createPaymentMethodFromHpp($methodCode, array(), Mage::app()->getStore(), '0');
37
+ $class = Mage::getStoreConfig($key);
38
+ } elseif(! $class && strpos($code, 'adyen_oneclick') !== false) {
39
+ if(Mage::app()->getStore()->isAdmin()) {
40
+ $methodCode = substr($code, strlen('adyen_oneclick_'));
41
+ $store = Mage::getSingleton('adminhtml/session_quote')->getStore();
42
+ Mage::getSingleton('adyen/observer')->createPaymentMethodFromOneClick($methodCode, array(), $store);
43
+ $class = Mage::getStoreConfig($key, $store->getId());
44
+ }
45
+ }
46
+
47
+ $methodInstance = Mage::getModel($class);
48
+ if (method_exists($methodInstance, 'setCode')) {
49
+ $methodInstance->setCode($code);
50
+ }
51
+
52
+ return $methodInstance;
53
+ }
54
+
55
+ /**
56
+ * Get and sort available payment methods for specified or current store
57
+ *
58
+ * array structure:
59
+ * $index => Varien_Simplexml_Element
60
+ *
61
+ * @param mixed $store
62
+ * @param Mage_Sales_Model_Quote $quote
63
+ * @return array
64
+ */
65
+ public function getStoreMethods($store = null, $quote = null)
66
+ {
67
+ $res = array();
68
+ foreach ($this->getPaymentMethods($store) as $code => $methodConfig) {
69
+ $prefix = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/';
70
+ if (!$model = Mage::getStoreConfig($prefix . 'model', $store)) {
71
+ continue;
72
+ }
73
+ /** @var Mage_Payment_Model_Method_Abstract $methodInstance */
74
+ $methodInstance = Mage::getModel($model);
75
+ if (method_exists($methodInstance, 'setCode')) {
76
+ $methodInstance->setCode($code);
77
+ }
78
+ if (!$methodInstance) {
79
+ continue;
80
+ }
81
+ $methodInstance->setStore($store);
82
+ if (!$methodInstance->isAvailable($quote)) {
83
+ /* if the payment method cannot be used at this time */
84
+ continue;
85
+ }
86
+ $sortOrder = (int)$methodInstance->getConfigData('sort_order', $store);
87
+ $methodInstance->setSortOrder($sortOrder);
88
+ $res[] = $methodInstance;
89
+ }
90
+
91
+ usort($res, array($this, '_sortMethods'));
92
+ return $res;
93
+ }
94
+
95
+ /**
96
+ * Retrieve payment information block
97
+ *
98
+ * @param Mage_Payment_Model_Info $info
99
+ * @return Mage_Core_Block_Template
100
+ */
101
+ public function getInfoBlock(Mage_Payment_Model_Info $info)
102
+ {
103
+ $instance = $this->getMethodInstance($info->getMethod());
104
+ if ($instance) {
105
+ $instance->setInfoInstance($info);
106
+ $info->setMethodInstance($instance);
107
+ }
108
+
109
+ $blockType = $instance->getInfoBlockType();
110
+ if ($this->getLayout()) {
111
+ $block = $this->getLayout()->createBlock($blockType);
112
+ }
113
+ else {
114
+ $className = Mage::getConfig()->getBlockClassName($blockType);
115
+ $block = new $className;
116
+ }
117
+ $block->setInfo($info);
118
+ return $block;
119
+ }
120
+ }
app/code/community/Adyen/Payment/Helper/Pci.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Adyen_Payment_Helper_Pci
5
+ * @see https://www.pcisecuritystandards.org/documents/pci_ssc_quick_guide.pdf
6
+ */
7
+ class Adyen_Payment_Helper_Pci
8
+ {
9
+ /** @var array */
10
+ protected static $_sensitiveDataKeys = ['holdername', 'expiryyear', 'expirymonth', 'issuenumber', 'cvc', 'number'];
11
+
12
+ /** @var array */
13
+ protected static $_sensitiveElementPatterns;
14
+
15
+ /**
16
+ * Set patterns for matching sensitive strings
17
+ */
18
+ public function __construct()
19
+ {
20
+ if (isset(self::$_sensitiveElementPatterns)) {
21
+ return;
22
+ }
23
+
24
+ foreach (self::$_sensitiveDataKeys as $key) {
25
+ self::$_sensitiveElementPatterns[] = '/(<ns1:' . $key . '>)(.*?)(<\/ns1:' . $key . '>)/i';
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Recursively work through an array object obscuring the values of sensitive keys
31
+ * Obscure any substrings matched as sensitive XML elements
32
+ * @param mixed $object
33
+ * @return mixed Original type of object
34
+ */
35
+ public function obscureSensitiveData($object)
36
+ {
37
+ if (is_array($object)) {
38
+ return $this->_obscureSensitiveArray($object);
39
+ }
40
+
41
+ if ($object instanceof ArrayAccess) {
42
+ return $this->_obscureSensitiveObject($object);
43
+ }
44
+
45
+ if (is_string($object) || is_numeric($object)) {
46
+ return $this->_obscureSensitiveElements($object);
47
+ }
48
+
49
+ return $object;
50
+ }
51
+
52
+ /**
53
+ * @param array $array
54
+ * @return array
55
+ */
56
+ protected function _obscureSensitiveArray(array $array)
57
+ {
58
+ foreach ($array as $key => $value) {
59
+ $array[$key] = $this->_obscureSensitiveKeyValue($key, $value);
60
+ }
61
+ return $array;
62
+ }
63
+
64
+ /**
65
+ * @param ArrayAccess $object E.g. Varien_Object
66
+ * @return ArrayAccess
67
+ */
68
+ protected function _obscureSensitiveObject(ArrayAccess $object)
69
+ {
70
+ foreach ($object as $key => $value) {
71
+ $object[$key] = $this->_obscureSensitiveKeyValue($key, $value);
72
+ }
73
+ return $object;
74
+ }
75
+
76
+ /**
77
+ * Replace any matched sensitive strings with an obscured version
78
+ * @param string $string
79
+ * @return string
80
+ */
81
+ protected function _obscureSensitiveElements($string)
82
+ {
83
+ return preg_replace_callback(self::$_sensitiveElementPatterns, function($matches) {
84
+ return $matches[1] . $this->_obscureString($matches[2]) . $matches[3];
85
+ }, $string);
86
+ }
87
+
88
+ /**
89
+ * Replace all but first and last characters with *
90
+ * @param $string
91
+ * @return string
92
+ */
93
+ protected function _obscureString($string)
94
+ {
95
+ $len = strlen($string);
96
+ if ($len > 3) {
97
+ return substr($string, 0, 1) . str_repeat('*', $len - 2) . substr($string, -1);
98
+ }
99
+ return str_repeat('*', $len);
100
+ }
101
+
102
+ /**
103
+ * Return value, obscured if sensitive based on key and value
104
+ * @param $key
105
+ * @param $value
106
+ * @return mixed
107
+ */
108
+ protected function _obscureSensitiveKeyValue($key, $value)
109
+ {
110
+ // Is this a sensitive key with a string or numeric value?
111
+ if (in_array(strtolower($key), self::$_sensitiveDataKeys) && (is_string($value) || is_numeric($value))) {
112
+ $strVal = (string) $value;
113
+ return $this->_obscureString($strVal);
114
+ }
115
+
116
+ // Recursively work through the value
117
+ return $this->obscureSensitiveData($value);
118
+ }
119
+ }
app/code/community/Adyen/Payment/Model/Adyen/Abstract.php CHANGED
@@ -44,12 +44,8 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
44
  protected $_canUseForMultishipping = false;
45
  protected $_canRefundInvoicePartial = true;
46
 
47
- /**
48
- * TODO: whether a captured transaction may be voided by this gateway
49
- * This may happen when amount is captured, but not settled
50
- * @var bool
51
- */
52
- protected $_canCancelInvoice = true;
53
 
54
  /**
55
  * Magento Order Object
@@ -78,6 +74,12 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
78
  protected $_testModificationUrl = 'https://pal-test.adyen.com/pal/adapter/httppost';
79
  protected $_liveModificationUrl = 'https://pal-live.adyen.com/pal/adapter/httppost';
80
 
 
 
 
 
 
 
81
  /**
82
  * @param Varien_Object $payment
83
  * @param unknown_type $amount
@@ -106,9 +108,40 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
106
  * @param unknown_type $amount
107
  */
108
  public function authorize(Varien_Object $payment, $amount) {
109
- parent::authorize($payment, $amount);
110
  $payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
111
- if ($this->getCode() == 'adyen_boleto' || $this->getCode() == 'adyen_cc' || $this->getCode() == 'adyen_oneclick' || $this->getCode() == 'adyen_elv' || $this->getCode() == 'adyen_sepa') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  $_authorizeResponse = $this->_processRequest($payment, $amount, "authorise");
113
  }
114
  return $this;
@@ -122,8 +155,8 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
122
  public function capture(Varien_Object $payment, $amount) {
123
  parent::capture($payment, $amount);
124
  $payment->setStatus(self::STATUS_APPROVED)
125
- ->setTransactionId($this->getTransactionId())
126
- ->setIsTransactionClosed(0);
127
 
128
  // do capture request to adyen
129
  $order = $payment->getOrder();
@@ -132,12 +165,12 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
132
 
133
  return $this;
134
  }
135
-
136
- public function authorise3d(Varien_Object $payment, $amount) {
137
  $authorizeResponse = $this->_processRequest($payment, $amount, "authorise3d");
138
- $responseCode = $authorizeResponse->paymentResult->resultCode;
139
- return $responseCode;
140
- }
141
 
142
  public function sendCaptureRequest(Varien_Object $payment, $amount, $pspReference) {
143
  if (empty($pspReference)) {
@@ -174,10 +207,9 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
174
  * @param unknown_type $responseData
175
  */
176
  protected function _processRequest(Varien_Object $payment, $amount, $request, $pspReference = null) {
177
- $this->_initOrder();
178
 
179
  if (Mage::app()->getStore()->isAdmin()) {
180
- $storeId = $this->_order->getStoreId();
181
  } else {
182
  $storeId = null;
183
  }
@@ -188,19 +220,19 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
188
  $enableMoto = (int) $this->_getConfigData('enable_moto', 'adyen_cc', $storeId);
189
  $modificationResult = Mage::getModel('adyen/adyen_data_modificationResult');
190
  $requestData = Mage::getModel('adyen/adyen_data_modificationRequest')
191
- ->create($payment, $amount, $this->_order, $merchantAccount, $pspReference);
192
 
193
  switch ($request) {
194
  case "authorise":
195
  $requestData = Mage::getModel('adyen/adyen_data_paymentRequest')
196
- ->create($payment, $amount, $this->_order, $this->_paymentMethod, $merchantAccount,$recurringType, $enableMoto);
197
 
198
  $response = $this->_service->authorise(array('paymentRequest' => $requestData));
199
  break;
200
  case "authorise3d":
201
  $requestData = Mage::getModel('adyen/adyen_data_paymentRequest3d')
202
- ->create($payment, $amount, $this->_order, $this->_paymentMethod, $merchantAccount);
203
-
204
  $response = $this->_service->authorise3d(array('paymentRequest3d' => $requestData));
205
  break;
206
  case "capture":
@@ -224,12 +256,18 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
224
  $this->_processResponse($payment, $response, $request);
225
  }
226
 
 
 
 
 
 
 
227
  //debug || log
228
- Mage::getResourceModel('adyen/adyen_debug')->assignData($response);
229
- $this->_debugAdyen();
230
- Mage::log($requestData, self::DEBUG_LEVEL, "$request.log", true);
231
- Mage::log("Response from Adyen:", self::DEBUG_LEVEL, "$request.log", true);
232
- Mage::log($response, self::DEBUG_LEVEL, "$request.log", true);
233
 
234
  //return $this;
235
  return $response;
@@ -261,10 +299,16 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
261
  switch ($request) {
262
  case "authorise":
263
  case "authorise3d":
264
- $fraudResult = $response->paymentResult->fraudResult->accountScore;
265
- $payment->setAdyenTotalFraudScore($fraudResult);
 
 
266
  $responseCode = $response->paymentResult->resultCode;
267
  $pspReference = $response->paymentResult->pspReference;
 
 
 
 
268
  break;
269
  case "refund":
270
  $responseCode = $response->refundResult->response;
@@ -285,24 +329,50 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
285
  switch ($responseCode) {
286
 
287
  case "RedirectShopper":
288
- $payment->setAdditionalInformation('paRequest', $response->paymentResult->paRequest);
289
- $payment->setAdditionalInformation('md', $response->paymentResult->md);
290
- $payment->setAdditionalInformation('issuerUrl', $response->paymentResult->issuerUrl);
291
- Mage::getSingleton('customer/session')->setRedirectUrl("adyen/process/validate3d");
292
- $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
293
  break;
294
  case "Refused":
295
- $errorMsg = Mage::helper('adyen')->__('The payment is REFUSED by Adyen.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  Mage::throwException($errorMsg);
297
  break;
298
  case "Authorised":
299
  $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
300
  break;
301
  case "Received": // boleto payment
302
- $additionalDataResult = $response->paymentResult->additionalData->entry;
303
- $pdfUrl = $additionalDataResult[0]->value;
304
- $this->_addStatusHistory($payment, $responseCode, $pspReference, false, $pdfUrl);
305
- break;
 
 
 
 
 
306
  case '[capture-received]':
307
  case '[refund-received]':
308
  case '[cancelOrRefund-received]':
@@ -319,13 +389,13 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
319
 
320
  //save all response data for a pure duplicate detection
321
  Mage::getModel('adyen/event')
322
- ->setPspReference($pspReference)
323
- ->setAdyenEventCode($responseCode)
324
- ->setAdyenEventResult($responseCode)
325
- ->setIncrementId($this->_order->getIncrementId())
326
- ->setPaymentMethod($this->getInfoInstance()->getCcType())
327
- ->setCreatedAt(now())
328
- ->saveData()
329
  ;
330
  return $this;
331
  }
@@ -337,13 +407,14 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
337
  * @param unknown_type $pspReference
338
  */
339
  protected function _addStatusHistory(Varien_Object $payment, $responseCode, $pspReference, $status = false, $boletoPDF = null) {
340
-
341
- if($boletoPDF)
342
- $payment->getOrder()->setAdyenBoletoPdf($boletoPDF);
343
 
344
- $comment = Mage::helper('adyen')->__('Adyen Result URL Notification(s): %s <br /> pspReference: %s', $responseCode, $pspReference);
 
 
 
 
345
  $payment->getOrder()->setAdyenEventCode($responseCode);
346
- $payment->getOrder()->addStatusHistoryComment($comment, $status);
347
  $payment->setAdyenEventCode($responseCode);
348
  return $this;
349
  }
@@ -359,7 +430,7 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
359
 
360
  /**
361
  * @desc Get SOAP client
362
- * @return Adyen_Payment_Model_Adyen_Abstract
363
  */
364
  protected function _initService($storeId = null) {
365
  $accountData = $this->getAccountData($storeId);
@@ -370,14 +441,14 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
370
  $classmap = new Adyen_Payment_Model_Adyen_Data_Classmap();
371
  try {
372
  $this->_service = new SoapClient($wsdl, array(
373
- 'login' => $login,
374
- 'password' => $password,
375
- 'soap_version' => SOAP_1_1,
376
- 'style' => SOAP_DOCUMENT,
377
- 'encoding' => SOAP_LITERAL,
378
- 'location' => $location,
379
- 'trace' => 1,
380
- 'classmap' => $classmap));
381
  } catch (SoapFault $fault) {
382
  $this->writeLog("Adyen SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})");
383
  Mage::throwException(Mage::helper('adyen')->__('Can not connect payment service. Please try again later.'));
@@ -387,7 +458,7 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
387
 
388
  /**
389
  * @desc soap urls
390
- * @return string
391
  */
392
  protected function _getAdyenUrls($storeId = null) {
393
  $test = array(
@@ -410,13 +481,24 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
410
  */
411
  protected function _debugAdyen() {
412
  $this->writeLog("Request Headers: ");
413
- $this->writeLog($this->_service->__getLastRequestHeaders());
414
  $this->writeLog("Request:");
415
- $this->writeLog($this->_service->__getLastRequest());
416
  $this->writeLog("Response Headers");
417
- $this->writeLog($this->_service->__getLastResponseHeaders());
418
  $this->writeLog("Response");
419
- $this->writeLog($this->_service->__getLastResponse());
 
 
 
 
 
 
 
 
 
 
 
420
  }
421
 
422
  /**
@@ -434,58 +516,13 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
434
  return $account;
435
  }
436
 
437
- /**
438
- * @desc init order object
439
- * @return Adyen_Payment_Model_Adyen_Abstract
440
- */
441
- protected function _initOrder() {
442
- if (!$this->_order) {
443
- $paymentInfo = $this->getInfoInstance();
444
- $this->_order = Mage::getModel('sales/order')
445
- ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId());
446
- }
447
- return $this;
448
- }
449
-
450
- /**
451
- * Void payment
452
- *
453
- * @param Varien_Object $invoicePayment
454
- * @return Mage_Payment_Model_Abstract
455
- */
456
- public function void(Varien_Object $payment) {
457
- parent::void();
458
- $this->cancel($payment);
459
- return $this;
460
- }
461
-
462
- /**
463
- * @todo fix me validate()
464
- * @see Mage_Payment_Model_Method_Abstract::validate()
465
- */
466
- public function validate() {
467
- return $this;
468
- }
469
-
470
- /**
471
- * @desc Cancel order
472
- * @param Varien_Object $payment
473
- * @param type $amount
474
- * @return Adyen_Payment_Model_Adyen_Abstract
475
- */
476
- public function cancel(Varien_Object $payment, $amount = null) {
477
- parent::cancel($payment);
478
- $this->writeLog("abstract -> cancel()" . get_class($this));
479
- return $this;
480
- }
481
-
482
  /**
483
  * @desc Adyen log fx
484
  * @param type $str
485
- * @return type
486
  */
487
  public function writeLog($str) {
488
- Mage::log($str, Zend_Log::DEBUG, "adyen_notification.log", true);
489
  return false;
490
  }
491
 
@@ -603,21 +640,29 @@ abstract class Adyen_Payment_Model_Adyen_Abstract extends Mage_Payment_Model_Met
603
  }
604
 
605
  public function getAvailableBoletoTypes() {
606
- $types = Mage::helper('adyen')->getBoletoTypes();
607
- $availableTypes = $this->_getConfigData('boletotypes', 'adyen_boleto');
608
- if ($availableTypes) {
609
- $availableTypes = explode(',', $availableTypes);
610
- foreach ($types as $code => $name) {
611
- if (!in_array($code, $availableTypes)) {
612
- unset($types[$code]);
613
- }
614
- }
615
- }
616
- return $types;
617
  }
618
 
619
  public function getConfigPaymentAction() {
620
  return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
621
  }
622
 
 
 
 
 
 
 
 
 
623
  }
44
  protected $_canUseForMultishipping = false;
45
  protected $_canRefundInvoicePartial = true;
46
 
47
+ /** @var Adyen_Payment_Helper_Pci */
48
+ protected $_pciHelper;
 
 
 
 
49
 
50
  /**
51
  * Magento Order Object
74
  protected $_testModificationUrl = 'https://pal-test.adyen.com/pal/adapter/httppost';
75
  protected $_liveModificationUrl = 'https://pal-live.adyen.com/pal/adapter/httppost';
76
 
77
+ protected $_paymentMethodType = 'api';
78
+
79
+ public function getPaymentMethodType() {
80
+ return $this->$_paymentMethodType;
81
+ }
82
+
83
  /**
84
  * @param Varien_Object $payment
85
  * @param unknown_type $amount
108
  * @param unknown_type $amount
109
  */
110
  public function authorize(Varien_Object $payment, $amount) {
111
+ parent::authorize($payment, $amount);
112
  $payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
113
+
114
+ $order = $payment->getOrder();
115
+ /*
116
+ * Do not send a email notification when order is created.
117
+ * Only do this on the AUHTORISATION notification.
118
+ * This is needed for old versions where there is no check if email is already send
119
+ */
120
+ $order->setCanSendNewEmailFlag(false);
121
+
122
+ if ($this->getCode() == 'adyen_boleto' || $this->getCode() == 'adyen_cc' || substr($this->getCode(), 0, 14) == 'adyen_oneclick' || $this->getCode() == 'adyen_elv' || $this->getCode() == 'adyen_sepa') {
123
+
124
+ if(substr($this->getCode(), 0, 14) == 'adyen_oneclick') {
125
+
126
+ // set payment method to adyen_oneclick otherwise backend can not view the order
127
+ $payment->setMethod("adyen_oneclick");
128
+
129
+ $recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
130
+
131
+ // load agreement based on reference_id (option to add an index on reference_id in database)
132
+ $agreement = Mage::getModel('sales/billing_agreement')->load($recurringDetailReference, 'reference_id');
133
+
134
+ // agreement could be a empty object
135
+ if ($agreement && $agreement->getAgreementId() > 0 && $agreement->isValid()) {
136
+ $agreement->addOrderRelation($order);
137
+ $agreement->setIsObjectChanged(true);
138
+ $order->addRelatedObject($agreement);
139
+ $message = Mage::helper('adyen')->__('Used existing billing agreement #%s.', $agreement->getReferenceId());
140
+
141
+ $comment = $order->addStatusHistoryComment($message);
142
+ $order->addRelatedObject($comment);
143
+ }
144
+ }
145
  $_authorizeResponse = $this->_processRequest($payment, $amount, "authorise");
146
  }
147
  return $this;
155
  public function capture(Varien_Object $payment, $amount) {
156
  parent::capture($payment, $amount);
157
  $payment->setStatus(self::STATUS_APPROVED)
158
+ ->setTransactionId($this->getTransactionId())
159
+ ->setIsTransactionClosed(0);
160
 
161
  // do capture request to adyen
162
  $order = $payment->getOrder();
165
 
166
  return $this;
167
  }
168
+
169
+ public function authorise3d(Varien_Object $payment, $amount) {
170
  $authorizeResponse = $this->_processRequest($payment, $amount, "authorise3d");
171
+ $responseCode = $authorizeResponse->paymentResult->resultCode;
172
+ return $responseCode;
173
+ }
174
 
175
  public function sendCaptureRequest(Varien_Object $payment, $amount, $pspReference) {
176
  if (empty($pspReference)) {
207
  * @param unknown_type $responseData
208
  */
209
  protected function _processRequest(Varien_Object $payment, $amount, $request, $pspReference = null) {
 
210
 
211
  if (Mage::app()->getStore()->isAdmin()) {
212
+ $storeId = $payment->getOrder()->getStoreId();
213
  } else {
214
  $storeId = null;
215
  }
220
  $enableMoto = (int) $this->_getConfigData('enable_moto', 'adyen_cc', $storeId);
221
  $modificationResult = Mage::getModel('adyen/adyen_data_modificationResult');
222
  $requestData = Mage::getModel('adyen/adyen_data_modificationRequest')
223
+ ->create($payment, $amount, $merchantAccount, $pspReference);
224
 
225
  switch ($request) {
226
  case "authorise":
227
  $requestData = Mage::getModel('adyen/adyen_data_paymentRequest')
228
+ ->create($payment, $amount, $this->_paymentMethod, $merchantAccount,$recurringType, $enableMoto);
229
 
230
  $response = $this->_service->authorise(array('paymentRequest' => $requestData));
231
  break;
232
  case "authorise3d":
233
  $requestData = Mage::getModel('adyen/adyen_data_paymentRequest3d')
234
+ ->create($payment, $merchantAccount);
235
+
236
  $response = $this->_service->authorise3d(array('paymentRequest3d' => $requestData));
237
  break;
238
  case "capture":
256
  $this->_processResponse($payment, $response, $request);
257
  }
258
 
259
+ /*
260
+ * clear the cache for recurring payments so new card will be added
261
+ */
262
+ $cacheKey = $merchantAccount . "|" . $payment->getOrder()->getCustomerId() . "|" . $recurringType;
263
+ Mage::app()->getCache()->remove($cacheKey);
264
+
265
  //debug || log
266
+ Mage::getResourceModel('adyen/adyen_debug')->assignData($response);
267
+ $this->_debugAdyen();
268
+ Mage::log($this->_pci()->obscureSensitiveData($requestData), self::DEBUG_LEVEL, "$request.log", true);
269
+ Mage::log("Response from Adyen:", self::DEBUG_LEVEL, "$request.log", true);
270
+ Mage::log($this->_pci()->obscureSensitiveData($response), self::DEBUG_LEVEL, "$request.log", true);
271
 
272
  //return $this;
273
  return $response;
299
  switch ($request) {
300
  case "authorise":
301
  case "authorise3d":
302
+ if($response->paymentResult->fraudResult) {
303
+ $fraudResult = $response->paymentResult->fraudResult->accountScore;
304
+ $payment->setAdyenTotalFraudScore($fraudResult);
305
+ }
306
  $responseCode = $response->paymentResult->resultCode;
307
  $pspReference = $response->paymentResult->pspReference;
308
+
309
+ // save pspreference to match with notification
310
+ $payment->setAdyenPspReference($pspReference);
311
+
312
  break;
313
  case "refund":
314
  $responseCode = $response->refundResult->response;
329
  switch ($responseCode) {
330
 
331
  case "RedirectShopper":
332
+ $payment->setAdditionalInformation('paRequest', $response->paymentResult->paRequest);
333
+ $payment->setAdditionalInformation('md', $response->paymentResult->md);
334
+ $payment->setAdditionalInformation('issuerUrl', $response->paymentResult->issuerUrl);
335
+ Mage::getSingleton('customer/session')->setRedirectUrl("adyen/process/validate3d");
336
+ $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
337
  break;
338
  case "Refused":
339
+
340
+ if($response->paymentResult->refusalReason) {
341
+
342
+ $refusalReason = $response->paymentResult->refusalReason;
343
+ switch($refusalReason) {
344
+ case "Transaction Not Permitted":
345
+ $errorMsg = Mage::helper('adyen')->__('The transaction is not permitted.');
346
+ break;
347
+ case "CVC Declined":
348
+ $errorMsg = Mage::helper('adyen')->__('Declined due to the Card Security Code(CVC) being incorrect. Please check your CVC code!');
349
+ break;
350
+ case "Restricted Card":
351
+ $errorMsg = Mage::helper('adyen')->__('The card is restricted.');
352
+ break;
353
+ default:
354
+ $errorMsg = Mage::helper('adyen')->__('The payment is REFUSED by Adyen.');
355
+ break;
356
+ }
357
+ } else {
358
+ $errorMsg = Mage::helper('adyen')->__('The payment is REFUSED by Adyen.');
359
+ }
360
+
361
  Mage::throwException($errorMsg);
362
  break;
363
  case "Authorised":
364
  $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
365
  break;
366
  case "Received": // boleto payment
367
+ $pdfUrl = null;
368
+ $additionalDataResults = $response->paymentResult->additionalData->entry;
369
+ foreach($additionalDataResults as $additionalDataResult) {
370
+ if($additionalDataResult->key == "boletobancario.url") {
371
+ $pdfUrl = $additionalDataResult->value;
372
+ }
373
+ }
374
+ $this->_addStatusHistory($payment, $responseCode, $pspReference, false, $pdfUrl);
375
+ break;
376
  case '[capture-received]':
377
  case '[refund-received]':
378
  case '[cancelOrRefund-received]':
389
 
390
  //save all response data for a pure duplicate detection
391
  Mage::getModel('adyen/event')
392
+ ->setPspReference($pspReference)
393
+ ->setAdyenEventCode($responseCode)
394
+ ->setAdyenEventResult($responseCode)
395
+ ->setIncrementId($payment->getOrder()->getIncrementId())
396
+ ->setPaymentMethod($this->getInfoInstance()->getCcType())
397
+ ->setCreatedAt(now())
398
+ ->saveData()
399
  ;
400
  return $this;
401
  }
407
  * @param unknown_type $pspReference
408
  */
409
  protected function _addStatusHistory(Varien_Object $payment, $responseCode, $pspReference, $status = false, $boletoPDF = null) {
 
 
 
410
 
411
+ if($boletoPDF)
412
+ $payment->getOrder()->setAdyenBoletoPdf($boletoPDF);
413
+
414
+ $type = 'Adyen Result URL Notification(s):';
415
+ $comment = Mage::helper('adyen')->__('%s <br /> authResult: %s <br /> pspReference: %s <br /> paymentMethod: %s', $type, $responseCode, $pspReference, "");
416
  $payment->getOrder()->setAdyenEventCode($responseCode);
417
+ $payment->getOrder()->addStatusHistoryComment($comment, $status);
418
  $payment->setAdyenEventCode($responseCode);
419
  return $this;
420
  }
430
 
431
  /**
432
  * @desc Get SOAP client
433
+ * @return Adyen_Payment_Model_Adyen_Abstract
434
  */
435
  protected function _initService($storeId = null) {
436
  $accountData = $this->getAccountData($storeId);
441
  $classmap = new Adyen_Payment_Model_Adyen_Data_Classmap();
442
  try {
443
  $this->_service = new SoapClient($wsdl, array(
444
+ 'login' => $login,
445
+ 'password' => $password,
446
+ 'soap_version' => SOAP_1_1,
447
+ 'style' => SOAP_DOCUMENT,
448
+ 'use' => SOAP_LITERAL,
449
+ 'location' => $location,
450
+ 'trace' => 1,
451
+ 'classmap' => $classmap));
452
  } catch (SoapFault $fault) {
453
  $this->writeLog("Adyen SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})");
454
  Mage::throwException(Mage::helper('adyen')->__('Can not connect payment service. Please try again later.'));
458
 
459
  /**
460
  * @desc soap urls
461
+ * @return string
462
  */
463
  protected function _getAdyenUrls($storeId = null) {
464
  $test = array(
481
  */
482
  protected function _debugAdyen() {
483
  $this->writeLog("Request Headers: ");
484
+ $this->writeLog($this->_pci()->obscureSensitiveData($this->_service->__getLastRequestHeaders()));
485
  $this->writeLog("Request:");
486
+ $this->writeLog($this->_pci()->obscureSensitiveData(($this->_service->__getLastRequest())));
487
  $this->writeLog("Response Headers");
488
+ $this->writeLog($this->_pci()->obscureSensitiveData(($this->_service->__getLastResponseHeaders())));
489
  $this->writeLog("Response");
490
+ $this->writeLog($this->_pci()->obscureSensitiveData(($this->_service->__getLastResponse())));
491
+ }
492
+
493
+ /**
494
+ * @return Adyen_Payment_Helper_Pci
495
+ */
496
+ protected function _pci()
497
+ {
498
+ if (!isset($this->_pciHelper)) {
499
+ $this->_pciHelper = Mage::helper('adyen/pci');
500
+ }
501
+ return $this->_pciHelper;
502
  }
503
 
504
  /**
516
  return $account;
517
  }
518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
  /**
520
  * @desc Adyen log fx
521
  * @param type $str
522
+ * @return type
523
  */
524
  public function writeLog($str) {
525
+ Mage::log($this->_pci()->obscureSensitiveData($str), Zend_Log::DEBUG, "adyen_notification.log", true);
526
  return false;
527
  }
528
 
640
  }
641
 
642
  public function getAvailableBoletoTypes() {
643
+ $types = Mage::helper('adyen')->getBoletoTypes();
644
+ $availableTypes = $this->_getConfigData('boletotypes', 'adyen_boleto');
645
+ if ($availableTypes) {
646
+ $availableTypes = explode(',', $availableTypes);
647
+ foreach ($types as $code => $name) {
648
+ if (!in_array($code, $availableTypes)) {
649
+ unset($types[$code]);
650
+ }
651
+ }
652
+ }
653
+ return $types;
654
  }
655
 
656
  public function getConfigPaymentAction() {
657
  return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
658
  }
659
 
660
+ protected function _initOrder() {
661
+ if (!$this->_order) {
662
+ $paymentInfo = $this->getInfoInstance();
663
+ $this->_order = $paymentInfo->getOrder();
664
+ }
665
+ return $this;
666
+ }
667
+
668
  }
app/code/community/Adyen/Payment/Model/Adyen/Boleto.php CHANGED
@@ -33,6 +33,7 @@ class Adyen_Payment_Model_Adyen_Boleto extends Adyen_Payment_Model_Adyen_Abstrac
33
  protected $_paymentMethod = 'boleto';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
 
36
 
37
  public function __construct()
38
  {
33
  protected $_paymentMethod = 'boleto';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
36
+ protected $_canUseForMultishipping = true;
37
 
38
  public function __construct()
39
  {
app/code/community/Adyen/Payment/Model/Adyen/Cash.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Adyen_Cash extends Adyen_Payment_Model_Adyen_Abstract {
29
+
30
+ protected $_code = 'adyen_cash';
31
+ protected $_formBlockType = 'adyen/form_cash';
32
+ protected $_infoBlockType = 'adyen/info_cash';
33
+ protected $_paymentMethod = 'cash';
34
+ protected $_canUseCheckout = true;
35
+ protected $_canUseInternal = true;
36
+ protected $_canUseForMultishipping = true;
37
+
38
+
39
+ public function __construct()
40
+ {
41
+ // check if this is adyen_cc payment method because this function is as well used for oneclick payments
42
+ if($this->getCode() == "adyen_cash") {
43
+ $visible = Mage::getStoreConfig("payment/adyen_cash/visible_type");
44
+ if($visible == "backend") {
45
+ $this->_canUseCheckout = false;
46
+ $this->_canUseInternal = true;
47
+ } else if($visible == "frontend") {
48
+ $this->_canUseCheckout = true;
49
+ $this->_canUseInternal = false;
50
+ } else {
51
+ $this->_canUseCheckout = true;
52
+ $this->_canUseInternal = true;
53
+ }
54
+ }
55
+ parent::__construct();
56
+ }
57
+
58
+ public function assignData($data)
59
+ {
60
+
61
+ }
62
+
63
+
64
+ public function authorize(Varien_Object $payment, $amount) {
65
+
66
+
67
+ $payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
68
+
69
+ $order = $payment->getOrder();
70
+
71
+ /*
72
+ * Do not send a email notification when order is created.
73
+ * Only do this on the AUHTORISATION notification.
74
+ * This is needed for old versions where there is no check if email is already send
75
+ */
76
+ $order->setCanSendNewEmailFlag(false);
77
+
78
+ if (Mage::app()->getStore()->isAdmin()) {
79
+ $storeId = $payment->getOrder()->getStoreId();
80
+ } else {
81
+ $storeId = null;
82
+ }
83
+
84
+ $merchantAccount = trim($this->_getConfigData('merchantAccount', 'adyen_abstract', $storeId));
85
+ $incrementId = $order->getIncrementId();
86
+ $orderCurrencyCode = $order->getOrderCurrencyCode();
87
+ $customerId = $order->getCustomerId();
88
+ $amount = Mage::helper('adyen')->formatAmount($amount, $orderCurrencyCode);
89
+
90
+ // do cash API
91
+ $request = array(
92
+ "merchantAccount" => $merchantAccount,
93
+ "shopperReference" => $customerId,
94
+ "variantCode" => 'c_cash',
95
+ "reference" => $incrementId,
96
+ "amount.value" => $amount,
97
+ "amount.currency" => $orderCurrencyCode
98
+ );
99
+
100
+ $ch = curl_init();
101
+
102
+ $isConfigDemoMode = $this->getConfigDataDemoMode($storeId = null);
103
+ $wsUsername = $this->getConfigDataWsUserName($storeId);
104
+ $wsPassword = $this->getConfigDataWsPassword($storeId);
105
+
106
+ if ($isConfigDemoMode)
107
+ {
108
+ curl_setopt($ch, CURLOPT_URL, "https://pal-test.adyen.com/pal/servlet/CustomPayment/beginCustomPayment");
109
+ }
110
+ else
111
+ {
112
+ curl_setopt($ch, CURLOPT_URL, "https://pal-live.adyen.com/pal/servlet/CustomPayment/beginCustomPayment");
113
+ }
114
+
115
+ curl_setopt($ch, CURLOPT_HEADER, false);
116
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
117
+ curl_setopt($ch, CURLOPT_USERPWD,$wsUsername.":".$wsPassword);
118
+ curl_setopt($ch, CURLOPT_POST,count($request));
119
+ curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($request));
120
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
121
+
122
+ $results = curl_exec($ch);
123
+
124
+ $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
125
+
126
+ if ($httpStatus != 200) {
127
+ Mage::throwException(
128
+ Mage::helper('adyen')->__('HTTP Status code %s received, data %s', $httpStatus, $results)
129
+ );
130
+ }
131
+
132
+ if ($results === false) {
133
+ Mage::throwException(
134
+ Mage::helper('adyen')->__('Got an empty response, status code %s', $httpStatus)
135
+ );
136
+ }
137
+ }
138
+ }
app/code/community/Adyen/Payment/Model/Adyen/Cc.php CHANGED
@@ -33,6 +33,7 @@ class Adyen_Payment_Model_Adyen_Cc extends Adyen_Payment_Model_Adyen_Abstract {
33
  protected $_paymentMethod = 'cc';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
 
36
 
37
  public function __construct()
38
  {
@@ -64,7 +65,7 @@ class Adyen_Payment_Model_Adyen_Cc extends Adyen_Payment_Model_Adyen_Abstract {
64
 
65
  if (!($data instanceof Varien_Object)) {
66
  $data = new Varien_Object($data);
67
- }
68
  $info = $this->getInfoInstance();
69
 
70
  // set number of installements
@@ -79,22 +80,21 @@ class Adyen_Payment_Model_Adyen_Cc extends Adyen_Payment_Model_Adyen_Abstract {
79
  }
80
  else {
81
  $info->setCcType($data->getCcType())
82
- ->setCcOwner($data->getCcOwner())
83
- ->setCcLast4(substr($data->getCcNumber(), -4))
84
- ->setCcNumber($data->getCcNumber())
85
- ->setCcExpMonth($data->getCcExpMonth())
86
- ->setCcExpYear($data->getCcExpYear())
87
- ->setCcCid($data->getCcCid())
88
- ->setPoNumber($data->getAdditionalData());
89
  }
90
 
91
- // recalculate the totals so that extra fee is defined
92
- $quote = (Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();
93
- $quote->setTotalsCollectedFlag(false);
94
- $quote->collectTotals();
95
- // not needed
96
- // $quote->save();
97
-
98
 
99
  return $this;
100
  }
@@ -121,13 +121,6 @@ class Adyen_Payment_Model_Adyen_Cc extends Adyen_Payment_Model_Adyen_Abstract {
121
  return $result;
122
  }
123
 
124
- /**
125
- * @desc Called just after asssign data
126
- */
127
- public function prepareSave() {
128
- parent::prepareSave();
129
- }
130
-
131
  /**
132
  * @desc Helper functions to get config data
133
  */
@@ -150,48 +143,52 @@ class Adyen_Payment_Model_Adyen_Cc extends Adyen_Payment_Model_Adyen_Abstract {
150
  return trim(Mage::getStoreConfig("payment/adyen_cc/cse_publickey"));
151
  }
152
 
153
- public function getRecurringType() {
154
- return trim(Mage::getStoreConfig("payment/adyen_abstract/recurringtypes"));
 
 
 
 
155
  }
156
-
157
  /**
158
  * @desc Specific functions for 3d secure validation
159
  */
160
-
161
- public function getOrderPlaceRedirectUrl() {
162
- $redirectUrl = Mage::getSingleton('customer/session')->getRedirectUrl();
163
-
164
- if (!empty($redirectUrl)) {
165
- Mage::getSingleton('customer/session')->unsRedirectUrl();
166
- return Mage::getUrl($redirectUrl);
167
- }
168
- else {
169
- return parent::getOrderPlaceRedirectUrl();
170
- }
171
  }
172
-
173
- public function getFormUrl() {
174
- $this->_initOrder();
175
- $order = $this->_order;
176
- $payment = $order->getPayment();
177
- return $payment->getAdditionalInformation('issuerUrl');
178
- }
179
-
180
- public function getFormName() {
181
- return "Adyen CC";
182
- }
183
-
184
- public function getFormFields() {
185
- $this->_initOrder();
186
- $order = $this->_order;
187
- $payment = $order->getPayment();
188
-
189
- $adyFields = array();
190
- $adyFields['PaReq'] = $payment->getAdditionalInformation('paRequest');
191
- $adyFields['MD'] = $payment->getAdditionalInformation('md');
192
- $adyFields['TermUrl'] = Mage::getUrl('adyen/process/validate3d');
193
-
194
  return $adyFields;
195
- }
196
 
197
  }
33
  protected $_paymentMethod = 'cc';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
36
+ protected $_canUseForMultishipping = true;
37
 
38
  public function __construct()
39
  {
65
 
66
  if (!($data instanceof Varien_Object)) {
67
  $data = new Varien_Object($data);
68
+ }
69
  $info = $this->getInfoInstance();
70
 
71
  // set number of installements
80
  }
81
  else {
82
  $info->setCcType($data->getCcType())
83
+ ->setCcOwner($data->getCcOwner())
84
+ ->setCcLast4(substr($data->getCcNumber(), -4))
85
+ ->setCcNumber($data->getCcNumber())
86
+ ->setCcExpMonth($data->getCcExpMonth())
87
+ ->setCcExpYear($data->getCcExpYear())
88
+ ->setCcCid($data->getCcCid())
89
+ ->setPoNumber($data->getAdditionalData());
90
  }
91
 
92
+ if($info->getAdditionalInformation('number_of_installments') != "") {
93
+ // recalculate the totals so that extra fee is defined
94
+ $quote = (Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();
95
+ $quote->setTotalsCollectedFlag(false);
96
+ $quote->collectTotals();
97
+ }
 
98
 
99
  return $this;
100
  }
121
  return $result;
122
  }
123
 
 
 
 
 
 
 
 
124
  /**
125
  * @desc Helper functions to get config data
126
  */
143
  return trim(Mage::getStoreConfig("payment/adyen_cc/cse_publickey"));
144
  }
145
 
146
+ public function showRememberThisCheckoutbox() {
147
+ $recurringType = $this->_getConfigData('recurringtypes');
148
+ if($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
149
+ return true;
150
+ }
151
+ return false;
152
  }
153
+
154
  /**
155
  * @desc Specific functions for 3d secure validation
156
  */
157
+
158
+ public function getOrderPlaceRedirectUrl() {
159
+ $redirectUrl = Mage::getSingleton('customer/session')->getRedirectUrl();
160
+
161
+ if (!empty($redirectUrl)) {
162
+ Mage::getSingleton('customer/session')->unsRedirectUrl();
163
+ return Mage::getUrl($redirectUrl);
164
+ }
165
+ else {
166
+ return parent::getOrderPlaceRedirectUrl();
167
+ }
168
  }
169
+
170
+ public function getFormUrl() {
171
+ $this->_initOrder();
172
+ $order = $this->_order;
173
+ $payment = $order->getPayment();
174
+ return $payment->getAdditionalInformation('issuerUrl');
175
+ }
176
+
177
+ public function getFormName() {
178
+ return "Adyen CC";
179
+ }
180
+
181
+ public function getFormFields() {
182
+ $this->_initOrder();
183
+ $order = $this->_order;
184
+ $payment = $order->getPayment();
185
+
186
+ $adyFields = array();
187
+ $adyFields['PaReq'] = $payment->getAdditionalInformation('paRequest');
188
+ $adyFields['MD'] = $payment->getAdditionalInformation('md');
189
+ $adyFields['TermUrl'] = Mage::getUrl('adyen/process/validate3d');
190
+
191
  return $adyFields;
192
+ }
193
 
194
  }
app/code/community/Adyen/Payment/Model/Adyen/Data/Abstract.php CHANGED
@@ -25,7 +25,7 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Adyen_Data_Abstract {
29
 
30
  /**
31
  * Zend_Log debug level
@@ -36,4 +36,70 @@ class Adyen_Payment_Model_Adyen_Data_Abstract {
36
  protected function _getCheckout() {
37
  return Mage::getSingleton('checkout/session');
38
  }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Adyen_Data_Abstract implements ArrayAccess {
29
 
30
  /**
31
  * Zend_Log debug level
36
  protected function _getCheckout() {
37
  return Mage::getSingleton('checkout/session');
38
  }
39
+
40
+ /**
41
+ * Whether an offset exists
42
+ * @link http://php.net/manual/en/arrayaccess.offsetexists.php
43
+ * @param mixed $offset An offset to check for.
44
+ * @return boolean true on success or false on failure.
45
+ *
46
+ * The return value will be casted to boolean if non-boolean was returned.
47
+ */
48
+ public function offsetExists($offset)
49
+ {
50
+ return array_key_exists($offset, get_object_vars($this));
51
+ }
52
+
53
+ /**
54
+ * Offset to retrieve
55
+ * @link http://php.net/manual/en/arrayaccess.offsetget.php
56
+ * @param mixed $offset
57
+ * The offset to retrieve.
58
+ * @return mixed Can return all value types.
59
+ */
60
+ public function offsetGet($offset)
61
+ {
62
+ if ($this->offsetExists($offset)) {
63
+ $values = get_object_vars($this);
64
+ return $values[$offset];
65
+ }
66
+
67
+ return null;
68
+ }
69
+
70
+ /**
71
+ * Offset to set
72
+ * @link http://php.net/manual/en/arrayaccess.offsetset.php
73
+ * @param mixed $offset
74
+ * The offset to assign the value to.
75
+ * @param mixed $value
76
+ * The value to set.
77
+ * @return void
78
+ */
79
+ public function offsetSet($offset, $value)
80
+ {
81
+ if (property_exists(get_class($this), $offset)) {
82
+ $property = new ReflectionProperty(get_class($this), $offset);
83
+ if ($property->isPublic()) {
84
+ $this->$offset = $value;
85
+ }
86
+ return;
87
+ }
88
+
89
+ $this->$offset = $value;
90
+ }
91
+
92
+ /**
93
+ * Offset to unset
94
+ * @link http://php.net/manual/en/arrayaccess.offsetunset.php
95
+ * @param mixed $offset
96
+ * The offset to unset.
97
+ * @return void
98
+ */
99
+ public function offsetUnset($offset)
100
+ {
101
+ if ($this->offsetExists($offset)) {
102
+ unset($this->$offset);
103
+ }
104
+ }
105
+ }
app/code/community/Adyen/Payment/Model/Adyen/Data/Address.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Adyen_Data_Address extends Adyen_Payment_Model_Adyen_Data_Abstract {
29
+
30
+ public $street;
31
+ public $postalCode;
32
+ public $city;
33
+ public $houseNumberOrName;
34
+ public $stateOrProvince;
35
+ public $country;
36
+
37
+
38
+ }
app/code/community/Adyen/Payment/Model/Adyen/Data/BillingAddress.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Adyen_Data_BillingAddress extends Adyen_Payment_Model_Adyen_Data_Address {
29
+
30
+ }
app/code/community/Adyen/Payment/Model/Adyen/Data/DeliveryAddress.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Adyen_Data_DeliveryAddress extends Adyen_Payment_Model_Adyen_Data_Address {
29
+
30
+ }
app/code/community/Adyen/Payment/Model/Adyen/Data/ModificationRequest.php CHANGED
@@ -34,7 +34,9 @@ class Adyen_Payment_Model_Adyen_Data_ModificationRequest extends Adyen_Payment_M
34
  public $modificationAmount;
35
  public $originalReference;
36
 
37
- public function create(Varien_Object $payment, $amount, $order, $merchantAccount, $pspReference = null) {
 
 
38
  $currency = $order->getOrderCurrencyCode();
39
  $incrementId = $order->getIncrementId();
40
 
34
  public $modificationAmount;
35
  public $originalReference;
36
 
37
+ public function create(Varien_Object $payment, $amount, $merchantAccount, $pspReference = null)
38
+ {
39
+ $order = $payment->getOrder();
40
  $currency = $order->getOrderCurrencyCode();
41
  $incrementId = $order->getIncrementId();
42
 
app/code/community/Adyen/Payment/Model/Adyen/Data/PaymentRequest.php CHANGED
@@ -34,6 +34,7 @@ class Adyen_Payment_Model_Adyen_Data_PaymentRequest extends Adyen_Payment_Model_
34
  public $card;
35
  public $dccQuote;
36
  public $deliveryAddress;
 
37
  public $elv;
38
  public $fraudOffset;
39
  public $merchantAccount;
@@ -64,7 +65,9 @@ class Adyen_Payment_Model_Adyen_Data_PaymentRequest extends Adyen_Payment_Model_
64
  $this->bankAccount = new Adyen_Payment_Model_Adyen_Data_BankAccount(); // for SEPA
65
  }
66
 
67
- public function create(Varien_Object $payment, $amount, $order, $paymentMethod = null, $merchantAccount = null, $recurringType = null, $enableMoto = null) {
 
 
68
  $incrementId = $order->getIncrementId();
69
  $orderCurrencyCode = $order->getOrderCurrencyCode();
70
  // override amount because this amount uses the right currency
@@ -123,6 +126,32 @@ class Adyen_Payment_Model_Adyen_Data_PaymentRequest extends Adyen_Payment_Model_
123
  $this->shopperName = null;
124
  $this->elv = null;
125
  $this->bankAccount = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  if($paymentMethod == "oneclick") {
128
  $recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
@@ -137,37 +166,56 @@ class Adyen_Payment_Model_Adyen_Data_PaymentRequest extends Adyen_Payment_Model_
137
  $this->shopperInteraction = "Ecommerce";
138
  }
139
 
140
-
141
- if(Mage::app()->getStore()->isAdmin() && $enableMoto != null && $enableMoto == 1) {
142
  $this->shopperInteraction = "Moto";
143
  }
144
 
 
 
 
 
 
 
 
 
 
145
  if (Mage::getModel('adyen/adyen_cc')->isCseEnabled()) {
146
 
147
- if($recurringDetailReference && $recurringDetailReference != "") {
148
- $this->selectedRecurringDetailReference = $recurringDetailReference;
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
-
151
- $this->card = null;
152
- $kv = new Adyen_Payment_Model_Adyen_Data_AdditionalDataKVPair();
153
- $kv->key = new SoapVar("card.encrypted.json", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
154
- $kv->value = new SoapVar($payment->getAdditionalInformation("encrypted_data"), XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
155
- $this->additionalData->entry = $kv;
156
  }
157
  else {
158
 
159
  if($recurringDetailReference && $recurringDetailReference != "") {
160
- $this->selectedRecurringDetailReference = $recurringDetailReference;
161
 
162
- if($recurringType != "RECURRING") {
163
- $this->card->cvc = $payment->getCcCid();
164
- }
 
 
 
165
 
166
- // TODO: check if expirymonth and year is changed if so add this in the card object
167
- $this->card->expiryMonth = $payment->getCcExpMonth();
168
- $this->card->expiryYear = $payment->getCcExpYear();
 
 
169
 
170
  } else {
 
171
  $this->card->cvc = $payment->getCcCid();
172
  $this->card->expiryMonth = $payment->getCcExpMonth();
173
  $this->card->expiryYear = $payment->getCcExpYear();
34
  public $card;
35
  public $dccQuote;
36
  public $deliveryAddress;
37
+ public $billingAddress;
38
  public $elv;
39
  public $fraudOffset;
40
  public $merchantAccount;
65
  $this->bankAccount = new Adyen_Payment_Model_Adyen_Data_BankAccount(); // for SEPA
66
  }
67
 
68
+ public function create(Varien_Object $payment, $amount, $paymentMethod = null, $merchantAccount = null, $recurringType = null, $enableMoto = null)
69
+ {
70
+ $order = $payment->getOrder();
71
  $incrementId = $order->getIncrementId();
72
  $orderCurrencyCode = $order->getOrderCurrencyCode();
73
  // override amount because this amount uses the right currency
126
  $this->shopperName = null;
127
  $this->elv = null;
128
  $this->bankAccount = null;
129
+ $this->deliveryAddress = new Adyen_Payment_Model_Adyen_Data_DeliveryAddress();
130
+ $this->billingAddress = new Adyen_Payment_Model_Adyen_Data_BillingAddress();
131
+
132
+ $billingAddress = $order->getBillingAddress();
133
+ $helper = Mage::helper('adyen');
134
+
135
+ if($billingAddress)
136
+ {
137
+ $this->billingAddress->street = $helper->getStreet($billingAddress)->getName();
138
+ $this->billingAddress->houseNumberOrName = $helper->getStreet($billingAddress)->getHouseNumber();
139
+ $this->billingAddress->city = $billingAddress->getCity();
140
+ $this->billingAddress->postalCode = $billingAddress->getPostcode();
141
+ $this->billingAddress->stateOrProvince = $billingAddress->getRegionCode();
142
+ $this->billingAddress->country = $billingAddress->getCountryId();
143
+ }
144
+
145
+ $deliveryAddress = $order->getShippingAddress();
146
+ if($deliveryAddress)
147
+ {
148
+ $this->deliveryAddress->street = $helper->getStreet($billingAddress)->getName();
149
+ $this->deliveryAddress->houseNumberOrName = $helper->getStreet($billingAddress)->getHouseNumber();
150
+ $this->deliveryAddress->city = $billingAddress->getCity();
151
+ $this->deliveryAddress->postalCode = $billingAddress->getPostcode();
152
+ $this->deliveryAddress->stateOrProvince = $billingAddress->getRegionCode();
153
+ $this->deliveryAddress->country = $billingAddress->getCountryId();
154
+ }
155
 
156
  if($paymentMethod == "oneclick") {
157
  $recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
166
  $this->shopperInteraction = "Ecommerce";
167
  }
168
 
169
+ if($paymentMethod == "adyen_cc" && Mage::app()->getStore()->isAdmin() && $enableMoto != null && $enableMoto == 1) {
 
170
  $this->shopperInteraction = "Moto";
171
  }
172
 
173
+ // if it is a sepadirectdebit set selectedBrand to sepadirectdebit
174
+ if($payment->getCcType() == "sepadirectdebit") {
175
+ $this->selectedBrand = "sepadirectdebit";
176
+ }
177
+
178
+ if($recurringDetailReference && $recurringDetailReference != "") {
179
+ $this->selectedRecurringDetailReference = $recurringDetailReference;
180
+ }
181
+
182
  if (Mage::getModel('adyen/adyen_cc')->isCseEnabled()) {
183
 
184
+ // this is only needed for creditcards
185
+ if($payment->getAdditionalInformation("encrypted_data") != "") {
186
+ $this->card = null;
187
+ $kv = new Adyen_Payment_Model_Adyen_Data_AdditionalDataKVPair();
188
+ $kv->key = new SoapVar("card.encrypted.json", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
189
+ $kv->value = new SoapVar($payment->getAdditionalInformation("encrypted_data"), XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
190
+ $this->additionalData->entry = $kv;
191
+ } else {
192
+ if($paymentMethod == 'cc') {
193
+ // For CC encrypted data is needed if you use CSE
194
+ Mage::throwException(
195
+ Mage::helper('adyen')->__('Missing the encrypted data value. Make sure the Client Side Encryption(CSE) script did encrypt the Credit Card details')
196
+ );
197
+ }
198
  }
 
 
 
 
 
 
199
  }
200
  else {
201
 
202
  if($recurringDetailReference && $recurringDetailReference != "") {
 
203
 
204
+ // this is only needed for creditcards
205
+ if($payment->getCcCid() != "" && $payment->getCcExpMonth() != "" && $payment->getCcExpYear() != "")
206
+ {
207
+ if($recurringType != "RECURRING") {
208
+ $this->card->cvc = $payment->getCcCid();
209
+ }
210
 
211
+ $this->card->expiryMonth = $payment->getCcExpMonth();
212
+ $this->card->expiryYear = $payment->getCcExpYear();
213
+ } else {
214
+ $this->card = null;
215
+ }
216
 
217
  } else {
218
+ // this is only the case for adyen_cc payments
219
  $this->card->cvc = $payment->getCcCid();
220
  $this->card->expiryMonth = $payment->getCcExpMonth();
221
  $this->card->expiryYear = $payment->getCcExpYear();
app/code/community/Adyen/Payment/Model/Adyen/Data/PaymentRequest3d.php CHANGED
@@ -37,13 +37,12 @@ class Adyen_Payment_Model_Adyen_Data_PaymentRequest3d extends Adyen_Payment_Mode
37
  $this->browserInfo = new Adyen_Payment_Model_Adyen_Data_BrowserInfo();
38
  }
39
 
40
- public function create(Varien_Object $payment, $amount, $order, $paymentMethod = null, $merchantAccount = null) {
41
- $this->merchantAccount = $merchantAccount;
42
-
43
  $this->browserInfo->acceptHeader = $_SERVER['HTTP_ACCEPT'];
44
  $this->browserInfo->userAgent = $_SERVER['HTTP_USER_AGENT'];
45
  $this->shopperIP = $_SERVER['REMOTE_ADDR'];
46
-
47
  $this->md = $payment->getAdditionalInformation('md');
48
  $this->paResponse = $payment->getAdditionalInformation('paResponse');
49
  return $this;
37
  $this->browserInfo = new Adyen_Payment_Model_Adyen_Data_BrowserInfo();
38
  }
39
 
40
+ public function create(Varien_Object $payment, $merchantAccount)
41
+ {
42
+ $this->merchantAccount = $merchantAccount;
43
  $this->browserInfo->acceptHeader = $_SERVER['HTTP_ACCEPT'];
44
  $this->browserInfo->userAgent = $_SERVER['HTTP_USER_AGENT'];
45
  $this->shopperIP = $_SERVER['REMOTE_ADDR'];
 
46
  $this->md = $payment->getAdditionalInformation('md');
47
  $this->paResponse = $payment->getAdditionalInformation('paResponse');
48
  return $this;
app/code/community/Adyen/Payment/Model/Adyen/Elv.php CHANGED
@@ -33,6 +33,7 @@ class Adyen_Payment_Model_Adyen_Elv extends Adyen_Payment_Model_Adyen_Abstract {
33
  protected $_paymentMethod = 'elv';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
 
36
 
37
  public function __construct()
38
  {
33
  protected $_paymentMethod = 'elv';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
36
+ protected $_canUseForMultishipping = true;
37
 
38
  public function __construct()
39
  {
app/code/community/Adyen/Payment/Model/Adyen/Hpp.php CHANGED
@@ -13,11 +13,14 @@
13
  * obtain it through the world-wide-web, please send an email
14
  * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
- * @category Adyen
17
- * @package Adyen_Payment
18
- * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
 
 
 
21
  /**
22
  * @category Payment Gateway
23
  * @package Adyen_Payment
@@ -25,11 +28,8 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Adyen_Hpp extends Adyen_Payment_Model_Adyen_Abstract {
29
- /**
30
- * @var DUMMY_EMAIL used when email is empty
31
- */
32
- const DUMMY_EMAIL = 'dummy@dummy.com';
33
  /**
34
  * @var GUEST_ID , used when order is placed by guests
35
  */
@@ -40,142 +40,174 @@ class Adyen_Payment_Model_Adyen_Hpp extends Adyen_Payment_Model_Adyen_Abstract {
40
  protected $_formBlockType = 'adyen/form_hpp';
41
  protected $_infoBlockType = 'adyen/info_hpp';
42
  protected $_paymentMethod = 'hpp';
43
- protected $_testModificationUrl = 'https://pal-test.adyen.com/pal/adapter/httppost';
44
- protected $_liveModificationUrl = 'https://pal-live.adyen.com/pal/adapter/httppost';
45
  protected $_isInitializeNeeded = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * @desc Get checkout session namespace
48
  *
49
  * @return Mage_Checkout_Model_Session
50
  */
51
- public function getCheckout() {
 
52
  return Mage::getSingleton('checkout/session');
53
  }
54
 
55
- public function assignData($data) {
 
56
  if (!($data instanceof Varien_Object)) {
57
  $data = new Varien_Object($data);
58
  }
59
- $info = $this->getInfoInstance();
60
- $hppType = $data->getHppType();
 
61
 
62
- // get the label name and save it so we can show it in the information tab
63
- $hppTypeLabel = "hpp_type_label_";
64
- $hppTypeLabelValue = $data->getData($hppTypeLabel . $hppType);
65
- $info->setAdditionalInformation('hpp_type_label', $hppTypeLabelValue);
66
 
67
  $info->setCcType($hppType)
68
- ->setPoNumber($data->getData('hpp_ideal_type')); /* @note misused field */
 
69
  $config = Mage::getStoreConfig("payment/adyen_hpp/disable_hpptypes");
70
  if (empty($hppType) && empty($config)) {
71
- Mage::throwException(Mage::helper('adyen')->__('Payment Method is complusory in order to process your payment'));
 
 
72
  }
73
  return $this;
74
  }
75
 
 
76
  public function validate()
77
  {
78
  parent::validate();
79
-
80
- $info = $this->getInfoInstance();
81
  $hppType = $info->getCcType();
82
-
83
  // validate if the ideal bank is chosen
84
- if($hppType == "ideal") {
85
- if($info->getPoNumber() == "") {
86
  // hpp type is empty throw error
87
  Mage::throwException(Mage::helper('adyen')->__('You chose an invalid bank'));
88
  }
89
  }
90
  }
91
 
 
92
  /**
93
  * @desc Called just after asssign data
94
  */
95
- public function prepareSave() {
 
96
  parent::prepareSave();
97
  }
98
 
 
99
  /**
100
  * @desc Get current quote
101
  *
102
  * @return Mage_Sales_Model_Quote
103
  */
104
- public function getQuote() {
 
105
  return $this->getCheckout()->getQuote();
106
  }
107
 
108
- public function getOrderPlaceRedirectUrl() {
 
 
109
  return Mage::getUrl('adyen/process/redirect');
110
  }
111
 
 
112
  /**
113
  * @desc prepare params array to send it to gateway page via POST
114
  * @return array
115
  */
116
- public function getFormFields() {
 
117
  $this->_initOrder();
118
- $order = $this->_order;
119
- $realOrderId = $order->getRealOrderId();
120
  $orderCurrencyCode = $order->getOrderCurrencyCode();
121
- $skinCode = trim($this->_getConfigData('skinCode', 'adyen_hpp'));
122
- $amount = Mage::helper('adyen')->formatAmount($order->getGrandTotal(), $orderCurrencyCode);
123
- $merchantAccount = trim($this->_getConfigData('merchantAccount'));
124
- $customerEmail = $order->getCustomerEmail();
125
- $shopperEmail = (!empty($customerEmail)) ? $customerEmail : self::DUMMY_EMAIL;
126
- $customerId = $order->getCustomerId();
127
- $shopperIP = $order->getRemoteIp();
128
- $browserInfo = $_SERVER['HTTP_USER_AGENT'];
129
- $shopperLocale = trim($this->_getConfigData('shopperlocale'));
130
- $shopperLocale = (!empty($shopperLocale)) ? $shopperLocale : Mage::app()->getLocale()->getLocaleCode();
131
- $countryCode = trim($this->_getConfigData('countryCode'));
132
- $countryCode = (!empty($countryCode)) ? $countryCode : false;
133
-
134
-
135
  // if directory lookup is enabled use the billingadress as countrycode
136
- if($countryCode == false) {
137
- if(is_object($order->getBillingAddress()) && $order->getBillingAddress()->getCountry() != "") {
138
- $countryCode = $order->getBillingAddress()->getCountry();
139
  }
140
  }
141
-
142
- $adyFields = array();
143
- $deliveryDays = (int) $this->_getConfigData('delivery_days', 'adyen_hpp');
144
- $deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5;
145
- $adyFields['merchantAccount'] = $merchantAccount;
146
  $adyFields['merchantReference'] = $realOrderId;
147
- $adyFields['paymentAmount'] = (int)$amount;
148
- $adyFields['currencyCode'] = $orderCurrencyCode;
149
- $adyFields['shipBeforeDate'] = date("Y-m-d", mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $deliveryDays, date("Y")));
150
- $adyFields['skinCode'] = $skinCode;
151
- $adyFields['shopperLocale'] = $shopperLocale;
152
- $adyFields['countryCode'] = $countryCode;
153
- $adyFields['shopperIP'] = $shopperIP;
154
- $adyFields['browserInfo'] = $browserInfo;
155
-
 
 
156
  //order data
157
- $items = $order->getAllItems();
158
  $shipmentAmount = number_format($order->getShippingAmount() + $order->getShippingTaxAmount(), 2, ',', ' ');
159
- $prodDetails = Mage::helper('adyen')->__('Shipment cost: %s %s <br />', $shipmentAmount, $orderCurrencyCode);
160
  $prodDetails .= Mage::helper('adyen')->__('Order rows: <br />');
161
  foreach ($items as $item) {
162
  if ($item->getParentItem()) {
163
  continue;
164
  }
165
- $name = $item->getName();
166
  $qtyOrdered = $this->_numberFormat($item->getQtyOrdered(), '0');
167
- $rowTotal = number_format($item->getRowTotalInclTax(), 2, ',', ' ');
168
- $prodDetails .= Mage::helper('adyen')->__('%s ( Qty: %s ) (Price: %s %s ) <br />', $name, $qtyOrdered, $rowTotal, $orderCurrencyCode);
 
 
 
 
 
 
169
  }
170
- $adyFields['orderData'] = base64_encode(gzencode($prodDetails)); //depreacated by Adyen
171
- $adyFields['sessionValidity'] = date(DATE_ATOM, mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y")));
172
- $adyFields['shopperEmail'] = $shopperEmail;
173
-
 
 
174
  // recurring
175
- $recurringType = trim($this->_getConfigData('recurringtypes', 'adyen_abstract'));
176
  $adyFields['recurringContract'] = $recurringType;
177
- $adyFields['shopperReference'] = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId;
178
-
179
  //blocked methods
180
  $adyFields['blockedMethods'] = "";
181
 
@@ -187,17 +219,17 @@ class Adyen_Payment_Model_Adyen_Hpp extends Adyen_Payment_Model_Adyen_Abstract {
187
  $adyFields['merchantReturnData'] = "";
188
 
189
  $openinvoiceType = $this->_getConfigData('openinvoicetypes', 'adyen_openinvoice');
190
-
191
- if($this->_code == "adyen_openinvoice" || $this->getInfoInstance()->getCcType() == "klarna" || $this->getInfoInstance()->getCcType() == "afterpay_default") {
192
- $adyFields['billingAddressType'] = "1";
 
193
  $adyFields['deliveryAddressType'] = "1";
194
- $adyFields['shopperType'] = "1";
195
  } else {
196
- $adyFields['billingAddressType'] = "";
197
  $adyFields['deliveryAddressType'] = "";
198
- $adyFields['shopperType'] = "";
199
  }
200
-
201
  //the data that needs to be signed is a concatenated string of the form data
202
  $sign = $adyFields['paymentAmount'] .
203
  $adyFields['currencyCode'] .
@@ -214,34 +246,28 @@ class Adyen_Payment_Model_Adyen_Hpp extends Adyen_Payment_Model_Adyen_Abstract {
214
  $adyFields['billingAddressType'] .
215
  $adyFields['deliveryAddressType'] .
216
  $adyFields['shopperType'];
217
-
218
  //Generate HMAC encrypted merchant signature
219
- $secretWord = $this->_getSecretWord();
220
- $signMac = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $sign);
221
  $adyFields['merchantSig'] = base64_encode(pack('H*', $signMac));
222
-
223
  // get extra fields
224
- $adyFields = Mage::getModel('adyen/adyen_openinvoice')->getOptionalFormFields($adyFields,$this->_order);
225
-
226
  //IDEAL
227
- if (strpos($this->getInfoInstance()->getCcType(),"ideal") !== false) {
228
  $bankData = $this->getInfoInstance()->getPoNumber();
229
  if (!empty($bankData)) {
230
- $id = explode(DS, $bankData);
231
  $adyFields['skipSelection'] = 'true';
232
- $adyFields['brandCode'] = $this->getInfoInstance()->getCcType();
233
  $adyFields['idealIssuerId'] = $id['0'];
234
  }
235
  }
236
-
237
-
238
  // if option to put Return Url in request from magento is enabled add this in the request
239
  $returnUrlInRequest = $this->_getConfigData('return_url_in_request', 'adyen_hpp');
240
- if($returnUrlInRequest){
241
- $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true)."adyen/process/success";
242
  $adyFields['resURL'] = $url;
243
  }
244
-
245
  // pos over hpp
246
  // disable this because no one using this and it will always show POS payment method
247
  // $terminalcode = 'redirect';
@@ -250,13 +276,13 @@ class Adyen_Payment_Model_Adyen_Hpp extends Adyen_Payment_Model_Adyen_Abstract {
250
  // $strsign = "merchantSig:pos.serial_number|" . $adyFields['merchantSig'] . ":" . $terminalcode;
251
  // $signPOS = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $strsign);
252
  // $adyFields['pos.sig'] = base64_encode(pack('H*', $signPOS));
253
-
254
- Mage::log($adyFields, self::DEBUG_LEVEL, 'http-request.log',true);
255
-
256
  return $adyFields;
257
  }
258
 
259
- protected function _getSecretWord($options = null) {
 
 
260
  switch ($this->getConfigDataDemoMode()) {
261
  case true:
262
  $secretWord = trim($this->_getConfigData('secret_wordt', 'adyen_hpp'));
@@ -268,201 +294,73 @@ class Adyen_Payment_Model_Adyen_Hpp extends Adyen_Payment_Model_Adyen_Abstract {
268
  return $secretWord;
269
  }
270
 
 
271
  /**
272
  * @desc Get url of Adyen payment
273
  * @return string
274
  * @todo add brandCode here
275
  */
276
- public function getFormUrl() {
277
- $brandCode = $this->getInfoInstance()->getCcType();
278
- $paymentRoutine = $this->_getConfigData('payment_routines', 'adyen_hpp');
 
279
  $isConfigDemoMode = $this->getConfigDataDemoMode();
280
  switch ($isConfigDemoMode) {
281
  case true:
282
- if ($paymentRoutine == 'single' && empty($brandCode)) {
283
  $url = 'https://test.adyen.com/hpp/pay.shtml';
284
  } else {
285
- $url = (empty($brandCode)) ?
286
- 'https://test.adyen.com/hpp/select.shtml' :
287
- "https://test.adyen.com/hpp/details.shtml?brandCode=$brandCode";
288
  }
289
  break;
290
  default:
291
- if ($paymentRoutine == 'single' && empty($brandCode)) {
292
  $url = 'https://live.adyen.com/hpp/pay.shtml';
293
  } else {
294
- $url = (empty($brandCode)) ?
295
- 'https://live.adyen.com/hpp/select.shtml' :
296
- "https://live.adyen.com/hpp/details.shtml?brandCode=$brandCode";
297
  }
298
  break;
299
  }
300
-
301
  //IDEAL
302
  $idealBankUrl = false;
303
- $bankData = $this->getInfoInstance()->getPoNumber();
304
  if ($brandCode == 'ideal' && !empty($bankData)) {
305
- $idealBankUrl = ($isConfigDemoMode == true) ?
306
- 'https://test.adyen.com/hpp/redirectIdeal.shtml' :
307
- 'https://live.adyen.com/hpp/redirectIdeal.shtml';
308
  }
309
-
310
-
311
  return (!empty($idealBankUrl)) ? $idealBankUrl : $url;
312
  }
313
 
314
- public function getFormName() {
 
 
315
  return "Adyen HPP";
316
  }
317
 
 
318
  /**
319
  * Return redirect block type
320
  *
321
  * @return string
322
  */
323
- public function getRedirectBlockType() {
 
324
  return $this->_redirectBlockType;
325
  }
326
 
327
- public function initialize($paymentAction, $stateObject) {
 
 
328
  $state = Mage_Sales_Model_Order::STATE_NEW;
329
  $stateObject->setState($state);
330
  $stateObject->setStatus($this->_getConfigData('order_status'));
331
  }
332
 
333
- public function getAvailableHPPTypes() {
334
-
335
- $orderCurrencyCode = Mage::helper('checkout/cart')->getQuote()->getQuoteCurrencyCode();
336
- $skinCode = trim($this->_getConfigData('skinCode', 'adyen_hpp'));
337
- $merchantAccount = trim($this->_getConfigData('merchantAccount'));
338
- $amount = Mage::helper('adyen')->formatAmount(Mage::helper('checkout/cart')->getQuote()->getGrandTotal(), $orderCurrencyCode);
339
- $sessionValidity = date(DATE_ATOM, mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y")));
340
- $cacheDirectoryLookup = trim($this->_getConfigData('cache_directory_lookup', 'adyen_hpp'));
341
-
342
-
343
- $countryCode = trim($this->_getConfigData('countryCode'));
344
-
345
- if(empty($countryCode)) {
346
-
347
- // check if billingcountry is filled in
348
- if(is_object(Mage::helper('checkout/cart')->getQuote()->getBillingAddress()) && Mage::helper('checkout/cart')->getQuote()->getBillingAddress()->getCountry() != "") {
349
- $countryCode = Mage::helper('checkout/cart')->getQuote()->getBillingAddress()->getCountry();
350
- } else {
351
- $countryCode = ""; // don't set countryCode so you get all the payment methods
352
- // You could do ip lookup but availability and performace is not guaranteed
353
- // $ip = Mage::helper('adyen')->getClientIp();
354
- // $countryCode = file_get_contents('http://api.hostip.info/country.php?ip='.$ip);
355
- }
356
- }
357
-
358
- // check if cache setting is on
359
- if($cacheDirectoryLookup) {
360
- // cache name has variables merchantAccount, skinCode, currencycode and country code. Amound is not cached because of performance issues
361
- $cacheId = 'cache_directory_lookup_request_' . $merchantAccount . "_" . $skinCode . "_" . $orderCurrencyCode . "_" . $countryCode;
362
- // check if this request is already cached
363
- if (false !== ($data = Mage::app()->getCache()->load($cacheId))) {
364
- // return result from cache
365
- return unserialize($data);
366
- }
367
- }
368
-
369
- // directory lookup to search for available payment methods
370
- $adyFields = array(
371
- "paymentAmount" => (int)$amount,
372
- "currencyCode" => $orderCurrencyCode,
373
- "merchantReference" => "Get Payment methods",
374
- "skinCode" => $skinCode,
375
- "merchantAccount" => $merchantAccount,
376
- "sessionValidity" => $sessionValidity,
377
- "countryCode" => $countryCode,
378
- "shopperLocale" => $countryCode,
379
- "merchantSig" => "",
380
- );
381
-
382
- $sign = $adyFields['paymentAmount'] .
383
- $adyFields['currencyCode'] .
384
- $adyFields['merchantReference'] .
385
- $adyFields['skinCode'] .
386
- $adyFields['merchantAccount'] .
387
- $adyFields['sessionValidity'];
388
-
389
- //Generate HMAC encrypted merchant signature
390
- $secretWord = $this->_getSecretWord();
391
-
392
- if($secretWord == "") {
393
- Mage::throwException(Mage::helper('adyen')->__('You forgot to fill in HMAC key for Test or Live'));
394
- }
395
-
396
- $signMac = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $sign);
397
- $adyFields['merchantSig'] = base64_encode(pack('H*', $signMac));
398
-
399
- $ch = curl_init();
400
-
401
- $isConfigDemoMode = $this->getConfigDataDemoMode();
402
- if ($isConfigDemoMode)
403
- curl_setopt($ch, CURLOPT_URL, "https://test.adyen.com/hpp/directory.shtml");
404
- else
405
- curl_setopt($ch, CURLOPT_URL, "https://live.adyen.com/hpp/directory.shtml");
406
-
407
- curl_setopt($ch, CURLOPT_HEADER, false);
408
- curl_setopt($ch, CURLOPT_POST,count($adyFields));
409
- curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($adyFields));
410
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // do not print results if you do curl_exec
411
-
412
- $results = curl_exec($ch);
413
-
414
- if($results === false) {
415
- Mage::log("Payment methods are not available on this merchantaccount\skin result is: " . curl_error($ch), self::DEBUG_LEVEL, 'http-request.log',true);
416
- Mage::throwException(Mage::helper('adyen')->__('Payment methods are not available on this merchantaccount\skin'));
417
- } else{
418
- /**
419
- * The $result contains a JSON array containing
420
- * the available payment methods for the merchant account.
421
- */
422
- $results_json = json_decode($results);
423
-
424
- if($results_json == null) {
425
- // no valid json so show the error
426
- Mage::log("Payment methods are empty on this merchantaccount with the selected skin,hmac,amount,country check if these settings are correct results_json result is:" . $results, self::DEBUG_LEVEL, 'http-request.log',true);
427
- // return empty array
428
- return array();
429
- }
430
-
431
- $payment_methods = $results_json->paymentMethods;
432
-
433
- $result_array = array();
434
- foreach($payment_methods as $payment_method) {
435
-
436
- // if openinvoice is activated don't show this in HPP options
437
- if(Mage::getStoreConfig("payment/adyen_openinvoice/active")) {
438
- if(Mage::getStoreConfig("payment/adyen_openinvoice/openinvoicetypes") == $payment_method->brandCode) {
439
- continue;
440
- }
441
- }
442
-
443
- $result_array[$payment_method->brandCode]['name'] = $payment_method->name;
444
-
445
- if(isset($payment_method->issuers)) {
446
- // for ideal go through the issuers
447
- if(count($payment_method->issuers) > 0)
448
- {
449
- foreach($payment_method->issuers as $issuer) {
450
- $result_array[$payment_method->brandCode]['issuers'][$issuer->issuerId] = $issuer->name;
451
- }
452
- }
453
- ksort($result_array[$payment_method->brandCode]['issuers']); // sort on key
454
- }
455
- }
456
- }
457
-
458
- // if cache is on cache this result
459
- if($cacheDirectoryLookup) {
460
- Mage::app()->getCache()->save(serialize($result_array), $cacheId);
461
- }
462
-
463
- return $result_array;
464
- }
465
-
466
  public function getHppOptionsDisabled() {
467
  return Mage::getStoreConfig("payment/adyen_hpp/disable_hpptypes");
468
  }
13
  * obtain it through the world-wide-web, please send an email
14
  * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+
22
+
23
+
24
  /**
25
  * @category Payment Gateway
26
  * @package Adyen_Payment
28
  * @property Adyen B.V
29
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
30
  */
31
+ class Adyen_Payment_Model_Adyen_Hpp extends Adyen_Payment_Model_Adyen_Abstract
32
+ {
 
 
 
33
  /**
34
  * @var GUEST_ID , used when order is placed by guests
35
  */
40
  protected $_formBlockType = 'adyen/form_hpp';
41
  protected $_infoBlockType = 'adyen/info_hpp';
42
  protected $_paymentMethod = 'hpp';
 
 
43
  protected $_isInitializeNeeded = true;
44
+
45
+ protected $_paymentMethodType = 'hpp';
46
+
47
+ public function getPaymentMethodType() {
48
+ return $this->$_paymentMethodType;
49
+ }
50
+
51
+ /**
52
+ * Ability to set the code, for dynamic payment methods.
53
+ * @param $code
54
+ * @return $this
55
+ */
56
+ public function setCode($code)
57
+ {
58
+ $this->_code = $code;
59
+ return $this;
60
+ }
61
+
62
  /**
63
  * @desc Get checkout session namespace
64
  *
65
  * @return Mage_Checkout_Model_Session
66
  */
67
+ public function getCheckout()
68
+ {
69
  return Mage::getSingleton('checkout/session');
70
  }
71
 
72
+ public function assignData($data)
73
+ {
74
  if (!($data instanceof Varien_Object)) {
75
  $data = new Varien_Object($data);
76
  }
77
+ $info = $this->getInfoInstance();
78
+ $hppType = str_replace('adyen_hpp_', '', $info->getData('method'));
79
+ $hppType = str_replace('adyen_ideal', 'ideal', $hppType);
80
 
81
+ $hppTypeLabel = Mage::getStoreConfig('payment/'.$info->getData('method').'/title');
82
+ $info->setAdditionalInformation('hpp_type_label', $hppTypeLabel);
 
 
83
 
84
  $info->setCcType($hppType)
85
+ ->setPoNumber($data->getData('adyen_ideal_type'));
86
+ /* @note misused field */
87
  $config = Mage::getStoreConfig("payment/adyen_hpp/disable_hpptypes");
88
  if (empty($hppType) && empty($config)) {
89
+ Mage::throwException(
90
+ Mage::helper('adyen')->__('Payment Method is complusory in order to process your payment')
91
+ );
92
  }
93
  return $this;
94
  }
95
 
96
+
97
  public function validate()
98
  {
99
  parent::validate();
100
+ $info = $this->getInfoInstance();
 
101
  $hppType = $info->getCcType();
 
102
  // validate if the ideal bank is chosen
103
+ if ($hppType == "ideal") {
104
+ if ($info->getPoNumber() == "") {
105
  // hpp type is empty throw error
106
  Mage::throwException(Mage::helper('adyen')->__('You chose an invalid bank'));
107
  }
108
  }
109
  }
110
 
111
+
112
  /**
113
  * @desc Called just after asssign data
114
  */
115
+ public function prepareSave()
116
+ {
117
  parent::prepareSave();
118
  }
119
 
120
+
121
  /**
122
  * @desc Get current quote
123
  *
124
  * @return Mage_Sales_Model_Quote
125
  */
126
+ public function getQuote()
127
+ {
128
  return $this->getCheckout()->getQuote();
129
  }
130
 
131
+
132
+ public function getOrderPlaceRedirectUrl()
133
+ {
134
  return Mage::getUrl('adyen/process/redirect');
135
  }
136
 
137
+
138
  /**
139
  * @desc prepare params array to send it to gateway page via POST
140
  * @return array
141
  */
142
+ public function getFormFields()
143
+ {
144
  $this->_initOrder();
145
+ $order = $this->_order;
146
+ $realOrderId = $order->getRealOrderId();
147
  $orderCurrencyCode = $order->getOrderCurrencyCode();
148
+ $skinCode = trim($this->_getConfigData('skinCode', 'adyen_hpp'));
149
+ $amount = Mage::helper('adyen')->formatAmount($order->getGrandTotal(), $orderCurrencyCode);
150
+ $merchantAccount = trim($this->_getConfigData('merchantAccount'));
151
+ $shopperEmail = $order->getCustomerEmail();
152
+ $customerId = $order->getCustomerId();
153
+ $shopperIP = $order->getRemoteIp();
154
+ $browserInfo = $_SERVER['HTTP_USER_AGENT'];
155
+ $shopperLocale = trim($this->_getConfigData('shopperlocale'));
156
+ $shopperLocale = (!empty($shopperLocale)) ? $shopperLocale : Mage::app()->getLocale()->getLocaleCode();
157
+ $countryCode = trim($this->_getConfigData('countryCode'));
158
+ $countryCode = (!empty($countryCode)) ? $countryCode : false;
 
 
 
159
  // if directory lookup is enabled use the billingadress as countrycode
160
+ if ($countryCode == false) {
161
+ if (is_object($order->getBillingAddress()) && $order->getBillingAddress()->getCountry() != "") {
162
+ $countryCode = $order->getBillingAddress()->getCountry();
163
  }
164
  }
165
+ $adyFields = array();
166
+ $deliveryDays = (int)$this->_getConfigData('delivery_days', 'adyen_hpp');
167
+ $deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5;
168
+ $adyFields['merchantAccount'] = $merchantAccount;
 
169
  $adyFields['merchantReference'] = $realOrderId;
170
+ $adyFields['paymentAmount'] = (int)$amount;
171
+ $adyFields['currencyCode'] = $orderCurrencyCode;
172
+ $adyFields['shipBeforeDate'] = date(
173
+ "Y-m-d",
174
+ mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $deliveryDays, date("Y"))
175
+ );
176
+ $adyFields['skinCode'] = $skinCode;
177
+ $adyFields['shopperLocale'] = $shopperLocale;
178
+ $adyFields['countryCode'] = $countryCode;
179
+ $adyFields['shopperIP'] = $shopperIP;
180
+ $adyFields['browserInfo'] = $browserInfo;
181
  //order data
182
+ $items = $order->getAllItems();
183
  $shipmentAmount = number_format($order->getShippingAmount() + $order->getShippingTaxAmount(), 2, ',', ' ');
184
+ $prodDetails = Mage::helper('adyen')->__('Shipment cost: %s %s <br />', $shipmentAmount, $orderCurrencyCode);
185
  $prodDetails .= Mage::helper('adyen')->__('Order rows: <br />');
186
  foreach ($items as $item) {
187
  if ($item->getParentItem()) {
188
  continue;
189
  }
190
+ $name = $item->getName();
191
  $qtyOrdered = $this->_numberFormat($item->getQtyOrdered(), '0');
192
+ $rowTotal = number_format($item->getRowTotalInclTax(), 2, ',', ' ');
193
+ $prodDetails .= Mage::helper('adyen')->__(
194
+ '%s ( Qty: %s ) (Price: %s %s ) <br />',
195
+ $name,
196
+ $qtyOrdered,
197
+ $rowTotal,
198
+ $orderCurrencyCode
199
+ );
200
  }
201
+ $adyFields['orderData'] = base64_encode(gzencode($prodDetails)); //depreacated by Adyen
202
+ $adyFields['sessionValidity'] = date(
203
+ DATE_ATOM,
204
+ mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y"))
205
+ );
206
+ $adyFields['shopperEmail'] = $shopperEmail;
207
  // recurring
208
+ $recurringType = trim($this->_getConfigData('recurringtypes', 'adyen_abstract'));
209
  $adyFields['recurringContract'] = $recurringType;
210
+ $adyFields['shopperReference'] = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId;
 
211
  //blocked methods
212
  $adyFields['blockedMethods'] = "";
213
 
219
  $adyFields['merchantReturnData'] = "";
220
 
221
  $openinvoiceType = $this->_getConfigData('openinvoicetypes', 'adyen_openinvoice');
222
+ if ($this->_code == "adyen_openinvoice" || $this->getInfoInstance()->getCcType() == "klarna"
223
+ || $this->getInfoInstance()->getCcType() == "afterpay_default"
224
+ ) {
225
+ $adyFields['billingAddressType'] = "1";
226
  $adyFields['deliveryAddressType'] = "1";
227
+ $adyFields['shopperType'] = "1";
228
  } else {
229
+ $adyFields['billingAddressType'] = "";
230
  $adyFields['deliveryAddressType'] = "";
231
+ $adyFields['shopperType'] = "";
232
  }
 
233
  //the data that needs to be signed is a concatenated string of the form data
234
  $sign = $adyFields['paymentAmount'] .
235
  $adyFields['currencyCode'] .
246
  $adyFields['billingAddressType'] .
247
  $adyFields['deliveryAddressType'] .
248
  $adyFields['shopperType'];
 
249
  //Generate HMAC encrypted merchant signature
250
+ $secretWord = $this->_getSecretWord();
251
+ $signMac = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $sign);
252
  $adyFields['merchantSig'] = base64_encode(pack('H*', $signMac));
 
253
  // get extra fields
254
+ $adyFields = Mage::getModel('adyen/adyen_openinvoice')->getOptionalFormFields($adyFields, $this->_order);
 
255
  //IDEAL
256
+ if (strpos($this->getInfoInstance()->getCcType(), "ideal") !== false) {
257
  $bankData = $this->getInfoInstance()->getPoNumber();
258
  if (!empty($bankData)) {
259
+ $id = explode(DS, $bankData);
260
  $adyFields['skipSelection'] = 'true';
261
+ $adyFields['brandCode'] = $this->getInfoInstance()->getCcType();
262
  $adyFields['idealIssuerId'] = $id['0'];
263
  }
264
  }
 
 
265
  // if option to put Return Url in request from magento is enabled add this in the request
266
  $returnUrlInRequest = $this->_getConfigData('return_url_in_request', 'adyen_hpp');
267
+ if ($returnUrlInRequest) {
268
+ $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true) . "adyen/process/success";
269
  $adyFields['resURL'] = $url;
270
  }
 
271
  // pos over hpp
272
  // disable this because no one using this and it will always show POS payment method
273
  // $terminalcode = 'redirect';
276
  // $strsign = "merchantSig:pos.serial_number|" . $adyFields['merchantSig'] . ":" . $terminalcode;
277
  // $signPOS = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $strsign);
278
  // $adyFields['pos.sig'] = base64_encode(pack('H*', $signPOS));
279
+ Mage::log($adyFields, self::DEBUG_LEVEL, 'adyen_http-request.log', true);
 
 
280
  return $adyFields;
281
  }
282
 
283
+
284
+ protected function _getSecretWord($options = null)
285
+ {
286
  switch ($this->getConfigDataDemoMode()) {
287
  case true:
288
  $secretWord = trim($this->_getConfigData('secret_wordt', 'adyen_hpp'));
294
  return $secretWord;
295
  }
296
 
297
+
298
  /**
299
  * @desc Get url of Adyen payment
300
  * @return string
301
  * @todo add brandCode here
302
  */
303
+ public function getFormUrl()
304
+ {
305
+ $brandCode = $this->getInfoInstance()->getCcType();
306
+ $paymentRoutine = $this->_getConfigData('payment_routines', 'adyen_hpp');
307
  $isConfigDemoMode = $this->getConfigDataDemoMode();
308
  switch ($isConfigDemoMode) {
309
  case true:
310
+ if ($paymentRoutine == 'single' && $this->getHppOptionsDisabled()) {
311
  $url = 'https://test.adyen.com/hpp/pay.shtml';
312
  } else {
313
+ $url = ($this->getHppOptionsDisabled())
314
+ ? 'https://test.adyen.com/hpp/select.shtml'
315
+ : "https://test.adyen.com/hpp/details.shtml?brandCode=$brandCode";
316
  }
317
  break;
318
  default:
319
+ if ($paymentRoutine == 'single' && $this->getHppOptionsDisabled()) {
320
  $url = 'https://live.adyen.com/hpp/pay.shtml';
321
  } else {
322
+ $url = ($this->getHppOptionsDisabled())
323
+ ? 'https://live.adyen.com/hpp/select.shtml'
324
+ : "https://live.adyen.com/hpp/details.shtml?brandCode=$brandCode";
325
  }
326
  break;
327
  }
 
328
  //IDEAL
329
  $idealBankUrl = false;
330
+ $bankData = $this->getInfoInstance()->getPoNumber();
331
  if ($brandCode == 'ideal' && !empty($bankData)) {
332
+ $idealBankUrl = ($isConfigDemoMode == true)
333
+ ? 'https://test.adyen.com/hpp/redirectIdeal.shtml'
334
+ : 'https://live.adyen.com/hpp/redirectIdeal.shtml';
335
  }
 
 
336
  return (!empty($idealBankUrl)) ? $idealBankUrl : $url;
337
  }
338
 
339
+
340
+ public function getFormName()
341
+ {
342
  return "Adyen HPP";
343
  }
344
 
345
+
346
  /**
347
  * Return redirect block type
348
  *
349
  * @return string
350
  */
351
+ public function getRedirectBlockType()
352
+ {
353
  return $this->_redirectBlockType;
354
  }
355
 
356
+
357
+ public function initialize($paymentAction, $stateObject)
358
+ {
359
  $state = Mage_Sales_Model_Order::STATE_NEW;
360
  $stateObject->setState($state);
361
  $stateObject->setStatus($this->_getConfigData('order_status'));
362
  }
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  public function getHppOptionsDisabled() {
365
  return Mage::getStoreConfig("payment/adyen_hpp/disable_hpptypes");
366
  }
app/code/community/Adyen/Payment/Model/Adyen/Ideal.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen_Payment
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the H&O Commercial License
8
+ * that is bundled with this package in the file LICENSE_HO.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.h-o.nl/license
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@h-o.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @author Paul Hachmang – H&O <info@h-o.nl>
18
+ * @copyright 2015 Copyright © H&O (http://www.h-o.nl/)
19
+ * @license H&O Commercial License (http://www.h-o.nl/license)
20
+ */
21
+
22
+ class Adyen_Payment_Model_Adyen_Ideal
23
+ extends Adyen_Payment_Model_Adyen_Hpp
24
+ {
25
+ protected $_code = 'adyen_ideal';
26
+ protected $_formBlockType = 'adyen/form_ideal';
27
+
28
+ /**
29
+ * @return mixed
30
+ */
31
+ public function getShowIdealLogos()
32
+ {
33
+ return $this->_getConfigData('show_ideal_logos', 'adyen_ideal');
34
+ }
35
+
36
+ public function getIssuers()
37
+ {
38
+ $issuerData = json_decode($this->getConfigData('issuers'), true);
39
+ $issuers = array();
40
+ if (! $issuerData) {
41
+ return $issuers;
42
+ }
43
+ foreach ($issuerData as $issuer) {
44
+ $issuers[$issuer['issuerId'].'/'.$issuer['name']] = array(
45
+ 'label' => $issuer['name']
46
+ );
47
+ }
48
+
49
+ if (isset($issuers[$this->getInfoInstance()->getPoNumber()])) {
50
+ $issuers[$this->getInfoInstance()->getPoNumber()]['selected'] = true;
51
+ }
52
+ ksort($issuers);
53
+ return $issuers;
54
+ }
55
+ }
app/code/community/Adyen/Payment/Model/Adyen/Oneclick.php CHANGED
@@ -31,87 +31,83 @@ class Adyen_Payment_Model_Adyen_Oneclick extends Adyen_Payment_Model_Adyen_Cc {
31
  protected $_formBlockType = 'adyen/form_oneclick';
32
  protected $_infoBlockType = 'adyen/info_oneclick';
33
  protected $_paymentMethod = 'oneclick';
34
- protected $_canUseInternal = false; // not possible through backoffice interface
35
 
36
 
37
- /*
38
- * only enable if adyen_cc is enabled
 
 
39
  */
40
- public function isAvailable($quote = null)
41
  {
42
- $isAvailable = parent::isAvailable($quote);
43
-
44
- // check if adyen_cc is enabled if not disable oneclick as well
45
- $isCCActive = $this->_getConfigData('active', 'adyen_cc');
46
- if(!$isCCActive)
47
- return false;
48
-
49
- return $isAvailable;
50
  }
 
51
  public function assignData($data) {
52
  if (!($data instanceof Varien_Object)) {
53
  $data = new Varien_Object($data);
54
  }
55
  $info = $this->getInfoInstance();
56
 
57
- // check if selected payment is a recurring payment
58
- if($data->getRecurring() != "") {
59
-
60
- // get the selected recurring card
61
- $recurringSelectedKey = $data->getRecurring();
62
-
63
-
64
- if(Mage::helper('adyen/installments')->isInstallmentsEnabled()) {
65
- $installmentReferenceKey = "installment_".$recurringSelectedKey;
66
- $info->setAdditionalInformation('number_of_installments', $data->getData($installmentReferenceKey));
67
- } else {
68
- $info->setAdditionalInformation('number_of_installments', "");
69
-
70
- }
71
-
72
- // get cvc code for this creditcard
73
- $recurringDetailReferenceKey = "recurringDetailReference_".$recurringSelectedKey;
74
- $cvcKey = "oneclick_cid_".$recurringSelectedKey;
75
-
76
- // don't use magic getter but get the key because this is a variable value
77
- $recurringDetailReference = $data->getData($recurringDetailReferenceKey);
78
- //$cvc = $data->getData($cvcKey);
79
 
80
- // save information as additional information so you don't have to add column in table
 
 
 
 
 
81
  $info->setAdditionalInformation('recurring_detail_reference', $recurringDetailReference);
82
-
83
- // save creditcard type
84
 
85
 
86
- if ($this->isCseEnabled()) {
87
- $ccType = $data->getData("oneclick_type_" . $recurringSelectedKey);
88
- $ccType = Mage::helper('adyen/data')->getMagentoCreditCartType($ccType);
89
 
90
- $info->setCcType($ccType);
91
- $info->setAdditionalInformation('encrypted_data', $data->getEncryptedDataOneclick());
92
- }
93
- else {
94
 
95
- // check if expiry month and year is changed
96
- $expiryMonth = $data->getData("oneclick_exp_month" . $recurringSelectedKey);
97
- $expiryYear = $data->getData("oneclick_exp_year_" . $recurringSelectedKey);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
- // just set default data for info block only
100
- $info->setCcType($data->getData("oneclick_type_" . $recurringSelectedKey))
101
- ->setCcOwner($data->getData("oneclick_owner_" . $recurringSelectedKey))
102
- ->setCcLast4($data->getData("oneclick_last_4_" . $recurringSelectedKey))
103
- ->setCcExpMonth($data->getData("oneclick_exp_month_" . $recurringSelectedKey))
104
- ->setCcExpYear($data->getData("oneclick_exp_year_" . $recurringSelectedKey))
105
- ->setCcCid($data->getData("oneclick_cid_" . $recurringSelectedKey));
106
- }
107
  } else {
108
- Mage::throwException(Mage::helper('adyen')->__('Payment Method is complusory in order to process your payment'));
 
109
  }
110
 
111
- // recalculate the totals so that extra fee is defined
112
- $quote = (Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();
113
- $quote->setTotalsCollectedFlag(false);
114
- $quote->collectTotals();
 
 
115
 
116
  return $this;
117
  }
31
  protected $_formBlockType = 'adyen/form_oneclick';
32
  protected $_infoBlockType = 'adyen/info_oneclick';
33
  protected $_paymentMethod = 'oneclick';
34
+ protected $_canUseInternal = true; // not possible through backoffice interface
35
 
36
 
37
+ /**
38
+ * Ability to set the code, for dynamic payment methods.
39
+ * @param $code
40
+ * @return $this
41
  */
42
+ public function setCode($code)
43
  {
44
+ $this->_code = $code;
45
+ return $this;
 
 
 
 
 
 
46
  }
47
+
48
  public function assignData($data) {
49
  if (!($data instanceof Varien_Object)) {
50
  $data = new Varien_Object($data);
51
  }
52
  $info = $this->getInfoInstance();
53
 
54
+ // get storeId
55
+ if(Mage::app()->getStore()->isAdmin()) {
56
+ $store = Mage::getSingleton('adminhtml/session_quote')->getStore();
57
+ } else {
58
+ $store = Mage::app()->getStore();
59
+ }
60
+ $storeId = $store->getId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
+ if($data->getRecurringDetailReference()) {
63
+ // this can be the case if you select the recurring card from the POS express checkout mechanisme
64
+ $info->setAdditionalInformation('recurring_detail_reference', $data->getRecurringDetailReference());
65
+ } else {
66
+ // Get recurringDetailReference from config
67
+ $recurringDetailReference = Mage::getStoreConfig("payment/".$this->getCode() . "/recurringDetailReference", $storeId);
68
  $info->setAdditionalInformation('recurring_detail_reference', $recurringDetailReference);
69
+ }
 
70
 
71
 
72
+ $ccType = Mage::getStoreConfig("payment/".$this->getCode() . "/variant", $storeId);
73
+ $ccType = Mage::helper('adyen')->getMagentoCreditCartType($ccType);
74
+ $info->setCcType($ccType);
75
 
76
+ if ($this->isCseEnabled()) {
77
+ $info->setAdditionalInformation('encrypted_data', $data->getEncryptedDataOneclick());
78
+ } else {
 
79
 
80
+ // check if expiry month and year is changed
81
+ $expiryMonth = $data->getOneclickExpMonth();
82
+ $expiryYear = $data->getOneclickExpYear();
83
+ $cvcCode = $data->getOneclickCid();
84
+
85
+ $cardHolderName = Mage::getStoreConfig("payment/".$this->getCode() . "/card_holderName", $storeId);
86
+ $last4Digits = Mage::getStoreConfig("payment/".$this->getCode() . "/card_number", $storeId);
87
+ $cardHolderName = Mage::getStoreConfig("payment/".$this->getCode() . "/card_holderName", $storeId);
88
+
89
+ // just set default data for info block only
90
+ $info->setCcType($ccType)
91
+ ->setCcOwner($cardHolderName)
92
+ ->setCcLast4($last4Digits)
93
+ ->setCcExpMonth($expiryMonth)
94
+ ->setCcExpYear($expiryYear)
95
+ ->setCcCid($cvcCode);
96
+ }
97
 
98
+ if(Mage::helper('adyen/installments')->isInstallmentsEnabled()) {
99
+ $info->setAdditionalInformation('number_of_installments', $data->getInstallment());
 
 
 
 
 
 
100
  } else {
101
+ $info->setAdditionalInformation('number_of_installments', "");
102
+
103
  }
104
 
105
+ if($info->getAdditionalInformation('number_of_installments') != "") {
106
+ // recalculate the totals so that extra fee is defined
107
+ $quote = (Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();
108
+ $quote->setTotalsCollectedFlag(false);
109
+ $quote->collectTotals();
110
+ }
111
 
112
  return $this;
113
  }
app/code/community/Adyen/Payment/Model/Adyen/Openinvoice.php CHANGED
@@ -36,11 +36,21 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
36
 
37
  public function isApplicableToQuote($quote, $checksBitMask)
38
  {
 
 
 
 
 
 
 
 
 
 
 
39
  // different don't show
40
  if($this->_getConfigData('different_address_disable', 'adyen_openinvoice')) {
41
 
42
  // get billing and shipping information
43
- $quote = $this->getQuote();
44
  $billing = $quote->getBillingAddress()->getData();
45
  $shipping = $quote->getShippingAddress()->getData();
46
 
@@ -176,16 +186,17 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
176
  public function getOptionalFormFields($adyFields,$order) {
177
  if (empty($order)) return $adyFields;
178
 
 
179
  $secretWord = $this->_getSecretWord();
180
 
181
  $billingAddress = $order->getBillingAddress();
182
  $adyFields['shopper.firstName'] = $billingAddress->getFirstname();
183
  $adyFields['shopper.lastName'] = $billingAddress->getLastname();
184
- $adyFields['billingAddress.street'] = $this->getStreet($billingAddress)->getName();
185
- $adyFields['billingAddress.houseNumberOrName'] = $this->getStreet($billingAddress)->getHouseNumber();
186
  $adyFields['billingAddress.city'] = $billingAddress->getCity();
187
  $adyFields['billingAddress.postalCode'] = $billingAddress->getPostcode();
188
- $adyFields['billingAddress.stateOrProvince'] = $billingAddress->getRegion();
189
  $adyFields['billingAddress.country'] = $billingAddress->getCountryId();
190
  $sign = $adyFields['billingAddress.street'] .
191
  $adyFields['billingAddress.houseNumberOrName'] .
@@ -202,11 +213,11 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
202
  $deliveryAddress = $order->getShippingAddress();
203
  if($deliveryAddress != null)
204
  {
205
- $adyFields['deliveryAddress.street'] = $this->getStreet($deliveryAddress)->getName();
206
- $adyFields['deliveryAddress.houseNumberOrName'] = $this->getStreet($deliveryAddress)->getHouseNumber();
207
  $adyFields['deliveryAddress.city'] = $deliveryAddress->getCity();
208
  $adyFields['deliveryAddress.postalCode'] = $deliveryAddress->getPostcode();
209
- $adyFields['deliveryAddress.stateOrProvince'] = $deliveryAddress->getRegion();
210
  $adyFields['deliveryAddress.country'] = $deliveryAddress->getCountryId();
211
  $sign = $adyFields['deliveryAddress.street'] .
212
  $adyFields['deliveryAddress.houseNumberOrName'] .
@@ -303,8 +314,8 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
303
  $linename = "line".$count;
304
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
305
  $additional_data_sign['openinvoicedata.' . $linename . '.description'] = $item->getName();
306
- $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = Mage::helper('adyen')->formatAmount($item->getPrice(), $currency);
307
- $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = ($item->getTaxAmount() > 0 && $item->getPriceInclTax() > 0) ? Mage::helper('adyen')->formatAmount($item->getPriceInclTax(), $currency) - Mage::helper('adyen')->formatAmount($item->getPrice(), $currency):Mage::helper('adyen')->formatAmount($item->getTaxAmount(), $currency);
308
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = (int) $item->getQtyOrdered();
309
 
310
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
@@ -321,8 +332,8 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
321
  {
322
  $linename = "line".++$count;
323
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
324
- $additional_data_sign['openinvoicedata.' . $linename . '.description'] = Mage::helper('adyen')->__('Total Discount');
325
- $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = Mage::helper('adyen')->formatAmount($order->getDiscountAmount(), $currency);
326
  $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
327
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
328
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
@@ -339,8 +350,8 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
339
  $linename = "line".++$count;
340
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
341
  $additional_data_sign['openinvoicedata.' . $linename . '.description'] = $order->getShippingDescription();
342
- $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = Mage::helper('adyen')->formatAmount($order->getShippingAmount(), $currency);
343
- $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = Mage::helper('adyen')->formatAmount($order->getShippingTaxAmount(), $currency);
344
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
345
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
346
  $additional_data_sign['openinvoicedata.' . $linename . '.vatCategory'] = "High";
@@ -352,8 +363,8 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
352
  if($order->getPaymentFeeAmount() > 0) {
353
  $linename = "line".++$count;
354
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
355
- $additional_data_sign['openinvoicedata.' . $linename . '.description'] = Mage::helper('adyen')->__('Payment Fee');
356
- $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = Mage::helper('adyen')->formatAmount($order->getPaymentFeeAmount(), $currency);
357
  $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
358
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
359
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
@@ -366,8 +377,8 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
366
  // Klarna wants tax cost provided in the lines of the products so overal tax cost is not needed anymore
367
  // $linename = "line".++$count;
368
  // $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
369
- // $additional_data_sign['openinvoicedata.' . $linename . '.description'] = Mage::helper('adyen')->__('Tax');
370
- // $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = Mage::helper('adyen')->formatAmount($order->getTaxAmount(), $currency);
371
  // $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
372
  // $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
373
  // $additional_data_sign['openinvoicedata.' . $linename . '.vatCategory'] = "None";
@@ -394,7 +405,7 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
394
  $signMac = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $sign_additional_data);
395
  $adyFields['openinvoicedata.sig'] = base64_encode(pack('H*', $signMac));
396
 
397
- Mage::log($adyFields, self::DEBUG_LEVEL, 'http-request.log');
398
 
399
  return $adyFields;
400
  }
@@ -424,41 +435,6 @@ class Adyen_Payment_Model_Adyen_Openinvoice extends Adyen_Payment_Model_Adyen_Hp
424
  return $timeStamp->format($format);
425
  }
426
 
427
- /**
428
- * Street format
429
- * @param type $address
430
- * @return Varien_Object
431
- */
432
- public function getStreet($address) {
433
- if (empty($address)) return false;
434
- $street = self::formatStreet($address->getStreet());
435
- $streetName = $street['0'];
436
- unset($street['0']);
437
- // $streetNr = implode('',$street);
438
- $streetNr = implode(' ',$street); // webprint aanpassing lijkt niet goed
439
-
440
- return new Varien_Object(array('name' => $streetName, 'house_number' => $streetNr));
441
- }
442
-
443
- /**
444
- * Fix this one string street + number
445
- * @example street + number
446
- * @param type $street
447
- * @return type $street
448
- */
449
- static public function formatStreet($street) {
450
- if (count($street) != 1) {
451
- return $street;
452
- }
453
- preg_match('/((\s\d{0,10})|(\s\d{0,10}\w{1,3}))$/i', $street['0'], $houseNumber, PREG_OFFSET_CAPTURE);
454
- if(!empty($houseNumber['0'])) {
455
- $_houseNumber = trim($houseNumber['0']['0']);
456
- $position = $houseNumber['0']['1'];
457
- $streeName = trim(substr($street['0'], 0, $position));
458
- $street = array($streeName,$_houseNumber);
459
- }
460
- return $street;
461
- }
462
 
463
  public function genderShow() {
464
  return $this->_getConfigData('gender_show', 'adyen_openinvoice');
36
 
37
  public function isApplicableToQuote($quote, $checksBitMask)
38
  {
39
+
40
+ if($this->_getConfigData('failed_attempt_disable', 'adyen_openinvoice')) {
41
+ $openInvoiceInactiveForThisQuoteId = Mage::getSingleton('checkout/session')->getOpenInvoiceInactiveForThisQuoteId();
42
+ if($openInvoiceInactiveForThisQuoteId != "") {
43
+ // check if quoteId is the same
44
+ if($quote->getId() == $openInvoiceInactiveForThisQuoteId) {
45
+ return false;
46
+ }
47
+ }
48
+ }
49
+
50
  // different don't show
51
  if($this->_getConfigData('different_address_disable', 'adyen_openinvoice')) {
52
 
53
  // get billing and shipping information
 
54
  $billing = $quote->getBillingAddress()->getData();
55
  $shipping = $quote->getShippingAddress()->getData();
56
 
186
  public function getOptionalFormFields($adyFields,$order) {
187
  if (empty($order)) return $adyFields;
188
 
189
+ $helper = Mage::helper('adyen');
190
  $secretWord = $this->_getSecretWord();
191
 
192
  $billingAddress = $order->getBillingAddress();
193
  $adyFields['shopper.firstName'] = $billingAddress->getFirstname();
194
  $adyFields['shopper.lastName'] = $billingAddress->getLastname();
195
+ $adyFields['billingAddress.street'] = $helper->getStreet($billingAddress)->getName();
196
+ $adyFields['billingAddress.houseNumberOrName'] = $helper->getStreet($billingAddress)->getHouseNumber();
197
  $adyFields['billingAddress.city'] = $billingAddress->getCity();
198
  $adyFields['billingAddress.postalCode'] = $billingAddress->getPostcode();
199
+ $adyFields['billingAddress.stateOrProvince'] = $billingAddress->getRegionCode();
200
  $adyFields['billingAddress.country'] = $billingAddress->getCountryId();
201
  $sign = $adyFields['billingAddress.street'] .
202
  $adyFields['billingAddress.houseNumberOrName'] .
213
  $deliveryAddress = $order->getShippingAddress();
214
  if($deliveryAddress != null)
215
  {
216
+ $adyFields['deliveryAddress.street'] = $helper->getStreet($deliveryAddress)->getName();
217
+ $adyFields['deliveryAddress.houseNumberOrName'] = $helper->getStreet($deliveryAddress)->getHouseNumber();
218
  $adyFields['deliveryAddress.city'] = $deliveryAddress->getCity();
219
  $adyFields['deliveryAddress.postalCode'] = $deliveryAddress->getPostcode();
220
+ $adyFields['deliveryAddress.stateOrProvince'] = $deliveryAddress->getRegionCode();
221
  $adyFields['deliveryAddress.country'] = $deliveryAddress->getCountryId();
222
  $sign = $adyFields['deliveryAddress.street'] .
223
  $adyFields['deliveryAddress.houseNumberOrName'] .
314
  $linename = "line".$count;
315
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
316
  $additional_data_sign['openinvoicedata.' . $linename . '.description'] = $item->getName();
317
+ $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = $helper->formatAmount($item->getPrice(), $currency);
318
+ $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = ($item->getTaxAmount() > 0 && $item->getPriceInclTax() > 0) ? $helper->formatAmount($item->getPriceInclTax(), $currency) - $helper->formatAmount($item->getPrice(), $currency):$helper->formatAmount($item->getTaxAmount(), $currency);
319
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = (int) $item->getQtyOrdered();
320
 
321
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
332
  {
333
  $linename = "line".++$count;
334
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
335
+ $additional_data_sign['openinvoicedata.' . $linename . '.description'] = $helper->__('Total Discount');
336
+ $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = $helper->formatAmount($order->getDiscountAmount(), $currency);
337
  $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
338
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
339
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
350
  $linename = "line".++$count;
351
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
352
  $additional_data_sign['openinvoicedata.' . $linename . '.description'] = $order->getShippingDescription();
353
+ $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = $helper->formatAmount($order->getShippingAmount(), $currency);
354
+ $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = $helper->formatAmount($order->getShippingTaxAmount(), $currency);
355
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
356
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
357
  $additional_data_sign['openinvoicedata.' . $linename . '.vatCategory'] = "High";
363
  if($order->getPaymentFeeAmount() > 0) {
364
  $linename = "line".++$count;
365
  $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
366
+ $additional_data_sign['openinvoicedata.' . $linename . '.description'] = $helper->__('Payment Fee');
367
+ $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = $helper->formatAmount($order->getPaymentFeeAmount(), $currency);
368
  $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
369
  $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
370
  if(($order->getPayment()->getMethod() == "adyen_openinvoice" && $openinvoiceType == "afterpay_default") || ($order->getPayment()->getMethodInstance()->getInfoInstance()->getCcType() == "afterpay_default")) {
377
  // Klarna wants tax cost provided in the lines of the products so overal tax cost is not needed anymore
378
  // $linename = "line".++$count;
379
  // $additional_data_sign['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
380
+ // $additional_data_sign['openinvoicedata.' . $linename . '.description'] = $helper->__('Tax');
381
+ // $additional_data_sign['openinvoicedata.' . $linename . '.itemAmount'] = $helper->formatAmount($order->getTaxAmount(), $currency);
382
  // $additional_data_sign['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
383
  // $additional_data_sign['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
384
  // $additional_data_sign['openinvoicedata.' . $linename . '.vatCategory'] = "None";
405
  $signMac = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $sign_additional_data);
406
  $adyFields['openinvoicedata.sig'] = base64_encode(pack('H*', $signMac));
407
 
408
+ Mage::log($adyFields, self::DEBUG_LEVEL, 'adyen_http-request.log');
409
 
410
  return $adyFields;
411
  }
435
  return $timeStamp->format($format);
436
  }
437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
 
439
  public function genderShow() {
440
  return $this->_getConfigData('gender_show', 'adyen_openinvoice');
app/code/community/Adyen/Payment/Model/Adyen/PayByMail.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Adyen_PayByMail extends Adyen_Payment_Model_Adyen_Abstract {
29
+
30
+ protected $_code = 'adyen_pay_by_mail';
31
+ protected $_formBlockType = 'adyen/form_payByMail';
32
+ protected $_infoBlockType = 'adyen/info_payByMail';
33
+ protected $_paymentMethod = 'pay_by_mail';
34
+ protected $_canUseCheckout = true;
35
+ protected $_canUseInternal = true;
36
+ protected $_canUseForMultishipping = true;
37
+
38
+ protected $_paymentMethodType = 'hpp';
39
+
40
+ public function getPaymentMethodType() {
41
+ return $this->$_paymentMethodType;
42
+ }
43
+
44
+ /**
45
+ * @var GUEST_ID , used when order is placed by guests
46
+ */
47
+ const GUEST_ID = 'customer_';
48
+
49
+ public function __construct()
50
+ {
51
+ // check if this is adyen_cc payment method because this function is as well used for oneclick payments
52
+ if($this->getCode() == "adyen_pay_by_mail") {
53
+ $visible = Mage::getStoreConfig("payment/adyen_pay_by_mail/visible_type");
54
+ if($visible == "backend") {
55
+ $this->_canUseCheckout = false;
56
+ $this->_canUseInternal = true;
57
+ } else if($visible == "frontend") {
58
+ $this->_canUseCheckout = true;
59
+ $this->_canUseInternal = false;
60
+ } else {
61
+ $this->_canUseCheckout = true;
62
+ $this->_canUseInternal = true;
63
+ }
64
+ }
65
+ parent::__construct();
66
+ }
67
+
68
+ public function assignData($data)
69
+ {
70
+
71
+ }
72
+
73
+ public function authorize(Varien_Object $payment, $amount) {
74
+
75
+ $payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
76
+
77
+ // create payment link and add it to comment history and send to shopper
78
+
79
+ $order = $payment->getOrder();
80
+
81
+ /*
82
+ * Do not send a email notification when order is created.
83
+ * Only do this on the AUHTORISATION notification.
84
+ * This is needed for old versions where there is no check if email is already send
85
+ */
86
+ // $order->setCanSendNewEmailFlag(false);
87
+
88
+ $fields = $this->getFormFields();
89
+
90
+ $url = $this->getFormUrl();
91
+
92
+ $count = 0;
93
+ $size = count($fields);
94
+ foreach ($fields as $field => $value) {
95
+
96
+ if($count == 0) {
97
+ $url .= "?";
98
+ }
99
+ $url .= urlencode($field) . "=" . urlencode($value);
100
+
101
+ if($count != $size) {
102
+ $url .= "&";
103
+ }
104
+
105
+ ++$count;
106
+ }
107
+
108
+ $comment = "<a target=\"_blank\" href=\"" . $url . "\">Generated payment url</a>";
109
+ $status = $this->_getConfigData('order_status');
110
+
111
+ $payment->getOrder()->addStatusHistoryComment($comment, $status);
112
+ $payment->setAdditionalInformation('payment_url', $url);
113
+
114
+ // send out email to shopper
115
+ // $templateId = "Fav Email";
116
+ //
117
+ // $emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId);
118
+ //
119
+ // $vars = array('user_name' => $userName, 'product_name' => $productName);
120
+ //
121
+ // $emailTemplate->getProcessedTemplate($vars);
122
+ //
123
+ // $emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
124
+ //
125
+ // $emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $storeId));
126
+ //
127
+ //
128
+ // $emailTemplate->send($receiveEmail,$receiveName, $vars);
129
+
130
+ // $order->
131
+
132
+ // $order->sendNewOrderEmail(); // send order email
133
+
134
+
135
+
136
+ return $this;
137
+ }
138
+
139
+ public function getFormFields()
140
+ {
141
+ $this->_initOrder();
142
+ $order = $this->_order;
143
+ $realOrderId = $order->getRealOrderId();
144
+ $orderCurrencyCode = $order->getOrderCurrencyCode();
145
+
146
+ // check if paybymail has it's own skin
147
+ $skinCode = trim($this->_getConfigData('skin_code', 'adyen_pay_by_mail', $order->getStoreId()));
148
+ if($skinCode == "") {
149
+ // use HPP skin and HMAC
150
+ $skinCode = trim($this->_getConfigData('skinCode', 'adyen_hpp', $order->getStoreId()));
151
+ $secretWord = $this->_getSecretWord($order->getStoreId(), 'adyen_hpp');
152
+ } else {
153
+ // use paybymail skin and hmac
154
+ $secretWord = $this->_getSecretWord($order->getStoreId(), 'adyen_pay_by_mail');
155
+ }
156
+
157
+ $amount = Mage::helper('adyen')->formatAmount($order->getGrandTotal(), $orderCurrencyCode);
158
+ $merchantAccount = trim($this->_getConfigData('merchantAccount', null, $order->getStoreId()));
159
+ $shopperEmail = $order->getCustomerEmail();
160
+ $customerId = $order->getCustomerId();
161
+ $shopperIP = $order->getRemoteIp();
162
+ $browserInfo = $_SERVER['HTTP_USER_AGENT'];
163
+ $shopperLocale = trim($this->_getConfigData('shopperlocale', null, $order->getStoreId()));
164
+ $shopperLocale = (!empty($shopperLocale)) ? $shopperLocale : Mage::app()->getLocale()->getLocaleCode();
165
+ $countryCode = trim($this->_getConfigData('countryCode', null, $order->getStoreId()));
166
+ $countryCode = (!empty($countryCode)) ? $countryCode : false;
167
+ // if directory lookup is enabled use the billingadress as countrycode
168
+ if ($countryCode == false) {
169
+ if (is_object($order->getBillingAddress()) && $order->getBillingAddress()->getCountry() != "") {
170
+ $countryCode = $order->getBillingAddress()->getCountry();
171
+ }
172
+ }
173
+ $adyFields = array();
174
+ $deliveryDays = (int)$this->_getConfigData('delivery_days', 'adyen_hpp', $order->getStoreId());
175
+ $deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5;
176
+ $adyFields['merchantAccount'] = $merchantAccount;
177
+ $adyFields['merchantReference'] = $realOrderId;
178
+ $adyFields['paymentAmount'] = (int)$amount;
179
+ $adyFields['currencyCode'] = $orderCurrencyCode;
180
+ $adyFields['shipBeforeDate'] = date(
181
+ "Y-m-d",
182
+ mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $deliveryDays, date("Y"))
183
+ );
184
+ $adyFields['skinCode'] = $skinCode;
185
+ $adyFields['shopperLocale'] = $shopperLocale;
186
+ $adyFields['countryCode'] = $countryCode;
187
+
188
+ //order data
189
+ $items = $order->getAllItems();
190
+ $shipmentAmount = number_format($order->getShippingAmount() + $order->getShippingTaxAmount(), 2, ',', ' ');
191
+ $prodDetails = Mage::helper('adyen')->__('Shipment cost: %s %s <br />', $shipmentAmount, $orderCurrencyCode);
192
+ $prodDetails .= Mage::helper('adyen')->__('Order rows: <br />');
193
+ foreach ($items as $item) {
194
+ if ($item->getParentItem()) {
195
+ continue;
196
+ }
197
+ $name = $item->getName();
198
+ $qtyOrdered = $this->_numberFormat($item->getQtyOrdered(), '0');
199
+ $rowTotal = number_format($item->getRowTotalInclTax(), 2, ',', ' ');
200
+ $prodDetails .= Mage::helper('adyen')->__(
201
+ '%s ( Qty: %s ) (Price: %s %s ) <br />',
202
+ $name,
203
+ $qtyOrdered,
204
+ $rowTotal,
205
+ $orderCurrencyCode
206
+ );
207
+ }
208
+ $adyFields['orderData'] = base64_encode(gzencode($prodDetails)); //depreacated by Adyen
209
+
210
+
211
+ $sessionValidity = (int) trim($this->_getConfigData('session_validity', 'adyen_pay_by_mail', $order->getStoreId()));
212
+ if($sessionValidity == "") {
213
+ $sessionValidity = 3;
214
+ }
215
+
216
+ $adyFields['sessionValidity'] = date("c",strtotime("+". $sessionValidity . " days"));
217
+ $adyFields['shopperEmail'] = $shopperEmail;
218
+ // recurring
219
+ $recurringType = trim($this->_getConfigData('recurringtypes', 'adyen_abstract', $order->getStoreId()));
220
+ $adyFields['recurringContract'] = $recurringType;
221
+ $adyFields['shopperReference'] = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId;
222
+ //blocked methods
223
+ $adyFields['blockedMethods'] = "";
224
+
225
+ /*
226
+ * This feld will be appended as-is to the return URL when the shopper completes, or abandons, the payment and
227
+ * returns to your shop; it is typically used to transmit a session ID. This feld has a maximum of 128 characters
228
+ * This is an optional field and not necessary by default
229
+ */
230
+ $adyFields['merchantReturnData'] = "";
231
+
232
+ $openinvoiceType = $this->_getConfigData('openinvoicetypes', 'adyen_openinvoice', $order->getStoreId());
233
+ if ($this->_code == "adyen_openinvoice" || $this->getInfoInstance()->getCcType() == "klarna"
234
+ || $this->getInfoInstance()->getCcType() == "afterpay_default"
235
+ ) {
236
+ $adyFields['billingAddressType'] = "1";
237
+ $adyFields['deliveryAddressType'] = "1";
238
+ $adyFields['shopperType'] = "1";
239
+ } else {
240
+ $adyFields['billingAddressType'] = "";
241
+ $adyFields['deliveryAddressType'] = "";
242
+ $adyFields['shopperType'] = "";
243
+ }
244
+ //the data that needs to be signed is a concatenated string of the form data
245
+ $sign = $adyFields['paymentAmount'] .
246
+ $adyFields['currencyCode'] .
247
+ $adyFields['shipBeforeDate'] .
248
+ $adyFields['merchantReference'] .
249
+ $adyFields['skinCode'] .
250
+ $adyFields['merchantAccount'] .
251
+ $adyFields['sessionValidity'] .
252
+ $adyFields['shopperEmail'] .
253
+ $adyFields['shopperReference'] .
254
+ $adyFields['recurringContract'] .
255
+ $adyFields['blockedMethods'] .
256
+ $adyFields['merchantReturnData'] .
257
+ $adyFields['billingAddressType'] .
258
+ $adyFields['deliveryAddressType'] .
259
+ $adyFields['shopperType'];
260
+ //Generate HMAC encrypted merchant signature
261
+ $signMac = Zend_Crypt_Hmac::compute($secretWord, 'sha1', $sign);
262
+ $adyFields['merchantSig'] = base64_encode(pack('H*', $signMac));
263
+ // get extra fields
264
+ //$adyFields = Mage::getModel('adyen/adyen_openinvoice')->getOptionalFormFields($adyFields, $this->_order);
265
+ //IDEAL
266
+ if (strpos($this->getInfoInstance()->getCcType(), "ideal") !== false) {
267
+ $bankData = $this->getInfoInstance()->getPoNumber();
268
+ if (!empty($bankData)) {
269
+ $id = explode(DS, $bankData);
270
+ $adyFields['skipSelection'] = 'true';
271
+ $adyFields['brandCode'] = $this->getInfoInstance()->getCcType();
272
+ $adyFields['idealIssuerId'] = $id['0'];
273
+ }
274
+ }
275
+
276
+ Mage::log($adyFields, self::DEBUG_LEVEL, 'adyen_http-request.log', true);
277
+ return $adyFields;
278
+ }
279
+
280
+ protected function _getSecretWord($storeId=null, $paymentMethodCode)
281
+ {
282
+ switch ($this->getConfigDataDemoMode()) {
283
+ case true:
284
+ $secretWord = trim($this->_getConfigData('secret_wordt', $paymentMethodCode, $storeId));
285
+ break;
286
+ default:
287
+ $secretWord = trim($this->_getConfigData('secret_wordp', $paymentMethodCode ,$storeId));
288
+ break;
289
+ }
290
+ return $secretWord;
291
+ }
292
+
293
+ public function getFormUrl()
294
+ {
295
+ $isConfigDemoMode = $this->getConfigDataDemoMode();
296
+ switch ($isConfigDemoMode) {
297
+ case true:
298
+ $url = 'https://test.adyen.com/hpp/pay.shtml';
299
+ break;
300
+ default:
301
+ $url = 'https://live.adyen.com/hpp/pay.shtml';
302
+ break;
303
+ }
304
+ return $url;
305
+ }
306
+ }
app/code/community/Adyen/Payment/Model/Adyen/Pos.php CHANGED
@@ -33,12 +33,18 @@ class Adyen_Payment_Model_Adyen_Pos extends Adyen_Payment_Model_Adyen_Abstract {
33
  protected $_infoBlockType = 'adyen/info_pos';
34
  protected $_paymentMethod = 'pos';
35
  protected $_isInitializeNeeded = true;
36
-
37
  /**
38
  * @var GUEST_ID , used when order is placed by guests
39
  */
40
  const GUEST_ID = 'customer_';
41
 
 
 
 
 
 
 
42
  /*
43
  * only enable if adyen_cc is enabled
44
  */
@@ -71,7 +77,10 @@ class Adyen_Payment_Model_Adyen_Pos extends Adyen_Payment_Model_Adyen_Abstract {
71
  $data = new Varien_Object($data);
72
  }
73
  $info = $this->getInfoInstance();
74
-
 
 
 
75
  return $this;
76
  }
77
 
@@ -113,15 +122,19 @@ class Adyen_Payment_Model_Adyen_Pos extends Adyen_Payment_Model_Adyen_Abstract {
113
  $adyFields['paymentAmount'] = $amount;
114
  $adyFields['merchantReference'] = $realOrderId;
115
  $adyFields['paymentAmountGrandTotal'] = $order->formatPrice($order->getGrandTotal()); // for showing only
116
-
117
  // for recurring payments
118
  $recurringType = $this->_getConfigData('recurringtypes', 'adyen_pos');
119
- $adyFields['recurringContract'] = $recurringType;
 
 
 
 
120
  $adyFields['shopperReference'] = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId;
121
  $adyFields['shopperEmail'] = $customerEmail;
122
 
123
- Mage::log($adyFields, self::DEBUG_LEVEL, 'http-request.log',true);
124
-
125
  return $adyFields;
126
  }
127
 
@@ -143,4 +156,13 @@ class Adyen_Payment_Model_Adyen_Pos extends Adyen_Payment_Model_Adyen_Abstract {
143
  $stateObject->setState($state);
144
  $stateObject->setStatus($this->_getConfigData('order_status'));
145
  }
 
 
 
 
 
 
 
 
 
146
  }
33
  protected $_infoBlockType = 'adyen/info_pos';
34
  protected $_paymentMethod = 'pos';
35
  protected $_isInitializeNeeded = true;
36
+
37
  /**
38
  * @var GUEST_ID , used when order is placed by guests
39
  */
40
  const GUEST_ID = 'customer_';
41
 
42
+ protected $_paymentMethodType = 'pos';
43
+
44
+ public function getPaymentMethodType() {
45
+ return $this->$_paymentMethodType;
46
+ }
47
+
48
  /*
49
  * only enable if adyen_cc is enabled
50
  */
77
  $data = new Varien_Object($data);
78
  }
79
  $info = $this->getInfoInstance();
80
+
81
+ // save value remember details checkbox
82
+ $info->setAdditionalInformation('store_cc', $data->getStoreCc());
83
+
84
  return $this;
85
  }
86
 
122
  $adyFields['paymentAmount'] = $amount;
123
  $adyFields['merchantReference'] = $realOrderId;
124
  $adyFields['paymentAmountGrandTotal'] = $order->formatPrice($order->getGrandTotal()); // for showing only
125
+
126
  // for recurring payments
127
  $recurringType = $this->_getConfigData('recurringtypes', 'adyen_pos');
128
+
129
+ if($order->getPayment()->getAdditionalInformation("store_cc") != "") {
130
+ $adyFields['recurringContract'] = $recurringType;
131
+ }
132
+
133
  $adyFields['shopperReference'] = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId;
134
  $adyFields['shopperEmail'] = $customerEmail;
135
 
136
+ Mage::log($adyFields, self::DEBUG_LEVEL, 'adyen_http-request.log',true);
137
+
138
  return $adyFields;
139
  }
140
 
156
  $stateObject->setState($state);
157
  $stateObject->setStatus($this->_getConfigData('order_status'));
158
  }
159
+
160
+ public function showRememberThisCheckoutbox() {
161
+ $recurringType = $this->_getConfigData('recurringtypes', 'adyen_pos');
162
+ if($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
163
+ return true;
164
+ }
165
+ return false;
166
+ }
167
+
168
  }
app/code/community/Adyen/Payment/Model/Adyen/Sepa.php CHANGED
@@ -33,6 +33,7 @@ class Adyen_Payment_Model_Adyen_Sepa extends Adyen_Payment_Model_Adyen_Abstract
33
  protected $_paymentMethod = 'sepa';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
 
36
 
37
  public function __construct()
38
  {
@@ -143,4 +144,94 @@ class Adyen_Payment_Model_Adyen_Sepa extends Adyen_Payment_Model_Adyen_Abstract
143
  parent::prepareSave();
144
  }
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  }
33
  protected $_paymentMethod = 'sepa';
34
  protected $_canUseCheckout = true;
35
  protected $_canUseInternal = true;
36
+ protected $_canUseForMultishipping = true;
37
 
38
  public function __construct()
39
  {
144
  parent::prepareSave();
145
  }
146
 
147
+ public function getBillingAgreementCollection()
148
+ {
149
+ return Mage::getResourceModel('sales/billing_agreement_collection')
150
+ ->addFieldToFilter('customer_id', $this->getInfoInstance()->getQuote()->getCustomerId())
151
+ ->addFieldToFilter('status', 'active')
152
+ ->addFieldToFilter('method_code', $this->getCode());
153
+ }
154
+
155
+ /**
156
+ * Init billing agreement
157
+ *
158
+ * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
159
+ * @return $this
160
+ */
161
+ public function initBillingAgreementToken(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
162
+ {
163
+ $agreement->setRedirectUrl(
164
+ Mage::getUrl('*/*/returnWizard', array('payment_method' => $this->getCode(), 'token' => uniqid('t')))
165
+ );
166
+ return $this;
167
+ }
168
+
169
+
170
+ /**
171
+ * Retrieve billing agreement details
172
+ *
173
+ * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
174
+ * @return $this
175
+ */
176
+ public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
177
+ {
178
+
179
+ return $this;
180
+ }
181
+
182
+
183
+ /**
184
+ * Create billing agreement
185
+ *
186
+ * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
187
+ * @return $this
188
+ */
189
+ public function placeBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
190
+ {
191
+ $agreement->setBillingAgreementId('SEPA12345');
192
+ return $this;
193
+ }
194
+
195
+
196
+ /**
197
+ * Update billing agreement status
198
+ *
199
+ * @param Mage_Payment_Model_Billing_AgreementAbstract $agreeme*
200
+ * @return $this
201
+ nt
202
+ */
203
+ public function updateBillingAgreementStatus(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
204
+ {
205
+ return $this;
206
+ }
207
+
208
+ // public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
209
+ // {
210
+ // return true;
211
+ // }
212
+ //
213
+ // public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
214
+ // {
215
+ //
216
+ // }
217
+ //
218
+ // public function getRecurringProfileDetails($referenceId, Varien_Object $result)
219
+ // {
220
+ //
221
+ // }
222
+ //
223
+ // public function canGetRecurringProfileDetails()
224
+ // {
225
+ // return false;
226
+ // }
227
+ //
228
+ // public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
229
+ // {
230
+ //
231
+ // }
232
+ //
233
+ // public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
234
+ // {
235
+ //
236
+ // }
237
  }
app/code/community/Adyen/Payment/Model/Authenticate.php CHANGED
@@ -40,22 +40,8 @@ class Adyen_Payment_Model_Authenticate extends Mage_Core_Model_Abstract {
40
  break;
41
  default:
42
  $authStatus = $this->_httpAuthenticate($varienObj);
43
- if($authStatus === false){
44
- header('HTTP/1.1 401 Unauthorized',true,401);
45
- header('WWW-Authenticate: Basic realm="Notifications"');
46
- echo "";
47
- exit();
48
- }
49
-
50
  break;
51
  }
52
- try {
53
- if (false === $authStatus ) {
54
- throw new SoapFault('200', Mage::helper('adyen')->__('Username or Password is incorrect, please contact Adyen for support!'));
55
- }
56
- } catch(SoapFault $e) {
57
- Mage::logException($e);
58
- }
59
  return $authStatus;
60
  }
61
 
@@ -169,7 +155,7 @@ class Adyen_Payment_Model_Authenticate extends Mage_Core_Model_Abstract {
169
  $pspReference = trim($response->getData('pspReference'));
170
  $originalReference = trim($response->getData('originalReference'));
171
  $merchantReference = trim($response->getData('merchantReference'));
172
- $valueArray = $response->getData('value');
173
 
174
  // json
175
  if($valueArray && is_array($valueArray)) {
40
  break;
41
  default:
42
  $authStatus = $this->_httpAuthenticate($varienObj);
 
 
 
 
 
 
 
43
  break;
44
  }
 
 
 
 
 
 
 
45
  return $authStatus;
46
  }
47
 
155
  $pspReference = trim($response->getData('pspReference'));
156
  $originalReference = trim($response->getData('originalReference'));
157
  $merchantReference = trim($response->getData('merchantReference'));
158
+ $valueArray = $response->getData('amount');
159
 
160
  // json
161
  if($valueArray && is_array($valueArray)) {
app/code/community/Adyen/Payment/Model/Cronjob.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ /**
21
+ * @category Payment Gateway
22
+ * @package Adyen_Payment
23
+ * @author Adyen
24
+ * @property Adyen B.V
25
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
+ */
27
+
28
+ class Adyen_Payment_Model_Cronjob {
29
+
30
+ /**
31
+ * Collected debug information
32
+ *
33
+ * @var array
34
+ */
35
+ protected $_debugData = array();
36
+
37
+ /**
38
+ * This updates the notifications that are in the adyen event queue. This is called by the cronjob of Magento
39
+ * To enable the cronjob on your webserver see the following magento dcoumentation:
40
+ * http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job
41
+ */
42
+ public function updateNotificationQueue()
43
+ {
44
+ if($this->_getConfigData('update_notification_cronjob')) {
45
+
46
+ // call ProcessNotifications
47
+ $this->_debugData = Mage::getModel('adyen/processNotification')->updateNotProcessedNotifications();
48
+
49
+ $this->_debug(null);
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Log debug data to file
55
+ *
56
+ * @param $storeId
57
+ * @param mixed $debugData
58
+ */
59
+ protected function _debug($storeId)
60
+ {
61
+ if ($this->_getConfigData('debug', 'adyen_abstract', $storeId)) {
62
+ $file = 'adyen_payment_cronjob.log';
63
+ Mage::getModel('core/log_adapter', $file)->log($this->_debugData);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * @param $code
69
+ * @param null $paymentMethodCode
70
+ * @param null $storeId
71
+ * @return mixed
72
+ */
73
+ protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null)
74
+ {
75
+ return Mage::helper('adyen')->getConfigData($code, $paymentMethodCode, $storeId);
76
+ }
77
+ }
app/code/community/Adyen/Payment/Model/Event.php CHANGED
@@ -45,6 +45,7 @@ class Adyen_Payment_Model_Event extends Mage_Core_Model_Abstract {
45
  const ADYEN_EVENT_MANUAL_REVIEW_REJECT = 'MANUAL_REVIEW_REJECT ';
46
  const ADYEN_EVENT_RECURRING_CONTRACT = "RECURRING_CONTRACT";
47
  const ADYEN_EVENT_REPORT_AVAILABLE = "REPORT_AVAILABLE";
 
48
 
49
  /**
50
  * Initialize resources
@@ -69,23 +70,8 @@ class Adyen_Payment_Model_Event extends Mage_Core_Model_Abstract {
69
  return $this->getResource()->getEvent($pspReference, $event);
70
  }
71
 
72
- public function saveData($updateAdyenStatus = true) {
73
-
74
  $this->getResource()->saveData($this);
75
- if($updateAdyenStatus)
76
- $this->updateAdyenStatus();
77
- }
78
-
79
- /**
80
- * Update sales grid && sales flat order
81
- * @since 0.1.0.9v
82
- * @param type $response
83
- */
84
- public function updateAdyenStatus() {
85
- $incrementId = $this->getIncrementId();
86
- $eventData = $this->getAdyenEventResult();
87
- if (!empty($incrementId) && !(empty($eventData)))
88
- $this->getResource()->updateAdyenStatus($incrementId, $eventData);
89
  }
90
 
91
  public function getOriginalPspReference($incrementId) {
45
  const ADYEN_EVENT_MANUAL_REVIEW_REJECT = 'MANUAL_REVIEW_REJECT ';
46
  const ADYEN_EVENT_RECURRING_CONTRACT = "RECURRING_CONTRACT";
47
  const ADYEN_EVENT_REPORT_AVAILABLE = "REPORT_AVAILABLE";
48
+ const ADYEN_EVENT_ORDER_CLOSED = "ORDER_CLOSED";
49
 
50
  /**
51
  * Initialize resources
70
  return $this->getResource()->getEvent($pspReference, $event);
71
  }
72
 
73
+ public function saveData() {
 
74
  $this->getResource()->saveData($this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
 
77
  public function getOriginalPspReference($incrementId) {
app/code/community/Adyen/Payment/Model/Event/Queue.php CHANGED
@@ -31,8 +31,6 @@ class Adyen_Payment_Model_Event_Queue extends Mage_Core_Model_Abstract {
31
  * Initialize resources
32
  */
33
  protected function _construct() {
34
- $this->_init('adyen/adyen_event_queue');
35
  }
36
-
37
-
38
  }
31
  * Initialize resources
32
  */
33
  protected function _construct() {
34
+ $this->_init('adyen/event_queue');
35
  }
 
 
36
  }
app/code/community/Adyen/Payment/Model/GetPosOrderStatus.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_GetPosOrderStatus extends Mage_Core_Model_Abstract {
29
+
30
+ /**
31
+ * Collected debug information
32
+ *
33
+ * @var array
34
+ */
35
+ protected $_debugData = array();
36
+
37
+ public function hasApprovedOrderStatus($merchantReference, $count = 0)
38
+ {
39
+ $storeId = null;
40
+
41
+ if($count == 0) {
42
+ $this->_debugData['getOrderStatus begin'] = 'Check the order status';
43
+ } else {
44
+ $this->_debugData['getOrderStatus count: '.$count] = 'Check the order status';
45
+ }
46
+
47
+ if($merchantReference != "") {
48
+
49
+ $this->_debugData['getOrderStatus count: '.$count . ' reference'] = 'MerchantReference is ' . $merchantReference;
50
+
51
+ // get the order
52
+ $order = Mage::getModel('sales/order')->loadByIncrementId($merchantReference);
53
+
54
+ $storeId = $order->getStoreId();
55
+
56
+ $result = $this->_checkOrderStatus($order, 0);
57
+
58
+ if($result) {
59
+ $this->_debugData['getOrderStatus end'] = 'getOrderStatus result is true';
60
+ $this->_debug($storeId);
61
+ return true;
62
+ }
63
+ } else {
64
+ $this->_debugData['error'] = 'order has no merchantReference';
65
+ }
66
+
67
+ $this->_debugData['getOrderStatus end'] = 'getOrderStatus result is false';
68
+ $this->_debug($storeId);
69
+ return false;
70
+ }
71
+
72
+ protected function _checkOrderStatus($order, $count = 0)
73
+ {
74
+
75
+ // if order is not cancelled then order is success
76
+ if($order->getStatus() == Mage_Sales_Model_Order::STATE_CANCELED || $order->getStatus() == Mage_Sales_Model_Order::STATE_HOLDED) {
77
+ $this->_debugData['getOrderStatus count: '.$count . ' cancelled'] = 'order has the status cancel or holded';
78
+ return false;
79
+ } else if($order->getStatus() == Mage_Sales_Model_Order::STATE_PROCESSING || $order->getAdyenEventCode() == Adyen_Payment_Model_Event::ADYEN_EVENT_POSAPPROVED || substr($order->getAdyenEventCode(), 0, 13) == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION)
80
+ {
81
+ $this->_debugData['getOrderStatus count: '.$count . ' success'] = 'order has the status: '.$order->getStatus();
82
+ return true;
83
+ } else if($order->getStatus() == 'pending' && $order->getAdyenEventCode() == "")
84
+ {
85
+ $this->_debugData['getOrderStatus count: '.$count . ' pending'] = 'order has the status: '.$order->getStatus() . ' lets wait a second';
86
+
87
+ sleep(1);
88
+ ++$count;
89
+
90
+ if($count > 5) {
91
+ $this->_debugData['getOrderStatus count: '.$count . ' end'] = 'order has the status: '.$order->getStatus() . ' this is the third try so cancel the order';
92
+ return false;
93
+ }
94
+
95
+ $this->_debugData['getOrderStatus count: '.$count . 'retry'] = 'Let\'s try again';
96
+ // load the order again and check if status has changed
97
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order->getIncrementId());
98
+ return $this->_checkOrderStatus($order, $count);
99
+ } else {
100
+
101
+ $this->_debugData['getOrderStatus count: '.$count . ' pending'] = 'order has the status: '.$order->getStatus() . ' lets wait a second';
102
+
103
+ sleep(1);
104
+ ++$count;
105
+
106
+ if($count > 5) {
107
+ $this->_debugData['getOrderStatus count: '.$count . ' end'] = 'order has the status: '.$order->getStatus() . ' this is the third try so cancel the order';
108
+ return false;
109
+ }
110
+ $this->_debugData['getOrderStatus count: '.$count . 'retry'] = 'Let\'s try again';
111
+ // load the order again and check if status has changed
112
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order->getIncrementId());
113
+ return $this->_checkOrderStatus($order,$count);
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Log debug data to file
119
+ *
120
+ * @param $storeId
121
+ * @param mixed $debugData
122
+ */
123
+ protected function _debug($storeId)
124
+ {
125
+ if ($this->_getConfigData('debug', 'adyen_abstract', $storeId)) {
126
+ $file = 'adyen_orderstatus_pos.log';
127
+ Mage::getModel('core/log_adapter', $file)->log($this->_debugData);
128
+ }
129
+ }
130
+
131
+ /**
132
+ * @param $code
133
+ * @param null $paymentMethodCode
134
+ * @param null $storeId
135
+ * @return mixed
136
+ */
137
+ protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null)
138
+ {
139
+ return Mage::helper('adyen')->getConfigData($code, $paymentMethodCode, $storeId);
140
+ }
141
+
142
+ }
app/code/community/Adyen/Payment/Model/Observer.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  /**
4
  * Adyen Payment Module
5
  *
@@ -22,14 +21,498 @@
22
  * @category Payment Gateway
23
  * @package Adyen_Payment
24
  * @author Adyen
25
- * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
  class Adyen_Payment_Model_Observer {
29
 
30
- public function salesOrderPaymentCancel(Varien_Event_Observer $observer) {
31
- // observer is payment object
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  $payment = $observer->getEvent()->getPayment();
 
 
33
  $order = $payment->getOrder();
34
 
35
  if($this->isPaymentMethodAdyen($order)) {
@@ -40,10 +523,11 @@ class Adyen_Payment_Model_Observer {
40
 
41
  /**
42
  * Determine if the payment method is Adyen
43
- * @param type $order
44
  * @return boolean
45
  */
46
- public function isPaymentMethodAdyen($order) {
47
- return ( strpos($order->getPayment()->getMethod(), 'adyen') !== false ) ? true : false;
 
48
  }
49
- }
1
  <?php
 
2
  /**
3
  * Adyen Payment Module
4
  *
21
  * @category Payment Gateway
22
  * @package Adyen_Payment
23
  * @author Adyen
 
24
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
25
  */
26
  class Adyen_Payment_Model_Observer {
27
 
28
+ /**
29
+ * @event controller_action_predispatch
30
+ * @param Varien_Event_Observer $observer
31
+ */
32
+ public function addMethodsToConfig(Varien_Event_Observer $observer)
33
+ {
34
+ if(Mage::app()->getStore()->isAdmin()) {
35
+ $store = Mage::getSingleton('adminhtml/session_quote')->getStore();
36
+ } else {
37
+ $store = Mage::app()->getStore();
38
+ }
39
+
40
+ // Add OneClick payment methods
41
+ if (Mage::getStoreConfigFlag('payment/adyen_oneclick/active', $store)) {
42
+ try {
43
+ $this->_addOneClickMethodsToConfig($store);
44
+ } catch (Exception $e) {
45
+ $store->setConfig('payment/adyen_oneclick/active', 0);
46
+ Mage::logException($e);
47
+ }
48
+ }
49
+
50
+ if (Mage::getStoreConfigFlag('payment/adyen_hpp/active', $store)) {
51
+ try {
52
+ $this->_addHppMethodsToConfig($store);
53
+ } catch (Exception $e) {
54
+ $store->setConfig('payment/adyen_hpp/active', 0);
55
+ Mage::logException($e);
56
+ }
57
+ }
58
+ }
59
+
60
+ /**
61
+ * @param Mage_Core_Model_Store $store
62
+ */
63
+ protected function _addOneClickMethodsToConfig(Mage_Core_Model_Store $store)
64
+ {
65
+ Varien_Profiler::start(__CLASS__.'::'.__FUNCTION__);
66
+
67
+ // Adyen CC needs to be active
68
+ if(Mage::getStoreConfigFlag('payment/adyen_cc/active', $store)) {
69
+ foreach ($this->_fetchOneClickMethods($store) as $methodCode => $methodData) {
70
+ $this->createPaymentMethodFromOneClick($methodCode, $methodData, $store);
71
+ }
72
+ }
73
+ $store->setConfig('payment/adyen_oneclick/active', 0);
74
+
75
+ Varien_Profiler::stop(__CLASS__.'::'.__FUNCTION__);
76
+ }
77
+
78
+
79
+ /**
80
+ * @param Mage_Core_Model_Store $store
81
+ */
82
+ protected function _addHppMethodsToConfig(Mage_Core_Model_Store $store)
83
+ {
84
+ Varien_Profiler::start(__CLASS__.'::'.__FUNCTION__);
85
+
86
+ if(!Mage::getStoreConfigFlag('payment/adyen_hpp/disable_hpptypes', $store)) {
87
+ $sortOrder = Mage::getStoreConfig('payment/adyen_hpp/sort_order', $store);
88
+ foreach ($this->_fetchHppMethods($store) as $methodCode => $methodData) {
89
+ $this->createPaymentMethodFromHpp($methodCode, $methodData, $store, $sortOrder);
90
+ $sortOrder+=10;
91
+ }
92
+
93
+ $store->setConfig('payment/adyen_hpp/active', 0);
94
+ } else {
95
+ $store->setConfig('payment/adyen_ideal/active', 0);
96
+ }
97
+
98
+ Varien_Profiler::stop(__CLASS__.'::'.__FUNCTION__);
99
+ }
100
+
101
+
102
+ /**
103
+ * @param string $methodCode ideal,mc,etc.
104
+ * @param array $methodData
105
+ */
106
+ public function createPaymentMethodFromOneClick($methodCode, $methodData = array(), Mage_Core_Model_Store $store)
107
+ {
108
+
109
+ $methodNewCode = 'adyen_oneclick_'.$methodCode;
110
+
111
+ $methodData = $methodData + Mage::getStoreConfig('payment/adyen_oneclick', $store);
112
+ $methodData['model'] = 'adyen/adyen_oneclick';
113
+
114
+ foreach ($methodData as $key => $value) {
115
+ $store->setConfig('payment/'.$methodNewCode.'/'.$key, $value);
116
+ }
117
+
118
+ $store->setConfig('payment/adyen_oneclick/active', 0);
119
+ }
120
+
121
+ /**
122
+ * @param string $methodCode ideal,mc,etc.
123
+ * @param array $methodData
124
+ */
125
+ public function createPaymentMethodFromHpp($methodCode, $methodData = array(), Mage_Core_Model_Store $store, $sortOrder)
126
+ {
127
+ $methodNewCode = 'adyen_hpp_'.$methodCode;
128
+
129
+ if ($methodCode == 'ideal') {
130
+ unset($methodData['title']);
131
+ $methodNewCode = 'adyen_ideal';
132
+ } else {
133
+ $methodData = $methodData + Mage::getStoreConfig('payment/adyen_hpp', $store);
134
+ $methodData['model'] = 'adyen/adyen_hpp';
135
+ }
136
+
137
+ foreach ($methodData as $key => $value) {
138
+ if (is_object($value) || is_array($value)) {
139
+ $value = json_encode($value);
140
+ }
141
+ $store->setConfig('payment/'.$methodNewCode.'/'.$key, $value);
142
+ }
143
+ $store->setConfig('/payment/' . $methodNewCode . '/sort_order', $sortOrder);
144
+ }
145
+
146
+ /**
147
+ * @param Mage_Core_Model_Store $store
148
+ * @return array
149
+ */
150
+ protected function _fetchOneClickMethods(Mage_Core_Model_Store $store)
151
+ {
152
+ $adyenHelper = Mage::helper('adyen');
153
+ $paymentMethods = array();
154
+
155
+ $merchantAccount = trim($adyenHelper->getConfigData('merchantAccount', 'adyen_abstract', $store->getId()));
156
+
157
+ if(Mage::app()->getStore()->isAdmin()) {
158
+ $customerId = Mage::getSingleton('adminhtml/session_quote')->getCustomerId();
159
+ } else if($customer = Mage::getSingleton('customer/session')->isLoggedIn()) {
160
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
161
+ $customerId = $customerData->getId();
162
+ } else {
163
+ // not logged in so has no cards
164
+ return array();
165
+ }
166
+
167
+ $recurringType = $adyenHelper->getConfigData('recurringtypes', 'adyen_abstract', $store->getId());
168
+ $recurringCards = $adyenHelper->getRecurringCards($merchantAccount, $customerId, $recurringType);
169
+
170
+ $paymentMethods = array();
171
+ foreach ($recurringCards as $key => $paymentMethod) {
172
+
173
+ $paymentMethodCode = $paymentMethod['recurringDetailReference'];
174
+ $paymentMethods[$paymentMethodCode] = $paymentMethod;
175
+
176
+ if($paymentMethod['variant'] == 'sepadirectdebit' || $paymentMethod['variant'] == 'ideal' || $paymentMethod['variant'] == 'openinvoice') {
177
+ $paymentMethods[$paymentMethodCode]['title'] = $paymentMethod['bank_ownerName'] ;
178
+ } else if($paymentMethod['variant'] == 'elv') {
179
+ $paymentMethods[$paymentMethodCode]['title'] = $paymentMethod['elv_accountHolderName'] ;
180
+ } else if(isset($paymentMethod["card_holderName"]) && isset($paymentMethod['card_number'])) {
181
+ $paymentMethods[$paymentMethodCode]['title'] = $paymentMethod["card_holderName"] . " **** " . $paymentMethod['card_number'];
182
+ } else {
183
+ // for now ignore PayPal and Klarna because we have no information on what account this is linked to. You will only get these back when you have recurring enabled
184
+ // $paymentMethods[$paymentMethodCode]['title'] = Mage::helper('adyen')->__('Saved Card') . " " . $paymentMethod["variant"];
185
+ unset($paymentMethods[$paymentMethodCode]);
186
+ }
187
+ }
188
+
189
+ return $paymentMethods;
190
+ }
191
+
192
+ /**
193
+ * @param Mage_Core_Model_Store $store
194
+ * @return array
195
+ */
196
+ protected function _fetchHppMethods(Mage_Core_Model_Store $store)
197
+ {
198
+ $adyenHelper = Mage::helper('adyen');
199
+
200
+
201
+ $skinCode = $adyenHelper->getConfigData('skinCode', 'adyen_hpp', $store);
202
+ $merchantAccount = $adyenHelper->getConfigData('merchantAccount', null, $store);
203
+ if (!$skinCode || !$merchantAccount) {
204
+ return array();
205
+ }
206
+
207
+ $adyFields = array(
208
+ "paymentAmount" => (int) Mage::helper('adyen')->formatAmount($this->_getCurrentPaymentAmount(), $this->_getCurrentCurrencyCode()),
209
+ "currencyCode" => $this->_getCurrentCurrencyCode(),
210
+ "merchantReference" => "Get Payment methods",
211
+ "skinCode" => $skinCode,
212
+ "merchantAccount" => $merchantAccount,
213
+ "sessionValidity" => date(
214
+ DATE_ATOM,
215
+ mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y"))
216
+ ),
217
+ "countryCode" => $this->_getCurrentCountryCode(),
218
+ "shopperLocale" => Mage::app()->getLocale()->getLocaleCode()
219
+ );
220
+ $responseData = $this->_getDirectoryLookupResponse($adyFields, $store);
221
+
222
+ $paymentMethods = array();
223
+ foreach ($responseData['paymentMethods'] as $paymentMethod) {
224
+ $paymentMethod = $this->_fieldMapPaymentMethod($paymentMethod);
225
+ $paymentMethodCode = $paymentMethod['brandCode'];
226
+
227
+ //Skip open invoice methods if they are enabled
228
+ if (Mage::getStoreConfigFlag('payment/adyen_openinvoice/active')
229
+ && Mage::getStoreConfig('payment/adyen_openinvoice/openinvoicetypes') == $paymentMethodCode) {
230
+ continue;
231
+ }
232
+
233
+ if (Mage::getStoreConfigFlag('payment/adyen_cc/active')
234
+ && in_array($paymentMethodCode, array('diners','discover','amex','mc','visa','maestro'))) {
235
+ continue;
236
+ }
237
+
238
+ if (Mage::getStoreConfigFlag('payment/adyen_sepa/active')
239
+ && in_array($paymentMethodCode, array('sepadirectdebit'))) {
240
+ continue;
241
+ }
242
+
243
+ if (Mage::getStoreConfigFlag('payment/adyen_elv/active')
244
+ && in_array($paymentMethodCode, array('elv'))) {
245
+ continue;
246
+ }
247
+
248
+ if (Mage::getStoreConfigFlag('payment/adyen_cash/active')
249
+ && in_array($paymentMethodCode, array('c_cash'))) {
250
+ continue;
251
+ }
252
+
253
+ unset($paymentMethod['brandCode']);
254
+ $paymentMethods[$paymentMethodCode] = $paymentMethod;
255
+ }
256
+
257
+ return $paymentMethods;
258
+ }
259
+
260
+
261
+ /**
262
+ * @return Mage_Sales_Model_Quote
263
+ */
264
+ protected function _getQuote()
265
+ {
266
+ return Mage::getSingleton('checkout/session')->getQuote();
267
+ }
268
+
269
+
270
+ /**
271
+ * @return string
272
+ */
273
+ protected function _getCurrentLocaleCode()
274
+ {
275
+ return Mage::app()->getLocale()->getLocaleCode();
276
+ }
277
+
278
+
279
+ /**
280
+ * @return string
281
+ */
282
+ protected function _getCurrentCurrencyCode()
283
+ {
284
+ return $this->_getQuote()->getQuoteCurrencyCode() ?: Mage::app()->getBaseCurrencyCode();
285
+ }
286
+
287
+
288
+ /**
289
+ * @return string
290
+ */
291
+ protected function _getCurrentCountryCode()
292
+ {
293
+ $billingParams = Mage::app()->getRequest()->getParam('billing');
294
+ if (isset($billingParams['country_id'])) {
295
+ return $billingParams['country_id'];
296
+ }
297
+
298
+ if ($country = $this->_getQuote()->getBillingAddress()->getCountry()) {
299
+ return $country;
300
+ }
301
+
302
+ if (Mage::getStoreConfig('payment/account/merchant_country')) {
303
+ return Mage::getStoreConfig('payment/account/merchant_country');
304
+ }
305
+
306
+ return null;
307
+ }
308
+
309
+
310
+ /**
311
+ * @return bool|int
312
+ */
313
+ protected function _getCurrentPaymentAmount()
314
+ {
315
+ if (($grandTotal = $this->_getQuote()->getGrandTotal()) > 0) {
316
+ return $grandTotal;
317
+ }
318
+ return 10;
319
+ }
320
+
321
+
322
+ /**
323
+ * @param $requestParams
324
+ * @param Mage_Core_Model_Store $store
325
+ *
326
+ * @return array
327
+ * @throws Mage_Core_Exception
328
+ */
329
+ protected function _getDirectoryLookupResponse($requestParams, Mage_Core_Model_Store $store)
330
+ {
331
+ $cacheKey = $this->_getCacheKeyForRequest($requestParams, $store);
332
+
333
+ // Load response from cache.
334
+ if ($responseData = Mage::app()->getCache()->load($cacheKey)) {
335
+ return unserialize($responseData);
336
+ }
337
+
338
+ $this->_signRequestParams($requestParams, $store);
339
+
340
+ $ch = curl_init();
341
+ $url = Mage::helper('adyen')->getConfigDataDemoMode()
342
+ ? "https://test.adyen.com/hpp/directory.shtml"
343
+ : "https://live.adyen.com/hpp/directory.shtml";
344
+ curl_setopt($ch, CURLOPT_URL, $url);
345
+
346
+ curl_setopt($ch, CURLOPT_HEADER, false);
347
+ curl_setopt($ch, CURLOPT_POST, count($requestParams));
348
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($requestParams));
349
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
350
+
351
+ $results = curl_exec($ch);
352
+ $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
353
+
354
+ if ($httpStatus != 200) {
355
+ Mage::throwException(
356
+ Mage::helper('adyen')->__('HTTP Status code %s received, data %s', $httpStatus, $results)
357
+ );
358
+ }
359
+
360
+ if ($results === false) {
361
+ Mage::throwException(
362
+ Mage::helper('adyen')->__('Got an empty response, status code %s', $httpStatus)
363
+ );
364
+ }
365
+
366
+ $responseData = json_decode($results, true);
367
+ if (! $responseData || !isset($responseData['paymentMethods'])) {
368
+ Mage::throwException(Mage::helper('adyen')->__(
369
+ 'Did not receive JSON, could not retrieve payment methods, received %s', $results
370
+ ));
371
+ }
372
+
373
+ // Save response to cache.
374
+ Mage::app()->getCache()->save(
375
+ serialize($responseData),
376
+ $cacheKey,
377
+ array(Mage_Core_Model_Config::CACHE_TAG),
378
+ 60 * 60 * 6
379
+ );
380
+
381
+ return $responseData;
382
+ }
383
+
384
+ protected $_cacheParams = array(
385
+ 'currencyCode',
386
+ 'merchantReference',
387
+ 'skinCode',
388
+ 'merchantAccount',
389
+ 'countryCode',
390
+ 'shopperLocale',
391
+ );
392
+
393
+
394
+ /**
395
+ * @param $requestParams
396
+ * @param Mage_Core_Model_Store $store
397
+ * @return string
398
+ */
399
+ protected function _getCacheKeyForRequest($requestParams, Mage_Core_Model_Store $store)
400
+ {
401
+ $cacheParams = array();
402
+ $cacheParams['store'] = $store->getId();
403
+ foreach ($this->_cacheParams as $paramKey) {
404
+ if (isset($requestParams[$paramKey])) {
405
+ $cacheParams[$paramKey] = $requestParams[$paramKey];
406
+ }
407
+ }
408
+
409
+ return md5(implode('|', $cacheParams));
410
+ }
411
+
412
+
413
+ protected $_requiredHmacFields = array(
414
+ 'merchantReference',
415
+ 'paymentAmount',
416
+ 'currencyCode',
417
+ 'shipBeforeDate',
418
+ 'skinCode',
419
+ 'merchantAccount',
420
+ 'sessionValidity'
421
+ );
422
+
423
+ protected $_optionalHmacFields = array(
424
+ 'merchantReturnData',
425
+ 'shopperEmail',
426
+ 'shopperReference',
427
+ 'allowedMethods',
428
+ 'blockedMethods',
429
+ 'offset',
430
+ 'shopperStatement',
431
+ 'recurringContract',
432
+ 'billingAddressType',
433
+ 'deliveryAddressType'
434
+ );
435
+
436
+
437
+ /**
438
+ * Communication between Adyen and the shop must be encoded with Hmac.
439
+ * @param $fields
440
+ * @param Mage_Core_Model_Store $store
441
+ *
442
+ * @throws Mage_Core_Exception
443
+ * @throws Zend_Crypt_Hmac_Exception
444
+ */
445
+ protected function _signRequestParams(&$fields, Mage_Core_Model_Store $store)
446
+ {
447
+ unset($fields['merchantSig']);
448
+ $hmacFields = $fields;
449
+
450
+ foreach ($this->_requiredHmacFields as $requiredHmacField) {
451
+ if (! isset($fields[$requiredHmacField])) {
452
+ $fields[$requiredHmacField] = '';
453
+ }
454
+ }
455
+
456
+ foreach ($fields as $field => $value) {
457
+ if (! in_array($field, $this->_requiredHmacFields)
458
+ && ! in_array($field, $this->_optionalHmacFields)) {
459
+ unset($hmacFields[$field]);
460
+ }
461
+ }
462
+
463
+ if (! $hmacKey = $this->_getHmacKey($store)) {
464
+ Mage::throwException(Mage::helper('adyen')->__('You forgot to fill in HMAC key for Test or Live'));
465
+ }
466
+
467
+ $signMac = Zend_Crypt_Hmac::compute($hmacKey, 'sha1', implode('', $hmacFields));
468
+ $fields['merchantSig'] = base64_encode(pack('H*', $signMac));
469
+ }
470
+
471
+
472
+ /**
473
+ * Get the Hmac key from the config
474
+ * @param Mage_Core_Model_Store $store
475
+ * @return string
476
+ */
477
+ protected function _getHmacKey(Mage_Core_Model_Store $store)
478
+ {
479
+ $adyenHelper = Mage::helper('adyen');
480
+ switch ($adyenHelper->getConfigDataDemoMode()) {
481
+ case true:
482
+ $secretWord = trim($adyenHelper->getConfigData('secret_wordt', 'adyen_hpp'));
483
+ break;
484
+ default:
485
+ $secretWord = trim($adyenHelper->getConfigData('secret_wordp', 'adyen_hpp'));
486
+ break;
487
+ }
488
+ return $secretWord;
489
+ }
490
+
491
+
492
+ protected $_fieldMapPaymentMethod = array(
493
+ 'name' => 'title'
494
+ );
495
+
496
+ protected function _fieldMapPaymentMethod($paymentMethod)
497
+ {
498
+ foreach ($this->_fieldMapPaymentMethod as $field => $newField) {
499
+ if (isset($paymentMethod[$field])) {
500
+ $paymentMethod[$newField] = $paymentMethod[$field];
501
+ unset($paymentMethod[$field]);
502
+ }
503
+ }
504
+ return $paymentMethod;
505
+ }
506
+
507
+
508
+ /**
509
+ * @param Varien_Event_Observer $observer
510
+ */
511
+ public function salesOrderPaymentCancel(Varien_Event_Observer $observer)
512
+ {
513
  $payment = $observer->getEvent()->getPayment();
514
+
515
+ /** @var Mage_Sales_Model_Order $order */
516
  $order = $payment->getOrder();
517
 
518
  if($this->isPaymentMethodAdyen($order)) {
523
 
524
  /**
525
  * Determine if the payment method is Adyen
526
+ * @param Mage_Sales_Model_Order $order
527
  * @return boolean
528
  */
529
+ public function isPaymentMethodAdyen(Mage_Sales_Model_Order $order)
530
+ {
531
+ return strpos($order->getPayment()->getMethod(), 'adyen') !== false;
532
  }
533
+ }
app/code/community/Adyen/Payment/Model/Process.php CHANGED
@@ -27,340 +27,6 @@
27
  */
28
  class Adyen_Payment_Model_Process extends Mage_Core_Model_Abstract {
29
 
30
- /**
31
- * Used in the ProcessController to handle all bussiness logic regarding Adyen to Magento
32
- * @since v008
33
- * @desc Update order status accordingly
34
- * @throws Exception
35
- */
36
- public function processResponse($soapItem = null) {
37
-
38
- $response = (!empty($soapItem)) ? $soapItem : $this->getRequest()->getParams();
39
- Mage::getResourceModel('adyen/adyen_debug')->assignData($response);
40
- $actionName = $this->getRequest()->getActionName();
41
- $helper = Mage::helper('adyen');
42
-
43
- if (empty($response)) {
44
- Mage::log('blanco on response, please check your webserver that the result url accepts parameters', Zend_Log::CRIT, "adyen_notification.log", true);
45
- return "401";
46
- }
47
-
48
- $varienObj = new Varien_Object();
49
- foreach ($response as $code => $value) {
50
- if ($code == 'amount') {
51
- if (is_object($value))
52
- $value = $value->value;
53
- $code = 'value';
54
- }
55
- $varienObj->setData($code, $value);
56
- }
57
-
58
- // if version is added to notification url (?version=true) then only return the version of the plugin (only works from verion 1.0.0.8)
59
- if($varienObj->getData('version')) {
60
- echo $helper->getExtensionVersion();
61
- exit;
62
- }
63
-
64
- //authenticate
65
- $authStatus = Mage::getModel('adyen/authenticate')->authenticate($actionName, $varienObj);
66
- if (!$authStatus) {
67
- $this->_writeLog('authentification failure!');
68
- Mage::log('authentification failure!', Zend_Log::CRIT, "adyen_notification.log", true);
69
- return "401";
70
- }
71
-
72
- $incrementId = $varienObj->getData('merchantReference');
73
-
74
- try{
75
-
76
- // skip notification if notification is REPORT_AVAILABLE
77
- $eventCode = trim($varienObj->getData('eventCode'));
78
- if($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_REPORT_AVAILABLE) {
79
- return false;
80
- }
81
-
82
- //get order && payment objects
83
- $order = Mage::getModel('sales/order');
84
-
85
- //error
86
- $orderExist = $this->_incrementIdExist($varienObj, $incrementId);
87
- if (empty($orderExist)) {
88
- Mage::log('Order does not exist with incrementId:' . $incrementId, Zend_Log::DEBUG, "adyen_notification.log", true);
89
- // on authorization it could be that the order is not yet created
90
- $eventCode = trim($varienObj->getData('eventCode'));
91
- $success = (trim($varienObj->getData('success')) == "true") ? true : false;
92
- // only log the AUTHORISATION with Sucess true because with false the order will never be created in magento
93
- if($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $success == true) {
94
- // pspreference is always numeric otherwise it is a test notification
95
- $pspReference = $varienObj->getData('pspReference');
96
- if(is_numeric($pspReference)) {
97
- $this->updateNotProcessedEvents($varienObj);
98
- return false;
99
- }
100
- }
101
- // it is a test notification but update the events that are in the queue
102
- $this->updateNotProcessedEvents(null);
103
- return false;
104
- }
105
- $order->loadByIncrementId($incrementId);
106
-
107
- //log
108
- $order->getPayment()->getMethodInstance()->writeLog($varienObj->debug());
109
-
110
- switch ($actionName) {
111
- case 'success':
112
- $status = $this->_processPostSuccess($order, $varienObj);
113
- break;
114
- default:
115
- $status = $this->_processNotifications($order, $varienObj);
116
- $this->updateNotProcessedEvents(null);
117
- break;
118
- }
119
- }catch(Exception $e){
120
- // do nothing
121
- // log error
122
- Mage::logException($e);
123
- Mage::log('NOTIFICATION RESPONSE failure!' . print_r($e, true), Zend_Log::DEBUG, "adyen_notification.log", true);
124
-
125
- }
126
-
127
- return $status;
128
- }
129
-
130
- public function updateNotProcessedEvents($varienObj) {
131
-
132
- if($varienObj) {
133
- $incrementId = $varienObj->getData('merchantReference');
134
- $pspReference = $varienObj->getData('pspReference');
135
- $eventCode = $varienObj->getData('eventCode');
136
-
137
- // check if already exists in the queue (sometimes Adyen Platform can send the same notification twice)
138
- $eventResults = Mage::getModel('adyen/event_queue')->getCollection()
139
- ->addFieldToFilter('increment_id', $incrementId);
140
-
141
- $eventQueue = null;
142
- if(count($eventResults) > 0) {
143
- $eventQueue = $eventResults->getFirstItem();
144
- }
145
-
146
- if($eventQueue) {
147
- $attempt = (int)$eventQueue->getAttempt();
148
- try{
149
- $eventQueue->setAttempt(++$attempt);
150
- $eventQueue->save();
151
- } catch(Exception $e) {
152
- Mage::logException($e);
153
- }
154
- Mage::log('Notification could still not processed this was attempt:'.$attempt .' for notification with incrementId:' . $incrementId, Zend_Log::DEBUG, "adyen_notification.log", true);
155
- } else {
156
- try {
157
- // add current request to the queue
158
- $eventQueue = Mage::getModel('adyen/event_queue');
159
- $eventQueue->setPspReference($pspReference);
160
- $eventQueue->setAdyenEventCode($eventCode);
161
- $eventQueue->setIncrementId($incrementId);
162
- $eventQueue->setAttempt(1);
163
- $eventQueue->setResponse(serialize($varienObj));
164
- $eventQueue->setCreatedAt(now());
165
- $eventQueue->save();
166
- Mage::log('Notification is added to the queue it will process when the next notification is received for incrementId:' . $incrementId, Zend_Log::DEBUG, "adyen_notification.log", true);
167
- } catch(Exception $e) {
168
- Mage::logException($e);
169
- }
170
- }
171
- }
172
-
173
- // try to update old notifications that did not processed yet
174
- $collection = Mage::getModel('adyen/event_queue')->getCollection()
175
- ->addFieldToFilter('attempt', array('lteq' => '4'));
176
-
177
- foreach($collection as $event){
178
-
179
- if($event->getAdyenEventCode() == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION) {
180
-
181
- $incrementId = $event->getIncrementId();
182
- $orderExist = Mage::getResourceModel('adyen/order')->orderExist($incrementId);
183
- if (!empty($orderExist)) {
184
- // try to process it now
185
- $varienObj = unserialize($event->getResponse());
186
- $order = Mage::getModel('sales/order');
187
- $order->loadByIncrementId($incrementId);
188
-
189
- //log
190
- Mage::log('Notification from queue is trying to processing it again incrementId is:' . $incrementId, Zend_Log::DEBUG, "adyen_notification.log", true);
191
- $order->getPayment()->getMethodInstance()->writeLog($varienObj->debug());
192
- $this->_processNotifications($order, $varienObj);
193
-
194
- // update event that it is processed
195
- try{
196
- Mage::log('Notification from queue is processed with incrementId:' . $incrementId, Zend_Log::DEBUG, "adyen_notification.log", true);
197
- $event->delete();
198
- } catch(Exception $e) {
199
- Mage::logException($e);
200
- }
201
- } else {
202
- // order still not exists save this attempt
203
- $currentAttempt = $event->getAttempt();
204
- $event->setAttempt(++$currentAttempt);
205
- $event->save();
206
- }
207
- }
208
- }
209
- }
210
-
211
- public function processPosResponse() {
212
-
213
- $helper = Mage::helper('adyen');
214
- $response = $_REQUEST;
215
-
216
- Mage::log("PosResonse:".print_r($response, true), Zend_Log::DEBUG, "adyen_notification.log", true);
217
-
218
- $varienObj = new Varien_Object();
219
- foreach ($response as $code => $value) {
220
- if ($code == 'amount') {
221
- if (is_object($value))
222
- $value = $value->value;
223
- $code = 'value';
224
- }
225
- $varienObj->setData($code, $value);
226
- }
227
-
228
- $actionName = $this->getRequest()->getActionName();
229
- $result = $varienObj->getData('result');
230
-
231
- // check if result comes from POS device comes form POS
232
- if($actionName == "successPos" && $result != "") {
233
-
234
- $checksum = $varienObj->getData('checksum');
235
-
236
- // for android checksum is called cs
237
- if($checksum == "") {
238
- $checksum = $varienObj->getData('cs');
239
- }
240
-
241
- $amount = $varienObj->getData('originalCustomAmount');
242
- $currency = $varienObj->getData('originalCustomCurrency');
243
- $session_id = $varienObj->getData('sessionId');
244
-
245
-
246
- // for android sessionis is with low i
247
- if($session_id == "") {
248
- $session_id = $varienObj->getData('sessionid');
249
- }
250
-
251
- // calculate amount checksum
252
- $amount_checksum = 0;
253
-
254
- for($i=0;$i<strlen($amount);$i++)
255
- {
256
- // ASCII value use ord
257
- $checksum_calc = ord($amount[$i]) - 48;
258
- $amount_checksum += $checksum_calc;
259
- }
260
-
261
- $currency_checksum = 0;
262
- for($i=0;$i<strlen($currency);$i++)
263
- {
264
- $checksum_calc = ord($currency[$i]) - 64;
265
- $currency_checksum += $checksum_calc;
266
- }
267
-
268
- $result_checksum = 0;
269
- for($i=0;$i<strlen($result);$i++)
270
- {
271
- $checksum_calc = ord($result[$i]) - 64;
272
- $result_checksum += $checksum_calc;
273
- }
274
-
275
- $session_id_checksum = 0;
276
- for($i=0;$i<strlen($session_id);$i++)
277
- {
278
- $checksum_calc = $this->getAscii2Int($session_id[$i]);
279
- $session_id_checksum += $checksum_calc;
280
- }
281
-
282
- $total_result_checksum = (($amount_checksum + $currency_checksum + $result_checksum) * $session_id_checksum) % 100;
283
-
284
- // check if request is valid
285
- if($total_result_checksum == $checksum) {
286
-
287
- //get order && payment objects
288
- $order = Mage::getModel('sales/order');
289
- //$incrementId = $varienObj->getData('merchantReference');
290
- $incrementId = $varienObj->getData('originalCustomMerchantReference');
291
-
292
- //error
293
- $orderExist = $this->_incrementIdExist($varienObj, $incrementId);
294
-
295
- if (empty($orderExist)) {
296
- $this->_writeLog("unknown order : $incrementId");
297
- } else {
298
- $order->loadByIncrementId($incrementId);
299
-
300
- if($result == 'APPROVED') {
301
- // wait for notification to finish the order
302
-
303
- // set adyen event status on true
304
- $order->setAdyenEventCode(Adyen_Payment_Model_Event::ADYEN_EVENT_POSAPPROVED);
305
-
306
- $comment = Mage::helper('adyen')
307
- ->__('%s <br /> Result: %s <br /> paymentMethod: %s', 'Adyen App Result URL Notification:', $result, 'POS');
308
-
309
- $order->addStatusHistoryComment($comment, false);
310
-
311
- try {
312
- Mage::log("processPosResponse Adyen Event Status is:".$order->getAdyenEventCode(), Zend_Log::DEBUG, "adyen_notification.log", true);
313
- $order->save();
314
- } catch (Exception $e) {
315
- Mage::logException($e);
316
- }
317
- } else {
318
-
319
- $comment = Mage::helper('adyen')
320
- ->__('%s <br /> Result: %s <br /> paymentMethod: %s', 'Adyen App Result URL Notification:', $result, 'POS');
321
-
322
- $order->addStatusHistoryComment($comment, Mage_Sales_Model_Order::STATE_CANCELED);
323
-
324
- $order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CANCEL, true);
325
-
326
- if (!$order->canCancel()) {
327
- $this->_writeLog('order can not be canceled', $order);
328
- $order->addStatusHistoryComment($helper->__('Order can not be canceled'), Mage_Sales_Model_Order::STATE_CANCELED);
329
- $order->save();
330
-
331
- } else {
332
- $order->cancel()->save();
333
- }
334
- }
335
- }
336
- } else {
337
- $incrementId = $varienObj->getData('originalCustomMerchantReference');
338
- Mage::log("Checksum failed for :".$incrementId, Zend_Log::DEBUG, "adyen_notification.log", true);
339
- }
340
- }
341
- // close the window
342
- $html = "<html><body>
343
- <script type=\"text/javascript\">
344
- function closeWindow() {
345
- window.open('', '_self', '');
346
- window.close();
347
- }
348
- setTimeout(closeWindow, 500);
349
- </script>
350
- </body></html>";
351
-
352
- return $html;
353
- }
354
-
355
- public function getAscii2Int($ascii){
356
- if (is_numeric($ascii)){
357
- $int = ord($ascii) - 48;
358
- } else {
359
- $int = ord($ascii) - 64;
360
- }
361
- return $int;
362
- }
363
-
364
  public function processCashResponse()
365
  {
366
  $response = $_REQUEST;
@@ -420,61 +86,13 @@ class Adyen_Payment_Model_Process extends Mage_Core_Model_Abstract {
420
  ->setEntityName("order")
421
  ->setOrder($order);
422
  $history->save();
423
-
424
-
425
- if($this->_getConfigData('cash_drawer', 'adyen_pos')) {
426
-
427
- $printerIp = trim($this->_getConfigData('cash_drawer_printer_ip', 'adyen_pos'));
428
-
429
- if($printerIp != "") {
430
-
431
- $drawCodeConfig = trim($this->_getConfigData('cash_drawer_code', 'adyen_pos'));
432
-
433
- if($drawCodeConfig != "") {
434
-
435
- // split comm based
436
- $drawCodes = explode(",", $drawCodeConfig);
437
-
438
- // open the cash drawer
439
- try {
440
- $esc = "\x1b";
441
- $fp = fsockopen($printerIp, 9100);
442
- fwrite($fp, $esc . "@");
443
- $write = "";
444
- $count = 0;
445
- foreach($drawCodes as $drawCode) {
446
- // first code 27 must be special character to let it work
447
- if($count == 0 && $drawCode == "27") {
448
- $write .= $esc;
449
- } else {
450
- $write .= chr($drawCode);
451
- }
452
- ++$count;
453
- }
454
- // example: fwrite($fp, $esc . chr(112) . chr(48) . chr(55) . chr(121));
455
- fwrite($fp, $write);
456
- // close connection
457
- fclose($fp);
458
- } catch(Exception $e) {
459
- Mage::logException($e);
460
- Mage::throwException($e->getMessage());
461
- }
462
- } else {
463
- Mage::log("Cash drawer Code not filled in check your Adyen POS settings", Zend_Log::DEBUG, "adyen_notification.log", true);
464
- Mage::throwException('Cash drawer Code not filled in check your Adyen POS settings');
465
- }
466
- } else {
467
- Mage::log("Cash drawer Code not filled in check your Adyen POS settings", Zend_Log::DEBUG, "adyen_notification.log", true);
468
- Mage::throwException('Cash drawer IP not filled in check your Adyen POS settings');
469
- }
470
- }
471
  return $status;
472
  }
473
  }
474
  return false;
475
  }
476
 
477
- protected function _getSecretWord($options = null) {
478
  switch ($this->getConfigDataDemoMode()) {
479
  case true:
480
  $secretWord = trim($this->_getConfigData('secret_wordt', 'adyen_hpp'));
@@ -508,770 +126,12 @@ class Adyen_Payment_Model_Process extends Mage_Core_Model_Abstract {
508
  return $orderExist;
509
  }
510
 
511
- /**
512
- * @desc Adyen attribute handling
513
- * @param Varien_Object $order
514
- * @param type $response
515
- */
516
- protected function _addAdyenAttributes(Varien_Object $order, $response, $updateAdyenStatus = true) {
517
- $klarnaReservationNumber = $response->getData('additionalData_additionalData_acquirerReference');
518
- $avsResult = $response->getData('additionalData_avsResult');
519
- $cvcResult = $response->getData('additionalData_cvcResult');
520
- $boletoPaidAmount = $response->getData('additionalData_boletobancario_paidAmount');
521
- $totalFraudScore = $response->getData('additionalData_totalFraudScore');
522
- $pspReference = $response->getData('pspReference');
523
- $eventCode = $response->getData('eventCode');
524
- $authResult = $response->getData('authResult');
525
- $incrementId = $response->getData('merchantReference');
526
- $paymentMethod = $response->getData('paymentMethod');
527
- $success = (trim($response->getData('success')) == "true") ? true : false;
528
- $eventData = (!empty($eventCode)) ? $eventCode : $authResult;
529
- $paymentObj = $order->getPayment();
530
- $_paymentCode = $this->_paymentMethodCode($order);
531
-
532
- $ccLast4 = $response->getData('additionalData_cardSummary');
533
- // if there is no server communication setup try to get last4 digits from reason field
534
- if($ccLast4 == "") {
535
- $reason = trim($response->getData('reason'));
536
- if($reason != "") {
537
- $reasonArray = explode(":", $reason);
538
- if($reasonArray != null && is_array($reasonArray)) {
539
- if(isset($reasonArray[1])) {
540
- $ccLast4 = $reasonArray[1];
541
- }
542
- }
543
- }
544
- }
545
-
546
- $paymentObj->setLastTransId($incrementId)
547
- ->setAdyenPaymentMethod($paymentMethod)
548
- ->setCcType($paymentMethod)
549
- ;
550
-
551
- // only update this when authroization notification is not yet processed
552
- Mage::log("AdyenEventCode in paymentobject order:".$order->getAdyenEventCode(), Zend_Log::DEBUG, "adyen_notification.log", true);
553
- Mage::log("paymentobject order authResult:".$authResult, Zend_Log::DEBUG, "adyen_notification.log", true);
554
-
555
- if(!(substr($order->getAdyenEventCode(), 0, 13) == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $authResult == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISED)){
556
- Mage::log("update paymentobject eventcode with:".$eventData, Zend_Log::DEBUG, "adyen_notification.log", true);
557
- $paymentObj->setAdyenEventCode($eventData);
558
- }
559
-
560
- //only original here
561
- if ($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISED
562
- || $eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION
563
- || $eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_HANDLED_EXTERNALLY
564
- || ($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_CAPTURE && $_paymentCode == "adyen_pos"))
565
- {
566
- $paymentObj->setAdyenPspReference($pspReference);
567
- if($klarnaReservationNumber != "") {
568
- $paymentObj->setAdyenKlarnaNumber($klarnaReservationNumber);
569
- }
570
- if($ccLast4 != "") {
571
- $paymentObj->setccLast4($ccLast4);
572
- }
573
- if($avsResult != "") {
574
- $paymentObj->setAdyenAvsResult($avsResult);
575
- }
576
- if($cvcResult != "") {
577
- $paymentObj->setAdyenCvcResult($cvcResult);
578
- }
579
- if($boletoPaidAmount != "") {
580
- $paymentObj->setAdyenBoletoPaidAmount($boletoPaidAmount);
581
- }
582
- if($totalFraudScore != "") {
583
- $paymentObj->setAdyenTotalFraudScore($totalFraudScore);
584
- }
585
- }
586
-
587
- try {
588
- //save all response data for a pure duplicate detection
589
- Mage::getModel('adyen/event')
590
- ->setPspReference($pspReference)
591
- ->setAdyenEventCode($eventCode)
592
- ->setAdyenEventResult($eventData)
593
- ->setIncrementId($incrementId)
594
- ->setPaymentMethod($paymentMethod)
595
- ->setCreatedAt(now())
596
- ->setSuccess($success)
597
- ->saveData($updateAdyenStatus) // don't update the adyen status
598
- ;
599
- } catch (Exception $e) {
600
- Mage::log($e->getMessage(), Zend_Log::DEBUG, "adyen_notification.log", true);
601
- }
602
- }
603
-
604
- /**
605
- * @desc Process what happened on Adyen during Hpp
606
- * @param Varien_Object $params
607
- */
608
- protected function _processPostSuccess($order, $params) {
609
-
610
- //set these attributes here
611
- $this->_addAdyenAttributes($order, $params, false);
612
- $status = false;
613
- $authResult = $params->getData('authResult');
614
- $pspReference = $params->getData('pspReference');
615
- switch ($authResult) {
616
- case Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISED:
617
- case Adyen_Payment_Model_Event::ADYEN_EVENT_PENDING:
618
- Mage::log("PAYMENT POST URL BEFORE SAVING STATUS:".$order->getStatus(), Zend_Log::DEBUG, "adyen_notification.log", true);
619
-
620
- $type = "Adyen Result URL Notification(s):";
621
- $pspReference = $params->getData('pspReference');
622
- $paymentMethod = $params->getData('paymentMethod');
623
-
624
- $comment = Mage::helper('adyen')
625
- ->__('%s <br /> authResult: %s <br /> pspReference: %s <br /> paymentMethod: %s', $type, $authResult, $pspReference, $paymentMethod);
626
-
627
- $history = Mage::getModel('sales/order_status_history')
628
- ->setStatus($status)
629
- ->setComment($comment)
630
- ->setEntityName("order")
631
- ->setOrder($order);
632
- $history->save();
633
- $status = true;
634
- // don't save the order because of interferrence with order status (set by notifications)
635
- break;
636
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLED:
637
- $paymentMethod = trim($params->getData('paymentMethod'));
638
- $isBankTransfer = $this->isBankTransfer($paymentMethod);
639
-
640
- //attempt to hold/cancel (exceptional to BankTransfer they stay in previous status/pending)
641
- if (!$isBankTransfer) {
642
- $this->_addStatusHistoryComment($order, $params);
643
- $this->holdCancelOrder($order, $params);
644
- } else {
645
- $this->_addStatusHistoryComment($order, $params, $order->getStatus());
646
- $status = true;
647
- }
648
- break;
649
- case Adyen_Payment_Model_Event::ADYEN_EVENT_REFUSED:
650
- case Adyen_Payment_Model_Event::ADYEN_EVENT_ERROR:
651
- $this->_addStatusHistoryComment($order, $params);
652
- //attempt to hold/cancel
653
- $this->holdCancelOrder($order, $params);
654
- break;
655
- default:
656
- $order->getPayment()->getMethodInstance()->writeLog('response not supported!');
657
- break;
658
- }
659
- return $status;
660
- }
661
-
662
- /**
663
- * @desc process notifications
664
- * @param type $order
665
- * @param type $response
666
- * @return type
667
- */
668
- public function notificationHandler($order, $response) {
669
- $payment = $order->getPayment()->getMethodInstance();
670
- $pspReference = trim($response->getData('pspReference'));
671
- $success = trim($response->getData('success'));
672
- $eventCode = trim($response->getData('eventCode'));
673
-
674
- //handle duplicates
675
- $isDuplicate = Mage::getModel('adyen/event')
676
- ->isDuplicate($pspReference, $eventCode, $success);
677
- if ($isDuplicate) {
678
- $payment->writeLog("#skipping duplicate notification pspReference:$pspReference && eventCode: $eventCode && success: $success");
679
- return false; //hmt
680
- }
681
-
682
- //set these attributes here
683
- $this->_addAdyenAttributes($order, $response);
684
-
685
- //add comment to the order
686
- if (strcmp($success, 'false') == 0 || !$success) {
687
- $status = ($order->isCanceled() || ($order->getState() === Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)) ?
688
- Mage_Sales_Model_Order::STATE_CANCELED : $order->getStatus();
689
- $this->_addStatusHistoryComment($order, $response, $status);
690
- } else {
691
- $this->_addStatusHistoryComment($order, $response, $order->getStatus());
692
- }
693
-
694
- //success failed
695
- if (strcmp($success, 'false') == 0 || !$success) {
696
-
697
- //attempt to hold/cancel
698
- $this->holdCancelOrder($order, $response);
699
-
700
- $payment->writeLog('success failed');
701
- //exit();
702
- return false; //hmt
703
- }
704
- return true;
705
- }
706
-
707
- /**
708
- * @desc process notifications
709
- * @param type $order
710
- * @param type $response
711
- */
712
- public function _processNotifications($order, $response) {
713
- $valid = $this->notificationHandler($order, $response); //hmt: added $valid
714
-
715
- if ($valid) {
716
- Mage::dispatchEvent('adyen_payment_process_notifications_before', array('order' => $order, 'adyen_response' => $response));
717
- if ($response->getData('handled')) {
718
- return;
719
- }
720
- $eventCode = trim($response->getData('eventCode'));
721
-
722
- $success = (bool) trim($response->getData('success'));
723
- $paymentMethod = trim($response->getData('paymentMethod'));
724
- $_paymentCode = $this->_paymentMethodCode($order);
725
- switch ($eventCode) {
726
- case Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND_FAILED:
727
- // do nothing only inform the merchant with order comment history
728
- break;
729
- case Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND:
730
-
731
- $this->refundOrder($order, $response);
732
- //refund completed
733
- $this->setRefundAuthorized($order, $success);
734
- break;
735
- case Adyen_Payment_Model_Event::ADYEN_EVENT_PENDING:
736
- if($this->_getConfigData('send_email_bank_sepa_on_pending', 'adyen_abstract')) {
737
- // Check if payment is banktransfer or sepa if true then send out order confirmation email
738
- $isBankTransfer = $this->isBankTransfer($paymentMethod);
739
- if($isBankTransfer || $paymentMethod == 'sepadirectdebit') {
740
- $order->sendNewOrderEmail(); // send order email
741
- }
742
- }
743
- break;
744
- case Adyen_Payment_Model_Event::ADYEN_EVENT_HANDLED_EXTERNALLY:
745
- case Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION:
746
- // for POS don't do anything on the AUTHORIZATION
747
- if($_paymentCode != "adyen_pos") {
748
- $this->authorizePayment($order, $success, $paymentMethod, $response);
749
- }
750
- break;
751
- case Adyen_Payment_Model_Event::ADYEN_EVENT_MANUAL_REVIEW_REJECT:
752
- // don't do anything it will send a CANCEL_OR_REFUND notification when this payment is captured
753
- break;
754
- case Adyen_Payment_Model_Event::ADYEN_EVENT_MANUAL_REVIEW_ACCEPT:
755
- // don't do anything it will send a CAPTURE notification when this payment is captured
756
- break;
757
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CAPTURE:
758
- if($_paymentCode != "adyen_pos") {
759
- $this->setPaymentAuthorized($order, $success, $response);
760
- } else {
761
- // FOR POS authorize the payment on the CAPTURE notification
762
- $this->authorizePayment($order, $success, $paymentMethod, $response);
763
- }
764
- break;
765
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CAPTURE_FAILED:
766
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLATION:
767
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLED:
768
- $this->holdCancelOrder($order, $response);
769
- break;
770
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCEL_OR_REFUND:
771
- $resultModification = trim($response->getData('additionalData_modification_action'));
772
- if(isset($resultModification) && $resultModification != "") {
773
- if($resultModification == "cancel") {
774
- $this->holdCancelOrder($order, $response);
775
- } elseif($resultModification == "refund") {
776
- $this->refundOrder($order, $response);
777
- //refund completed
778
- $this->setRefundAuthorized($order, $success);
779
- }
780
- } else {
781
- // not sure if it cancelled or refund the order
782
- $helper = Mage::helper('adyen');
783
- $order->addStatusHistoryComment($helper->__('Order is cancelled or refunded'));
784
- $order->save();
785
- }
786
- break;
787
- default:
788
- //@todo fix me cancel && error here
789
- $order->getPayment()->getMethodInstance()->writeLog('notification event not supported!');
790
- break;
791
- }
792
- }
793
- }
794
-
795
- public function authorizePayment($order, $success, $payment_method, $response) {
796
-
797
- //pre-authorise if success
798
- $order->sendNewOrderEmail(); // send order email
799
-
800
- /*
801
- * For AliPay or UnionPay sometimes it first send a AUTHORISATION false notification and then
802
- * a AUTHORISATION true notification. The second time it must revert the cancelled of the first notification before we can
803
- * assign a new status
804
- */
805
- if($success == "true") {
806
- if($payment_method == "alipay" || $payment_method == "unionpay") {
807
- foreach ($order->getAllItems() as $item) {
808
- $item->setQtyCanceled(0);
809
- $item->save();
810
- }
811
- }
812
- }
813
- $this->setPrePaymentAuthorized($order, $success);
814
-
815
- $this->createInvoice($order, $response);
816
-
817
- $_paymentCode = $this->_paymentMethodCode($order);
818
- if($payment_method == "c_cash" || ($this->_getConfigData('create_shipment', 'adyen_pos') && $_paymentCode == "adyen_pos"))
819
- {
820
- $this->createShipment($order);
821
- }
822
- }
823
-
824
- /**
825
- * @since v0.1.0.5
826
- * @param type $order
827
- * @param type $success
828
- */
829
- public function setPaymentAuthorized($order, $success = false, $response) {
830
- if ($success && !empty($order)) {
831
-
832
- $status = $this->_getConfigData('payment_authorized');
833
- // virtual order can have different status
834
- if($order->getIsVirtual()) {
835
- $virtual_status = $this->_getConfigData('payment_authorized_virtual');
836
- if($virtual_status != "") {
837
- $status = $virtual_status;
838
- }
839
- }
840
-
841
- // check for boleto if payment is totally paid
842
- if($order->getPayment()->getMethod() == "adyen_boleto") {
843
-
844
- // check if paid amount is the same as orginal amount
845
- $orginalAmount = trim($response->getData('additionalData_boletobancario_originalAmount'));
846
- $paidAmount = trim($response->getData('additionalData_boletobancario_paidAmount'));
847
-
848
- if($orginalAmount != $paidAmount) {
849
-
850
- // not the full amount is paid. Check if it is underpaid or overpaid
851
- // strip the BRL of the string
852
- $orginalAmount = str_replace("BRL", "", $orginalAmount);
853
- $orginalAmount = floatval(trim($orginalAmount));
854
-
855
- $paidAmount = str_replace("BRL", "", $paidAmount);
856
- $paidAmount = floatval(trim($paidAmount));
857
-
858
- if($paidAmount > $orginalAmount) {
859
- $overpaidStatus = $this->_getConfigData('order_overpaid_status', 'adyen_boleto');
860
- // check if there is selected a status if not fall back to the default
861
- $status = (!empty($overpaidStatus)) ? $overpaidStatus : $status;
862
- } else {
863
- $underpaidStatus = $this->_getConfigData('order_underpaid_status', 'adyen_boleto');
864
- // check if there is selected a status if not fall back to the default
865
- $status = (!empty($underpaidStatus)) ? $underpaidStatus : $status;
866
- }
867
- }
868
- }
869
-
870
- $status = (!empty($status)) ? $status : $order->getStatus();
871
- $order->addStatusHistoryComment(Mage::helper('adyen')->__('Adyen Payment Successfully completed'), $status);
872
- $order->sendOrderUpdateEmail((bool) $this->_getConfigData('send_update_mail'));
873
- Mage::log("PAYMENT CAPTURE STATUS:".$order->getStatus(), Zend_Log::DEBUG, "adyen_notification.log", true);
874
- $order->save();
875
- return true;
876
- }
877
- return false;
878
- }
879
-
880
- /**
881
- * @since v0.1.0.5
882
- * @param type $order
883
- * @param type $success
884
- */
885
- public function setPrePaymentAuthorized($order, $success = false) {
886
- if ($success && !empty($order)) {
887
- $status = $this->_getConfigData('payment_pre_authorized');
888
- $status = (!empty($status)) ? $status : $order->getStatus();
889
- $order->addStatusHistoryComment(Mage::helper('adyen')->__('Payment is pre authorised waiting for capture'), $status);
890
- $order->sendOrderUpdateEmail((bool) $this->_getConfigData('send_update_mail'));
891
- Mage::log("PAYMENT PRE AUTHORIZED STATUS:".$order->getStatus(), Zend_Log::DEBUG, "adyen_notification.log", true);
892
- $order->save();
893
- return true;
894
- }
895
- return false;
896
- }
897
-
898
- /**
899
- * @since v0.1.0.8
900
- * @param type $order
901
- * @param type $success
902
- */
903
- public function setRefundAuthorized($order, $success = false) {
904
- if ($success && !empty($order)) {
905
- $status = $this->_getConfigData('refund_authorized');
906
- $status = (!empty($status)) ? $status : $order->getStatus();
907
- $order->addStatusHistoryComment(Mage::helper('adyen')->__('Adyen Refund Successfully completed'), $status);
908
- $order->sendOrderUpdateEmail((bool) $this->_getConfigData('send_update_mail'));
909
- $order->save();
910
- return true;
911
- }
912
- return false;
913
- }
914
-
915
- /**
916
- * @desc Determine wether to create invoice or not using notifications
917
- * @param Varien_Object $response
918
- * @return true or false
919
- * @notice ideal is exception here
920
- * @since 0.0.9.x
921
- */
922
- public function isAutoCapture($response, $order) {
923
- $paymentMethod = trim($response->getData('paymentMethod'));
924
- $captureMode = trim($this->_getConfigData('capture_mode'));
925
- $sepaFlow = trim($this->_getConfigData('capture_mode', 'adyen_sepa'));
926
- $_paymentCode = $this->_paymentMethodCode($order);
927
- $captureModeOpenInvoice = $this->_getConfigData('auto_capture_openinvoice', 'adyen_abstract');
928
- $captureModePayPal = trim($this->_getConfigData('paypal_capture_mode', 'adyen_abstract'));
929
-
930
- //check if it is a banktransfer. Banktransfer only a Authorize notification is send.
931
- $isBankTransfer = $this->isBankTransfer($paymentMethod);
932
-
933
- // payment method ideal, cash or adyen_pos has direct capture
934
- if (strcmp($paymentMethod, 'ideal') === 0 || strcmp($paymentMethod, 'c_cash' ) === 0 || $_paymentCode == "adyen_pos" || $isBankTransfer == true || ($_paymentCode == "adyen_sepa" && $sepaFlow != "authcap")) {
935
- return true;
936
- }
937
- // if auto capture mode for openinvoice is turned on then use auto capture
938
- if ($captureModeOpenInvoice == true && (strcmp($paymentMethod, 'openinvoice') === 0 || strcmp($paymentMethod, 'afterpay_default') === 0 || strcmp($paymentMethod, 'klarna') === 0)) {
939
- return true;
940
- }
941
- // if PayPal capture modues is different from the default use this one
942
- if(strcmp($paymentMethod, 'paypal' ) === 0 && $captureModePayPal != "") {
943
- if(strcmp($captureModePayPal, 'auto') === 0 ) {
944
- return true;
945
- } elseif(strcmp($captureModePayPal, 'manual') === 0 ) {
946
- return false;
947
- }
948
- }
949
- if (strcmp($captureMode, 'manual') === 0) {
950
- return false;
951
- }
952
- //online capture after delivery, use Magento backend to online invoice (if the option auto capture mode for openinvoice is not set)
953
- if (strcmp($paymentMethod, 'openinvoice') === 0 || strcmp($paymentMethod, 'afterpay_default') === 0 || strcmp($paymentMethod, 'klarna') === 0) {
954
- return false;
955
- }
956
- return true;
957
- }
958
-
959
- public function isBankTransfer($paymentMethod) {
960
- if(strlen($paymentMethod) >= 12 && substr($paymentMethod, 0, 12) == "bankTransfer") {
961
- $isBankTransfer = true;
962
- } else {
963
- $isBankTransfer = false;
964
- }
965
- return $isBankTransfer;
966
- }
967
-
968
- /**
969
- * @desc Handle Refund here
970
- * @todo create credit memo && set order status to closed
971
- * @param Varien_Object $order
972
- * @param Varien_Object $response
973
- * @since 0.0.9.2
974
- */
975
- public function refundOrder($order, $response) {
976
-
977
- //skip orders with [refund-received]
978
- $pspReference = trim($response->getData('pspReference'));
979
- $result = Mage::getModel('adyen/event')
980
- ->getEvent($pspReference, '[refund-received]');
981
- if (!empty($result)) {
982
- $this->_writeLog("\nSkip refund process, as refund initiated via Magento id: {$order->getIncrementId()}");
983
- return false;
984
- }
985
-
986
- $_mail = (bool) $this->_getConfigData('send_update_mail');
987
- $amount = $response->getValue() / 100;
988
-
989
- if ($order->canCreditmemo()) {
990
- $service = Mage::getModel('sales/service_order', $order);
991
- $creditmemo = $service->prepareCreditmemo();
992
- $creditmemo->getOrder()->setIsInProcess(true);
993
-
994
- //set refund data on the order
995
- $creditmemo->setGrandTotal($amount);
996
- $creditmemo->setBaseGrandTotal($amount);
997
- $creditmemo->save();
998
-
999
- try {
1000
- Mage::getModel('core/resource_transaction')
1001
- ->addObject($creditmemo)
1002
- ->addObject($creditmemo->getOrder())
1003
- ->save();
1004
- //refund
1005
- $creditmemo->refund();
1006
- $transactionSave = Mage::getModel('core/resource_transaction')
1007
- ->addObject($creditmemo)
1008
- ->addObject($creditmemo->getOrder());
1009
- if ($creditmemo->getInvoice()) {
1010
- $transactionSave->addObject($creditmemo->getInvoice());
1011
- }
1012
- $transactionSave->save();
1013
- if ($_mail) {
1014
- $creditmemo->getOrder()->setCustomerNoteNotify(true);
1015
- $creditmemo->sendEmail();
1016
- }
1017
- } catch (Exception $e) {
1018
- $this->_writeLog($e->getMessage());
1019
- }
1020
- } else {
1021
- $this->_writeLog("\nOrder can not refund {$order->getIncrementId()}");
1022
- }
1023
- }
1024
-
1025
- /**
1026
- * @desc Create invoice
1027
- * @param type $order
1028
- * @param type $response
1029
- * @return type
1030
- */
1031
- public function createInvoice($order, $response) {
1032
- $payment = $order->getPayment()->getMethodInstance();
1033
- $pspReference = trim($response->getData('pspReference'));
1034
- $success = trim($response->getData('success'));
1035
- $eventCode = trim($response->getData('eventCode'));
1036
- $reason = trim($response->getData('reason'));
1037
- $invoiceAutoMail = (bool) $this->_getConfigData('send_invoice_update_mail');
1038
- $_mail = (bool) $this->_getConfigData('send_update_mail');
1039
-
1040
- //create invoice
1041
- if (strcmp($order->getState(), Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) == 0) {
1042
- $order->setState(Mage_Sales_Model_Order::STATE_NEW);
1043
- }
1044
-
1045
- //capture mode
1046
- if (!$this->isAutoCapture($response, $order)) {
1047
- $order->addStatusHistoryComment(Mage::helper('adyen')->__('Capture Mode set to Manual'));
1048
- $order->sendOrderUpdateEmail($_mail);
1049
- $order->save();
1050
- return false;
1051
- }
1052
-
1053
- //$order->addStatusHistoryComment(Mage::helper('adyen')->__('Adyen Payment Successfully completed'), $status);
1054
-
1055
-
1056
- if ($order->canInvoice()) {
1057
- $invoice = $order->prepareInvoice();
1058
- $invoice->getOrder()->setIsInProcess(true);
1059
- // set transaction id so you can do a online refund this is used instead of online capture
1060
- // because it is already auto capture in Adyen Backoffice
1061
- $invoice->setTransactionId(1);
1062
- $invoice->register()->pay();
1063
- try {
1064
- Mage::getModel('core/resource_transaction')
1065
- ->addObject($invoice)
1066
- ->addObject($invoice->getOrder())
1067
- ->save();
1068
- } catch (Exception $e) {
1069
- $payment->writeLog($e->getMessage());
1070
- }
1071
-
1072
- //selected adyen status
1073
- $this->setPaymentAuthorized($order, $success, $response);
1074
-
1075
- if ($invoiceAutoMail) {
1076
- $invoice->sendEmail();
1077
- }
1078
- }
1079
- $order->sendOrderUpdateEmail($_mail);
1080
- $order->save();
1081
- }
1082
-
1083
- public function createShipment($order) {
1084
- // create shipment for cash payment
1085
- $payment = $order->getPayment()->getMethodInstance();
1086
- if($order->canShip()) {
1087
- // $itemQty = $order->getItemsCollection()->count();
1088
-
1089
- $itemQty = array();
1090
- // $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
1091
- $shipment = $order->prepareShipment($itemQty);
1092
- if($shipment) {
1093
- $shipment->register();
1094
- $shipment->getOrder()->setIsInProcess(true);
1095
- $comment = Mage::helper('adyen')->__('Shipment created by Adyen');
1096
- $shipment->addComment($comment);
1097
- Mage::getModel('core/resource_transaction')
1098
- ->addObject($shipment)
1099
- ->addObject($shipment->getOrder())
1100
- ->save();
1101
- }
1102
- } else {
1103
- $payment->writeLog("Order can't be shipped");
1104
- }
1105
- }
1106
-
1107
- /**
1108
- * @desc order comments or history
1109
- * @param type $order
1110
- * @param Varien_Object $response
1111
- */
1112
- protected function _addStatusHistoryComment($order, Varien_Object $response, $status = false) {
1113
- Mage::log("_addStatusHistoryComment", Zend_Log::DEBUG, "adyen_notification.log", true);
1114
-
1115
- //notification
1116
- $pspReference = $response->getData('pspReference');
1117
- $success = trim($response->getData('success'));
1118
- $success_result = (strcmp($success, 'false') == 0 || !$success) ? 'false' : 'true';
1119
- $eventCode = $response->getData('eventCode');
1120
- $reason = $response->getData('reason');
1121
- $success = (!empty($reason)) ? "$success_result <br />reason:$reason" : $success_result;
1122
- $klarnaReservationNumber = $response->getData('additionalData_additionalData_acquirerReference');
1123
- $boletoPaidAmount = $response->getData('additionalData_boletobancario_paidAmount');
1124
-
1125
- //post
1126
- $authResult = $response->getData('authResult');
1127
- $pspReference = $response->getData('pspReference');
1128
-
1129
- //payment method
1130
- $paymentMethod = $response->getData('paymentMethod');
1131
-
1132
- //data type
1133
- $type = (!empty($authResult)) ? 'Adyen Result URL Notification(s):' : 'Adyen HTTP Notification(s):';
1134
- switch ($type) {
1135
- case 'Adyen Result URL Notification(s):':
1136
- /*PCD*/ // choose not to update the adyen_event_code in the order when the order is already on notification:Authorisation status and authresult = resultURL:Authorised
1137
- if(!(substr($order->getAdyenEventCode(), 0, 13) == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $authResult == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISED)){
1138
- Mage::log("Adyen Result URL order authResult:".$authResult, Zend_Log::DEBUG, "adyen_notification.log", true);
1139
-
1140
- $order->setAdyenEventCode($authResult);
1141
- }
1142
- $comment = Mage::helper('adyen')
1143
- ->__('%s <br /> authResult: %s <br /> pspReference: %s <br /> paymentMethod: %s', $type, $authResult, $pspReference, $paymentMethod);
1144
- break;
1145
- default:
1146
- Mage::log("default order authResult:".$eventCode . " : " . strtoupper($success_result), Zend_Log::DEBUG, "adyen_notification.log", true);
1147
-
1148
- if($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND) {
1149
-
1150
- $currency = $order->getOrderCurrencyCode();
1151
-
1152
- // check if it is a full or partial refund
1153
- $amount = Mage::helper('adyen')->formatAmount(($response->getValue() / 100), $currency);
1154
- $orderAmount = Mage::helper('adyen')->formatAmount($order->getGrandTotal(), $currency);
1155
-
1156
- if($amount == $orderAmount) {
1157
- $order->setAdyenEventCode($eventCode . " : " . strtoupper($success_result));
1158
- } else {
1159
- $order->setAdyenEventCode("(PARTIAL) " . $eventCode . " : " . strtoupper($success_result));
1160
- }
1161
- } else {
1162
- $order->setAdyenEventCode($eventCode . " : " . strtoupper($success_result));
1163
- }
1164
-
1165
- // if payment method is klarna or openinvoice/afterpay show the reservartion number
1166
- if(($paymentMethod == "klarna" || $paymentMethod == "afterpay_default" || $paymentMethod == "openinvoice") && ($klarnaReservationNumber != null && $klarnaReservationNumber != "")) {
1167
- $klarnaReservationNumberText = "<br /> reservationNumber: " . $klarnaReservationNumber;
1168
- } else {
1169
- $klarnaReservationNumberText = "";
1170
- }
1171
-
1172
- if($boletoPaidAmount != null && $boletoPaidAmount != "") {
1173
- $boletoPaidAmountText = "<br /> Paid amount: " . $boletoPaidAmount;
1174
- } else {
1175
- $boletoPaidAmountText = "";
1176
- }
1177
-
1178
- $comment = Mage::helper('adyen')
1179
- ->__('%s <br /> eventCode: %s <br /> pspReference: %s <br /> paymentMethod: %s <br /> success: %s %s %s', $type, $eventCode, $pspReference, $paymentMethod, $success, $klarnaReservationNumberText, $boletoPaidAmountText);
1180
-
1181
- break;
1182
- }
1183
-
1184
- $order->addStatusHistoryComment($comment, $status);
1185
- $order->save();
1186
- }
1187
-
1188
- /**
1189
- * Handle order cancellation && success failure on notifications
1190
- * Called for all failed notifications, even cancellations
1191
- * @param unknown_type $order
1192
- * @param unknown_type $response
1193
- */
1194
- public function holdCancelOrder($order, $response = null) {
1195
- $eventCode = trim($response->getData('eventCode'));
1196
- $orderStatus = $this->_getConfigData('payment_cancelled');
1197
- switch ($eventCode) {
1198
- case Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND:
1199
- $orderStatus = Mage_Sales_Model_Order::STATE_HOLDED;
1200
- break;
1201
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLATION:
1202
- case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLED:
1203
- $orderStatus = Mage_Sales_Model_Order::STATE_CANCELED;
1204
- break;
1205
- }
1206
- $_mail = (bool) $this->_getConfigData('send_update_mail');
1207
- $helper = Mage::helper('adyen');
1208
- switch ($orderStatus) {
1209
- case Mage_Sales_Model_Order::STATE_HOLDED:
1210
- $order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_HOLD, true);
1211
- if (!$order->canHold()) {
1212
- $this->_writeLog('order can not hold or is already on Hold', $order);
1213
- $order->addStatusHistoryComment($helper->__('Order can not Hold or is already on Hold'), Mage_Sales_Model_Order::STATE_HOLDED);
1214
- $order->save();
1215
- return false;
1216
- }
1217
- $order->hold()->save();
1218
- break;
1219
- case Mage_Sales_Model_Order::STATE_CANCELED:
1220
- $order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CANCEL, true);
1221
- if (!$order->canCancel()) {
1222
- $this->_writeLog('order can not be canceled', $order);
1223
- $order->addStatusHistoryComment($helper->__('Order can not be canceled or is already canceled'), Mage_Sales_Model_Order::STATE_CANCELED);
1224
- $order->save();
1225
- return false;
1226
- }
1227
- $order->cancel()->save();
1228
- break;
1229
- }
1230
- $order->sendOrderUpdateEmail($_mail);
1231
- $order->save();
1232
- return true;
1233
- }
1234
-
1235
  protected function _writeLog($str, $order = null) {
1236
  if (!empty($order)) {
1237
  $order->getPayment()->getMethodInstance()->writeLog($str);
1238
  }
1239
  }
1240
 
1241
- protected function _getCheckout() {
1242
- return Mage::getSingleton('checkout/session');
1243
- }
1244
-
1245
- protected function _getOrder() {
1246
- return Mage::getModel('sales/order');
1247
- }
1248
-
1249
- /**
1250
- * @since 0.0.1
1251
- * @desprecated since 0.0.2, over _getPayment
1252
- */
1253
- protected function _getHpp() {
1254
- return Mage::getModel('adyen/adyen_hpp');
1255
- }
1256
-
1257
- /**
1258
- * @since 0.0.2
1259
- * @param unknown_type $order
1260
- */
1261
- protected function _paymentMethodCode($order) {
1262
- return $order->getPayment()->getMethod();
1263
- }
1264
-
1265
- /**
1266
- * @since 0.0.2
1267
- * @param unknown_type $order
1268
- */
1269
- protected function _getPayment($order) {
1270
- $_paymentCode = $this->_paymentMethodCode($order);
1271
- //@todo strict $paymentMethodCode to known payment methods i.e adyen_hpp, adyen_cc,adyen_elv
1272
- return Mage::getModel("adyen/$_paymentCode");
1273
- }
1274
-
1275
  /**
1276
  * @desc Give Default settings
1277
  * @example $this->_getConfigData('demoMode','adyen_abstract')
@@ -1282,12 +142,8 @@ class Adyen_Payment_Model_Process extends Mage_Core_Model_Abstract {
1282
  return Mage::helper('adyen')->_getConfigData($code, $paymentMethodCode, $storeId);
1283
  }
1284
 
1285
- public function getConfigData($code, $paymentMethodCode = null, $storeId = null) {
1286
- return $this->_getConfigData($code, $paymentMethodCode, $storeId);
1287
- }
1288
-
1289
  public function getRequest() {
1290
  return Mage::app()->getRequest();
1291
  }
1292
 
1293
- }
27
  */
28
  class Adyen_Payment_Model_Process extends Mage_Core_Model_Abstract {
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  public function processCashResponse()
31
  {
32
  $response = $_REQUEST;
86
  ->setEntityName("order")
87
  ->setOrder($order);
88
  $history->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  return $status;
90
  }
91
  }
92
  return false;
93
  }
94
 
95
+ protected function _getSecretWord() {
96
  switch ($this->getConfigDataDemoMode()) {
97
  case true:
98
  $secretWord = trim($this->_getConfigData('secret_wordt', 'adyen_hpp'));
126
  return $orderExist;
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  protected function _writeLog($str, $order = null) {
130
  if (!empty($order)) {
131
  $order->getPayment()->getMethodInstance()->writeLog($str);
132
  }
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  /**
136
  * @desc Give Default settings
137
  * @example $this->_getConfigData('demoMode','adyen_abstract')
142
  return Mage::helper('adyen')->_getConfigData($code, $paymentMethodCode, $storeId);
143
  }
144
 
 
 
 
 
145
  public function getRequest() {
146
  return Mage::app()->getRequest();
147
  }
148
 
149
+ }
app/code/community/Adyen/Payment/Model/ProcessNotification.php ADDED
@@ -0,0 +1,1235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_ProcessNotification extends Mage_Core_Model_Abstract {
29
+
30
+
31
+ /**
32
+ * Collected debug information
33
+ *
34
+ * @var array
35
+ */
36
+ protected $_debugData = array();
37
+
38
+ /**
39
+ * Process the notification that is received by the Adyen platform
40
+ * @param $response
41
+ * @return string
42
+ */
43
+ public function processResponse($response)
44
+ {
45
+ // SOAP, JSON, HTTP POST
46
+ $storeId = null;
47
+
48
+ $this->_debugData['processResponse begin'] = 'Begin to process Notification';
49
+
50
+ if (empty($response)) {
51
+ $this->_debugData['error'] = 'Response is empty, please check your webserver that the result url accepts parameters';
52
+ $this->_debug($storeId);
53
+ return "401";
54
+ }
55
+
56
+ // Log the results in log file and adyen_debug table
57
+ $this->_debugData['response'] = $response;
58
+ Mage::getResourceModel('adyen/adyen_debug')->assignData($response);
59
+
60
+ // $params = new Varien_Object($response);
61
+ // Create Varien_Object from response (soap compatible)
62
+ $params = new Varien_Object();
63
+ foreach ($response as $code => $value) {
64
+ $params->setData($code, $value);
65
+ }
66
+ $actionName = $this->_getRequest()->getActionName();
67
+
68
+ // authenticate result url
69
+ $authStatus = Mage::getModel('adyen/authenticate')->authenticate($actionName, $params);
70
+ if (!$authStatus) {
71
+ $this->_debugData['error'] = 'Autentication failure please check your notification username and password. This must be the same in Magento as in the Adyen platform';
72
+ $this->_debug($storeId);
73
+ return "401";
74
+ }
75
+
76
+ // skip notification if notification is REPORT_AVAILABLE
77
+ $eventCode = trim($params->getData('eventCode'));
78
+ if($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_REPORT_AVAILABLE) {
79
+ $this->_debugData['processResponse info'] = 'Skip notification REPORT_AVAILABLE';
80
+ $this->_debug($storeId);
81
+ return;
82
+ }
83
+
84
+ // check if notification is not duplicate
85
+ if(!$this->_isDuplicate($params)) {
86
+
87
+ $incrementId = $params->getData('merchantReference');
88
+
89
+ if($incrementId) {
90
+ $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
91
+ if ($order->getId()) {
92
+
93
+ if($this->_validateNotification($order, $params)) {
94
+
95
+ // set StoreId for retrieving debug log setting
96
+ $storeId = $order->getStoreId();
97
+
98
+ $this->_updateOrder($order, $params);
99
+
100
+ } else {
101
+ $this->_debugData['info'] = 'Order does not validate payment method in Magento don\'t match with payment method in notification';
102
+ }
103
+ } else {
104
+ $this->_debugData['error'] = 'Order does not exists with increment_id: ' . $incrementId;
105
+ $this->_addNotificationToQueue($params);
106
+ }
107
+ } else {
108
+ $this->_debugData['error'] = 'Empty merchantReference';
109
+ }
110
+ } else {
111
+ $this->_debugData['processResponse info'] = 'Skipping duplicate notification';
112
+ }
113
+
114
+ // update the queue if it is not processed by cronjob
115
+ if(!$this->_getConfigData('update_notification_cronjob')) {
116
+ $this->_updateNotProcessedNotifications();
117
+ }
118
+
119
+ $this->_debug($storeId);
120
+ }
121
+
122
+ /**
123
+ * Check if notification is already received
124
+ * If this is the case ignore the notification
125
+ * @param $params
126
+ * @return bool
127
+ */
128
+ protected function _isDuplicate($params)
129
+ {
130
+ $pspReference = trim($params->getData('pspReference'));
131
+ $success = trim($params->getData('success'));
132
+ $eventCode = trim($params->getData('eventCode'));
133
+
134
+ // if notification is already processed ignore it
135
+ $isDuplicate = Mage::getModel('adyen/event')
136
+ ->isDuplicate($pspReference, $eventCode, $success);
137
+ if ($isDuplicate && $eventCode != Adyen_Payment_Model_Event::ADYEN_EVENT_RECURRING_CONTRACT) {
138
+ return true;
139
+ }
140
+ return false;
141
+ }
142
+
143
+ /**
144
+ * Extra validation check on the payment method
145
+ * @param $order
146
+ * @param $params
147
+ * @return bool
148
+ */
149
+ protected function _validateNotification($order, $params)
150
+ {
151
+ $paymentMethod = trim(strtolower($params->getData('paymentMethod')));
152
+
153
+ if($paymentMethod != '') {
154
+ $orderPaymentMethod = strtolower($this->_paymentMethodCode($order));
155
+
156
+ // Only possible for the Adyen HPP payment method
157
+ if($orderPaymentMethod == 'adyen_hpp') {
158
+ if(substr($orderPaymentMethod, 0, 6) == 'adyen_') {
159
+ if(substr($orderPaymentMethod, 0, 10) == 'adyen_hpp_') {
160
+ $orderPaymentMethod = substr($orderPaymentMethod, 10);
161
+ } else {
162
+ $orderPaymentMethod = substr($orderPaymentMethod, 6);
163
+ }
164
+ }
165
+ } else {
166
+ return true;
167
+ }
168
+
169
+ $this->_debugData['_validateNotification'] = 'Payment method in Magento is: ' . $orderPaymentMethod . ", payment method in notification is: " . $paymentMethod;
170
+
171
+ if($orderPaymentMethod == $paymentMethod) {
172
+ return true;
173
+ } else {
174
+ return false;
175
+ }
176
+ }
177
+ // if payment method in notification is empty just process it
178
+ return true;
179
+ }
180
+
181
+ // notification attributes
182
+ protected $_pspReference;
183
+ protected $_merchantReference;
184
+ protected $_eventCode;
185
+ protected $_success;
186
+ protected $_paymentMethod;
187
+ protected $_reason;
188
+ protected $_value;
189
+ protected $_boletoOriginalAmount;
190
+ protected $_boletoPaidAmount;
191
+ protected $_modificationResult;
192
+ protected $_klarnaReservationNumber;
193
+ protected $_fraudManualReview;
194
+
195
+ /**
196
+ * @param $order
197
+ * @param $params
198
+ */
199
+ protected function _updateOrder($order, $params)
200
+ {
201
+ $this->_debugData['_updateOrder'] = 'Updating the order';
202
+
203
+ Mage::dispatchEvent('adyen_payment_process_notifications_before', array('order' => $order, 'adyen_response' => $params));
204
+ if ($params->getData('handled')) {
205
+ $this->_debug($order->getStoreId());
206
+ return;
207
+ }
208
+
209
+ $this->_declareVariables($order, $params);
210
+
211
+ $previousAdyenEventCode = $order->getAdyenEventCode();
212
+
213
+ // add notification to comment history status is current status
214
+ $this->_addStatusHistoryComment($order);
215
+
216
+ // update order details
217
+ $this->_updateAdyenAttributes($order, $params);
218
+
219
+ // check if success is true of false
220
+ if (strcmp($this->_success, 'false') == 0 || strcmp($this->_success, '0') == 0) {
221
+ // Only cancel the order when it is in state pending, payment review or if the ORDER_CLOSED is failed (means split payment has not be successful)
222
+ if($order->getState() === Mage_Sales_Model_Order::STATE_PENDING_PAYMENT || $order->getState() === Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW || $this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_ORDER_CLOSED) {
223
+ $this->_debugData['_updateOrder info'] = 'Going to cancel the order';
224
+
225
+ // if payment is API check, check if API result pspreference is the same as reference
226
+ if($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $this->_getPaymentMethodType($order) == 'api') {
227
+ if($this->_pspReference == $order->getPayment()->getAdyenPspReference()) {
228
+ // don't cancel the order if previous state is authorisation with success=true
229
+ if($previousAdyenEventCode != "AUTHORISATION : TRUE") {
230
+ $this->_holdCancelOrder($order, false);
231
+ } else {
232
+ $order->setAdyenEventCode($previousAdyenEventCode); // do not update the adyenEventCode
233
+ $this->_debugData['_updateOrder warning'] = 'order is not cancelled because previous notification was a authorisation that succeeded';
234
+ }
235
+ } else {
236
+ $this->_debugData['_updateOrder warning'] = 'order is not cancelled because pspReference does not match with the order';
237
+ }
238
+ } else {
239
+ // don't cancel the order if previous state is authorisation with success=true
240
+ if($previousAdyenEventCode != "AUTHORISATION : TRUE") {
241
+ $this->_holdCancelOrder($order, false);
242
+ } else {
243
+ $order->setAdyenEventCode($previousAdyenEventCode); // do not update the adyenEventCode
244
+ $this->_debugData['_updateOrder warning'] = 'order is not cancelled because previous notification was a authorisation that succeeded';
245
+ }
246
+ }
247
+ } else {
248
+ $this->_debugData['_updateOrder info'] = 'Order is already processed so ignore this notification state is:' . $order->getState();
249
+ }
250
+ } else {
251
+ // Notification is successful
252
+ $this->_processNotification($order);
253
+ }
254
+
255
+ // save event for duplication
256
+ $this->_storeNotification();
257
+
258
+ // update the order with status/adyen event and comment history
259
+ $order->save();
260
+
261
+ Mage::dispatchEvent('adyen_payment_process_notifications_after', array('order' => $order, 'adyen_response' => $params));
262
+ }
263
+
264
+ protected function _declareVariables($order, $params)
265
+ {
266
+ // declare the common parameters
267
+ $this->_pspReference = trim($params->getData('pspReference'));
268
+ $this->_merchantReference = trim($params->getData('merchantReference'));
269
+ $this->_eventCode = trim($params->getData('eventCode'));
270
+ $this->_success = trim($params->getData('success'));
271
+ $this->_paymentMethod = trim($params->getData('paymentMethod'));
272
+ $this->_reason = trim($params->getData('reason'));
273
+
274
+ $valueArray = $params->getData('amount');
275
+ if($valueArray && is_array($valueArray)) {
276
+ $this->_value = isset($valueArray['value']) ? $valueArray['value'] : "";
277
+ }
278
+
279
+ $additionalData = $params->getData('additionalData');
280
+
281
+ // boleto data
282
+ if($this->_paymentMethodCode($order) == "adyen_boleto") {
283
+ if($additionalData && is_array($additionalData)) {
284
+ $boletobancario = isset($additionalData['boletobancario']) ? $additionalData['boletobancario'] : null;
285
+ if($boletobancario && is_array($boletobancario)) {
286
+ $this->_boletoOriginalAmount = isset($boletobancario['originalAmount']) ? trim($boletobancario['originalAmount']) : "";
287
+ $this->_boletoPaidAmount = isset($boletobancario['paidAmount']) ? trim($boletobancario['paidAmount']) : "";
288
+ }
289
+ }
290
+ }
291
+
292
+ if($additionalData && is_array($additionalData)) {
293
+
294
+ // check if the payment is in status manual review
295
+ $fraudManualReview = isset($additionalData['fraudManualReview']) ? $additionalData['fraudManualReview'] : "";
296
+ if($fraudManualReview == "true") {
297
+ $this->_fraudManualReview = true;
298
+ } else {
299
+ $this->_fraudManualReview = false;
300
+ }
301
+
302
+ $modification = isset($additionalData['modification']) ? $additionalData['modification'] : null;
303
+ if($modification && is_array($modification)) {
304
+ $this->_modificationResult = isset($valueArray['action']) ? trim($modification['action']) : "";
305
+ }
306
+ $additionalData2 = isset($additionalData['additionalData']) ? $additionalData['additionalData'] : null;
307
+ if($additionalData2 && is_array($additionalData2)) {
308
+ $this->_klarnaReservationNumber = isset($additionalData2['acquirerReference']) ? trim($additionalData2['acquirerReference']) : "";
309
+ }
310
+ }
311
+ }
312
+
313
+ /**
314
+ * @param $order
315
+ * @param $params
316
+ */
317
+ protected function _updateAdyenAttributes($order, $params)
318
+ {
319
+ $this->_debugData['_updateAdyenAttributes'] = 'Updating the Adyen attributes of the order';
320
+
321
+ $additionalData = $params->getData('additionalData');
322
+ if($additionalData && is_array($additionalData)) {
323
+ $avsResult = (isset($additionalData['avsResult'])) ? $additionalData['avsResult'] : "";
324
+ $cvcResult = (isset($additionalData['cvcResult'])) ? $additionalData['cvcResult'] : "";
325
+ $totalFraudScore = (isset($additionalData['totalFraudScore'])) ? $additionalData['totalFraudScore'] : "";
326
+ $ccLast4 = (isset($additionalData['cardSummary'])) ? $additionalData['cardSummary'] : "";
327
+ $refusalReasonRaw = (isset($additionalData['refusalReasonRaw'])) ? $additionalData['refusalReasonRaw'] : "";
328
+ $acquirerReference = (isset($additionalData['acquirerReference'])) ? $additionalData['acquirerReference'] : "";
329
+ $authCode = (isset($additionalData['authCode'])) ? $additionalData['authCode'] : "";
330
+ }
331
+
332
+ $paymentObj = $order->getPayment();
333
+ $_paymentCode = $this->_paymentMethodCode($order);
334
+
335
+ // if there is no server communication setup try to get last4 digits from reason field
336
+ if(!isset($ccLast4) || $ccLast4 == "") {
337
+ $ccLast4 = $this->_retrieveLast4DigitsFromReason($this->_reason);
338
+ }
339
+ $paymentObj->setLastTransId($this->_merchantReference)
340
+ ->setCcType($this->_paymentMethod);
341
+
342
+ if ($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION
343
+ || $this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_HANDLED_EXTERNALLY
344
+ || ($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_CAPTURE && $_paymentCode == "adyen_pos"))
345
+ {
346
+ $paymentObj->setAdyenPspReference($this->_pspReference);
347
+ if($this->_klarnaReservationNumber != "") {
348
+ $paymentObj->setAdyenKlarnaNumber($this->_klarnaReservationNumber);
349
+ }
350
+ if(isset($ccLast4) && $ccLast4 != "") {
351
+ $paymentObj->setccLast4($ccLast4);
352
+ }
353
+ if(isset($avsResult) && $avsResult != "") {
354
+ $paymentObj->setAdyenAvsResult($avsResult);
355
+ }
356
+ if(isset($cvcResult) && $cvcResult != "") {
357
+ $paymentObj->setAdyenCvcResult($cvcResult);
358
+ }
359
+ if($this->_boletoPaidAmount != "") {
360
+ $paymentObj->setAdyenBoletoPaidAmount($this->_boletoPaidAmount);
361
+ }
362
+ if(isset($totalFraudScore) && $totalFraudScore != "") {
363
+ $paymentObj->setAdyenTotalFraudScore($totalFraudScore);
364
+ }
365
+ if(isset($refusalReasonRaw) && $refusalReasonRaw != "") {
366
+ $paymentObj->setAdyenRefusalReasonRaw($refusalReasonRaw);
367
+ }
368
+ if(isset($acquirerReference) && $acquirerReference != "") {
369
+ $paymentObj->setAdyenAcquirerReference($acquirerReference);
370
+ }
371
+ if(isset($authCode) && $authCode != "") {
372
+ $paymentObj->setAdyenAuthCode($authCode);
373
+ }
374
+ }
375
+
376
+ }
377
+
378
+ /**
379
+ * retrieve last 4 digits of card from the reason field
380
+ * @param $reason
381
+ * @return string
382
+ */
383
+ protected function _retrieveLast4DigitsFromReason($reason)
384
+ {
385
+ $result = "";
386
+
387
+ if($reason != "") {
388
+ $reasonArray = explode(":", $reason);
389
+ if($reasonArray != null && is_array($reasonArray)) {
390
+ if(isset($reasonArray[1])) {
391
+ $result = $reasonArray[1];
392
+ }
393
+ }
394
+ }
395
+ return $result;
396
+ }
397
+
398
+ /**
399
+ * @param $order
400
+ * @param $params
401
+ */
402
+ protected function _storeNotification()
403
+ {
404
+ $success = ($this->_success == "true" || $this->_success == "1") ? true : false;
405
+
406
+ try {
407
+ //save all response data for a pure duplicate detection
408
+ Mage::getModel('adyen/event')
409
+ ->setPspReference($this->_pspReference)
410
+ ->setAdyenEventCode($this->_eventCode)
411
+ ->setAdyenEventResult($this->_eventCode)
412
+ ->setIncrementId($this->_merchantReference)
413
+ ->setPaymentMethod($this->_paymentMethod)
414
+ ->setCreatedAt(now())
415
+ ->setSuccess($success)
416
+ ->saveData();
417
+
418
+ $this->_debugData['_storeNotification'] = 'Notification is saved in adyen_event_data table';
419
+ } catch (Exception $e) {
420
+ $this->_debugData['_storeNotification error'] = 'Notification could not be saved in adyen_event_data table error message is: ' . $e->getMessage() ;
421
+ Mage::logException($e);
422
+ }
423
+ }
424
+
425
+ /**
426
+ * @param $order
427
+ * @param $params
428
+ */
429
+ protected function _processNotification($order)
430
+ {
431
+ $this->_debugData['_processNotification'] = 'Processing the notification';
432
+ $_paymentCode = $this->_paymentMethodCode($order);
433
+
434
+ switch ($this->_eventCode) {
435
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND_FAILED:
436
+ // do nothing only inform the merchant with order comment history
437
+ break;
438
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND:
439
+ $ignoreRefundNotification = $this->_getConfigData('ignore_refund_notification', 'adyen_abstract', $order->getStoreId());
440
+ if($ignoreRefundNotification != true) {
441
+ $this->_refundOrder($order);
442
+ //refund completed
443
+ $this->_setRefundAuthorized($order);
444
+ } else {
445
+ $this->_debugData['_processNotification info'] = 'Setting to ignore refund notification is enabled so ignore this notification';
446
+ }
447
+ break;
448
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_PENDING:
449
+ if($this->_getConfigData('send_email_bank_sepa_on_pending', 'adyen_abstract', $order->getStoreId())) {
450
+ // Check if payment is banktransfer or sepa if true then send out order confirmation email
451
+ $isBankTransfer = $this->_isBankTransfer($this->_paymentMethod);
452
+ if($isBankTransfer || $this->_paymentMethod == 'sepadirectdebit') {
453
+ $order->sendNewOrderEmail(); // send order email
454
+ $this->_debugData['_processNotification send email'] = 'Send orderconfirmation email to shopper';
455
+ }
456
+ }
457
+ break;
458
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_HANDLED_EXTERNALLY:
459
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION:
460
+ // for POS don't do anything on the AUTHORIZATION
461
+ if($_paymentCode != "adyen_pos") {
462
+ $this->_authorizePayment($order, $this->_paymentMethod);
463
+ }
464
+ break;
465
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_MANUAL_REVIEW_REJECT:
466
+ // don't do anything it will send a CANCEL_OR_REFUND notification when this payment is captured
467
+ break;
468
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_MANUAL_REVIEW_ACCEPT:
469
+ // only process this if you are on auto capture. On manual capture you will always get Capture or CancelOrRefund notification
470
+ if ($this->_isAutoCapture($order)) {
471
+ $this->_setPaymentAuthorized($order, false);
472
+ }
473
+ break;
474
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_CAPTURE:
475
+ if($_paymentCode != "adyen_pos") {
476
+ // ignore capture if you are on auto capture (this could be called if manual review is enabled and you have a capture delay)
477
+ if (!$this->_isAutoCapture($order)) {
478
+ $this->_setPaymentAuthorized($order, false);
479
+ }
480
+ } else {
481
+
482
+ // uncancel the order just to be sure that order is going trough
483
+ $this->_uncancelOrder($order);
484
+
485
+ // FOR POS authorize the payment on the CAPTURE notification
486
+ $this->_authorizePayment($order, $this->_paymentMethod);
487
+ }
488
+ break;
489
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_CAPTURE_FAILED:
490
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLATION:
491
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLED:
492
+ $this->_holdCancelOrder($order, true);
493
+ break;
494
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCEL_OR_REFUND:
495
+ if(isset($this->_modificationResult) && $this->_modificationResult != "") {
496
+ if($this->_modificationResult == "cancel") {
497
+ $this->_holdCancelOrder($order, true);
498
+ } elseif($this->_modificationResult == "refund") {
499
+ $this->_refundOrder($order);
500
+ //refund completed
501
+ $this->_setRefundAuthorized($order);
502
+ }
503
+ } else {
504
+ $orderStatus = $this->_getConfigData('order_status', 'adyen_abstract', $order->getStoreId());
505
+ if(($orderStatus != Mage_Sales_Model_Order::STATE_HOLDED && $order->canCancel()) || ($orderStatus == Mage_Sales_Model_Order::STATE_HOLDED && $order->canHold())) {
506
+ // cancel order
507
+ $this->_debugData['_processNotification'] = 'try to cancel the order';
508
+ $this->_holdCancelOrder($order, true);
509
+ } else {
510
+ $this->_debugData['_processNotification'] = 'try to refund the order';
511
+ // refund
512
+ $this->_refundOrder($order);
513
+ //refund completed
514
+ $this->_setRefundAuthorized($order);
515
+ }
516
+ }
517
+ break;
518
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_RECURRING_CONTRACT:
519
+
520
+ // get payment object
521
+ $payment = $order->getPayment();
522
+
523
+ // save recurring contract (not for oneclicks because billing agreement does already exists
524
+ if($_paymentCode != "adyen_oneclick") {
525
+
526
+ // storedReferenceCode
527
+ $recurringDetailReference = $this->_pspReference;
528
+
529
+ // check if there is already a BillingAgreement
530
+ $agreement = Mage::getModel('sales/billing_agreement')->load($recurringDetailReference, 'reference_id');
531
+
532
+ if ($agreement && $agreement->getAgreementId() > 0 && $agreement->isValid()) {
533
+
534
+ $agreement->addOrderRelation($order);
535
+ $agreement->setIsObjectChanged(true);
536
+ $order->addRelatedObject($agreement);
537
+ $message = Mage::helper('adyen')->__('Used existing billing agreement #%s.', $agreement->getReferenceId());
538
+
539
+ } else {
540
+ // set billing agreement data
541
+ $payment->setBillingAgreementData(array(
542
+ 'billing_agreement_id' => $recurringDetailReference,
543
+ 'method_code' => $payment->getMethodCode()
544
+ ));
545
+
546
+ // create billing agreement for this order
547
+ $agreement = Mage::getModel('sales/billing_agreement')->importOrderPayment($payment);
548
+ $agreement->setAgreementLabel($payment->getMethodInstance()->getTitle());
549
+
550
+ if ($agreement->isValid()) {
551
+ $message = Mage::helper('adyen')->__('Created billing agreement #%s.', $agreement->getReferenceId());
552
+
553
+ // save into sales_billing_agreement_order
554
+ $agreement->addOrderRelation($order);
555
+
556
+ // add to order to save agreement
557
+ $order->addRelatedObject($agreement);
558
+ } else {
559
+ $message = Mage::helper('adyen')->__('Failed to create billing agreement for this order.');
560
+ }
561
+ }
562
+ $comment = $order->addStatusHistoryComment($message);
563
+ $order->addRelatedObject($comment);
564
+
565
+ /*
566
+ * clear the cache for recurring payments so new card will be added
567
+ */
568
+ $merchantAccount = $this->_getConfigData('merchantAccount','adyen_abstract', $order->getStoreId());
569
+ $recurringType = $this->_getConfigData('recurringtypes', 'adyen_abstract', $order->getStoreId());
570
+
571
+ $cacheKey = $merchantAccount . "|" . $order->getCustomerId() . "|" . $recurringType;
572
+ Mage::app()->getCache()->remove($cacheKey);
573
+ }
574
+ break;
575
+ default:
576
+ $order->getPayment()->getMethodInstance()->writeLog('notification event not supported!');
577
+ break;
578
+ }
579
+ }
580
+
581
+ /**
582
+ * @desc Revert back to NEW status if previous notification has cancelled the order
583
+ * @param $order
584
+ */
585
+ protected function _uncancelOrder($order) {
586
+
587
+ if($order->isCanceled()) {
588
+
589
+ $this->_debugData['_uncancelOrder'] = 'Uncancel the order because could be that it is cancelled in a previous notification';
590
+
591
+ $orderStatus = $this->_getConfigData('order_status', 'adyen_abstract', $order->getStoreId());
592
+
593
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW);
594
+ $order->setStatus($orderStatus);
595
+ $order->setBaseDiscountCanceled(0);
596
+ $order->setBaseShippingCanceled(0);
597
+ $order->setBaseSubtotalCanceled(0);
598
+ $order->setBaseTaxCanceled(0);
599
+ $order->setBaseTotalCanceled(0);
600
+ $order->setDiscountCanceled(0);
601
+ $order->setShippingCanceled(0);
602
+ $order->setSubtotalCanceled(0);
603
+ $order->setTaxCanceled(0);
604
+ $order->setTotalCanceled(0);
605
+ $order->save();
606
+
607
+ try {
608
+ foreach ($order->getAllItems() as $item) {
609
+ $item->setQtyCanceled(0);
610
+ $item->setTaxCanceled(0);
611
+ $item->setHiddenTaxCanceled(0);
612
+ $item->save();
613
+ }
614
+ } catch(Excpetion $e) {
615
+ $this->_debugData['_uncancelOrder'] = 'Failed to cancel orderlines exception: ' . $e->getMessage();
616
+
617
+ }
618
+ }
619
+ }
620
+ /**
621
+ * @param $order
622
+ * @return bool
623
+ */
624
+ protected function _refundOrder($order)
625
+ {
626
+ $this->_debugData['_refundOrder'] = 'Refunding the order';
627
+
628
+ // Don't create a credit memo if refund is initialize in Magento because in this case the credit memo already exits
629
+ $result = Mage::getModel('adyen/event')
630
+ ->getEvent($this->_pspReference, '[refund-received]');
631
+ if (!empty($result)) {
632
+ $this->_debugData['_refundOrder ignore'] = 'Skip refund process because credit memo is already created';
633
+ return false;
634
+ }
635
+
636
+ $_mail = (bool) $this->_getConfigData('send_update_mail', 'adyen_abstract', $order->getStoreId());
637
+ $amount = $this->_value;
638
+
639
+ if ($order->canCreditmemo()) {
640
+ $service = Mage::getModel('sales/service_order', $order);
641
+ $creditmemo = $service->prepareCreditmemo();
642
+ $creditmemo->getOrder()->setIsInProcess(true);
643
+
644
+ //set refund data on the order
645
+ $creditmemo->setGrandTotal($amount);
646
+ $creditmemo->setBaseGrandTotal($amount);
647
+ $creditmemo->save();
648
+
649
+ try {
650
+ Mage::getModel('core/resource_transaction')
651
+ ->addObject($creditmemo)
652
+ ->addObject($creditmemo->getOrder())
653
+ ->save();
654
+ //refund
655
+ $creditmemo->refund();
656
+ $transactionSave = Mage::getModel('core/resource_transaction')
657
+ ->addObject($creditmemo)
658
+ ->addObject($creditmemo->getOrder());
659
+ if ($creditmemo->getInvoice()) {
660
+ $transactionSave->addObject($creditmemo->getInvoice());
661
+ }
662
+ $transactionSave->save();
663
+ if ($_mail) {
664
+ $creditmemo->getOrder()->setCustomerNoteNotify(true);
665
+ $creditmemo->sendEmail();
666
+ }
667
+ $this->_debugData['_refundOrder done'] = 'Credit memo is created';
668
+ } catch (Exception $e) {
669
+ $this->_debugData['_refundOrder error'] = 'Error creating credit memo error message is: ' . $e->getMessage();
670
+ Mage::logException($e);
671
+ }
672
+ } else {
673
+ $this->_debugData['_refundOrder error'] = 'Order can not be refunded';
674
+ }
675
+ }
676
+
677
+ /**
678
+ * @param $order
679
+ */
680
+ protected function _setRefundAuthorized($order)
681
+ {
682
+ $this->_debugData['_setRefundAuthorized'] = 'Status update to default status or refund_authorized status if this is set';
683
+ $status = $this->_getConfigData('refund_authorized', 'adyen_abstract', $order->getStoreId());
684
+ $status = (!empty($status)) ? $status : $order->getStatus();
685
+ $order->addStatusHistoryComment(Mage::helper('adyen')->__('Adyen Refund Successfully completed'), $status);
686
+ $order->sendOrderUpdateEmail((bool) $this->_getConfigData('send_update_mail', 'adyen_abstract', $order->getStoreId()));
687
+ }
688
+
689
+ /**
690
+ * @param $order
691
+ * @param $payment_method
692
+ */
693
+ protected function _authorizePayment($order, $payment_method)
694
+ {
695
+ $this->_debugData['_authorizePayment'] = 'Authorisation of the order';
696
+ //pre-authorise if success
697
+ $order->sendNewOrderEmail(); // send order email
698
+
699
+ $this->_uncancelOrder($order);
700
+
701
+ $this->_setPrePaymentAuthorized($order);
702
+
703
+ $this->_prepareInvoice($order);
704
+
705
+ $_paymentCode = $this->_paymentMethodCode($order);
706
+ if($payment_method == "c_cash" || ($this->_getConfigData('create_shipment', 'adyen_pos', $order->getStoreId()) && $_paymentCode == "adyen_pos"))
707
+ {
708
+ $this->_createShipment($order);
709
+ }
710
+ }
711
+
712
+ /**
713
+ * @param $order
714
+ */
715
+ private function _setPrePaymentAuthorized($order)
716
+ {
717
+ $status = $this->_getConfigData('payment_pre_authorized', 'adyen_abstract', $order->getStoreId());
718
+
719
+ // only do this if status in configuration is set
720
+ if(!empty($status)) {
721
+ $order->addStatusHistoryComment(Mage::helper('adyen')->__('Payment is pre authorised waiting for capture'), $status);
722
+ $order->sendOrderUpdateEmail((bool) $this->_getConfigData('send_update_mail', 'adyen_abstract', $order->getStoreId()));
723
+ $this->_debugData['_setPrePaymentAuthorized'] = 'Order status is changed to Pre-authorised status, status is ' . $status;
724
+ } else {
725
+ $this->_debugData['_setPrePaymentAuthorized'] = 'No pre-authorised status is used so ignore';
726
+ }
727
+ }
728
+
729
+ /**
730
+ * @param $order
731
+ */
732
+ protected function _prepareInvoice($order)
733
+ {
734
+ $this->_debugData['_prepareInvoice'] = 'Prepare invoice for order';
735
+ $payment = $order->getPayment()->getMethodInstance();
736
+
737
+ $_mail = (bool) $this->_getConfigData('send_update_mail', 'adyen_abstract', $order->getStoreId());
738
+
739
+ //Set order state to new because with order state payment_review it is not possible to create an invoice
740
+ if (strcmp($order->getState(), Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) == 0) {
741
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW);
742
+ }
743
+
744
+ //capture mode
745
+ if (!$this->_isAutoCapture($order)) {
746
+ $order->addStatusHistoryComment(Mage::helper('adyen')->__('Capture Mode set to Manual'));
747
+ $order->sendOrderUpdateEmail($_mail);
748
+ $this->_debugData['_prepareInvoice done'] = 'Capture mode is set to Manual so don\'t create an invoice wait for the capture notification';
749
+
750
+ // show message if order is in manual review
751
+ if($this->_fraudManualReview) {
752
+ // check if different status is selected
753
+ $fraudManualReviewStatus = $this->_getConfigData('fraud_manual_review_status', 'adyen_abstract', $order->getStoreId());
754
+ if($fraudManualReviewStatus != "") {
755
+ $status = $fraudManualReviewStatus;
756
+ $comment = "Adyen Payment is in Manual Review check the Adyen platform";
757
+ $order->addStatusHistoryComment(Mage::helper('adyen')->__($comment), $status);
758
+ }
759
+ }
760
+ return;
761
+ }
762
+
763
+ $this->_createInvoice($order);
764
+
765
+ $order->sendOrderUpdateEmail($_mail);
766
+ }
767
+
768
+ protected function _createInvoice($order)
769
+ {
770
+ $this->_debugData['_createInvoice'] = 'Creating invoice for order';
771
+
772
+ if ($order->canInvoice()) {
773
+ $invoice = $order->prepareInvoice();
774
+ $invoice->getOrder()->setIsInProcess(true);
775
+ // set transaction id so you can do a online refund this is used instead of online capture
776
+ // because it is already auto capture in Adyen Backoffice
777
+ $invoice->setTransactionId(1);
778
+ $invoice->register()->pay();
779
+ try {
780
+ Mage::getModel('core/resource_transaction')
781
+ ->addObject($invoice)
782
+ ->addObject($invoice->getOrder())
783
+ ->save();
784
+ $this->_debugData['_createInvoice done'] = 'Created invoice';
785
+ } catch (Exception $e) {
786
+ $this->_debugData['_createInvoice error'] = 'Error saving invoice. The error message is: ' . $e->getMessage();
787
+ Mage::logException($e);
788
+ }
789
+
790
+ //selected adyen status
791
+ $this->_setPaymentAuthorized($order);
792
+
793
+ $invoiceAutoMail = (bool) $this->_getConfigData('send_invoice_update_mail', 'adyen_abstract', $order->getStoreId());
794
+ if ($invoiceAutoMail) {
795
+ $invoice->sendEmail();
796
+ }
797
+ } else {
798
+ $this->_debugData['_createInvoice error'] = 'It is not possible to create invoice for this order';
799
+ }
800
+ }
801
+
802
+ /**
803
+ * @param $order
804
+ * @return bool
805
+ */
806
+ protected function _isAutoCapture($order)
807
+ {
808
+ $captureMode = trim($this->_getConfigData('capture_mode', 'adyen_abstract', $order->getStoreId()));
809
+ $sepaFlow = trim($this->_getConfigData('capture_mode', 'adyen_sepa', $order->getStoreId()));
810
+ $_paymentCode = $this->_paymentMethodCode($order);
811
+ $captureModeOpenInvoice = $this->_getConfigData('auto_capture_openinvoice', 'adyen_abstract', $order->getStoreId());
812
+ $captureModePayPal = trim($this->_getConfigData('paypal_capture_mode', 'adyen_abstract', $order->getStoreId()));
813
+
814
+ //check if it is a banktransfer. Banktransfer only a Authorize notification is send.
815
+ $isBankTransfer = $this->_isBankTransfer($this->_paymentMethod);
816
+
817
+ // payment method ideal, cash adyen_boleto or adyen_pos has direct capture
818
+ if (strcmp($this->_paymentMethod, 'ideal') === 0 || strcmp($this->_paymentMethod, 'c_cash' ) === 0 || $_paymentCode == "adyen_pos" || $isBankTransfer == true || ($_paymentCode == "adyen_sepa" && $sepaFlow != "authcap") || $_paymentCode == "adyen_boleto") {
819
+ return true;
820
+ }
821
+ // if auto capture mode for openinvoice is turned on then use auto capture
822
+ if ($captureModeOpenInvoice == true && (strcmp($this->_paymentMethod, 'openinvoice') === 0 || strcmp($this->_paymentMethod, 'afterpay_default') === 0 || strcmp($this->_paymentMethod, 'klarna') === 0)) {
823
+ return true;
824
+ }
825
+ // if PayPal capture modues is different from the default use this one
826
+ if(strcmp($this->_paymentMethod, 'paypal' ) === 0 && $captureModePayPal != "") {
827
+ if(strcmp($captureModePayPal, 'auto') === 0 ) {
828
+ return true;
829
+ } elseif(strcmp($captureModePayPal, 'manual') === 0 ) {
830
+ return false;
831
+ }
832
+ }
833
+ if (strcmp($captureMode, 'manual') === 0) {
834
+ return false;
835
+ }
836
+ //online capture after delivery, use Magento backend to online invoice (if the option auto capture mode for openinvoice is not set)
837
+ if (strcmp($this->_paymentMethod, 'openinvoice') === 0 || strcmp($this->_paymentMethod, 'afterpay_default') === 0 || strcmp($this->_paymentMethod, 'klarna') === 0) {
838
+ return false;
839
+ }
840
+ return true;
841
+ }
842
+
843
+ /**
844
+ * @param $order
845
+ * @return mixed
846
+ */
847
+ protected function _paymentMethodCode($order)
848
+ {
849
+ return $order->getPayment()->getMethod();
850
+ }
851
+
852
+ protected function _getPaymentMethodType($order) {
853
+ return $order->getPayment()->getPaymentMethodType();
854
+ }
855
+
856
+ /**
857
+ * @param $paymentMethod
858
+ * @return bool
859
+ */
860
+ protected function _isBankTransfer($paymentMethod) {
861
+ if(strlen($paymentMethod) >= 12 && substr($paymentMethod, 0, 12) == "bankTransfer") {
862
+ $isBankTransfer = true;
863
+ } else {
864
+ $isBankTransfer = false;
865
+ }
866
+ return $isBankTransfer;
867
+ }
868
+
869
+ /**
870
+ * @param $order
871
+ */
872
+ protected function _setPaymentAuthorized($order, $manualReviewComment = true)
873
+ {
874
+ $this->_debugData['_setPaymentAuthorized start'] = 'Set order to authorised';
875
+
876
+ // if full amount is captured create invoice
877
+ $currency = $order->getOrderCurrencyCode();
878
+ $amount = $this->_value;
879
+ $orderAmount = (int) Mage::helper('adyen')->formatAmount($order->getGrandTotal(), $currency);
880
+
881
+ $this->_debugData['_setPaymentAuthorized amount'] = 'amount notification:'.$amount . ' amount order:'.$orderAmount;
882
+ if($amount == $orderAmount) {
883
+ $this->_createInvoice($order);
884
+ }
885
+
886
+ $status = $this->_getConfigData('payment_authorized', 'adyen_abstract', $order->getStoreId());
887
+ // virtual order can have different status
888
+ if($order->getIsVirtual()) {
889
+ $virtual_status = $this->_getConfigData('payment_authorized_virtual');
890
+ if($virtual_status != "") {
891
+ $status = $virtual_status;
892
+ }
893
+ }
894
+
895
+ // check for boleto if payment is totally paid
896
+ if($this->_paymentMethodCode($order) == "adyen_boleto") {
897
+
898
+ // check if paid amount is the same as orginal amount
899
+ $orginalAmount = $this->_boletoOriginalAmount;
900
+ $paidAmount = $this->_boletoPaidAmount;
901
+
902
+ if($orginalAmount != $paidAmount) {
903
+
904
+ // not the full amount is paid. Check if it is underpaid or overpaid
905
+ // strip the BRL of the string
906
+ $orginalAmount = str_replace("BRL", "", $orginalAmount);
907
+ $orginalAmount = floatval(trim($orginalAmount));
908
+
909
+ $paidAmount = str_replace("BRL", "", $paidAmount);
910
+ $paidAmount = floatval(trim($paidAmount));
911
+
912
+ if($paidAmount > $orginalAmount) {
913
+ $overpaidStatus = $this->_getConfigData('order_overpaid_status', 'adyen_boleto');
914
+ // check if there is selected a status if not fall back to the default
915
+ $status = (!empty($overpaidStatus)) ? $overpaidStatus : $status;
916
+ } else {
917
+ $underpaidStatus = $this->_getConfigData('order_underpaid_status', 'adyen_boleto');
918
+ // check if there is selected a status if not fall back to the default
919
+ $status = (!empty($underpaidStatus)) ? $underpaidStatus : $status;
920
+ }
921
+ }
922
+ }
923
+
924
+ $comment = "Adyen Payment Successfully completed";
925
+
926
+ // if manual review is true use the manual review status if this is set
927
+ if($manualReviewComment == true && $this->_fraudManualReview) {
928
+ // check if different status is selected
929
+ $fraudManualReviewStatus = $this->_getConfigData('fraud_manual_review_status', 'adyen_abstract', $order->getStoreId());
930
+ if($fraudManualReviewStatus != "") {
931
+ $status = $fraudManualReviewStatus;
932
+ $comment = "Adyen Payment is in Manual Review check the Adyen platform";
933
+ }
934
+ }
935
+
936
+ $status = (!empty($status)) ? $status : $order->getStatus();
937
+ $order->addStatusHistoryComment(Mage::helper('adyen')->__($comment), $status);
938
+ $order->sendOrderUpdateEmail((bool) $this->_getConfigData('send_update_mail', 'adyen_abstract', $order->getStoreId()));
939
+ $this->_debugData['_setPaymentAuthorized end'] = 'Order status is changed to authorised status, status is ' . $status;
940
+ }
941
+
942
+ /**
943
+ * @param $order
944
+ */
945
+ protected function _createShipment($order) {
946
+ $this->_debugData['_createShipment'] = 'Creating shipment for order';
947
+ // create shipment for cash payment
948
+ $payment = $order->getPayment()->getMethodInstance();
949
+ if($order->canShip())
950
+ {
951
+ $itemQty = array();
952
+ $shipment = $order->prepareShipment($itemQty);
953
+ if($shipment) {
954
+ $shipment->register();
955
+ $shipment->getOrder()->setIsInProcess(true);
956
+ $comment = Mage::helper('adyen')->__('Shipment created by Adyen');
957
+ $shipment->addComment($comment);
958
+ Mage::getModel('core/resource_transaction')
959
+ ->addObject($shipment)
960
+ ->addObject($shipment->getOrder())
961
+ ->save();
962
+ $this->_debugData['_createShipment done'] = 'Order is shipped';
963
+ }
964
+ } else {
965
+ $this->_debugData['_createShipment error'] = 'Order can\'t be shipped';
966
+ }
967
+ }
968
+
969
+ /**
970
+ * @desc order comments or history
971
+ * @param type $order
972
+ */
973
+ protected function _addStatusHistoryComment($order)
974
+ {
975
+ $success_result = (strcmp($this->_success, 'true') == 0 || strcmp($this->_success, '1') == 0) ? 'true' : 'false';
976
+ $success = (!empty($this->_reason)) ? "$success_result <br />reason:$this->_reason" : $success_result;
977
+
978
+ if($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND || $this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_CAPTURE) {
979
+
980
+ $currency = $order->getOrderCurrencyCode();
981
+
982
+ // check if it is a full or partial refund
983
+ $amount = $this->_value;
984
+ $orderAmount = (int) Mage::helper('adyen')->formatAmount($order->getGrandTotal(), $currency);
985
+
986
+ $this->_debugData['_addStatusHistoryComment amount'] = 'amount notification:'.$amount . ' amount order:'.$orderAmount;
987
+
988
+ if($amount == $orderAmount) {
989
+ $order->setAdyenEventCode($this->_eventCode . " : " . strtoupper($success_result));
990
+ } else {
991
+ $order->setAdyenEventCode("(PARTIAL) " . $this->_eventCode . " : " . strtoupper($success_result));
992
+ }
993
+ } else {
994
+ $order->setAdyenEventCode($this->_eventCode . " : " . strtoupper($success_result));
995
+ }
996
+
997
+ // if payment method is klarna or openinvoice/afterpay show the reservartion number
998
+ if(($this->_paymentMethod == "klarna" || $this->_paymentMethod == "afterpay_default" || $this->_paymentMethod == "openinvoice") && ($this->_klarnaReservationNumber != null && $this->_klarnaReservationNumber != "")) {
999
+ $klarnaReservationNumberText = "<br /> reservationNumber: " . $this->_klarnaReservationNumber;
1000
+ } else {
1001
+ $klarnaReservationNumberText = "";
1002
+ }
1003
+
1004
+ if($this->_boletoPaidAmount != null && $this->_boletoPaidAmount != "") {
1005
+ $boletoPaidAmountText = "<br /> Paid amount: " . $this->_boletoPaidAmount;
1006
+ } else {
1007
+ $boletoPaidAmountText = "";
1008
+ }
1009
+
1010
+ $type = 'Adyen HTTP Notification(s):';
1011
+ $comment = Mage::helper('adyen')
1012
+ ->__('%s <br /> eventCode: %s <br /> pspReference: %s <br /> paymentMethod: %s <br /> success: %s %s %s', $type, $this->_eventCode, $this->_pspReference, $this->_paymentMethod, $success, $klarnaReservationNumberText, $boletoPaidAmountText);
1013
+
1014
+ // If notification is pending status and pending status is set add the status change to the comment history
1015
+ if($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_PENDING)
1016
+ {
1017
+ $pendingStatus = $this->_getConfigData('pending_status', 'adyen_abstract', $order->getStoreId());
1018
+ if($pendingStatus != "") {
1019
+ $order->addStatusHistoryComment($comment, $pendingStatus);
1020
+ $this->_debugData['_addStatusHistoryComment'] = 'Created comment history for this notification with status change to: ' . $pendingStatus;
1021
+ return;
1022
+ }
1023
+ }
1024
+
1025
+ $order->addStatusHistoryComment($comment);
1026
+ $this->_debugData['_addStatusHistoryComment'] = 'Created comment history for this notification';
1027
+ }
1028
+ /**
1029
+ * @param $order
1030
+ * @return bool
1031
+ * @deprecate not needed already cancelled in ProcessController
1032
+ */
1033
+ protected function _holdCancelOrder($order, $ignoreHasInvoice)
1034
+ {
1035
+ $orderStatus = $this->_getConfigData('payment_cancelled', 'adyen_abstract', $order->getStoreId());
1036
+
1037
+ $_mail = (bool) $this->_getConfigData('send_update_mail', 'adyen_abstract', $order->getStoreId());
1038
+ $helper = Mage::helper('adyen');
1039
+
1040
+ // check if order has in invoice only cancel/hold if this is not the case
1041
+ if ($ignoreHasInvoice || !$order->hasInvoices()) {
1042
+ $order->setActionFlag($orderStatus, true);
1043
+
1044
+ if($orderStatus == Mage_Sales_Model_Order::STATE_HOLDED) {
1045
+ if ($order->canHold()) {
1046
+ $order->hold();
1047
+ } else {
1048
+ $this->_debugData['warning'] = 'Order can not hold or is already on Hold';
1049
+ return;
1050
+ }
1051
+ } else {
1052
+ if ($order->canCancel()) {
1053
+ $order->cancel();
1054
+ } else {
1055
+ $this->_debugData['warning'] = 'Order can not be canceled';
1056
+ return;
1057
+ }
1058
+ }
1059
+ $order->sendOrderUpdateEmail($_mail);
1060
+ } else {
1061
+ $this->_debugData['warning'] = 'Order has already an invoice so cannot be canceled';
1062
+ }
1063
+ }
1064
+
1065
+ /*
1066
+ * Add AUTHORISATION notification where order does not exists to the queue
1067
+ */
1068
+ /**
1069
+ * @param $params
1070
+ */
1071
+ protected function _addNotificationToQueue($params) {
1072
+
1073
+ $eventCode = trim($params->getData('eventCode'));
1074
+ $success = (trim($params->getData('success')) == 'true' || trim($params->getData('success')) == '1') ? true : false;
1075
+ // only log the AUTHORISATION with Sucess true because with false the order will never be created in magento
1076
+ if($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $success == true) {
1077
+ // pspreference is always numeric otherwise it is a test notification
1078
+ $pspReference = $params->getData('pspReference');
1079
+ if(is_numeric($pspReference)) {
1080
+ $this->_debugData['AddNotificationToQueue Step1'] = 'Going to add notification to queue';
1081
+
1082
+ $incrementId = $params->getData('merchantReference');
1083
+ $pspReference = $params->getData('pspReference');
1084
+ $eventCode = $params->getData('eventCode');
1085
+
1086
+ // check if already exists in the queue (sometimes Adyen Platform can send the same notification twice)
1087
+ $eventResults = Mage::getModel('adyen/event_queue')->getCollection()
1088
+ ->addFieldToFilter('increment_id', $incrementId);
1089
+ $eventResults->getSelect()->limit(1);
1090
+
1091
+ $eventQueue = null;
1092
+ if($eventResults->getSize() > 0) {
1093
+ $eventQueue = current($eventResults->getItems());
1094
+ }
1095
+
1096
+ if($eventQueue) {
1097
+ $this->_debugData['AddNotificationToQueue Step2'] = 'Notification already in the queue';
1098
+ $attempt = (int)$eventQueue->getAttempt();
1099
+ try{
1100
+ $eventQueue->setAttempt(++$attempt);
1101
+ $eventQueue->save();
1102
+ $this->_debugData['AddNotificationToQueue Step3'] = 'Updated the attempt of the Queue to ' . $eventQueue->getAttempt();
1103
+ } catch(Exception $e) {
1104
+ $this->_debugData['AddNotificationToQueue error'] = 'Could not update the notification to queue, reason: ' . $e->getMessage();
1105
+ Mage::logException($e);
1106
+ }
1107
+ } else {
1108
+ try {
1109
+ // add current request to the queue
1110
+ $eventQueue = Mage::getModel('adyen/event_queue');
1111
+ $eventQueue->setPspReference($pspReference);
1112
+ $eventQueue->setAdyenEventCode($eventCode);
1113
+ $eventQueue->setIncrementId($incrementId);
1114
+ $eventQueue->setAttempt(1);
1115
+ $eventQueue->setResponse(serialize($params));
1116
+ $eventQueue->setCreatedAt(now());
1117
+ $eventQueue->save();
1118
+ $this->_debugData['AddNotificationToQueue Step2'] = 'Notification is added to the queue';
1119
+ } catch(Exception $e) {
1120
+ $this->_debugData['AddNotificationToQueue error'] = 'Could not save the notification to queue, reason: ' . $e->getMessage();
1121
+ Mage::logException($e);
1122
+ }
1123
+ }
1124
+ } else {
1125
+ $this->_debugData['AddNotificationToQueue'] = 'Notification is a TEST Notification so do not add to queue';
1126
+ }
1127
+ } else {
1128
+ $this->_debugData['AddNotificationToQueue'] = 'Notification is not a AUTHORISATION Notification so do not add to queue';
1129
+ }
1130
+ }
1131
+
1132
+
1133
+ /*
1134
+ * This function is called from the cronjob
1135
+ */
1136
+ public function updateNotProcessedNotifications() {
1137
+
1138
+ $this->_debugData = array();
1139
+
1140
+ $this->_debugData['processPosResponse begin'] = 'Begin to process cronjob for updating notifications from the queue';
1141
+
1142
+ $this->_updateNotProcessedNotifications();
1143
+
1144
+ $this->_debugData['processPosResponse end'] = 'Cronjob ends';
1145
+
1146
+ return $this->_debugData;
1147
+ }
1148
+
1149
+ /**
1150
+ *
1151
+ */
1152
+ protected function _updateNotProcessedNotifications() {
1153
+
1154
+ $this->_debugData['UpdateNotProcessedEvents Step1'] = 'Going to update Notifications from the queue';
1155
+ // try to update old notifications that did not processed yet
1156
+ $collection = Mage::getModel('adyen/event_queue')->getCollection()
1157
+ ->addFieldToFilter('attempt', array('lteq' => '4'));
1158
+
1159
+ if($collection->getSize() > 0) {
1160
+ foreach($collection as $event){
1161
+ if($event->getAdyenEventCode() == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION) {
1162
+
1163
+ $incrementId = $event->getIncrementId();
1164
+
1165
+ $this->_debugData['UpdateNotProcessedEvents Step2'] = 'Going to update notification with incrementId: ' . $incrementId;
1166
+
1167
+ $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
1168
+ if ($order->getId()) {
1169
+
1170
+ $this->_debugData['UpdateNotProcessedEvents Step3'] = 'Order exists going to update it';
1171
+ // try to process it now
1172
+ $params = unserialize($event->getResponse());
1173
+
1174
+ $this->_debugData['UpdateNotProcessedEvents params'] = $params->debug();
1175
+
1176
+ $this->_updateOrder($order, $params);
1177
+
1178
+ // update event that it is processed
1179
+ try{
1180
+ // @codingStandardsIgnoreStart
1181
+ $event->delete();
1182
+ // @codingStandardsIgnoreEnd
1183
+ $this->_debugData['UpdateNotProcessedEvents Step4'] = 'Notification is processed and removed from the queue';
1184
+ } catch(Exception $e) {
1185
+ Mage::logException($e);
1186
+ }
1187
+ } else {
1188
+ // order still not exists save this attempt
1189
+ $currentAttempt = $event->getAttempt();
1190
+ $event->setAttempt(++$currentAttempt);
1191
+ // @codingStandardsIgnoreStart
1192
+ $event->save();
1193
+ // @codingStandardsIgnoreEnd
1194
+ $this->_debugData['UpdateNotProcessedEvents Step3'] = 'The Notification still does not exists updated attempt to ' . $event->getAttempt();
1195
+ }
1196
+ }
1197
+ }
1198
+ } else {
1199
+ $this->_debugData['UpdateNotProcessedEvents Step2'] = 'The queue is empty';
1200
+ }
1201
+ }
1202
+
1203
+ /**
1204
+ * Log debug data to file
1205
+ *
1206
+ * @param $storeId
1207
+ * @param mixed $debugData
1208
+ */
1209
+ protected function _debug($storeId)
1210
+ {
1211
+ if ($this->_getConfigData('debug', 'adyen_abstract', $storeId)) {
1212
+ $file = 'adyen_process_notification.log';
1213
+ Mage::getModel('core/log_adapter', $file)->log($this->_debugData);
1214
+ }
1215
+ }
1216
+
1217
+ /**
1218
+ * @param $code
1219
+ * @param null $paymentMethodCode
1220
+ * @param null $storeId
1221
+ * @return mixed
1222
+ */
1223
+ protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null)
1224
+ {
1225
+ return Mage::helper('adyen')->getConfigData($code, $paymentMethodCode, $storeId);
1226
+ }
1227
+
1228
+ /**
1229
+ * @return mixed
1230
+ */
1231
+ protected function _getRequest()
1232
+ {
1233
+ return Mage::app()->getRequest();
1234
+ }
1235
+ }
app/code/community/Adyen/Payment/Model/ProcessPosResult.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_ProcessPosResult extends Mage_Core_Model_Abstract {
29
+
30
+ /**
31
+ * Collected debug information
32
+ *
33
+ * @var array
34
+ */
35
+ protected $_debugData = array();
36
+
37
+ public function processPosResponse($response)
38
+ {
39
+ $storeId = null;
40
+
41
+ $this->_debugData['processPosResponse begin'] = 'Begin to process POS result url';
42
+
43
+ $helper = Mage::helper('adyen');
44
+
45
+ $this->_debugData['POS Response'] = $response;
46
+
47
+ $params = new Varien_Object();
48
+ foreach ($response as $code => $value) {
49
+ $params->setData($code, $value);
50
+ }
51
+
52
+ $actionName = $this->_getRequest()->getActionName();
53
+ $result = $params->getData('result');
54
+
55
+ // check if result comes from POS device comes from POS and validate Checksum
56
+ if($actionName == "successPos" && $result != "" && $this->_validateChecksum($params)) {
57
+
58
+ //get order && payment objects
59
+ $order = Mage::getModel('sales/order');
60
+ //$incrementId = $params->getData('merchantReference');
61
+ $incrementId = $params->getData('originalCustomMerchantReference');
62
+
63
+ if($incrementId) {
64
+ $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
65
+ if ($order->getId()) {
66
+
67
+ // set StoreId for retrieving debug log setting
68
+ $storeId = $order->getStoreId();
69
+
70
+ if($result == 'APPROVED') {
71
+
72
+ $this->_debugData['processPosResponse'] = 'Result is APPROVED';
73
+
74
+ // set adyen event status on true
75
+ $order->setAdyenEventCode(Adyen_Payment_Model_Event::ADYEN_EVENT_POSAPPROVED);
76
+
77
+ $comment = Mage::helper('adyen')
78
+ ->__('%s <br /> Result: %s <br /> paymentMethod: %s', 'Adyen App Result URL Notification:', $result, 'POS');
79
+
80
+ $order->addStatusHistoryComment($comment, false);
81
+
82
+ try {
83
+ $order->save();
84
+ $this->_debugData['complete'] = 'Order is updated with AdyenEventCode: ' . $order->getAdyenEventCode();
85
+ } catch (Exception $e) {
86
+ $this->_debugData['error'] = 'error updating order reason: ' . $e->getMessage();
87
+ Mage::logException($e);
88
+ }
89
+ } else {
90
+
91
+ $this->_debugData['processPosResponse'] = 'Result is: ' . $result;
92
+
93
+ $comment = Mage::helper('adyen')
94
+ ->__('%s <br /> Result: %s <br /> paymentMethod: %s', 'Adyen App Result URL Notification:', $result, 'POS');
95
+
96
+ $order->addStatusHistoryComment($comment, Mage_Sales_Model_Order::STATE_CANCELED);
97
+
98
+ $order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CANCEL, true);
99
+
100
+ if (!$order->canCancel()) {
101
+ $order->addStatusHistoryComment($helper->__('Order can not be canceled'), Mage_Sales_Model_Order::STATE_CANCELED);
102
+ $order->save();
103
+ $this->_debugData['error'] = 'can not be canceled';
104
+
105
+ } else {
106
+ $order->cancel()->save();
107
+ $this->_debugData['complete'] = 'Order is cancelled';
108
+ }
109
+ }
110
+ } else {
111
+ $this->_debugData['error'] = 'Order does not exists with increment_id: ' . $incrementId;
112
+ }
113
+ } else {
114
+ $this->_debugData['error'] = 'Empty merchantReference';
115
+ }
116
+ } else {
117
+ $this->_debugData['error'] = 'actionName or checksum failed or response is empty';
118
+ }
119
+
120
+ $this->_debug($storeId);
121
+
122
+ // close the window
123
+ $html = "<html><body>
124
+ <script type=\"text/javascript\">
125
+ function closeWindow() {
126
+ window.open('', '_self', '');
127
+ window.close();
128
+ }
129
+ setTimeout(closeWindow, 500);
130
+ </script>
131
+ </body></html>";
132
+
133
+ return $html;
134
+ }
135
+
136
+ protected function _validateChecksum($params)
137
+ {
138
+ $checksum = $params->getData('cs');
139
+ $result = $params->getData('result');
140
+ $amount = $params->getData('originalCustomAmount');
141
+ $currency = $params->getData('originalCustomCurrency');
142
+ $sessionId = $params->getData('sessionId');
143
+
144
+
145
+ // for android sessionis is with low i
146
+ if($sessionId == "") {
147
+ $sessionId = $params->getData('sessionid');
148
+ }
149
+
150
+ // calculate amount checksum
151
+ $amount_checksum = 0;
152
+
153
+ $amountLength = strlen($amount);
154
+ for($i=0;$i<$amountLength;$i++)
155
+ {
156
+ // ASCII value use ord
157
+ $checksumCalc = ord($amount[$i]) - 48;
158
+ $amount_checksum += $checksumCalc;
159
+ }
160
+
161
+ $currency_checksum = 0;
162
+ $currencyLength = strlen($currency);
163
+ for($i=0;$i<$currencyLength;$i++)
164
+ {
165
+ $checksumCalc = ord($currency[$i]) - 64;
166
+ $currency_checksum += $checksumCalc;
167
+ }
168
+
169
+ $result_checksum = 0;
170
+ $resultLength = strlen($result);
171
+ for($i=0;$i<$resultLength;$i++)
172
+ {
173
+ $checksumCalc = ord($result[$i]) - 64;
174
+ $result_checksum += $checksumCalc;
175
+ }
176
+
177
+ $sessionId_checksum = 0;
178
+ $sessionIdLength = strlen($sessionId);
179
+ for($i=0;$i<$sessionIdLength;$i++)
180
+ {
181
+ $checksumCalc = $this->_getAscii2Int($sessionId[$i]);
182
+ $sessionId_checksum += $checksumCalc;
183
+ }
184
+
185
+ $total_result_checksum = (($amount_checksum + $currency_checksum + $result_checksum) * $sessionId_checksum) % 100;
186
+
187
+ // check if request is valid
188
+ if($total_result_checksum == $checksum) {
189
+ $this->_debugData['_validateChecksum'] = 'Checksum is valid';
190
+ return true;
191
+ }
192
+ $this->_debugData['_validateChecksum'] = 'Checksum is invalid!';
193
+ return false;
194
+ }
195
+
196
+ protected function _getRequest()
197
+ {
198
+ return Mage::app()->getRequest();
199
+ }
200
+
201
+ protected function _getAscii2Int($ascii)
202
+ {
203
+ if (is_numeric($ascii)){
204
+ $int = ord($ascii) - 48;
205
+ } else {
206
+ $int = ord($ascii) - 64;
207
+ }
208
+ return $int;
209
+ }
210
+
211
+ /**
212
+ * Log debug data to file
213
+ *
214
+ * @param $storeId
215
+ * @param mixed $debugData
216
+ */
217
+ protected function _debug($storeId)
218
+ {
219
+ if ($this->_getConfigData('debug', 'adyen_abstract', $storeId)) {
220
+ $file = 'adyen_result_pos.log';
221
+ Mage::getModel('core/log_adapter', $file)->log($this->_debugData);
222
+ }
223
+ }
224
+
225
+ /**
226
+ * @param $code
227
+ * @param null $paymentMethodCode
228
+ * @param null $storeId
229
+ * @return mixed
230
+ */
231
+ protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null)
232
+ {
233
+ return Mage::helper('adyen')->getConfigData($code, $paymentMethodCode, $storeId);
234
+ }
235
+
236
+ }
app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Debug.php RENAMED
@@ -25,9 +25,12 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Adyen_Debug extends Mage_Core_Model_Mysql4_Abstract {
 
 
29
 
30
- protected function _construct() {
 
31
  $this->_init('adyen/api_debug', 'debug_id');
32
  }
33
 
@@ -35,7 +38,8 @@ class Adyen_Payment_Model_Mysql4_Adyen_Debug extends Mage_Core_Model_Mysql4_Abst
35
  * @since 0.0.2
36
  * @param array $response
37
  */
38
- public function assignData($response) {
 
39
  $db = $this->_getWriteAdapter();
40
  $db->insert($this->getMainTable(), array('adyen_response' => serialize($response)));
41
  }
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Resource_Adyen_Debug
29
+ extends Mage_Core_Model_Resource_Db_Abstract
30
+ {
31
 
32
+ protected function _construct()
33
+ {
34
  $this->_init('adyen/api_debug', 'debug_id');
35
  }
36
 
38
  * @since 0.0.2
39
  * @param array $response
40
  */
41
+ public function assignData($response)
42
+ {
43
  $db = $this->_getWriteAdapter();
44
  $db->insert($this->getMainTable(), array('adyen_response' => serialize($response)));
45
  }
app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Debug/Collection.php RENAMED
@@ -25,9 +25,12 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Adyen_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
 
 
29
 
30
- protected function _construct() {
 
31
  $this->_init('adyen/adyen_api_debug');
32
  }
33
 
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Resource_Adyen_Debug_Collection
29
+ extends Mage_Core_Model_Resource_Db_Collection_Abstract
30
+ {
31
 
32
+ protected function _construct()
33
+ {
34
  $this->_init('adyen/adyen_api_debug');
35
  }
36
 
app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Event.php RENAMED
@@ -25,7 +25,9 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Adyen_Event extends Mage_Core_Model_Mysql4_Abstract {
 
 
29
 
30
  const COLLECTION_LIMIT = 1000;
31
 
@@ -82,33 +84,6 @@ class Adyen_Payment_Model_Mysql4_Adyen_Event extends Mage_Core_Model_Mysql4_Abst
82
  $db->insert($this->getMainTable(), $obj->getData());
83
  }
84
 
85
- /**
86
- * @deprecated not used at the moment
87
- * @param type $id
88
- * @param type $status
89
- */
90
- public function updateAdyenStatus($id,$status) {
91
- $db = $this->_getWriteAdapter();
92
- $_status = array('adyen_event_code' => $status);
93
- $where = $db->quoteInto('increment_id = ?', $id );
94
- $db->update($this->getTable('sales/order'), $_status, $where);
95
- $db->update($this->getTable('sales/order_grid'), $_status,$where);
96
- }
97
-
98
- /**
99
- * @deprecated not used at the moment
100
- * @return type
101
- */
102
- public function getOrderToUpdate() {
103
- $db = $this->_getReadAdapter();
104
- $sql = $db->select()->from(array('a' => $this->getMainTable()), array('increment_id','adyen_event_result','created_at'))
105
- ->join(array('s' => $this->getTable('sales/order')), 's.increment_id=a.increment_id', array('increment_id','updated_at','adyen_status'))
106
- ->where("s.adyen_status IS NULL OR s.adyen_status <> a.adyen_event_result")
107
- ->limit(self::COLLECTION_LIMIT)
108
- ;
109
- return $db->fetchAll($sql);
110
- }
111
-
112
  /**
113
  * Event Status
114
  * @param type $incrementId
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Resource_Adyen_Event
29
+ extends Mage_Core_Model_Resource_Db_Abstract
30
+ {
31
 
32
  const COLLECTION_LIMIT = 1000;
33
 
84
  $db->insert($this->getMainTable(), $obj->getData());
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  /**
88
  * Event Status
89
  * @param type $incrementId
app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Adyen/Event/Collection.php RENAMED
@@ -25,11 +25,12 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Adyen_Event_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
 
29
  {
30
  protected function _construct()
31
  {
32
  $this->_init('adyen/adyen_event');
33
  $this->setItemObjectClass('adyen/event');
34
  }
35
- }
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Resource_Adyen_Event_Collection
29
+ extends Mage_Core_Model_Resource_Db_Collection_Abstract
30
  {
31
  protected function _construct()
32
  {
33
  $this->_init('adyen/adyen_event');
34
  $this->setItemObjectClass('adyen/event');
35
  }
36
+ }
app/code/community/Adyen/Payment/Model/{Mysql4/Adyen → Resource}/Event/Queue.php RENAMED
@@ -25,12 +25,12 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Adyen_Event_Queue extends Mage_Core_Model_Mysql4_Abstract {
29
 
30
  const COLLECTION_LIMIT = 1000;
31
 
32
- protected function _construct() {
33
- // set main table with primary key
34
  $this->_init('adyen/event_queue', 'event_queue_id');
35
  }
36
- }
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Resource_Event_Queue extends Mage_Core_Model_Resource_Db_Abstract {
29
 
30
  const COLLECTION_LIMIT = 1000;
31
 
32
+ protected function _construct()
33
+ {
34
  $this->_init('adyen/event_queue', 'event_queue_id');
35
  }
36
+ }
app/code/community/Adyen/Payment/Model/{Mysql4/Adyen → Resource}/Event/Queue/Collection.php RENAMED
@@ -25,10 +25,11 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Adyen_Event_Queue_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
 
29
  {
30
  protected function _construct()
31
  {
32
- $this->_init('adyen/event_queue', 'adyen/adyen_event_queue');
33
  }
34
- }
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Resource_Event_Queue_Collection
29
+ extends Mage_Core_Model_Resource_Db_Collection_Abstract
30
  {
31
  protected function _construct()
32
  {
33
+ $this->_init('adyen/event_queue');
34
  }
35
+ }
app/code/community/Adyen/Payment/Model/{Mysql4 → Resource}/Order.php RENAMED
@@ -25,7 +25,9 @@
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
- class Adyen_Payment_Model_Mysql4_Order extends Mage_Core_Model_Mysql4_Abstract {
 
 
29
 
30
  protected function _construct() {
31
  $this->_init('sales/order', 'entity_id');
@@ -46,4 +48,4 @@ class Adyen_Payment_Model_Mysql4_Order extends Mage_Core_Model_Mysql4_Abstract {
46
  return $stmt->fetch();
47
  }
48
 
49
- }
25
  * @property Adyen B.V
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
+ class Adyen_Payment_Model_Resource_Order
29
+ extends Mage_Core_Model_Resource_Db_Abstract
30
+ {
31
 
32
  protected function _construct() {
33
  $this->_init('sales/order', 'entity_id');
48
  return $stmt->fetch();
49
  }
50
 
51
+ }
app/code/community/Adyen/Payment/Model/Resource/Setup.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Resource_Setup
29
+ extends Mage_Sales_Model_Resource_Setup
30
+ {
31
+
32
+ }
app/code/community/Adyen/Payment/Model/Sales/Quote/Address/Total/PaymentInstallmentFee.php CHANGED
@@ -47,7 +47,7 @@ class Adyen_Payment_Model_Sales_Quote_Address_Total_PaymentInstallmentFee extend
47
 
48
  $paymentMethod = $quote->getPayment()->getMethod() ;
49
 
50
- if($paymentMethod == "adyen_cc" || $paymentMethod == "adyen_oneclick" ) {
51
 
52
  $info = $payment->getMethodInstance();
53
 
@@ -71,7 +71,6 @@ class Adyen_Payment_Model_Sales_Quote_Address_Total_PaymentInstallmentFee extend
71
  }
72
 
73
  $installmentKey = $numberOfInstallments - 1;
74
-
75
  $installment = $all_installments[$installmentKey];
76
 
77
  if($installment != null && is_array($installment)) {
47
 
48
  $paymentMethod = $quote->getPayment()->getMethod() ;
49
 
50
+ if($paymentMethod == "adyen_cc" || substr($paymentMethod, 0, 14) == 'adyen_oneclick') {
51
 
52
  $info = $payment->getMethodInstance();
53
 
71
  }
72
 
73
  $installmentKey = $numberOfInstallments - 1;
 
74
  $installment = $all_installments[$installmentKey];
75
 
76
  if($installment != null && is_array($installment)) {
app/code/community/Adyen/Payment/Model/Source/CancelRedirect.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Source_CancelRedirect {
29
+
30
+ public function toOptionArray()
31
+ {
32
+ return array(
33
+ array('value' => 'checkout/cart', 'label' => 'Cart'),
34
+ array('value' => 'checkout/onepage', 'label' => 'Checkout'),
35
+ );
36
+ }
37
+
38
+ }
app/code/community/Adyen/Payment/Model/Source/CcType.php CHANGED
@@ -38,4 +38,8 @@ class Adyen_Payment_Model_Source_CcType {
38
  return $options;
39
  }
40
 
41
- }
 
 
 
 
38
  return $options;
39
  }
40
 
41
+ public function toOptionHash()
42
+ {
43
+ return Mage::helper('adyen')->getCcTypes();
44
+ }
45
+ }
app/code/community/Adyen/Payment/Model/Source/DefaultPaymentMethods.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Adyen Payment Module
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * @category Adyen
17
- * @package Adyen_Payment
18
- * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
- /**
22
- * @category Payment Gateway
23
- * @package Adyen_Payment
24
- * @author Adyen
25
- * @property Adyen B.V
26
- * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
- */
28
- class Adyen_Payment_Model_Source_DefaultPaymentMethods {
29
-
30
- public function toOptionArray() {
31
- return array(
32
- array('value' => '', 'label' => 'None'),
33
- array('value' => 'ideal', 'label' => 'Ideal'),
34
- array('value' => 'mc', 'label' => 'Mastercard'),
35
- array('value' => 'visa', 'label' => 'Visa'),
36
- array('value' => 'amex', 'label' => 'American Express'),
37
- array('value' => 'sepa', 'label' => 'SEPA'),
38
- array('value' => 'c_cash', 'label' => 'Cash')
39
- );
40
- }
41
-
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Adyen/Payment/Model/Source/Rendermode.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * @category Payment Gateway
24
+ * @package Adyen_Payment
25
+ * @author Adyen
26
+ * @property Adyen B.V
27
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
28
+ */
29
+ class Adyen_Payment_Model_Source_Rendermode
30
+ {
31
+
32
+ const MODE_TITLE = 'title';
33
+ const MODE_TITLE_IMAGE = 'title_image';
34
+
35
+
36
+ public function toOptionArray()
37
+ {
38
+ return array(
39
+ array('value' => self::MODE_TITLE, 'label' => Mage::helper('adyen')->__('Title')),
40
+ array('value' => self::MODE_TITLE_IMAGE, 'label' => Mage::helper('adyen')->__('Image + Title')),
41
+ );
42
+ }
43
+ }
app/code/community/Adyen/Payment/Model/Source/Status/Pending.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_Source_Status_Pending extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
29
+ {
30
+ protected $_stateStatuses = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
31
+ }
app/code/community/Adyen/Payment/Model/ValidateResultUrl.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class Adyen_Payment_Model_ValidateResultUrl extends Mage_Core_Model_Abstract {
29
+
30
+ /**
31
+ * Collected debug information
32
+ *
33
+ * @var array
34
+ */
35
+ protected $_debugData = array();
36
+
37
+
38
+ /**
39
+ * @param $response
40
+ * @return string
41
+ */
42
+ public function validateResponse($response)
43
+ {
44
+ $result = true;
45
+
46
+ $this->_debugData['Step1'] = 'Processing ResultUrl';
47
+ $storeId = null;
48
+
49
+ if (empty($response)) {
50
+ $this->_debugData['error'] = 'Response is empty, please check your webserver that the result url accepts parameters';
51
+ $this->_debug($storeId);
52
+
53
+ Mage::throwException(
54
+ Mage::helper('adyen')->__('Response is empty, please check your webserver that the result url accepts parameters')
55
+ );
56
+ }
57
+
58
+ // Log the results in log file and adyen_debug table
59
+ $this->_debugData['response'] = $response;
60
+ Mage::getResourceModel('adyen/adyen_debug')->assignData($response);
61
+
62
+
63
+ $params = new Varien_Object($response);
64
+
65
+ $actionName = $this->_getRequest()->getActionName();
66
+
67
+ // authenticate result url
68
+ $authStatus = Mage::getModel('adyen/authenticate')->authenticate($actionName, $params);
69
+ if (!$authStatus) {
70
+ Mage::throwException(
71
+ Mage::helper('adyen')->__('ResultUrl authentification failure')
72
+ );
73
+ }
74
+
75
+ $incrementId = $params->getData('merchantReference');
76
+
77
+ if($incrementId) {
78
+ $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
79
+ if ($order->getId()) {
80
+
81
+ Mage::dispatchEvent('adyen_payment_process_resulturl_before', array('order' => $order, 'adyen_response' => $params));
82
+ if ($params->getData('handled')) {
83
+ $this->_debug($storeId);
84
+ return;
85
+ }
86
+ // set StoreId for retrieving debug log setting
87
+ $storeId = $order->getStoreId();
88
+
89
+ // update the order
90
+ $result = $this->_validateUpdateOrder($order, $params);
91
+
92
+ Mage::dispatchEvent('adyen_payment_process_resulturl_after', array('order' => $order, 'adyen_response' => $params));
93
+ } else {
94
+ Mage::throwException(
95
+ Mage::helper('adyen')->__('Order does not exists with increment_id: %s', $incrementId)
96
+ );
97
+ }
98
+ } else {
99
+ Mage::throwException(
100
+ Mage::helper('adyen')->__('Empty merchantReference')
101
+ );
102
+ }
103
+ $this->_debug($storeId);
104
+
105
+ return $result;
106
+ }
107
+
108
+
109
+ /**
110
+ * @param $order
111
+ * @param $params
112
+ */
113
+ protected function _validateUpdateOrder($order, $params)
114
+ {
115
+ $result = true;
116
+
117
+ $this->_debugData['Step2'] = 'Updating the order';
118
+
119
+ $authResult = $params->getData('authResult');
120
+ $paymentMethod = trim($params->getData('paymentMethod'));
121
+ $pspReference = trim($params->getData('pspReference'));
122
+
123
+ $type = 'Adyen Result URL Notification(s):';
124
+ $comment = Mage::helper('adyen')
125
+ ->__('%s <br /> authResult: %s <br /> pspReference: %s <br /> paymentMethod: %s', $type, $authResult, $pspReference, $paymentMethod);
126
+
127
+ $history = Mage::getModel('sales/order_status_history')
128
+ ->setComment($comment)
129
+ ->setEntityName("order")
130
+ ->setOrder($order);
131
+ $history->save();
132
+
133
+ // Update the Adyen Event Code if notification is not yet received
134
+ if(!(substr($order->getAdyenEventCode(), 0, 13) == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $authResult == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISED)){
135
+ $order->setAdyenEventCode($authResult);
136
+ $this->_debugData['Step3'] = 'Updating the adyen event code with ' . $authResult;
137
+ } else {
138
+ $this->_debugData['Step3'] = 'Not updating the adyen event code with ' . $authResult . 'because notification is already received';
139
+ }
140
+
141
+ switch ($authResult) {
142
+
143
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISED:
144
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_PENDING:
145
+ // do nothing wait for the notification
146
+ $this->_debugData['Step4'] = 'Do nothing wait for the notification';
147
+ break;
148
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLED:
149
+ $this->_debugData['Step4'] = 'Cancel or Hold the order';
150
+ $result = false;
151
+ break;
152
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_REFUSED:
153
+ // if refused there will be a AUTHORIZATION : FALSE notification send only exception is ideal
154
+ $this->_debugData['Step4'] = 'Cancel or Hold the order';
155
+ $result = false;
156
+ break;
157
+ case Adyen_Payment_Model_Event::ADYEN_EVENT_ERROR:
158
+ //attempt to hold/cancel
159
+ $this->_debugData['Step4'] = 'Cancel or Hold the order';
160
+ $result = false;
161
+ break;
162
+ default:
163
+ $this->_debugData['error'] = 'This event is not supported: ' . $authResult;
164
+ $result = false;
165
+ break;
166
+ }
167
+
168
+ $order->save();
169
+
170
+ return $result;
171
+ }
172
+
173
+
174
+
175
+ /**
176
+ * Log debug data to file
177
+ *
178
+ * @param mixed $debugData
179
+ */
180
+ protected function _debug($storeId)
181
+ {
182
+ if ($this->_getConfigData('debug', 'adyen_abstract', $storeId)) {
183
+ $file = 'adyen_resulturl.log';
184
+ Mage::getModel('core/log_adapter', $file)->log($this->_debugData);
185
+ }
186
+ }
187
+
188
+ /**
189
+ * @param $paymentMethod
190
+ * @return bool
191
+ */
192
+ protected function _isBankTransfer($paymentMethod)
193
+ {
194
+ if(strlen($paymentMethod) >= 22 && substr($paymentMethod, 0, 22) == 'adyen_hpp_bankTransfer') {
195
+ $isBankTransfer = true;
196
+ } else {
197
+ $isBankTransfer = false;
198
+ }
199
+ return $isBankTransfer;
200
+ }
201
+
202
+
203
+ /**
204
+ * @param $code
205
+ * @param null $paymentMethodCode
206
+ * @param null $storeId
207
+ * @return mixed
208
+ */
209
+ protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null)
210
+ {
211
+ return Mage::helper('adyen')->getConfigData($code, $paymentMethodCode, $storeId);
212
+ }
213
+
214
+ /**
215
+ * @return mixed
216
+ */
217
+ protected function _getRequest()
218
+ {
219
+ return Mage::app()->getRequest();
220
+ }
221
+ }
app/code/community/Adyen/Payment/controllers/Adminhtml/ExportAdyenSettingsController.php CHANGED
@@ -38,7 +38,7 @@ class Adyen_Payment_Adminhtml_ExportAdyenSettingsController extends Mage_Adminht
38
 
39
  // to array
40
  $list = array();
41
- if ($collection->count() > 0) {
42
  foreach ($collection as $configItem) {
43
 
44
  $path = $configItem->getPath();
@@ -62,6 +62,8 @@ class Adyen_Payment_Adminhtml_ExportAdyenSettingsController extends Mage_Adminht
62
  }
63
 
64
  $xml = new SimpleXMLElement('<root/>');
 
 
65
  // function call to convert array to xml
66
  $this->_arrayToXml($list,$xml);
67
 
@@ -69,24 +71,20 @@ class Adyen_Payment_Adminhtml_ExportAdyenSettingsController extends Mage_Adminht
69
  $contentType = "application/xml";
70
  $fileName = "AdyenSettings.xml";
71
 
 
 
 
72
  $this->getResponse()
73
  ->setHttpResponseCode(200)
74
  ->setHeader('Pragma', 'public', true)
75
  ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
76
- ->setHeader('Content-type', $contentType, true);
77
-
78
- $this->getResponse()
79
- ->setHeader('Content-Disposition', "attachment" . '; filename='.$fileName);
80
-
81
- $this->getResponse()
82
- ->clearBody();
83
- $this->getResponse()
84
- ->sendHeaders();
85
-
86
- $xml->formatOutput = true;
87
 
88
- echo $xml->asXML();
89
- exit();
90
  }
91
 
92
  // function defination to convert array to xml
38
 
39
  // to array
40
  $list = array();
41
+ if ($collection->getSize() > 0) {
42
  foreach ($collection as $configItem) {
43
 
44
  $path = $configItem->getPath();
62
  }
63
 
64
  $xml = new SimpleXMLElement('<root/>');
65
+ $xml->formatOutput = true;
66
+
67
  // function call to convert array to xml
68
  $this->_arrayToXml($list,$xml);
69
 
71
  $contentType = "application/xml";
72
  $fileName = "AdyenSettings.xml";
73
 
74
+ $content = $xml->asXML();
75
+ $contentLength = "";
76
+
77
  $this->getResponse()
78
  ->setHttpResponseCode(200)
79
  ->setHeader('Pragma', 'public', true)
80
  ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
81
+ ->setHeader('Content-type', $contentType, true)
82
+ // ->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)
83
+ ->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"', true)
84
+ ->setHeader('Last-Modified', date('r'), true);
 
 
 
 
 
 
 
85
 
86
+ $this->getResponse()->setBody($content);
87
+ return $this;
88
  }
89
 
90
  // function defination to convert array to xml
app/code/community/Adyen/Payment/controllers/Adminhtml/ValidateWebserverSettingsController.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ /**
21
+ * @category Payment Gateway
22
+ * @package Adyen_Payment
23
+ * @author Adyen
24
+ * @property Adyen B.V
25
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
+ */
27
+ class Adyen_Payment_Adminhtml_ValidateWebserverSettingsController extends Mage_Adminhtml_Controller_Action {
28
+
29
+ public function indexAction()
30
+ {
31
+ $result = false;
32
+
33
+ $modus = $this->getRequest()->getParam('modus');
34
+ $username = $this->getRequest()->getParam('username');
35
+ $password = $this->getRequest()->getParam('password');
36
+
37
+ // check if password is encrypted if so get it from database
38
+ if (preg_match('/^\*+$/', $password)) {
39
+
40
+ $websiteCode = Mage::app()->getRequest()->getParam('website');
41
+ $storeCode = Mage::app()->getRequest()->getParam('store');
42
+
43
+ if($storeCode) {
44
+ $store = Mage::getModel('core/store')->load($storeCode);
45
+ $storeId = $store->getId();
46
+ } elseif ($websiteCode) {
47
+ $website = Mage::getModel('core/website')->load($websiteCode);
48
+ $storeId = $website->getId();
49
+ } else {
50
+ // the default
51
+ $storeId = 0;
52
+ }
53
+
54
+ if($modus == 'test') {
55
+ $configValue = 'ws_password_test';
56
+ } else {
57
+ $configValue = 'ws_password_live';
58
+ }
59
+
60
+ $password = Mage::helper('core')->decrypt(Mage::helper('adyen')->getConfigData($configValue, 'adyen_abstract', $storeId));
61
+ }
62
+
63
+ $ch = curl_init();
64
+ if($modus == 'test') {
65
+ curl_setopt($ch, CURLOPT_URL, "https://pal-test.adyen.com/pal/adapter/httppost?Payment");
66
+ } else {
67
+ curl_setopt($ch, CURLOPT_URL, "https://pal-live.adyen.com/pal/adapter/httppost?Payment");
68
+ }
69
+
70
+ curl_setopt($ch, CURLOPT_HEADER, false);
71
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
72
+ curl_setopt($ch, CURLOPT_USERPWD,$username.":".$password);
73
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
74
+
75
+ $results = curl_exec($ch);
76
+ $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
77
+
78
+ if ($httpStatus == 200) {
79
+ $result = true;
80
+ }
81
+
82
+ echo $result;
83
+ return;
84
+ }
85
+ }
app/code/community/Adyen/Payment/controllers/CheckoutCashController.php CHANGED
@@ -30,7 +30,6 @@ class Adyen_Payment_CheckoutCashController extends Mage_Core_Controller_Front_Ac
30
 
31
  public function indexAction()
32
  {
33
-
34
  $customer = Mage::getSingleton('customer/session');
35
 
36
  // only proceed if customer is logged in
@@ -59,7 +58,7 @@ class Adyen_Payment_CheckoutCashController extends Mage_Core_Controller_Front_Ac
59
  ->setPaymentMethod('adyen_pos');
60
 
61
  $payment = $quote->getPayment();
62
- $payment->importData(array('method' => 'adyen_hpp', 'hpp_type' => "c_cash"));
63
 
64
  $quote->collectTotals()->save();
65
  $session = Mage::getSingleton('checkout/session');
@@ -72,16 +71,75 @@ class Adyen_Payment_CheckoutCashController extends Mage_Core_Controller_Front_Ac
72
  $order->setStatus($oderStatus);
73
  $order->save();
74
 
75
- // add order information to the session
76
- $session->setLastOrderId($order->getId())
77
- ->setLastRealOrderId($order->getIncrementId())
78
- ->setLastSuccessQuoteId($order->getQuoteId())
79
- ->setLastQuoteId($order->getQuoteId());
80
-
81
- $this->_redirect('adyen/process/redirect');
82
- return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  } else {
84
- Mage::throwException('Customer is not logged in.');
 
 
85
  }
86
  }
87
  }
30
 
31
  public function indexAction()
32
  {
 
33
  $customer = Mage::getSingleton('customer/session');
34
 
35
  // only proceed if customer is logged in
58
  ->setPaymentMethod('adyen_pos');
59
 
60
  $payment = $quote->getPayment();
61
+ $payment->importData(array('method' => 'adyen_cash'));
62
 
63
  $quote->collectTotals()->save();
64
  $session = Mage::getSingleton('checkout/session');
71
  $order->setStatus($oderStatus);
72
  $order->save();
73
 
74
+ // redirect to success page
75
+ $session->unsAdyenRealOrderId();
76
+ $session->setLastSuccessQuoteId($session->getQuoteId());
77
+ $session->getQuote()->setIsActive(false)->save();
78
+
79
+ // needed for redirect through javascript (cashdrawer)
80
+ $session->setLastQuoteId($session->getQuoteId());
81
+ $session->setLastOrderId($order->getId());
82
+
83
+ // redirect to page where cash drawer is open, do it in a seperate page bercause in checkout page it is not working looks like conflict with prototype
84
+ $openCashDrawer = Mage::helper('adyen')->getConfigData("cash_drawer", "adyen_cash", null);
85
+ if($openCashDrawer) {
86
+
87
+ $cashDrawerIp = Mage::helper('adyen')->getConfigData("cash_drawer_printer_ip", "adyen_cash", $order->getStoreId());
88
+ $cashDrawerPort = Mage::helper('adyen')->getConfigData("cash_drawer_printer_port", "adyen_cash", $order->getStoreId());
89
+ $cashDrawerDeviceId = Mage::helper('adyen')->getConfigData("cash_drawer_printer_device_id", "adyen_cash", $order->getStoreId());
90
+
91
+ if($cashDrawerIp != '' && $cashDrawerPort != '' && $cashDrawerDeviceId != '') {
92
+
93
+ $html = '<html><head><link rel="stylesheet" type="text/css" href="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/frontend/base/default/css/adyenstyle.css"><script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>';
94
+
95
+ // for cash add epson libary to open the cash drawer
96
+ $jsPath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
97
+
98
+ $html .= '<script src="'.$jsPath.'adyen/payment/epos-device-2.6.0.js"></script>';
99
+ $html .= '</head><body class="redirect-body-adyen">';
100
+ $html.= '
101
+ <script type="text/javascript">
102
+ var ipAddress = "'.$cashDrawerIp.'";
103
+ var port = "'.$cashDrawerPort.'";
104
+ var deviceID = "'.$cashDrawerDeviceId.'";
105
+ var ePosDev = new epson.ePOSDevice();
106
+ ePosDev.connect(ipAddress, port, Callback_connect);
107
+
108
+ function Callback_connect(data) {
109
+ if (data == "OK" || data == "SSL_CONNECT_OK") {
110
+ var options = "{}";
111
+ ePosDev.createDevice(deviceID, ePosDev.DEVICE_TYPE_PRINTER, options, callbackCreateDevice_printer);
112
+ } else {
113
+ alert("connected to ePOS Device Service Interface is failed. [" + data + "]");
114
+ }
115
+ }
116
+
117
+ function callbackCreateDevice_printer(data, code) {
118
+ var print = data;
119
+ var drawer = "{}";
120
+ var time = print.PULSE_100
121
+ print.addPulse();
122
+ print.send();
123
+ window.location = "'. Mage::getUrl('checkout/onepage/success') .'";
124
+ }
125
+ </script>
126
+ ';
127
+
128
+ $html.= '</body></html>';
129
+
130
+ $this->getResponse()->setBody($html);
131
+ } else {
132
+ Mage::throwException(
133
+ Mage::helper('adyen')->__('You did not fill in all the fields (ip,port,device id) to use Cash Drawer support')
134
+ );
135
+ }
136
+ } else {
137
+ $this->_redirect('checkout/onepage/success');
138
+ }
139
  } else {
140
+ Mage::throwException(
141
+ Mage::helper('adyen')->__('Customer is not logged in.')
142
+ );
143
  }
144
  }
145
  }
app/code/community/Adyen/Payment/controllers/CheckoutPosController.php CHANGED
@@ -30,56 +30,205 @@ class Adyen_Payment_CheckoutPosController extends Mage_Core_Controller_Front_Act
30
 
31
  public function indexAction()
32
  {
 
33
 
34
- $customer = Mage::getSingleton('customer/session');
35
 
36
- // only proceed if customer is logged in
37
- if($customer->isLoggedIn()) {
38
 
39
- // get email
40
- $params = $this->getRequest()->getParams();
 
 
 
 
41
  $adyenPosEmail = isset($params['adyenPosEmail']) ? $params['adyenPosEmail'] : "";
42
- $quote = (Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();
43
-
44
- // get customer object from session
45
- $customerObject = Mage::getModel('customer/customer')->load($customer->getId());
46
-
47
- // important update the shippingaddress and billingaddress this can be null sometimes.
48
- $quote->assignCustomerWithAddressChange($customerObject);
49
 
50
- // update email with customer Email
51
  if($adyenPosEmail != "") {
52
- $quote->setCustomerEmail($adyenPosEmail);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
- $shippingAddress = $quote->getShippingAddress();
 
56
 
57
- $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
58
- ->setShippingMethod('freeshipping_freeshipping')
59
- ->setPaymentMethod('adyen_pos');
 
 
60
 
61
- $quote->getPayment()->importData(array('method' => 'adyen_pos'));
62
- $quote->collectTotals()->save();
63
- $session = Mage::getSingleton('checkout/session');
64
 
65
- $service = Mage::getModel('sales/service_quote', $quote);
66
- $service->submitAll();
67
- $order = $service->getOrder();
68
 
69
- $oderStatus = Mage::helper('adyen')->getOrderStatus();
70
- $order->setStatus($oderStatus);
71
- $order->save();
72
 
73
- // add order information to the session
74
- $session->setLastOrderId($order->getId())
75
- ->setLastRealOrderId($order->getIncrementId())
76
- ->setLastSuccessQuoteId($order->getQuoteId())
77
- ->setLastQuoteId($order->getQuoteId());
78
 
 
 
 
 
 
 
 
 
 
79
  $this->_redirect('adyen/process/redirect');
80
- return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  } else {
82
- Mage::throwException('Customer is not logged in.');
83
  }
84
  }
 
 
 
 
 
 
85
  }
30
 
31
  public function indexAction()
32
  {
33
+ $params = $this->getRequest()->getParams();
34
 
35
+ $store = Mage::app()->getStore();
36
 
37
+ // if recurring card is selected do online OneClick Payment
38
+ $recurringDetailReference = isset($params['recurringDetailReference']) ? $params['recurringDetailReference'] : "";
39
 
40
+ if($recurringDetailReference) {
41
+ // load customer by Id
42
+ $customerId = isset($params['customerId']) ? $params['customerId'] : "";
43
+ $customerObject = Mage::getModel("customer/customer")->load($customerId);
44
+ } else {
45
+ // check if email is filled in
46
  $adyenPosEmail = isset($params['adyenPosEmail']) ? $params['adyenPosEmail'] : "";
47
+ $saveCard = isset($params['adyenPosSaveCard']) ? $params['adyenPosSaveCard'] : "";
 
 
 
 
 
 
48
 
 
49
  if($adyenPosEmail != "") {
50
+
51
+ // check if the email hasa an existing account
52
+ $customer = Mage::getModel("customer/customer");
53
+ $customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
54
+ $customer->loadByEmail($adyenPosEmail);
55
+
56
+ if($customer->getId() > 0) {
57
+ // customer exists so give back customerData
58
+ $customerObject = $customer;
59
+ } else {
60
+ // create new account with provided email
61
+ $websiteId = Mage::app()->getWebsite()->getId();
62
+
63
+ $customer = Mage::getModel("customer/customer");
64
+
65
+ $password = Mage::helper('core')->getRandomString($length = 8);
66
+
67
+
68
+ $customer->setWebsiteId($websiteId)
69
+ ->setStore($store)
70
+ ->setEmail($adyenPosEmail)
71
+ ->setPassword($password);
72
+
73
+ try{
74
+ $customer->save();
75
+ $customerObject = $customer;
76
+ }
77
+ catch (Exception $e) {
78
+ Zend_Debug::dump($e->getMessage());
79
+ }
80
+ }
81
+ } else {
82
+ $customer = Mage::getSingleton('customer/session');
83
+ // no email is filled in so connect this to current logged in user:
84
+ if($customer->isLoggedIn()) {
85
+ $customerObject = Mage::getModel('customer/customer')->load($customer->getId());
86
+ } else {
87
+ Mage::throwException('Customer is not logged in.');
88
+ }
89
  }
90
+ }
91
+
92
+ // get email
93
+
94
+ $quote = (Mage::getModel('checkout/type_onepage') !== false)? Mage::getModel('checkout/type_onepage')->getQuote(): Mage::getModel('checkout/session')->getQuote();
95
+
96
+ // important update the shippingaddress and billingaddress this can be null sometimes.
97
+ $quote->assignCustomerWithAddressChange($customerObject);
98
+
99
+ $shippingAddress = $quote->getShippingAddress();
100
+
101
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
102
+ ->setShippingMethod('freeshipping_freeshipping')
103
+ ->setPaymentMethod('adyen_pos');
104
+
105
+
106
+ if($recurringDetailReference) {
107
+ $store->setConfig('payment/adyen_oneclick/active', 1);
108
 
109
+ // set config to recurring because we want to do a recurring transaction in this case
110
+ $store->setConfig('payment/adyen_abstract/recurringtypes', 'RECURRING');
111
 
112
+ // do the payment
113
+ $quote->getPayment()->importData(array('method' => 'adyen_oneclick', 'recurring_detail_reference' => $recurringDetailReference));
114
+ } else {
115
+ $quote->getPayment()->importData(array('method' => 'adyen_pos', 'store_cc' => $saveCard));
116
+ }
117
 
 
 
 
118
 
119
+ $quote->collectTotals()->save();
120
+ $session = Mage::getSingleton('checkout/session');
 
121
 
122
+ $service = Mage::getModel('sales/service_quote', $quote);
123
+ $service->submitAll();
124
+ $order = $service->getOrder();
125
 
126
+ $oderStatus = Mage::helper('adyen')->getOrderStatus();
127
+ $order->setStatus($oderStatus);
128
+ $order->save();
 
 
129
 
130
+ // add order information to the session
131
+ $session->setLastOrderId($order->getId())
132
+ ->setLastRealOrderId($order->getIncrementId())
133
+ ->setLastSuccessQuoteId($order->getQuoteId())
134
+ ->setLastQuoteId($order->getQuoteId());
135
+
136
+ if($recurringDetailReference) {
137
+ $this->_redirect('checkout/onepage/success');
138
+ } else {
139
  $this->_redirect('adyen/process/redirect');
140
+ }
141
+
142
+ return $this;
143
+ }
144
+
145
+ public function validateCustomerByEmailAction()
146
+ {
147
+ $this->getResponse()->setHeader('Content-type', 'application/json');
148
+ $jsonData = "";
149
+
150
+ if($this->_hasExpressCheckout() && $this->_inKioskMode() != "1") {
151
+ $params = $this->getRequest()->getParams();
152
+ $email = isset($params['email']) ? $params['email'] : "";
153
+ $customerId = isset($params['customerId']) ? $params['customerId'] : "";
154
+
155
+ if($customerId > 0) {
156
+
157
+ $customer = Mage::getModel("customer/customer")->load($customerId);
158
+ $jsonData['customerData'] = $customer->getData();
159
+
160
+ } else {
161
+
162
+ $customer = Mage::getModel("customer/customer");
163
+ $customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
164
+ $customer->loadByEmail($email);
165
+
166
+ if($customer->getId() > 0) {
167
+
168
+ $jsonData['customerData'] = $customer->getData();
169
+ }
170
+ }
171
+
172
+
173
+ if($customer->getId() > 0) {
174
+ // do list recurring call
175
+ $adyenHelper = Mage::helper('adyen');
176
+
177
+ $store = Mage::app()->getStore();
178
+
179
+ $merchantAccount = trim($adyenHelper->getConfigData('merchantAccount', 'adyen_abstract', $store->getId()));
180
+ // $recurringType = $adyenHelper->getConfigData('recurringtypes', 'adyen_abstract', $store->getId());
181
+ // you only want recurring cards so you can select the card to do online payment
182
+ $recurringType = "RECURRING";
183
+
184
+ try {
185
+ $recurringCards = $adyenHelper->getRecurringCards($merchantAccount, $customerId, $recurringType);
186
+ $jsonData['recurringCards'] = $recurringCards;
187
+ } catch(Exception $e) {
188
+ // do nothing
189
+ }
190
+ }
191
+ }
192
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($jsonData));
193
+ }
194
+
195
+ public function getCustomerEmailAction()
196
+ {
197
+ $jsonData = "";
198
+
199
+ if($this->_hasExpressCheckout() && $this->_inKioskMode() != "1") {
200
+ $params = $this->getRequest()->getParams();
201
+ $email = isset($params['email']) ? $params['email'] : "";
202
+
203
+ $customers = Mage::getModel('customer/customer')->getCollection()
204
+ ->addAttributeToSelect('email')
205
+ ->addAttributeToFilter('email', array('like'=>'%'.$email.'%'))
206
+ ->addAttributeToFilter('website_id', Mage::app()->getStore()->getWebsiteId());
207
+
208
+ $jsonData = '<ul>';
209
+ foreach ($customers as $customer) {
210
+ $data = $customer->getData();
211
+ $id = $customer->getId();
212
+ $jsonData .= '<li id="customer-'.$id.'">' . $data['email'] . '</li>';
213
+ }
214
+ $jsonData .= '</ul>';
215
+ }
216
+ $this->getResponse()->setBody($jsonData);
217
+ }
218
+
219
+ protected function _hasExpressCheckout()
220
+ {
221
+ // must be login to show this checkout option
222
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
223
+ return (string) Mage::helper('adyen')->hasExpressCheckout();
224
  } else {
225
+ return false;
226
  }
227
  }
228
+
229
+ protected function _inKioskMode()
230
+ {
231
+ return Mage::helper('adyen')->getConfigData("express_checkout_kiosk_mode", "adyen_pos", null);
232
+ }
233
+
234
  }
app/code/community/Adyen/Payment/controllers/GetInstallmentsController.php CHANGED
@@ -34,9 +34,9 @@ class Adyen_Payment_GetInstallmentsController extends Mage_Core_Controller_Front
34
  $params = $this->getRequest()->getParams();
35
 
36
  // get installments for cctype
37
- $ccType = $params['ccType'];
38
 
39
- $result = Mage::helper('adyen/installments')->getInstallmentForCreditCardType($params['ccType']);
40
 
41
  $jsonData = json_encode($result);
42
  $this->getResponse()->setHeader('Content-type', 'application/json');
34
  $params = $this->getRequest()->getParams();
35
 
36
  // get installments for cctype
37
+ $ccType = isset($params['ccType']) ? $params['ccType'] : "";
38
 
39
+ $result = Mage::helper('adyen/installments')->getInstallmentForCreditCardType($ccType);
40
 
41
  $jsonData = json_encode($result);
42
  $this->getResponse()->setHeader('Content-type', 'application/json');
app/code/community/Adyen/Payment/controllers/ProcessController.php CHANGED
@@ -54,20 +54,58 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
54
  //get soap request
55
  $request = Mage::registry('soap-request');
56
 
57
-
58
  if (empty($request)) {
59
- return false;
 
60
  }
61
 
 
62
  if (is_array($request->notification->notificationItems->NotificationRequestItem)) {
63
  foreach ($request->notification->notificationItems->NotificationRequestItem as $item) {
64
- $this->processResponse($item);
 
65
  }
66
  } else {
67
  $item = $request->notification->notificationItems->NotificationRequestItem;
68
- $this->processResponse($item);
 
69
  }
70
- exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
 
73
  public function openinvoiceAction() {
@@ -216,20 +254,41 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
216
  * Adyen returns POST variables to this action
217
  */
218
  public function successAction() {
219
- $status = $this->processResponse();
220
-
221
- if ($status) {
222
- $session = $this->_getCheckout();
223
- $session->unsAdyenRealOrderId();
224
- $session->setQuoteId($session->getAdyenQuoteId(true));
225
- $session->getQuote()->setIsActive(false)->save();
226
 
227
- $this->_redirect('checkout/onepage/success');
228
- } else {
229
- $this->cancel();
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
  }
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  /**
234
  * @desc reloads the items in the cart && cancel the order
235
  * @since v009
@@ -237,12 +296,16 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
237
  public function cancel() {
238
 
239
  $session = $this->_getCheckout();
 
 
 
 
240
  $order = Mage::getModel('sales/order');
241
  $incrementId = $session->getLastRealOrderId();
242
 
243
  if (empty($incrementId)) {
244
  $session->addError($this->__('Your payment failed, Please try again later'));
245
- $this->_redirect('checkout/cart');
246
  return;
247
  }
248
 
@@ -252,11 +315,36 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
252
  $quoteId = $order->getQuoteId();
253
  $cart = Mage::getModel('sales/quote')->load($quoteId);
254
  $cart->setIsActive(true)->save();
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
  //handle the old order here
 
 
257
  try {
258
- $order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CANCEL, true);
259
- $order->cancel()->save();
 
 
 
 
 
 
 
 
 
 
 
260
  } catch (Mage_Core_Exception $e) {
261
  Mage::logException($e);
262
  }
@@ -265,27 +353,95 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
265
  if(isset($params['authResult']) && $params['authResult'] == Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLED) {
266
  $session->addError($this->__('You have cancelled the order. Please try again'));
267
  } else {
268
- $session->addError($this->__('Your payment failed. Please try again later'));
269
  }
270
 
271
- $this->_redirect('checkout/cart');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  }
273
 
274
  public function insAction() {
275
  try {
 
 
 
 
 
 
 
276
 
277
- $status = $this->processResponse();
278
 
279
- if($status == "401"){
280
- $this->_return401();
281
- } else {
282
- echo "[accepted]";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  }
 
284
  } catch (Exception $e) {
285
  Mage::logException($e);
286
  }
287
-
288
- exit();
289
  }
290
 
291
  public function jsonAction() {
@@ -293,18 +449,39 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
293
  try {
294
  $notificationItems = json_decode(file_get_contents('php://input'), true);
295
 
296
- foreach($notificationItems['notificationItems'] as $notificationItem)
 
 
297
  {
298
- $status = $this->processResponse($notificationItem['NotificationRequestItem']);
299
- if($status == "401"){
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  $this->_return401();
 
301
  }
 
 
 
 
302
  }
303
- echo "[accepted]";
 
304
  } catch (Exception $e) {
305
  Mage::logException($e);
306
  }
307
- exit();
308
  }
309
 
310
  public function cashAction() {
@@ -323,30 +500,36 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
323
  }
324
 
325
  /* START actions for POS */
326
- public function successPosAction() {
 
 
 
 
 
 
 
 
 
 
327
 
328
- echo $this->processPosResponse();
329
  return $this;
330
  }
331
 
332
  public function getOrderStatusAction()
333
  {
334
- if($_POST['merchantReference'] != "") {
335
- // get the order
336
- $order = Mage::getModel('sales/order')->loadByIncrementId($_POST['merchantReference']);
337
- // if order is not cancelled then order is success
338
- if($order->getStatus() == Mage_Sales_Model_Order::STATE_PROCESSING || $order->getAdyenEventCode() == Adyen_Payment_Model_Event::ADYEN_EVENT_POSAPPROVED || substr($order->getAdyenEventCode(), 0, 13) == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION) {
339
- echo 'true';
340
- } elseif($order->getStatus() == 'pending' && $order->getAdyenEventCode() == "") {
341
- echo 'wait';
342
- Mage::log("NO MATCH! JUST WAIT order is not matching with merchantReference:".$_POST['merchantReference'] . " status is:" . $order->getStatus() . " and adyen event status is:" . $order->getAdyenEventCode(), Zend_Log::DEBUG, "adyen_notification_pos.log", true);
343
- } else {
344
- Mage::log("NO MATCH! order is not matching with merchantReference:".$_POST['merchantReference'] . " status is:" . $order->getStatus() . " and adyen event status is:" . $order->getAdyenEventCode(), Zend_Log::DEBUG, "adyen_notification_pos.log", true);
345
- }
346
 
347
- // extra check cancelled
 
 
 
348
  }
349
- return;
 
 
 
 
350
  }
351
 
352
  public function cancelAction()
@@ -355,8 +538,8 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
355
  }
356
 
357
 
358
- public function processPosResponse() {
359
- return Mage::getModel('adyen/process')->processPosResponse();
360
  }
361
  /* END actions for POS */
362
 
@@ -365,16 +548,15 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
365
  }
366
 
367
  protected function _return401(){
368
- header('HTTP/1.1 401 Unauthorized',true,401);
369
  }
370
 
371
- /**
372
- * @since v008
373
- * @desc Update order status accordingly
374
- * @throws Exception
375
- */
376
- public function processResponse($soapItem = null) {
377
- return Mage::getModel('adyen/process')->processResponse($soapItem);
378
  }
379
 
380
  protected function _getCheckout() {
@@ -385,13 +567,24 @@ class Adyen_Payment_ProcessController extends Mage_Core_Controller_Front_Action
385
  return Mage::getModel('sales/order');
386
  }
387
 
 
 
 
 
 
 
 
 
 
388
  /**
389
  * @desc Give Default settings
390
- * @example $this->_getConfigData('demoMode','adyen_abstract')
391
- * @since 0.0.2
392
- * @param string $code
 
393
  */
394
  protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null) {
395
- return Mage::getModel('adyen/process')->getConfigData($code, $paymentMethodCode, $storeId);
396
  }
 
397
  }
54
  //get soap request
55
  $request = Mage::registry('soap-request');
56
 
 
57
  if (empty($request)) {
58
+ $this->_return401();
59
+ return;
60
  }
61
 
62
+ $status = "";
63
  if (is_array($request->notification->notificationItems->NotificationRequestItem)) {
64
  foreach ($request->notification->notificationItems->NotificationRequestItem as $item) {
65
+ $item = $this->formatSoapNotification($item);
66
+ $status = $this->processNotification($item);
67
  }
68
  } else {
69
  $item = $request->notification->notificationItems->NotificationRequestItem;
70
+ $item = $this->formatSoapNotification($item);
71
+ $status = $this->processNotification($item);
72
  }
73
+
74
+ if($status == "401"){
75
+ $this->_return401();
76
+ return;
77
+ }
78
+
79
+ return $this;
80
+ }
81
+
82
+
83
+ /**
84
+ * @desc Format soap notification so it is allign with HTTP POST and JSON output
85
+ * @param $item
86
+ * @return mixed
87
+ */
88
+ protected function formatSoapNotification($item)
89
+ {
90
+ $additionalData = array();
91
+ foreach ($item->additionalData->entry as $additionalDataItem) {
92
+ $key = $additionalDataItem->key;
93
+ $value = $additionalDataItem->value;
94
+
95
+ if (strpos($key,'.') !== false) {
96
+ $results = explode('.', $key);
97
+ $size = count($results);
98
+ if($size == 2) {
99
+ $additionalData[$results[0]][$results[1]] = $value;
100
+ } elseif($size == 3) {
101
+ $additionalData[$results[0]][$results[1]][$results[2]] = $value;
102
+ }
103
+ } else {
104
+ $additionalData[$key] = $value;
105
+ }
106
+ }
107
+ $item->additionalData = $additionalData;
108
+ return $item;
109
  }
110
 
111
  public function openinvoiceAction() {
254
  * Adyen returns POST variables to this action
255
  */
256
  public function successAction() {
257
+ // get the response data
258
+ $response = $this->getRequest()->getParams();
 
 
 
 
 
259
 
260
+ // process
261
+ try {
262
+ $result = $this->validateResultUrl($response);
263
+
264
+ if ($result) {
265
+ $session = $this->_getCheckout();
266
+ $session->unsAdyenRealOrderId();
267
+ $session->setQuoteId($session->getAdyenQuoteId(true));
268
+ $session->getQuote()->setIsActive(false)->save();
269
+ $this->_redirect('checkout/onepage/success');
270
+ } else {
271
+ $this->cancel();
272
+ }
273
+ } catch(Exception $e) {
274
+ Mage::logException($e);
275
+ throw $e;
276
  }
277
  }
278
 
279
+ public function successPosRedirectAction()
280
+ {
281
+ $session = $this->_getCheckout();
282
+
283
+ // clear session for email shopper
284
+ $session->setAdyenEmailShopper("");
285
+
286
+ $session->unsAdyenRealOrderId();
287
+ $session->setQuoteId($session->getAdyenQuoteId(true));
288
+ $session->getQuote()->setIsActive(false)->save();
289
+ $this->_redirect('checkout/onepage/success');
290
+ }
291
+
292
  /**
293
  * @desc reloads the items in the cart && cancel the order
294
  * @since v009
296
  public function cancel() {
297
 
298
  $session = $this->_getCheckout();
299
+
300
+ // clear session for email shopper
301
+ $session->setAdyenEmailShopper("");
302
+
303
  $order = Mage::getModel('sales/order');
304
  $incrementId = $session->getLastRealOrderId();
305
 
306
  if (empty($incrementId)) {
307
  $session->addError($this->__('Your payment failed, Please try again later'));
308
+ $this->_redirectCheckoutCart();
309
  return;
310
  }
311
 
315
  $quoteId = $order->getQuoteId();
316
  $cart = Mage::getModel('sales/quote')->load($quoteId);
317
  $cart->setIsActive(true)->save();
318
+ // reset reserverOrderId because already used by previous order
319
+ $cart->setReservedOrderId(null);
320
+ $session->replaceQuote($cart);
321
+
322
+ // if setting failed_attempt_disable is on and the payment method is openinvoice ignore this payment mehthod the second time
323
+ if($this->_getConfigData('failed_attempt_disable', 'adyen_openinvoice') && $order->getPayment()->getMethod() == "adyen_openinvoice") {
324
+ // check if payment failed
325
+ $response = $this->getRequest()->getParams();
326
+ if($response['authResult'] == "REFUSED") {
327
+ $session->setOpenInvoiceInactiveForThisQuoteId($quoteId);
328
+ }
329
+ }
330
 
331
  //handle the old order here
332
+ $orderStatus = $this->_getConfigData('payment_cancelled', 'adyen_abstract', $order->getStoreId());
333
+
334
  try {
335
+ $order->setActionFlag($orderStatus, true);
336
+ switch ($orderStatus) {
337
+ case Mage_Sales_Model_Order::STATE_HOLDED:
338
+ if ($order->canHold()) {
339
+ $order->hold()->save();
340
+ }
341
+ break;
342
+ default:
343
+ if($order->canCancel()) {
344
+ $order->cancel()->save();
345
+ }
346
+ break;
347
+ }
348
  } catch (Mage_Core_Exception $e) {
349
  Mage::logException($e);
350
  }
353
  if(isset($params['authResult']) && $params['authResult'] == Adyen_Payment_Model_Event::ADYEN_EVENT_CANCELLED) {
354
  $session->addError($this->__('You have cancelled the order. Please try again'));
355
  } else {
356
+ $session->addError($this->__('Your payment failed, Please try again later'));
357
  }
358
 
359
+ // if payment method is adyen_pos or adyen_cash redirect to checkout if the kiosk mode is turned off
360
+ if(!$this->_getConfigData('express_checkout_kiosk_mode', 'adyen_pos') && ($order->getPayment()->getMethod() == "adyen_pos" || $order->getPayment()->getMethod() == "adyen_cash")) {
361
+
362
+ // add email to session so this can be shown
363
+ $session->setAdyenEmailShopper($order->getCustomerEmail());
364
+
365
+ $redirect = Mage::getUrl('checkout/cart');
366
+ $this->_redirectUrl($redirect);
367
+ } else {
368
+ $this->_redirectCheckoutCart();
369
+ }
370
+ }
371
+
372
+ protected function _redirectCheckoutCart()
373
+ {
374
+ $redirect = Mage::getStoreConfig('payment/adyen_abstract/payment_cancelled_redirect');
375
+
376
+ if($redirect == "checkout/cart") {
377
+ $redirect = Mage::getUrl('checkout/cart');
378
+ $this->_redirectUrl($redirect);
379
+ } else if ($redirect == "checkout/onepage") {
380
+ $redirect = Mage::helper('checkout/url')->getCheckoutUrl();
381
+ $this->_redirectUrl($redirect);
382
+ } else {
383
+ $this->_redirect($redirect);
384
+ }
385
  }
386
 
387
  public function insAction() {
388
  try {
389
+ // if version is in the notification string show the module version
390
+ $response = $this->getRequest()->getParams();
391
+ if(isset($response['version'])) {
392
+ $helper = Mage::helper('adyen');
393
+ $this->getResponse()->setBody($helper->getExtensionVersion());
394
+ return $this;
395
+ }
396
 
397
+ $notificationMode = isset($response['live']) ? $response['live'] : "";
398
 
399
+ if($notificationMode != "" && $this->_validateNotificationMode($notificationMode))
400
+ {
401
+ // add HTTP POST attributes as an array so it is the same as JSON and SOAP result
402
+ foreach($response as $key => $value) {
403
+ if (strpos($key,'_') !== false) {
404
+ $results = explode('_', $key);
405
+ $size = count($results);
406
+ if($size == 2) {
407
+ $response[$results[0]][$results[1]] = $value;
408
+ } elseif($size == 3) {
409
+ $response[$results[0]][$results[1]][$results[2]] = $value;
410
+ }
411
+ }
412
+ }
413
+
414
+ // create amount array so it is the same as JSON SOAP response
415
+ $response['amount'] = array('value' => $response['value'], 'currency' => $response['currency']);
416
+
417
+ $status = $this->processNotification($response);
418
+
419
+ if($status == "401"){
420
+ $this->_return401();
421
+ return;
422
+ } else {
423
+ $this->getResponse()
424
+ ->setHeader('Content-Type', 'text/html')
425
+ ->setBody("[accepted]");
426
+ return;
427
+ }
428
+ } else
429
+ {
430
+ if($notificationMode == "") {
431
+ $this->_return401();
432
+ return;
433
+ }
434
+
435
+ Mage::throwException(
436
+ Mage::helper('adyen')->__('Mismatch between Live/Test modes of Magento store and the Adyen platform.')
437
+ );
438
+ return;
439
  }
440
+
441
  } catch (Exception $e) {
442
  Mage::logException($e);
443
  }
444
+ return $this;
 
445
  }
446
 
447
  public function jsonAction() {
449
  try {
450
  $notificationItems = json_decode(file_get_contents('php://input'), true);
451
 
452
+ $notificationMode = isset($notificationItems['live']) ? $notificationItems['live'] : "";
453
+
454
+ if($notificationMode != "" && $this->_validateNotificationMode($notificationMode))
455
  {
456
+ foreach($notificationItems['notificationItems'] as $notificationItem)
457
+ {
458
+ $status = $this->processNotification($notificationItem['NotificationRequestItem']);
459
+ if($status == "401"){
460
+ $this->_return401();
461
+ return;
462
+ }
463
+ }
464
+ $this->getResponse()
465
+ ->setHeader('Content-Type', 'text/html')
466
+ ->setBody("[accepted]");
467
+ return;
468
+ } else
469
+ {
470
+ if($notificationMode == "") {
471
  $this->_return401();
472
+ return;
473
  }
474
+
475
+ Mage::throwException(
476
+ Mage::helper('adyen')->__('Mismatch between Live/Test modes of Magento store and the Adyen platform')
477
+ );
478
  }
479
+
480
+
481
  } catch (Exception $e) {
482
  Mage::logException($e);
483
  }
484
+ return $this;
485
  }
486
 
487
  public function cashAction() {
500
  }
501
 
502
  /* START actions for POS */
503
+ public function successPosAction()
504
+ {
505
+ // $response = $this->getRequest();
506
+ // need to get the full request
507
+ $response = $_REQUEST;
508
+
509
+ $html = $this->processPosResponse($response);
510
+
511
+ $this->getResponse()
512
+ ->setHeader('Content-Type', 'text/html')
513
+ ->setBody($html);
514
 
 
515
  return $this;
516
  }
517
 
518
  public function getOrderStatusAction()
519
  {
520
+ $merchantReference = $this->getRequest()->getParam('merchantReference');
521
+ $result = Mage::getModel('adyen/getPosOrderStatus')->hasApprovedOrderStatus($merchantReference);
 
 
 
 
 
 
 
 
 
 
522
 
523
+ $response = "";
524
+
525
+ if($result) {
526
+ $response = 'true';
527
  }
528
+
529
+ // $this->getResponse()->clearHeaders()->setHeader('Content-type','application/json',true);
530
+ $this->getResponse()->setBody($response);
531
+
532
+ return $this;
533
  }
534
 
535
  public function cancelAction()
538
  }
539
 
540
 
541
+ public function processPosResponse($response) {
542
+ return Mage::getModel('adyen/processPosResult')->processPosResponse($response);
543
  }
544
  /* END actions for POS */
545
 
548
  }
549
 
550
  protected function _return401(){
551
+ $this->getResponse()->setHttpResponseCode(401);
552
  }
553
 
554
+ public function processNotification($response) {
555
+ return Mage::getModel('adyen/processNotification')->processResponse($response);
556
+ }
557
+
558
+ public function validateResultUrl($response) {
559
+ return Mage::getModel('adyen/validateResultUrl')->validateResponse($response);
 
560
  }
561
 
562
  protected function _getCheckout() {
567
  return Mage::getModel('sales/order');
568
  }
569
 
570
+ protected function _validateNotificationMode($notificationMode)
571
+ {
572
+ $mode = $this->_getConfigData('demoMode');
573
+ if ($mode=='Y' && $notificationMode == "false" || $mode=='N' && $notificationMode == 'true') {
574
+ return true;
575
+ }
576
+ return false;
577
+ }
578
+
579
  /**
580
  * @desc Give Default settings
581
+ * @param $code
582
+ * @param null $paymentMethodCode
583
+ * @param null $storeId
584
+ * @return mixed
585
  */
586
  protected function _getConfigData($code, $paymentMethodCode = null, $storeId = null) {
587
+ return Mage::helper('adyen')->_getConfigData($code, $paymentMethodCode, $storeId);
588
  }
589
+
590
  }
app/code/community/Adyen/Payment/controllers/SavedCardController.php CHANGED
@@ -64,11 +64,29 @@ class Adyen_Payment_SavedCardController extends Mage_Core_Controller_Front_Actio
64
  $customer = Mage::registry('current_customer');
65
  $shopperReference = $customer->getId();
66
  // do api call to delete this card
67
- $success = Mage::helper('adyen')->removeRecurringCart($merchantAccount, $shopperReference, $recurringDetailReference);
68
 
69
  // show result message
70
  if($success) {
71
  $this->_getSession()->addSuccess(Mage::helper('adyen')->__('The card has been deleted.'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  } else {
73
  $this->_getSession()->addError(Mage::helper('adyen')->__('The card has not been deleted, please contact us.'));
74
  }
64
  $customer = Mage::registry('current_customer');
65
  $shopperReference = $customer->getId();
66
  // do api call to delete this card
67
+ $success = Mage::helper('adyen')->removeRecurringCard($merchantAccount, $shopperReference, $recurringDetailReference);
68
 
69
  // show result message
70
  if($success) {
71
  $this->_getSession()->addSuccess(Mage::helper('adyen')->__('The card has been deleted.'));
72
+
73
+ // remove the billing agreement
74
+ $agreement = Mage::getModel('sales/billing_agreement')->load($recurringDetailReference, 'reference_id');
75
+
76
+ if ($agreement && $agreement->getAgreementId() > 0 && $agreement->isValid()) {
77
+ $agreement->delete();
78
+ }
79
+
80
+ /*
81
+ * clear the cache for recurring payments so new card will be added
82
+ */
83
+ $recurringType = Mage::getStoreConfig('payment/adyen_abstract/recurringtypes', $storeId);
84
+ $customer = Mage::registry('current_customer');
85
+ $shopperReference = $customer->getId();
86
+
87
+ $cacheKey = $merchantAccount . "|" . $shopperReference . "|" . $recurringType;
88
+ Mage::app()->getCache()->remove($cacheKey);
89
+
90
  } else {
91
  $this->_getSession()->addError(Mage::helper('adyen')->__('The card has not been deleted, please contact us.'));
92
  }
app/code/community/Adyen/Payment/docs/.DS_Store DELETED
Binary file
app/code/community/Adyen/Payment/docs/httpauthentication/cgihtaccess.patch DELETED
@@ -1,15 +0,0 @@
1
- diff --git a/.htaccess b/.htaccess
2
- index 6fbbd49..4d93121 100755
3
- --- a/.htaccess
4
- +++ b/.htaccess
5
- @@ -127,7 +127,9 @@ setEnv MAGE_IS_DEVELOPER_MODE true
6
- ## workaround for HTTP authorization
7
- ## in CGI environment
8
-
9
- - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
10
- +## RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11
- + RewriteCond %{HTTP:Authorization} !^$
12
- + RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
13
-
14
- ############################################
15
- ## always send 404 on missing files in these folders
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Adyen/Payment/docs/httpauthentication/howto DELETED
@@ -1,7 +0,0 @@
1
- INTRODUCTION (Only if you are using Apache in CGI Mode):
2
- HTTP AUTHENTICATION on Apache CGI Mode is known not to work out of the Box, use the patch in the directory to get around the problem.
3
-
4
- WALK AROUND:
5
- Upload the patch to the <web_root>, followed by the following bash commands
6
- $ cd <web_root>
7
- $ patch -p0 < cgihtaccess.patch
 
 
 
 
 
 
 
app/code/community/Adyen/Payment/docs/readme DELETED
@@ -1,221 +0,0 @@
1
- /**
2
- * Adyen Payment Module
3
- *
4
- * NOTICE OF LICENSE
5
- *
6
- * This source file is subject to the Open Software License (OSL 3.0)
7
- * that is bundled with this package in the file LICENSE.txt.
8
- * It is also available through the world-wide-web at this URL:
9
- * http://opensource.org/licenses/osl-3.0.php
10
- * If you did not receive a copy of the license and are unable to
11
- * obtain it through the world-wide-web, please send an email
12
- * to license@magentocommerce.com so we can send you a copy immediately.
13
- *
14
- * @category Adyen
15
- * @package Adyen_Payment
16
- * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
17
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
- */
19
- /**
20
- * @category Payment Gateway
21
- * @package Adyen_Payment
22
- * @author Adyen
23
- * @property Adyen B.V
24
- * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
25
- */
26
-
27
- USAGE:
28
- 1.Authorize only:
29
- Authorize only, if set via the backend it means the plugin will just authorize and nothing more.That means users will have to place invoice manually and adyen backoffice manually
30
- capture payments.
31
-
32
- 2.Authorize and Capture:
33
- This can be set via the backend of the Adyen CC.If set to this option, order will be placed and capture in adyen will be started.
34
- Simply might means Automatic capture payment.
35
-
36
-
37
- Log changes
38
- ##0.0.1
39
- 1.Adding Direct payment methods Elv && Cc support via
40
-
41
- ##0.0.2
42
- 1.Configurations on backend classified to add efficiency
43
- 2.Landing pages on Adyen System on HPP
44
- 3.Refund reviewed or added
45
- 4.Capture && Authorization reviewe
46
-
47
-
48
- ##0.0.3
49
- See 0004208
50
-
51
- Date 8th November 2010
52
- ##v0.0.4
53
-
54
- ##Fixes Notification fixes for elv && cc
55
- ##Fixes Elv exchange of bank code && bank name
56
- ##Order status for both cc
57
- ##Added limit on text fields on ELV PM
58
-
59
- Date 18-02-2011
60
- Version 007
61
- ##Fixes the Customer edit error on the backend of magento
62
- ##Compatibility/tests with 1.4.1.2
63
-
64
-
65
- Date 22-03-2011
66
- Version 008
67
- @todo
68
- 1.Re-write hpp model
69
- 2.Re-write controller and fix all notification issues
70
-
71
-
72
- Date 31-03-2011
73
- Version 009
74
- ##Fixes
75
-
76
-
77
- Date 04-04-2011
78
- Version 0091
79
- ##Added mail notifications in order states
80
- ##Added manual capture support
81
- ##Added payment method in customer mails && Backend
82
- ##Fixes the auto_capture
83
- ##Fixes cgi authentication failures
84
- ##Fixes bank transfer notifications
85
- ##Fixes several confussions backend configuration settings
86
- ##Fixes auto capture, now more magento friendliness
87
-
88
- Date 05-04-2011
89
- 0.0.9.2
90
- ##Added partial refund support from Magento to Adyen psp
91
- ##Fixes redundant requests in offline refund
92
- ##Fixes cancelation request from Adyen psp
93
- ##Removal of complex backend settings, more magento friendly work flow
94
-
95
-
96
- Date 19-04-2011
97
- Version 0.0.9.4
98
- ##Fixes order status
99
-
100
- Date 02-05-2011
101
- Version 0.0.9.5
102
- ##Fixes the translation on the checkout
103
- ##Fixes the order overview on the psp
104
-
105
- Date : 04-05-2011
106
-
107
- Version 0.0.9.6
108
- ##Adding locale info under docs
109
-
110
- Version 0.0.9.7
111
- ##Adding adding nl_NL as standard translation file on locale
112
-
113
- Date : 12-05-2011
114
- Version 0.0.9.8
115
- ##Adding PENDING notifications support, now 'pending_payment' status for bank transfers
116
- ##Adding ONECLICK payment support on hpp
117
- ##Modifying the notifications to include Payment method and amphasizing notifications vs posts responses
118
- ##Adds logs on unsupported posts events
119
-
120
-
121
- Date : 29-09-2011
122
- Version 0.0.9.9
123
- ##Enterprise 1.11.x compatibility
124
- ##Testing 1.6.x
125
- ##MC 2.x compatibility
126
- ##Adding pre-fix support
127
-
128
- Date:29-09-2011
129
- Version:0.0.9.9r1
130
- ##Adding order link to Adyen Backoffice using search
131
-
132
- Version:0.1.0.0
133
- ##Adding partial refund from Adyen backoffice
134
- ##Adding Soap support in the notifications
135
- ##Adding pre-select payment methods in the HPP.
136
- ##Adding fallbacks for shopperReference && shopperEmail
137
-
138
- Version:0.1.0.3
139
- Date:10-11-2011
140
- ##Fixes missing some of the missing payment methods
141
- ##Improves payment methods configurations
142
- ##Fixes few post data in order comments
143
- ##Testing compatibility with 1.6.1.0
144
-
145
- Version:0.1.0.3r1-r2
146
- ##Addressing hard order state changes
147
- ##Fixing country settings/config
148
-
149
- Version:0.1.0.3r3
150
- ##Fixes creditmemo && refund on the observer.
151
-
152
- Version:0.1.0.4
153
- ##Fixes duplicate notifications, now robust mechanism
154
- ##Adding disable button for checkout options
155
- ##Removing the add to history deprecated method by magento 1.4.0.0-alpha3
156
- ##Fixes address street + housenr
157
- ##Fixes dummy items on the invoiceline
158
- ##Fixes provincie field on the billing address
159
- ##Added Openinvoice implimentation on hpp and standalone
160
-
161
- Version:0.1.0.5
162
- Date:02-01-2012
163
- ##Fixes manual/complete payment status notifications processing
164
- ##Adding pre-authorise configu for manual mode
165
- ##Fixes broken psp on admin panel
166
-
167
- Version:0.1.0.6
168
- Date:05-01-2012
169
- ##Fixes success flag on the HTTP notification mode.
170
-
171
- Version:0.1.0.7
172
- Date:06-01-2012
173
- ##Fixes the back button from a browser, now continue shopping in this case.
174
-
175
- Version:0.1.0.8
176
- Date:11-01-2012
177
- ##Adding 2 extra status configurations for refund and pre refund authorisation
178
- ##Detection of refund-received will skip creditmemmo from Adyen.
179
- ##Adding an exceptional to failed refunds on holdCancel events
180
-
181
- Version:v0.1.0.8r1
182
- ##Fixes the broken configuration in handling URL result 'REFUSED' 'CANCELLED' 'ERROR'
183
- ##Fixes some pdf paths in templates
184
- 0.1.0.8r2
185
- ##Code refactoring, introducing adyen/process
186
- 0.1.0.8r3-r4
187
- ##Adding an exception to the CANCEL on bankTransfer
188
-
189
- Date:23-04-2012
190
- Vesion:0.1.0.9
191
- ##Adding Admin Sales Adyen Status Column
192
- ##Adding ideal bank selection in the checkout
193
- ##Adding a stylesheet for styling
194
-
195
- Fixes:
196
- ##Fixed orderData
197
-
198
- Version:v0.1.0.9r1
199
- Date 29-05-2012
200
- #Fixing demoMode configuration
201
- #Fixing default configuration demoMode
202
- #Fixing ideal list on file_get_contents, now using curl
203
- #Compatibility test on enteriprise 1.12.x.x && community 1.7.0.0
204
-
205
- Version:0.1.0.10v
206
- Date:13-07-2012
207
- #Fixing broken grid update in 1.7.x.x
208
- #Code refactoring in process model
209
- #Adding better authorisation detection on the return url
210
- #Improving redirect action by internal record check
211
-
212
- Version:v0.1.0.11
213
- Date:13-09-2012
214
- ##Fixing demo-mode configuration handling
215
-
216
- Version:0.1.0.11r1
217
- ##Fixing spelling in the configuration fields
218
- ##Remove sort order in the default group configuration
219
-
220
- Version:0.1.0.12
221
- ##Migrating upgrade user from previous demoMode (namely production), back to their original setting.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Adyen/Payment/docs/test-cards DELETED
@@ -1,47 +0,0 @@
1
- TESTING THE PLUGIN:
2
- **Use the data on this url https://support.adyen.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=2
3
- **Sample used in testing:
4
-
5
- CC:
6
- 5555444433331111
7
- MasterCard
8
- CVC 737
9
- Date:12/2012
10
-
11
- VISA
12
- 4111111111111111 (Consumer)
13
- 4444333322221111 (Corporate)
14
-
15
- Elv
16
- Account Number / Kontonummer: 1234567890
17
- Bank Location ID/Bankleitzahl: 12345678
18
-
19
-
20
- MAGENTO CC TO ADYEN:
21
- magento cc
22
- [AE] => American Express
23
- [VI] => Visa
24
- [MC] => Master Card
25
- [DI] => Discover
26
- [DC] => Diners Club
27
- [SS] => Switch/Solo
28
- [MO] => Maestro
29
- [JC] => JCB
30
- [CB] => CarteBleue
31
-
32
- adyen cc
33
- American Express amex
34
- Bank Transfer (NL) bankTransfer_NL
35
- DIRECTebanking directEbanking
36
- Direct Debit (NL) / Eenmalige machtiging directdebit_NL
37
- Electronic Direct Debit (DE) / Lastschrift (ELV) elv
38
- iDEAL iDEAL ideal
39
- Maestro UK Maestro UK maestrouk
40
- MasterCard MasterCard mc
41
- Solo Solo solo
42
- VISA VISA visa
43
-
44
-
45
- Openinvoice
46
- 43.27.366.70
47
- 12.34.567.89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Adyen/Payment/docs/translation/Adyen_Payment.csv DELETED
@@ -1,53 +0,0 @@
1
- "You will be redirected to Adyen website when you place an order."
2
- "%s ( Qty: %s ) (Price: %s %s ) <br />"
3
- "Adyen %s <br /> authResult: %s <br /> pspReference: %s"
4
- "Adyen %s <br /> eventCode: %s <br /> pspReference: %s <br /> success: %s"
5
- "Adyen response(s): %s <br /> pspReference: %s"
6
- "Authorize Only"
7
- "Authorize and Capture"
8
- "Can not connect payment service. Please try again later."
9
- "Capture Mode set to Manual"
10
- "Customer was redirected to Adyen."
11
- "Order can not Hold"
12
- "Order can not be canceled"
13
- "Order rows: <br />"
14
- "Shipment cost: %s %s <br />"
15
- "System error, please try again later"
16
- "System error, please try again later: %s"
17
- "The payment is REFUSED by Adyen."
18
- "You will be redirected to Adyen in a few seconds."
19
- "Your payment failed, Please try again later"
20
- "--Please Select--"
21
- "Account Number"
22
- "Account holder name"
23
- "Account holder: %s"
24
- "Account number: xxx%s"
25
- "Bank Location"
26
- "Bank Location (City)"
27
- "Bank Location ID"
28
- "Bank Name"
29
- "Bank code: %s"
30
- "Bank name: %s"
31
- "Card Verification Number"
32
- "Credit Card Number"
33
- "Credit Card Number: xxxx-%s"
34
- "Credit Card Type"
35
- "Credit Card Type: %s"
36
- "Expiration Date"
37
- "Expiration Date: %s/%s"
38
- "Name on Card"
39
- "Name on the Card: %s"
40
- "Payment Method: %s"
41
- "Submitting payment information..."
42
- "What is this?","Wat is dit?"
43
- "Order email sent to shopper."
44
- "The payment is PENDING by Adyen."
45
- "The payment is AUTHORIZED by Adyen."
46
- "There has an error occurred with your Adyen payment."
47
- "There was an error with your payment."
48
- "You will be redirected to Adyen website when you place an order."
49
- "Your payment is cancelled."
50
- "Your payment is CANCELLED"
51
- "Your payment is pending."
52
- "Your payment is refused."
53
- "Your payment is authorized."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Adyen/Payment/docs/translation/Mage_Checkout.csv DELETED
@@ -1 +0,0 @@
1
- "Your payment failed. Please try again later"
 
app/code/community/Adyen/Payment/docs/translation/howto DELETED
@@ -1,12 +0,0 @@
1
- USAGE:
2
- File:Mage_Checkout.csv
3
- Copy the content of the file Mage_Checkout.csv and paste it into locale/nl_NL/ or other language dir.
4
-
5
- File name:Adyen_Payment.csv
6
- Translate this file into your language by separating the strings in the quote and separate them by comma.
7
-
8
- Example:
9
- "You will be redirected to Adyen website when you place an order.","U wordt doorverwezen naar Adyen na het plaatsen van de order."
10
-
11
- Notice:
12
- The first line has been done for you as an example on how to translate.Available samples ready for use are also available under their country code e.g nl_NL
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Adyen/Payment/etc/config.xml CHANGED
@@ -29,17 +29,17 @@
29
  <config>
30
  <modules>
31
  <Adyen_Payment>
32
- <version>2.2.2</version>
33
  </Adyen_Payment>
34
  </modules>
35
  <global>
36
  <models>
37
  <adyen>
38
  <class>Adyen_Payment_Model</class>
39
- <resourceModel>adyen_mysql4</resourceModel>
40
  </adyen>
41
- <adyen_mysql4>
42
- <class>Adyen_Payment_Model_Mysql4</class>
43
  <entities>
44
  <api_debug>
45
  <table>adyen_api_debug</table>
@@ -51,18 +51,23 @@
51
  <table>adyen_event_data_queue</table>
52
  </event_queue>
53
  </entities>
54
- </adyen_mysql4>
55
  </models>
56
  <helpers>
57
  <adyen>
58
  <class>Adyen_Payment_Helper</class>
59
  </adyen>
 
 
 
 
 
60
  </helpers>
61
  <resources>
62
  <adyen_setup>
63
  <setup>
64
  <module>Adyen_Payment</module>
65
- <class>Adyen_Payment_Model_Mysql4_Setup</class>
66
  </setup>
67
  <connection>
68
  <use>core_setup</use>
@@ -162,6 +167,16 @@
162
  </totals>
163
  </order_creditmemo>
164
  </sales>
 
 
 
 
 
 
 
 
 
 
165
  </global>
166
 
167
  <frontend>
@@ -247,20 +262,25 @@
247
  <ws_password_test></ws_password_test>
248
  <ws_username_live></ws_username_live>
249
  <ws_password_live></ws_password_live>
250
- <demoMode>N</demoMode>
251
- <order_status>processing</order_status>
 
252
  <payment_authorized>processing</payment_authorized>
253
  <payment_authorized_virtual>complete</payment_authorized_virtual>
 
254
  <capture_mode>auto</capture_mode>
255
  <recurringtypes>ONECLICK</recurringtypes>
256
  <auto_capture_openinvoice>0</auto_capture_openinvoice>
257
  <paypal_capture_mode>0</paypal_capture_mode>
258
  <send_email_bank_sepa_on_pending>0</send_email_bank_sepa_on_pending>
 
 
259
  </adyen_abstract>
260
  <adyen_hpp translate="title" module="adyen">
261
  <customer_id backend_model="adminhtml/system_config_backend_encrypted"/>
262
  <currency>EUR</currency>
263
  <model>adyen/adyen_hpp</model>
 
264
  <title>Adyen HPP</title>
265
  <secret_wordt></secret_wordt>
266
  <secret_wordp></secret_wordp>
@@ -269,37 +289,57 @@
269
  <ws_password_test></ws_password_test>
270
  <ws_username_live></ws_username_live>
271
  <ws_password_live></ws_password_live>
272
- <order_status>processing</order_status>
273
  <allowspecific>0</allowspecific>
274
  <disable_hpptypes>0</disable_hpptypes>
275
  <sort_order>30</sort_order>
276
  <cache_directory_lookup>0</cache_directory_lookup>
277
  <return_url_in_request>0</return_url_in_request>
278
- <show_ideal_logos>0</show_ideal_logos>
279
  </adyen_hpp>
 
 
 
 
 
 
 
 
 
 
280
  <adyen_pos translate="title" module="adyen">
281
  <active>0</active>
282
  <model>adyen/adyen_pos</model>
283
- <title>Adyen POS</title>
 
284
  <recurringtypes>ONECLICK</recurringtypes>
 
285
  <enable_scanner>0</enable_scanner>
286
  <submit_scanner>0</submit_scanner>
287
  <express_checkout>0</express_checkout>
 
 
 
288
  <create_shipment>0</create_shipment>
 
 
 
 
 
 
 
 
 
 
289
  <cash_express_checkout>0</cash_express_checkout>
290
  <cash_drawer>0</cash_drawer>
291
  <cash_drawer_printer_ip></cash_drawer_printer_ip>
292
  <cash_drawer_printer_port>8008</cash_drawer_printer_port>
293
  <cash_drawer_printer_device_id>local_printer</cash_drawer_printer_device_id>
294
  <ip_filter>0</ip_filter>
295
- <allowspecific>0</allowspecific>
296
- <sort_order>80</sort_order>
297
- </adyen_pos>
298
  <adyen_openinvoice translate="title" module="adyen">
299
  <active>0</active>
300
  <model>adyen/adyen_openinvoice</model>
301
  <group>adyen</group>
302
- <order_status>pending</order_status>
303
  <title>Adyen Open Invoice</title>
304
  <openinvoicetypes>openinvoice</openinvoicetypes>
305
  <gender_show>0</gender_show>
@@ -312,7 +352,6 @@
312
  <active>0</active>
313
  <model>adyen/adyen_cc</model>
314
  <group>adyen</group>
315
- <order_status>processing</order_status>
316
  <title>Adyen Credit Card</title>
317
  <debug>0</debug>
318
  <enable_installments>0</enable_installments>
@@ -331,7 +370,6 @@
331
  <active>0</active>
332
  <model>adyen/adyen_oneclick</model>
333
  <group>adyen</group>
334
- <order_status>processing</order_status>
335
  <title>Adyen OneClick</title>
336
  <sort_order>1</sort_order>
337
  </adyen_oneclick>
@@ -339,7 +377,6 @@
339
  <active>0</active>
340
  <model>adyen/adyen_elv</model>
341
  <group>adyen</group>
342
- <order_status>processing</order_status>
343
  <visible_type>both</visible_type>
344
  <title>Adyen ELV</title>
345
  <sort_order>50</sort_order>
@@ -348,7 +385,6 @@
348
  <active>0</active>
349
  <model>adyen/adyen_boleto</model>
350
  <group>adyen</group>
351
- <order_status>processing</order_status>
352
  <visible_type>both</visible_type>
353
  <title>Adyen Boleto</title>
354
  <delivery_days>5</delivery_days>
@@ -359,13 +395,21 @@
359
  <active>0</active>
360
  <model>adyen/adyen_sepa</model>
361
  <group>adyen</group>
362
- <order_status>processing</order_status>
363
  <visible_type>both</visible_type>
364
  <title>Adyen SEPA</title>
365
  <sort_order>60</sort_order>
366
  <validate_iban>0</validate_iban>
367
  <flow>sales</flow>
368
  </adyen_sepa>
 
 
 
 
 
 
 
 
 
369
  </payment>
370
  <adyen>
371
  <payment>
@@ -495,4 +539,16 @@
495
  </totals_sort>
496
  </sales>
497
  </default>
 
 
 
 
 
 
 
 
 
 
 
 
498
  </config>
29
  <config>
30
  <modules>
31
  <Adyen_Payment>
32
+ <version>2.3.0</version>
33
  </Adyen_Payment>
34
  </modules>
35
  <global>
36
  <models>
37
  <adyen>
38
  <class>Adyen_Payment_Model</class>
39
+ <resourceModel>adyen_resource</resourceModel>
40
  </adyen>
41
+ <adyen_resource>
42
+ <class>Adyen_Payment_Model_Resource</class>
43
  <entities>
44
  <api_debug>
45
  <table>adyen_api_debug</table>
51
  <table>adyen_event_data_queue</table>
52
  </event_queue>
53
  </entities>
54
+ </adyen_resource>
55
  </models>
56
  <helpers>
57
  <adyen>
58
  <class>Adyen_Payment_Helper</class>
59
  </adyen>
60
+ <payment>
61
+ <rewrite>
62
+ <data>Adyen_Payment_Helper_Payment_Data</data>
63
+ </rewrite>
64
+ </payment>
65
  </helpers>
66
  <resources>
67
  <adyen_setup>
68
  <setup>
69
  <module>Adyen_Payment</module>
70
+ <class>Adyen_Payment_Model_Resource_Setup</class>
71
  </setup>
72
  <connection>
73
  <use>core_setup</use>
167
  </totals>
168
  </order_creditmemo>
169
  </sales>
170
+ <events>
171
+ <controller_action_predispatch>
172
+ <observers>
173
+ <adyen_payment>
174
+ <class>adyen/observer</class>
175
+ <method>addMethodsToConfig</method>
176
+ </adyen_payment>
177
+ </observers>
178
+ </controller_action_predispatch>
179
+ </events>
180
  </global>
181
 
182
  <frontend>
262
  <ws_password_test></ws_password_test>
263
  <ws_username_live></ws_username_live>
264
  <ws_password_live></ws_password_live>
265
+ <demoMode>Y</demoMode>
266
+ <debug>1</debug>
267
+ <order_status>pending</order_status>
268
  <payment_authorized>processing</payment_authorized>
269
  <payment_authorized_virtual>complete</payment_authorized_virtual>
270
+ <payment_cancelled_redirect>checkout/cart</payment_cancelled_redirect>
271
  <capture_mode>auto</capture_mode>
272
  <recurringtypes>ONECLICK</recurringtypes>
273
  <auto_capture_openinvoice>0</auto_capture_openinvoice>
274
  <paypal_capture_mode>0</paypal_capture_mode>
275
  <send_email_bank_sepa_on_pending>0</send_email_bank_sepa_on_pending>
276
+ <title_renderer>title_image</title_renderer>
277
+ <ignore_refund_notification>0</ignore_refund_notification>
278
  </adyen_abstract>
279
  <adyen_hpp translate="title" module="adyen">
280
  <customer_id backend_model="adminhtml/system_config_backend_encrypted"/>
281
  <currency>EUR</currency>
282
  <model>adyen/adyen_hpp</model>
283
+ <group>adyen</group>
284
  <title>Adyen HPP</title>
285
  <secret_wordt></secret_wordt>
286
  <secret_wordp></secret_wordp>
289
  <ws_password_test></ws_password_test>
290
  <ws_username_live></ws_username_live>
291
  <ws_password_live></ws_password_live>
 
292
  <allowspecific>0</allowspecific>
293
  <disable_hpptypes>0</disable_hpptypes>
294
  <sort_order>30</sort_order>
295
  <cache_directory_lookup>0</cache_directory_lookup>
296
  <return_url_in_request>0</return_url_in_request>
 
297
  </adyen_hpp>
298
+ <adyen_ideal translate="title" module="adyen">
299
+ <active>0</active>
300
+ <model>adyen/adyen_ideal</model>
301
+ <group>adyen</group>
302
+ <title>Adyen iDEAL</title>
303
+ <show_ideal_logos>0</show_ideal_logos>
304
+ <sort_order>35</sort_order>
305
+ <allowspecific>1</allowspecific>
306
+ <specificcountry>NL</specificcountry>
307
+ </adyen_ideal>
308
  <adyen_pos translate="title" module="adyen">
309
  <active>0</active>
310
  <model>adyen/adyen_pos</model>
311
+ <group>adyen</group>
312
+ <title>PIN</title>
313
  <recurringtypes>ONECLICK</recurringtypes>
314
+ <add_receipt_order_lines>1</add_receipt_order_lines>
315
  <enable_scanner>0</enable_scanner>
316
  <submit_scanner>0</submit_scanner>
317
  <express_checkout>0</express_checkout>
318
+ <express_checkout_redirect_connect>1</express_checkout_redirect_connect>
319
+ <express_checkout_kiosk_mode>0</express_checkout_kiosk_mode>
320
+ <express_checkout_recurring>1</express_checkout_recurring>
321
  <create_shipment>0</create_shipment>
322
+ <allowspecific>0</allowspecific>
323
+ <sort_order>80</sort_order>
324
+ </adyen_pos>
325
+ <adyen_cash>
326
+ <active>0</active>
327
+ <model>adyen/adyen_cash</model>
328
+ <group>adyen</group>
329
+ <title>Cash</title>
330
+ <sort_order>90</sort_order>
331
+ <visible_type>both</visible_type>
332
  <cash_express_checkout>0</cash_express_checkout>
333
  <cash_drawer>0</cash_drawer>
334
  <cash_drawer_printer_ip></cash_drawer_printer_ip>
335
  <cash_drawer_printer_port>8008</cash_drawer_printer_port>
336
  <cash_drawer_printer_device_id>local_printer</cash_drawer_printer_device_id>
337
  <ip_filter>0</ip_filter>
338
+ </adyen_cash>
 
 
339
  <adyen_openinvoice translate="title" module="adyen">
340
  <active>0</active>
341
  <model>adyen/adyen_openinvoice</model>
342
  <group>adyen</group>
 
343
  <title>Adyen Open Invoice</title>
344
  <openinvoicetypes>openinvoice</openinvoicetypes>
345
  <gender_show>0</gender_show>
352
  <active>0</active>
353
  <model>adyen/adyen_cc</model>
354
  <group>adyen</group>
 
355
  <title>Adyen Credit Card</title>
356
  <debug>0</debug>
357
  <enable_installments>0</enable_installments>
370
  <active>0</active>
371
  <model>adyen/adyen_oneclick</model>
372
  <group>adyen</group>
 
373
  <title>Adyen OneClick</title>
374
  <sort_order>1</sort_order>
375
  </adyen_oneclick>
377
  <active>0</active>
378
  <model>adyen/adyen_elv</model>
379
  <group>adyen</group>
 
380
  <visible_type>both</visible_type>
381
  <title>Adyen ELV</title>
382
  <sort_order>50</sort_order>
385
  <active>0</active>
386
  <model>adyen/adyen_boleto</model>
387
  <group>adyen</group>
 
388
  <visible_type>both</visible_type>
389
  <title>Adyen Boleto</title>
390
  <delivery_days>5</delivery_days>
395
  <active>0</active>
396
  <model>adyen/adyen_sepa</model>
397
  <group>adyen</group>
 
398
  <visible_type>both</visible_type>
399
  <title>Adyen SEPA</title>
400
  <sort_order>60</sort_order>
401
  <validate_iban>0</validate_iban>
402
  <flow>sales</flow>
403
  </adyen_sepa>
404
+ <adyen_pay_by_mail>
405
+ <active>0</active>
406
+ <model>adyen/adyen_payByMail</model>
407
+ <group>adyen</group>
408
+ <visible_type>backend</visible_type>
409
+ <title>Adyen Pay By Mail</title>
410
+ <session_validity>3</session_validity>
411
+ <sort_order>70</sort_order>
412
+ </adyen_pay_by_mail>
413
  </payment>
414
  <adyen>
415
  <payment>
539
  </totals_sort>
540
  </sales>
541
  </default>
542
+ <crontab>
543
+ <jobs>
544
+ <adyen>
545
+ <schedule>
546
+ <cron_expr>*/5 * * * *</cron_expr>
547
+ </schedule>
548
+ <run>
549
+ <model>adyen/cronjob::updateNotificationQueue</model>
550
+ </run>
551
+ </adyen>
552
+ </jobs>
553
+ </crontab>
554
  </config>
app/code/community/Adyen/Payment/etc/system.xml CHANGED
@@ -41,19 +41,20 @@
41
  <frontend_class>adyen-method-abstract</frontend_class>
42
  <frontend_model>adyen/adminhtml_system_config_fieldset_payment</frontend_model>
43
  <comment><![CDATA[<p>Click the following link for an <a target="_blank" href="http://vimeo.com/94005128">instructional video on how to set up the Adyen Magento plugin</a>, or <a target="_blank" href="https://www.adyen.com/dam/documentation/manuals/MagentoQuickIntegrationManual.pdf">here to download the Quick Quick Integration Guide</a> or <a target="_blank" href="https://www.adyen.com/dam/documentation/manuals/AdyenMagentoExtension.pdf">here to download the more advanced manual</a> and <a target="_blank" href="https://www.adyen.com/home/payment-services/plug-ins/magento#form">here to sign up for a test account</a>.
 
44
  The latest version of the <a target="_blank" href="https://github.com/adyenpayments/magento/releases">Adyen Magento plugin is also available through GitHub</a>.
45
  If you have any further questions, please visit the <a target="_blank" href="http://www.adyen.com">Adyen.com</a> website or email <a href="mailto:magento@adyen.com">magento@adyen.com</a>.
46
  </p>]]></comment>
47
  <fields>
48
  <version translate="label">
49
-             <label>Extension version</label>
50
-                     <frontend_type>label</frontend_type>
51
-                     <frontend_model>Adyen_Payment_Block_Adminhtml_Version</frontend_model>
52
-                     <sort_order>0</sort_order>
53
-                     <show_in_default>1</show_in_default>
54
-                     <show_in_website>1</show_in_website>
55
-                     <show_in_store>1</show_in_store>
56
-         </version>
57
  <merchantAccount translate="label">
58
  <label>Merchant Account</label>
59
  <comment><![CDATA[You can find this in the Adyen back-office. The Adyen back-office can be found on <a target="_blank" href="https://ca-test.adyen.com">https://ca-test.adyen.com</a> for test or <a target="_blank" href="https://ca-live.adyen.com">https://ca-live.adyen.com</a> for live.]]></comment>
@@ -123,6 +124,15 @@
123
  <show_in_website>1</show_in_website>
124
  <show_in_store>0</show_in_store>
125
  </payment_cancelled>
 
 
 
 
 
 
 
 
 
126
  <refund_authorized translate="label">
127
  <label>Refund authorise (refund success)</label>
128
  <comment>(optional) leave empty if you are not sure</comment>
@@ -164,7 +174,7 @@
164
  <capture_mode translate="label">
165
  <label>Capture Mode</label>
166
  <frontend_type>select</frontend_type>
167
- <comment>If you are using "The manual capture in Adyen" set this to manual and you will get a chance to capture it by creating the invoice and select "capture online".If not sure select auto.Notice:Ideal and Cash are always Auto Capture!</comment>
168
  <source_model>adyen/source_captureModes</source_model>
169
  <sort_order>78</sort_order>
170
  <show_in_default>1</show_in_default>
@@ -199,6 +209,16 @@
199
  <show_in_website>1</show_in_website>
200
  <show_in_store>0</show_in_store>
201
  </ws_password_test>
 
 
 
 
 
 
 
 
 
 
202
  <ws_username_live translate="label">
203
  <label>Adyen ws username for Live</label>
204
  <comment>Normally this will be ws@Company.YourCompanyCode</comment>
@@ -218,6 +238,24 @@
218
  <show_in_website>1</show_in_website>
219
  <show_in_store>0</show_in_store>
220
  </ws_password_live>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  <auto_capture_openinvoice>
222
  <label>Auto capture Openinvoice(AfterPay/Klarna) payment methods</label>
223
  <comment>By default OpenInvoice is set to manual capture. If you want auto capture you need to contact magento@adyen.com so we can set this up for your account and then you can set this option to yes</comment>
@@ -238,6 +276,16 @@
238
  <show_in_website>1</show_in_website>
239
  <show_in_store>0</show_in_store>
240
  </paypal_capture_mode>
 
 
 
 
 
 
 
 
 
 
241
  <send_email_bank_sepa_on_pending>
242
  <label>Send confirmation email for Banktransfer/SEPA</label>
243
  <comment>Send a confirmation mail after banktranfer/SEPA is placed (not yet paid). Make sure that you have BankTransfer Pending Notification enabled in Adyen backoffice to do this contact magento@adyen.com</comment>
@@ -286,6 +334,45 @@
286
  <show_in_website>1</show_in_website>
287
  <show_in_store>0</show_in_store>
288
  </send_invoice_update_mail>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  </fields>
290
  </adyen_abstract>
291
  <!-- @Hpp only -->
@@ -366,8 +453,8 @@
366
  <source_model>adminhtml/system_config_source_yesno</source_model>
367
  <sort_order>90</sort_order>
368
  <show_in_default>1</show_in_default>
369
- <show_in_website>0</show_in_website>
370
- <show_in_store>0</show_in_store>
371
  </disable_hpptypes>
372
  <payment_routines translate="label">
373
  <label>Payment Flow Selection</label>
@@ -377,7 +464,7 @@
377
  <sort_order>95</sort_order>
378
  <show_in_default>1</show_in_default>
379
  <show_in_website>1</show_in_website>
380
- <show_in_store>0</show_in_store>
381
  <depends><disable_hpptypes>1</disable_hpptypes></depends>
382
  </payment_routines>
383
  <cache_directory_lookup>
@@ -401,20 +488,74 @@
401
  <show_in_website>1</show_in_website>
402
  <show_in_store>1</show_in_store>
403
  </return_url_in_request>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  <show_ideal_logos>
405
- <label>Show ideal bank logos</label>
406
- <comment>Show ideal bank logos instead of dropdown</comment>
407
  <frontend_type>select</frontend_type>
408
  <source_model>adminhtml/system_config_source_yesno</source_model>
409
- <sort_order>115</sort_order>
410
  <show_in_default>1</show_in_default>
411
  <show_in_website>1</show_in_website>
412
  <show_in_store>1</show_in_store>
413
  </show_ideal_logos>
 
 
 
 
 
 
 
 
414
  <allowspecific translate="label">
415
  <label>Payment to applicable countries</label>
416
  <frontend_type>allowspecific</frontend_type>
417
- <sort_order>120</sort_order>
418
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
419
  <show_in_default>1</show_in_default>
420
  <show_in_website>1</show_in_website>
@@ -423,7 +564,7 @@
423
  <specificcountry translate="label">
424
  <label>Payment to Specific countries</label>
425
  <frontend_type>multiselect</frontend_type>
426
- <sort_order>130</sort_order>
427
  <source_model>adminhtml/system_config_source_country</source_model>
428
  <show_in_default>1</show_in_default>
429
  <show_in_website>1</show_in_website>
@@ -431,7 +572,7 @@
431
  <depends><allowspecific>1</allowspecific></depends>
432
  </specificcountry>
433
  </fields>
434
- </adyen_hpp>
435
  <!-- @Pos only -->
436
  <adyen_pos translate="label" module="adyen">
437
  <label>Adyen POS</label>
@@ -476,6 +617,16 @@
476
  <show_in_website>1</show_in_website>
477
  <show_in_store>1</show_in_store>
478
  </recurringtypes>
 
 
 
 
 
 
 
 
 
 
479
  <enable_scanner translate="label">
480
  <label>Enable Scanner</label>
481
  <comment>If you enable this you have the possiblity to scan products with a hand scanner on the shopping cart page and this will automatically add products to the shopping cart based on the same SKU name</comment>
@@ -507,16 +658,102 @@
507
  <show_in_website>1</show_in_website>
508
  <show_in_store>1</show_in_store>
509
  </express_checkout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  <create_shipment>
511
  <label>Create Shipment</label>
512
  <comment>If you enable this there will be automatically be created a shipment if the invoice is created</comment>
513
  <frontend_type>select</frontend_type>
514
  <source_model>adminhtml/system_config_source_yesno</source_model>
515
- <sort_order>38</sort_order>
516
  <show_in_default>1</show_in_default>
517
  <show_in_website>1</show_in_website>
518
  <show_in_store>1</show_in_store>
519
  </create_shipment>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  <cash_express_checkout>
521
  <label>Cash Express checkout</label>
522
  <comment>This will show a checkout buttton on the shopping cart to directly do a Cash payment without going to the checkout steps. Make sure that you have Cash enabled on your skin and HPP payment method is enabled and correctly configured. You must be logged into your magento account on the front-end to see the button</comment>
@@ -536,7 +773,6 @@
536
  <show_in_default>1</show_in_default>
537
  <show_in_website>1</show_in_website>
538
  <show_in_store>1</show_in_store>
539
- <depends><cash_express_checkout>1</cash_express_checkout></depends>
540
  </cash_drawer>
541
  <cash_drawer_printer_ip>
542
  <label>IP address printer</label>
@@ -598,10 +834,20 @@
598
  <show_in_store>1</show_in_store>
599
  <depends><ip_filter>1</ip_filter></depends>
600
  </ip_filter_to>
 
 
 
 
 
 
 
 
 
 
601
  <allowspecific translate="label">
602
  <label>Payment to applicable countries</label>
603
  <frontend_type>allowspecific</frontend_type>
604
- <sort_order>49</sort_order>
605
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
606
  <show_in_default>1</show_in_default>
607
  <show_in_website>1</show_in_website>
@@ -610,7 +856,7 @@
610
  <specificcountry translate="label">
611
  <label>Payment to Specific countries</label>
612
  <frontend_type>multiselect</frontend_type>
613
- <sort_order>50</sort_order>
614
  <source_model>adminhtml/system_config_source_country</source_model>
615
  <show_in_default>1</show_in_default>
616
  <show_in_website>1</show_in_website>
@@ -618,7 +864,7 @@
618
  <depends><allowspecific>1</allowspecific></depends>
619
  </specificcountry>
620
  </fields>
621
- </adyen_pos>
622
  <!-- @Openinvoice only -->
623
  <adyen_openinvoice translate="label" module="adyen">
624
  <label>Adyen OpenInvoice</label>
@@ -689,29 +935,39 @@
689
  <show_in_website>1</show_in_website>
690
  <show_in_store>1</show_in_store>
691
  </telephone_show>
 
 
 
 
 
 
 
 
 
692
  <different_address_disable>
693
  <label>Disable on Different Address</label>
694
  <comment>If the delivery address and billing address in the checkout is not the same disable this payment method because Klarna will most likely reject it</comment>
695
  <frontend_type>select</frontend_type>
696
  <source_model>adminhtml/system_config_source_yesno</source_model>
697
- <sort_order>38</sort_order>
698
  <show_in_default>1</show_in_default>
699
  <show_in_website>1</show_in_website>
700
  <show_in_store>1</show_in_store>
701
  </different_address_disable>
702
- <fee translate="label">
703
- <label>Fee</label>
704
- <frontend_type>text</frontend_type>
705
- <sort_order>38</sort_order>
 
 
706
  <show_in_default>1</show_in_default>
707
  <show_in_website>1</show_in_website>
708
  <show_in_store>1</show_in_store>
709
- <validate>validate-number</validate>
710
- </fee>
711
  <allowspecific translate="label">
712
  <label>Payment to applicable countries</label>
713
  <frontend_type>allowspecific</frontend_type>
714
- <sort_order>40</sort_order>
715
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
716
  <show_in_default>1</show_in_default>
717
  <show_in_website>1</show_in_website>
@@ -1231,6 +1487,87 @@
1231
  </visible_type>
1232
  </fields>
1233
  </adyen_sepa>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1234
  </groups>
1235
  </payment>
1236
  </sections>
41
  <frontend_class>adyen-method-abstract</frontend_class>
42
  <frontend_model>adyen/adminhtml_system_config_fieldset_payment</frontend_model>
43
  <comment><![CDATA[<p>Click the following link for an <a target="_blank" href="http://vimeo.com/94005128">instructional video on how to set up the Adyen Magento plugin</a>, or <a target="_blank" href="https://www.adyen.com/dam/documentation/manuals/MagentoQuickIntegrationManual.pdf">here to download the Quick Quick Integration Guide</a> or <a target="_blank" href="https://www.adyen.com/dam/documentation/manuals/AdyenMagentoExtension.pdf">here to download the more advanced manual</a> and <a target="_blank" href="https://www.adyen.com/home/payment-services/plug-ins/magento#form">here to sign up for a test account</a>.
44
+ For the test environment you can use test cards. You can find the test cards <a target="_blank" href="https://www.adyen.com/home/support/knowledgebase/implementation-articles?article=kb_imp_17">here</a>.
45
  The latest version of the <a target="_blank" href="https://github.com/adyenpayments/magento/releases">Adyen Magento plugin is also available through GitHub</a>.
46
  If you have any further questions, please visit the <a target="_blank" href="http://www.adyen.com">Adyen.com</a> website or email <a href="mailto:magento@adyen.com">magento@adyen.com</a>.
47
  </p>]]></comment>
48
  <fields>
49
  <version translate="label">
50
+             <label>Extension version</label>
51
+                     <frontend_type>label</frontend_type>
52
+                     <frontend_model>Adyen_Payment_Block_Adminhtml_Version</frontend_model>
53
+                     <sort_order>0</sort_order>
54
+                     <show_in_default>1</show_in_default>
55
+                     <show_in_website>1</show_in_website>
56
+                     <show_in_store>1</show_in_store>
57
+         </version>
58
  <merchantAccount translate="label">
59
  <label>Merchant Account</label>
60
  <comment><![CDATA[You can find this in the Adyen back-office. The Adyen back-office can be found on <a target="_blank" href="https://ca-test.adyen.com">https://ca-test.adyen.com</a> for test or <a target="_blank" href="https://ca-live.adyen.com">https://ca-live.adyen.com</a> for live.]]></comment>
124
  <show_in_website>1</show_in_website>
125
  <show_in_store>0</show_in_store>
126
  </payment_cancelled>
127
+ <payment_cancelled_redirect>
128
+ <label>Redirect to page after cancellation</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adyen/source_cancelRedirect</source_model>
131
+ <sort_order>65</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>0</show_in_store>
135
+ </payment_cancelled_redirect>
136
  <refund_authorized translate="label">
137
  <label>Refund authorise (refund success)</label>
138
  <comment>(optional) leave empty if you are not sure</comment>
174
  <capture_mode translate="label">
175
  <label>Capture Mode</label>
176
  <frontend_type>select</frontend_type>
177
+ <comment>If you are using "The manual capture in Adyen" set this to manual and you will get a chance to capture it by creating the invoice and select "capture online".If not sure select auto.Notice:iDEAL and Cash are always Auto Capture!</comment>
178
  <source_model>adyen/source_captureModes</source_model>
179
  <sort_order>78</sort_order>
180
  <show_in_default>1</show_in_default>
209
  <show_in_website>1</show_in_website>
210
  <show_in_store>0</show_in_store>
211
  </ws_password_test>
212
+ <ws_test_button translate="label">
213
+ <label></label>
214
+ <button_label>Test Webserver Credentials for test</button_label>
215
+ <modus>test</modus>
216
+ <frontend_model>adyen/adminhtml_system_config_testWebserverConfiguration</frontend_model>
217
+ <sort_order>91</sort_order>
218
+ <show_in_default>1</show_in_default>
219
+ <show_in_website>1</show_in_website>
220
+ <show_in_store></show_in_store>
221
+ </ws_test_button>
222
  <ws_username_live translate="label">
223
  <label>Adyen ws username for Live</label>
224
  <comment>Normally this will be ws@Company.YourCompanyCode</comment>
238
  <show_in_website>1</show_in_website>
239
  <show_in_store>0</show_in_store>
240
  </ws_password_live>
241
+ <ws_live_button translate="label">
242
+ <label></label>
243
+ <button_label>Test Webserver Credentials for live</button_label>
244
+ <modus>live</modus>
245
+ <frontend_model>adyen/adminhtml_system_config_testWebserverConfiguration</frontend_model>
246
+ <sort_order>111</sort_order>
247
+ <show_in_default>1</show_in_default>
248
+ <show_in_website>1</show_in_website>
249
+ </ws_live_button>
250
+ <debug translate="label">
251
+ <label>Debug</label>
252
+ <frontend_type>select</frontend_type>
253
+ <source_model>adminhtml/system_config_source_yesno</source_model>
254
+ <sort_order>112</sort_order>
255
+ <show_in_default>1</show_in_default>
256
+ <show_in_website>1</show_in_website>
257
+ <show_in_store>0</show_in_store>
258
+ </debug>
259
  <auto_capture_openinvoice>
260
  <label>Auto capture Openinvoice(AfterPay/Klarna) payment methods</label>
261
  <comment>By default OpenInvoice is set to manual capture. If you want auto capture you need to contact magento@adyen.com so we can set this up for your account and then you can set this option to yes</comment>
276
  <show_in_website>1</show_in_website>
277
  <show_in_store>0</show_in_store>
278
  </paypal_capture_mode>
279
+ <pending_status>
280
+ <label>Pending order status</label>
281
+ <comment>By default pending notifications are not send. If you want these notifications to be received enable the BankTransfer Pending Notification and\or Direct-Debit Pending Notification in the Adyen Platform</comment>
282
+ <frontend_type>select</frontend_type>
283
+ <source_model>adyen/source_status_pending</source_model>
284
+ <sort_order>119</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>0</show_in_store>
288
+ </pending_status>
289
  <send_email_bank_sepa_on_pending>
290
  <label>Send confirmation email for Banktransfer/SEPA</label>
291
  <comment>Send a confirmation mail after banktranfer/SEPA is placed (not yet paid). Make sure that you have BankTransfer Pending Notification enabled in Adyen backoffice to do this contact magento@adyen.com</comment>
334
  <show_in_website>1</show_in_website>
335
  <show_in_store>0</show_in_store>
336
  </send_invoice_update_mail>
337
+ <title_renderer>
338
+ <label>Title renderer</label>
339
+ <frontend_type>select</frontend_type>
340
+ <source_model>adyen/source_rendermode</source_model>
341
+ <sort_order>220</sort_order>
342
+ <show_in_default>1</show_in_default>
343
+ <show_in_website>1</show_in_website>
344
+ <show_in_store>1</show_in_store>
345
+ </title_renderer>
346
+ <ignore_refund_notification>
347
+ <label>Ignore refund notification</label>
348
+ <comment>If the refund is done on the Adyen Platform it will send a refund notification to Magento that automatically create a credit memo. If you enable this setting this will not happen because it will not process any of the REFUND notification that is received.</comment>
349
+ <frontend_type>select</frontend_type>
350
+ <source_model>adminhtml/system_config_source_yesno</source_model>
351
+ <sort_order>230</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>1</show_in_website>
354
+ <show_in_store>1</show_in_store>
355
+ </ignore_refund_notification>
356
+ <update_notification_cronjob>
357
+ <label>Update notification queue by cronjob (every 5 minutes)</label>
358
+ <comment>If you using API methods(CC, SEPA, ELV or Boleto) and your magento order processing is slow it could be that the notificaiton is faster then magento saves the ordrer. The notification will then be saved in a queue. This is processed on default when next notification is received. If you want to update the notificaiton queue every 5 minutes activate this and make sure cronjob of magento is called by your webserver</comment>
359
+ <frontend_type>select</frontend_type>
360
+ <source_model>adminhtml/system_config_source_yesno</source_model>
361
+ <sort_order>240</sort_order>
362
+ <show_in_default>1</show_in_default>
363
+ <show_in_website>0</show_in_website>
364
+ <show_in_store>0</show_in_store>
365
+ </update_notification_cronjob>
366
+ <fraud_manual_review_status>
367
+ <label>Manual Review Status</label>
368
+ <comment>If you are using Manual Review and a payment match your case set here the status it should have in magento. It will then move to processing when you approve the payment on Adyen platform. If you don't have this or don't want a seperate status please keep it on -- Please Select --</comment>
369
+ <frontend_type>select</frontend_type>
370
+ <source_model>adyen/source_status_pending</source_model>
371
+ <sort_order>250</sort_order>
372
+ <show_in_default>1</show_in_default>
373
+ <show_in_website>1</show_in_website>
374
+ <show_in_store>0</show_in_store>
375
+ </fraud_manual_review_status>
376
  </fields>
377
  </adyen_abstract>
378
  <!-- @Hpp only -->
453
  <source_model>adminhtml/system_config_source_yesno</source_model>
454
  <sort_order>90</sort_order>
455
  <show_in_default>1</show_in_default>
456
+ <show_in_website>1</show_in_website>
457
+ <show_in_store>1</show_in_store>
458
  </disable_hpptypes>
459
  <payment_routines translate="label">
460
  <label>Payment Flow Selection</label>
464
  <sort_order>95</sort_order>
465
  <show_in_default>1</show_in_default>
466
  <show_in_website>1</show_in_website>
467
+ <show_in_store>1</show_in_store>
468
  <depends><disable_hpptypes>1</disable_hpptypes></depends>
469
  </payment_routines>
470
  <cache_directory_lookup>
488
  <show_in_website>1</show_in_website>
489
  <show_in_store>1</show_in_store>
490
  </return_url_in_request>
491
+ <allowspecific translate="label">
492
+ <label>Payment to applicable countries</label>
493
+ <frontend_type>allowspecific</frontend_type>
494
+ <sort_order>120</sort_order>
495
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
496
+ <show_in_default>1</show_in_default>
497
+ <show_in_website>1</show_in_website>
498
+ <show_in_store>1</show_in_store>
499
+ </allowspecific>
500
+ <specificcountry translate="label">
501
+ <label>Payment to Specific countries</label>
502
+ <frontend_type>multiselect</frontend_type>
503
+ <sort_order>130</sort_order>
504
+ <source_model>adminhtml/system_config_source_country</source_model>
505
+ <show_in_default>1</show_in_default>
506
+ <show_in_website>1</show_in_website>
507
+ <show_in_store>1</show_in_store>
508
+ <depends><allowspecific>1</allowspecific></depends>
509
+ </specificcountry>
510
+ </fields>
511
+ </adyen_hpp>
512
+ <adyen_ideal translate="label" module="adyen">
513
+ <label>Adyen iDEAL</label>
514
+ <frontend_type>text</frontend_type>
515
+ <sort_order>315</sort_order>
516
+ <show_in_default>1</show_in_default>
517
+ <show_in_website>1</show_in_website>
518
+ <show_in_store>1</show_in_store>
519
+ <fields>
520
+ <active translate="label">
521
+ <label>Enabled</label>
522
+ <frontend_type>select</frontend_type>
523
+ <source_model>adminhtml/system_config_source_yesno</source_model>
524
+ <sort_order>10</sort_order>
525
+ <show_in_default>1</show_in_default>
526
+ <show_in_website>1</show_in_website>
527
+ <show_in_store>1</show_in_store>
528
+ </active>
529
+ <title translate="label">
530
+ <label>Title</label>
531
+ <frontend_type>text</frontend_type>
532
+ <sort_order>20</sort_order>
533
+ <show_in_default>1</show_in_default>
534
+ <show_in_website>1</show_in_website>
535
+ <show_in_store>1</show_in_store>
536
+ </title>
537
  <show_ideal_logos>
538
+ <label>Show iDEAL bank logos</label>
539
+ <comment>Show iDEAL bank logos (radio buttons) instead of dropdown</comment>
540
  <frontend_type>select</frontend_type>
541
  <source_model>adminhtml/system_config_source_yesno</source_model>
542
+ <sort_order>30</sort_order>
543
  <show_in_default>1</show_in_default>
544
  <show_in_website>1</show_in_website>
545
  <show_in_store>1</show_in_store>
546
  </show_ideal_logos>
547
+ <sort_order translate="label">
548
+ <label>Sort Order</label>
549
+ <frontend_type>text</frontend_type>
550
+ <sort_order>40</sort_order>
551
+ <show_in_default>1</show_in_default>
552
+ <show_in_website>1</show_in_website>
553
+ <show_in_store>0</show_in_store>
554
+ </sort_order>
555
  <allowspecific translate="label">
556
  <label>Payment to applicable countries</label>
557
  <frontend_type>allowspecific</frontend_type>
558
+ <sort_order>49</sort_order>
559
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
560
  <show_in_default>1</show_in_default>
561
  <show_in_website>1</show_in_website>
564
  <specificcountry translate="label">
565
  <label>Payment to Specific countries</label>
566
  <frontend_type>multiselect</frontend_type>
567
+ <sort_order>50</sort_order>
568
  <source_model>adminhtml/system_config_source_country</source_model>
569
  <show_in_default>1</show_in_default>
570
  <show_in_website>1</show_in_website>
572
  <depends><allowspecific>1</allowspecific></depends>
573
  </specificcountry>
574
  </fields>
575
+ </adyen_ideal>
576
  <!-- @Pos only -->
577
  <adyen_pos translate="label" module="adyen">
578
  <label>Adyen POS</label>
617
  <show_in_website>1</show_in_website>
618
  <show_in_store>1</show_in_store>
619
  </recurringtypes>
620
+ <add_receipt_order_lines translate="label">
621
+ <label>Add orderlines to receipt</label>
622
+ <comment>If you have the Adyen App configured to print to an external printer the orderlines can be printed on to the receipt if you turn this option on.</comment>
623
+ <frontend_type>select</frontend_type>
624
+ <source_model>adminhtml/system_config_source_yesno</source_model>
625
+ <sort_order>33</sort_order>
626
+ <show_in_default>1</show_in_default>
627
+ <show_in_website>1</show_in_website>
628
+ <show_in_store>1</show_in_store>
629
+ </add_receipt_order_lines>
630
  <enable_scanner translate="label">
631
  <label>Enable Scanner</label>
632
  <comment>If you enable this you have the possiblity to scan products with a hand scanner on the shopping cart page and this will automatically add products to the shopping cart based on the same SKU name</comment>
658
  <show_in_website>1</show_in_website>
659
  <show_in_store>1</show_in_store>
660
  </express_checkout>
661
+ <express_checkout_redirect_connect>
662
+ <label>Redirect direct</label>
663
+ <comment>Redirect directly to the Adyen app to do the PIN payment. This is not supported for all browsers if you have problems set this setting to false</comment>
664
+ <frontend_type>select</frontend_type>
665
+ <source_model>adminhtml/system_config_source_yesno</source_model>
666
+ <sort_order>38</sort_order>
667
+ <show_in_default>1</show_in_default>
668
+ <show_in_website>1</show_in_website>
669
+ <show_in_store>1</show_in_store>
670
+ <depends><express_checkout>1</express_checkout></depends>
671
+ </express_checkout_redirect_connect>
672
+ <express_checkout_kiosk_mode>
673
+ <label>Kiosk mode</label>
674
+ <comment>If you turn kiosk modus on it will not autocomplete the customers based on the filled in email address</comment>
675
+ <frontend_type>select</frontend_type>
676
+ <source_model>adminhtml/system_config_source_yesno</source_model>
677
+ <sort_order>45</sort_order>
678
+ <show_in_default>1</show_in_default>
679
+ <show_in_website>1</show_in_website>
680
+ <show_in_store>1</show_in_store>
681
+ </express_checkout_kiosk_mode>
682
+ <express_checkout_recurring>
683
+ <label>Show Recurring Cards</label>
684
+ <comment>This will show the recurring cards beneath the express checkout and makes it possible to do a recurring online payment by clicking on the card</comment>
685
+ <frontend_type>select</frontend_type>
686
+ <source_model>adminhtml/system_config_source_yesno</source_model>
687
+ <sort_order>50</sort_order>
688
+ <show_in_default>1</show_in_default>
689
+ <show_in_website>1</show_in_website>
690
+ <show_in_store>1</show_in_store>
691
+ <depends><express_checkout_kiosk_mode>0</express_checkout_kiosk_mode></depends>
692
+ </express_checkout_recurring>
693
  <create_shipment>
694
  <label>Create Shipment</label>
695
  <comment>If you enable this there will be automatically be created a shipment if the invoice is created</comment>
696
  <frontend_type>select</frontend_type>
697
  <source_model>adminhtml/system_config_source_yesno</source_model>
698
+ <sort_order>55</sort_order>
699
  <show_in_default>1</show_in_default>
700
  <show_in_website>1</show_in_website>
701
  <show_in_store>1</show_in_store>
702
  </create_shipment>
703
+ <allowspecific translate="label">
704
+ <label>Payment to applicable countries</label>
705
+ <frontend_type>allowspecific</frontend_type>
706
+ <sort_order>60</sort_order>
707
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
708
+ <show_in_default>1</show_in_default>
709
+ <show_in_website>1</show_in_website>
710
+ <show_in_store>1</show_in_store>
711
+ </allowspecific>
712
+ <specificcountry translate="label">
713
+ <label>Payment to Specific countries</label>
714
+ <frontend_type>multiselect</frontend_type>
715
+ <sort_order>70</sort_order>
716
+ <source_model>adminhtml/system_config_source_country</source_model>
717
+ <show_in_default>1</show_in_default>
718
+ <show_in_website>1</show_in_website>
719
+ <show_in_store>1</show_in_store>
720
+ <depends><allowspecific>1</allowspecific></depends>
721
+ </specificcountry>
722
+ </fields>
723
+ </adyen_pos>
724
+ <adyen_cash translate="label" module="adyen">
725
+ <label>Adyen CASH</label>
726
+ <frontend_type>text</frontend_type>
727
+ <sort_order>325</sort_order>
728
+ <show_in_default>1</show_in_default>
729
+ <show_in_website>1</show_in_website>
730
+ <show_in_store>1</show_in_store>
731
+ <fields>
732
+ <active translate="label">
733
+ <label>Enabled</label>
734
+ <frontend_type>select</frontend_type>
735
+ <source_model>adminhtml/system_config_source_yesno</source_model>
736
+ <sort_order>10</sort_order>
737
+ <show_in_default>1</show_in_default>
738
+ <show_in_website>1</show_in_website>
739
+ <show_in_store>1</show_in_store>
740
+ </active>
741
+ <title translate="label">
742
+ <label>Title</label>
743
+ <frontend_type>text</frontend_type>
744
+ <sort_order>20</sort_order>
745
+ <show_in_default>1</show_in_default>
746
+ <show_in_website>1</show_in_website>
747
+ <show_in_store>1</show_in_store>
748
+ </title>
749
+ <sort_order translate="label">
750
+ <label>Sort Order</label>
751
+ <frontend_type>text</frontend_type>
752
+ <sort_order>30</sort_order>
753
+ <show_in_default>1</show_in_default>
754
+ <show_in_website>1</show_in_website>
755
+ <show_in_store>0</show_in_store>
756
+ </sort_order>
757
  <cash_express_checkout>
758
  <label>Cash Express checkout</label>
759
  <comment>This will show a checkout buttton on the shopping cart to directly do a Cash payment without going to the checkout steps. Make sure that you have Cash enabled on your skin and HPP payment method is enabled and correctly configured. You must be logged into your magento account on the front-end to see the button</comment>
773
  <show_in_default>1</show_in_default>
774
  <show_in_website>1</show_in_website>
775
  <show_in_store>1</show_in_store>
 
776
  </cash_drawer>
777
  <cash_drawer_printer_ip>
778
  <label>IP address printer</label>
834
  <show_in_store>1</show_in_store>
835
  <depends><ip_filter>1</ip_filter></depends>
836
  </ip_filter_to>
837
+ <visible_type>
838
+ <label>Visible in:</label>
839
+ <frontend_type>select</frontend_type>
840
+ <source_model>adyen/source_VisibleType</source_model>
841
+ <sort_order>80</sort_order>
842
+ <comment>Where do you want to show this payment method in the backend of magento or in the frontend for the shoppers</comment>
843
+ <show_in_default>1</show_in_default>
844
+ <show_in_website>1</show_in_website>
845
+ <show_in_store>1</show_in_store>
846
+ </visible_type>
847
  <allowspecific translate="label">
848
  <label>Payment to applicable countries</label>
849
  <frontend_type>allowspecific</frontend_type>
850
+ <sort_order>90</sort_order>
851
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
852
  <show_in_default>1</show_in_default>
853
  <show_in_website>1</show_in_website>
856
  <specificcountry translate="label">
857
  <label>Payment to Specific countries</label>
858
  <frontend_type>multiselect</frontend_type>
859
+ <sort_order>100</sort_order>
860
  <source_model>adminhtml/system_config_source_country</source_model>
861
  <show_in_default>1</show_in_default>
862
  <show_in_website>1</show_in_website>
864
  <depends><allowspecific>1</allowspecific></depends>
865
  </specificcountry>
866
  </fields>
867
+ </adyen_cash>
868
  <!-- @Openinvoice only -->
869
  <adyen_openinvoice translate="label" module="adyen">
870
  <label>Adyen OpenInvoice</label>
935
  <show_in_website>1</show_in_website>
936
  <show_in_store>1</show_in_store>
937
  </telephone_show>
938
+ <fee translate="label">
939
+ <label>Fee</label>
940
+ <frontend_type>text</frontend_type>
941
+ <sort_order>38</sort_order>
942
+ <show_in_default>1</show_in_default>
943
+ <show_in_website>1</show_in_website>
944
+ <show_in_store>1</show_in_store>
945
+ <validate>validate-number</validate>
946
+ </fee>
947
  <different_address_disable>
948
  <label>Disable on Different Address</label>
949
  <comment>If the delivery address and billing address in the checkout is not the same disable this payment method because Klarna will most likely reject it</comment>
950
  <frontend_type>select</frontend_type>
951
  <source_model>adminhtml/system_config_source_yesno</source_model>
952
+ <sort_order>39</sort_order>
953
  <show_in_default>1</show_in_default>
954
  <show_in_website>1</show_in_website>
955
  <show_in_store>1</show_in_store>
956
  </different_address_disable>
957
+ <failed_attempt_disable>
958
+ <label>Disable this payment method if first attempt is refused</label>
959
+ <comment>If the first attempt is refused don't show this as an payment option for the current quote</comment>
960
+ <frontend_type>select</frontend_type>
961
+ <source_model>adminhtml/system_config_source_yesno</source_model>
962
+ <sort_order>45</sort_order>
963
  <show_in_default>1</show_in_default>
964
  <show_in_website>1</show_in_website>
965
  <show_in_store>1</show_in_store>
966
+ </failed_attempt_disable>
 
967
  <allowspecific translate="label">
968
  <label>Payment to applicable countries</label>
969
  <frontend_type>allowspecific</frontend_type>
970
+ <sort_order>49</sort_order>
971
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
972
  <show_in_default>1</show_in_default>
973
  <show_in_website>1</show_in_website>
1487
  </visible_type>
1488
  </fields>
1489
  </adyen_sepa>
1490
+ <adyen_pay_by_mail translate="label" module="adyen">
1491
+ <label>Adyen Pay By Mail</label>
1492
+ <frontend_type>text</frontend_type>
1493
+ <sort_order>390</sort_order>
1494
+ <show_in_default>1</show_in_default>
1495
+ <show_in_website>1</show_in_website>
1496
+ <show_in_store>1</show_in_store>
1497
+ <fields>
1498
+ <active translate="label">
1499
+ <label>Enabled</label>
1500
+ <frontend_type>select</frontend_type>
1501
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1502
+ <sort_order>10</sort_order>
1503
+ <show_in_default>1</show_in_default>
1504
+ <show_in_website>1</show_in_website>
1505
+ <show_in_store>1</show_in_store>
1506
+ </active>
1507
+ <title translate="label">
1508
+ <label>Title</label>
1509
+ <frontend_type>text</frontend_type>
1510
+ <sort_order>20</sort_order>
1511
+ <show_in_default>1</show_in_default>
1512
+ <show_in_website>1</show_in_website>
1513
+ <show_in_store>1</show_in_store>
1514
+ </title>
1515
+ <sort_order translate="label">
1516
+ <label>Sort Order</label>
1517
+ <frontend_type>text</frontend_type>
1518
+ <sort_order>25</sort_order>
1519
+ <show_in_default>1</show_in_default>
1520
+ <show_in_website>1</show_in_website>
1521
+ <show_in_store>0</show_in_store>
1522
+ </sort_order>
1523
+ <session_validity>
1524
+ <label>Session Validity</label>
1525
+ <comment>How many days do you want this payment page to be active</comment>
1526
+ <frontend_type>text</frontend_type>
1527
+ <sort_order>30</sort_order>
1528
+ <show_in_default>1</show_in_default>
1529
+ <show_in_website>1</show_in_website>
1530
+ <show_in_store>1</show_in_store>
1531
+ </session_validity>
1532
+ <skin_code translate="label">
1533
+ <label>Skin Code</label>
1534
+ <comment>The skin code you want to use levae this empty if you want to use the same as Adyen HPP settings</comment>
1535
+ <frontend_type>text</frontend_type>
1536
+ <sort_order>40</sort_order>
1537
+ <show_in_default>1</show_in_default>
1538
+ <show_in_website>1</show_in_website>
1539
+ <show_in_store>1</show_in_store>
1540
+ </skin_code>
1541
+ <secret_wordt translate="label">
1542
+ <label>HMAC Key for Test</label>
1543
+ <comment>Should match with the HMAC test key in the Adyen backoffice. Fill this in if you are using a different skin then defined in Adyen HPP</comment>
1544
+ <frontend_type>text</frontend_type>
1545
+ <sort_order>50</sort_order>
1546
+ <show_in_default>1</show_in_default>
1547
+ <show_in_website>1</show_in_website>
1548
+ <show_in_store>1</show_in_store>
1549
+ </secret_wordt>
1550
+ <secret_wordp translate="label">
1551
+ <label>HMAC Key for Live</label>
1552
+ <comment>Should match with the HMAC live key in the Adyen backoffice. Fill this in if you are using a different skin then defined in Adyen HPP</comment>
1553
+ <frontend_type>text</frontend_type>
1554
+ <sort_order>60</sort_order>
1555
+ <show_in_default>1</show_in_default>
1556
+ <show_in_website>1</show_in_website>
1557
+ <show_in_store>1</show_in_store>
1558
+ </secret_wordp>
1559
+ <visible_type>
1560
+ <label>Visible in:</label>
1561
+ <frontend_type>select</frontend_type>
1562
+ <source_model>adyen/source_VisibleType</source_model>
1563
+ <sort_order>70</sort_order>
1564
+ <comment>Where do you want to show this payment method in the backend of magento or in the frontend for the shoppers</comment>
1565
+ <show_in_default>1</show_in_default>
1566
+ <show_in_website>1</show_in_website>
1567
+ <show_in_store>1</show_in_store>
1568
+ </visible_type>
1569
+ </fields>
1570
+ </adyen_pay_by_mail>
1571
  </groups>
1572
  </payment>
1573
  </sections>
app/code/community/Adyen/Payment/sql/adyen_setup/mysql4-upgrade-2.2.2-2.2.2.1.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ /**
21
+ * @category Payment Gateway
22
+ * @package Adyen_Payment
23
+ * @author Adyen
24
+ * @property Adyen B.V
25
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
+ */
27
+
28
+ /* @var $installer Adyen_Payment_Model_Mysql4_Setup */
29
+ $installer = $this;
30
+
31
+ $installer->startSetup();
32
+ $installer->addAttribute('order_payment', 'adyen_refusal_reason_raw', array());
33
+ $installer->addAttribute('order_payment', 'adyen_acquirer_reference', array());
34
+ $installer->addAttribute('order_payment', 'adyen_auth_code', array());
35
+ $installer->endSetup();
app/design/adminhtml/default/default/template/adyen/form/oneclick.phtml ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ /**
21
+ * @category Payment Gateway
22
+ * @package Adyen_Payment
23
+ * @author Adyen
24
+ * @property Adyen B.V
25
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
+ */
27
+ ?>
28
+ <?php $_code=$this->getMethodCode() ?>
29
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none;">
30
+ <li>
31
+ <?php
32
+ $recurringDetails = $this->getRecurringDetails();
33
+ if(isset($recurringDetails["variant"])):
34
+ ?>
35
+
36
+ <?php if(isset($recurringDetails["card_number"]) && isset($recurringDetails["card_expiryMonth"]) && isset($recurringDetails["card_expiryYear"]) ): ?>
37
+ <div class="columns three a">
38
+ <label><?php echo $this->__('Credit Card Number') ?></label>
39
+ <span>****</span> <?php echo $recurringDetails["card_number"]; ?>
40
+ </div>
41
+
42
+ <div class="columns three b">
43
+ <label><?php echo $this->__('Expiration Date') ?><a href="#" id="update-expiration-date-<?php echo $_code; ?>" class="update-expiration-date"><?php echo $this->__('(update)') ?></a></label>
44
+
45
+ <div id="static-card-expiry-<?php echo $_code; ?>" class="static-card-expiry">
46
+ <?php echo $recurringDetails["card_expiryMonth"] . " /" . $recurringDetails["card_expiryYear"]; ?>
47
+ </div>
48
+ <div id="changable-card-expiry-<?php echo $_code; ?>" class="changable-card-expiry" style="display:none;">
49
+ <select id="<?php echo $_code ?>_expiration_<?php echo $_code; ?>" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_exp_month]\"" : "data-encrypted-name-oneclick-" . $_code . "=expiryMonth"); ?> class="month validate-oneclick-exp required-entry">
50
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
51
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$recurringDetails["card_expiryMonth"]): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
52
+ <?php endforeach ?>
53
+ </select>
54
+
55
+ <select id="<?php echo $_code ?>_expiration_yr_<?php echo $_code; ?>" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_exp_year]\"" : "data-encrypted-name-oneclick-" . $_code . "=expiryYear"); ?> class="year required-entry">
56
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
57
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$recurringDetails["card_expiryYear"]): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
58
+ <?php endforeach ?>
59
+ </select>
60
+ </div>
61
+ </div>
62
+
63
+ <?php if($this->isNotRecurring()): ?>
64
+ <div class="columns three c">
65
+ <label><?php echo $this->__('Card Verification Number') ?></label>
66
+ <?php if($this->hasVerification()): ?>
67
+ <div class="cvc_block" id="cvc_block_<?php echo $_code;?>">
68
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry" id="<?php echo $_code ?>_cc_cid" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_cid_".$_code."]\"" : "data-encrypted-name-oneclick-" . $_code ."=cvc"); ?> value="" />
69
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
70
+ </div>
71
+ <?php endif; ?>
72
+ </div>
73
+ <?php endif; ?>
74
+
75
+ <?php if($this->hasInstallments()): ?>
76
+ <div id="adyen_oneclick_installment_<?php echo $_code;?>" class="adyen-oneclick-installments">
77
+ <label for="<?php echo $_code ?>_installment_<?php echo $_code; ?>" class="required"><em>*</em><?php echo $this->__('Installments') ?></label>
78
+ <div class="input-box">
79
+ <div class="v-fix">
80
+ <select id="<?php echo $_code ?>_installment" name="payment[installment]" class="adyen-installment number required-entry">
81
+ <?php foreach ($this->getInstallments() as $k=>$v): ?>
82
+ <option value="<?php echo $k?$k:'' ?>"><?php echo $v ?></option>
83
+ <?php endforeach ?>
84
+ </select>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ <?php endif;?>
89
+
90
+ <?php if ($this->isCseEnabled()): ?>
91
+ <input type="hidden" id="<?php echo $_code ?>_encrypted_form_expiry_generationtime" value="<?php echo date("c"); ?>" data-encrypted-name-oneclick-<?php echo $_code ?>="generationtime" />
92
+ <script type="text/javascript">
93
+
94
+ // update-expiration-date action
95
+ $$('.update-expiration-date').each(function(element) {
96
+ element.observe('click', updateExpirationDate);
97
+ });
98
+ // show the expiration month and year
99
+ function updateExpirationDate(event) {
100
+ // hide the link
101
+ this.hide();
102
+ // show expiration month and year
103
+ var id = this.id.replace("update-expiration-date-", "");
104
+ var changableId = "changable-card-expiry-" + id;
105
+ var staticId = "static-card-expiry-" + id;
106
+ // show changeble card expiry
107
+ $(staticId).hide();
108
+ $(changableId).show();
109
+ event.preventDefault();
110
+ }
111
+
112
+ var cse_key_oneclick = <?php echo json_encode($this->getCsePublicKey()); ?>;
113
+ var cse_options_oneclick = {
114
+ name: 'payment[encrypted_data_oneclick]',
115
+ force: true
116
+ };
117
+
118
+ var cseUpdateOneClick = function() {
119
+
120
+ try {
121
+ if (order.paymentMethod && order.paymentMethod == '<?php echo $_code ?>') {
122
+ var cse_form_oneclick = $('payment_form_<?php echo $_code ?>');
123
+ cse_options_oneclick.dataEncryptedName = "data-encrypted-name-oneclick-<?php echo $_code ?>";
124
+ adyen.encrypt.createEncryptedForm(cse_form_oneclick, cse_key_oneclick, cse_options_oneclick);
125
+ }
126
+ } catch (e) {
127
+ if (typeof console == "object") {
128
+ console.error(e);
129
+ } else {
130
+ alert("Warning: Adyen Client Side Encryption cannot succeed.");
131
+ }
132
+ }
133
+
134
+ };
135
+
136
+ var cseInitOneClick = function() {
137
+ if (typeof adyen === 'undefined') {
138
+ var script = document.createElement("script");
139
+ script.type = "text/javascript";
140
+ script.src = "<?php echo $this->getJsUrl('adyen/payment/adyen.encrypt.js'); ?>";
141
+ document.body.appendChild(script);
142
+ }
143
+
144
+ var fields = $$('#payment_form_<?php echo $_code ?> input, #payment_form_<?php echo $_code ?> textarea, #payment_form_<?php echo $_code ?> select');
145
+ fields.forEach(function(field) {
146
+ field.observe('change', cseUpdateOneClick);
147
+ });
148
+ };
149
+
150
+ cseInitOneClick();
151
+ </script>
152
+ <?php endif;?>
153
+
154
+ <?php elseif($recurringDetails["variant"] == "elv"): ?>
155
+ <div class="columns three a">
156
+ <label><?php echo $this->__('Account holder name') ?></label>
157
+ <span><?php echo $recurringDetails["elv_accountHolderName"]; ?></span>
158
+ </div>
159
+ <div class="columns three b">
160
+ <label><?php echo $this->__('Account Number') ?></label>
161
+ <span><?php echo $recurringDetails["elv_bankAccountNumber"]; ?></span>
162
+ </div>
163
+ <div class="columns three c">
164
+ <label><?php echo $this->__('Bank Name') ?></label>
165
+ <span><?php echo $recurringDetails["elv_bankName"]; ?></span>
166
+ </div>
167
+ <?php elseif($recurringDetails["variant"] == "openinvoice"): ?>
168
+ <div class="columns three a">
169
+ <label><?php echo $this->__('Bank account holder name') ?></label>
170
+ <span><?php echo $recurringDetails["bank_ownerName"]; ?></span>
171
+ </div>
172
+ <div class="columns three b">
173
+ <label><?php echo $this->__('Bank Account Number') ?></label>
174
+ <span><?php echo $recurringDetails["bank_bankAccountNumber"]; ?></span>
175
+ </div>
176
+ <div class="columns three c">
177
+ <label><?php echo $this->__('Country') ?></label>
178
+ <span><?php echo $recurringDetails["bank_countryCode"]; ?></span>
179
+ </div>
180
+ <?php elseif($recurringDetails["variant"] == "sepadirectdebit" || $recurringDetails["variant"] == "ideal" ): ?>
181
+ <div class="columns three a">
182
+ <label><?php echo $this->__('Bank account holder name') ?></label>
183
+ <span><?php echo $recurringDetails["bank_ownerName"]; ?></span>
184
+ </div>
185
+ <div class="columns three b">
186
+ <label><?php echo $this->__('IBAN') ?></label>
187
+ <span><?php echo $recurringDetails["bank_iban"]; ?></span>
188
+ </div>
189
+ <div class="columns three c">
190
+ <label><?php echo $this->__('Country') ?></label>
191
+ <span><?php echo $recurringDetails["bank_countryCode"]; ?></span>
192
+ </div>
193
+ <?php endif;?>
194
+ <?php endif;?>
195
+ </li>
196
+ </ul>
app/design/adminhtml/default/default/template/adyen/form/sepa.phtml CHANGED
@@ -36,7 +36,7 @@ $_code=$this->getMethodCode();
36
  type="text" id="<?php echo $_code ?>_account_name" name="payment[account_name]"
37
  title="<?php echo $this->__('Bank account holder name') ?>"
38
  class="validate-ipayment-sepa-account-name required-entry input-text"
39
- value="" autocomplete="off"
40
  />
41
  </div>
42
  </li>
@@ -47,7 +47,7 @@ $_code=$this->getMethodCode();
47
  type="text" id="<?php echo $_code ?>_iban" name="payment[iban]"
48
  title="<?php echo $this->__('IBAN') ?>"
49
  class="validate-ipayment-sepa-iban required-entry input-text"
50
- value="" autocomplete="off"
51
  />
52
  </div>
53
  </li>
36
  type="text" id="<?php echo $_code ?>_account_name" name="payment[account_name]"
37
  title="<?php echo $this->__('Bank account holder name') ?>"
38
  class="validate-ipayment-sepa-account-name required-entry input-text"
39
+ autocomplete="off"
40
  />
41
  </div>
42
  </li>
47
  type="text" id="<?php echo $_code ?>_iban" name="payment[iban]"
48
  title="<?php echo $this->__('IBAN') ?>"
49
  class="validate-ipayment-sepa-iban required-entry input-text"
50
+ autocomplete="off"
51
  />
52
  </div>
53
  </li>
app/design/adminhtml/default/default/template/adyen/info/boleto.phtml CHANGED
@@ -36,11 +36,6 @@
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
39
- <?php $paymentMethod = $_info->getAdyenPaymentMethod() ?>
40
- <?php if (!empty($paymentMethod)): ?>
41
- <?php echo $this->__('Payment Method: %s', $this->htmlEscape($paymentMethod)) ?><br/>
42
- <?php endif; ?>
43
-
44
 
45
  <?php $boleto = unserialize($this->getInfo()->getPoNumber())?>
46
  <?php echo Mage::helper('adyen')->__('Social Security Number: %s', $this->htmlEscape($boleto['social_security_number'])) ?><br/>
@@ -50,4 +45,13 @@
50
  <?php if($_info->getAdyenBoletoPaidAmount() != null && $_info->getAdyenBoletoPaidAmount() != ""): ?>
51
  <?php echo Mage::helper('adyen')->__('Paid amount: %s', $this->htmlEscape($_info->getAdyenBoletoPaidAmount())) ?> <br/>
52
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
53
  <?php endif;?>
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
 
 
 
 
 
39
 
40
  <?php $boleto = unserialize($this->getInfo()->getPoNumber())?>
41
  <?php echo Mage::helper('adyen')->__('Social Security Number: %s', $this->htmlEscape($boleto['social_security_number'])) ?><br/>
45
  <?php if($_info->getAdyenBoletoPaidAmount() != null && $_info->getAdyenBoletoPaidAmount() != ""): ?>
46
  <?php echo Mage::helper('adyen')->__('Paid amount: %s', $this->htmlEscape($_info->getAdyenBoletoPaidAmount())) ?> <br/>
47
  <?php endif; ?>
48
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
49
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
50
+ <?php endif; ?>
51
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
52
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
53
+ <?php endif; ?>
54
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
55
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
56
+ <?php endif; ?>
57
  <?php endif;?>
app/design/adminhtml/default/default/template/adyen/info/cc.phtml CHANGED
@@ -43,10 +43,6 @@ echo ($cseEnabled ? " (with Client-Side Encryption)" : "");
43
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
44
  <?php endif; ?>
45
  <?php endif;?>
46
- <?php $paymentMethod = $_info->getAdyenPaymentMethod() ?>
47
- <?php if (!empty($paymentMethod)): ?>
48
- <?php echo $this->__('Payment Method: %s', $this->htmlEscape($paymentMethod)) ?><br/>
49
- <?php endif; ?>
50
  <?php if (!$cseEnabled): ?>
51
  <?php echo Mage::helper('adyen')->__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?><br/>
52
  <?php echo Mage::helper('adyen')->__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?><br/>
@@ -73,4 +69,13 @@ echo ($cseEnabled ? " (with Client-Side Encryption)" : "");
73
  <?php if($this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments')) != "" && $this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments')) > 1): ?>
74
  <?php echo Mage::helper('adyen')->__('Number of installments: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments'))) ?><br/>
75
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
76
  <?php endif;?>
43
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
44
  <?php endif; ?>
45
  <?php endif;?>
 
 
 
 
46
  <?php if (!$cseEnabled): ?>
47
  <?php echo Mage::helper('adyen')->__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?><br/>
48
  <?php echo Mage::helper('adyen')->__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?><br/>
69
  <?php if($this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments')) != "" && $this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments')) > 1): ?>
70
  <?php echo Mage::helper('adyen')->__('Number of installments: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments'))) ?><br/>
71
  <?php endif; ?>
72
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
73
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
74
+ <?php endif; ?>
75
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
76
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
77
+ <?php endif; ?>
78
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
79
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
80
+ <?php endif; ?>
81
  <?php endif;?>
app/design/adminhtml/default/default/template/adyen/info/elv.phtml CHANGED
@@ -36,15 +36,18 @@
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
39
- <?php $paymentMethod = $_info->getAdyenPaymentMethod() ?>
40
- <?php if (!empty($paymentMethod)): ?>
41
- <?php echo $this->__('Payment Method: %s', $this->htmlEscape($paymentMethod)) ?><br/>
42
- <?php endif; ?>
43
-
44
-
45
  <?php $elv = unserialize($this->getInfo()->getPoNumber())?>
46
  <?php echo Mage::helper('adyen')->__('Account holder: %s', $this->htmlEscape($elv['account_owner'])) ?><br/>
47
  <?php echo Mage::helper('adyen')->__('Bank name: %s', $this->htmlEscape($elv['bank_name'])) ?><br/>
48
  <?php echo Mage::helper('adyen')->__('Bank code: %s', $this->htmlEscape($elv['bank_location'])) ?><br/>
49
  <?php echo Mage::helper('adyen')->__('Account number: xxx%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br/>
 
 
 
 
 
 
 
 
 
50
  <?php endif;?>
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
 
 
 
 
 
 
39
  <?php $elv = unserialize($this->getInfo()->getPoNumber())?>
40
  <?php echo Mage::helper('adyen')->__('Account holder: %s', $this->htmlEscape($elv['account_owner'])) ?><br/>
41
  <?php echo Mage::helper('adyen')->__('Bank name: %s', $this->htmlEscape($elv['bank_name'])) ?><br/>
42
  <?php echo Mage::helper('adyen')->__('Bank code: %s', $this->htmlEscape($elv['bank_location'])) ?><br/>
43
  <?php echo Mage::helper('adyen')->__('Account number: xxx%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br/>
44
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
45
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
46
+ <?php endif; ?>
47
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
48
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
49
+ <?php endif; ?>
50
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
51
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
52
+ <?php endif; ?>
53
  <?php endif;?>
app/design/adminhtml/default/default/template/adyen/info/hpp.phtml CHANGED
@@ -53,4 +53,13 @@
53
  <?php if($_info->getAdyenKlarnaNumber() != null && $_info->getAdyenKlarnaNumber() != ""): ?>
54
  <?php echo Mage::helper('adyen')->__('Klarna reservation number: %s', $this->htmlEscape($_info->getAdyenKlarnaNumber())) ?> <br/>
55
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
56
  <?php endif; ?>
53
  <?php if($_info->getAdyenKlarnaNumber() != null && $_info->getAdyenKlarnaNumber() != ""): ?>
54
  <?php echo Mage::helper('adyen')->__('Klarna reservation number: %s', $this->htmlEscape($_info->getAdyenKlarnaNumber())) ?> <br/>
55
  <?php endif; ?>
56
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
57
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
58
+ <?php endif; ?>
59
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
60
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
61
+ <?php endif; ?>
62
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
63
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
64
+ <?php endif; ?>
65
  <?php endif; ?>
app/design/adminhtml/default/default/template/adyen/info/openinvoice.phtml CHANGED
@@ -40,9 +40,13 @@
40
  <?php if($_info->getAdyenKlarnaNumber() != null && $_info->getAdyenKlarnaNumber() != ""): ?>
41
  <?php echo Mage::helper('adyen')->__('Klarna reservation number: %s', $this->htmlEscape($_info->getAdyenKlarnaNumber())) ?> <br/>
42
  <?php endif; ?>
43
-
44
- <?php $paymentMethod = $_info->getAdyenPaymentMethod() ?>
45
- <?php if (!empty($paymentMethod)): ?>
46
- <?php echo $this->__('Payment Method: %s', $this->htmlEscape($paymentMethod)) ?><br/>
 
 
 
 
47
  <?php endif; ?>
48
  <?php endif; ?>
40
  <?php if($_info->getAdyenKlarnaNumber() != null && $_info->getAdyenKlarnaNumber() != ""): ?>
41
  <?php echo Mage::helper('adyen')->__('Klarna reservation number: %s', $this->htmlEscape($_info->getAdyenKlarnaNumber())) ?> <br/>
42
  <?php endif; ?>
43
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
44
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
45
+ <?php endif; ?>
46
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
47
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
48
+ <?php endif; ?>
49
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
50
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
51
  <?php endif; ?>
52
  <?php endif; ?>
app/design/adminhtml/default/default/template/adyen/info/pay_by_mail.phtml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ /**
21
+ * @category Payment Gateway
22
+ * @package Adyen_Payment
23
+ * @author Adyen
24
+ * @property Adyen B.V
25
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
+ */
27
+ ?>
28
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?><br/>
29
+ <a target="_blank" href="<?php echo $this->getMethod()->getInfoInstance()->getAdditionalInformation('payment_url'); ?>">Payment Link</a><br />
30
+
31
+ <?php if ($_info = $this->getInfo()): ?>
32
+ <?php if ($_info->getAdyenPspReference() == ''): ?>
33
+ <?php echo Mage::helper('adyen')->__('Payment has not been processed yet.') ?> <br/>
34
+ <?php else :?>
35
+ <?php if($this->getMethod()->getConfigDataDemoMode()): ?>
36
+ <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-test.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
+ <?php else : ?>
38
+ <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
39
+ <?php endif; ?>
40
+ <?php endif;?>
41
+ <?php $paymentMethod = $_info->getCcType() ?>
42
+ <?php if (!empty($paymentMethod)): ?>
43
+ <?php echo $this->__('Payment Method: %s', $this->htmlEscape($paymentMethod)) ?><br/>
44
+ <?php endif; ?>
45
+ <?php if (strpos($_info->getCcType(), "ideal") !== false): ?>
46
+ <?php $bankData = $_info->getPoNumber(); ?>
47
+ <?php if (!empty($bankData)) : ?>
48
+ <?php
49
+ $id = explode(DS, $bankData);
50
+ $label = $id['1'];
51
+ ?>
52
+ <?php echo $this->__('Bank: %s', $this->htmlEscape($label)) ?><br/>
53
+ <?php endif; ?>
54
+ <?php endif; ?>
55
+ <?php if($_info->getAdyenKlarnaNumber() != null && $_info->getAdyenKlarnaNumber() != ""): ?>
56
+ <?php echo Mage::helper('adyen')->__('Klarna reservation number: %s', $this->htmlEscape($_info->getAdyenKlarnaNumber())) ?> <br/>
57
+ <?php endif; ?>
58
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
59
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
60
+ <?php endif; ?>
61
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
62
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
63
+ <?php endif; ?>
64
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
65
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
66
+ <?php endif; ?>
67
+ <?php endif; ?>
68
+
app/design/adminhtml/default/default/template/adyen/info/pos.phtml CHANGED
@@ -36,8 +36,13 @@
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
39
- <?php $paymentMethod = $_info->getAdyenPaymentMethod() ?>
40
- <?php if (!empty($paymentMethod)): ?>
41
- <?php echo $this->__('Payment Method: %s', $this->htmlEscape($paymentMethod)) ?><br/>
42
- <?php endif; ?>
 
 
 
 
 
43
  <?php endif; ?>
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
39
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
40
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
41
+ <?php endif; ?>
42
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
43
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
44
+ <?php endif; ?>
45
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
46
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
47
+ <?php endif; ?>
48
  <?php endif; ?>
app/design/adminhtml/default/default/template/adyen/info/sepa.phtml CHANGED
@@ -36,14 +36,17 @@
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
39
- <?php $paymentMethod = $_info->getAdyenPaymentMethod() ?>
40
- <?php if (!empty($paymentMethod)): ?>
41
- <?php echo $this->__('Payment Method: %s', $this->htmlEscape($paymentMethod)) ?><br/>
42
- <?php endif; ?>
43
-
44
-
45
  <?php $elv = unserialize($this->getInfo()->getPoNumber())?>
46
  <?php echo Mage::helper('adyen')->__('Account holder: %s', $this->htmlEscape($elv['account_name'])) ?><br/>
47
  <?php echo Mage::helper('adyen')->__('IBAN: %s', $this->htmlEscape($elv['iban'])) ?><br/>
48
  <?php echo Mage::helper('adyen')->__('Country: %s', $this->htmlEscape($elv['country'])) ?><br/>
 
 
 
 
 
 
 
 
 
49
  <?php endif;?>
36
  <?php echo Mage::helper('adyen')->__('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%s&txType=Payment" target="__blank">%s</a>', $this->htmlEscape($_info->getAdyenPspReference()), $this->htmlEscape($_info->getAdyenPspReference())) ?> <br/>
37
  <?php endif; ?>
38
  <?php endif;?>
 
 
 
 
 
 
39
  <?php $elv = unserialize($this->getInfo()->getPoNumber())?>
40
  <?php echo Mage::helper('adyen')->__('Account holder: %s', $this->htmlEscape($elv['account_name'])) ?><br/>
41
  <?php echo Mage::helper('adyen')->__('IBAN: %s', $this->htmlEscape($elv['iban'])) ?><br/>
42
  <?php echo Mage::helper('adyen')->__('Country: %s', $this->htmlEscape($elv['country'])) ?><br/>
43
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw()) != ""): ?>
44
+ <?php echo Mage::helper('adyen')->__('Raw acquirer response: %s', $this->htmlEscape($this->getInfo()->getAdyenRefusalReasonRaw())) ?><br/>
45
+ <?php endif; ?>
46
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAuthCode()) != ""): ?>
47
+ <?php echo Mage::helper('adyen')->__('Authorisation code: %s', $this->htmlEscape($this->getInfo()->getAdyenAuthCode())) ?><br/>
48
+ <?php endif; ?>
49
+ <?php if($this->htmlEscape($this->getInfo()->getAdyenAcquirerReference()) != ""): ?>
50
+ <?php echo Mage::helper('adyen')->__('Acquirer reference: %s', $this->htmlEscape($this->getInfo()->getAdyenAcquirerReference())) ?><br/>
51
+ <?php endif; ?>
52
  <?php endif;?>
app/design/adminhtml/default/default/template/adyen/pdf/cc.phtml CHANGED
@@ -26,4 +26,8 @@
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
  ?>
29
- <?php echo $this->getMethod()->getTitle() ?>
 
 
 
 
26
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
  */
28
  ?>
29
+ <?php echo $this->getMethod()->getTitle() ?>
30
+ <?php if($this->hasInstallments()):?>
31
+ {{pdf_row_separator}}
32
+ <?php echo $this->__('Installments: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments')))."<br/>";
33
+ endif;?>
app/design/adminhtml/default/default/template/adyen/system/config/test_webserver_configuration.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ ?>
29
+ <?php
30
+ /**
31
+ * @see Adyen_Payment_Block_Adminhtml_System_Config_testWebserverConfiguration
32
+ */
33
+ ?>
34
+ <div class="pp-buttons-container">
35
+ <button id="validate-webserver-configuration-<?php echo $this->getModus(); ?>">
36
+ <span><span><span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span></span></span>
37
+ </button>
38
+ </div>
39
+
40
+ <script type="text/javascript">
41
+ //<![CDATA[
42
+ $('validate-webserver-configuration-<?php echo $this->getModus(); ?>').observe('click', function(event) {
43
+
44
+ var baseUrl = "<?php echo $this->getUrlWebserverValidation(); ?>";
45
+
46
+ if('<?php echo $this->getModus(); ?>' == 'test') {
47
+ var username = $('payment_adyen_abstract_ws_username_test').value;
48
+ var password = $('payment_adyen_abstract_ws_password_test').value;
49
+ } else {
50
+ var username = $('payment_adyen_abstract_ws_username_live').value;
51
+ var password = $('payment_adyen_abstract_ws_password_live').value;
52
+ }
53
+
54
+ var request = new Ajax.Request(baseUrl, {
55
+ method: 'POST',
56
+ parameters: {username: username, password: password, modus: '<?php echo $this->getModus(); ?>'},
57
+ timeout: 2000,
58
+ onSuccess: function(response) { if (response.responseText) { alert("<?php echo Mage::helper('adminhtml')->__('successful'); ?>") } else { alert("<?php echo Mage::helper('adminhtml')->__('failed'); ?>") } }
59
+ });
60
+
61
+ event.preventDefault();
62
+ });
63
+ //]]>
64
+ </script>
app/design/frontend/base/default/layout/adyen.xml CHANGED
@@ -52,6 +52,9 @@
52
  </adyen_updatecart_index>
53
 
54
  <checkout_cart_index>
 
 
 
55
  <reference name="top.container">
56
  <block type="adyen/scanProduct" name="adyen.scanProduct" template="adyen/scan_product.phtml"/>
57
  </reference>
@@ -65,7 +68,9 @@
65
  <action method="addJs"><script>adyen/payment/cc.js</script></action>
66
  <action method="addJs"><script>adyen/payment/elv.js</script></action>
67
  <action method="addCss"><stylesheet>css/adyenstyle.css</stylesheet></action>
68
- <block type="core/text" name="adyen.diners.validation">
 
 
69
  <action method="setText">
70
  <text>
71
  <![CDATA[<script type="text/javascript">
@@ -73,6 +78,7 @@
73
  Validation.creditCartTypes.set('CB', [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true]);
74
  Validation.creditCartTypes.set('ELO', [new RegExp(/^((((636368)|(438935)|(504175)|(451416)|(636297)|(506699))\d{0,10})|((5067)|(4576)|(4011))\d{0,12})$/), new RegExp('^[0-9]{3}$'), true]);
75
  Validation.creditCartTypes.set('hipercard', [new RegExp(/^(606282\d{10}(\d{3})?)|(3841\d{15})$/), new RegExp('^[0-9]{3}$'), true]);
 
76
  </script>]]>
77
  </text>
78
  </action>
@@ -80,18 +86,14 @@
80
  </reference>
81
  </checkout_onepage_index>
82
 
83
- <checkout_onepage_paymentmethod>
84
- <reference name="root">
85
- <action method="setTemplate"><template>adyen/checkout/onepage/payment/methods.phtml</template></action>
86
- </reference>
87
- </checkout_onepage_paymentmethod>
88
-
89
  <onestepcheckout_index_index>
90
  <reference name="head">
91
  <action method="addJs"><script>adyen/payment/cc.js</script></action>
92
  <action method="addJs"><script>adyen/payment/elv.js</script></action>
93
  <action method="addCss"><stylesheet>css/adyenstyle.css</stylesheet></action>
94
- <block type="core/text" name="adyen.diners.validation">
 
 
95
  <action method="setText">
96
  <text>
97
  <![CDATA[<script type="text/javascript">
52
  </adyen_updatecart_index>
53
 
54
  <checkout_cart_index>
55
+ <reference name="head">
56
+ <action method="addCss"><stylesheet>css/adyenstyle.css</stylesheet></action>
57
+ </reference>
58
  <reference name="top.container">
59
  <block type="adyen/scanProduct" name="adyen.scanProduct" template="adyen/scan_product.phtml"/>
60
  </reference>
68
  <action method="addJs"><script>adyen/payment/cc.js</script></action>
69
  <action method="addJs"><script>adyen/payment/elv.js</script></action>
70
  <action method="addCss"><stylesheet>css/adyenstyle.css</stylesheet></action>
71
+ </reference>
72
+ <reference name="after_body_start">
73
+ <block type="core/text" name="adyen.diners.validation" after="-">
74
  <action method="setText">
75
  <text>
76
  <![CDATA[<script type="text/javascript">
78
  Validation.creditCartTypes.set('CB', [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true]);
79
  Validation.creditCartTypes.set('ELO', [new RegExp(/^((((636368)|(438935)|(504175)|(451416)|(636297)|(506699))\d{0,10})|((5067)|(4576)|(4011))\d{0,12})$/), new RegExp('^[0-9]{3}$'), true]);
80
  Validation.creditCartTypes.set('hipercard', [new RegExp(/^(606282\d{10}(\d{3})?)|(3841\d{15})$/), new RegExp('^[0-9]{3}$'), true]);
81
+ Validation.creditCartTypes.set('unionpay', [new RegExp('^62[0-5]\d{13,16}$', new RegExp('^[0-9]{3}$'), true]);
82
  </script>]]>
83
  </text>
84
  </action>
86
  </reference>
87
  </checkout_onepage_index>
88
 
 
 
 
 
 
 
89
  <onestepcheckout_index_index>
90
  <reference name="head">
91
  <action method="addJs"><script>adyen/payment/cc.js</script></action>
92
  <action method="addJs"><script>adyen/payment/elv.js</script></action>
93
  <action method="addCss"><stylesheet>css/adyenstyle.css</stylesheet></action>
94
+ </reference>
95
+ <reference name="after_body_start">
96
+ <block type="core/text" name="adyen.diners.validation" after="-">
97
  <action method="setText">
98
  <text>
99
  <![CDATA[<script type="text/javascript">
app/design/frontend/base/default/template/adyen/checkout/onepage/payment/methods.phtml DELETED
@@ -1,173 +0,0 @@
1
- <?php
2
- /**
3
- * Adyen Payment Module
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Adyen
16
- * @package Adyen_Payment
17
- * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- /**
21
- * @category Payment Gateway
22
- * @package Adyen_Payment
23
- * @author Adyen
24
- * @property Adyen B.V
25
- * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
- */
27
- ?>
28
- <?php
29
- /**
30
- * One page checkout payment methods
31
- *
32
- * @var $this Mage_Checkout_Block_Onepage_Payment_Methods
33
- */
34
- ?>
35
-
36
- <?php
37
- $methods = $this->getMethods();
38
- $oneMethod = count($methods) <= 1;
39
- ?>
40
- <?php if (empty($methods)): ?>
41
- <dt>
42
- <?php echo $this->__('No Payment Methods') ?>
43
- </dt>
44
- <?php else:
45
- foreach ($methods as $_method):
46
- $_code = $_method->getCode();
47
-
48
- $_style = "";
49
- if($_code == "adyen_hpp") {
50
-
51
- // get method and check if config payment/adyen_hpp/disable_hpptypes is set
52
- $disabled = $_method->getHppOptionsDisabled();
53
- if(!$disabled) {
54
- $_style = ($_code == "adyen_hpp" && !$oneMethod) ? "display:none" : "";
55
- }
56
- } else if ($_code == "adyen_oneclick" && !$oneMethod) {
57
- $_style = "display:none";
58
- }
59
-
60
- ?>
61
- <dt style="<?php echo $_style; ?>">
62
- <?php if(!$oneMethod): ?>
63
- <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->escapeHtml($_method->getTitle()) ?>" <?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> class="radio" />
64
- <?php else: ?>
65
- <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
66
- <?php $oneMethod = $_code; ?>
67
- <?php endif; ?>
68
-
69
- <?php if(($_code == "adyen_hpp" && $disabled) || ($_code != "adyen_hpp")): ?>
70
- <label for="p_method_<?php echo $_code ?>"><?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
71
- <?php endif; ?>
72
- </dt>
73
-
74
- <?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
75
- <dd>
76
- <?php echo $html; ?>
77
- </dd>
78
- <?php endif; ?>
79
- <script type="text/javascript">
80
- //<![CDATA[
81
-
82
- var SwitchMethod= function() {
83
- var method = $('p_method_<?php echo $_code?>').value;
84
- if(method != "adyen_hpp") {
85
- // check if hpp is enabled if so clear the selected option because you select different payment method
86
- if($('adyen_hpp_enable_fields'))
87
- {
88
- var form = $('adyen_hpp_enable_fields');
89
- var elements = form.getElementsByTagName('input');
90
- for (var i=0; i<elements.length; i++) elements[i].checked = false;
91
- }
92
- }
93
-
94
- // check if adyen_oneclick is enabled
95
- if(method != "adyen_oneclick") {
96
- if($('oneclick_payment_form_adyen_oneclick'))
97
- {
98
- // if so clear the selected option because you select different payment method
99
- var form = $('oneclick_payment_form_adyen_oneclick');
100
- var elements = form.getElementsByTagName('input');
101
- for (var i=0; i<elements.length; i++) elements[i].checked = false;
102
-
103
- // don't show the cvc field
104
- $$('.cvc_block').each(
105
- function (e) {
106
- e.setStyle({display:'none'});
107
- }
108
- );
109
-
110
- // hide update link
111
- $$('.update-expiration-date').each(
112
- function (e) {
113
- e.setStyle({display:'none'});
114
- }
115
- );
116
-
117
- // don't show installment field
118
- $$('.adyen-oneclick-installments').each(
119
- function (e) {
120
- e.setStyle({display:'none'});
121
- }
122
- );
123
- }
124
- }
125
- payment.switchMethod(method);
126
-
127
- // always enable adyen_hpp
128
- if ($('payment_form_adyen_hpp')){
129
- var form = $('payment_form_adyen_hpp');
130
- form.style.display = '';
131
- var elements = form.getElementsByTagName('input');
132
- for (var i=0; i<elements.length; i++) elements[i].disabled = false;
133
- var elements = form.getElementsByTagName('select');
134
- for (var i=0; i<elements.length; i++) elements[i].disabled = false;
135
- }
136
-
137
- };
138
- Event.observe($('p_method_<?php echo $_code ?>'), 'change', SwitchMethod);
139
-
140
- //]]>
141
- </script>
142
- <?php endforeach;
143
- endif;
144
- ?>
145
- <?php echo $this->getChildChildHtml('additional'); ?>
146
- <script type="text/javascript">
147
- //<![CDATA[
148
- <?php echo $this->getChildChildHtml('scripts'); ?>
149
- payment.init();
150
- <?php if (is_string($oneMethod)): ?>
151
- payment.switchMethod('<?php echo $oneMethod ?>');
152
- <?php endif; ?>
153
-
154
- // always enable the hpp payment options if this payment method is on
155
- if($('adyen_hpp_enable_fields'))
156
- {
157
- var form = $('adyen_hpp_enable_fields');
158
- var elements = form.getElementsByTagName('input');
159
- for (var i=0; i<elements.length; i++) elements[i].disabled = false;
160
- }
161
- // always enable the oneclick payments options if this payment method is on
162
- if($('oneclick_payment_form_adyen_oneclick'))
163
- {
164
- var form = $('oneclick_payment_form_adyen_oneclick');
165
- var elements = form.getElementsByTagName('input');
166
- for (var i=0; i<elements.length; i++) elements[i].disabled = false;
167
-
168
- // always enable the selectboxes for the oneclick creditcards
169
- var elements = form.getElementsByTagName('select');
170
- for (var i=0; i<elements.length; i++) elements[i].disabled = false;
171
- }
172
- //]]>
173
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/adyen/form/cc.phtml CHANGED
@@ -25,207 +25,235 @@
25
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
  */
27
  ?>
28
- <?php $_code=$this->getMethodCode() ?>
 
 
 
29
  <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
30
- <li class="adyen_payment_creditcard_labels">
31
- <?php $count = 0;
32
- foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
33
- <?php $_filename = $this->getSkinUrl('images/adyen/' . strtolower($_typeCode) . "_small.png"); ?>
34
- <img id="cc_type_<?php echo $count; ?>" width="40" height="22" src="<?php echo $_filename; ?>" alt="" class="mid" />
35
- <?php ++$count;
36
- endforeach; ?>
37
- <input type="hidden" id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" value=""/>
38
- </li>
39
- <li class="adyen_payment_input_fields">
40
- <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
41
- <div class="input-box">
42
- <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_owner]\"" : "data-encrypted-name=\"holderName\""); ?> value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" maxlength="100" />
43
- </div>
44
- </li>
45
- <li class="adyen_payment_input_fields">
46
- <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
47
- <div class="input-box">
48
- <input type="text" id="<?php echo $_code ?>_cc_number" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_number]\"" : " data-encrypted-name=\"number\""); ?> title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-type required-entry" value="" maxlength="23"/>
49
- <script type="text/javascript">
50
- var group_types = new Array();
51
- <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
52
- group_types.push("<?php echo $_typeCode; ?>");
53
- <?php endforeach ?>
54
-
55
- card_previousCardNumber = "";
56
-
57
- function selectBrand() {
58
-
59
- cardNumber = (document.getElementById( '<?php echo $_code ?>_cc_number' ).value);
60
- dontHideErrorFrame = null;
61
-
62
- // empty card field - reset all
63
- if (cardNumber.length == 0) {
64
- card_previousCardNumber = cardNumber;
65
- cardSetCardBrand(null, false, group_types);
66
- return;
67
- }
68
 
69
- // When editing the card (but not adding digits at the end), don't reformat the number
70
- var l=0;
71
- while(l < card_previousCardNumber.length && l < cardNumber.length) {
72
- if(cardNumber[l] != card_previousCardNumber[l]) {
 
73
  card_previousCardNumber = cardNumber;
 
74
  return;
75
  }
76
- l++;
77
- }
78
 
79
- // remove all whitespace
80
- reg = /\s+/g;
81
- cardNumber = cardNumber.replace(reg,'');
 
 
 
 
 
 
82
 
83
- nrOfDigits = cardNumber.length;
84
- if(nrOfDigits > 19){
85
- return;
86
- }
87
 
88
- baseCard = getBaseCard(cardNumber, group_types);
 
 
 
89
 
90
- if(baseCard != null) {
91
- cardSetCardBrand(baseCard, true, group_types);
92
- } else if(nrOfDigits > 4) {
93
- cardSetCardBrand(null, true, group_types);
94
- } else {
95
- cardSetCardBrand(null, false, group_types);
96
- }
97
 
98
- //show value with white space after four numbers
99
- result = cardNumber.replace(/(\d{4})/g, '$1 ');
100
- result = result.replace(/\s+$/, ''); //remove trailing spaces
101
- card_previousCardNumber = result;
102
- document.getElementById( '<?php echo $_code; ?>_cc_number' ).value = result;
103
- }
 
104
 
105
- function cardSetCardBrand(selectedCard, greyInactive, group_types) {
 
 
 
 
 
106
 
107
- for(var i = 0; i < group_types.length; ++i) {
108
- var imageId = 'cc_type_' + i;
109
- if(selectedCard != null && group_types[i] == selectedCard.cardtype) {
110
- // remove class
111
- $(imageId).removeClassName('grey');
112
- // set hidden field cc type for installments
113
- $('<?php echo $_code ?>_cc_type').setValue(selectedCard.cardtype);
114
- } else {
115
- if(greyInactive) {
116
- // add class
117
- $(imageId).addClassName('grey');
118
- } else {
119
  // remove class
120
  $(imageId).removeClassName('grey');
 
 
 
 
 
 
 
 
 
 
121
  }
 
122
  }
123
- document.getElementById(imageId).style.display="inline";
 
 
 
 
 
 
 
 
124
  }
125
 
126
- <?php if($this->hasInstallments()): ?>
127
- if(selectedCard != null ) {
128
- var interval = setInterval(getInstallments(selectedCard.cardtype), 500);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
- <?php endif; ?>
131
- }
132
 
133
- var ajaxReq;
134
- function getInstallments(variant) {
135
 
136
- // get the installments for this cardtype
137
- var ccType = variant;
138
- console.log(ccType);
139
 
140
- var url = '<?php echo $this->getUrl('adyen/GetInstallments', array('_secure'=>true)); ?>';
141
 
142
- if(ajaxReq && ajaxReq.readystate != 4){
143
- ajaxReq.transport.abort();
144
- }
145
 
146
- ajaxReq = new Ajax.Request(url, {
147
- parameters: {ccType: ccType, isAjax: 1, method: 'POST'},
148
- onSuccess: function(transport) {
149
 
150
- if(transport.status == 200) {
151
 
152
- // get current selected installment
153
- var currentSelectedInstallment = document.getElementById('<?php echo $_code ?>_installments').getValue();
154
 
155
- // clear the select box
156
- document.getElementById('<?php echo $_code ?>_installments').options.length = 0;
157
 
158
- var response = transport.responseText.evalJSON();
159
 
160
- var sel = false;
161
- for (var key in response) {
162
 
163
- // change the installments
164
- var opt = document.createElement('option');
165
- opt.text = response[key]
166
- opt.value = key;
167
- // check if selected installment is still available
168
- if(currentSelectedInstallment == key) {
169
- sel = true;
 
 
170
  }
171
- $('<?php echo $_code ?>_installments').options.add(opt);
172
- }
173
 
174
- if(sel == true && currentSelectedInstallment) {
175
- document.getElementById('adyen_cc_installments').value=currentSelectedInstallment;
 
176
  }
 
 
 
177
  }
178
- },
179
- onFailure: function(){
180
- alert('<?php echo $this->jsQuoteEscape($this->__('Server Error. Please try again.')) ?>');
181
- }
182
- });
183
- }
184
 
185
- // default
186
- cardSetCardBrand(null, false, group_types);
187
-
188
- // observers
189
- Event.observe($('<?php echo $_code ?>_cc_number'), 'change', selectBrand);
190
- Event.observe($('<?php echo $_code ?>_cc_number'), 'keyup', selectBrand);
191
-
192
- </script>
193
- </div>
194
- </li>
195
- <li class="adyen_payment_input_fields">
196
- <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
197
- <div class="input-box">
198
- <div class="v-fix">
199
- <select id="<?php echo $_code ?>_expiration" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_exp_month]\"" : "data-encrypted-name=\"expiryMonth\""); ?> class="month validate-cc-exp required-entry">
200
- <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
201
- <?php foreach ($this->getCcMonths() as $k=>$v): ?>
202
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
203
- <?php endforeach ?>
204
- </select>
205
  </div>
206
- <div class="v-fix">
207
- <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
208
- <select id="<?php echo $_code ?>_expiration_yr" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_exp_year]\"" : "data-encrypted-name=\"expiryYear\""); ?> class="year required-entry">
209
- <?php foreach ($this->getCcYears() as $k=>$v): ?>
210
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
211
- <?php endforeach ?>
212
- </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  </div>
214
- </div>
215
- </li>
216
- <?php echo $this->getChildHtml() ?>
217
- <?php if($this->hasVerification()): ?>
218
  <li class="adyen_payment_input_fields">
219
  <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
220
  <div class="input-box">
221
  <div class="v-fix">
222
- <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry" id="<?php echo $_code ?>_cc_cid" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_cid]\"" : "data-encrypted-name=\"cvc\""); ?> value="" maxlength="4" />
223
  </div>
224
  <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
225
  </div>
226
  </li>
227
- <?php endif; ?>
228
- <?php if($this->hasInstallments()): ?>
229
  <li class="adyen_payment_input_fields">
230
  <label for="<?php echo $_code ?>_installments" class="required"><em>*</em><?php echo $this->__('Installments') ?></label>
231
  <div class="input-box">
@@ -238,101 +266,64 @@
238
  </div>
239
  </div>
240
  </li>
241
- <?php endif;?>
242
 
243
- <?php if($this->getRecurringType() == "ONECLICK" || $this->getRecurringType() == "ONECLICK,RECURRING"): ?>
244
- <li class="adyen_payment_input_fields">
245
  <div class="input-box">
246
  <div class="v-fix">
247
  <input type="checkbox" name="payment[store_cc]" id="<?php echo $_code ?>_store_cc" value="1" checked />
248
- <label for="<?php echo $_code ?>_store_cc" class="required"><em>*</em><?php echo $this->__('Remember these details') ?></label>
249
  </div>
250
  </div>
251
  </li>
252
- <?php endif; ?>
253
- </ul>
254
- <?php if ($this->isCseEnabled()): ?>
 
 
 
 
 
255
  <input type="hidden" id="<?php echo $_code ?>_encrypted_form_expiry_generationtime" value="<?php echo date("c"); ?>" data-encrypted-name="generationtime" />
256
- <input type="hidden" id="adyen-cse-form" />
257
  <script type="text/javascript">
258
- //<![CDATA[
259
- var cse_form = document.getElementById('adyen-cse-form').form;
260
  var cse_key = <?php echo json_encode($this->getCsePublicKey()); ?>;
261
  var cse_options = {
262
  name: 'payment[encrypted_data]',
263
  force: true
264
  };
265
- var cse = function() {
266
- if (payment.currentMethod && payment.currentMethod == '<?php echo $_code ?>') {
267
- try {
 
268
  adyen.encrypt.createEncryptedForm(cse_form, cse_key, cse_options);
269
- } catch (e) {
270
- var encryptionFailed = true;
271
  }
272
- var encryptedForm = document.getElementById(cse_options.name);
273
- if (encryptionFailed || !encryptedForm || encryptedForm.value.length == 0) {
 
 
274
  alert("Warning: Adyen Client Side Encryption cannot succeed.");
275
  }
276
  }
277
- }
278
- var cse_initialize = function() {
279
- if (typeof adyen === 'undefined') {
280
- js = document.createElement("script");
281
- js.type = "text/javascript";
282
- js.src = "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>adyen/payment/adyen.encrypt.js";
283
- document.body.appendChild(js);
284
- }
285
 
286
- if (typeof payment !== 'undefined' && typeof payment.save !== 'undefined') {
287
- payment.save = payment.save.wrap(function(originalSaveMethod) {
288
- cse.call(this);
289
- originalSaveMethod();
290
- });
291
- }
292
- if (typeof checkout !== 'undefined' && typeof checkout.save !== 'undefined') {
293
- checkout.save = checkout.save.wrap(function(originalSaveMethod) {
294
- cse.call(this);
295
- originalSaveMethod();
296
- });
297
- }
298
-
299
- // Fix for the onestepcheckout plugins
300
- if($('onestepcheckout-place-order')) {
301
- $('onestepcheckout-place-order').observe('click', function(e) {
302
- cse.call(this);
303
- });
304
- }
305
-
306
- // fix for the IWD One Page Checkout
307
- if($('checkout-review-submit')) {
308
- $$('.opc-btn-checkout').each(function(element) {
309
- element.observe('click', function(e) {
310
- cse.call(this);
311
- });
312
- })
313
- }
314
 
315
- //Fix for Inovarti One Step Checkout Brasil
316
- if($('onestepcheckout-place-order-button')) {
317
- $('onestepcheckout-place-order-button').observe('click', function(e) {
318
- cse.call(this);
319
- });
 
320
  }
321
 
322
- // Fix for GoMage LightCheckout
323
- if($('submit-btn')) {
324
- $('submit-btn').observe('click', function(e) {
325
- cse.call(this);
326
- });
327
- }
328
- }
329
 
330
- if (document.readyState === "complete") {
331
- cse_initialize();
332
- }
333
- else {
334
- Event.observe(window, 'load', cse_initialize);
335
- }
336
- //]]>
337
  </script>
338
- <?php endif;?>
 
25
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
  */
27
  ?>
28
+ <?php
29
+ /** @var Adyen_Payment_Block_Form_Cc $this */
30
+ $_code = $this->getMethodCode();
31
+ ?>
32
  <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
33
+ <li class="adyen_payment_creditcard_labels">
34
+ <?php $count = 0;
35
+ foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
36
+ <?php $_filename = $this->getSkinUrl('images'.DS.'adyen'.DS. strtolower($_typeCode) . "_small.png"); ?>
37
+ <img id="cc_type_<?php echo $count; ?>" width="40" height="22" src="<?php echo $_filename; ?>" alt="" class="mid" />
38
+ <?php ++$count;
39
+ endforeach; ?>
40
+ <input type="hidden" id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" value=""/>
41
+ </li>
42
+ <li class="adyen_payment_input_fields">
43
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
44
+ <div class="input-box">
45
+ <input type="text" id="<?php echo $_code ?>_cc_number" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_number]\"" : " data-encrypted-name=\"number\""); ?> title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-type required-entry" value="" maxlength="23"/>
46
+ <script type="text/javascript">
47
+ var group_types = [];
48
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
49
+ group_types.push("<?php echo $_typeCode; ?>");
50
+ <?php endforeach ?>
51
+
52
+ card_previousCardNumber = "";
53
+
54
+ function selectBrand() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
+ cardNumber = (document.getElementById( '<?php echo $_code ?>_cc_number' ).value);
57
+ dontHideErrorFrame = null;
58
+
59
+ // empty card field - reset all
60
+ if (cardNumber.length == 0) {
61
  card_previousCardNumber = cardNumber;
62
+ cardSetCardBrand(null, false, group_types);
63
  return;
64
  }
 
 
65
 
66
+ // When editing the card (but not adding digits at the end), don't reformat the number
67
+ var l=0;
68
+ while(l < card_previousCardNumber.length && l < cardNumber.length) {
69
+ if(cardNumber[l] != card_previousCardNumber[l]) {
70
+ card_previousCardNumber = cardNumber;
71
+ return;
72
+ }
73
+ l++;
74
+ }
75
 
76
+ // remove all whitespace
77
+ reg = /\s+/g;
78
+ cardNumber = cardNumber.replace(reg,'');
 
79
 
80
+ nrOfDigits = cardNumber.length;
81
+ if(nrOfDigits > 19){
82
+ return;
83
+ }
84
 
85
+ baseCard = getBaseCard(cardNumber, group_types);
 
 
 
 
 
 
86
 
87
+ if(baseCard != null) {
88
+ cardSetCardBrand(baseCard, true, group_types);
89
+ } else if(nrOfDigits > 4) {
90
+ cardSetCardBrand(null, true, group_types);
91
+ } else {
92
+ cardSetCardBrand(null, false, group_types);
93
+ }
94
 
95
+ //show value with white space after four numbers
96
+ result = cardNumber.replace(/(\d{4})/g, '$1 ');
97
+ result = result.replace(/\s+$/, ''); //remove trailing spaces
98
+ card_previousCardNumber = result;
99
+ document.getElementById( '<?php echo $_code; ?>_cc_number' ).value = result;
100
+ }
101
 
102
+ function cardSetCardBrand(selectedCard, greyInactive, group_types) {
103
+
104
+ for(var i = 0; i < group_types.length; ++i) {
105
+ var imageId = 'cc_type_' + i;
106
+ if(selectedCard != null && group_types[i] == selectedCard.cardtype) {
 
 
 
 
 
 
 
107
  // remove class
108
  $(imageId).removeClassName('grey');
109
+ // set hidden field cc type for installments
110
+ $('<?php echo $_code ?>_cc_type').setValue(selectedCard.cardtype);
111
+ } else {
112
+ if(greyInactive) {
113
+ // add class
114
+ $(imageId).addClassName('grey');
115
+ } else {
116
+ // remove class
117
+ $(imageId).removeClassName('grey');
118
+ }
119
  }
120
+ document.getElementById(imageId).style.display="inline";
121
  }
122
+
123
+ <?php if($this->hasInstallments()): ?>
124
+ if(selectedCard != null ) {
125
+ var interval = setInterval(getInstallments(selectedCard.cardtype), 500);
126
+ }
127
+ <?php endif; ?>
128
+
129
+ cardSetCvcElementselectedCardType(selectedCard != null ? selectedCard.cardtype : null);
130
+
131
  }
132
 
133
+ function cardSetCvcElementselectedCardType(selectedCardType) {
134
+ var cvcCodeElem = document.getElementById( '<?php echo $_code; ?>_cc_cid' );
135
+
136
+ // first remove classnames
137
+ cvcCodeElem.removeClassName('maximum-length-3');
138
+ cvcCodeElem.removeClassName('minimum-length-3');
139
+ cvcCodeElem.removeClassName('maximum-length-4');
140
+ cvcCodeElem.removeClassName('minimum-length-4');
141
+
142
+ if(selectedCardType == null) {
143
+ // error do nothing
144
+ } else if(selectedCardType == "AE") {
145
+ cvcCodeElem.maxLength = 4;
146
+ cvcCodeElem.addClassName('maximum-length-4');
147
+ cvcCodeElem.addClassName('minimum-length-4');
148
+ } else {
149
+ cvcCodeElem.maxLength = 3;
150
+ cvcCodeElem.addClassName('maximum-length-3');
151
+ cvcCodeElem.addClassName('minimum-length-3');
152
  }
153
+ }
 
154
 
155
+ var ajaxReq;
156
+ function getInstallments(variant) {
157
 
158
+ // get the installments for this cardtype
159
+ var ccType = variant;
 
160
 
161
+ var url = '<?php echo $this->getUrl('adyen/GetInstallments', array('_secure'=>true)); ?>';
162
 
163
+ if(ajaxReq && ajaxReq.readystate != 4){
164
+ ajaxReq.transport.abort();
165
+ }
166
 
167
+ ajaxReq = new Ajax.Request(url, {
168
+ parameters: {ccType: ccType, isAjax: 1, method: 'POST'},
169
+ onSuccess: function(transport) {
170
 
171
+ if(transport.status == 200) {
172
 
173
+ // get current selected installment
174
+ var currentSelectedInstallment = document.getElementById('<?php echo $_code ?>_installments').getValue();
175
 
176
+ // clear the select box
177
+ document.getElementById('<?php echo $_code ?>_installments').options.length = 0;
178
 
179
+ var response = transport.responseText.evalJSON();
180
 
181
+ var sel = false;
182
+ for (var key in response) {
183
 
184
+ // change the installments
185
+ var opt = document.createElement('option');
186
+ opt.text = response[key]
187
+ opt.value = key;
188
+ // check if selected installment is still available
189
+ if(currentSelectedInstallment == key) {
190
+ sel = true;
191
+ }
192
+ $('<?php echo $_code ?>_installments').options.add(opt);
193
  }
 
 
194
 
195
+ if(sel == true && currentSelectedInstallment) {
196
+ document.getElementById('adyen_cc_installments').value=currentSelectedInstallment;
197
+ }
198
  }
199
+ },
200
+ onFailure: function(){
201
+ alert('<?php echo $this->jsQuoteEscape($this->__('Server Error. Please try again.')) ?>');
202
  }
203
+ });
204
+ }
 
 
 
 
205
 
206
+ // default
207
+ cardSetCardBrand(null, false, group_types);
208
+
209
+ // observers
210
+ Event.observe($('<?php echo $_code ?>_cc_number'), 'change', selectBrand);
211
+ Event.observe($('<?php echo $_code ?>_cc_number'), 'keyup', selectBrand);
212
+
213
+ </script>
 
 
 
 
 
 
 
 
 
 
 
 
214
  </div>
215
+ </li>
216
+ <li class="adyen_payment_input_fields">
217
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
218
+ <div class="input-box">
219
+ <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_owner]\"" : "data-encrypted-name=\"holderName\""); ?> value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" maxlength="100" />
220
+ </div>
221
+ </li>
222
+ <li class="adyen_payment_input_fields">
223
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
224
+ <div class="input-box">
225
+ <div class="v-fix">
226
+ <select id="<?php echo $_code ?>_expiration" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_exp_month]\"" : "data-encrypted-name=\"expiryMonth\""); ?> class="month validate-cc-exp required-entry">
227
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
228
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
229
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
230
+ <?php endforeach ?>
231
+ </select>
232
+ </div>
233
+ <div class="v-fix">
234
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
235
+ <select id="<?php echo $_code ?>_expiration_yr" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_exp_year]\"" : "data-encrypted-name=\"expiryYear\""); ?> class="year required-entry">
236
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
237
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
238
+ <?php endforeach ?>
239
+ </select>
240
+ </div>
241
  </div>
242
+ </li>
243
+ <?php echo $this->getChildHtml() ?>
244
+
245
+ <?php if($this->hasVerification()): ?>
246
  <li class="adyen_payment_input_fields">
247
  <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
248
  <div class="input-box">
249
  <div class="v-fix">
250
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-digits validate-length" id="<?php echo $_code ?>_cc_cid" <?php echo (!$this->isCseEnabled() ? "name=\"payment[cc_cid]\"" : "data-encrypted-name=\"cvc\""); ?> value="" size="7" maxlength="4" />
251
  </div>
252
  <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
253
  </div>
254
  </li>
255
+ <?php endif; ?>
256
+ <?php if($this->hasInstallments()): ?>
257
  <li class="adyen_payment_input_fields">
258
  <label for="<?php echo $_code ?>_installments" class="required"><em>*</em><?php echo $this->__('Installments') ?></label>
259
  <div class="input-box">
266
  </div>
267
  </div>
268
  </li>
269
+ <?php endif;?>
270
 
271
+ <?php if($this->showRememberThisCheckoutbox()): ?>
272
+ <li id="adyen-remember-these-details" class="adyen_payment_input_fields">
273
  <div class="input-box">
274
  <div class="v-fix">
275
  <input type="checkbox" name="payment[store_cc]" id="<?php echo $_code ?>_store_cc" value="1" checked />
276
+ <label for="<?php echo $_code ?>_store_cc"><em>*</em><?php echo $this->__('Remember these details') ?></label>
277
  </div>
278
  </div>
279
  </li>
280
+ <script type="text/javascript">
281
+ // don't show save cc for quest checkout. Only possible to detect with javascript
282
+ if ($('login:guest') && $('login:guest').checked) {
283
+ $('adyen-remember-these-details').hide();
284
+ }
285
+ </script>
286
+ <?php endif; ?>
287
+ <?php if ($this->isCseEnabled()): ?>
288
  <input type="hidden" id="<?php echo $_code ?>_encrypted_form_expiry_generationtime" value="<?php echo date("c"); ?>" data-encrypted-name="generationtime" />
 
289
  <script type="text/javascript">
290
+ var cse_form = $('payment_form_<?php echo $_code ?>');
 
291
  var cse_key = <?php echo json_encode($this->getCsePublicKey()); ?>;
292
  var cse_options = {
293
  name: 'payment[encrypted_data]',
294
  force: true
295
  };
296
+
297
+ var cseUpdate = function() {
298
+ try {
299
+ if (payment.currentMethod && payment.currentMethod == '<?php echo $_code ?>') {
300
  adyen.encrypt.createEncryptedForm(cse_form, cse_key, cse_options);
 
 
301
  }
302
+ } catch (e) {
303
+ if (typeof console == "object") {
304
+ console.error(e);
305
+ } else {
306
  alert("Warning: Adyen Client Side Encryption cannot succeed.");
307
  }
308
  }
 
 
 
 
 
 
 
 
309
 
310
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
 
312
+ var cseInit = function() {
313
+ if (typeof adyen === 'undefined') {
314
+ var script = document.createElement("script");
315
+ script.type = "text/javascript";
316
+ script.src = "<?php echo $this->getJsUrl('adyen/payment/adyen.encrypt.js'); ?>";
317
+ document.body.appendChild(script);
318
  }
319
 
320
+ var fields = $$('#payment_form_<?php echo $_code ?> input, #payment_form_<?php echo $_code ?> textarea, #payment_form_<?php echo $_code ?> select');
321
+ fields.forEach(function(field) {
322
+ field.observe('change', cseUpdate);
323
+ });
324
+ };
 
 
325
 
326
+ cseInit();
 
 
 
 
 
 
327
  </script>
328
+ <?php endif;?>
329
+ </ul>
app/design/frontend/base/default/template/adyen/form/hpp.phtml CHANGED
@@ -26,136 +26,13 @@
26
  */
27
  ?>
28
  <?php $_code = $this->getMethodCode() ?>
29
-
30
  <?php $disabled = $this->getHppOptionsDisabled();?>
31
-
32
- <?php $id = ($disabled) ? "" : "adyen_hpp_enable_fields"; ?>
33
- <fieldset id="<?php echo $id; ?>" class="">
34
- <?php $hidePaymentMethod = ($disabled) ? ' style="display: none;"' : '';?>
35
-
36
- <ul id="<?php echo "payment_form_" . $_code; ?>"<?php echo $hidePaymentMethod; ?>>
37
- <?php
38
- if(empty($disabled)):
39
- $enabledTypes = $this->getHppAvailableTypes();
40
- if(!empty($enabledTypes)):
41
- ?>
42
  <li>
43
- <div class="input-box required-entry">
44
- <?php foreach ($enabledTypes as $_typeCode=>$_type): ?>
45
- <?php $_typeName = $_type['name']; ?>
46
- <?php $filename = $this->getSkinUrl('images/adyen/' . $_typeCode . ".png"); ?>
47
- <table class="table_adyen_<?php echo $_typeCode; ?>">
48
- <tr class="adyen_payment_method_row">
49
- <td class="col_radio" width="20px">
50
- <input type="radio" id="hpp_type_<?php echo $_typeCode ?>" name="payment[hpp_type]" value="<?php echo $_typeCode ?>"/>
51
- <input type="hidden" name="payment[hpp_type_label_<?php echo $_typeCode ?>]" value="<?php echo $_typeName; ?>" />
52
- </td>
53
- <td class="col_img" width="80px"><label for="hpp_type_<?php echo $_typeCode ?>"><img src="<?php echo $this->getSkinUrl('images/adyen/' . "$_typeCode.png") ?>" alt="<?php echo $_typeName ?>" /></label></td>
54
-
55
- <?php if ($_typeName == "pm.c_cash.buttonName"):
56
- $_typeName = "Cash";
57
- endif; ?>
58
- <td class="col_name"><label for="hpp_type_<?php echo $_typeCode ?>"><?php echo $this->__($_typeName) ?></label></td>
59
- </tr>
60
- <?php if ($_typeCode == 'ideal' && !empty($_type['issuers'])): ?>
61
- <tr class="adyen_ideal_row">
62
- <td colspan="3" class="payment_form_ideal">
63
- <fieldset class="form-list" id="payment_form_ideal" style="display:none">
64
- <?php
65
- if($this->getShowIdealLogos()):
66
- foreach ($_type['issuers'] as $_issueId => $_IssueLabel): ?>
67
- <?php
68
- $_bankFile = strtoupper(str_replace(" ", '', $_IssueLabel));
69
- $_filename = $this->getSkinUrl('images/adyen/' . $_bankFile . ".png");
70
- if (empty($_issueId) || empty($_IssueLabel)) continue;
71
- ?>
72
- <table class="banks">
73
- <tr>
74
- <td width="20px">
75
- <input type="radio" id="hpp_ideal_type_<?php echo $_issueId ?>" name="payment[hpp_ideal_type]" value="<?php echo $_issueId .DS. $_IssueLabel ?>"/>
76
- </td>
77
- <td width="80px"><label for="hpp_ideal_type_<?php echo $_issueId ?>"><img src="<?php echo $this->getSkinUrl('images/adyen/' . "$_bankFile.png") ?>" alt="<?php echo $_IssueLabel ?>" label="<?php echo $_IssueLabel ?>" /></label></td>
78
- </tr>
79
- </table>
80
- <script type="text/javascript">
81
- $("hpp_ideal_type_<?php echo $_issueId; ?>").observe("click", function (e) {
82
- // set ideal as payment method
83
- $('hpp_type_ideal').checked = true;
84
- // set the adyen_hpp payment method
85
- $('p_method_adyen_hpp').checked = true;
86
- payment.switchMethod("adyen_hpp");
87
- });
88
- </script>
89
- <?php endforeach;
90
- else:?>
91
- <select class="adyen_select_ideal" name="payment[hpp_ideal_type]">
92
- <option value=""><?php echo $this->__('Choose Your Bank');?></option>
93
- <?php foreach ($_type['issuers'] as $_issueId => $_IssueLabel): ?>
94
- <option value="<?php echo $_issueId .DS. $_IssueLabel ?>"><?php echo $_IssueLabel; ?></option>
95
- <?php endforeach;?>
96
- </select>
97
- <?php endif; ?>
98
- </fieldset>
99
- </td>
100
- </tr>
101
- <?php endif; ?>
102
- </table>
103
- <script type="text/javascript">
104
- //<![CDATA[
105
-
106
- var IdealChecked= function() {
107
-
108
- // uncheck hpp_oneclick if exists
109
- if($('oneclick_payment_form_adyen_oneclick'))
110
- {
111
- var form = $('oneclick_payment_form_adyen_oneclick');
112
- var elements = form.getElementsByTagName('input');
113
- for (var i=0; i<elements.length; i++) elements[i].checked = false;
114
-
115
- // hide open cvc field
116
- $$('.cvc_block').each(
117
- function (e) {
118
- e.setStyle({display:'none'});
119
- }
120
- );
121
-
122
- // hide update link
123
- $$('.update-expiration-date').each(
124
- function (e) {
125
- e.setStyle({display:'none'});
126
- }
127
- );
128
-
129
- // hide installment box
130
- $$('.adyen-oneclick-installments').each(
131
- function (e) {
132
- e.setStyle({display:'none'});
133
- }
134
- );
135
-
136
- }
137
-
138
- var method = $('hpp_type_<?php echo $_typeCode?>');
139
- // set the adyen_hpp payment method
140
- $('p_method_adyen_hpp').checked = true;
141
- payment.switchMethod("adyen_hpp");
142
- if (method.value == 'ideal') {
143
- $('payment_form_ideal').show();
144
- } else {
145
- $('payment_form_ideal').hide();
146
- }
147
- };
148
- Event.observe($('hpp_type_<?php echo $_typeCode?>'), 'change', IdealChecked);
149
- //]]>
150
- </script>
151
- <?php endforeach ?>
152
- </div>
153
  </li>
154
- <?php endif; ?>
155
- <?php else: ?>
156
- <li>
157
- <?php echo $this->__('You will be redirected to Adyen website when you place an order.') ?>
158
- </li>
159
- <?php endif; ?>
160
- </ul>
161
- </fieldset>
26
  */
27
  ?>
28
  <?php $_code = $this->getMethodCode() ?>
 
29
  <?php $disabled = $this->getHppOptionsDisabled();?>
30
+ <?php if ($disabled): ?>
31
+ <fieldset class="form-list">
32
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
 
 
 
 
 
 
 
 
33
  <li>
34
+ <?php echo $this->__('You will be redirected to Adyen website when you place an order.') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  </li>
36
+ </ul>
37
+ </fieldset>
38
+ <?php endif; ?>
 
 
 
 
 
app/design/frontend/base/default/template/adyen/form/ideal.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ /**
21
+ * @category Payment Gateway
22
+ * @package Adyen_Payment
23
+ * @author Adyen
24
+ * @property Adyen B.V
25
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
+ */
27
+ ?>
28
+ <?php
29
+ /** @var Adyen_Payment_Block_Form_Ideal $this */
30
+ ?>
31
+ <?php $_code = $this->getMethodCode() ?>
32
+
33
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none">
34
+ <li>
35
+ <label for="payment[adyen_ideal_type]">
36
+ <?php echo $this->__('Choose Your Bank') ?>
37
+ </label>
38
+ <?php if($this->getShowIdealLogos()): ?>
39
+ <?php foreach ($this->getIssuers() as $_issueId => $_issuerData): ?>
40
+ <label class="adyen-ideal-image-label">
41
+ <input type="radio" id="adyen_ideal_type_<?php echo $_issueId ?>"
42
+ name="payment[adyen_ideal_type]" value="<?php echo $_issueId ?>"
43
+ <?php if (isset($_issuerData['selected'])): ?>checked<?php endif; ?> />
44
+ <img src="<?php echo $this->getIssuerImageUrl($_issuerData); ?>"
45
+ alt="<?php echo $_issuerData['label'] ?>" />
46
+ </label>
47
+ <?php endforeach; ?>
48
+ <?php else:?>
49
+ <select class="adyen_select_ideal" name="payment[adyen_ideal_type]">
50
+ <option value=""><?php echo $this->__('Choose Your Bank');?></option>
51
+ <?php foreach ($this->getIssuers() as $_issuerId => $_issuerData): ?>
52
+ <option value="<?php echo $_issuerId ?>" <?php if (isset($_issuerData['selected'])): ?>selected<?php endif; ?>>
53
+ <?php echo $_issuerData['label']; ?>
54
+ </option>
55
+ <?php endforeach;?>
56
+ </select>
57
+ <?php endif; ?>
58
+ </li>
59
+ </ul>
app/design/frontend/base/default/template/adyen/form/oneclick.phtml CHANGED
@@ -27,379 +27,183 @@
27
  ?>
28
  <?php $_code=$this->getMethodCode() ?>
29
 
 
 
 
30
 
31
- <div id="oneclick-cse" class="">
32
-
33
- <?php $_listRecurringDetails = $this->getlistRecurringDetails(); ?>
34
-
35
- <?php if(!empty($_listRecurringDetails)): ?>
36
-
37
- <h3><?php echo $this->__('Pay using previously stored details') ?></h3>
38
- <ul id="oneclick_payment_form_<?php echo $_code ?>" class="recurring-creditcards">
39
  <?php
40
- $count = 0;
41
- foreach($_listRecurringDetails as $key => $value):?>
42
- <?php if(isset($value["recurringDetailReference"]) && isset($value["variant"]) && isset($value["card_number"]) && isset($value["card_expiryMonth"]) && isset($value["card_expiryYear"])): ?>
43
- <li>
44
- <input id="recurring_type_<?php echo $key; ?>" class="recurring_type" type="radio" name="payment[recurring]" value="<?php echo $key; ?>" />
45
- <input type="hidden" name="payment[recurringDetailReference_<?php echo $key; ?>]" value="<?php echo $value["recurringDetailReference"] ?>" />
46
-
47
- <input type="hidden" name="payment[oneclick_owner_<?php echo $key; ?>]" value="<?php echo $value["card_holderName"] ?>" />
48
- <input type="hidden" name="payment[oneclick_type_<?php echo $key; ?>]" value="<?php echo $value["variant"] ?>" />
49
- <input type="hidden" name="payment[oneclick_last_4_<?php echo $key; ?>]" value="<?php echo $value["card_number"] ?>" />
50
-
51
- <input type="hidden" id="card_expiry_month_<?php echo $key; ?>" name="card_expiry_month_<?php echo $key; ?>" value="<?php echo $value["card_expiryMonth"] ?>" />
52
- <input type="hidden" id="card_expiry_year_<?php echo $key; ?>" name="card_expiry_year_<?php echo $key; ?>" value="<?php echo $value["card_expiryYear"] ?>" />
53
-
54
- <div class="creditcard-block">
55
- <?php
56
- $_bankFile = $value["variant"];
57
- $_filename = Mage::getBaseDir().DS.'skin'.DS.'frontend'.DS.'base'.DS.'default'.DS.'images'.DS.'adyen'.DS. $_bankFile ."_small.png";
58
 
59
- ?>
60
- <?php if (file_exists($_filename)){ ?>
61
- <img src="<?php echo $this->getSkinUrl('images/adyen/' . $_bankFile . "_small.png") ?>" alt="<?php echo $_bankFile ?>" label="<?php echo $_bankFile ?>" />
62
- <?php } ?>
 
63
 
 
 
64
 
65
- <div class="columns three a">
66
- <label><?php echo $this->__('Credit Card Number') ?></label>
67
- <span>****</span> <?php echo $value["card_number"]; ?>
68
- </div>
69
-
70
- <div class="columns three b">
71
- <label><?php echo $this->__('Expiration Date') ?><a href="#" id="update-expiration-date-<?php echo $key; ?>" class="update-expiration-date" style="display:none;"><?php echo $this->__('(update)') ?></a></label>
72
-
73
- <div id="static-card-expiry-<?php echo $key; ?>" class="static-card-expiry">
74
- <?php echo $value["card_expiryMonth"] . " /" . $value["card_expiryYear"]; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  </div>
76
- <div id="changable-card-expiry-<?php echo $key; ?>" class="changable-card-expiry" style="display:none;">
77
- <select id="<?php echo $_code ?>_expiration_<?php echo $key; ?>" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_exp_month_".$key."]\"" : ""); ?> class="month validate-oneclick-exp required-entry">
78
- <?php foreach ($this->getCcMonths() as $k=>$v): ?>
79
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$value["card_expiryMonth"]): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
80
- <?php endforeach ?>
81
- </select>
82
 
83
- <select id="<?php echo $_code ?>_expiration_yr_<?php echo $key; ?>" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_exp_year_".$key."]\"" : ""); ?> class="year required-entry">
84
- <?php foreach ($this->getCcYears() as $k=>$v): ?>
85
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$value["card_expiryYear"]): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
 
 
 
 
 
86
  <?php endforeach ?>
87
  </select>
88
  </div>
89
  </div>
90
-
91
-
92
- <?php if($this->isNotRecurring()): ?>
93
- <div class="columns three c">
94
- <label><?php echo $this->__('Card Verification Number') ?></label>
95
- <?php if($this->hasVerification()): ?>
96
- <div style="display:none;" class="cvc_block" id="cvc_block_<?php echo $key;?>">
97
- <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry" id="<?php echo $_code ?>_oneclick_cid_<?php echo $key; ?>" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_cid_".$key."]\"" : ""); ?> value="" />
98
- <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
99
- </div>
100
- <?php endif; ?>
101
- </div>
102
- <?php endif; ?>
103
-
104
- <div style="clear:both;"></div>
105
-
106
- <div class="creditcard-holder-name"><?php echo $value["card_holderName"]; ?></div>
107
-
108
-
109
- <?php if($this->hasInstallments()): ?>
110
- <div id="adyen_oneclick_installment_<?php echo $key;?>" class="adyen-oneclick-installments" style="display:none;">
111
- <label for="<?php echo $_code ?>_installment_<?php echo $key; ?>" class="required"><em>*</em><?php echo $this->__('Installments') ?></label>
112
- <div class="input-box">
113
- <div class="v-fix">
114
- <select id="<?php echo $_code ?>_installment_<?php echo $key; ?>" name="payment[installment_<?php echo $key; ?>]" class="adyen-installment number required-entry">
115
- <?php foreach ($this->getInstallmentForCreditCardType($_bankFile) as $k=>$v): ?>
116
- <option value="<?php echo $k?$k:'' ?>"><?php echo $v ?></option>
117
- <?php endforeach ?>
118
- </select>
119
- </div>
120
- </div>
121
- </div>
122
- <?php endif;?>
123
-
124
- <div style="clear:both;"></div>
125
  </div>
126
- <?php ++$count; ?>
127
- </li>
128
- <?php endif; ?>
129
- <?php endforeach; ?>
130
- </ul>
131
-
132
- <h3 class="other-payment"><?php echo $this->__('Or pay using one of the methods below') ?></h3>
133
-
134
- <script type="text/javascript">
135
-
136
- // update-expiration-date action
137
- $$('.update-expiration-date').each(function(element) {
138
- element.observe('click', updateExpirationDate);
139
- });
140
-
141
- // show the expiration month and year
142
- function updateExpirationDate(event) {
143
-
144
- // hide the link
145
- this.hide();
146
-
147
- // show expiration month and year
148
- var id = this.id.replace("update-expiration-date-", "");
149
- var changableId = "changable-card-expiry-" + id;
150
- var staticId = "static-card-expiry-" + id;
151
-
152
- // show changeble card expiry
153
- $(staticId).hide();
154
- $(changableId).show();
155
-
156
- event.preventDefault();
157
- }
158
-
159
- // change selection of recurring card
160
- $$(".recurring_type").invoke('observe', 'change', function() {
161
-
162
- // set the adyen_oneclick payment method
163
- $('p_method_adyen_oneclick').checked = true;
164
- payment.switchMethod("adyen_oneclick");
165
-
166
- // always enable adyen_hpp
167
- if ($('payment_form_adyen_hpp')){
168
- var form = $('payment_form_adyen_hpp');
169
- form.style.display = '';
170
- var elements = form.getElementsByTagName('input');
171
- for (var i=0; i<elements.length; i++) elements[i].disabled = false;
172
- var elements = form.getElementsByTagName('select');
173
- for (var i=0; i<elements.length; i++) elements[i].disabled = false;
174
- }
175
-
176
- // uncheck hpp_method if exists
177
- if($('adyen_hpp_enable_fields'))
178
- {
179
- var form = $('adyen_hpp_enable_fields');
180
- var elements = form.getElementsByTagName('input');
181
- for (var i=0; i<elements.length; i++) elements[i].checked = false;
182
- }
183
-
184
- // remove all the data-encrypted-name="cvc" for CSE
185
- removeAllAttributeCvc();
186
-
187
- // remove all the data-encrypted-name="expiryMonth" and data-encrypted-name="expiryYear" for CSE
188
- removeAllAttributeExpiryMonthAndYear();
189
-
190
- // hide all the open blocks
191
- hideCvcBlocks();
192
- hideInstallmentBlocks();
193
-
194
- // open the selected block
195
- var key = this.value;
196
- var id = "cvc_block_" + key;
197
-
198
- // open the installment block
199
- var installmentId = "adyen_oneclick_installment_" + key;
200
-
201
- // hide changeble card and show static expiration date
202
- hideChangableCardExpiry()
203
-
204
- // show static version of expiry month and year when switching creditcard
205
- showStaticCardExpiry();
206
-
207
- // hide the update expiration date link for recurring cards
208
- hideExpirationDate();
209
-
210
- // show current recurring block update link
211
- var updateLink = "update-expiration-date-"+key;
212
- $(updateLink).setStyle({
213
- display: 'inline'
214
- });
215
-
216
- // set data-encrypted-name="cvc" to this element
217
- var cvv = "adyen_oneclick_oneclick_cid_"+key;
218
- var expiryMonth = "adyen_oneclick_expiration_" + key;
219
- var expiryYear = "adyen_oneclick_expiration_yr_"+key;
220
-
221
- // reset the custom input datemonth and dateyear by the static version (could be changed by customer)
222
- var card_expiry_month = 'card_expiry_month_'+key;
223
- var card_expiry_year = 'card_expiry_year_'+key;
224
- $(expiryMonth).value = $(card_expiry_month).value;
225
- $(expiryYear).value = $(card_expiry_year).value;
226
-
227
- // only set data-encrypted-name="expiryMonth" and data-encrypted-name="expiryYear" for the selected card
228
- $(expiryMonth).setAttribute('data-encrypted-name-oneclick', "expiryMonth");
229
- $(expiryYear).setAttribute('data-encrypted-name-oneclick', "expiryYear");
230
- $(cvv).setAttribute('data-encrypted-name-oneclick', "cvc");
231
-
232
- // show the cvc input field
233
- $(id).show();
234
-
235
- // show recurring selectbox
236
- $(installmentId).show();
237
- });
238
-
239
- // remove all cvc data-encrypted-name attributes
240
- // and uncheck HPP payment method selection
241
- function removeAllAttributeCvc() {
242
-
243
- var form = $('adyen_hpp_enable_fields');
244
- if(form)
245
- {
246
- var elements = form.getElementsByTagName('input');
247
- for (var i=0; i<elements.length; i++) elements[i].checked = false;
248
- }
249
-
250
- $$('.cvv').each(
251
- function (e) {
252
- e.removeAttribute("data-encrypted-name-oneclick");
253
- }
254
- );
255
- }
256
-
257
- // remove all the data-encrypted-name="expiryMonth" and data-encrypted-name="expiryYear" for CSE
258
- function removeAllAttributeExpiryMonthAndYear() {
259
- $$('.month').each(
260
- function (e) {
261
- e.removeAttribute("data-encrypted-name-oneclick");
262
- }
263
- );
264
-
265
- $$('.year').each(
266
- function (e) {
267
- e.removeAttribute("data-encrypted-name-oneclick");
268
- }
269
- );
270
- }
271
-
272
- // hide all the cvc blocks for the recurring cards
273
- function hideCvcBlocks() {
274
- $$('.cvc_block').each(
275
- function (e) {
276
- e.setStyle({display:'none'});
277
- }
278
- );
279
- }
280
-
281
- // hide all the installment block
282
- function hideInstallmentBlocks() {
283
- $$('.adyen-oneclick-installments').each(
284
- function (e) {
285
- e.setStyle({display:'none'});
286
- }
287
- );
288
- }
289
-
290
- function hideChangableCardExpiry() {
291
- $$('.changable-card-expiry').each(
292
- function (e) {
293
- e.setStyle({display:'none'});
294
- }
295
- );
296
- }
297
-
298
- // show the non changable card expiry month and ydaear
299
- function showStaticCardExpiry() {
300
- $$('.static-card-expiry').each(
301
- function (e) {
302
- e.setStyle({display:'block'});
303
- }
304
- );
305
- }
306
-
307
- // hide the update expiration date link for recurring cards
308
- function hideExpirationDate() {
309
- $$('.update-expiration-date').each(
310
- function (e) {
311
- e.hide();
312
- }
313
- );
314
- }
315
- </script>
316
- <?php endif; ?>
317
-
318
- <?php if ($this->isCseEnabled()): ?>
319
- <input type="hidden" id="<?php echo $_code ?>_encrypted_form_expiry_generationtime" value="<?php echo date("c"); ?>" data-encrypted-name-oneclick="generationtime" />
320
- <input type="hidden" id="adyen-cse-form" />
321
- <script type="text/javascript">
322
- //<![CDATA[
323
- var cse_form = document.getElementById('adyen-cse-form').form;
324
- var cse_key = <?php echo json_encode($this->getCsePublicKey()); ?>;
325
- var cse_options_oneclick = {
326
- name: 'payment[encrypted_data_oneclick]',
327
- force: true,
328
- dataEncryptedName: "data-encrypted-name-oneclick"
329
- };
330
- var cseOneClick = function() {
331
- if (payment.currentMethod && payment.currentMethod == '<?php echo $_code ?>') {
332
- try {
333
- adyen.encrypt.createEncryptedForm(cse_form, cse_key, cse_options_oneclick);
334
- } catch (e) {
335
- var encryptionFailed = true;
336
- }
337
- var encryptedForm = document.getElementById(cse_options_oneclick.name);
338
- if (encryptionFailed || !encryptedForm || encryptedForm.value.length == 0) {
339
- alert("Warning: Adyen Client Side Encryption cannot succeed.");
340
- }
341
- }
342
- }
343
- var cse_oneclick_initialize = function() {
344
- if (typeof adyen === 'undefined') {
345
- js = document.createElement("script");
346
- js.type = "text/javascript";
347
- js.src = "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>adyen/payment/adyen.encrypt.js";
348
- document.body.appendChild(js);
349
- }
350
- if (typeof payment !== 'undefined' && typeof payment.save !== 'undefined') {
351
- payment.save = payment.save.wrap(function(originalSaveMethod) {
352
- cseOneClick.call(this);
353
- originalSaveMethod();
354
- });
355
- }
356
- if (typeof checkout !== 'undefined' && typeof checkout.save !== 'undefined') {
357
- checkout.save = checkout.save.wrap(function(originalSaveMethod) {
358
- cseOneClick.call(this);
359
- originalSaveMethod();
360
- });
361
- }
362
-
363
- // Fix for the onestepcheckout plugins
364
- if($('onestepcheckout-place-order')) {
365
- $('onestepcheckout-place-order').observe('click', function(e) {
366
- cseOneClick.call(this);
367
- });
368
- }
369
-
370
- // fix for the IWD One Page Checkout
371
- if($('checkout-review-submit')) {
372
- $$('.opc-btn-checkout').each(function(element) {
373
- element.observe('click', function(e) {
374
- cseOneClick.call(this);
375
- });
376
- })
377
- }
378
-
379
- //Fix for Inovarti One Step Checkout Brasil
380
- if($('onestepcheckout-place-order-button')) {
381
- $('onestepcheckout-place-order-button').observe('click', function(e) {
382
- cseOneClick.call(this);
383
- });
384
- }
385
-
386
- // Fix for GoMage LightCheckout
387
- if($('submit-btn')) {
388
- $('submit-btn').observe('click', function(e) {
389
- cseOneClick.call(this);
390
- });
391
- }
392
- }
393
-
394
- if (document.readyState === "complete") {
395
- cse_oneclick_initialize();
396
- }
397
- else {
398
- Event.observe(window, 'load', cse_oneclick_initialize);
399
- }
400
- //]]>
401
- </script>
402
- <?php endif;?>
403
-
404
 
405
- </div>
27
  ?>
28
  <?php $_code=$this->getMethodCode() ?>
29
 
30
+ <fieldset id="" class="">
31
+ <ul class="form-list adyen_oneclick" id="payment_form_<?php echo $_code ?>" style="display:none">
32
+ <li>
33
 
 
 
 
 
 
 
 
 
34
  <?php
35
+ $recurringDetails = $this->getRecurringDetails();
36
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
+ <?php if(isset($recurringDetails["card_number"]) && isset($recurringDetails["card_expiryMonth"]) && isset($recurringDetails["card_expiryYear"]) ): ?>
39
+ <div class="columns three a">
40
+ <label><?php echo $this->__('Credit Card Number') ?></label>
41
+ <span>****</span> <?php echo $recurringDetails["card_number"]; ?>
42
+ </div>
43
 
44
+ <div class="columns three b">
45
+ <label><?php echo $this->__('Expiration Date') ?><a href="#" id="update-expiration-date-<?php echo $_code; ?>" class="update-expiration-date"><?php echo $this->__('(update)') ?></a></label>
46
 
47
+ <div id="static-card-expiry-<?php echo $_code; ?>" class="static-card-expiry">
48
+ <?php echo $recurringDetails["card_expiryMonth"] . " /" . $recurringDetails["card_expiryYear"]; ?>
49
+ </div>
50
+ <div id="changable-card-expiry-<?php echo $_code; ?>" class="changable-card-expiry" style="display:none;">
51
+ <select id="<?php echo $_code ?>_expiration_<?php echo $_code; ?>" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_exp_month]\"" : "data-encrypted-name-oneclick-" . $_code . "=expiryMonth"); ?> class="month validate-oneclick-exp required-entry">
52
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
53
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$recurringDetails["card_expiryMonth"]): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
54
+ <?php endforeach ?>
55
+ </select>
56
+
57
+ <select id="<?php echo $_code ?>_expiration_yr_<?php echo $_code; ?>" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_exp_year]\"" : "data-encrypted-name-oneclick-" . $_code . "=expiryYear"); ?> class="year required-entry">
58
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
59
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$recurringDetails["card_expiryYear"]): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
60
+ <?php endforeach ?>
61
+ </select>
62
+ </div>
63
+ </div>
64
+
65
+ <?php if($this->isNotRecurring()):
66
+ // set max lenght cvc code
67
+ if($recurringDetails["variant"] == "amex") {
68
+ $maxLenght = "4";
69
+ $class = "validate-length maximum-length-4 minimum-length-4 validate-digits";
70
+ } else {
71
+ $maxLenght = "3";
72
+ $class = "validate-length maximum-length-3 minimum-length-3 validate-digits";
73
+ }
74
+ ?>
75
+ <div class="columns three c">
76
+ <label><?php echo $this->__('Card Verification Number') ?></label>
77
+ <?php if($this->hasVerification()): ?>
78
+ <div class="cvc_block" id="cvc_block_<?php echo $_code;?>">
79
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry <?php echo $class; ?>" id="<?php echo $_code ?>_cc_cid" <?php echo (!$this->isCseEnabled() ? "name=\"payment[oneclick_cid_".$_code."]\"" : "data-encrypted-name-oneclick-" . $_code ."=cvc"); ?> value="" size="7" maxlength="<?php echo $maxLenght; ?>" />
80
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
81
  </div>
82
+ <?php endif; ?>
83
+ </div>
84
+ <?php endif; ?>
 
 
 
85
 
86
+ <?php if($this->hasInstallments()): ?>
87
+ <div id="adyen_oneclick_installment_<?php echo $_code;?>" class="adyen-oneclick-installments">
88
+ <label for="<?php echo $_code ?>_installment_<?php echo $_code; ?>" class="required"><em>*</em><?php echo $this->__('Installments') ?></label>
89
+ <div class="input-box">
90
+ <div class="v-fix">
91
+ <select id="<?php echo $_code ?>_installment" name="payment[installment]" class="adyen-installment number required-entry">
92
+ <?php foreach ($this->getInstallments() as $k=>$v): ?>
93
+ <option value="<?php echo $k?$k:'' ?>"><?php echo $v ?></option>
94
  <?php endforeach ?>
95
  </select>
96
  </div>
97
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  </div>
99
+ <?php endif;?>
100
+
101
+ <?php if ($this->isCseEnabled()): ?>
102
+ <input type="hidden" id="<?php echo $_code ?>_encrypted_form_expiry_generationtime" value="<?php echo date("c"); ?>" data-encrypted-name-oneclick-<?php echo $_code ?>="generationtime" />
103
+ <script type="text/javascript">
104
+
105
+ // update-expiration-date action
106
+ $$('.update-expiration-date').each(function(element) {
107
+ element.observe('click', updateExpirationDate);
108
+ });
109
+ // show the expiration month and year
110
+ function updateExpirationDate(event) {
111
+ // hide the link
112
+ this.hide();
113
+ // show expiration month and year
114
+ var id = this.id.replace("update-expiration-date-", "");
115
+ var changableId = "changable-card-expiry-" + id;
116
+ var staticId = "static-card-expiry-" + id;
117
+ // show changeble card expiry
118
+ $(staticId).hide();
119
+ $(changableId).show();
120
+ event.preventDefault();
121
+ }
122
+
123
+ var cse_key_oneclick = <?php echo json_encode($this->getCsePublicKey()); ?>;
124
+ var cse_options_oneclick = {
125
+ name: 'payment[encrypted_data_oneclick]',
126
+ force: true
127
+ };
128
+
129
+
130
+ var cseUpdateOneClick = function() {
131
+
132
+ try {
133
+ if (payment.currentMethod && payment.currentMethod == '<?php echo $_code ?>') {
134
+ var cse_form_oneclick = $('payment_form_<?php echo $_code ?>');
135
+ cse_options_oneclick.dataEncryptedName = "data-encrypted-name-oneclick-<?php echo $_code ?>";
136
+ adyen.encrypt.createEncryptedForm(cse_form_oneclick, cse_key_oneclick, cse_options_oneclick);
137
+ }
138
+ } catch (e) {
139
+ if (typeof console == "object") {
140
+ console.error(e);
141
+ } else {
142
+ alert("Warning: Adyen Client Side Encryption cannot succeed.");
143
+ }
144
+ }
145
+
146
+ };
147
+
148
+ var cseInitOneClick = function() {
149
+ if (typeof adyen === 'undefined') {
150
+ var script = document.createElement("script");
151
+ script.type = "text/javascript";
152
+ script.src = "<?php echo $this->getJsUrl('adyen/payment/adyen.encrypt.js'); ?>";
153
+ document.body.appendChild(script);
154
+ }
155
+
156
+ var fields = $$('#payment_form_<?php echo $_code ?> input, #payment_form_<?php echo $_code ?> textarea, #payment_form_<?php echo $_code ?> select');
157
+ fields.forEach(function(field) {
158
+ field.observe('change', cseUpdateOneClick);
159
+ });
160
+ };
161
+
162
+ cseInitOneClick();
163
+ </script>
164
+ <?php endif;?>
165
+
166
+ <?php elseif($recurringDetails["variant"] == "elv"): ?>
167
+ <div class="columns three a">
168
+ <label><?php echo $this->__('Account holder name') ?></label>
169
+ <span><?php echo $recurringDetails["elv_accountHolderName"]; ?></span>
170
+ </div>
171
+ <div class="columns three b">
172
+ <label><?php echo $this->__('Account Number') ?></label>
173
+ <span><?php echo $recurringDetails["elv_bankAccountNumber"]; ?></span>
174
+ </div>
175
+ <div class="columns three c">
176
+ <label><?php echo $this->__('Bank Name') ?></label>
177
+ <span><?php echo $recurringDetails["elv_bankName"]; ?></span>
178
+ </div>
179
+ <?php elseif($recurringDetails["variant"] == "openinvoice"): ?>
180
+ <div class="columns three a">
181
+ <label><?php echo $this->__('Bank account holder name') ?></label>
182
+ <span><?php echo $recurringDetails["bank_ownerName"]; ?></span>
183
+ </div>
184
+ <div class="columns three b">
185
+ <label><?php echo $this->__('Bank Account Number') ?></label>
186
+ <span><?php echo $recurringDetails["bank_bankAccountNumber"]; ?></span>
187
+ </div>
188
+ <div class="columns three c">
189
+ <label><?php echo $this->__('Country') ?></label>
190
+ <span><?php echo $recurringDetails["bank_countryCode"]; ?></span>
191
+ </div>
192
+ <?php elseif($recurringDetails["variant"] == "sepadirectdebit" || $recurringDetails["variant"] == "ideal" ): ?>
193
+ <div class="columns three a">
194
+ <label><?php echo $this->__('Bank account holder name') ?></label>
195
+ <span><?php echo $recurringDetails["bank_ownerName"]; ?></span>
196
+ </div>
197
+ <div class="columns three b">
198
+ <label><?php echo $this->__('IBAN') ?></label>
199
+ <span><?php echo $recurringDetails["bank_iban"]; ?></span>
200
+ </div>
201
+ <div class="columns three c">
202
+ <label><?php echo $this->__('Country') ?></label>
203
+ <span><?php echo $recurringDetails["bank_countryCode"]; ?></span>
204
+ </div>
205
+ <?php endif;?>
206
+ </li>
207
+ </ul>
208
+ </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
 
app/design/frontend/base/default/template/adyen/form/openinvoice.phtml CHANGED
@@ -26,12 +26,16 @@
26
  */
27
  ?>
28
  <?php //TODO add a form to add data here, currently only on Adyen. ?>
29
- <?php $_code = $this->getMethodCode(); ?>
 
 
 
30
  <fieldset class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none">
31
  <ul>
32
 
33
  <?php if($this->genderShow()):?>
34
- <li><label for="gender" class="required"><em>*</em><?php echo $this->__('Gender') ?></label>
 
35
  <div class="input-box">
36
  <select id="gender" name="payment[gender]" title="<?php echo $this->__('Gender') ?>" class="validate-select">
37
  <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions();?>
@@ -45,57 +49,22 @@
45
  <?php endif; ?>
46
 
47
  <?php if($this->dobShow()):?>
48
- <li>
49
- <label for="month" class="required"><em>*</em><?php echo $this->__('Date of Birth') ?></label>
50
- <div class="input-box customer-dob">
51
- <?php
52
- $this->setDateInput('d',
53
- '<div class="dob-day">
54
- <input type="text" id="day" name="payment[day]" value="' . $this->getDay() . '" title="' . $this->__('Day') . '" class="input-text validate-custom" />
55
- <label for="' . $this->getFieldId('day') . '">' . $this->__('DD') . '</label>
56
- </div>'
57
- );
58
-
59
- $this->setDateInput('m',
60
- '<div class="dob-month">
61
- <input type="text" id="month" name="payment[month]" value="' . $this->getMonth() . '" title="' . $this->__('Month') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
62
- <label for="' . $this->getFieldId('month') . '">' . $this->__('MM') . '</label>
63
- </div>'
64
- );
65
-
66
- $this->setDateInput('y',
67
- '<div class="dob-year">
68
- <input type="text" id="year" name="payment[year]" value="' . $this->getYear() . '" title="' . $this->__('Year') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
69
- <label for="' . $this->getFieldId('year') . '">' . $this->__('YYYY') . '</label>
70
- </div>'
71
- );
72
- ?>
73
- <?php echo $this->getSortedDateInputs() ?>
74
- <div class="dob-full" style="display:none;">
75
- <input type="hidden" id="dob" name="payment[dob]" />
76
- </div>
77
 
78
- <div class="validation-advice" style="display:none;"></div>
79
- </div>
80
- <script type="text/javascript">
81
- //<![CDATA[
82
- var customer_dob = new Varien.DOB('.customer-dob', true, '<?php echo $this->getDateFormat() ?>');
83
- //]]>
84
- </script>
85
  </li>
86
  <?php endif; ?>
87
  <?php if($this->telephoneShow()):?>
88
  <li class="fields">
89
- <div class="field">
90
- <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
91
  <div class="input-box">
92
  <input type="tel" name="payment[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
93
  </div>
94
- </div>
95
  </li>
96
  <?php endif; ?>
97
 
98
- <li>
99
  <?php echo $this->__('You will be redirected to Adyen website when you place an order.') ?>
100
  </li>
101
  </ul>
26
  */
27
  ?>
28
  <?php //TODO add a form to add data here, currently only on Adyen. ?>
29
+ <?php
30
+ /** @var Adyen_Payment_Block_Form_Openinvoice $this */
31
+ $_code = $this->getMethodCode();
32
+ ?>
33
  <fieldset class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none">
34
  <ul>
35
 
36
  <?php if($this->genderShow()):?>
37
+ <li class="fields">
38
+ <label for="gender" class="required"><?php echo $this->__('Gender') ?> <em class="required">*</em></label>
39
  <div class="input-box">
40
  <select id="gender" name="payment[gender]" title="<?php echo $this->__('Gender') ?>" class="validate-select">
41
  <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions();?>
49
  <?php endif; ?>
50
 
51
  <?php if($this->dobShow()):?>
52
+ <li class="fields">
53
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ <?php echo $_dob->setDate($this->getDate())->setFieldIdFormat($_code.':%s')->setFieldNameFormat('payment[%s]')->toHtml() ?>
 
 
 
 
 
 
56
  </li>
57
  <?php endif; ?>
58
  <?php if($this->telephoneShow()):?>
59
  <li class="fields">
60
+ <label for="billing:telephone" class="required"><?php echo $this->__('Telephone') ?> <em class="required">*</em></label>
 
61
  <div class="input-box">
62
  <input type="tel" name="payment[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
63
  </div>
 
64
  </li>
65
  <?php endif; ?>
66
 
67
+ <li class="fields">
68
  <?php echo $this->__('You will be redirected to Adyen website when you place an order.') ?>
69
  </li>
70
  </ul>
app/design/frontend/base/default/template/adyen/form/pos.phtml CHANGED
@@ -32,5 +32,21 @@
32
  <li>
33
  <?php echo $this->__('You will be redirected to Adyen app when you place an order.') ?>
34
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  </ul>
36
  </fieldset>
32
  <li>
33
  <?php echo $this->__('You will be redirected to Adyen app when you place an order.') ?>
34
  </li>
35
+ <?php if($this->showRememberThisCheckoutbox()): ?>
36
+ <li id="adyen-remember-these-details" class="adyen_payment_input_fields">
37
+ <div class="input-box">
38
+ <div class="v-fix">
39
+ <input type="checkbox" name="payment[store_cc]" id="<?php echo $_code ?>_store_cc" value="1" checked />
40
+ <label for="<?php echo $_code ?>_store_cc" class="required"><em>*</em><?php echo $this->__('Remember these details') ?></label>
41
+ </div>
42
+ </div>
43
+ </li>
44
+ <script type="text/javascript">
45
+ // don't show save cc for quest checkout. Only possible to detect with javascript
46
+ if ($('login:guest') && $('login:guest').checked) {
47
+ $('adyen-remember-these-details').hide();
48
+ }
49
+ </script>
50
+ <?php endif; ?>
51
  </ul>
52
  </fieldset>
app/design/frontend/base/default/template/adyen/form/sepa.phtml CHANGED
@@ -24,12 +24,12 @@
24
  * @property Adyen B.V
25
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
  */
27
- $_code=$this->getMethodCode();
 
28
  ?>
29
  <fieldset class="form-list">
30
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
31
-
32
- <li>
33
  <div class="input-box">
34
  <label for="<?php echo $_code ?>_account_number"><?php echo $this->__('Bank account holder name') ?> <span class="required">*</span></label><br />
35
  <input
@@ -40,10 +40,10 @@ $_code=$this->getMethodCode();
40
  />
41
  </div>
42
  </li>
43
- <li>
44
  <div class="input-box">
45
  <label for="<?php echo $_code ?>_iban"><?php echo $this->__('IBAN') ?> <span class="required">*</span></label><br />
46
- <input
47
  type="text" id="<?php echo $_code ?>_iban" name="payment[iban]"
48
  title="<?php echo $this->__('IBAN') ?>"
49
  class="validate-ipayment-sepa-iban required-entry input-text"
@@ -51,8 +51,8 @@ $_code=$this->getMethodCode();
51
  />
52
  </div>
53
  </li>
54
-
55
- <li>
56
  <div class="input-box">
57
  <label for="<?php echo $_code ?>_country"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
58
  <select id="<?php echo $_code ?>_country" name="payment[country]" name="payment[country]" title="<?php echo $this->__('Country') ?>" class="validate-ipayment-sepa-country required-entry input-√√√">
24
  * @property Adyen B.V
25
  * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
  */
27
+ $_code = $this->getMethodCode();
28
+ /** @var $this Adyen_Payment_Block_Form_Sepa */
29
  ?>
30
  <fieldset class="form-list">
31
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
32
+ <li class="no-agreement">
 
33
  <div class="input-box">
34
  <label for="<?php echo $_code ?>_account_number"><?php echo $this->__('Bank account holder name') ?> <span class="required">*</span></label><br />
35
  <input
40
  />
41
  </div>
42
  </li>
43
+ <li class="no-agreement">
44
  <div class="input-box">
45
  <label for="<?php echo $_code ?>_iban"><?php echo $this->__('IBAN') ?> <span class="required">*</span></label><br />
46
+ <input
47
  type="text" id="<?php echo $_code ?>_iban" name="payment[iban]"
48
  title="<?php echo $this->__('IBAN') ?>"
49
  class="validate-ipayment-sepa-iban required-entry input-text"
51
  />
52
  </div>
53
  </li>
54
+
55
+ <li class="no-agreement">
56
  <div class="input-box">
57
  <label for="<?php echo $_code ?>_country"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
58
  <select id="<?php echo $_code ?>_country" name="payment[country]" name="payment[country]" title="<?php echo $this->__('Country') ?>" class="validate-ipayment-sepa-country required-entry input-√√√">
app/design/frontend/base/default/template/adyen/info/cc.phtml CHANGED
@@ -29,6 +29,9 @@
29
  if ($_info = $this->getInfo()) {
30
  if ($this->isCseEnabled()) {
31
  echo "Adyen Credit Card";
 
 
 
32
  }
33
  else {
34
  echo $this->__('Name on the Card: %s', $this->htmlEscape($_info->getCcOwner()))."<br/>";
29
  if ($_info = $this->getInfo()) {
30
  if ($this->isCseEnabled()) {
31
  echo "Adyen Credit Card";
32
+ if($this->hasInstallments()):
33
+ echo "<br />" . $this->__('Installments: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('number_of_installments')))."<br/>";
34
+ endif;
35
  }
36
  else {
37
  echo $this->__('Name on the Card: %s', $this->htmlEscape($_info->getCcOwner()))."<br/>";
app/design/frontend/base/default/template/adyen/info/pay_by_mail.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adyen Payment Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Adyen
16
+ * @package Adyen_Payment
17
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ /**
21
+ * @category Payment Gateway
22
+ * @package Adyen_Payment
23
+ * @author Adyen
24
+ * @property Adyen B.V
25
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
26
+ */
27
+ ?>
28
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?><br/>
29
+ <?php if(!$this->inCheckout()):?>
30
+ <a target="_blank" href="<?php echo $this->getMethod()->getInfoInstance()->getAdditionalInformation('payment_url'); ?>">Click here to pay for your purchase</a>
31
+ <?php endif; ?>
app/design/frontend/base/default/template/adyen/pos_express_checkout.phtml CHANGED
@@ -28,27 +28,143 @@
28
  ?>
29
  <?php if($this->hasExpressCheckout() || $this->hasCashExpressCheckout() ): ?>
30
 
31
- <div id="adyen-checkout-wrapper">
32
- <form action="<?php echo $this->getUrl("adyen/checkoutPos", array('_secure'=>true)); ?>" method="post">
33
- <input style="width:250px;" type="text" class="input-text" name="adyenPosEmail" id="adyenPosEmail" value="" size="60" placeholder="Email" autocapitalize="off"/>
34
-
35
- <?php if($this->hasExpressCheckout()): ?>
36
- <button id="CheckoutWithPos" style="" type="submit" title="Checkout with POS" class="button btn-proceed-checkout btn-checkout adyen-checkout-button">
37
- <span><span>Checkout with POS</span></span>
38
- </button>
39
- <?php endif; ?>
40
 
41
- </form>
42
 
43
- <form action="<?php echo $this->getUrl("adyen/checkoutCash", array('_secure'=>true)); ?>" method="post">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  <?php if($this->hasCashExpressCheckout()): ?>
45
- <button id="CheckoutWithCash" style="" type="submit" title="Checkout with Cash" class="button btn-proceed-checkout btn-checkout adyen-checkout-button">
46
- <span><span>Checkout with Cash</span></span>
47
- </button>
 
 
 
 
48
  <?php endif; ?>
49
- </form>
50
- </div>
51
 
52
- <div>-OR-</div>
 
 
53
 
54
  <?php endif; ?>
28
  ?>
29
  <?php if($this->hasExpressCheckout() || $this->hasCashExpressCheckout() ): ?>
30
 
 
 
 
 
 
 
 
 
 
31
 
 
32
 
33
+ <div id="adyen-checkout-wrapper">
34
+ <form class="form-list" action="<?php echo $this->getUrl("adyen/checkoutPos", array('_secure'=>true)); ?>" method="post">
35
+
36
+
37
+ <div class="adyenExpressCheckoutBlockLeft">
38
+ <input style="width:240px;" type="text" class="input-text" name="adyenPosEmail" id="adyenPosEmail" value="<?php echo $this->getEmailAddressShopper(); ?>" size="60" placeholder="Email" autocapitalize="off" autocomplete="off"/>
39
+
40
+
41
+ <div id="autocomplete_choices" class="adyenAutocomplete" style="display: none;"></div>
42
+
43
+ <div class="input-box">
44
+ <div class="v-fix">
45
+ <input type="checkbox" class="checkbox" name="adyenPosSaveCard" id="adyenPosSaveCard" checked/>
46
+ <label for="adyenPosSaveCard"><?php echo $this->__('Save Card'); ?></label>
47
+ </div>
48
+ </div>
49
+
50
+ <div id="adyenEmailLoader" class="autocomplete-indicator" style="display: none;">
51
+ <img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading...') ?>" class="v-middle"/>
52
+ </div>
53
+
54
+ <div id="AdyenAccountInfo"></div>
55
+ </div>
56
+
57
+ <?php if($this->hasExpressCheckout() && $this->inKioskMode() != "1"): ?>
58
+
59
+ <script type="text/javascript">
60
+ $('adyenPosEmail').observe('change', getCustomerFromEmail);
61
+
62
+ new Ajax.Autocompleter(
63
+ 'adyenPosEmail',
64
+ 'autocomplete_choices',
65
+ '<?php echo $this->getUrl('adyen/checkoutPos/getCustomerEmail') ?>',
66
+ {
67
+ paramName:"email",
68
+ minChars:2,
69
+ indicator:"adyenEmailLoader",
70
+ evalJSON:'force',
71
+ afterUpdateElement : getSelectionId
72
+ }
73
+ );
74
+
75
+ function getSelectionId(text, li) {
76
+ // strip of customer- to get the id
77
+ var id = li.id;
78
+ var customerId = id.replace("customer-", "");
79
+ getCustomerFromEmailAjaxCall(null, customerId);
80
+ }
81
+
82
+ function getCustomerFromEmail(event) {
83
+ getCustomerFromEmailAjaxCall(this.value, null);
84
+ }
85
+
86
+ function getCustomerFromEmailAjaxCall(email, customerId) {
87
+
88
+ var url = '<?php echo $this->getUrl('adyen/checkoutPos/validateCustomerByEmail', array('_secure'=>true));?>';
89
+
90
+ ajaxReq = new Ajax.Request(url, {
91
+ parameters: {email: email, customerId: customerId, isAjax: 1, method: 'POST'},
92
+ onSuccess: function(transport) {
93
+
94
+ if(transport.status == 200) {
95
+ var json = transport.responseText.evalJSON();
96
+ if(json) {
97
+
98
+ var text = "<div class=\"AdyenShopperDetails\"><h3><?php echo $this->__('Shopper Details') ?>:</h3>";
99
+ text += "<?php echo $this->__('Firstname'); ?>: " + json.customerData.firstname;
100
+ text+= "<br />";
101
+ text += "<?php echo $this->__('Lastname'); ?>: " + json.customerData.lastname;
102
+ text += "</div>";
103
+
104
+ <?php if($this->showExpressCheckoutRecurringCards()): ?>
105
+ var savedCards = false;
106
+ if(json.recurringCards) {
107
+ text += "<div class=\"AdyenSavedCards\"><h3><?php echo $this->__('Saved cards') ?>:</h3>";
108
+ for (var i=0;i<json.recurringCards.length;i++)
109
+ {
110
+ if(json.recurringCards[i].card_number)
111
+ {
112
+ savedCards = true;
113
+ var variant = json.recurringCards[i].variant;
114
+ var imageUrl = '<?php echo $this->getSkinUrl("images/adyen/elv.png"); ?>';
115
+ imageUrl = imageUrl.replace("elv", variant);
116
+ var html = '<div class="creditcard-block">';
117
+ html += '<a href="<?php echo $this->getUrl('adyen/checkoutPos', array('_secure'=>true));?>?recurringDetailReference=' + json.recurringCards[i].recurringDetailReference + '&customerId=' + json.customerData.entity_id + '">';
118
+ html += '<img src="'+ imageUrl + '" alt="' + variant + '" label="' + variant + '" />';
119
+ html += '</a>';
120
+ html += ' **** ' + json.recurringCards[i].card_number;
121
+ html += '</div>';
122
+ text += html;
123
+ }
124
+ }
125
+ if(savedCards == false) {
126
+ text += "<div><?php echo $this->__('There are no saved cards for this account.');?></div>";
127
+ }
128
+ text += "</div>";
129
+ }
130
+ <?php endif; ?>
131
+ $('AdyenAccountInfo').update(text);
132
+
133
+ } else {
134
+ $('AdyenAccountInfo').update("<?php echo $this->__('This is a new Customer'); ?>");
135
+ }
136
+ }
137
+ },
138
+ onFailure: function(){
139
+ alert('<?php echo $this->jsQuoteEscape($this->__('Server Error. Please try again.')) ?>');
140
+ }
141
+ });
142
+ }
143
+ </script>
144
+
145
+ <?php endif; ?>
146
+
147
+
148
+ <?php if($this->hasExpressCheckout()): ?>
149
+ <button id="CheckoutWithPos" style="" type="submit" title="<?php echo $this->__($this->getExpressCheckoutTitle()); ?>" class="button btn-proceed-checkout btn-checkout adyen-checkout-button">
150
+ <span><span><?php echo $this->__($this->getExpressCheckoutTitle()); ?></span></span>
151
+ </button>
152
+ <?php endif; ?>
153
+
154
+ </form>
155
+
156
  <?php if($this->hasCashExpressCheckout()): ?>
157
+ <form id="AdyenFormCheckoutWithCash" action="<?php echo $this->getUrl("adyen/checkoutCash", array('_secure'=>true)); ?>" method="post">
158
+
159
+ <button id="CheckoutWithCash" style="" type="submit" title="<?php echo $this->__($this->getCashExpressCheckoutTitle()); ?>" class="button btn-proceed-checkout btn-checkout adyen-checkout-button">
160
+ <span><span><?php echo $this->__($this->getCashExpressCheckoutTitle()); ?></span></span>
161
+ </button>
162
+
163
+ </form>
164
  <?php endif; ?>
 
 
165
 
166
+ </div>
167
+
168
+ <div>-OR-</div>
169
 
170
  <?php endif; ?>
app/design/frontend/base/default/template/adyen/saved_cards.phtml CHANGED
@@ -55,31 +55,84 @@
55
  <div class="creditcard-block">
56
  <?php
57
  $_bankFile = $value["variant"];
58
- $_filename = Mage::getBaseDir().DS.'skin'.DS.'frontend'.DS.'base'.DS.'default'.DS.'images'.DS.'adyen'.DS. $_bankFile ."_small.png";
 
 
 
59
 
60
  ?>
61
- <?php if (file_exists($_filename)){ ?>
62
- <img src="<?php echo $this->getSkinUrl('images/adyen/' . $_bankFile . "_small.png") ?>" alt="<?php echo $_bankFile ?>" label="<?php echo $_bankFile ?>" />
63
- <?php } ?>
64
 
 
65
 
66
- <div class="columns three a">
67
- <label><?php echo $this->__('Credit Card Number') ?></label>
68
- <span>****</span> <?php echo $value["card_number"]; ?>
69
- </div>
70
 
71
- <div class="columns three b">
72
- <label><?php echo $this->__('Expiration Date') ?><a href="#" id="update-expiration-date-<?php echo $key; ?>" class="update-expiration-date" style="display:none;"><?php echo $this->__('(update)') ?></a></label>
 
 
 
 
 
 
 
 
 
 
73
 
74
- <div id="static-card-expiry-<?php echo $key; ?>" class="static-card-expiry">
75
- <?php echo $value["card_expiryMonth"] . " /" . $value["card_expiryYear"]; ?>
76
  </div>
77
 
78
- </div>
79
 
80
- <div style="clear:both;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
- <div class="creditcard-holder-name"><?php echo $value["card_holderName"]; ?></div>
83
 
84
  <button type="submit" title="Add to Cart" class="button btn-cart btn-delete"><span><span><?php echo $this->__('Remove Card');?></span></span></button>
85
 
55
  <div class="creditcard-block">
56
  <?php
57
  $_bankFile = $value["variant"];
58
+ $_filename = Mage::getDesign()->getFilename("images/adyen/{$_bankFile}.png", array('_type' => 'skin'));
59
+ $imageUrl = file_exists($_filename)
60
+ ? $this->getSkinUrl("images/adyen/{$_bankFile}.png")
61
+ : $this->getSkinUrl("images/adyen/img_trans.gif");
62
 
63
  ?>
 
 
 
64
 
65
+ <img src="<?php echo $imageUrl; ?>" alt="<?php echo $_bankFile ?>" label="<?php echo $_bankFile ?>" />
66
 
 
 
 
 
67
 
68
+ <?php if(isset($value["card_number"]) && isset($value["card_expiryMonth"]) && isset($value["card_expiryYear"]) ): ?>
69
+ <div class="columns three a">
70
+ <label><?php echo $this->__('Credit Card Number') ?></label>
71
+ <span>****</span> <?php echo $value["card_number"]; ?>
72
+ </div>
73
+
74
+ <div class="columns three b">
75
+ <label><?php echo $this->__('Expiration Date') ?><a href="#" id="update-expiration-date-<?php echo $key; ?>" class="update-expiration-date" style="display:none;"><?php echo $this->__('(update)') ?></a></label>
76
+
77
+ <div id="static-card-expiry-<?php echo $key; ?>" class="static-card-expiry">
78
+ <?php echo $value["card_expiryMonth"] . " /" . $value["card_expiryYear"]; ?>
79
+ </div>
80
 
 
 
81
  </div>
82
 
83
+ <div style="clear:both;"></div>
84
 
85
+ <div class="creditcard-holder-name"><?php echo $value["card_holderName"]; ?></div>
86
+
87
+ <?php elseif($value["variant"] == "elv"): ?>
88
+
89
+ <div class="columns three a">
90
+ <label><?php echo $this->__('Account Number') ?></label>
91
+ <span><?php echo $value["elv_bankAccountNumber"]; ?></span>
92
+ </div>
93
+
94
+ <div class="columns three b">
95
+ <label><?php echo $this->__('Bank Name') ?></label>
96
+ <span><?php echo $value["elv_bankName"]; ?></span>
97
+ </div>
98
+
99
+ <div style="clear:both;"></div>
100
+
101
+ <div class="creditcard-holder-name"><?php echo $value["elv_bankName"]; ?></div>
102
+
103
+ <?php elseif($value["variant"] == "openinvoice"): ?>
104
+
105
+ <div class="columns three a">
106
+ <label><?php echo $this->__('Account Number') ?></label>
107
+ <span><?php echo $value["bank_bankAccountNumber"]; ?></span>
108
+ </div>
109
+
110
+ <div class="columns three b">
111
+ <label><?php echo $this->__('Country') ?></label>
112
+ <span><?php echo $value["bank_countryCode"]; ?></span>
113
+ </div>
114
+
115
+ <div style="clear:both;"></div>
116
+
117
+ <div class="creditcard-holder-name"><?php echo $value["bank_ownerName"]; ?></div>
118
+
119
+ <?php elseif($value["variant"] == "sepadirectdebit" || $value["variant"] == "ideal" ): ?>
120
+
121
+ <div class="columns three a">
122
+ <label><?php echo $this->__('IBAN') ?></label>
123
+ <span><?php echo $value["bank_iban"]; ?></span>
124
+ </div>
125
+
126
+ <div class="columns three b">
127
+ <label><?php echo $this->__('Country') ?></label>
128
+ <span><?php echo $value["bank_countryCode"]; ?></span>
129
+ </div>
130
+
131
+ <div style="clear:both;"></div>
132
+
133
+ <div class="creditcard-holder-name"><?php echo $value["bank_ownerName"]; ?></div>
134
 
135
+ <?php endif; ?>
136
 
137
  <button type="submit" title="Add to Cart" class="button btn-cart btn-delete"><span><span><?php echo $this->__('Remove Card');?></span></span></button>
138
 
app/locale/fr_FR/Adyen_Payment.csv CHANGED
@@ -32,7 +32,7 @@
32
  "Credit Card Number","Numéro de la carte"
33
  "Credit Card Number: xxxx-%s","Numéro de la carte: xxxx-%s"
34
  "Credit Card Type", "Type de carte"
35
- "Credit Card Type: %s", ,"Type de carte: %s"
36
  "Expiration Date","Date d'expiration"
37
  "Expiration Date: %s/%s","Date d'expiration: %s/%s"
38
  "Name on Card","Nom sur la carte"
32
  "Credit Card Number","Numéro de la carte"
33
  "Credit Card Number: xxxx-%s","Numéro de la carte: xxxx-%s"
34
  "Credit Card Type", "Type de carte"
35
+ "Credit Card Type: %s","Type de carte: %s"
36
  "Expiration Date","Date d'expiration"
37
  "Expiration Date: %s/%s","Date d'expiration: %s/%s"
38
  "Name on Card","Nom sur la carte"
app/locale/nl_NL/Adyen_Payment.csv CHANGED
@@ -1,4 +1,4 @@
1
- "You will be redirected to Adyen website when you place an order.", "U wordt doorgestuurd naar de Adyen website bij het plaatsen van uw order."
2
  "%s ( Qty: %s ) (Price: %s %s ) <br />","%s ( Aantal: %s ) (Prijs: %s %s ) <br />"
3
  "Adyen %s <br /> authResult: %s <br /> pspReference: %s"
4
  "Adyen %s <br /> eventCode: %s <br /> pspReference: %s <br /> success: %s"
@@ -14,44 +14,49 @@
14
  "Shipment cost: %s %s <br />","Verzendkosten: %s %s <br />"
15
  "System error, please try again later","Systeem error. Probeer het later nog eens."
16
  "System error, please try again later: %s", "Systeem error. Probeer het later nog eens: %s"
17
- "The payment is REFUSED by Adyen.", "Betaalmethode is TEGENGEHOUDEN door Adyen."
18
- "You will be redirected to Adyen in a few seconds.", "U wordt doorgestuurd naar Adyen."
19
- "Your payment failed, Please try again later","Betaalmethode niet geslaagd. Probeer het later nog eens."
 
 
20
  "--Please Select--","--Selecteren--"
21
- "Account Number","Account nummmer"
22
  "Account holder name","Account houder naam"
23
  "Account holder: %s","Account houder: %s"
24
  "Account number: xxx%s","Account nummer: xxx%s"
25
- "Bank Location","Bank locatie"
26
- "Bank Location (City)","Bank locatie (Stad)"
27
  "Bank Location ID","Bank locatie ID"
28
- "Bank Name","Bank naam"
29
- "Bank code: %s"
30
- "Bank name: %s","Bank naam: %s"
31
- "Card Verification Number","Kaart verificatie nummer CVC"
32
  "Credit Card Number","Credit Card Nummer"
33
  "Credit Card Number: xxxx-%s","Credit Card Nummer: xxxx-%s"
34
- "Credit Card Type"
35
- "Credit Card Type: %s"
36
- "Expiration Date","Expiratie datum"
37
- "Expiration Date: %s/%s","Expiratie Datum: %s/%s"
38
  "Name on Card","Naam op de kaart"
39
  "Name on the Card: %s","Naam op de kaart: %s"
40
  "Payment Method: %s","Betaalmethode: %s"
41
  "Submitting payment information...","Betaalinformatie wordt verzonden..."
42
  "What is this?","Wat is dit?"
43
- "Order email sent to shopper.","Bevestingsemail is verzonden aan klant."
44
- "The payment is PENDING by Adyen.","Betaling PENDING by Adyen."
45
- "The payment is AUTHORIZED by Adyen.","Betaling AUTHORIZED by Adyen."
46
- "There has an error occurred with your Adyen payment.","Er is een probleem met uw betaling bij Adyen."
47
- "There was an error with your payment.","Uw betaling is niet afgerond."
48
- "You will be redirected to Adyen website when you place an order.","U wordt doorgestuurd naar de Adyen bij het plaatsen van uw order."
49
  "Your payment is cancelled.","Betaling geannuleerd."
50
  "Your payment is CANCELLED","Betaling geannuleerd."
51
  "Your payment is pending.","Betaling wordt verwerkt."
52
  "Your payment is refused.","Betaling tegengehouden."
53
  "Your payment is authorized.","Betaling bevestigd."
54
  "Remember these details","Onthoud deze gegevens"
55
- "Choose Your Bank","Kies je bank"
56
- "You chose an invalid bank","De bank moet nog ingevuld worden"
57
- "You have cancelled the order. Please try again", "Je hebt de betaling geannuleerd. Probeer het nogmaals"
 
 
 
1
+ "You will be redirected to Adyen website when you place an order.", "U wordt doorgestuurd naar de Adyen website bij het plaatsen van uw bestelling."
2
  "%s ( Qty: %s ) (Price: %s %s ) <br />","%s ( Aantal: %s ) (Prijs: %s %s ) <br />"
3
  "Adyen %s <br /> authResult: %s <br /> pspReference: %s"
4
  "Adyen %s <br /> eventCode: %s <br /> pspReference: %s <br /> success: %s"
14
  "Shipment cost: %s %s <br />","Verzendkosten: %s %s <br />"
15
  "System error, please try again later","Systeem error. Probeer het later nog eens."
16
  "System error, please try again later: %s", "Systeem error. Probeer het later nog eens: %s"
17
+ "The payment is REFUSED by Adyen.", "Betaalmethode is AFGEWEZEN door Adyen."
18
+ "The transaction is not permitted.", "De transactie is niet toegestaan"
19
+ "Declined due to the Card Security Code(CVC) being incorrect. Please check your CVC code!", "De betaling is afgewezen in verband met een verkeerde Kaart verificatie nummer(CVC). Controleer of u de juiste CVC nummer hebt ingevoerd!"
20
+ "The card is restricted.", "De kaart is niet geschikt."
21
+ "You will be redirected to Adyen in a few seconds.", "U wordt binnen enkele momenten doorgestuurd naar Adyen."
22
  "--Please Select--","--Selecteren--"
23
+ "Account Number","Accountnummer"
24
  "Account holder name","Account houder naam"
25
  "Account holder: %s","Account houder: %s"
26
  "Account number: xxx%s","Account nummer: xxx%s"
27
+ "Bank Location","Locatie Bank"
28
+ "Bank Location (City)","Locatie Bank (Stad)"
29
  "Bank Location ID","Bank locatie ID"
30
+ "Bank Name","Banknaam"
31
+ "Bank code: %s", "Bank code %s"
32
+ "Bank name: %s","Banknaam: %s"
33
+ "Card Verification Number","Kaart verificatie nummer"
34
  "Credit Card Number","Credit Card Nummer"
35
  "Credit Card Number: xxxx-%s","Credit Card Nummer: xxxx-%s"
36
+ "Credit Card Type","Soort Credit Card"
37
+ "Credit Card Type: %s", "Credit Card Type: %s"
38
+ "Expiration Date","Verloopdatum"
39
+ "Expiration Date: %s/%s","ExpirVerloopdatum: %s/%s"
40
  "Name on Card","Naam op de kaart"
41
  "Name on the Card: %s","Naam op de kaart: %s"
42
  "Payment Method: %s","Betaalmethode: %s"
43
  "Submitting payment information...","Betaalinformatie wordt verzonden..."
44
  "What is this?","Wat is dit?"
45
+ "Order email sent to shopper.","Bevestingsmail is verzonden naar de klant."
46
+ "The payment is PENDING by Adyen.","Betaling IN AFWACHTING by Adyen."
47
+ "The payment is AUTHORIZED by Adyen.","Betaling GEAUTORISEERD by Adyen."
48
+ "There has an error occurred with your Adyen payment.","Er is een probleem opgetreden met uw Adyen betaling."
49
+ "There was an error with your payment.","Er is een probleem opgetreden met uw betaling."
50
+ "You will be redirected to Adyen website when you place an order.","U wordt doorgestuurd naar de website van Adyen bij het plaatsen van uw bestelling."
51
  "Your payment is cancelled.","Betaling geannuleerd."
52
  "Your payment is CANCELLED","Betaling geannuleerd."
53
  "Your payment is pending.","Betaling wordt verwerkt."
54
  "Your payment is refused.","Betaling tegengehouden."
55
  "Your payment is authorized.","Betaling bevestigd."
56
  "Remember these details","Onthoud deze gegevens"
57
+ "Choose Your Bank","Kies uw bank"
58
+ "You chose an invalid bank","U heeft een ongeldige bank geselecteerd."
59
+ "Male","Man"
60
+ "Female","Vrouw"
61
+ "You have cancelled the order. Please try again","U heeft de betaling geannuleerd, probeer het nogmaals."
62
+ "Your payment failed, Please try again later","Deze betaalmethode is niet beschikbaar voor u op het moment. Kies voor andere betaalmethode om de bestelling af te ronden"
js/adyen/payment/cc.js CHANGED
@@ -45,7 +45,7 @@ Cards[16] = new CardType("ELO", "506699,50670,50671,50672,50673,50674,50675,5067
45
  var Elo = Cards[16];
46
  Cards[17] = new CardType("uatp", "1", "15");
47
  var Uatp = Cards[17];
48
- Cards[18] = new CardType("cup", "62", "14,15,16,17,18,19");
49
  var Cup = Cards[18];
50
  Cards[19] = new CardType("cartebancaire", "4,5,6", "16");
51
  var CarteBancaire = Cards[19];
45
  var Elo = Cards[16];
46
  Cards[17] = new CardType("uatp", "1", "15");
47
  var Uatp = Cards[17];
48
+ Cards[18] = new CardType("unionpay", "62", "14,15,16,17,18,19");
49
  var Cup = Cards[18];
50
  Cards[19] = new CardType("cartebancaire", "4,5,6", "16");
51
  var CarteBancaire = Cards[19];
js/adyen/payment/epos-device-3.0.0.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ (function(window,undefined){var socket=null;var ePosC=null;var msgGenerator=null;var deviceInfo=null;var isConnected=false;var ofscCallbackList=new Array();var connectCallback=null;var SOCKET_EVENT_NAME="message";var CONNECT_RESULT_OK="OK";var CONNECT_RESULT_SSL_OK="SSL_CONNECT_OK";var CONNECT_RESULT_ERROR_PARAMETER="ERROR_PARAMETER";var CONNECT_RESULT_ERROR_TIMEOUT="ERROR_TIMEOUT";var ERROR_SYSTEM_ERROR="SYSTEM_ERROR";var ERROR_PARAM_ERROR="PARAM_ERROR";function ePOSDevice(){this.DEVICE_TYPE_SCANNER="type_scanner";this.DEVICE_TYPE_KEYBOARD="type_keyboard";this.DEVICE_TYPE_MSR="type_msr";this.DEVICE_TYPE_CAT="type_cat";this.DEVICE_TYPE_CASH_CHANGER="type_cash_changer";this.DEVICE_TYPE_PRINTER="type_printer";this.DEVICE_TYPE_DISPLAY="type_display";this.DEVICE_TYPE_SCALE="type_scale";this.DEVICE_TYPE_SIMPLE_SERIAL="type_simple_serial";this.DEVICE_TYPE_HYBRID_PRINTER="type_hybrid_printer";this.DEVICE_TYPE_DT="type_dt";this.DEVICE_ID_DT="local_dt";this.CLIENT_DRIVER_SCANNER="Scanner";this.CLIENT_DRIVER_KEYBOARD="Keyboard";this.CLIENT_DRIVER_MSR="MSR";this.CLIENT_DRIVER_CAT="CAT";this.CLIENT_DRIVER_CASH_CHANGER="CashChanger";this.CLIENT_DRIVER_PRINTER="Printer";this.CLIENT_DRIVER_DISPLAY="Display";this.CLIENT_DRIVER_SIMPLE_SERIAL="SimpleSerial";this.CLIENT_DRIVER_HYBRID_PRINTER="HybridPrinter";this.CLIENT_DRIVER_DT="DeviceTerminal";this.ERROR_DEVICE_OPEN_ERROR="DEVICE_OPEN_ERROR";this.ERROR_DEVICE_CLOSE_ERROR="DEVICE_CLOSE_ERROR";this.ERROR_DEVICE_NOT_OPEN="DEVICE_NOT_OPEN";this.ERROR_DEVICE_IN_USE="DEVICE_IN_USE";this.SEQUENCE_INIT_PARAM=1;this.CONNECT_TIMEOUT=15000;this.RECONNECT_INTERVAL=3000;this.RECONNECT_TIMEOUT=15000;this.COOKIE_KEY_CLIENTID="EPSON_EPOSDEVICE_CLIENTID";this.OFSC_SERVICE_ID="OFSC";this.CONNECT_API="CONNECT_API";this.CONNECT_RECONNECT="CONNECT_RECONNECT";this.WEBSOCKET_PORT=8008;this.SSLWEBSOCKET_PORT=8043;socket=null;ePosC=new ePosCrypto();deviceInfo=new clientDeviceInfo();msgGenerator=new clientMessageGenerator();this.cookieIo=new cookieIO;this.utility=new utility;this.adminInfo="";this.locationInfo="";isConnected=false;this.connectProtocol="";this.clientId="";this.connectMode=this.CONNECT_API;this.reconnectTryCount=0;this.reconnectSeqDisconnect=false;this.recievedDataId=0;this.isReconnecting=false;this.sequence=0;this.ipAddress="";this.port="";this.prime="";this.key="";this.onerror=null;this.ondisconnect=null;this.socketList=new Array();this.commBoxManager=null;this.init();var ePosDev=this;window.onbeforeunload=function(){isConnected=false;ePosDev.disconnect()};window.onpagehide=function(){isConnected=false;ePosDev.disconnect()}}ePOSDevice.prototype={init:function(){ePosC=new ePosCrypto();deviceInfo=new clientDeviceInfo();this.adminInfo="";this.locationInfo="";this.clientId="";this.ipAddress="";this.port="";this.prime="";this.key="";this.initSocket();this.initReconnectTimer();this.commBoxManager=new CommBoxManager(this)},initSocket:function(){if(socket==null){return}socket.disconnect();delete socket;socket=null},initReconnectTimer:function(){clearInterval(this.reconnectTimerId);this.reconnectTimerId=null;this.reconnectTryCount=0},setReconnect:function(){if(this.isReconnecting){return}this.isReconnecting=true;this.connectMode=this.CONNECT_RECONNECT;var self=this;this.reconnectTimerId=setInterval(function(){if(socket!=null){self.clearListeners();self.socketList.push(self.utility.clone(socket));self.initSocket()}if(self.reconnectTryCount>=(self.RECONNECT_TIMEOUT/self.RECONNECT_INTERVAL)){isConnected=false;self.isReconnecting=false;self.init();if(self.ondisconnect!=null){self.ondisconnect()}return}var url=self.ipAddress+":"+self.port;self.socketConnect(url,true);self.reconnectTryCount++},this.RECONNECT_INTERVAL);if(this.reconnectTryCount==0){if(this.onreconnecting!=null){this.onreconnecting()}}},connect:function(ipAddress,port,callback){if(socket!=null){var clientId=this.clientId;this.clientId="";if(clientId!=""){var command=msgGenerator.getDisconnect({client_id:clientId});socket.emit(SOCKET_EVENT_NAME,command)}this.clearListeners();this.socketList.push(this.utility.clone(socket));this.initSocket();if((isConnected)&&(this.ondisconnect!=null)){this.ondisconnect()}isConnected=false}this.isReconnecting=false;this.init();this.connectMode=this.CONNECT_API;this.ipAddress=ipAddress;this.port=port;connectCallback=callback;var url="";if(this.ipAddress.match(/^(http:\u002f\u002f)/)){url=this.ipAddress+":"+this.port;this.connectProtocol="http"}else{if(this.ipAddress.match(/^(https:\u002f\u002f)/)){url=this.ipAddress+":"+this.port;this.connectProtocol="https"}else{var port=Number(this.port);switch(port){case this.WEBSOCKET_PORT:url="http://"+this.ipAddress+":"+this.port;this.connectProtocol="http";break;case this.SSLWEBSOCKET_PORT:url="https://"+this.ipAddress+":"+this.port;this.connectProtocol="https";break;default:url="http://"+this.ipAddress+":"+this.port;this.connectProtocol="http";break}}}this.socketConnect(url,false);return},socketConnect:function(url,isReconnect){var timeout=this.CONNECT_TIMEOUT;if(isReconnect){timeout=this.RECONNECT_INTERVAL}socket=io.connect(url,{reconnect:false,"connect timeout":timeout,"force new connection":true});var self=this;socket.on("connect",function(data){try{isConnected=true;for(var i=0;i<self.socketList.length;i++){var oldSocket=self.socketList[i];oldSocket.disconnect()}}catch(e){}});socket.on("close",function(){try{isConnected=false}catch(e){}});socket.on("disconnect",function(data){try{if(self.isReconnecting){return}if(self.isApiDisconnect()){isConnected=false;self.init();if(self.ondisconnect!=null){self.ondisconnect()}}else{self.setReconnect()}}catch(e){}});socket.on("error",function(){try{isConnected=false;if(connectCallback!=null){connectCallback(CONNECT_RESULT_ERROR_PARAMETER);initConnectCallback()}}catch(e){}});socket.on("connect_failed",function(){try{isConnected=false;if(connectCallback!=null){connectCallback(CONNECT_RESULT_ERROR_TIMEOUT);initConnectCallback()}}catch(e){}});socket.on(SOCKET_EVENT_NAME,function(recvData){var SOCKET_COMMAND_CONNECT="connect";var SOCKET_COMMAND_RECONNECT="reconnect";var SOCKET_COMMAND_DISCONNECT="disconnect";var SOCKET_COMMAND_PUBKEY="pubkey";var SOCKET_COMMAND_ADMININFO="admin_info";var SOCKET_COMMAND_OPENDEVICE="open_device";var SOCKET_COMMAND_CLOSEDEVICE="close_device";var SOCKET_COMMAND_DATA="device_data";var SOCKET_COMMAND_SERVICE="service_data";var SOCKET_COMMAND_ERROR="error";var SOCKET_COMMAND_OPENCOMM="open_commbox";var SOCKET_COMMAND_CLOSECOMM="close_commbox";var SOCKET_COMMAND_COMMDATA="commbox_data";var SOCKET_RESULT_OK="OK";var SOCKET_RESULT_SHAREDKEY_MISMATCH_ERROR="SHARED_KEY_MISMATCH_ERROR";var SOCKET_RESULT_CLIENT_NOT_FOUND="CLIENT_NOT_FOUND";var PUBKEY_TEST_TEXT="hello";if(recvData==null){return}var header=recvData[0];switch(header){case SOCKET_COMMAND_CONNECT:socketCommandConnect(recvData);break;case SOCKET_COMMAND_DISCONNECT:socketCommandDisconnect(recvData);break;case SOCKET_COMMAND_RECONNECT:socketCommandReconnect(recvData);break;case SOCKET_COMMAND_PUBKEY:socketCommandPubkey(recvData);break;case SOCKET_COMMAND_ADMININFO:socketCommandAdminInfo(recvData);break;case SOCKET_COMMAND_OPENDEVICE:socketCommandOpenDevice(recvData);break;case SOCKET_COMMAND_CLOSEDEVICE:socketCommandCloseDevice(recvData);break;case SOCKET_COMMAND_DATA:socketCommandData(recvData);break;case SOCKET_COMMAND_SERVICE:socketCommandService(recvData);break;case SOCKET_COMMAND_ERROR:socketCommandError(recvData);break;case SOCKET_COMMAND_OPENCOMM:socketCommandOpenComm(recvData);break;case SOCKET_COMMAND_CLOSECOMM:socketCommandCloseComm(recvData);break;case SOCKET_COMMAND_COMMDATA:socketCommandCommData(recvData);break;default:break}function socketCommandConnect(recvData){try{var data=recvData[1];self.prime=data.prime;self.key=data.key;var protocol_version=data.protocol_version;var client_id=data.client_id;if(self.connectMode==self.CONNECT_RECONNECT){if(self.reconnectTryCount==0){return}else{self.initReconnectTimer()}}if(protocol_version<2){sendPubkeyInfo(self.prime,self.key);self.setClientId(client_id);return}if(self.clientId!=""){var command=msgGenerator.getReconnect({old_client_id:self.clientId,new_client_id:client_id,received_id:self.recievedDataId});socket.emit(SOCKET_EVENT_NAME,command);self.setClientId(client_id);return}var cookieClientId=self.cookieIo.readCookie(self.COOKIE_KEY_CLIENTID);if(cookieClientId==""){sendPubkeyInfo(self.prime,self.key);self.setClientId(client_id);return}else{self.reconnectSeqDisconnect=true;if(cookieClientId!=""){var command=msgGenerator.getDisconnect({client_id:cookieClientId});socket.emit(SOCKET_EVENT_NAME,command)}self.setClientId(client_id);return}}catch(e){if(connectCallback!=null){connectCallback(e.message);initConnectCallback()}}return}function socketCommandDisconnect(recvData){var result=recvData[1];if(self.reconnectSeqDisconnect){sendPubkeyInfo(self.prime,self.key)}self.reconnectSeqDisconnect=false}function socketCommandReconnect(recvData){try{self.isReconnecting=false;if(self.connectMode!=self.CONNECT_RECONNECT){return}var result=recvData[1];switch(result){case SOCKET_RESULT_OK:if(self.onreconnect!=null){self.onreconnect()}break;case SOCKET_RESULT_CLIENT_NOT_FOUND:isConnected=false;self.init();if(self.ondisconnect!=null){self.ondisconnect()}break;default:throw new Error(result);break}}catch(e){if(self.onerror!=null){self.onerror("0","",e.message,null)}}return}function socketCommandPubkey(recvData){try{var result=recvData[1];if(result==SOCKET_RESULT_SHAREDKEY_MISMATCH_ERROR){throw new Error("")}if(result==ERROR_PARAM_ERROR){throw new Error(ERROR_SYSTEM_ERROR)}sendAdminInfo()}catch(e){var exception=e.message;if((exception==null)||(exception=="")){self.connect(self.ipAddress,self.port,connectCallback)}else{if(connectCallback!=null){connectCallback(exception);initConnectCallback()}}}return}function socketCommandAdminInfo(recvData){try{var result=recvData[1];var data=recvData[2];if(result!=SOCKET_RESULT_OK){throw new Error(result)}self.adminInfo=data.admin_name;self.locationInfo=data.location;if(connectCallback!=null){var code=CONNECT_RESULT_OK;if(self.connectProtocol=="https"){code=CONNECT_RESULT_SSL_OK}connectCallback(code);initConnectCallback()}}catch(e){if(connectCallback!=null){connectCallback(e.message);initConnectCallback()}}return}function socketCommandOpenDevice(recvData){var deviceID="";try{deviceID=recvData[1];var code=recvData[2];if(recvData.length>4){if(recvData[4]!=""){self.recievedDataId=recvData[4]}}var driverObj=null;if(code==SOCKET_RESULT_OK){var driverObj=deviceInfo.getClientDriverObj(deviceID)}var callback=deviceInfo.getResultCallback(deviceID);if(callback!=null){callback(driverObj,code)}if(code!=SOCKET_RESULT_OK){deviceInfo.removeClientDeviceInfo(deviceID)}}catch(e){if(self.onerror!=null){self.onerror("0",deviceID,ERROR_SYSTEM_ERROR,null)}}return}function socketCommandCloseDevice(recvData){var deviceID="";try{deviceID=recvData[1];var code=recvData[2];if(recvData.length>4){if(recvData[4]!=""){self.recievedDataId=recvData[4]}}var callback=deviceInfo.getResultCallback(deviceID);if(callback!=null){callback(code)}if(code==SOCKET_RESULT_OK){deviceInfo.removeClientDeviceInfo(deviceID)}}catch(e){if(self.onerror!=null){self.onerror("0",deviceID,ERROR_SYSTEM_ERROR,null)}}return}function socketCommandData(recvData){var sq="";var deviceID="";try{sq=recvData[1];deviceID=recvData[2];var data=recvData[3];if(recvData.length>4){if(recvData[4]!=""){self.recievedDataId=recvData[4]}}if(deviceInfo.getClientDeviceInfo(deviceID).isCrypto){var strData=ePosC.bfDecrypt(data);data=JSON.parse(strData)}var drvObj=deviceInfo.getClientDeviceInfo(deviceID).driverObj;var method="client_"+data.type;try{try{eval("drvObj."+method+"(data, sq)")}catch(e){eval("drvObj."+data.type+"(data, sq)")}}catch(e){throw new Error("")}}catch(e){if(self.onerror!=null){self.onerror(sq,deviceID,ERROR_SYSTEM_ERROR,null)}}return}function socketCommandService(recvData){var sq="";try{sq=recvData[1];var isCrypto=recvData[3];var data=recvData[4];if(recvData.length>5){if(recvData[5]!=""){self.recievedDataId=recvData[5]}}if(isCrypto=="1"){var strData=ePosC.bfDecrypt(data,sq);data=JSON.parse(strData)}try{ofscCallbackList[0](data.resultdata,sq);ofscCallbackList.splice(0,1)}catch(e){throw new Error("")}}catch(e){if(self.onerror!=null){self.onerror(sq,self.OFSC_SERVICE_ID,ERROR_SYSTEM_ERROR,null)}}return}function socketCommandError(recvData){var sq="";var deviceID="";try{sq=recvData[1];deviceID=recvData[2];var code=recvData[3];var data=recvData[4];if(recvData.length>5){if(recvData[5]!=""){self.recievedDataId=recvData[5]}}if(self.onerror!=null){self.onerror(sq,deviceID,code,data)}}catch(e){if(self.onerror!=null){self.onerror(sq,deviceID,ERROR_SYSTEM_ERROR,null)}}return}function socketCommandOpenComm(recvData){var sq="";var boxID="";try{sq=recvData[1];var data=recvData[2];var boxID=data.box_id;if(recvData.length>3){if(recvData[3]!=""){self.recievedDataId=recvData[3]}}self.commBoxManager.client_opencommbox(data,sq)}catch(e){if(self.onerror!=null){self.onerror(sq,"",ERROR_SYSTEM_ERROR,null)}}return}function socketCommandCloseComm(recvData){var sq="";var boxID="";try{sq=recvData[1];var data=recvData[2];var boxID=data.box_id;if(recvData.length>3){if(recvData[3]!=""){self.recievedDataId=recvData[3]}}self.commBoxManager.client_closecommbox(data,sq)}catch(e){if(self.onerror!=null){self.onerror(sq,"",ERROR_SYSTEM_ERROR,null)}}return}function socketCommandCommData(recvData){var sq="";var boxID="";try{sq=recvData[1];var data=recvData[2];var boxID=data.box_id;if(recvData.length>3){if(recvData[3]!=""){self.recievedDataId=recvData[3]}}self.commBoxManager.executeCommDataCallback(data,sq)}catch(e){if(self.onerror!=null){self.onerror(sq,"",ERROR_SYSTEM_ERROR,null)}}return}function sendPubkeyInfo(prime,key){try{ePosC.genClientKeys(prime,key);var testData=ePosC.bfEncrypt(PUBKEY_TEST_TEXT);var pubkey=bigInt2str(ePosC.pubkey_c,16);var command=msgGenerator.getPubkey(null,{key:pubkey,testData:testData});socket.emit(SOCKET_EVENT_NAME,command)}catch(e){throw new Error(ERROR_SYSTEM_ERROR)}return}function sendAdminInfo(){try{var command=msgGenerator.getAdminInfo(null,{});socket.emit(SOCKET_EVENT_NAME,command)}catch(e){throw new Error(ERROR_SYSTEM_ERROR)}return}function initConnectCallback(){connectCallback=null;return}})},isApiDisconnect:function(){var ret=false;var cookieClientId=this.cookieIo.readCookie(this.COOKIE_KEY_CLIENTID);if((this.clientId=="")&&(cookieClientId=="")){ret=true}return ret},setClientId:function(id){var ret=false;if(id==null){return ret}this.clientId=id;ret=this.cookieIo.writeCookie(this.COOKIE_KEY_CLIENTID,id);return ret},clearListeners:function(){var ret=false;if(socket==null){return ret}socket.removeAllListeners("connect");socket.removeAllListeners("close");socket.removeAllListeners("disconnect");socket.removeAllListeners("error");socket.removeAllListeners("connect_failed");socket.removeAllListeners(SOCKET_EVENT_NAME);ret=true;return(ret)},disconnect:function(){if(socket==null){return}var clientId=this.clientId;this.clientId="";var command=msgGenerator.getDisconnect({client_id:clientId});socket.emit(SOCKET_EVENT_NAME,command);this.clearListeners();this.init();if(this.ondisconnect!=null){this.ondisconnect()}isConnected=false;return(true)},isConnected:function(){return isConnected},getAdmin:function(){return this.adminInfo},getLocation:function(){return this.locationInfo},createDevice:function(deviceID,deviceType,options,callback){try{var isCrypto=false;var isBuffer=null;if(deviceType==this.DEVICE_TYPE_DT){isCrypto=true;deviceID=this.DEVICE_ID_DT}if(typeof(options)=="boolean"){isCrypto=options}else{if(typeof(options.crypto)=="boolean"){isCrypto=options.crypto}if(typeof(options.buffer)=="boolean"){isBuffer=options.buffer}}if(deviceInfo.isExsitClientDeviceInfo(deviceID)){throw new Error(this.ERROR_DEVICE_IN_USE)}if(socket==null){throw new Error(ERROR_SYSTEM_ERROR)}var driverClass="";switch(deviceType){case this.DEVICE_TYPE_SCANNER:driverClass=this.CLIENT_DRIVER_SCANNER;break;case this.DEVICE_TYPE_KEYBOARD:driverClass=this.CLIENT_DRIVER_KEYBOARD;break;case this.DEVICE_TYPE_MSR:driverClass=this.CLIENT_DRIVER_MSR;break;case this.DEVICE_TYPE_CAT:driverClass=this.CLIENT_DRIVER_CAT;break;case this.DEVICE_TYPE_CASH_CHANGER:driverClass=this.CLIENT_DRIVER_CASH_CHANGER;break;case this.DEVICE_TYPE_PRINTER:driverClass=this.CLIENT_DRIVER_PRINTER;break;case this.DEVICE_TYPE_DISPLAY:driverClass=this.CLIENT_DRIVER_DISPLAY;break;case this.DEVICE_TYPE_SIMPLE_SERIAL:driverClass=this.CLIENT_DRIVER_SIMPLE_SERIAL;break;case this.DEVICE_TYPE_HYBRID_PRINTER:driverClass=this.CLIENT_DRIVER_HYBRID_PRINTER;break;case this.DEVICE_TYPE_DT:driverClass=this.CLIENT_DRIVER_DT;break;default:break}if(typeof(options.driver)=="string"){driverClass=options.driver}var func=eval(driverClass);if(typeof(func)!="function"){throw new Error(ERROR_PARAM_ERROR)}var driverObj=new func(this,deviceID);switch(deviceType){case this.DEVICE_TYPE_PRINTER:case this.DEVICE_TYPE_HYBRID_PRINTER:driverObj.setIpAddress(this.ipAddress);break;default:break}deviceInfo.addClientDeviceInfo(deviceID,isCrypto,driverObj,callback);var data={type:deviceType,crypto:isCrypto};if(isBuffer!=null){data.buffer=isBuffer}var command=msgGenerator.getOpenDevice(deviceID,null,data);socket.emit(SOCKET_EVENT_NAME,command)}catch(e){var exception=e.message;if((exception==null)||(exception=="")){exception=this.ERROR_DEVICE_OPEN_ERROR}if(callback!=null){callback(null,exception)}}return},deleteDevice:function(driverObject,callback){try{if(socket==null){throw new Error(ERROR_SYSTEM_ERROR)}var devStruct=deviceInfo.getClientDeviceInfoByDriverObj(driverObject);if(devStruct==null){throw new Error(this.ERROR_DEVICE_NOT_OPEN)}deviceInfo.setResultCallback(devStruct.deviceID,callback);var command=msgGenerator.getCloseDevice(devStruct.deviceID,null,{});socket.emit(SOCKET_EVENT_NAME,command)}catch(e){var exception=e.message;if((exception==null)||(exception=="")){exception=this.ERROR_DEVICE_CLOSE_ERROR}if(callback!=null){callback(exception)}}},sendDeviceData:function(deviceID,deviceData){var sq=-1;try{if(socket==null){return sq}var devInfo=deviceInfo.getClientDeviceInfo(deviceID);var command="";var sq=this.genSequence();if(devInfo.isCrypto){command=msgGenerator.getDeviceData(sq,deviceID,deviceData,ePosC)}else{command=msgGenerator.getDeviceData(sq,deviceID,deviceData,null)}socket.emit(SOCKET_EVENT_NAME,command)}catch(e){sq=-1}return sq},sendOfscXml:function(xml,timeout,isCrypto,callback){try{var serviceID=this.OFSC_SERVICE_ID;if(socket==null){throw new Error("")}var command="";var sq=this.genSequence();ofscCallbackList.push(callback);var data={type:"print",timeout:timeout,printdata:xml};if(isCrypto){command=msgGenerator.getServiceData(sq,serviceID,data,ePosC)}else{command=msgGenerator.getServiceData(sq,serviceID,data,null)}socket.emit(SOCKET_EVENT_NAME,command)}catch(e){return -1}},genSequence:function(){this.sequence++;if(this.sequence>=Number.MAX_VALUE){this.sequence=this.SEQUENCE_INIT_PARAM}return String(this.sequence)},getCommBoxManager:function(){if(socket==null){return null}return this.commBoxManager},sendOpenComm:function(sq,data){try{if(socket==null){return -1}var command=msgGenerator.getOpenComm(sq,null,data);socket.emit(SOCKET_EVENT_NAME,command)}catch(e){return -1}return sq},sendCloseComm:function(sq,data){try{if(socket==null){return -1}var command=msgGenerator.getCloseComm(sq,null,data);socket.emit(SOCKET_EVENT_NAME,command)}catch(e){return -1}return sq},sendCommData:function(sq,data){try{if(socket==null){return -1}var command=msgGenerator.getCommData(sq,data,null);socket.emit(SOCKET_EVENT_NAME,command)}catch(e){return -1}return sq}};function utility(){}utility.prototype={init:function(){},clone:function(obj){var func=function(){};func.prototype=obj;return new func}};function cookieIO(){this.init();this.EXPIRE_MINUTES=5}cookieIO.prototype={init:function(){},writeCookie:function(valueId,value){if((valueId==null)||(valueId=="")){return false}if(value==null){return false}var path=location.pathname;var hostname=location.hostname;var id=valueId+"_"+hostname+path;var expired=this.getExpiredDate();document.cookie=id+"="+escape(value)+"; expires="+expired;return true},readCookie:function(valueId){var ret="";var path=location.pathname;var hostname=location.hostname;var id=valueId+"_"+hostname+path;var strCookie=document.cookie+";";var strKey=id+"=";var start=strCookie.indexOf(strKey);if(start!=-1){var end=strCookie.indexOf(";",start);ret=unescape(strCookie.substring(start+strKey.length,end))}return ret},getExpiredDate:function(){var expire=new Date();var nTime=expire.getTime();expire.setTime(nTime+(1000*60*this.EXPIRE_MINUTES));return expire.toUTCString()}};function clientDeviceInfo(){this.clientDevStructList=null;this.init()}clientDeviceInfo.prototype={init:function(){this.clientDevStructList=new Array()},addClientDeviceInfo:function(deviceID,isCrypto,driverObj,callback){var clientDevStruct=new clientDeviceStruct(deviceID,isCrypto,driverObj,callback);this.clientDevStructList[deviceID]=clientDevStruct},getClientDeviceInfo:function(deviceID){for(var i in this.clientDevStructList){if(this.clientDevStructList[i].deviceID==deviceID){return this.clientDevStructList[i]}}return null},getClientDeviceInfoByDriverObj:function(driverObj){for(var i in this.clientDevStructList){if(this.clientDevStructList[i].driverObj==driverObj){return this.clientDevStructList[i]}}return null},getClientDriverObj:function(deviceID){return this.getClientDeviceInfo(deviceID).driverObj},setResultCallback:function(deviceID,callback){var devStruct=this.getClientDeviceInfo(deviceID);devStruct.resultCallback=callback;this.removeClientDeviceInfo(deviceID);this.addClientDeviceInfo(devStruct.deviceID,devStruct.isCrypto,devStruct.driverObj,callback);return},getResultCallback:function(deviceID){var callback=null;var devStruct=this.getClientDeviceInfo(deviceID);if(devStruct!=null){callback=devStruct.resultCallback}return callback},removeClientDeviceInfo:function(deviceID){for(var i in this.clientDevStructList){if(this.clientDevStructList[i].deviceID==deviceID){delete this.clientDevStructList[i];return}}},isExsitClientDeviceInfo:function(deviceID){var ret=true;if(this.clientDevStructList[deviceID]==null){ret=false}return ret}};function clientDeviceStruct(deviceID,isCrypto,driverObj,resultCallback){this.deviceID=deviceID;this.isCrypto=isCrypto;this.driverObj=driverObj;this.resultCallback=resultCallback}function clientMessageGenerator(){}clientMessageGenerator.prototype={getOpenDevice:function(deviceID,code,data){var message="";if(code==null){message=["open_device",deviceID,data,"0"]}else{message=["open_device",deviceID,code,data,"0"]}return message},getCloseDevice:function(deviceID,code,data){var message="";if(code==null){message=["close_device",deviceID,data,"0"]}else{message=["close_device",deviceID,code,data,"0"]}return message},getDeviceData:function(sq,deviceID,data,cryptoObj){var message="";if(cryptoObj==null){message=["device_data",sq,deviceID,data,"0"]}else{var encryptData=cryptoObj.bfEncrypt(JSON.stringify(data));message=["device_data",sq,deviceID,encryptData,"0"]}return message},getPubkey:function(code,data){var message="";if(code==null){message=["pubkey",data,"0"]}else{message=["pubkey",code,data,"0"]}return message},getAdminInfo:function(code,data){var message="";if(code==null){message=["admin_info",data,"0"]}else{message=["admin_info",code,data,"0"]}return message},getConnect:function(data){return["connect",data,"0"]},getReconnect:function(data){return["reconnect",data,"0"]},getDisconnect:function(data){return["disconnect",data,"0"]},getServiceData:function(sq,serviceID,data,crypto){var message="";if(crypto==null){message=["service_data",sq,serviceID,"0",data,"0"]}else{var encryptData=crypto.bfEncrypt(JSON.stringify(data));message=["service_data",sq,serviceID,"1",encryptData,"0"]}return message},getError:function(sq,deviceID,code){return["error",sq,deviceID,code,"0"]},getOpenComm:function(sq,code,data){var message="";if(code==null){message=["open_commbox",sq,data,"0"]}else{message=["open_commbox",sq,code,data,"0"]}return message},getCloseComm:function(sq,code,data){var message="";if(code==null){message=["close_commbox",sq,data,"0"]}else{message=["close_commbox",sq,code,data,"0"]}return message},getCommData:function(sq,data,cryptoObj){var message="";if(cryptoObj==null){message=["commbox_data",sq,data,"0"]}else{var encryptData=cryptoObj.bfEncrypt(JSON.stringify(data));message=["commbox_data",sq,encryptData,"0"]}return message}};function CommBoxManager(ePosDevObj){this.ERROR_OK="OK";this.ERROR_BOX_COUNT_OVER="BOX_COUNT_OVER";this.ERROR_BOX_CLIENT_OVER="BOX_CLIENT_OVER";this.ERROR_MEMBERID_ALREADY_USED="MEMBERID_ALREADY_USED";this.ERROR_ALREADY_OPENED="ALREADY_OPENED";this.ERROR_NOT_OPENED="NOT_OPENED";this.ERROR_PARAMETER_ERROR="PARAMETER_ERROR";this.ERROR_SYSTEM_ERROR="SYSTEM_ERROR";this.ePosDevObj=ePosDevObj;this.callbackInfo=null;this.commBoxList=null;this.init()}CommBoxManager.prototype={init:function(){this.callbackInfo=new callbackInfo();this.commBoxList=new Array()},openCommBox:function(boxID,option,callback){var sq=this.ePosDevObj.genSequence();var memberID="";if(option!=null&&option.memberID!=null){memberID=option.memberID}var data={box_id:boxID,member_id:memberID};this.callbackInfo.addCallback(callback,sq);sq=this.ePosDevObj.sendOpenComm(sq,data);return sq},closeCommBox:function(boxObj,callback){var sq=this.ePosDevObj.genSequence();try{var boxID=boxObj.getBoxId();if(!this.isOpened(boxID)){if(callback!=null){callback(this.ERROR_NOT_OPENED,sq)}return sq}var data={box_id:boxID};this.callbackInfo.addCallback(callback,sq);sq=this.ePosDevObj.sendCloseComm(sq,data)}catch(e){if(callback!=null){callback(this.ERROR_PARAMETER_ERROR,sq)}this.callbackInfo.removeCallback(sq)}return sq},client_opencommbox:function(data,sq){var boxID=data.box_id;var code=data.code;var commBoxObj=null;if(code==this.ERROR_OK&&this.getCommBox(boxID)==null){commBoxObj=new CommBox(boxID,this,this.callbackInfo)}if(commBoxObj!=null){this.commBoxList.push(commBoxObj)}var openCommBoxCB=this.callbackInfo.getCallback(sq);this.callbackInfo.removeCallback(sq);if(openCommBoxCB!=null){openCommBoxCB(commBoxObj,code,sq)}return},client_closecommbox:function(data,sq){var boxID=data.box_id;var code=data.code;this.removeCommBox(boxID);var closeCommBoxCB=this.callbackInfo.getCallback(sq);this.callbackInfo.removeCallback(sq);if(closeCommBoxCB!=null){closeCommBoxCB(code,sq)}return},sendCommData:function(sq,data){var ret=this.ePosDevObj.sendCommData(sq,data);return ret},executeCommDataCallback:function(data,sq){var boxID=data.box_id;var commBoxObj=this.getCommBox(boxID);var method="client_"+data.type;try{eval("commBoxObj."+method+"(data, sq)")}catch(e){throw new Error("")}return},getCommBox:function(boxID){var commBoxObj=null;for(var i=0;i<this.commBoxList.length;i++){if(this.commBoxList[i].getBoxId()==boxID){commBoxObj=this.commBoxList[i];break}}return commBoxObj},removeCommBox:function(boxID){var result=false;for(var i=0;i<this.commBoxList.length;i++){if(this.commBoxList[i].getBoxId()==boxID){this.commBoxList.splice(i,1);result=true;break}}return result},isOpened:function(boxID){var result=false;for(var i=0;i<this.commBoxList.length;i++){if(this.commBoxList[i].getBoxId()==boxID){result=true;break}}return result},genSequence:function(){return this.ePosDevObj.genSequence()}};function CommBox(boxID,commBoxManager,callbackInfo){this.ERROR_OK="OK";this.ERROR_NOT_OPENED="NOT_OPENED";this.ERROR_MEMBER_NOT_FOUND="MEMBER_NOT_FOUND";this.ERROR_SYSTEM_ERROR="SYSTEM_ERROR";this.boxID=boxID;this.commBoxManager=commBoxManager;this.callbackInfo=callbackInfo;this.onreceive=null;this.init()}CommBox.prototype={init:function(){},getCommHistory:function(option,callback){var sq=this.commBoxManager.genSequence();var _option=(typeof(option)=="function")?null:option;var _callback=(typeof(option)=="function")?option:callback;var allHistory=((_option==null)||(_option.allHistory==null))?false:option.allHistory;if(!this.commBoxManager.isOpened(this.getBoxId())){if(_callback!=null){_callback(this.ERROR_NOT_OPENED,null,sq)}return sq}this.callbackInfo.addCallback(_callback,sq);var data={type:"getcommhistory",box_id:this.boxID,all_history:allHistory};sq=this.commBoxManager.sendCommData(sq,data);return sq},send:function(message,memberID,callback){var sq=this.commBoxManager.genSequence();if(!this.commBoxManager.isOpened(this.getBoxId())){if(callback!=null){callback(this.ERROR_NOT_OPENED,0,sq)}return sq}this.callbackInfo.addCallback(callback,sq);var data={type:"send",box_id:this.boxID,message:message,member_id:memberID};sq=this.commBoxManager.sendCommData(sq,data);return sq},client_getcommhistory:function(data,sq){var code=data.code;var historyList=data.history_list;var getCommHistoryCB=this.callbackInfo.getCallback(sq);this.callbackInfo.removeCallback(sq);if(getCommHistoryCB!=null){getCommHistoryCB(code,historyList,sq)}return},client_send:function(data,sq){var code=data.code;var count=data.count;var sendCB=this.callbackInfo.getCallback(sq);this.callbackInfo.removeCallback(sq);if(sendCB!=null){sendCB(code,count,sq)}return},client_onreceive:function(data,sq){var rcvData=new Object();rcvData.senderId=data.sender_id;rcvData.receiverId=data.receiver_id;rcvData.message=data.message;if(this.onreceive!=null){this.onreceive(rcvData)}return},getBoxId:function(){return this.boxID}};function callbackInfo(){this.callbackInfoList=null;this.init()}callbackInfo.prototype={init:function(){this.callbackInfoList=new Object()},addCallback:function(callback,sq){this.callbackInfoList[sq]=callback},removeCallback:function(sq){for(var i in this.callbackInfoList){if(i==sq){delete this.callbackInfoList[i];return}}},getCallback:function(sq){if(this.callbackInfoList[sq]!=null){return this.callbackInfoList[sq]}return null}};function SimpleSerial(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID}SimpleSerial.prototype={sendCommand:function(command){var data={type:"sendcommand",command:toHexBinary(command)};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},client_oncommandreply:function(data){try{if(this.oncommandreply==null){return}var hexData=data.data;hexData=hexData.replace(/[0-9a-fA-F]{2}/g,function(c){var hexNum=parseInt(c,16);return String.fromCharCode(hexNum)});data.data=hexData;this.oncommandreply(data)}catch(e){}return}};function CAT(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID}CAT.prototype={sendCommand:function(command){var data={type:"sendcommand",command:toHexBinary(command)};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},client_oncommandreply:function(data){try{if(this.oncommandreply==null){return}var hexData=data.command;hexData=hexData.replace(/[0-9a-fA-F]{2}/g,function(c){var hexNum=parseInt(c,16);return String.fromCharCode(hexNum)});data.command=hexData;this.oncommandreply(data)}catch(e){}return}};function Scanner(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.init()}Scanner.prototype={init:function(){},client_ondata:function(data){try{if(this.ondata==null){return}this.ondata(data)}catch(e){}return},callEvent:function(eventName,data){var eventReq=data;eventReq.type=eventName;var sq=this.ePosDevObj.sendDeviceData(this.deviceID,eventReq);return sq}};function Keyboard(ePosDevObj,deviceID){this.VK_CANCEL=3;this.VK_BACK=8;this.VK_TAB=9;this.VK_RETURN=13;this.VK_SHIFT=16;this.VK_CONTROL=17;this.VK_MENU=18;this.VK_PAUSE=19;this.VK_CAPITAL=20;this.VK_KANA=21;this.VK_ESCAPE=27;this.VK_CONVERT=28;this.VK_NONCONVERT=29;this.VK_SPACE=32;this.VK_PRIOR=33;this.VK_NEXT=34;this.VK_END=35;this.VK_HOME=36;this.VK_LEFT=37;this.VK_UP=38;this.VK_RIGHT=39;this.VK_DOWN=40;this.VK_INSERT=45;this.VK_DELETE=46;this.VK_0=48;this.VK_1=49;this.VK_2=50;this.VK_3=51;this.VK_4=52;this.VK_5=53;this.VK_6=54;this.VK_7=55;this.VK_8=56;this.VK_9=57;this.VK_A=65;this.VK_B=66;this.VK_C=67;this.VK_D=68;this.VK_E=69;this.VK_F=70;this.VK_G=71;this.VK_H=72;this.VK_I=73;this.VK_J=74;this.VK_K=75;this.VK_L=76;this.VK_M=77;this.VK_N=78;this.VK_O=79;this.VK_P=80;this.VK_Q=81;this.VK_R=82;this.VK_S=83;this.VK_T=84;this.VK_U=85;this.VK_V=86;this.VK_W=87;this.VK_X=88;this.VK_Y=89;this.VK_Z=90;this.VK_LWIN=91;this.VK_RWIN=92;this.VK_APPS=93;this.VK_NUMPAD0=96;this.VK_NUMPAD1=97;this.VK_NUMPAD2=98;this.VK_NUMPAD3=99;this.VK_NUMPAD4=100;this.VK_NUMPAD5=101;this.VK_NUMPAD6=102;this.VK_NUMPAD7=103;this.VK_NUMPAD8=104;this.VK_NUMPAD9=105;this.VK_MULTIPLY=106;this.VK_ADD=107;this.VK_SEPARATOR=108;this.VK_SUBTRACT=109;this.VK_DECIMAL=110;this.VK_DIVIDE=111;this.VK_F1=112;this.VK_F2=113;this.VK_F3=114;this.VK_F4=115;this.VK_F5=116;this.VK_F6=117;this.VK_F7=118;this.VK_F8=119;this.VK_F9=120;this.VK_F10=121;this.VK_F11=122;this.VK_F12=123;this.VK_NUMLOCK=144;this.VK_SCROLL=145;this.VK_LSHIFT=160;this.VK_RSHIFT=161;this.VK_LCONTROL=162;this.VK_RCONTROL=163;this.VK_LMENU=164;this.VK_RMENU=165;this.VK_OEM_1=186;this.VK_OEM_PLUS=187;this.VK_OEM_COMMA=188;this.VK_OEM_MINUS=189;this.VK_OEM_PERIOD=190;this.VK_OEM_2=191;this.VK_OEM_3=192;this.VK_OEM_4=219;this.VK_OEM_5=220;this.VK_OEM_6=221;this.VK_OEM_7=222;this.VK_OEM_102=226;this.VK_OEM_ATTN=240;this.ePosDevObj=ePosDevObj;this.deviceID=deviceID}Keyboard.prototype={client_onkeypress:function(data){try{if(this.onkeypress==null){return}this.onkeypress(data)}catch(e){}return},client_onstring:function(data){try{if(this.onstring==null){return}this.onstring(data)}catch(e){}return},setPrefix:function(keycodes){var data={type:"setprefix"};if(typeof keycodes=="object"){if((keycodes.length==0)){return -1}data.keycodes=keycodes}else{if((keycodes==null)||(keycodes=="")){return -1}data.keycodes=[keycodes]}var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},callEvent:function(eventName,data){var eventReq=data;eventReq.type=eventName;var sq=this.ePosDevObj.sendDeviceData(this.deviceID,eventReq);return sq}};function MSR(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.init()}MSR.prototype={init:function(){},client_ondata:function(data){try{if(this.ondata==null){return}this.ondata(data)}catch(e){}return},callEvent:function(eventName,data){var eventReq=data;eventReq.type=eventName;var sq=this.ePosDevObj.sendDeviceData(this.deviceID,eventReq);return sq}};function CashChanger(ePosDevObj,deviceID){this.CONFIG_LEFT_CASH="CONFIG_LEFT_CASH";this.CONFIG_COUNT_MODE="CONFIG_COUNT_MODE";this.MODE_MANUAL_INPUT="MODE_MANUAL_INPUT";this.MODE_AUTOCOUNT="MODE_AUTO_COUNT";this.DEPOSIT_CHANGE="DEPOSIT_CHANGE";this.DEPOSIT_NOCHANGE="DEPOSIT_NOCHANGE";this.DEPOSIT_REPAY="DEPOSIT_REPAY";this.COLLECT_ALL_CASH="ALL_CASH";this.COLLECT_PART_OF_CASH="PART_OF_CASH";this.ePosDevObj=ePosDevObj;this.deviceID=deviceID}CashChanger.prototype={client_oncashcounts:function(data){try{if(this.oncashcounts==null){return}this.oncashcounts(data)}catch(e){}return},client_onstatuschange:function(data){try{if(this.onstatuschange==null){return}this.onstatuschange(data)}catch(e){}return},client_ondeposit:function(data){try{if(this.ondeposit==null){return}this.ondeposit(data)}catch(e){}return},client_ondispense:function(data){try{if(this.ondispense==null){return}this.ondispense(data)}catch(e){}return},client_oncollect:function(data){try{if(this.oncollect==null){return}this.oncollect(data)}catch(e){}return},client_onconfigchange:function(data){try{if(this.onconfigchange==null){return}this.onconfigchange(data)}catch(e){}return},client_oncommandreply:function(data){try{if(this.oncommandreply==null){return}var hexData=data.data;hexData=hexData.replace(/[0-9a-fA-F]{2}/g,function(c){var hexNum=parseInt(c,16);return String.fromCharCode(hexNum)});data.data=hexData;this.oncommandreply(data)}catch(e){}return},readCashCounts:function(){var data={type:"readcashcounts"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},beginDeposit:function(){var data={type:"begindeposit"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},pauseDeposit:function(){var data={type:"pausedeposit"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},restartDeposit:function(){var data={type:"restartdeposit"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},endDeposit:function(cmd){var data={type:"enddeposit",cmd:cmd};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},dispenseCash:function(cash){var data={type:"dispensecash",cash:cash};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},dispenseChange:function(data){data.type="dispensechange";var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},openDrawer:function(){var data={type:"opendrawer"};var ret=this.ePosDevObj.sendDeviceData(this.deviceID,data);return ret},collectCash:function(collectMode){var data={type:"collectcash",collectmode:collectMode};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},setConfig:function(config,value){var data=null;switch(config){case this.CONFIG_COUNT_MODE:data={type:"setconfig",config:config,mode:value.mode};break;case this.CONFIG_LEFT_CASH:if((value.bills==null)||(value.bills=="")){value.bills="0"}if((value.coins==null)||(value.coins=="")){value.coins="0"}data={type:"setconfig",config:config,bills:value.bills,coins:value.coins};break;default:break}var sq=-1;if(data!=null){sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}return sq},sendCommand:function(command){var data={type:"sendcommand",command:toHexBinary(command)};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},callEvent:function(eventName,data){var eventReq=data;eventReq.type=eventName;var sq=this.ePosDevObj.sendDeviceData(this.deviceID,eventReq);return sq}};
2
+ /*! Based JavaScript is ePOS-Print API Version 4.1.1 */
3
+ function ePOSBuilder(){this.message="";this.halftone=0;this.brightness=1;this.force=false;this.FONT_A="font_a";this.FONT_B="font_b";this.FONT_C="font_c";this.FONT_D="font_d";this.FONT_E="font_e";this.FONT_SPECIAL_A="special_a";this.FONT_SPECIAL_B="special_b";this.ALIGN_LEFT="left";this.ALIGN_CENTER="center";this.ALIGN_RIGHT="right";this.COLOR_NONE="none";this.COLOR_1="color_1";this.COLOR_2="color_2";this.COLOR_3="color_3";this.COLOR_4="color_4";this.FEED_PEELING="peeling";this.FEED_CUTTING="cutting";this.FEED_CURRENT_TOF="current_tof";this.FEED_NEXT_TOF="next_tof";this.MODE_MONO="mono";this.MODE_GRAY16="gray16";this.BARCODE_UPC_A="upc_a";this.BARCODE_UPC_E="upc_e";this.BARCODE_EAN13="ean13";this.BARCODE_JAN13="jan13";this.BARCODE_EAN8="ean8";this.BARCODE_JAN8="jan8";this.BARCODE_CODE39="code39";this.BARCODE_ITF="itf";this.BARCODE_CODABAR="codabar";this.BARCODE_CODE93="code93";this.BARCODE_CODE128="code128";this.BARCODE_GS1_128="gs1_128";this.BARCODE_GS1_DATABAR_OMNIDIRECTIONAL="gs1_databar_omnidirectional";this.BARCODE_GS1_DATABAR_TRUNCATED="gs1_databar_truncated";this.BARCODE_GS1_DATABAR_LIMITED="gs1_databar_limited";this.BARCODE_GS1_DATABAR_EXPANDED="gs1_databar_expanded";this.HRI_NONE="none";this.HRI_ABOVE="above";this.HRI_BELOW="below";this.HRI_BOTH="both";this.SYMBOL_PDF417_STANDARD="pdf417_standard";this.SYMBOL_PDF417_TRUNCATED="pdf417_truncated";this.SYMBOL_QRCODE_MODEL_1="qrcode_model_1";this.SYMBOL_QRCODE_MODEL_2="qrcode_model_2";this.SYMBOL_QRCODE_MICRO="qrcode_micro";this.SYMBOL_MAXICODE_MODE_2="maxicode_mode_2";this.SYMBOL_MAXICODE_MODE_3="maxicode_mode_3";this.SYMBOL_MAXICODE_MODE_4="maxicode_mode_4";this.SYMBOL_MAXICODE_MODE_5="maxicode_mode_5";this.SYMBOL_MAXICODE_MODE_6="maxicode_mode_6";this.SYMBOL_GS1_DATABAR_STACKED="gs1_databar_stacked";this.SYMBOL_GS1_DATABAR_STACKED_OMNIDIRECTIONAL="gs1_databar_stacked_omnidirectional";this.SYMBOL_GS1_DATABAR_EXPANDED_STACKED="gs1_databar_expanded_stacked";this.SYMBOL_AZTECCODE_FULLRANGE="azteccode_fullrange";this.SYMBOL_AZTECCODE_COMPACT="azteccode_compact";this.SYMBOL_DATAMATRIX_SQUARE="datamatrix_square";this.SYMBOL_DATAMATRIX_RECTANGLE_8="datamatrix_rectangle_8";this.SYMBOL_DATAMATRIX_RECTANGLE_12="datamatrix_rectangle_12";this.SYMBOL_DATAMATRIX_RECTANGLE_16="datamatrix_rectangle_16";this.LEVEL_0="level_0";this.LEVEL_1="level_1";this.LEVEL_2="level_2";this.LEVEL_3="level_3";this.LEVEL_4="level_4";this.LEVEL_5="level_5";this.LEVEL_6="level_6";this.LEVEL_7="level_7";this.LEVEL_8="level_8";this.LEVEL_L="level_l";this.LEVEL_M="level_m";this.LEVEL_Q="level_q";this.LEVEL_H="level_h";this.LEVEL_DEFAULT="default";this.LINE_THIN="thin";this.LINE_MEDIUM="medium";this.LINE_THICK="thick";this.LINE_THIN_DOUBLE="thin_double";this.LINE_MEDIUM_DOUBLE="medium_double";this.LINE_THICK_DOUBLE="thick_double";this.DIRECTION_LEFT_TO_RIGHT="left_to_right";this.DIRECTION_BOTTOM_TO_TOP="bottom_to_top";this.DIRECTION_RIGHT_TO_LEFT="right_to_left";this.DIRECTION_TOP_TO_BOTTOM="top_to_bottom";this.CUT_NO_FEED="no_feed";this.CUT_FEED="feed";this.CUT_RESERVE="reserve";this.DRAWER_1="drawer_1";this.DRAWER_2="drawer_2";this.PULSE_100="pulse_100";this.PULSE_200="pulse_200";this.PULSE_300="pulse_300";this.PULSE_400="pulse_400";this.PULSE_500="pulse_500";this.PATTERN_NONE="none";this.PATTERN_1="pattern_1";this.PATTERN_2="pattern_2";this.PATTERN_3="pattern_3";this.PATTERN_4="pattern_4";this.PATTERN_5="pattern_5";this.PATTERN_6="pattern_6";this.PATTERN_7="pattern_7";this.PATTERN_8="pattern_8";this.PATTERN_9="pattern_9";this.PATTERN_10="pattern_10";this.PATTERN_A="pattern_a";this.PATTERN_B="pattern_b";this.PATTERN_C="pattern_c";this.PATTERN_D="pattern_d";this.PATTERN_E="pattern_e";this.PATTERN_ERROR="error";this.PATTERN_PAPER_END="paper_end";this.LAYOUT_RECEIPT="receipt";this.LAYOUT_RECEIPT_BM="receipt_bm";this.LAYOUT_LABEL="label";this.LAYOUT_LABEL_BM="label_bm";this.HALFTONE_DITHER=0;this.HALFTONE_ERROR_DIFFUSION=1;this.HALFTONE_THRESHOLD=2}ePOSBuilder.prototype.addText=function(data){this.message+="<text>"+escapeMarkup(data)+"</text>";return this};ePOSBuilder.prototype.addTextLang=function(lang){this.message+='<text lang="'+lang+'"/>';return this};ePOSBuilder.prototype.addTextAlign=function(align){var s="";s+=getEnumAttr("align",align,regexAlign);this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextRotate=function(rotate){var s="";s+=getBoolAttr("rotate",rotate);this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextLineSpace=function(linespc){var s="";s+=getUByteAttr("linespc",linespc);this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextFont=function(font){var s="";s+=getEnumAttr("font",font,regexFont);this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextSmooth=function(smooth){var s="";s+=getBoolAttr("smooth",smooth);this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextDouble=function(dw,dh){var s="";if(dw!==undefined){s+=getBoolAttr("dw",dw)}if(dh!==undefined){s+=getBoolAttr("dh",dh)}this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextSize=function(width,height){var s="";if(width!==undefined){s+=getIntAttr("width",width,1,8)}if(height!==undefined){s+=getIntAttr("height",height,1,8)}this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextStyle=function(reverse,ul,em,color){var s="";if(reverse!==undefined){s+=getBoolAttr("reverse",reverse)}if(ul!==undefined){s+=getBoolAttr("ul",ul)}if(em!==undefined){s+=getBoolAttr("em",em)}if(color!==undefined){s+=getEnumAttr("color",color,regexColor)}this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextPosition=function(x){var s="";s+=getUShortAttr("x",x);this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addTextVPosition=function(y){var s="";s+=getUShortAttr("y",y);this.message+="<text"+s+"/>";return this};ePOSBuilder.prototype.addFeedUnit=function(unit){var s="";s+=getUByteAttr("unit",unit);this.message+="<feed"+s+"/>";return this};ePOSBuilder.prototype.addFeedLine=function(line){var s="";s+=getUByteAttr("line",line);this.message+="<feed"+s+"/>";return this};ePOSBuilder.prototype.addFeed=function(){this.message+="<feed/>";return this};ePOSBuilder.prototype.addFeedPosition=function(pos){var s="";s+=getEnumAttr("pos",pos,regexFeed);this.message+="<feed"+s+"/>";return this};ePOSBuilder.prototype.addImage=function(context,x,y,width,height,color,mode){var s="",ht=this.halftone,br=this.brightness,imgdata,raster;getUShortAttr("x",x);getUShortAttr("y",y);s+=getUShortAttr("width",width);s+=getUShortAttr("height",height);if(color!==undefined){s+=getEnumAttr("color",color,regexColor)}if(mode!==undefined){s+=getEnumAttr("mode",mode,regexMode)}if(isNaN(ht)||ht<0||ht>2){throw new Error('Property "halftone" is invalid')}if(isNaN(br)||br<0.1||br>10){throw new Error('Property "brightness" is invalid')}imgdata=context.getImageData(x,y,width,height);raster=(mode==this.MODE_GRAY16)?toGrayImage(imgdata,br):toMonoImage(imgdata,ht,br);this.message+="<image"+s+">"+toBase64Binary(raster)+"</image>";return this};ePOSBuilder.prototype.addLogo=function(key1,key2){var s="";s+=getUByteAttr("key1",key1);s+=getUByteAttr("key2",key2);this.message+="<logo"+s+"/>";return this};ePOSBuilder.prototype.addBarcode=function(data,type,hri,font,width,height){var s="";s+=getEnumAttr("type",type,regexBarcode);if(hri!==undefined){s+=getEnumAttr("hri",hri,regexHri)}if(font!==undefined){s+=getEnumAttr("font",font,regexFont)}if(width!==undefined){s+=getUByteAttr("width",width)}if(height!==undefined){s+=getUByteAttr("height",height)}this.message+="<barcode"+s+">"+escapeControl(escapeMarkup(data))+"</barcode>";return this};ePOSBuilder.prototype.addSymbol=function(data,type,level,width,height,size){var s="";s+=getEnumAttr("type",type,regexSymbol);if(level!==undefined){s+=getEnumIntAttr("level",level,regexLevel,0,255)}if(width!==undefined){s+=getUByteAttr("width",width)}if(height!==undefined){s+=getUByteAttr("height",height)}if(size!==undefined){s+=getUShortAttr("size",size)}this.message+="<symbol"+s+">"+escapeControl(escapeMarkup(data))+"</symbol>";return this};ePOSBuilder.prototype.addHLine=function(x1,x2,style){var s="";s+=getUShortAttr("x1",x1);s+=getUShortAttr("x2",x2);if(style!==undefined){s+=getEnumAttr("style",style,regexLine)}this.message+="<hline"+s+"/>";return this};ePOSBuilder.prototype.addVLineBegin=function(x,style){var s="";s+=getUShortAttr("x",x);if(style!==undefined){s+=getEnumAttr("style",style,regexLine)}this.message+="<vline-begin"+s+"/>";return this};ePOSBuilder.prototype.addVLineEnd=function(x,style){var s="";s+=getUShortAttr("x",x);if(style!==undefined){s+=getEnumAttr("style",style,regexLine)}this.message+="<vline-end"+s+"/>";return this};ePOSBuilder.prototype.addPageBegin=function(){this.message+="<page>";return this};ePOSBuilder.prototype.addPageEnd=function(){this.message+="</page>";return this};ePOSBuilder.prototype.addPageArea=function(x,y,width,height){var s="";s+=getUShortAttr("x",x);s+=getUShortAttr("y",y);s+=getUShortAttr("width",width);s+=getUShortAttr("height",height);this.message+="<area"+s+"/>";return this};ePOSBuilder.prototype.addPageDirection=function(dir){var s="";s+=getEnumAttr("dir",dir,regexDirection);this.message+="<direction"+s+"/>";return this};ePOSBuilder.prototype.addPagePosition=function(x,y){var s="";s+=getUShortAttr("x",x);s+=getUShortAttr("y",y);this.message+="<position"+s+"/>";return this};ePOSBuilder.prototype.addPageLine=function(x1,y1,x2,y2,style){var s="";s+=getUShortAttr("x1",x1);s+=getUShortAttr("y1",y1);s+=getUShortAttr("x2",x2);s+=getUShortAttr("y2",y2);if(style!==undefined){s+=getEnumAttr("style",style,regexLine)}this.message+="<line"+s+"/>";return this};ePOSBuilder.prototype.addPageRectangle=function(x1,y1,x2,y2,style){var s="";s+=getUShortAttr("x1",x1);s+=getUShortAttr("y1",y1);s+=getUShortAttr("x2",x2);s+=getUShortAttr("y2",y2);if(style!==undefined){s+=getEnumAttr("style",style,regexLine)}this.message+="<rectangle"+s+"/>";return this};ePOSBuilder.prototype.addCut=function(type){var s="";if(type!==undefined){s+=getEnumAttr("type",type,regexCut)}this.message+="<cut"+s+"/>";return this};ePOSBuilder.prototype.addPulse=function(drawer,time){var s="";if(drawer!==undefined){s+=getEnumAttr("drawer",drawer,regexDrawer)}if(time!==undefined){s+=getEnumAttr("time",time,regexPulse)}this.message+="<pulse"+s+"/>";return this};ePOSBuilder.prototype.addSound=function(pattern,repeat,cycle){var s="";if(pattern!==undefined){s+=getEnumAttr("pattern",pattern,regexPattern)}if(repeat!==undefined){s+=getUByteAttr("repeat",repeat)}if(cycle!==undefined){s+=getUShortAttr("cycle",cycle)}this.message+="<sound"+s+"/>";return this};ePOSBuilder.prototype.addLayout=function(type,width,height,margin_top,margin_bottom,offset_cut,offset_label){var s="";s+=getEnumAttr("type",type,regexLayout);if(width!==undefined){s+=getUShortAttr("width",width)}if(height!==undefined){s+=getUShortAttr("height",height)}if(margin_top!==undefined){s+=getShortAttr("margin-top",margin_top)}if(margin_bottom!==undefined){s+=getShortAttr("margin-bottom",margin_bottom)}if(offset_cut!==undefined){s+=getShortAttr("offset-cut",offset_cut)}if(offset_label!==undefined){s+=getShortAttr("offset-label",offset_label)}this.message+="<layout"+s+"/>";return this};ePOSBuilder.prototype.addRecovery=function(){this.message+="<recovery/>";return this};ePOSBuilder.prototype.addReset=function(){this.message+="<reset/>";return this};ePOSBuilder.prototype.addCommand=function(data){this.message+="<command>"+toHexBinary(data)+"</command>";return this};ePOSBuilder.prototype.toString=function(){var s="";if(this.force){s+=getBoolAttr("force",true)}return'<epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print"'+s+">"+this.message+"</epos-print>"};function toHexBinary(s){var l=s.length,r=new Array(l),i;for(i=0;i<l;i++){r[i]=("0"+s.charCodeAt(i).toString(16)).slice(-2)}return r.join("")}function toBase64Binary(s){var l=s.length,r=new Array((l+2)/3<<2),t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=(3-l%3)%3,j=0,i=0,n;s+="\x00\x00";while(i<l){n=s.charCodeAt(i++)<<16|s.charCodeAt(i++)<<8|s.charCodeAt(i++);r[j++]=t.charAt(n>>18&63);r[j++]=t.charAt(n>>12&63);r[j++]=t.charAt(n>>6&63);r[j++]=t.charAt(n&63)}while(p--){r[--j]="="}return r.join("")}function toMonoImage(imgdata,s,g){var x=String.fromCharCode,m8=[[2,130,34,162,10,138,42,170],[194,66,226,98,202,74,234,106],[50,178,18,146,58,186,26,154],[242,114,210,82,250,122,218,90],[14,142,46,174,6,134,38,166],[206,78,238,110,198,70,230,102],[62,190,30,158,54,182,22,150],[254,126,222,94,246,118,214,86]],d=imgdata.data,w=imgdata.width,h=imgdata.height,r=new Array((w+7>>3)*h),n=0,p=0,q=0,t=128,e=new Array(),e1,e2,b,v,f,i,j;if(s==1){i=w;while(i--){e.push(0)}}for(j=0;j<h;j++){e1=0;e2=0;i=0;while(i<w){b=i&7;if(s==0){t=m8[j&7][b]}v=Math.pow(((d[p++]*0.29891+d[p++]*0.58661+d[p++]*0.11448)*d[p]/255+255-d[p++])/255,1/g)*255|0;if(s==1){v+=e[i]+e1>>4;f=v-(v<t?0:255);if(i>0){e[i-1]+=f}e[i]=f*7+e2;e1=f*5;e2=f*3}if(v<t){n|=128>>b}i++;if(b==7||i==w){r[q++]=x(n==16?32:n);n=0}}}return r.join("")}function toGrayImage(imgdata,g){var x=String.fromCharCode,m4=[[0,9,2,11],[13,4,15,6],[3,12,1,10],[16,7,14,5]],thermal=[0,7,13,19,23,27,31,35,40,44,49,52,54,55,57,59,61,62,64,66,67,69,70,70,71,72,73,74,75,76,77,78,79,80,81,82,83,83,84,85,86,86,87,88,88,89,90,90,91,91,92,93,93,94,94,95,96,96,97,98,98,99,99,100,101,101,102,102,103,103,104,104,105,105,106,106,107,107,108,108,109,109,110,110,111,111,112,112,112,113,113,114,114,115,115,116,116,117,117,118,118,119,119,120,120,120,121,121,122,122,123,123,123,124,124,125,125,125,126,126,127,127,127,128,128,129,129,130,130,130,131,131,132,132,132,133,133,134,134,135,135,135,136,136,137,137,137,138,138,139,139,139,140,140,141,141,141,142,142,143,143,143,144,144,145,145,146,146,146,147,147,148,148,148,149,149,150,150,150,151,151,152,152,152,153,153,154,154,155,155,155,156,156,157,157,158,158,159,159,160,160,161,161,161,162,162,163,163,164,164,165,165,166,166,166,167,167,168,168,169,169,170,170,171,171,172,173,173,174,175,175,176,177,178,178,179,180,180,181,182,182,183,184,184,185,186,186,187,189,191,193,195,198,200,202,255],d=imgdata.data,w=imgdata.width,h=imgdata.height,r=new Array((w+1>>1)*h),n=0,p=0,q=0,b,v,v1,i,j;for(j=0;j<h;j++){i=0;while(i<w){b=i&1;v=thermal[Math.pow(((d[p++]*0.29891+d[p++]*0.58661+d[p++]*0.11448)*d[p]/255+255-d[p++])/255,1/g)*255|0];v1=v/17|0;if(m4[j&3][i&3]<v%17){v1++}n|=v1<<((1-b)<<2);i++;if(b==1||i==w){r[q++]=x(n);n=0}}}return r.join("")}function escapeMarkup(s){var markup=/[<>&'"\t\n\r]/g;if(markup.test(s)){s=s.replace(markup,function(c){var r="";switch(c){case"<":r="&lt;";break;case">":r="&gt;";break;case"&":r="&amp;";break;case"'":r="&apos;";break;case'"':r="&quot;";break;case"\t":r="&#9;";break;case"\n":r="&#10;";break;case"\r":r="&#13;";break;default:break}return r})}return s}function escapeControl(s){var control=/[\\\x00-\x1f\x7f-\xff]/g;if(control.test(s)){s=s.replace(control,function(c){return(c=="\\")?"\\\\":"\\x"+("0"+c.charCodeAt(0).toString(16)).slice(-2)})}return s}var regexFont=/^(font_[a-e]|special_[ab])$/,regexAlign=/^(left|center|right)$/,regexColor=/^(none|color_[1-4])$/,regexFeed=/^(peeling|cutting|current_tof|next_tof)$/,regexMode=/^(mono|gray16)$/,regexBarcode=/^(upc_[ae]|[ej]an13|[ej]an8|code(39|93|128)|itf|codabar|gs1_128|gs1_databar_(omnidirectional|truncated|limited|expanded))$/,regexHri=/^(none|above|below|both)$/,regexSymbol=/^(pdf417_(standard|truncated)|qrcode_(model_[12]|micro)|maxicode_mode_[2-6]|gs1_databar_(stacked(_omnidirectional)?|expanded_stacked)|azteccode_(fullrange|compact)|datamatrix_(square|rectangle_(8|12|16)))$/,regexLevel=/^(level_[0-8lmqh]|default)$/,regexLine=/^(thin|medium|thick)(_double)?$/,regexDirection=/^(left_to_right|bottom_to_top|right_to_left|top_to_bottom)$/,regexCut=/^(no_feed|feed|reserve)$/,regexDrawer=/^drawer_[12]$/,regexPulse=/^pulse_[1-5]00$/,regexPattern=/^(none|pattern_(10|[1-9a-e])|error|paper_end)$/,regexLayout=/^(receipt|label)(_bm)?$/;function getEnumAttr(name,value,regex){if(!regex.test(value)){throw new Error('Parameter "'+name+'" is invalid')}return" "+name+'="'+value+'"'}function getBoolAttr(name,value){return" "+name+'="'+!!value+'"'}function getIntAttr(name,value,min,max){if(isNaN(value)||value<min||value>max){throw new Error('Parameter "'+name+'" is invalid')}return" "+name+'="'+value+'"'}function getUByteAttr(name,value){return getIntAttr(name,value,0,255)}function getUShortAttr(name,value){return getIntAttr(name,value,0,65535)}function getShortAttr(name,value){return getIntAttr(name,value,-32768,32767)}function getEnumIntAttr(name,value,regex,min,max){if(!regex.test(value)){if(isNaN(value)||value<min||value>max){throw new Error('Parameter "'+name+'" is invalid')}}return" "+name+'="'+value+'"'}function ePOSPrint(address){this.address=address;this.enabled=false;this.interval=3000;this.timeout=300000;this.status=0;this.battery=0;this.drawerOpenLevel=0;this.onreceive=null;this.onerror=null;this.onstatuschange=null;this.ononline=null;this.onoffline=null;this.onpoweroff=null;this.oncoverok=null;this.oncoveropen=null;this.onpaperok=null;this.onpaperend=null;this.onpapernearend=null;this.ondrawerclosed=null;this.ondraweropen=null;this.onbatterylow=null;this.onbatteryok=null;this.onbatterystatuschange=null;this.ASB_NO_RESPONSE=1;this.ASB_PRINT_SUCCESS=2;this.ASB_DRAWER_KICK=4;this.ASB_BATTERY_OFFLINE=4;this.ASB_OFF_LINE=8;this.ASB_COVER_OPEN=32;this.ASB_PAPER_FEED=64;this.ASB_WAIT_ON_LINE=256;this.ASB_PANEL_SWITCH=512;this.ASB_MECHANICAL_ERR=1024;this.ASB_AUTOCUTTER_ERR=2048;this.ASB_UNRECOVER_ERR=8192;this.ASB_AUTORECOVER_ERR=16384;this.ASB_RECEIPT_NEAR_END=131072;this.ASB_RECEIPT_END=524288;this.ASB_BUZZER=16777216;this.ASB_WAIT_REMOVE_LABEL=16777216;this.ASB_NO_LABEL=67108864;this.ASB_SPOOLER_IS_STOPPED=2147483648;this.DRAWER_OPEN_LEVEL_LOW=0;this.DRAWER_OPEN_LEVEL_HIGH=1}ePOSPrint.prototype=new ePOSBuilder();ePOSPrint.prototype.constructor=ePOSPrint;ePOSPrint.prototype.open=function(){if(!this.enabled){this.enabled=true;this.status=0;this.battery=0;this.send()}};ePOSPrint.prototype.close=function(){this.enabled=false;if(this.intervalid){clearTimeout(this.intervalid);delete this.intervalid}if(this.intervalxhr){this.intervalxhr.abort();delete this.intervalxhr}};ePOSPrint.prototype.getPrintJobStatus=function(printjobid){this.send(printjobid)};ePOSPrint.prototype.send=function(request,printjobid){var args=arguments.length,epos=this,address=epos.address,soap,xhr,tid,res,success,code,status,battery;if(!/^<epos/.test(request)){if(args<2){printjobid=request;request=new ePOSBuilder().toString()}else{address=request;request=printjobid;printjobid=arguments[2]}}soap='<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">';if(printjobid){soap+='<s:Header><parameter xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print"><printjobid>'+printjobid+"</printjobid></parameter></s:Header>"}soap+="<s:Body>"+request+"</s:Body></s:Envelope>";if(window.XMLHttpRequest){xhr=new XMLHttpRequest();if(!("withCredentials" in xhr)&&window.XDomainRequest){xhr=new XDomainRequest();xhr.open("POST",address,true);xhr.onload=function(){res=xhr.responseText;if(/response/.test(res)){success=/success\s*=\s*"\s*(1|true)\s*"/.test(res);code=res.match(/code\s*=\s*"\s*(\S*)\s*"/)?RegExp.$1:"";status=res.match(/status\s*=\s*"\s*(\d+)\s*"/)?parseInt(RegExp.$1):0;battery=res.match(/battery\s*=\s*"\s*(\d+)\s*"/)?parseInt(RegExp.$1):0;printjobid=res.match(/<printjobid>\s*(\S*)\s*<\/printjobid>/)?RegExp.$1:"";if(args>0){fireReceiveEvent(epos,success,code,status,battery,printjobid)}else{fireStatusEvent(epos,status,battery)}}else{if(args>0){fireErrorEvent(epos,0,xhr.responseText)}else{fireStatusEvent(epos,epos.ASB_NO_RESPONSE,0)}}if(args<1){updateStatus(epos)}};xhr.onerror=function(){if(args>0){fireErrorEvent(epos,0,xhr.responseText)}else{fireStatusEvent(epos,epos.ASB_NO_RESPONSE,0);updateStatus(epos)}};xhr.onprogress=function(){};xhr.ontimeout=xhr.onerror;xhr.timeout=epos.timeout;xhr.send(soap)}else{xhr.open("POST",address,true);xhr.setRequestHeader("Content-Type","text/xml; charset=utf-8");xhr.setRequestHeader("If-Modified-Since","Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("SOAPAction",'""');xhr.onreadystatechange=function(){if(xhr.readyState==4){clearTimeout(tid);if(xhr.status==200&&xhr.responseXML){res=xhr.responseXML.getElementsByTagName("response");if(res.length>0){success=/^(1|true)$/.test(res[0].getAttribute("success"));code=res[0].hasAttribute("code")?res[0].getAttribute("code"):"";status=res[0].hasAttribute("status")?parseInt(res[0].getAttribute("status")):0;battery=res[0].hasAttribute("battery")?parseInt(res[0].getAttribute("battery")):0;res=xhr.responseXML.getElementsByTagName("printjobid");printjobid=res.length>0?res[0].textContent:"";if(args>0){fireReceiveEvent(epos,success,code,status,battery,printjobid)}else{fireStatusEvent(epos,status,battery)}}else{if(args>0){fireErrorEvent(epos,xhr.status,xhr.responseText)}else{fireStatusEvent(epos,epos.ASB_NO_RESPONSE,0)}}}else{if(args>0){fireErrorEvent(epos,xhr.status,xhr.responseText)}else{fireStatusEvent(epos,epos.ASB_NO_RESPONSE,0)}}if(args<1){updateStatus(epos)}}};tid=setTimeout(function(){xhr.abort()},epos.timeout);xhr.send(soap)}if(args<1){epos.intervalxhr=xhr}}else{throw new Error("XMLHttpRequest is not supported")}};function fireReceiveEvent(epos,success,code,status,battery,printjobid){if(epos.onreceive){epos.onreceive({success:success,code:code,status:status,battery:battery,printjobid:printjobid})}}function fireStatusEvent(epos,status,battery){var diff,difb;if(status==0||status==epos.ASB_NO_RESPONSE){status=epos.status|epos.ASB_NO_RESPONSE}diff=epos.status==0?~0:epos.status^status;difb=epos.status==0?~0:epos.battery^battery;epos.status=status;epos.battery=battery;if(diff&&epos.onstatuschange){epos.onstatuschange(status)}if(difb&&epos.onbatterystatuschange){epos.onbatterystatuschange(battery)}if(diff&(epos.ASB_NO_RESPONSE|epos.ASB_OFF_LINE)){if(status&epos.ASB_NO_RESPONSE){if(epos.onpoweroff){epos.onpoweroff()}}else{if(status&epos.ASB_OFF_LINE){if(epos.onoffline){epos.onoffline()}}else{if(epos.ononline){epos.ononline()}}}}if(diff&epos.ASB_COVER_OPEN){if(status&epos.ASB_NO_RESPONSE){}else{if(status&epos.ASB_COVER_OPEN){if(epos.oncoveropen){epos.oncoveropen()}}else{if(epos.oncoverok){epos.oncoverok()}}}}if(diff&(epos.ASB_RECEIPT_END|epos.ASB_RECEIPT_NEAR_END)){if(status&epos.ASB_NO_RESPONSE){}else{if(status&epos.ASB_RECEIPT_END){if(epos.onpaperend){epos.onpaperend()}}else{if(status&epos.ASB_RECEIPT_NEAR_END){if(epos.onpapernearend){epos.onpapernearend()}}else{if(epos.onpaperok){epos.onpaperok()}}}}}if(diff&epos.ASB_DRAWER_KICK){if(status&epos.ASB_NO_RESPONSE){}else{if(status&epos.ASB_DRAWER_KICK){if(epos.drawerOpenLevel==epos.DRAWER_OPEN_LEVEL_HIGH){if(epos.ondraweropen){epos.ondraweropen()}}else{if(epos.ondrawerclosed){epos.ondrawerclosed()}}if(epos.onbatterylow){epos.onbatterylow()}}else{if(epos.drawerOpenLevel==epos.DRAWER_OPEN_LEVEL_HIGH){if(epos.ondrawerclosed){epos.ondrawerclosed()}}else{if(epos.ondraweropen){epos.ondraweropen()}}if(epos.onbatteryok){epos.onbatteryok()}}}}}function fireErrorEvent(epos,status,responseText){if(epos.onerror){epos.onerror({status:status,responseText:responseText})}}function updateStatus(epos){var delay=epos.interval;if(epos.enabled){if(isNaN(delay)||delay<1000){delay=3000}epos.intervalid=setTimeout(function(){delete epos.intervalid;if(epos.enabled){epos.send()}},delay)}delete epos.intervalxhr}function CanvasPrint(address){this.address=address;this.mode="mono";this.halftone=0;this.brightness=1;this.align="left";this.color="color_1";this.paper="receipt";this.feed="current_tof";this.cut=false;this.layout=null;this.ALIGN_LEFT="left";this.ALIGN_CENTER="center";this.ALIGN_RIGHT="right";this.COLOR_NONE="none";this.COLOR_1="color_1";this.COLOR_2="color_2";this.COLOR_3="color_3";this.COLOR_4="color_4";this.FEED_PEELING="peeling";this.FEED_CUTTING="cutting";this.FEED_CURRENT_TOF="current_tof";this.FEED_NEXT_TOF="next_tof";this.HALFTONE_DITHER=0;this.HALFTONE_ERROR_DIFFUSION=1;this.HALFTONE_THRESHOLD=2;this.MODE_MONO="mono";this.MODE_GRAY16="gray16";this.PAPER_RECEIPT="receipt";this.PAPER_RECEIPT_BM="receipt_bm";this.PAPER_LABEL="label";this.PAPER_LABEL_BM="label_bm"}CanvasPrint.prototype=new ePOSPrint();CanvasPrint.prototype.constructor=CanvasPrint;CanvasPrint.prototype.print=function(canvas,cut,mode,printjobid){var args=arguments.length,address=this.address,layout=this.layout,paper=this.paper,builder=new ePOSBuilder();if(!canvas.getContext){throw new Error("Canvas is not supported")}if(layout){builder.addLayout(paper,layout.width,layout.height,layout.margin_top,layout.margin_bottom,layout.offset_cut,layout.offset_label)}if(paper!=this.PAPER_RECEIPT){builder.addFeedPosition(builder.FEED_CURRENT_TOF);if(layout){builder.addFeedPosition(builder.FEED_NEXT_TOF)}}builder.addTextAlign(this.align);builder.halftone=this.halftone;builder.brightness=this.brightness;builder.addImage(canvas.getContext("2d"),0,0,canvas.width,canvas.height,this.color,mode);if(paper!=this.PAPER_RECEIPT){builder.addFeedPosition(this.feed);if(cut){builder.addCut(builder.CUT_NO_FEED)}}else{if(cut){builder.addCut(builder.CUT_FEED)}}this.send(address,builder.toString(),printjobid)};CanvasPrint.prototype.recover=function(){var builder=new ePOSBuilder();builder.force=true;builder.addRecovery();this.send(this.address,builder.toString())};CanvasPrint.prototype.reset=function(){var builder=new ePOSBuilder();builder.addReset();this.send(this.address,builder.toString())};function Printer(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.timeout=10000;this.ipAddress="";var result=this.init();return(result)?this:null}Printer.prototype=new CanvasPrint();Printer.prototype.init=function(){var result=false;try{result=true}catch(e){}return result};Printer.prototype.setIpAddress=function(ipAddress){this.ipAddress=ipAddress};Printer.prototype.toString=function(){var str=ePOSBuilder.prototype.toString.apply(this);return str};Printer.prototype.addFeedUnit=function(unit){try{ePOSBuilder.prototype.addFeedUnit.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addFeedLine=function(line){try{ePOSBuilder.prototype.addFeedLine.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addFeed=function(unit){try{ePOSBuilder.prototype.addFeed.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addFeedPosition=function(line){try{ePOSBuilder.prototype.addFeedPosition.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addText=function(text){try{ePOSBuilder.prototype.addText.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextLang=function(lang){try{ePOSBuilder.prototype.addTextLang.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextAlign=function(align){try{ePOSBuilder.prototype.addTextAlign.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextRotate=function(rotate){try{ePOSBuilder.prototype.addTextRotate.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextLineSpace=function(linespc){try{ePOSBuilder.prototype.addTextLineSpace.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextFont=function(font){try{ePOSBuilder.prototype.addTextFont.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextSmooth=function(smooth){try{ePOSBuilder.prototype.addTextSmooth.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextDouble=function(dw,dh){try{ePOSBuilder.prototype.addTextDouble.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextSize=function(width,height){try{ePOSBuilder.prototype.addTextSize.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextStyle=function(reverse,ul,em,color){try{ePOSBuilder.prototype.addTextStyle.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextPosition=function(x){try{ePOSBuilder.prototype.addTextPosition.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addTextVPosition=function(y){try{ePOSBuilder.prototype.addTextVPosition.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addImage=function(context,x,y,width,height,color,mode){try{ePOSBuilder.prototype.addImage.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addLogo=function(key1,key2){try{ePOSBuilder.prototype.addLogo.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addBarcode=function(barCodeData,type,hri,font,width,height){try{ePOSBuilder.prototype.addBarcode.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addSymbol=function(symbolData,type,level,width,height,size){try{ePOSBuilder.prototype.addSymbol.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addCommand=function(data){try{ePOSBuilder.prototype.addCommand.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addHLine=function(x1,x2,style){try{ePOSBuilder.prototype.addHLine.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addVLineBegin=function(x,style){try{ePOSBuilder.prototype.addVLineBegin.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addVLineEnd=function(x,style){try{ePOSBuilder.prototype.addVLineEnd.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addPageBegin=function(){try{ePOSBuilder.prototype.addPageBegin.apply(this)}catch(e){throw e}return this};Printer.prototype.addPageEnd=function(){try{ePOSBuilder.prototype.addPageEnd.apply(this)}catch(e){throw e}return this};Printer.prototype.addPageArea=function(x,y,width,height){try{ePOSBuilder.prototype.addPageArea.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addPageDirection=function(dir){try{ePOSBuilder.prototype.addPageDirection.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addPagePosition=function(x,y){try{ePOSBuilder.prototype.addPagePosition.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addPageLine=function(x1,y1,x2,y2,style){try{ePOSBuilder.prototype.addPageLine.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addPageRectangle=function(x1,y1,x2,y2,style){try{ePOSBuilder.prototype.addPageRectangle.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addCut=function(type){try{ePOSBuilder.prototype.addCut.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addPulse=function(drawer,time){try{ePOSBuilder.prototype.addPulse.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addSound=function(pattern,repeat,cycle){try{ePOSBuilder.prototype.addSound.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.addLayout=function(type,width,height,margin_top,margin_bottom,offset_cut,offset_label){try{ePOSBuilder.prototype.addLayout.apply(this,arguments)}catch(e){throw e}return this};Printer.prototype.setXmlString=function(xml){this.message=xml};Printer.prototype.getXmlString=function(){return this.message};Printer.prototype.getPrintJobStatus=function(printjobid){this.setXmlString("");this.send(printjobid)};Printer.prototype.send=function(printjobid){var sq=-1;try{var data={type:"print",timeout:this.timeout,printdata:this.toString()};switch(arguments.length){case 0:data.printdata=this.toString();break;case 1:data.printdata=this.toString();data.printjobid=printjobid;break;case 2:case 3:data.printdata=arguments[1];data.printjobid=arguments[2]}sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);this.force=false;this.setXmlString("")}catch(e){sq=-1}return sq};Printer.prototype.client_onxmlresult=function(res,sq){if(res){var xml=res.resultdata;var success=/success\s*=\s*"\s*(1|true)\s*"/.test(xml);xml.match(/code\s*=\s*"\s*(\S*)\s*"/);var code=RegExp.$1;xml.match(/status\s*=\s*"\s*(\d+)\s*"/);var status=parseInt(RegExp.$1);xml.match(/battery\s*=\s*"\s*(\d+)\s*"/);var battery=parseInt(RegExp.$1);this.fireReceiveEvent(success,code,status,battery,res.printjobid,sq)}else{this.fireErrorEvent(0,this.ASB_NO_RESPONSE,sq)}};Printer.prototype.startMonitor=function(){var result=false;var protocol=this.ePosDevObj.connectProtocol;var address=protocol+"://"+this.ipAddress+"/cgi-bin/epos/service.cgi?devid="+this.deviceID+"&timeout=10000";try{if(!this.enabled){this.address=address;this.enabled=true;this.status=this.ASB_DRAWER_KICK;this.sendStartMonitorCommand()}result=true}catch(e){throw e}return result};Printer.prototype.sendStartMonitorCommand=function(){var self=this;var address=this.address;var request=new ePOSBuilder().toString();var soap='<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>'+request+"</s:Body></s:Envelope>";var epos=this;if(window.XDomainRequest){var xdr=new XDomainRequest();xdr.open("POST",address,true);xdr.onload=function(){var res=xdr.responseText;if(/response/.test(res)){var success=/success\s*=\s*"\s*(1|true)\s*"/.test(res);res.match(/code\s*=\s*"\s*(\S*)\s*"/);var code=RegExp.$1;res.match(/status\s*=\s*"\s*(\d+)\s*"/);var status=parseInt(RegExp.$1);res.match(/battery\s*=\s*"\s*(\d+)\s*"/);var battery=parseInt(RegExp.$1);self.fireStatusEvent(epos,status,battery)}else{self.fireStatusEvent(epos,epos.ASB_NO_RESPONSE,0)}self.updateStatus(epos)};xdr.onerror=function(){self.fireStatusEvent(epos,epos.ASB_NO_RESPONSE);self.updateStatus(epos)};xdr.onprogress=function(){};xdr.ontimeout=xdr.onerror;xdr.send(soap)}else{if(window.XMLHttpRequest){var xhr=new XMLHttpRequest();xhr.open("POST",address,true);xhr.setRequestHeader("Content-Type","text/xml; charset=utf-8");xhr.setRequestHeader("If-Modified-Since","Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("SOAPAction",'""');xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200&&xhr.responseXML){var res=xhr.responseXML.getElementsByTagName("response");if(res.length>0){var success=/^(1|true)$/.test(res[0].getAttribute("success"));var code=res[0].getAttribute("code");var status=parseInt(res[0].getAttribute("status"));var battery=res[0].hasAttribute("battery")?parseInt(res[0].getAttribute("battery")):0;self.fireStatusEvent(epos,status,battery)}else{self.fireStatusEvent(epos,epos.ASB_NO_RESPONSE,0)}}else{self.fireStatusEvent(epos,epos.ASB_NO_RESPONSE,0)}self.updateStatus(epos)}};xhr.send(soap)}else{throw new Error("XMLHttpRequest is not supported")}}};Printer.prototype.stopMonitor=function(){var result=false;try{this.enabled=false;if(this.timeoutid){clearTimeout(this.timeoutid);delete this.timeoutid}result=true}catch(e){throw e}return result};Printer.prototype.fireReceiveEvent=function(success,code,status,battery,printjobid,sq){delete this.isPrint;if(this.onreceive){this.onreceive({success:success,code:code,status:status,battery:battery,printjobid:printjobid},sq)}};Printer.prototype.fireErrorEvent=function(status,responseText,sq){if(this.onerror){this.onerror({status:status,responseText:responseText},sq)}};Printer.prototype.fireStatusEvent=function(epos,status,battery){if(status==0||status==this.ASB_NO_RESPONSE){status=this.status|this.ASB_NO_RESPONSE}var diff=this.status==this.ASB_DRAWER_KICK?~0:this.status^status;var difb=this.status==0?~0:this.battery^battery;this.status=status;this.battery=battery;if(diff&&this.onstatuschange){this.onstatuschange(status)}if(difb&&this.onbatterystatuschange){this.onbatterystatuschange(battery)}if(diff&(this.ASB_NO_RESPONSE|this.ASB_OFF_LINE)){if(status&this.ASB_NO_RESPONSE){if(this.onpoweroff){this.onpoweroff()}}else{if(status&this.ASB_OFF_LINE){if(this.onoffline){this.onoffline()}}else{if(this.ononline){this.ononline()}}}}if(diff&this.ASB_COVER_OPEN){if(status&this.ASB_NO_RESPONSE){}else{if(status&this.ASB_COVER_OPEN){if(this.oncoveropen){this.oncoveropen()}}else{if(this.oncoverok){this.oncoverok()}}}}if(diff&(this.ASB_RECEIPT_END|this.ASB_RECEIPT_NEAR_END)){if(status&this.ASB_NO_RESPONSE){}else{if(status&this.ASB_RECEIPT_END){if(this.onpaperend){this.onpaperend()}}else{if(status&this.ASB_RECEIPT_NEAR_END){if(this.onpapernearend){this.onpapernearend()}}else{if(this.onpaperok){this.onpaperok()}}}}}if(diff&this.ASB_DRAWER_KICK){if(status&this.ASB_NO_RESPONSE){}else{if(status&this.ASB_DRAWER_KICK){if(this.drawerOpenLevel==this.DRAWER_OPEN_LEVEL_HIGH){if(this.ondraweropen){this.ondraweropen()}}else{if(this.ondrawerclosed){this.ondrawerclosed()}}if(this.onbatterylow){this.onbatterylow()}}else{if(this.drawerOpenLevel==this.DRAWER_OPEN_LEVEL_HIGH){if(this.ondrawerclosed){this.ondrawerclosed()}}else{if(this.ondraweropen){this.ondraweropen()}}if(this.onbatteryok){this.onbatteryok()}}}}};Printer.prototype.updateStatus=function(){var self=this;if(this.enabled){var delay=this.interval;if(isNaN(delay)||delay<1000){delay=3000}this.timeoutid=setTimeout(function(){delete self.timeoutid;if(self.enabled){self.sendStartMonitorCommand()}},delay)}};Printer.prototype.print=function(canvas,cut,mode,printjobid){try{CanvasPrint.prototype.print.apply(this,arguments)}catch(e){throw e}};Printer.prototype.reset=function(){try{var builder=new ePOSBuilder();builder.addReset();builder.force=this.force;this.send(null,builder.toString())}catch(e){throw e}};Printer.prototype.recover=function(){try{CanvasPrint.prototype.recover.apply(this,arguments)}catch(e){throw e}};function Display(ePosDevObj,deviceID){this.message="";this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.timeout=10000;this.onreceive=null;this.onerror=null;this.ASB_NO_RESPONSE=1;this.ASB_DISPLAY_SUCCESS=2;this.SCROLL_OVERWRITE="overwrite";this.SCROLL_VERTICAL="v_scroll";this.SCROLL_HORIZONTAL="h_scroll";this.MOVE_TOP_LEFT="top_left";this.MOVE_TOP_RIGHT="top_right";this.MOVE_BOTTOM_LEFT="bottom_left";this.MOVE_BOTTOM_RIGHT="bottom_right";this.CURSOR_NONE="none";this.CURSOR_UNDERLINE="underline";this.BRIGHTNESS_20=20;this.BRIGHTNESS_40=40;this.BRIGHTNESS_60=60;this.BRIGHTNESS_100=100;this.MARQUEE_WALK="walk";this.MARQUEE_PLACE="place";var result=this.init();return(result)?this:null}Display.prototype.init=function(){var result=false;try{result=true}catch(e){}return result};Display.prototype.reset=function(){try{this.message+="<reset />"}catch(e){throw e}return this};Display.prototype.createWindow=function(number,x,y,width,hight,scrollMode){try{var s="";s+=getIntAttr("number",number,1,4);s+=getIntAttr("x",x,1,20);s+=getIntAttr("y",y,1,2);s+=getIntAttr("width",width,1,(21-x));s+=getIntAttr("height",hight,1,(3-y));s+=getEnumAttr("scrollmode",scrollMode,regexScrollMode);this.message+="<window"+s+"/>"}catch(e){throw e}return this};Display.prototype.destroyWindow=function(number){try{var s="";s+=getIntAttr("number",number,1,4);this.message+="<window"+s+' destroy="true"/>'}catch(e){throw e}return this};Display.prototype.setCurrentWindow=function(number){try{var s="";s+=getIntAttr("number",number,1,4);this.message+="<window"+s+"/>"}catch(e){throw e}return this};Display.prototype.setCursorPosition=function(){try{var s="";s+=getIntAttr("x",arguments[0],1,20);s+=getIntAttr("y",arguments[1],1,2);this.message+="<cursor"+s+"/>"}catch(e){throw e}return this};Display.prototype.moveCursorPosition=function(){try{var s="";s+=getEnumAttr("moveto",arguments[0],regexMoveto);this.message+="<cursor"+s+"/>"}catch(e){throw e}return this};Display.prototype.setCursorType=function(underline){try{var s="";s+=getEnumAttr("type",underline,regexUnderline);this.message+="<cursor"+s+"/>"}catch(e){throw e}return this};Display.prototype.addText=function(){try{var s="";switch(arguments.length){case 1:break;case 2:s+=' lang="'+arguments[1]+'"';break;case 3:s+=getIntAttr("x",arguments[1],1,20);s+=getIntAttr("y",arguments[2],1,2);break;case 4:s+=getIntAttr("x",arguments[1],1,20);s+=getIntAttr("y",arguments[2],1,2);s+=' lang="'+arguments[3]+'"';break;default:throw new Error("Parameters are invalid");break}this.message+="<text"+s+">"+escapeMarkup(arguments[0])+"</text>"}catch(e){throw e}return this};Display.prototype.addReverseText=function(){try{var s="";switch(arguments.length){case 1:s+=getBoolAttr("reverse",true);break;case 2:s+=' lang="'+arguments[1]+'"';s+=getBoolAttr("reverse",true);break;case 3:s+=getIntAttr("x",arguments[1],1,20);s+=getIntAttr("y",arguments[2],1,2);s+=getBoolAttr("reverse",true);break;case 4:s+=getIntAttr("x",arguments[1],1,20);s+=getIntAttr("y",arguments[2],1,2);s+=' lang="'+arguments[3]+'"';s+=getBoolAttr("reverse",true);break;default:throw new Error("Parameters are invalid");break}this.message+="<text"+s+">"+escapeMarkup(arguments[0])+"</text>"}catch(e){throw e}return this};Display.prototype.clearWindow=function(){try{this.message+="<clear/>"}catch(e){throw e}return this};Display.prototype.setBlink=function(interval){try{var s="";s+=getUShortAttr("interval",interval);this.message+="<blink"+s+"/>"}catch(e){throw e}return this};Display.prototype.setBrightness=function(value){try{var s="";s+=getEnumAttr("value",value,regexBrightness);this.message+="<brightness"+s+"/>"}catch(e){throw e}return this};Display.prototype.addMarquee=function(text,format,uwait,rwait,repeat,lang){try{var s="";s+=getEnumAttr("format",format,regexMarquee);s+=getIntAttr("uwait",uwait,0,2000);s+=getIntAttr("rwait",rwait,100,2000);s+=getIntAttr("repeat",repeat,0,127);if((typeof lang)!=="undefined"){s+=' lang="'+lang+'"'}this.message+="<marquee"+s+">"+escapeMarkup(text)+"</marquee>"}catch(e){throw e}return this};Display.prototype.showClock=function(){try{this.message+="<clock/>"}catch(e){throw e}return this};Display.prototype.addCommand=function(text){try{this.message+="<command>"+toHexBinary(text)+"</command>"}catch(e){throw e}return this};Display.prototype.send=function(){var sq=-1;try{var xml=this.toString();var data={type:"display",timeout:this.timeout,displaydata:xml};sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);this.message=""}catch(e){sq=-1}return sq};Display.prototype.client_onxmlresult=function(res,sq){if(res){var xml=res.resultdata;var success=/success\s*=\s*"\s*(1|true)\s*"/.test(xml);xml.match(/code\s*=\s*"\s*(\S*)\s*"/);var code=RegExp.$1;xml.match(/status\s*=\s*"\s*(\d+)\s*"/);var status=parseInt(RegExp.$1);if(this.onreceive){this.onreceive({success:success,code:code,status:status},sq)}}else{if(this.onerror){this.onerror({status:0,responseText:this.ASB_NO_RESPONSE})}}};Display.prototype.toString=function(){var epos='<epos-display xmlns="http://www.epson-pos.com/schemas/2012/09/epos-display">'+this.message+"</epos-display>";return epos};Display.prototype.setXmlString=function(xml){this.message=xml};Display.prototype.getXmlString=function(){return this.message};Display.prototype.callEvent=function(eventName,data){var eventReq={type:eventName,data:data};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,eventReq);return sq};var regexBrightness=/^(20|40|60|100)$/;var regexScrollMode=/^(overwrite|v_scroll|h_scroll)$/;var regexMoveto=/^(top_left|top_right|bottom_left|bottom_right)$/;var regexUnderline=/^(none|underline)$/;var regexMarquee=/^(walk|place)$/;function HybridPrinter(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.ReceiptPrinter;this.SlipPrinter;this.EndorsePrinter;this.MICRReader;this.force=false;this.onstatuschange;this.ononline;this.onoffline;this.onpoweroff;this.oncoveropen;this.onpaperok;this.onpapernearend;this.onpaperend;this.ondrawerclosed;this.ondraweropen;this.ASB_NO_RESPONSE=1;this.ASB_PRINT_SUCCESS=2;this.ASB_DRAWER_KICK=4;this.ASB_OFF_LINE=8;this.ASB_COVER_OPEN=32;this.ASB_PAPER_FEED=64;this.ASB_WAIT_ON_LINE=256;this.ASB_PANEL_SWITCH=512;this.ASB_MECHANICAL_ERR=1024;this.ASB_AUTOCUTTER_ERR=2048;this.ASB_UNRECOVER_ERR=8192;this.ASB_AUTORECOVER_ERR=16384;this.ASB_RECEIPT_NEAR_END=131072;this.ASB_RECEIPT_END=524288;this.ASB_TOF_NOPAPER=2097152;this.ASB_BOF_NOPAPER=4194304;this.ASB_SLIP_NO_SELECT=16777216;this.ASB_SLIP_IMPOSSIBLE_PRINT=33554432;this.ASB_SPOOLER_IS_STOPPED=2147483648;this.SUCCESS="SUCCESS";this.CANCEL="CANCEL";this.ERROR_PARAMMETER="ERROR_PARAMMETER";this.ERROR_COMMAND="ERROR_COMMAND";this.ERROR_DEVICE_NOT_FOUND="ERROR_DEVICE_NOT_FOUND";this.ERROR_DEVICE_BUSY="ERROR_DEVICE_BUSY";this.ERROR_NOT_SUPPORTED="ERROR_NOT_SUPPORTED";this.ERROR_COVER_OPEN="ERROR_COVER_OPEN";this.ERROR_TIMEOUT="ERROR_TIMEOUT";this.ERROR_AUTOMATICAL="ERROR_AUTOMATICAL";this.ERROR_UNRECOVERABLE="ERROR_UNRECOVERABLE";this.ERROR_BADPORT="ERROR_BADPORT";this.SYSTEM_ERROR="SYSTEM_ERROR";this.init(ePosDevObj,deviceID)}HybridPrinter.prototype={init:function(ePosDevObj,deviceID){var obj=this;obj.ePosDevObj=ePosDevObj;obj.deviceID=deviceID;obj.ReceiptPrinter=new ReceiptPrinter(ePosDevObj,deviceID,this);obj.SlipPrinter=new SlipPrinter(ePosDevObj,deviceID);obj.EndorsePrinter=new EndorsePrinter(ePosDevObj,deviceID);obj.MICRReader=new MICRReader(ePosDevObj,deviceID);obj.ReceiptPrinter.onstatuschange=function(status){if(obj.onstatuschange!=null){obj.onstatuschange(status)}};obj.ReceiptPrinter.ononline=function(){if(obj.ononline!=null){obj.ononline()}};obj.ReceiptPrinter.onoffline=function(){if(obj.onoffline!=null){obj.onoffline()}};obj.ReceiptPrinter.onpoweroff=function(){if(obj.onpoweroff!=null){obj.onpoweroff()}};obj.ReceiptPrinter.oncoveropen=function(){if(obj.oncoveropen!=null){obj.oncoveropen()}};obj.ReceiptPrinter.onpaperok=function(){if(obj.onpaperok!=null){obj.onpaperok()}};obj.ReceiptPrinter.onpapernearend=function(){if(obj.onpapernearend!=null){obj.onpapernearend()}};obj.ReceiptPrinter.onpaperend=function(){if(obj.onpaperend!=null){obj.onpaperend()}};obj.ReceiptPrinter.ondrawerclosed=function(){if(obj.ondrawerclosed!=null){obj.ondrawerclosed()}};obj.ReceiptPrinter.ondraweropen=function(){if(obj.ondraweropen!=null){obj.ondraweropen()}}},setIpAddress:function(ipAddress){this.ReceiptPrinter.setIpAddress(ipAddress)},lock:function(){var sq=-1;try{var data={type:"lock"};sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq},unlock:function(){var sq=-1;try{var data={type:"unlock"};sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq},eject:function(){var sq=-1;try{var data={type:"eject"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq},recover:function(){return this.ReceiptPrinter.recover()},reset:function(){this.ReceiptPrinter.force=this.force;var ret=this.ReceiptPrinter.reset();this.force=false;return ret},startMonitor:function(){return this.ReceiptPrinter.startMonitor()},stopMonitor:function(){return this.ReceiptPrinter.stopMonitor()},client_onreceive:function(res,sq){switch(res.eventtype){case"slipprint":case"slipcancel":this.SlipPrinter.fireOnReceive(res,sq);break;case"endorseprint":case"endorsecancel":this.EndorsePrinter.fireOnReceive(res,sq);break;case"micrread":case"micrcleaning":case"micrcancel":this.MICRReader.fireOnReceive(res,sq);break;case"print":var tmp=res;tmp.eventtype=this.ReceiptPrinter.methodName;this.fireOnReceive(tmp,sq);break;default:this.fireOnReceive(res,sq);break}},client_onxmlresult:function(res,sq){this.ReceiptPrinter.fireOnReceive(res,sq)},fireOnReceive:function(res,sq){if(this.onreceive==null){return}if(res==null){return}this.onreceive({eventtype:res.eventtype,success:res.success,code:res.code,status:res.status},sq)},callEvent:function(eventName,data){var eventReq=data;eventReq.type=eventName;var sq=this.ePosDevObj.sendDeviceData(this.deviceID,eventReq);return sq}};function ReceiptPrinter(ePosDevObj,deviceID,hPrinterObj){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.hPrinterObj=hPrinterObj;this.methodName="";this.SUCCESS="SUCCESS";this.CANCEL="CANCEL";this.ERROR_PARAMMETER="ERROR_PARAMMETER";this.ERROR_COMMAND="ERROR_COMMAND";this.ERROR_DEVICE_NOT_FOUND="DeviceNotFound";this.ERROR_DEVICE_BUSY="ERROR_DEVICE_BUSY";this.ERROR_NOT_SUPPORTED="ERROR_NOT_SUPPORTED";this.ERROR_COVER_OPEN="EPTR_COVER_OPEN";this.ERROR_TIMEOUT="EX_TIMEOUT";this.ERROR_AUTOMATICAL="EPTR_AUTOMATICAL";this.ERROR_UNRECOVERABLE="EPTR_UNRECOVERABLE";this.ERROR_BADPORT="EX_BADPORT";this.SYSTEM_ERROR="SYSTEM_ERROR";this.EPTR_CUTTER="EPTR_CUTTER";this.EPTR_MECHANICAL="EPTR_MECHANICAL";this.EPTR_REC_EMPTY="EPTR_REC_EMPTY";this.EPTR_SCHEMAERROR="SchemaError";this.EPTR_PRINT_SYSTEM_ERROR="PrintSystemError"}ReceiptPrinter.prototype=new Printer;ReceiptPrinter.prototype.send=function(){if(this.methodName==""){this.methodName="send"}return Printer.prototype.send.apply(this,arguments)};ReceiptPrinter.prototype.print=function(canvas,cut,mode){this.methodName="print";return Printer.prototype.print.apply(this,arguments)};ReceiptPrinter.prototype.recover=function(){this.methodName="recover";return Printer.prototype.recover.apply(this,arguments)};ReceiptPrinter.prototype.reset=function(){this.methodName="reset";return Printer.prototype.reset.apply(this,arguments)};ReceiptPrinter.prototype.fireOnReceive=function(res,sq){if(this.onreceive==null){return}var eventtype=this.methodName;var success="false";var code="";var status=this.ASB_NO_RESPONSE;if(res){var xml=res.resultdata;success=/success\s*=\s*"\s*(1|true)\s*"/.test(xml);xml.match(/code\s*=\s*"\s*(\S*)\s*"/);code=RegExp.$1;if(code==""){code=(success)?"SUCCESS":"ERROR_DEVICE_NOT_FOUND"}xml.match(/status\s*=\s*"\s*(\d+)\s*"/);status=parseInt(RegExp.$1)}this.onreceive({eventtype:eventtype,success:success,code:code,status:status},sq);this.methodName=""};function SlipPrinter(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.SUCCESS="SUCCESS";this.CANCEL="CANCEL";this.ERROR_PARAMMETER="ERROR_PARAMMETER";this.ERROR_COMMAND="ERROR_COMMAND";this.ERROR_DEVICE_NOT_FOUND="ERROR_DEVICE_NOT_FOUND";this.ERROR_DEVICE_BUSY="ERROR_DEVICE_BUSY";this.ERROR_NOT_SUPPORTED="ERROR_NOT_SUPPORTED";this.ERROR_COVER_OPEN="ERROR_COVER_OPEN";this.ERROR_TIMEOUT="ERROR_TIMEOUT";this.ERROR_AUTOMATICAL="ERROR_AUTOMATICAL";this.ERROR_UNRECOVERABLE="ERROR_UNRECOVERABLE";this.ERROR_BADPORT="ERROR_BADPORT";this.SYSTEM_ERROR="SYSTEM_ERROR";this.EPTR_CUTTER="EPTR_CUTTER";this.EPTR_MECHANICAL="EPTR_MECHANICAL";this.EPTR_REC_EMPTY="EPTR_REC_EMPTY";this.EPTR_SCHEMAERROR="EPTR_SCHEMAERROR";this.EPTR_PRINT_SYSTEM_ERROR="EPTR_PRINT_SYSTEM_ERROR"}SlipPrinter.prototype=new ePOSBuilder();SlipPrinter.prototype.timeout=60000;SlipPrinter.prototype.send=function(){var sq=-1;try{var xml=(arguments.length<1)?this.toString():arguments[1];var data={type:"slipprint",timeout:this.timeout,printdata:xml};sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);this.setXmlString("")}catch(e){sq=-1}return sq};SlipPrinter.prototype.setXmlString=function(xml){this.message=xml};SlipPrinter.prototype.getXmlString=function(){return this.message};SlipPrinter.prototype.cancel=function(){var sq=-1;try{var data={type:"slipcancel"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq};SlipPrinter.prototype.fireOnReceive=function(res,sq){if(this.onreceive==null){return}if(res==null){return}var eventtype="";switch(res.eventtype){case"slipprint":eventtype="send";break;case"slipcancel":eventtype="cancel";break;default:break}this.onreceive({eventtype:eventtype,success:res.success,code:res.code,status:res.status},sq)};function EndorsePrinter(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.mode40cpl=false;this.SUCCESS="SUCCESS";this.CANCEL="CANCEL";this.ERROR_PARAMMETER="ERROR_PARAMMETER";this.ERROR_COMMAND="ERROR_COMMAND";this.ERROR_DEVICE_NOT_FOUND="ERROR_DEVICE_NOT_FOUND";this.ERROR_DEVICE_BUSY="ERROR_DEVICE_BUSY";this.ERROR_NOT_SUPPORTED="ERROR_NOT_SUPPORTED";this.ERROR_COVER_OPEN="ERROR_COVER_OPEN";this.ERROR_TIMEOUT="ERROR_TIMEOUT";this.ERROR_AUTOMATICAL="ERROR_AUTOMATICAL";this.ERROR_UNRECOVERABLE="ERROR_UNRECOVERABLE";this.ERROR_BADPORT="ERROR_BADPORT";this.SYSTEM_ERROR="SYSTEM_ERROR";this.EPTR_CUTTER="EPTR_CUTTER";this.EPTR_MECHANICAL="EPTR_MECHANICAL";this.EPTR_REC_EMPTY="EPTR_REC_EMPTY";this.EPTR_SCHEMAERROR="EPTR_SCHEMAERROR";this.EPTR_PRINT_SYSTEM_ERROR="EPTR_PRINT_SYSTEM_ERROR"}EndorsePrinter.prototype=new ePOSBuilder();EndorsePrinter.prototype.timeout=60000;EndorsePrinter.prototype.send=function(){var sq=-1;try{var xml=(arguments.length<1)?this.toString():arguments[1];var data={type:"endorseprint","40cplmode":this.mode40cpl,timeout:this.timeout,printdata:xml};sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);this.setXmlString("")}catch(e){sq=-1}return sq};EndorsePrinter.prototype.setXmlString=function(xml){this.message=xml};EndorsePrinter.prototype.getXmlString=function(){return this.message};EndorsePrinter.prototype.cancel=function(){var sq=-1;try{var data={type:"endorsecancel"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq};EndorsePrinter.prototype.enable40cplmode=function(flag){this.mode40cpl=flag};EndorsePrinter.prototype.fireOnReceive=function(res,sq){if(this.onreceive==null){return}if(res==null){return}var eventtype="";switch(res.eventtype){case"endorseprint":eventtype="send";break;case"endorsecancel":eventtype="cancel";break;default:break}this.onreceive({eventtype:eventtype,success:res.success,code:res.code,status:res.status},sq)};function MICRReader(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.timeout=60000;this.FONT_E13B="MICR_E13B";this.FONT_CMC7="MICR_CMC7";this.SUCCESS="SUCCESS";this.CANCEL="CANCEL";this.ERROR_PARAMMETER="ERROR_PARAMMETER";this.ERROR_COMMAND="ERROR_COMMAND";this.ERROR_DEVICE_NOT_FOUND="ERROR_DEVICE_NOT_FOUND";this.ERROR_DEVICE_BUSY="ERROR_DEVICE_BUSY";this.ERROR_NOT_SUPPORTED="ERROR_NOT_SUPPORTED";this.ERROR_COVER_OPEN="ERROR_COVER_OPEN";this.ERROR_TIMEOUT="ERROR_TIMEOUT";this.ERROR_AUTOMATICAL="ERROR_AUTOMATICAL";this.ERROR_UNRECOVERABLE="ERROR_UNRECOVERABLE";this.ERROR_BADPORT="ERROR_BADPORT";this.SYSTEM_ERROR="SYSTEM_ERROR";this.EMICR_ILLEGAL_LENGTH="EMICR_ILLEGAL_LENGTH";this.EMICR_NO_MICR="EMICR_NO_MICR";this.EMICR_RECOGNITION="EMICR_RECOGNITION";this.EMICR_READ="EMICR_READ";this.EMICR_NOISE_DETECTED="EMICR_NOISE_DETECTED";this.EMICR_COVER_OPENED="EMICR_COVER_OPENED";this.EMICR_PAPER_JAM="EMICR_PAPER_JAM"}MICRReader.prototype.read=function(ignoreerror,font){var sq=-1;try{var data={type:"micrread",ignoreerror:ignoreerror,font:font,timeout:this.timeout};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq};MICRReader.prototype.cleaning=function(){var sq=-1;try{var data={type:"micrcleaning",timeout:this.timeout};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq};MICRReader.prototype.cancel=function(){var sq=-1;try{var data={type:"micrcancel"};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data)}catch(e){sq=-1}return sq};MICRReader.prototype.fireOnReceive=function(res,sq){if(this.onreceive==null){return}if(res==null){return}var eventtype="";switch(res.eventtype){case"micrread":eventtype="read";break;case"micrcleaning":eventtype="cleaning";break;case"micrcancel":eventtype="cancel";break;default:break}this.onreceive({eventtype:eventtype,success:res.success,code:res.code,status:res.status,data:res.data},sq)};function DeviceTerminal(ePosDevObj,deviceID){this.ePosDevObj=ePosDevObj;this.deviceID=deviceID;this.onshutdown=null;this.onrestart=null}DeviceTerminal.prototype={shutdown:function(password,callback){this.onshutdown=callback;var data={type:"shutdown",password:password};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},client_onshutdown:function(data){try{if(typeof(this.onshutdown)!="function"){return}this.onshutdown(data)}catch(e){}return},restart:function(password,callback){this.onrestart=callback;var data={type:"restart",password:password};var sq=this.ePosDevObj.sendDeviceData(this.deviceID,data);return sq},client_onrestart:function(data){try{if(typeof(this.onrestart)!="function"){return}this.onrestart(data)}catch(e){}return}};function ePosCrypto(){this.pubkey_c;this.secretKey}ePosCrypto.prototype={init:function(){this.pubkey_c="";this.secretKey=""},genClientKeys:function(arg_prime_s,arg_pubkey_s){var g=str2bigInt("2",10);var prime_c=str2bigInt(arg_prime_s,16);var privkey_c=randBigInt(64,0);this.pubkey_c=powMod(g,privkey_c,prime_c);var intPubkey=str2bigInt(arg_pubkey_s,16);var modNum=powMod(intPubkey,privkey_c,prime_c);var strModNum=bigInt2str(modNum,16);var strSecretKey=strModNum.toLowerCase();while(strSecretKey.length<192){strSecretKey="0"+strSecretKey}this.secretKey=md5.bin(strSecretKey)},bfEncrypt:function(data){try{var enc_req={data:data,key:this.secretKey,mode:"cbc",round:16,iv:blowfish.mkIV()};var enc_data=blowfish.encrypt(enc_req);var cdata=base64.encode(enc_data)}catch(e){return""}return cdata},bfDecrypt:function(data){try{var dec_req={data:base64.decode(data),key:this.secretKey,mode:"cbc"};var ddata=blowfish.decrypt(dec_req)}catch(e){return""}return ddata}};
4
+ /*! Socket.IO.js build:0.8.7, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
5
+ (function(exports,global){var io=exports;io.version="0.8.7";io.protocol=1;io.transports=[];io.j=[];io.sockets={};io.connect=function(host,details){var uri=io.util.parseUri(host),uuri,socket;if(global&&global.location){uri.protocol=uri.protocol||global.location.protocol.slice(0,-1);uri.host=uri.host||(global.document?global.document.domain:global.location.hostname);uri.port=uri.port||global.location.port}uuri=io.util.uniqueUri(uri);var options={host:uri.host,secure:"https"==uri.protocol,port:uri.port||("https"==uri.protocol?443:80),query:uri.query||""};io.util.merge(options,details);if(options["force new connection"]||!io.sockets[uuri]){socket=new io.Socket(options)}if(!options["force new connection"]&&socket){io.sockets[uuri]=socket}socket=socket||io.sockets[uuri];return socket.of(uri.path.length>1?uri.path:"")}})("object"===typeof module?module.exports:(this.io={}),this);(function(exports,global){var util=exports.util={};var re=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];util.parseUri=function(str){var m=re.exec(str||""),uri={},i=14;while(i--){uri[parts[i]]=m[i]||""}return uri};util.uniqueUri=function(uri){var protocol=uri.protocol,host=uri.host,port=uri.port;if("document" in global){host=host||document.domain;port=port||(protocol=="https"&&document.location.protocol!=="https:"?443:document.location.port)}else{host=host||"localhost";if(!port&&protocol=="https"){port=443}}return(protocol||"http")+"://"+host+":"+(port||80)};util.query=function(base,addition){var query=util.chunkQuery(base||""),components=[];util.merge(query,util.chunkQuery(addition||""));for(var part in query){if(query.hasOwnProperty(part)){components.push(part+"="+query[part])}}return components.length?"?"+components.join("&"):""};util.chunkQuery=function(qs){var query={},params=qs.split("&"),i=0,l=params.length,kv;for(;i<l;++i){kv=params[i].split("=");if(kv[0]){query[kv[0]]=decodeURIComponent(kv[1])}}return query};var pageLoaded=false;util.load=function(fn){if("document" in global&&document.readyState==="complete"||pageLoaded){return fn()}util.on(global,"load",fn,false)};util.on=function(element,event,fn,capture){if(element.attachEvent){element.attachEvent("on"+event,fn)}else{if(element.addEventListener){element.addEventListener(event,fn,capture)}}};util.request=function(xdomain){if(xdomain&&"undefined"!=typeof XDomainRequest){return new XDomainRequest()}if("undefined"!=typeof XMLHttpRequest&&(!xdomain||util.ua.hasCORS)){return new XMLHttpRequest()}if(!xdomain){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}return null};if("undefined"!=typeof window){util.load(function(){pageLoaded=true})}util.defer=function(fn){if(!util.ua.webkit||"undefined"!=typeof importScripts){return fn()}util.load(function(){setTimeout(fn,100)})};util.merge=function merge(target,additional,deep,lastseen){var seen=lastseen||[],depth=typeof deep=="undefined"?2:deep,prop;for(prop in additional){if(additional.hasOwnProperty(prop)&&util.indexOf(seen,prop)<0){if(typeof target[prop]!=="object"||!depth){target[prop]=additional[prop];seen.push(additional[prop])}else{util.merge(target[prop],additional[prop],depth-1,seen)}}}return target};util.mixin=function(ctor,ctor2){util.merge(ctor.prototype,ctor2.prototype)};util.inherit=function(ctor,ctor2){function f(){}f.prototype=ctor2.prototype;ctor.prototype=new f};util.isArray=Array.isArray||function(obj){return Object.prototype.toString.call(obj)==="[object Array]"};util.intersect=function(arr,arr2){var ret=[],longest=arr.length>arr2.length?arr:arr2,shortest=arr.length>arr2.length?arr2:arr;for(var i=0,l=shortest.length;i<l;i++){if(~util.indexOf(longest,shortest[i])){ret.push(shortest[i])}}return ret};util.indexOf=function(arr,o,i){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(arr,o,i)}for(var j=arr.length,i=i<0?i+j<0?0:i+j:i||0;i<j&&arr[i]!==o;i++){}return j<=i?-1:i};util.toArray=function(enu){var arr=[];for(var i=0,l=enu.length;i<l;i++){arr.push(enu[i])}return arr};util.ua={};util.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&(function(){try{var a=new XMLHttpRequest()}catch(e){return false}return a.withCredentials!=undefined})();util.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent)})("undefined"!=typeof io?io:module.exports,this);(function(exports,io){exports.EventEmitter=EventEmitter;function EventEmitter(){}EventEmitter.prototype.on=function(name,fn){if(!this.$events){this.$events={}}if(!this.$events[name]){this.$events[name]=fn}else{if(io.util.isArray(this.$events[name])){this.$events[name].push(fn)}else{this.$events[name]=[this.$events[name],fn]}}return this};EventEmitter.prototype.addListener=EventEmitter.prototype.on;EventEmitter.prototype.once=function(name,fn){var self=this;function on(){self.removeListener(name,on);fn.apply(this,arguments)}on.listener=fn;this.on(name,on);return this};EventEmitter.prototype.removeListener=function(name,fn){if(this.$events&&this.$events[name]){var list=this.$events[name];if(io.util.isArray(list)){var pos=-1;for(var i=0,l=list.length;i<l;i++){if(list[i]===fn||(list[i].listener&&list[i].listener===fn)){pos=i;break}}if(pos<0){return this}list.splice(pos,1);if(!list.length){delete this.$events[name]}}else{if(list===fn||(list.listener&&list.listener===fn)){delete this.$events[name]}}}return this};EventEmitter.prototype.removeAllListeners=function(name){if(this.$events&&this.$events[name]){this.$events[name]=null}return this};EventEmitter.prototype.listeners=function(name){if(!this.$events){this.$events={}}if(!this.$events[name]){this.$events[name]=[]}if(!io.util.isArray(this.$events[name])){this.$events[name]=[this.$events[name]]}return this.$events[name]};EventEmitter.prototype.emit=function(name){if(!this.$events){return false}var handler=this.$events[name];if(!handler){return false}var args=Array.prototype.slice.call(arguments,1);if("function"==typeof handler){handler.apply(this,args)}else{if(io.util.isArray(handler)){var listeners=handler.slice();for(var i=0,l=listeners.length;i<l;i++){listeners[i].apply(this,args)}}else{return false}}return true}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(exports,nativeJSON){if(nativeJSON&&nativeJSON.parse){return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify}}var JSON=exports.JSON={};function f(n){return n<10?"0"+n:n}function date(d,key){return isFinite(d.valueOf())?d.getUTCFullYear()+"-"+f(d.getUTCMonth()+1)+"-"+f(d.getUTCDate())+"T"+f(d.getUTCHours())+":"+f(d.getUTCMinutes())+":"+f(d.getUTCSeconds())+"Z":null}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value instanceof Date){value=date(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})};JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}})("undefined"!=typeof io?io:module.exports,typeof JSON!=="undefined"?JSON:undefined);(function(exports,io){var parser=exports.parser={};var packets=parser.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"];var reasons=parser.reasons=["transport not supported","client not handshaken","unauthorized"];var advice=parser.advice=["reconnect"];var JSON=io.JSON,indexOf=io.util.indexOf;parser.encodePacket=function(packet){var type=indexOf(packets,packet.type),id=packet.id||"",endpoint=packet.endpoint||"",ack=packet.ack,data=null;switch(packet.type){case"error":var reason=packet.reason?indexOf(reasons,packet.reason):"",adv=packet.advice?indexOf(advice,packet.advice):"";if(reason!==""||adv!==""){data=reason+(adv!==""?("+"+adv):"")}break;case"message":if(packet.data!==""){data=packet.data}break;case"event":var ev={name:packet.name};if(packet.args&&packet.args.length){ev.args=packet.args}data=JSON.stringify(ev);break;case"json":data=JSON.stringify(packet.data);break;case"connect":if(packet.qs){data=packet.qs}break;case"ack":data=packet.ackId+(packet.args&&packet.args.length?"+"+JSON.stringify(packet.args):"");break}var encoded=[type,id+(ack=="data"?"+":""),endpoint];if(data!==null&&data!==undefined){encoded.push(data)}return encoded.join(":")};parser.encodePayload=function(packets){var decoded="";if(packets.length==1){return packets[0]}for(var i=0,l=packets.length;i<l;i++){var packet=packets[i];decoded+="\ufffd"+packet.length+"\ufffd"+packets[i]}return decoded};var regexp=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;parser.decodePacket=function(data){var pieces=data.match(regexp);if(!pieces){return{}}var id=pieces[2]||"",data=pieces[5]||"",packet={type:packets[pieces[1]],endpoint:pieces[4]||""};if(id){packet.id=id;if(pieces[3]){packet.ack="data"}else{packet.ack=true}}switch(packet.type){case"error":var pieces=data.split("+");packet.reason=reasons[pieces[0]]||"";packet.advice=advice[pieces[1]]||"";break;case"message":packet.data=data||"";break;case"event":try{var opts=JSON.parse(data);packet.name=opts.name;packet.args=opts.args}catch(e){}packet.args=packet.args||[];break;case"json":try{packet.data=JSON.parse(data)}catch(e){}break;case"connect":packet.qs=data||"";break;case"ack":var pieces=data.match(/^([0-9]+)(\+)?(.*)/);if(pieces){packet.ackId=pieces[1];packet.args=[];if(pieces[3]){try{packet.args=pieces[3]?JSON.parse(pieces[3]):[]}catch(e){}}}break;case"disconnect":case"heartbeat":break}return packet};parser.decodePayload=function(data){if(data.charAt(0)=="\ufffd"){var ret=[];for(var i=1,length="";i<data.length;i++){if(data.charAt(i)=="\ufffd"){ret.push(parser.decodePacket(data.substr(i+1).substr(0,length)));i+=Number(length)+1;length=""}else{length+=data.charAt(i)}}return ret}else{return[parser.decodePacket(data)]}}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(exports,io){exports.Transport=Transport;function Transport(socket,sessid){this.socket=socket;this.sessid=sessid}io.util.mixin(Transport,io.EventEmitter);Transport.prototype.onData=function(data){this.clearCloseTimeout();if(this.socket.connected||this.socket.connecting||this.socket.reconnecting){this.setCloseTimeout()}if(data!==""){var msgs=io.parser.decodePayload(data);if(msgs&&msgs.length){for(var i=0,l=msgs.length;i<l;i++){this.onPacket(msgs[i])}}}return this};Transport.prototype.onPacket=function(packet){if(packet.type=="heartbeat"){return this.onHeartbeat()}if(packet.type=="connect"&&packet.endpoint==""){this.onConnect()}this.socket.onPacket(packet);return this};Transport.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var self=this;this.closeTimeout=setTimeout(function(){self.onDisconnect()},this.socket.closeTimeout)}};Transport.prototype.onDisconnect=function(){if(this.close&&this.open){this.close()}this.clearTimeouts();this.socket.onDisconnect();return this};Transport.prototype.onConnect=function(){this.socket.onConnect();return this};Transport.prototype.clearCloseTimeout=function(){if(this.closeTimeout){clearTimeout(this.closeTimeout);this.closeTimeout=null}};Transport.prototype.clearTimeouts=function(){this.clearCloseTimeout();if(this.reopenTimeout){clearTimeout(this.reopenTimeout)}};Transport.prototype.packet=function(packet){this.send(io.parser.encodePacket(packet))};Transport.prototype.onHeartbeat=function(heartbeat){this.packet({type:"heartbeat"})};Transport.prototype.onOpen=function(){this.open=true;this.clearCloseTimeout();this.socket.onOpen()};Transport.prototype.onClose=function(){var self=this;this.open=false;this.socket.onClose();this.onDisconnect()};Transport.prototype.prepareUrl=function(){var options=this.socket.options;return this.scheme()+"://"+options.host+":"+options.port+"/"+options.resource+"/"+io.protocol+"/"+this.name+"/"+this.sessid};Transport.prototype.ready=function(socket,fn){fn.call(this)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(exports,io,global){exports.Socket=Socket;function Socket(options){this.options={port:80,secure:false,document:"document" in global?document:false,resource:"socket.io",transports:io.transports,"connect timeout":10000,"try multiple transports":true,reconnect:true,"reconnection delay":500,"reconnection limit":Infinity,"reopen delay":3000,"max reconnection attempts":10,"sync disconnect on unload":true,"auto connect":true,"flash policy port":10843};io.util.merge(this.options,options);this.connected=false;this.open=false;this.connecting=false;this.reconnecting=false;this.namespaces={};this.buffer=[];this.doBuffer=false;if(this.options["sync disconnect on unload"]&&(!this.isXDomain()||io.util.ua.hasCORS)){var self=this;io.util.on(global,"beforeunload",function(){self.disconnectSync()},false)}if(this.options["auto connect"]){this.connect()}}io.util.mixin(Socket,io.EventEmitter);Socket.prototype.of=function(name){if(!this.namespaces[name]){this.namespaces[name]=new io.SocketNamespace(this,name);if(name!==""){this.namespaces[name].packet({type:"connect"})}}return this.namespaces[name]};Socket.prototype.publish=function(){this.emit.apply(this,arguments);var nsp;for(var i in this.namespaces){if(this.namespaces.hasOwnProperty(i)){nsp=this.of(i);nsp.$emit.apply(nsp,arguments)}}};function empty(){}Socket.prototype.handshake=function(fn){var self=this,options=this.options;function complete(data){if(data instanceof Error){self.onError(data.message)}else{fn.apply(null,data.split(":"))}}var url=["http"+(options.secure?"s":"")+":/",options.host+":"+options.port,options.resource,io.protocol,io.util.query(this.options.query,"t="+ +new Date)].join("/");var loadTimeout=setTimeout(function(){if(typeof script!=="undefined"){try{var srcIndex=script.src.lastIndexOf("=")+1;var arrayIndex=script.src.substring(srcIndex);io.j[arrayIndex]=function(data){script.parentNode.removeChild(script)}}catch(e){}}self.publish("connect_failed")},this.options["connect timeout"]);if(this.isXDomain()&&!io.util.ua.hasCORS){var insertAt=document.getElementsByTagName("script")[0],script=document.createElement("script");script.src=url+"&jsonp="+io.j.length;insertAt.parentNode.insertBefore(script,insertAt);io.j.push(function(data){clearTimeout(loadTimeout);complete(data);script.parentNode.removeChild(script)})}else{var xhr=io.util.request();xhr.open("GET",url,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){xhr.onreadystatechange=empty;clearTimeout(loadTimeout);if(xhr.status==200){complete(xhr.responseText)}else{!self.reconnecting&&self.onError(xhr.responseText)}}};xhr.timeout=this.options["connect timeout"];xhr.send(null)}};Socket.prototype.getTransport=function(override){var transports=override||this.transports,match;for(var i=0,transport;transport=transports[i];i++){if(io.Transport[transport]&&io.Transport[transport].check(this)&&(!this.isXDomain()||io.Transport[transport].xdomainCheck())){return new io.Transport[transport](this,this.sessionid)}}return null};Socket.prototype.connect=function(fn){if(this.connecting){return this}var self=this;this.handshake(function(sid,heartbeat,close,transports){self.sessionid=sid;self.closeTimeout=close*1000;self.heartbeatTimeout=heartbeat*1000;self.transports=io.util.intersect(transports.split(","),self.options.transports);function connect(transports){if(self.transport){self.transport.clearTimeouts()}self.transport=self.getTransport(transports);if(!self.transport){return self.publish("connect_failed")}self.transport.ready(self,function(){self.connecting=true;self.publish("connecting",self.transport.name);self.transport.open();if(self.options["connect timeout"]){self.connectTimeoutTimer=setTimeout(function(){if(!self.connected){self.connecting=false;if(self.options["try multiple transports"]){if(!self.remainingTransports){self.remainingTransports=self.transports.slice(0)}var remaining=self.remainingTransports;while(remaining.length>0&&remaining.splice(0,1)[0]!=self.transport.name){}if(remaining.length){connect(remaining)}else{self.publish("connect_failed")}}}},self.options["connect timeout"])}})}connect();self.once("connect",function(){clearTimeout(self.connectTimeoutTimer);fn&&typeof fn=="function"&&fn()})});return this};Socket.prototype.packet=function(data){if(this.connected&&!this.doBuffer){this.transport.packet(data)}else{this.buffer.push(data)}return this};Socket.prototype.setBuffer=function(v){this.doBuffer=v;if(!v&&this.connected&&this.buffer.length){this.transport.payload(this.buffer);this.buffer=[]}};Socket.prototype.disconnect=function(){if(this.connected){if(this.open){this.of("").packet({type:"disconnect"})}this.onDisconnect("booted")}return this};Socket.prototype.disconnectSync=function(){var xhr=io.util.request(),uri=this.resource+"/"+io.protocol+"/"+this.sessionid;xhr.open("GET",uri,true);this.onDisconnect("booted")};Socket.prototype.isXDomain=function(){var port=global.location.port||("https:"==global.location.protocol?443:80);return this.options.host!==global.location.hostname||this.options.port!=port};Socket.prototype.onConnect=function(){if(!this.connected){this.connected=true;this.connecting=false;if(!this.doBuffer){this.setBuffer(false)}this.emit("connect")}};Socket.prototype.onOpen=function(){this.open=true};Socket.prototype.onClose=function(){this.open=false};Socket.prototype.onPacket=function(packet){this.of(packet.endpoint).onPacket(packet)};Socket.prototype.onError=function(err){if(err&&err.advice){if(err.advice==="reconnect"&&this.connected){this.disconnect();this.reconnect()}}this.publish("error",err&&err.reason?err.reason:err)};Socket.prototype.onDisconnect=function(reason){var wasConnected=this.connected;this.connected=false;this.connecting=false;this.open=false;if(wasConnected){this.transport.close();this.transport.clearTimeouts();this.publish("disconnect",reason);if("booted"!=reason&&this.options.reconnect&&!this.reconnecting){this.reconnect()}}};Socket.prototype.reconnect=function(){this.reconnecting=true;this.reconnectionAttempts=0;this.reconnectionDelay=this.options["reconnection delay"];var self=this,maxAttempts=this.options["max reconnection attempts"],tryMultiple=this.options["try multiple transports"],limit=this.options["reconnection limit"];function reset(){if(self.connected){for(var i in self.namespaces){if(self.namespaces.hasOwnProperty(i)&&""!==i){self.namespaces[i].packet({type:"connect"})}}self.publish("reconnect",self.transport.name,self.reconnectionAttempts)}self.removeListener("connect_failed",maybeReconnect);self.removeListener("connect",maybeReconnect);self.reconnecting=false;delete self.reconnectionAttempts;delete self.reconnectionDelay;delete self.reconnectionTimer;delete self.redoTransports;self.options["try multiple transports"]=tryMultiple}function maybeReconnect(){if(!self.reconnecting){return}if(self.connected){return reset()}if(self.connecting&&self.reconnecting){return self.reconnectionTimer=setTimeout(maybeReconnect,1000)}if(self.reconnectionAttempts++>=maxAttempts){if(!self.redoTransports){self.on("connect_failed",maybeReconnect);self.options["try multiple transports"]=true;self.transport=self.getTransport();self.redoTransports=true;self.connect()}else{self.publish("reconnect_failed");reset()}}else{if(self.reconnectionDelay<limit){self.reconnectionDelay*=2}self.connect();self.publish("reconnecting",self.reconnectionDelay,self.reconnectionAttempts);self.reconnectionTimer=setTimeout(maybeReconnect,self.reconnectionDelay)}}this.options["try multiple transports"]=false;this.reconnectionTimer=setTimeout(maybeReconnect,this.reconnectionDelay);this.on("connect",maybeReconnect)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(exports,io){exports.SocketNamespace=SocketNamespace;function SocketNamespace(socket,name){this.socket=socket;this.name=name||"";this.flags={};this.json=new Flag(this,"json");this.ackPackets=0;this.acks={}}io.util.mixin(SocketNamespace,io.EventEmitter);SocketNamespace.prototype.$emit=io.EventEmitter.prototype.emit;SocketNamespace.prototype.of=function(){return this.socket.of.apply(this.socket,arguments)};SocketNamespace.prototype.packet=function(packet){packet.endpoint=this.name;this.socket.packet(packet);this.flags={};return this};SocketNamespace.prototype.send=function(data,fn){var packet={type:this.flags.json?"json":"message",data:data};if("function"==typeof fn){packet.id=++this.ackPackets;packet.ack=true;this.acks[packet.id]=fn}return this.packet(packet)};SocketNamespace.prototype.emit=function(name){var args=Array.prototype.slice.call(arguments,1),lastArg=args[args.length-1],packet={type:"event",name:name};if("function"==typeof lastArg){packet.id=++this.ackPackets;packet.ack="data";this.acks[packet.id]=lastArg;args=args.slice(0,args.length-1)}packet.args=args;return this.packet(packet)};SocketNamespace.prototype.disconnect=function(){if(this.name===""){this.socket.disconnect()}else{this.packet({type:"disconnect"});this.$emit("disconnect")}return this};SocketNamespace.prototype.onPacket=function(packet){var self=this;function ack(){self.packet({type:"ack",args:io.util.toArray(arguments),ackId:packet.id})}switch(packet.type){case"connect":this.$emit("connect");break;case"disconnect":if(this.name===""){this.socket.onDisconnect(packet.reason||"booted")}else{this.$emit("disconnect",packet.reason)}break;case"message":case"json":var params=["message",packet.data];if(packet.ack=="data"){params.push(ack)}else{if(packet.ack){this.packet({type:"ack",ackId:packet.id})}}this.$emit.apply(this,params);break;case"event":var params=[packet.name].concat(packet.args);if(packet.ack=="data"){params.push(ack)}this.$emit.apply(this,params);break;case"ack":if(this.acks[packet.ackId]){this.acks[packet.ackId].apply(this,packet.args);delete this.acks[packet.ackId]}break;case"error":if(packet.advice){this.socket.onError(packet)}else{if(packet.reason=="unauthorized"){this.$emit("connect_failed",packet.reason)}else{this.$emit("error",packet.reason)}}break}};function Flag(nsp,name){this.namespace=nsp;this.name=name}Flag.prototype.send=function(){this.namespace.flags[this.name]=true;this.namespace.send.apply(this.namespace,arguments)};Flag.prototype.emit=function(){this.namespace.flags[this.name]=true;this.namespace.emit.apply(this.namespace,arguments)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(exports,io,global){exports.websocket=WS;function WS(socket){io.Transport.apply(this,arguments)}io.util.inherit(WS,io.Transport);WS.prototype.name="websocket";WS.prototype.open=function(){var query=io.util.query(this.socket.options.query),self=this,Socket;if(!Socket){Socket=global.MozWebSocket||global.WebSocket}this.websocket=new Socket(this.prepareUrl()+query);this.websocket.onopen=function(){self.onOpen();self.socket.setBuffer(false)};this.websocket.onmessage=function(ev){self.onData(ev.data)};this.websocket.onclose=function(){self.onClose();self.socket.setBuffer(true)};this.websocket.onerror=function(e){self.onError(e)};return this};WS.prototype.send=function(data){this.websocket.send(data);return this};WS.prototype.payload=function(arr){for(var i=0,l=arr.length;i<l;i++){this.packet(arr[i])}return this};WS.prototype.close=function(){this.websocket.close();return this};WS.prototype.onError=function(e){this.socket.onError(e)};WS.prototype.scheme=function(){return this.socket.options.secure?"wss":"ws"};WS.check=function(){return("WebSocket" in global&&!("__addTask" in WebSocket))||"MozWebSocket" in global};WS.xdomainCheck=function(){return true};io.transports.push("websocket")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(exports,io){exports.flashsocket=Flashsocket;function Flashsocket(){io.Transport.websocket.apply(this,arguments)}io.util.inherit(Flashsocket,io.Transport.websocket);Flashsocket.prototype.name="flashsocket";Flashsocket.prototype.open=function(){var self=this,args=arguments;WebSocket.__addTask(function(){io.Transport.websocket.prototype.open.apply(self,args)});return this};Flashsocket.prototype.send=function(){var self=this,args=arguments;WebSocket.__addTask(function(){io.Transport.websocket.prototype.send.apply(self,args)});return this};Flashsocket.prototype.close=function(){WebSocket.__tasks.length=0;io.Transport.websocket.prototype.close.call(this);return this};Flashsocket.prototype.ready=function(socket,fn){function init(){var options=socket.options,port=options["flash policy port"],path=["http"+(options.secure?"s":"")+":/",options.host+":"+options.port,options.resource,"static/flashsocket","WebSocketMain"+(socket.isXDomain()?"Insecure":"")+".swf"];if(!Flashsocket.loaded){if(typeof WEB_SOCKET_SWF_LOCATION==="undefined"){WEB_SOCKET_SWF_LOCATION=path.join("/")}if(port!==843){WebSocket.loadFlashPolicyFile("xmlsocket://"+options.host+":"+port)}WebSocket.__initialize();Flashsocket.loaded=true}fn.call(self)}var self=this;if(document.body){return init()}io.util.load(init)};Flashsocket.check=function(){if(typeof WebSocket=="undefined"||!("__initialize" in WebSocket)||!swfobject){return false}return swfobject.getFlashPlayerVersion().major>=10};Flashsocket.xdomainCheck=function(){return true};if(typeof window!="undefined"){WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=true}io.transports.push("flashsocket")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);if("undefined"!=typeof window){var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}()}(function(){if("undefined"==typeof window||window.WebSocket){return}var console=window.console;if(!console||!console.log||!console.error){console={log:function(){},error:function(){}}}if(!swfobject.hasFlashPlayerVersion("10.0.0")){console.error("Flash Player >= 10.0.0 is required.");return}if(location.protocol=="file:"){console.error("WARNING: web-socket-js doesn't work in file:///... URL unless you set Flash Security Settings properly. Open the page via Web server i.e. http://...")}WebSocket=function(url,protocols,proxyHost,proxyPort,headers){var self=this;self.__id=WebSocket.__nextId++;WebSocket.__instances[self.__id]=self;self.readyState=WebSocket.CONNECTING;self.bufferedAmount=0;self.__events={};if(!protocols){protocols=[]}else{if(typeof protocols=="string"){protocols=[protocols]}}setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(self.__id,url,protocols,proxyHost||null,proxyPort||0,headers||null)})},0)};WebSocket.prototype.send=function(data){if(this.readyState==WebSocket.CONNECTING){throw"INVALID_STATE_ERR: Web Socket connection has not been established"}var result=WebSocket.__flash.send(this.__id,encodeURIComponent(data));if(result<0){return true}else{this.bufferedAmount+=result;return false}};WebSocket.prototype.close=function(){if(this.readyState==WebSocket.CLOSED||this.readyState==WebSocket.CLOSING){return}this.readyState=WebSocket.CLOSING;WebSocket.__flash.close(this.__id)};WebSocket.prototype.addEventListener=function(type,listener,useCapture){if(!(type in this.__events)){this.__events[type]=[]}this.__events[type].push(listener)};WebSocket.prototype.removeEventListener=function(type,listener,useCapture){if(!(type in this.__events)){return}var events=this.__events[type];for(var i=events.length-1;i>=0;--i){if(events[i]===listener){events.splice(i,1);break}}};WebSocket.prototype.dispatchEvent=function(event){var events=this.__events[event.type]||[];for(var i=0;i<events.length;++i){events[i](event)}var handler=this["on"+event.type];if(handler){handler(event)}};WebSocket.prototype.__handleEvent=function(flashEvent){if("readyState" in flashEvent){this.readyState=flashEvent.readyState}if("protocol" in flashEvent){this.protocol=flashEvent.protocol}var jsEvent;if(flashEvent.type=="open"||flashEvent.type=="error"){jsEvent=this.__createSimpleEvent(flashEvent.type)}else{if(flashEvent.type=="close"){jsEvent=this.__createSimpleEvent("close")}else{if(flashEvent.type=="message"){var data=decodeURIComponent(flashEvent.message);jsEvent=this.__createMessageEvent("message",data)}else{throw"unknown event type: "+flashEvent.type}}}this.dispatchEvent(jsEvent)};WebSocket.prototype.__createSimpleEvent=function(type){if(document.createEvent&&window.Event){var event=document.createEvent("Event");event.initEvent(type,false,false);return event}else{return{type:type,bubbles:false,cancelable:false}}};WebSocket.prototype.__createMessageEvent=function(type,data){if(document.createEvent&&window.MessageEvent&&!window.opera){var event=document.createEvent("MessageEvent");event.initMessageEvent("message",false,false,data,null,null,window,null);return event}else{return{type:type,data:data,bubbles:false,cancelable:false}}};WebSocket.CONNECTING=0;WebSocket.OPEN=1;WebSocket.CLOSING=2;WebSocket.CLOSED=3;WebSocket.__flash=null;WebSocket.__instances={};WebSocket.__tasks=[];WebSocket.__nextId=0;WebSocket.loadFlashPolicyFile=function(url){WebSocket.__addTask(function(){WebSocket.__flash.loadManualPolicyFile(url)})};WebSocket.__initialize=function(){if(WebSocket.__flash){return}if(WebSocket.__swfLocation){window.WEB_SOCKET_SWF_LOCATION=WebSocket.__swfLocation}if(!window.WEB_SOCKET_SWF_LOCATION){console.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");return}var container=document.createElement("div");container.id="webSocketContainer";container.style.position="absolute";if(WebSocket.__isFlashLite()){container.style.left="0px";container.style.top="0px"}else{container.style.left="-100px";container.style.top="-100px"}var holder=document.createElement("div");holder.id="webSocketFlash";container.appendChild(holder);document.body.appendChild(container);swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION,"webSocketFlash","1","1","10.0.0",null,null,{hasPriority:true,swliveconnect:true,allowScriptAccess:"always"},null,function(e){if(!e.success){console.error("[WebSocket] swfobject.embedSWF failed")}})};WebSocket.__onFlashInitialized=function(){setTimeout(function(){WebSocket.__flash=document.getElementById("webSocketFlash");WebSocket.__flash.setCallerUrl(location.href);WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);for(var i=0;i<WebSocket.__tasks.length;++i){WebSocket.__tasks[i]()}WebSocket.__tasks=[]},0)};WebSocket.__onFlashEvent=function(){setTimeout(function(){try{var events=WebSocket.__flash.receiveEvents();for(var i=0;i<events.length;++i){WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i])}}catch(e){console.error(e)}},0);return true};WebSocket.__log=function(message){console.log(decodeURIComponent(message))};WebSocket.__error=function(message){console.error(decodeURIComponent(message))};WebSocket.__addTask=function(task){if(WebSocket.__flash){task()}else{WebSocket.__tasks.push(task)}};WebSocket.__isFlashLite=function(){if(!window.navigator||!window.navigator.mimeTypes){return false}var mimeType=window.navigator.mimeTypes["application/x-shockwave-flash"];if(!mimeType||!mimeType.enabledPlugin||!mimeType.enabledPlugin.filename){return false}return mimeType.enabledPlugin.filename.match(/flashlite/i)?true:false};if(!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION){if(window.addEventListener){window.addEventListener("load",function(){WebSocket.__initialize()},false)}else{window.attachEvent("onload",function(){WebSocket.__initialize()})}}})();(function(exports,io,global){exports.XHR=XHR;function XHR(socket){if(!socket){return}io.Transport.apply(this,arguments);this.sendBuffer=[]}io.util.inherit(XHR,io.Transport);XHR.prototype.open=function(){this.socket.setBuffer(false);this.onOpen();this.get();this.setCloseTimeout();return this};XHR.prototype.payload=function(payload){var msgs=[];for(var i=0,l=payload.length;i<l;i++){msgs.push(io.parser.encodePacket(payload[i]))}this.send(io.parser.encodePayload(msgs))};XHR.prototype.send=function(data){this.post(data);return this};function empty(){}XHR.prototype.post=function(data){var self=this;this.socket.setBuffer(true);function stateChange(){if(this.readyState==4){this.onreadystatechange=empty;self.posting=false;if(this.status==200){self.socket.setBuffer(false)}else{self.onClose()}}}function onload(){this.onload=empty;self.socket.setBuffer(false)}this.sendXHR=this.request("POST");if(global.XDomainRequest&&this.sendXHR instanceof XDomainRequest){this.sendXHR.onload=this.sendXHR.onerror=onload}else{this.sendXHR.onreadystatechange=stateChange}this.sendXHR.send(data)};XHR.prototype.close=function(){this.onClose();return this};XHR.prototype.request=function(method){var req=io.util.request(this.socket.isXDomain()),query=io.util.query(this.socket.options.query,"t="+ +new Date);req.open(method||"GET",this.prepareUrl()+query,true);if(method=="POST"){try{if(req.setRequestHeader){req.setRequestHeader("Content-type","text/plain;charset=UTF-8")}else{req.contentType="text/plain"}}catch(e){}}return req};XHR.prototype.scheme=function(){return this.socket.options.secure?"https":"http"};XHR.check=function(socket,xdomain){try{if(io.util.request(xdomain)){return true}}catch(e){}return false};XHR.xdomainCheck=function(){return XHR.check(null,true)}})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(exports,io){exports.htmlfile=HTMLFile;function HTMLFile(socket){io.Transport.XHR.apply(this,arguments)}io.util.inherit(HTMLFile,io.Transport.XHR);HTMLFile.prototype.name="htmlfile";HTMLFile.prototype.get=function(){this.doc=new ActiveXObject("htmlfile");this.doc.open();this.doc.write("<html></html>");this.doc.close();this.doc.parentWindow.s=this;var iframeC=this.doc.createElement("div");iframeC.className="socketio";this.doc.body.appendChild(iframeC);this.iframe=this.doc.createElement("iframe");iframeC.appendChild(this.iframe);var self=this,query=io.util.query(this.socket.options.query,"t="+ +new Date);this.iframe.src=this.prepareUrl()+query;io.util.on(window,"unload",function(){self.destroy()})};HTMLFile.prototype._=function(data,doc){this.onData(data);try{var script=doc.getElementsByTagName("script")[0];script.parentNode.removeChild(script)}catch(e){}};HTMLFile.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(e){}this.doc=null;this.iframe.parentNode.removeChild(this.iframe);this.iframe=null;CollectGarbage()}};HTMLFile.prototype.close=function(){this.destroy();return io.Transport.XHR.prototype.close.call(this)};HTMLFile.check=function(){if("ActiveXObject" in window){try{var a=new ActiveXObject("htmlfile");return a&&io.Transport.XHR.check()}catch(e){}}return false};HTMLFile.xdomainCheck=function(){return false};io.transports.push("htmlfile")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(exports,io,global){exports["xhr-polling"]=XHRPolling;function XHRPolling(){io.Transport.XHR.apply(this,arguments)}io.util.inherit(XHRPolling,io.Transport.XHR);io.util.merge(XHRPolling,io.Transport.XHR);XHRPolling.prototype.name="xhr-polling";XHRPolling.prototype.open=function(){var self=this;io.Transport.XHR.prototype.open.call(self);return false};function empty(){}XHRPolling.prototype.get=function(){if(!this.open){return}var self=this;function stateChange(){if(this.readyState==4){this.onreadystatechange=empty;if(this.status==200){self.onData(this.responseText);self.get()}else{self.onClose()}}}function onload(){this.onload=empty;self.onData(this.responseText);self.get()}this.xhr=this.request();if(global.XDomainRequest&&this.xhr instanceof XDomainRequest){this.xhr.onload=this.xhr.onerror=onload}else{this.xhr.onreadystatechange=stateChange}this.xhr.send(null)};XHRPolling.prototype.onClose=function(){io.Transport.XHR.prototype.onClose.call(this);if(this.xhr){this.xhr.onreadystatechange=this.xhr.onload=empty;try{this.xhr.abort()}catch(e){}this.xhr=null}};XHRPolling.prototype.ready=function(socket,fn){var self=this;io.util.defer(function(){fn.call(self)})};io.transports.push("xhr-polling")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(exports,io,global){var indicator=global.document&&"MozAppearance" in global.document.documentElement.style;exports["jsonp-polling"]=JSONPPolling;function JSONPPolling(socket){io.Transport["xhr-polling"].apply(this,arguments);this.index=io.j.length;var self=this;io.j.push(function(msg){self._(msg)})}io.util.inherit(JSONPPolling,io.Transport["xhr-polling"]);JSONPPolling.prototype.name="jsonp-polling";JSONPPolling.prototype.post=function(data){var self=this,query=io.util.query(this.socket.options.query,"t="+(+new Date)+"&i="+this.index);if(!this.form){var form=document.createElement("form"),area=document.createElement("textarea"),id=this.iframeId="socketio_iframe_"+this.index,iframe;form.className="socketio";form.style.position="absolute";form.style.top="-1000px";form.style.left="-1000px";form.target=id;form.method="POST";form.setAttribute("accept-charset","utf-8");area.name="d";form.appendChild(area);document.body.appendChild(form);this.form=form;this.area=area}this.form.action=this.prepareUrl()+query;function complete(){initIframe();self.socket.setBuffer(false)}function initIframe(){if(self.iframe){self.form.removeChild(self.iframe)}try{iframe=document.createElement('<iframe name="'+self.iframeId+'">')}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();this.area.value=io.JSON.stringify(data);try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){iframe.onreadystatechange=function(){if(self.iframe.readyState=="complete"){complete()}}}else{this.iframe.onload=complete}this.socket.setBuffer(true)};JSONPPolling.prototype.get=function(){var self=this,script=document.createElement("script"),query=io.util.query(this.socket.options.query,"t="+(+new Date)+"&i="+this.index);if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}script.async=true;script.src=this.prepareUrl()+query;script.onerror=function(){self.onClose()};var insertAt=document.getElementsByTagName("script")[0];insertAt.parentNode.insertBefore(script,insertAt);this.script=script;if(indicator){setTimeout(function(){var iframe=document.createElement("iframe");document.body.appendChild(iframe);document.body.removeChild(iframe)},100)}};JSONPPolling.prototype._=function(msg){this.onData(msg);if(this.open){this.get()}return this};JSONPPolling.prototype.ready=function(socket,fn){var self=this;if(!indicator){return fn.call(this)}io.util.load(function(){fn.call(self)})};JSONPPolling.check=function(){return"document" in global};JSONPPolling.xdomainCheck=function(){return true};io.transports.push("jsonp-polling")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);var JSON;if(!JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());base64=new function(){var utfLibName="utf";var b64char="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64encTable=b64char.split("");var b64decTable=[];for(var i=0;i<b64char.length;i++){b64decTable[b64char.charAt(i)]=i}this.encode=function(_dat,_strMode){return encoder(_strMode?unpackUTF8(_dat):unpackChar(_dat))};var encoder=function(_ary){var md=_ary.length%3;var b64="";var i,tmp=0;if(md){for(i=3-md;i>0;i--){_ary[_ary.length]=0}}for(i=0;i<_ary.length;i+=3){tmp=(_ary[i]<<16)|(_ary[i+1]<<8)|_ary[i+2];b64+=b64encTable[(tmp>>>18)&63]+b64encTable[(tmp>>>12)&63]+b64encTable[(tmp>>>6)&63]+b64encTable[tmp&63]}if(md){md=3-md;b64=b64.substr(0,b64.length-md);while(md--){b64+="="}}return b64};this.decode=function(_b64,_strMode){var tmp=decoder(_b64);return _strMode?packUTF8(tmp):packChar(tmp)};var decoder=function(_b64){_b64=_b64.replace(/[^A-Za-z0-9\+\/]/g,"");var md=_b64.length%4;var j,i,tmp;var dat=[];if(md){for(i=0;i<4-md;i++){_b64+="A"}}for(j=i=0;i<_b64.length;i+=4,j+=3){tmp=(b64decTable[_b64.charAt(i)]<<18)|(b64decTable[_b64.charAt(i+1)]<<12)|(b64decTable[_b64.charAt(i+2)]<<6)|b64decTable[_b64.charAt(i+3)];dat[j]=tmp>>>16;dat[j+1]=(tmp>>>8)&255;dat[j+2]=tmp&255}if(md){dat.length-=[0,0,2,1][md]}return dat};var packUTF8=function(_x){return window[utfLibName].packUTF8(_x)};var unpackUTF8=function(_x){return window[utfLibName].unpackUTF8(_x)};var packChar=function(_x){return window[utfLibName].packChar(_x)};var unpackChar=function(_x){return window[utfLibName].unpackChar(_x)}};utf=new function(){this.unpackUTF16=function(_str){var i,utf16=[];for(i=0;i<_str.length;i++){utf16[i]=_str.charCodeAt(i)}return utf16};this.unpackChar=function(_str){var utf16=this.unpackUTF16(_str);var i,n,tmp=[];for(n=i=0;i<utf16.length;i++){if(utf16[i]<=255){tmp[n++]=utf16[i]}else{tmp[n++]=utf16[i]>>8;tmp[n++]=utf16[i]&255}}return tmp};this.packChar=this.packUTF16=function(_utf16){var i,str="";for(i in _utf16){str+=String.fromCharCode(_utf16[i])}return str};this.unpackUTF8=function(_str){return this.toUTF8(this.unpackUTF16(_str))};this.packUTF8=function(_utf8){return this.packUTF16(this.toUTF16(_utf8))};this.toUTF8=function(_utf16){var utf8=[];var idx=0;var i,j,c;for(i=0;i<_utf16.length;i++){c=_utf16[i];if(c<=127){utf8[idx++]=c}else{if(c<=2047){utf8[idx++]=192|(c>>>6);utf8[idx++]=128|(c&63)}else{if(c<=65535){utf8[idx++]=224|(c>>>12);utf8[idx++]=128|((c>>>6)&63);utf8[idx++]=128|(c&63)}else{j=4;while(c>>(6*j)){j++}utf8[idx++]=((65280>>>j)&255)|(c>>>(6*--j));while(j--){utf8[idx++]=128|((c>>>(6*j))&63)}}}}}return utf8};this.toUTF16=function(_utf8){var utf16=[];var idx=0;var i,s;for(i=0;i<_utf8.length;i++,idx++){if(_utf8[i]<=127){utf16[idx]=_utf8[i]}else{if((_utf8[i]>>5)==6){utf16[idx]=((_utf8[i]&31)<<6)|(_utf8[++i]&63)}else{if((_utf8[i]>>4)==14){utf16[idx]=((_utf8[i]&15)<<12)|((_utf8[++i]&63)<<6)|(_utf8[++i]&63)}else{s=1;while(_utf8[i]&(32>>>s)){s++}utf16[idx]=_utf8[i]&(31>>>s);while(s-->=0){utf16[idx]=(utf16[idx]<<6)^(_utf8[++i]&63)}}}}}return utf16};this.URLencode=function(_str){return _str.replace(/([^a-zA-Z0-9_\-\.])/g,function(_tmp,_c){if(_c=="\x20"){return"+"}var tmp=utf.toUTF8([_c.charCodeAt(0)]);var c="";for(var i in tmp){i=tmp[i].toString(16);if(i.length==1){i="0"+i}c+="%"+i}return c})};this.URLdecode=function(_dat){_dat=_dat.replace(/\+/g,"\x20");_dat=_dat.replace(/%([a-fA-F0-9][a-fA-F0-9])/g,function(_tmp,_hex){return String.fromCharCode(parseInt(_hex,16))});return this.packChar(this.toUTF16(this.unpackUTF16(_dat)))}};bpe=0;mask=0;radix=mask+1;digitsStr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\'\"+-";for(bpe=0;(1<<(bpe+1))>(1<<bpe);bpe++){}bpe>>=1;mask=(1<<bpe)-1;radix=mask+1;one=int2bigInt(1,1,1);t=new Array(0);ss=t;s0=t;s1=t;s2=t;s3=t;s4=t;s5=t;s6=t;s7=t;T=t;sa=t;mr_x1=t;mr_r=t;mr_a=t;eg_v=t;eg_u=t;eg_A=t;eg_B=t;eg_C=t;eg_D=t;md_q1=t;md_q2=t;md_q3=t;md_r=t;md_r1=t;md_r2=t;md_tt=t;primes=t;pows=t;s_i=t;s_i2=t;s_R=t;s_rm=t;s_q=t;s_n1=t;s_a=t;s_r2=t;s_n=t;s_b=t;s_d=t;s_x1=t;s_x2=t,s_aa=t;rpprb=t;function findPrimes(n){var i,s,p,ans;s=new Array(n);for(i=0;i<n;i++){s[i]=0}s[0]=2;p=0;for(;s[p]<n;){for(i=s[p]*s[p];i<n;i+=s[p]){s[i]=1}p++;s[p]=s[p-1]+1;for(;s[p]<n&&s[s[p]];s[p]++){}}ans=new Array(p);for(i=0;i<p;i++){ans[i]=s[i]}return ans}function millerRabinInt(x,b){if(mr_x1.length!=x.length){mr_x1=dup(x);mr_r=dup(x);mr_a=dup(x)}copyInt_(mr_a,b);return millerRabin(x,mr_a)}function millerRabin(x,b){var i,j,k,s;if(mr_x1.length!=x.length){mr_x1=dup(x);mr_r=dup(x);mr_a=dup(x)}copy_(mr_a,b);copy_(mr_r,x);copy_(mr_x1,x);addInt_(mr_r,-1);addInt_(mr_x1,-1);k=0;for(i=0;i<mr_r.length;i++){for(j=1;j<mask;j<<=1){if(x[i]&j){s=(k<mr_r.length+bpe?k:0);i=mr_r.length;j=mask}else{k++}}}if(s){rightShift_(mr_r,s)}powMod_(mr_a,mr_r,x);if(!equalsInt(mr_a,1)&&!equals(mr_a,mr_x1)){j=1;while(j<=s-1&&!equals(mr_a,mr_x1)){squareMod_(mr_a,x);if(equalsInt(mr_a,1)){return 0}j++}if(!equals(mr_a,mr_x1)){return 0}}return 1}function bitSize(x){var j,z,w;for(j=x.length-1;(x[j]==0)&&(j>0);j--){}for(z=0,w=x[j];w;(w>>=1),z++){}z+=bpe*j;return z}function expand(x,n){var ans=int2bigInt(0,(x.length>n?x.length:n)*bpe,0);copy_(ans,x);return ans}function randTruePrime(k){var ans=int2bigInt(0,k,0);randTruePrime_(ans,k);return trim(ans,1)}function randProbPrime(k){if(k>=600){return randProbPrimeRounds(k,2)}if(k>=550){return randProbPrimeRounds(k,4)}if(k>=500){return randProbPrimeRounds(k,5)}if(k>=400){return randProbPrimeRounds(k,6)}if(k>=350){return randProbPrimeRounds(k,7)}if(k>=300){return randProbPrimeRounds(k,9)}if(k>=250){return randProbPrimeRounds(k,12)}if(k>=200){return randProbPrimeRounds(k,15)}if(k>=150){return randProbPrimeRounds(k,18)}if(k>=100){return randProbPrimeRounds(k,27)}return randProbPrimeRounds(k,40)}function randProbPrimeRounds(k,n){var ans,i,divisible,B;B=30000;ans=int2bigInt(0,k,0);if(primes.length==0){primes=findPrimes(30000)}if(rpprb.length!=ans.length){rpprb=dup(ans)}for(;;){randBigInt_(ans,k,0);ans[0]|=1;divisible=0;for(i=0;(i<primes.length)&&(primes[i]<=B);i++){if(modInt(ans,primes[i])==0&&!equalsInt(ans,primes[i])){divisible=1;break}}for(i=0;i<n&&!divisible;i++){randBigInt_(rpprb,k,0);while(!greater(ans,rpprb)){randBigInt_(rpprb,k,0)}if(!millerRabin(ans,rpprb)){divisible=1}}if(!divisible){return ans}}}function mod(x,n){var ans=dup(x);mod_(ans,n);return trim(ans,1)}function addInt(x,n){var ans=expand(x,x.length+1);addInt_(ans,n);return trim(ans,1)}function mult(x,y){var ans=expand(x,x.length+y.length);mult_(ans,y);return trim(ans,1)}function powMod(x,y,n){var ans=expand(x,n.length);powMod_(ans,trim(y,2),trim(n,2),0);return trim(ans,1)}function sub(x,y){var ans=expand(x,(x.length>y.length?x.length+1:y.length+1));sub_(ans,y);return trim(ans,1)}function add(x,y){var ans=expand(x,(x.length>y.length?x.length+1:y.length+1));add_(ans,y);return trim(ans,1)}function inverseMod(x,n){var ans=expand(x,n.length);var s;s=inverseMod_(ans,n);return s?trim(ans,1):null}function multMod(x,y,n){var ans=expand(x,n.length);multMod_(ans,y,n);return trim(ans,1)}function randTruePrime_(ans,k){var c,m,pm,dd,j,r,B,divisible,z,zz,recSize;if(primes.length==0){primes=findPrimes(30000)}if(pows.length==0){pows=new Array(512);for(j=0;j<512;j++){pows[j]=Math.pow(2,j/511-1)}}c=0.1;m=20;recLimit=20;if(s_i2.length!=ans.length){s_i2=dup(ans);s_R=dup(ans);s_n1=dup(ans);s_r2=dup(ans);s_d=dup(ans);s_x1=dup(ans);s_x2=dup(ans);s_b=dup(ans);s_n=dup(ans);s_i=dup(ans);s_rm=dup(ans);s_q=dup(ans);s_a=dup(ans);s_aa=dup(ans)}if(k<=recLimit){pm=(1<<((k+2)>>1))-1;copyInt_(ans,0);for(dd=1;dd;){dd=0;ans[0]=1|(1<<(k-1))|Math.floor(Math.random()*(1<<k));for(j=1;(j<primes.length)&&((primes[j]&pm)==primes[j]);j++){if(0==(ans[0]%primes[j])){dd=1;break}}}carry_(ans);return}B=c*k*k;if(k>2*m){for(r=1;k-k*r<=m;){r=pows[Math.floor(Math.random()*512)]}}else{r=0.5}recSize=Math.floor(r*k)+1;randTruePrime_(s_q,recSize);copyInt_(s_i2,0);s_i2[Math.floor((k-2)/bpe)]|=(1<<((k-2)%bpe));divide_(s_i2,s_q,s_i,s_rm);z=bitSize(s_i);for(;;){for(;;){randBigInt_(s_R,z,0);if(greater(s_i,s_R)){break}}addInt_(s_R,1);add_(s_R,s_i);copy_(s_n,s_q);mult_(s_n,s_R);multInt_(s_n,2);addInt_(s_n,1);copy_(s_r2,s_R);multInt_(s_r2,2);for(divisible=0,j=0;(j<primes.length)&&(primes[j]<B);j++){if(modInt(s_n,primes[j])==0&&!equalsInt(s_n,primes[j])){divisible=1;break}}if(!divisible){if(!millerRabinInt(s_n,2)){divisible=1}}if(!divisible){addInt_(s_n,-3);for(j=s_n.length-1;(s_n[j]==0)&&(j>0);j--){}for(zz=0,w=s_n[j];w;(w>>=1),zz++){}zz+=bpe*j;for(;;){randBigInt_(s_a,zz,0);if(greater(s_n,s_a)){break}}addInt_(s_n,3);addInt_(s_a,2);copy_(s_b,s_a);copy_(s_n1,s_n);addInt_(s_n1,-1);powMod_(s_b,s_n1,s_n);addInt_(s_b,-1);if(isZero(s_b)){copy_(s_b,s_a);powMod_(s_b,s_r2,s_n);addInt_(s_b,-1);copy_(s_aa,s_n);copy_(s_d,s_b);GCD_(s_d,s_n);if(equalsInt(s_d,1)){copy_(ans,s_aa);return}}}}}function randBigInt(n,s){var a,b;a=Math.floor((n-1)/bpe)+2;b=int2bigInt(0,0,a);randBigInt_(b,n,s);return b}function randBigInt_(b,n,s){var i,a;for(i=0;i<b.length;i++){b[i]=0}a=Math.floor((n-1)/bpe)+1;for(i=0;i<a;i++){b[i]=Math.floor(Math.random()*(1<<(bpe-1)))}b[a-1]&=(2<<((n-1)%bpe))-1;if(s==1){b[a-1]|=(1<<((n-1)%bpe))}}function GCD(x,y){var xc,yc;xc=dup(x);yc=dup(y);GCD_(xc,yc);return xc}function GCD_(x,y){var i,xp,yp,A,B,C,D,q,sing;if(T.length!=x.length){T=dup(x)}sing=1;while(sing){sing=0;for(i=1;i<y.length;i++){if(y[i]){sing=1;break}}if(!sing){break}for(i=x.length;!x[i]&&i>=0;i--){}xp=x[i];yp=y[i];A=1;B=0;C=0;D=1;while((yp+C)&&(yp+D)){q=Math.floor((xp+A)/(yp+C));qp=Math.floor((xp+B)/(yp+D));if(q!=qp){break}t=A-q*C;A=C;C=t;t=B-q*D;B=D;D=t;t=xp-q*yp;xp=yp;yp=t}if(B){copy_(T,x);linComb_(x,y,A,B);linComb_(y,T,D,C)}else{mod_(x,y);copy_(T,x);copy_(x,y);copy_(y,T)}}if(y[0]==0){return}t=modInt(x,y[0]);copyInt_(x,y[0]);y[0]=t;while(y[0]){x[0]%=y[0];t=x[0];x[0]=y[0];y[0]=t}}function inverseMod_(x,n){var k=1+2*Math.max(x.length,n.length);if(!(x[0]&1)&&!(n[0]&1)){copyInt_(x,0);return 0}if(eg_u.length!=k){eg_u=new Array(k);eg_v=new Array(k);eg_A=new Array(k);eg_B=new Array(k);eg_C=new Array(k);eg_D=new Array(k)}copy_(eg_u,x);copy_(eg_v,n);copyInt_(eg_A,1);copyInt_(eg_B,0);copyInt_(eg_C,0);copyInt_(eg_D,1);for(;;){while(!(eg_u[0]&1)){halve_(eg_u);if(!(eg_A[0]&1)&&!(eg_B[0]&1)){halve_(eg_A);halve_(eg_B)}else{add_(eg_A,n);halve_(eg_A);sub_(eg_B,x);halve_(eg_B)}}while(!(eg_v[0]&1)){halve_(eg_v);if(!(eg_C[0]&1)&&!(eg_D[0]&1)){halve_(eg_C);halve_(eg_D)}else{add_(eg_C,n);halve_(eg_C);sub_(eg_D,x);halve_(eg_D)}}if(!greater(eg_v,eg_u)){sub_(eg_u,eg_v);sub_(eg_A,eg_C);sub_(eg_B,eg_D)}else{sub_(eg_v,eg_u);sub_(eg_C,eg_A);sub_(eg_D,eg_B)}if(equalsInt(eg_u,0)){if(negative(eg_C)){add_(eg_C,n)}copy_(x,eg_C);if(!equalsInt(eg_v,1)){copyInt_(x,0);return 0}return 1}}}function inverseModInt(x,n){var a=1,b=0,t;for(;;){if(x==1){return a}if(x==0){return 0}b-=a*Math.floor(n/x);n%=x;if(n==1){return b}if(n==0){return 0}a-=b*Math.floor(x/n);x%=n}}function inverseModInt_(x,n){return inverseModInt(x,n)}function eGCD_(x,y,v,a,b){var g=0;var k=Math.max(x.length,y.length);if(eg_u.length!=k){eg_u=new Array(k);eg_A=new Array(k);eg_B=new Array(k);eg_C=new Array(k);eg_D=new Array(k)}while(!(x[0]&1)&&!(y[0]&1)){halve_(x);halve_(y);g++}copy_(eg_u,x);copy_(v,y);copyInt_(eg_A,1);copyInt_(eg_B,0);copyInt_(eg_C,0);copyInt_(eg_D,1);for(;;){while(!(eg_u[0]&1)){halve_(eg_u);if(!(eg_A[0]&1)&&!(eg_B[0]&1)){halve_(eg_A);halve_(eg_B)}else{add_(eg_A,y);halve_(eg_A);sub_(eg_B,x);halve_(eg_B)}}while(!(v[0]&1)){halve_(v);if(!(eg_C[0]&1)&&!(eg_D[0]&1)){halve_(eg_C);halve_(eg_D)}else{add_(eg_C,y);halve_(eg_C);sub_(eg_D,x);halve_(eg_D)}}if(!greater(v,eg_u)){sub_(eg_u,v);sub_(eg_A,eg_C);sub_(eg_B,eg_D)}else{sub_(v,eg_u);sub_(eg_C,eg_A);sub_(eg_D,eg_B)}if(equalsInt(eg_u,0)){if(negative(eg_C)){add_(eg_C,y);sub_(eg_D,x)}multInt_(eg_D,-1);copy_(a,eg_C);copy_(b,eg_D);leftShift_(v,g);return}}}function negative(x){return((x[x.length-1]>>(bpe-1))&1)}function greaterShift(x,y,shift){var i,kx=x.length,ky=y.length;k=((kx+shift)<ky)?(kx+shift):ky;for(i=ky-1-shift;i<kx&&i>=0;i++){if(x[i]>0){return 1}}for(i=kx-1+shift;i<ky;i++){if(y[i]>0){return 0}}for(i=k-1;i>=shift;i--){if(x[i-shift]>y[i]){return 1}else{if(x[i-shift]<y[i]){return 0}}}return 0}function greater(x,y){var i;var k=(x.length<y.length)?x.length:y.length;for(i=x.length;i<y.length;i++){if(y[i]){return 0}}for(i=y.length;i<x.length;i++){if(x[i]){return 1}}for(i=k-1;i>=0;i--){if(x[i]>y[i]){return 1}else{if(x[i]<y[i]){return 0}}}return 0}function divide_(x,y,q,r){var kx,ky;var i,j,y1,y2,c,a,b;copy_(r,x);for(ky=y.length;y[ky-1]==0;ky--){}b=y[ky-1];for(a=0;b;a++){b>>=1}a=bpe-a;leftShift_(y,a);leftShift_(r,a);for(kx=r.length;r[kx-1]==0&&kx>ky;kx--){}copyInt_(q,0);while(!greaterShift(y,r,kx-ky)){subShift_(r,y,kx-ky);q[kx-ky]++}for(i=kx-1;i>=ky;i--){if(r[i]==y[ky-1]){q[i-ky]=mask}else{q[i-ky]=Math.floor((r[i]*radix+r[i-1])/y[ky-1])}for(;;){y2=(ky>1?y[ky-2]:0)*q[i-ky];c=y2>>bpe;y2=y2&mask;y1=c+q[i-ky]*y[ky-1];c=y1>>bpe;y1=y1&mask;if(c==r[i]?y1==r[i-1]?y2>(i>1?r[i-2]:0):y1>r[i-1]:c>r[i]){q[i-ky]--}else{break}}linCombShift_(r,y,-q[i-ky],i-ky);if(negative(r)){addShift_(r,y,i-ky);q[i-ky]--}}rightShift_(y,a);rightShift_(r,a)}function carry_(x){var i,k,c,b;k=x.length;c=0;for(i=0;i<k;i++){c+=x[i];b=0;if(c<0){b=-(c>>bpe);c+=b*radix}x[i]=c&mask;c=(c>>bpe)-b}}function modInt(x,n){var i,c=0;for(i=x.length-1;i>=0;i--){c=(c*radix+x[i])%n}return c}function int2bigInt(t,bits,minSize){var i,k;k=Math.ceil(bits/bpe)+1;k=minSize>k?minSize:k;buff=new Array(k);copyInt_(buff,t);return buff}function str2bigInt(s,base,minSize){var d,i,j,x,y,kk;var k=s.length;if(base==-1){x=new Array(0);for(;;){y=new Array(x.length+1);for(i=0;i<x.length;i++){y[i+1]=x[i]}y[0]=parseInt(s,10);x=y;d=s.indexOf(",",0);if(d<1){break}s=s.substring(d+1);if(s.length==0){break}}if(x.length<minSize){y=new Array(minSize);copy_(y,x);return y}return x}x=int2bigInt(0,base*k,0);for(i=0;i<k;i++){d=digitsStr.indexOf(s.substring(i,i+1),0);if(base<=36&&d>=36){d-=26}if(d>=base||d<0){break}multInt_(x,base);addInt_(x,d)}for(k=x.length;k>0&&!x[k-1];k--){}k=minSize>k+1?minSize:k+1;y=new Array(k);kk=k<x.length?k:x.length;for(i=0;i<kk;i++){y[i]=x[i]}for(;i<k;i++){y[i]=0}return y}function equalsInt(x,y){var i;if(x[0]!=y){return 0}for(i=1;i<x.length;i++){if(x[i]){return 0}}return 1}function equals(x,y){var i;var k=x.length<y.length?x.length:y.length;for(i=0;i<k;i++){if(x[i]!=y[i]){return 0}}if(x.length>y.length){for(;i<x.length;i++){if(x[i]){return 0}}}else{for(;i<y.length;i++){if(y[i]){return 0}}}return 1}function isZero(x){var i;for(i=0;i<x.length;i++){if(x[i]){return 0}}return 1}function bigInt2str(x,base){var i,t,s="";if(s6.length!=x.length){s6=dup(x)}else{copy_(s6,x)}if(base==-1){for(i=x.length-1;i>0;i--){s+=x[i]+","}s+=x[0]}else{while(!isZero(s6)){t=divInt_(s6,base);s=digitsStr.substring(t,t+1)+s}}if(s.length==0){s="0"}return s}function dup(x){var i;buff=new Array(x.length);copy_(buff,x);return buff}function copy_(x,y){var i;var k=x.length<y.length?x.length:y.length;for(i=0;i<k;i++){x[i]=y[i]}for(i=k;i<x.length;i++){x[i]=0}}function copyInt_(x,n){var i,c;for(c=n,i=0;i<x.length;i++){x[i]=c&mask;c>>=bpe}}function addInt_(x,n){var i,k,c,b;x[0]+=n;k=x.length;c=0;for(i=0;i<k;i++){c+=x[i];b=0;if(c<0){b=-(c>>bpe);c+=b*radix}x[i]=c&mask;c=(c>>bpe)-b;if(!c){return}}}function rightShift_(x,n){var i;var k=Math.floor(n/bpe);if(k){for(i=0;i<x.length-k;i++){x[i]=x[i+k]}for(;i<x.length;i++){x[i]=0}n%=bpe}for(i=0;i<x.length-1;i++){x[i]=mask&((x[i+1]<<(bpe-n))|(x[i]>>n))}x[i]>>=n}function halve_(x){var i;for(i=0;i<x.length-1;i++){x[i]=mask&((x[i+1]<<(bpe-1))|(x[i]>>1))}x[i]=(x[i]>>1)|(x[i]&(radix>>1))}function leftShift_(x,n){var i;var k=Math.floor(n/bpe);if(k){for(i=x.length;i>=k;i--){x[i]=x[i-k]}for(;i>=0;i--){x[i]=0}n%=bpe}if(!n){return}for(i=x.length-1;i>0;i--){x[i]=mask&((x[i]<<n)|(x[i-1]>>(bpe-n)))}x[i]=mask&(x[i]<<n)}function multInt_(x,n){var i,k,c,b;if(!n){return}k=x.length;c=0;for(i=0;i<k;i++){c+=x[i]*n;b=0;if(c<0){b=-(c>>bpe);c+=b*radix}x[i]=c&mask;c=(c>>bpe)-b}}function divInt_(x,n){var i,r=0,s;for(i=x.length-1;i>=0;i--){s=r*radix+x[i];x[i]=Math.floor(s/n);r=s%n}return r}function linComb_(x,y,a,b){var i,c,k,kk;k=x.length<y.length?x.length:y.length;kk=x.length;for(c=0,i=0;i<k;i++){c+=a*x[i]+b*y[i];x[i]=c&mask;c>>=bpe}for(i=k;i<kk;i++){c+=a*x[i];x[i]=c&mask;c>>=bpe}}function linCombShift_(x,y,b,ys){var i,c,k,kk;k=x.length<ys+y.length?x.length:ys+y.length;kk=x.length;for(c=0,i=ys;i<k;i++){c+=x[i]+b*y[i-ys];x[i]=c&mask;c>>=bpe}for(i=k;c&&i<kk;i++){c+=x[i];x[i]=c&mask;c>>=bpe}}function addShift_(x,y,ys){var i,c,k,kk;k=x.length<ys+y.length?x.length:ys+y.length;kk=x.length;for(c=0,i=ys;i<k;i++){c+=x[i]+y[i-ys];x[i]=c&mask;c>>=bpe}for(i=k;c&&i<kk;i++){c+=x[i];x[i]=c&mask;c>>=bpe}}function subShift_(x,y,ys){var i,c,k,kk;k=x.length<ys+y.length?x.length:ys+y.length;kk=x.length;for(c=0,i=ys;i<k;i++){c+=x[i]-y[i-ys];x[i]=c&mask;c>>=bpe}for(i=k;c&&i<kk;i++){c+=x[i];x[i]=c&mask;c>>=bpe}}function sub_(x,y){var i,c,k,kk;k=x.length<y.length?x.length:y.length;for(c=0,i=0;i<k;i++){c+=x[i]-y[i];x[i]=c&mask;c>>=bpe}for(i=k;c&&i<x.length;i++){c+=x[i];x[i]=c&mask;c>>=bpe}}function add_(x,y){var i,c,k,kk;k=x.length<y.length?x.length:y.length;for(c=0,i=0;i<k;i++){c+=x[i]+y[i];x[i]=c&mask;c>>=bpe}for(i=k;c&&i<x.length;i++){c+=x[i];x[i]=c&mask;c>>=bpe}}function mult_(x,y){var i;if(ss.length!=2*x.length){ss=new Array(2*x.length)}copyInt_(ss,0);for(i=0;i<y.length;i++){if(y[i]){linCombShift_(ss,x,y[i],i)}}copy_(x,ss)}function mod_(x,n){if(s4.length!=x.length){s4=dup(x)}else{copy_(s4,x)}if(s5.length!=x.length){s5=dup(x)}divide_(s4,n,s5,x)}function multMod_(x,y,n){var i;if(s0.length!=2*x.length){s0=new Array(2*x.length)}copyInt_(s0,0);for(i=0;i<y.length;i++){if(y[i]){linCombShift_(s0,x,y[i],i)}}mod_(s0,n);copy_(x,s0)}function squareMod_(x,n){var i,j,d,c,kx,kn,k;for(kx=x.length;kx>0&&!x[kx-1];kx--){}k=kx>n.length?2*kx:2*n.length;if(s0.length!=k){s0=new Array(k)}copyInt_(s0,0);for(i=0;i<kx;i++){c=s0[2*i]+x[i]*x[i];s0[2*i]=c&mask;c>>=bpe;for(j=i+1;j<kx;j++){c=s0[i+j]+2*x[i]*x[j]+c;s0[i+j]=(c&mask);c>>=bpe}s0[i+kx]=c}mod_(s0,n);copy_(x,s0)}function trim(x,k){var i,y;for(i=x.length;i>0&&!x[i-1];i--){}y=new Array(i+k);copy_(y,x);return y}function powMod_(x,y,n){var k1,k2,kn,np;if(s7.length!=n.length){s7=dup(n)}if((n[0]&1)==0){copy_(s7,x);copyInt_(x,1);while(!equalsInt(y,0)){if(y[0]&1){multMod_(x,s7,n)}divInt_(y,2);squareMod_(s7,n)}return}copyInt_(s7,0);for(kn=n.length;kn>0&&!n[kn-1];kn--){}np=radix-inverseModInt(modInt(n,radix),radix);s7[kn]=1;multMod_(x,s7,n);if(s3.length!=x.length){s3=dup(x)}else{copy_(s3,x)}for(k1=y.length-1;k1>0&!y[k1];k1--){}if(y[k1]==0){copyInt_(x,1);return}for(k2=1<<(bpe-1);k2&&!(y[k1]&k2);k2>>=1){}for(;;){if(!(k2>>=1)){k1--;if(k1<0){mont_(x,one,n,np);return}k2=1<<(bpe-1)}mont_(x,x,n,np);if(k2&y[k1]){mont_(x,s3,n,np)}}}function mont_(x,y,n,np){var i,j,c,ui,t,ks;var kn=n.length;var ky=y.length;if(sa.length!=kn){sa=new Array(kn)}copyInt_(sa,0);for(;kn>0&&n[kn-1]==0;kn--){}for(;ky>0&&y[ky-1]==0;ky--){}ks=sa.length-1;for(i=0;i<kn;i++){t=sa[0]+x[i]*y[0];ui=((t&mask)*np)&mask;c=(t+ui*n[0])>>bpe;t=x[i];j=1;for(;j<ky-4;){c+=sa[j]+ui*n[j]+t*y[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j]+t*y[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j]+t*y[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j]+t*y[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j]+t*y[j];sa[j-1]=c&mask;c>>=bpe;j++}for(;j<ky;){c+=sa[j]+ui*n[j]+t*y[j];sa[j-1]=c&mask;c>>=bpe;j++}for(;j<kn-4;){c+=sa[j]+ui*n[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j];sa[j-1]=c&mask;c>>=bpe;j++;c+=sa[j]+ui*n[j];sa[j-1]=c&mask;c>>=bpe;j++}for(;j<kn;){c+=sa[j]+ui*n[j];sa[j-1]=c&mask;c>>=bpe;j++}for(;j<ks;){c+=sa[j];sa[j-1]=c&mask;c>>=bpe;j++}sa[j-1]=c&mask}if(!greater(n,sa)){sub_(sa,n)}copy_(x,sa)}var w;blowfish=new function(){var utfLibName="utf";var def_mode="ecb";var def_padChar="\x05";var def_round=16;var blockLen=8;var keyLen=56;var keyz=[];var tmpBlk=[];var S=[];var P=[];var enc={};var dec={};var rTime=def_round;var argKeyz=["data","key","mode","iv","round","pchar"];var argDKeyz=[argKeyz[0],argKeyz[1],argKeyz[2],argKeyz[4],argKeyz[5]];this.binMode=0;this.mkIV=function(_len){if(!_len||isNaN(_len)){_len=blockLen}var iv="";while(_len--){iv+=String.fromCharCode(Math.floor(Math.random()*255))}return iv};this.mkKey=function(_len){if(!_len||isNaN(_len)){_len=keyLen}var k="";while(_len--){k+=String.fromCharCode(parseInt(Math.random()*80)+32)}return k};this.encrypt=function(){var arg=initArg(arguments,"encrypt",this.binMode);keyUpdate(arg.keyz);tmpBlk=arg.ivz;rTime=checkRound(arg.round);var i,edat="";for(i=0;i<arg.datz.length;i+=blockLen){edat+=packChar(enc[arg.mode](arg.datz.slice(i,i+blockLen)))}return arg.iv+edat};this.decrypt=function(){var arg=initArg(arguments,"decrypt");keyUpdate(arg.keyz);tmpBlk=arg.ivz;rTime=checkRound(arg.round);var i,edat=[];for(i=0;i<arg.datz.length;i+=blockLen){edat=edat.concat(dec[arg.mode](arg.datz.slice(i,i+blockLen)))}return(this.binMode?packChar(edat):packUTF8(edat)).replace(new RegExp(arg.pchar+"+$"),"")};dec.ecb=function(_blk){return round(_blk)};enc.ecb=function(_blk){return re_round(_blk)};enc.cbc=function(_blk){return tmpBlk=round(xor(_blk,tmpBlk))};dec.cbc=function(_blk){var tmp=_blk;_blk=xor(re_round(_blk),tmpBlk);tmpBlk=tmp;return _blk};enc.cfb=function(_blk){return tmpBlk=xor(round(tmpBlk),_blk)};dec.cfb=function(_blk){var tmp=xor(round(tmpBlk),_blk);tmpBlk=_blk;return tmp};enc.ofb=function(_blk){tmpBlk=round(tmpBlk);return xor(tmpBlk,_blk)};dec.ofb=function(_blk){tmpBlk=round(tmpBlk);return xor(tmpBlk,_blk)};var initArg=function(_arg,_encrypt,_bin){var val={};var padDatz=1;var padKeyz=0;var i;var isStr=new Function("_x","return typeof(_x) == typeof('string')");_encrypt=!!(_encrypt&&_encrypt.match(/^enc/i)!==null);var aks=_encrypt?argKeyz:argDKeyz;if(typeof(_arg[0])==typeof(val)){val=_arg[0]}else{for(i=0;i<_arg.length;i++){val[aks[i]]=_arg[i]}}if(!isStr(val.pchar)){val.pchar=def_padChar}var tmpPChar=unpackChar(val.pchar);if(!isStr(val.mode)||val.mode.match(/^(ecb|cbc|ofb|cfb)$/i)===null){val.mode=def_mode}val.mode=val.mode.toLowerCase();if(!isStr(val.key)){val.key="\0"}val.keyz=unpackChar(val.key);if(padKeyz){for(i=val.keyz.length;i<keyLen;i++){val.keyz[i]=0}}if(!_encrypt||_bin){val.datz=unpackChar(val.data)}else{val.datz=unpackUTF8(val.data)}if(_encrypt&&padDatz){for(i=val.datz.length%blockLen;i<blockLen;i++){val.datz[val.datz.length]=tmpPChar}}if(val.mode=="ecb"){val.iv="";val.ivz=[]}else{if(_encrypt){if(!isStr(val.iv)){val.iv=""}val.ivz=unpackChar(val.iv);for(i=val.ivz.length;i<blockLen;i++){val.ivz[i]=0}val.ivz.length=blockLen;val.iv=packChar(val.ivz)}else{val.ivz=val.datz.slice(0,blockLen);val.datz=val.datz.slice(blockLen)}}return val};var xor=function(_a,_b){var i,tmp=[];for(i=0;i<_a.length;i++){tmp[i]=_a[i]^_b[i]}return tmp};var packUTF8=function(_x){return window[utfLibName].packUTF8(_x)};var unpackUTF8=function(_x){return window[utfLibName].unpackUTF8(_x)};var packChar=function(_x){return window[utfLibName].packChar(_x)};var unpackChar=function(_x){return window[utfLibName].unpackChar(_x)};var toBigEndian32=function(_x){var i,tmp=[];for(i=0;i<_x.length;i+=4){tmp[i/4]=(_x[i]<<24)|(_x[i+1]<<16)|(_x[i+2]<<8)|_x[i+3]}return tmp};var fromBigEndian32=function(_x){var i,tmp=[];for(i=0;i<_x.length;i++){tmp[i*4]=(_x[i]>>>24)&255;tmp[i*4+1]=(_x[i]>>>16)&255;tmp[i*4+2]=(_x[i]>>>8)&255;tmp[i*4+3]=_x[i]&255}return tmp};var round=function(_blk,_32){var xl,xr;if(_32){xl=_blk[0];xr=_blk[1]}else{xl=toBigEndian32(_blk.slice(0,4));xr=toBigEndian32(_blk.slice(4))}var i,tmp;for(i=0;i<rTime;i++){xl^=P[i];xr^=f(xl);tmp=xl;xl=xr;xr=tmp}tmp=xl;xl=xr^P[rTime+1];xr=tmp^P[rTime];if(_32){return[xl,xr]}else{return fromBigEndian32([xl,xr])}};var re_round=function(_blk){var xl=toBigEndian32(_blk.slice(0,4));var xr=toBigEndian32(_blk.slice(4));var i,tmp;for(i=rTime+1;i>1;i--){xl^=P[i];xr^=f(xl);tmp=xl;xl=xr;xr=tmp}tmp=xl;xl=xr^P[0];xr=tmp^P[1];return fromBigEndian32([xl,xr])};var f=function(_x){return((S[0][(_x>>>24)&255]+S[1][(_x>>>16)&255])^S[2][(_x>>>8)&255])+S[3][_x&255]};var keyUpdate=function(_key){var keyLen=_key.length;var i,j,tmp;var tmpD=[0,0];initVal();for(j=i=0;i<18;i++){for(tmp=k=0;k<4;k++,j++){tmp=(tmp<<8)|_key[j%keyLen]}P[i]^=tmp}for(i=0;i<18;i+=2){tmpD=round(tmpD,1);P[i]=tmpD[0];P[i+1]=tmpD[1]}for(i=0;i<4;i++){for(j=0;j<=255;j+=2){tmpD=round(tmpD,1);S[i][j]=tmpD[0];S[i][j+1]=tmpD[1]}}};var checkRound=function(_r){if(!_r||isNaN(_r)||_r>16){_r=def_round}return _r};var initVal=function(){P=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731];S=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,2909710000,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409000,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]]}};md5=new function(){var blockLen=64;var state=[1732584193,4023233417,2562383102,271733878];var sttLen=state.length;this.hex=function(_data){return toHex(getMD(_data))};this.dec=function(_data){return getMD(_data)};this.bin=function(_data){return pack(getMD(_data))};var getMD=function(_data){var datz=[];if(isAry(_data)){datz=_data}else{if(isStr(_data)){datz=unpack(_data)}else{"unknown type"}}datz=paddingData(datz);return round(datz)};var isAry=function(_ary){return _ary&&_ary.constructor===[].constructor};var isStr=function(_str){return typeof(_str)==typeof("string")};var round=function(_blk){var stt=[];var tmpS=[];var i,j,tmp,x=[];for(j=0;j<sttLen;j++){stt[j]=state[j]}for(i=0;i<_blk.length;i+=blockLen){for(j=0;j<sttLen;j++){tmpS[j]=stt[j]}x=toLittleEndian32(_blk.slice(i,i+blockLen));for(j=0;j<64;j++){if(j<16){tmp=(stt[1]&stt[2])|(~stt[1]&stt[3])}else{if(j<32){tmp=(stt[1]&stt[3])|(stt[2]&~stt[3])}else{if(j<48){tmp=stt[1]^stt[2]^stt[3]}else{tmp=stt[2]^(stt[1]|~stt[3])}}}tmp+=x[K[j]]+T[j]+stt[0];stt[0]=stt[1]+((tmp<<S[j])|(tmp>>>(32-S[j])));stt=[stt[3],stt[0],stt[1],stt[2]]}for(j=0;j<sttLen;j++){stt[j]+=tmpS[j]}}return fromLittleEndian32(stt)};var paddingData=function(_datz){var datLen=_datz.length;var n=datLen;_datz[n++]=128;while(n%blockLen!=56){_datz[n++]=0}datLen*=8;return _datz.concat(fromLittleEndian32([datLen]),0,0,0,0)};var toHex=function(_decz){var i,hex="";for(i=0;i<_decz.length;i++){hex+=(_decz[i]>15?"":"0")+_decz[i].toString(16)}return hex};var fromLittleEndian32=function(_blk){var tmp=[];for(n=i=0;i<_blk.length;i++){tmp[n++]=_blk[i]&255;tmp[n++]=(_blk[i]>>>8)&255;tmp[n++]=(_blk[i]>>>16)&255;tmp[n++]=(_blk[i]>>>24)&255}return tmp};var toLittleEndian32=function(_blk){var tmp=[];var i,n;for(n=i=0;i<_blk.length;i+=4,n++){tmp[n]=(_blk[i+3]<<24)|(_blk[i+2]<<16)|(_blk[i+1]<<8)|_blk[i]}return tmp};var unpack=function(_dat){var i,n,c,tmp=[];for(n=i=0;i<_dat.length;i++){c=_dat.charCodeAt(i);if(c<=255){tmp[n++]=c}else{tmp[n++]=c>>>8;tmp[n++]=c&255}}return tmp};var pack=function(_ary){var i,tmp="";for(i in _ary){tmp+=String.fromCharCode(_ary[i])}return tmp};var K=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];var S=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];var T=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]};if(!window.epson){window.epson={}}window.epson.ePOSDevice=ePOSDevice})(window);
package.xml CHANGED
@@ -1,24 +1,58 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adyen_Payment</name>
4
- <version>2.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL-3.0)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento Plugin for Payment service provider Adyen</summary>
10
  <description>Magento Plugin for Payment Service Provider Adyen. The plugin supports the Magento Community and Enterprise edition. Inhouse support on magento@adyen.com as well available through GitHub on https://github.com/adyenpayments/magento</description>
11
- <notes>Features:&#xD;
12
- #220 Add only Authorization with success true to the notification queue&#xD;
13
- #221 Added support for HMAC key in Notification&#xD;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  &#xD;
15
- Fixes:&#xD;
16
- #217 Afterpay send in vatCategory = High instead of None&#xD;
17
- #219 Notification Queue does not update attempts if second attempt failed</notes>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  <authors><author><name>Adyen</name><user>adyen</user><email>magento@adyen.com</email></author></authors>
19
- <date>2015-02-24</date>
20
- <time>09:09:11</time>
21
- <contents><target name="magecommunity"><dir name="Adyen"><dir name="Payment"><dir name="Block"><dir name="Adminhtml"><dir name="Adyen"><dir name="Event"><dir name="Queue"><file name="Grid.php" hash="d2cd3e1c4dd24aad20855556e0f8f87f"/></dir><file name="Queue.php" hash="d9d4d4113656ba4d6c97cf8e4c52b903"/></dir></dir><dir name="Form"><dir name="Field"><file name="Installments.php" hash="e73b36349ac2ac5f9687cd5ce5958e53"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="1460f2048e15c0d08405c00e68653a47"/></dir><dir name="Filter"><file name="Adyen.php" hash="f0428953d0ffb335d0d4a1362500ec2e"/></dir><dir name="Invoice"><file name="Totals.php" hash="40f4258c2e79e25bd38abb8ed7a0a778"/></dir><dir name="Renderer"><file name="Adyen.php" hash="44bc7f403e35ce4711101f8b93192190"/></dir><file name="Totals.php" hash="e56db3fa837b78c3fa79851a82bac575"/></dir></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="1976ae2cccf9cbd106ff369625d5120b"/></dir></dir></dir><file name="Version.php" hash="8ae6d538b9616499eb898579bef4abaa"/></dir><dir name="Checkout"><file name="Success.php" hash="9903de28ec3467e222c145491b87839b"/></dir><file name="Failure.php" hash="ead96fee55fba2cbb5044f09566e85e4"/><dir name="Form"><file name="Boleto.php" hash="01789ab9e7470b0466b04ab1b95db52c"/><file name="Cc.php" hash="127b4fd891d144dc60b3093b1ddee02d"/><file name="Elv.php" hash="e796ca82baa55ea4cbbd32f40f643e69"/><file name="Hpp.php" hash="08bf6b40565a450fb9a768219988ed81"/><file name="Oneclick.php" hash="f1d4c1bba402e2da141373209693b927"/><file name="Openinvoice.php" hash="d17d2a4316ba3299337898fa1dd2bccc"/><file name="Pos.php" hash="184fcc568c437868ccff69e139458591"/><file name="Sepa.php" hash="803ad62986393d2f67338fde0aa8b2a3"/></dir><file name="Form.php" hash="77d0589a32cb816dcdc6df16c98f2cd6"/><dir name="Info"><file name="Boleto.php" hash="6068acbb3d3dec90a797390871150956"/><file name="Cc.php" hash="9861c34ed4eee0d0b22d66c9b9a0b9ad"/><file name="Elv.php" hash="09a10412250e2bed303a189cfb216254"/><file name="Hpp.php" hash="bce3945267dac13f4fd9c9fd1400d11c"/><file name="Oneclick.php" hash="b0fb295f9a0572f92f0a1dc7108b9e8a"/><file name="Openinvoice.php" hash="1e99e4ab3ef75a9fa27626bd946b0407"/><file name="Pos.php" hash="8a6be4f35d43dc7791b9741cfb05b8a5"/><file name="Sepa.php" hash="2f6fbcfeb770a208abc9c8dd4cd1a613"/></dir><file name="PosExpressCheckout.php" hash="7ba0d55c5db72b602555ae3c45da4d13"/><file name="Redirect.php" hash="e90771aea572504cb5a109944988aabc"/><dir name="Sales"><dir name="Order"><file name="Totals.php" hash="a39a86ab4e7f49a91c0d3ef37a37d45a"/></dir></dir><file name="SavedCards.php" hash="3fe47b88678d0c30aa3fc6b2b9592eae"/><file name="ScanProduct.php" hash="31c08b14b9e17a8f065b7d553470d518"/></dir><dir name="Helper"><file name="Data.php" hash="11a6a07eb9eadb173d92bf8770bdcaa5"/><file name="Installments.php" hash="6bfc01af88a457be9f444aade1fd5e1d"/></dir><dir name="Model"><dir name="Adyen"><file name="Abstract.php" hash="8bda55aa9890d122e4bb2b05ccd55560"/><file name="Boleto.php" hash="9a3e23f8daee54881a4e82cb26b883df"/><file name="Cc.php" hash="c772702eea7ee37f76bf6450a88f9ac3"/><dir name="Data"><file name="Abstract.php" hash="cdda2d90654bff01f372a817d6e94e1a"/><file name="AdditionalData.php" hash="e4d038a60ac548e0938f75a0452d5717"/><file name="AdditionalDataKVPair.php" hash="cc2e0ba6733ef5139f44ba7c9af303dc"/><file name="Amount.php" hash="73540706cac2c2eef0252615d6200511"/><file name="BankAccount.php" hash="89124b1a311269d878e88acd56391afc"/><file name="BrowserInfo.php" hash="bd1cca3cc27aea7fad85661c7132e2cd"/><file name="Card.php" hash="ea384e9c2032ba7ad5925edfb434625f"/><file name="Classmap.php" hash="38ab9bfbfb1585852380c0551a35b9ec"/><file name="Elv.php" hash="6608688d03b047387a2b28be10c47b87"/><file name="Installments.php" hash="ab285677d94614d631b927b427268eff"/><file name="InvoiceLine.php" hash="2013af2bbae2b07df4db34b4d8565796"/><file name="InvoiceRow.php" hash="caa2f530ea8a2100fee55f9d16fa8235"/><file name="ModificationRequest.php" hash="35877a23e1159cae3b9a1b4687e1a663"/><file name="ModificationResult.php" hash="eec37eba3849baa4ad52b194e31ac362"/><file name="NotificationClassmap.php" hash="31166e4ef9ea728c107f5ee501d67fc5"/><file name="NotificationRequest.php" hash="4647bfc558308e8f7795ae97fbf2c066"/><file name="NotificationRequestItem.php" hash="ef0794de69076f4accc5035b3f659808"/><file name="OpenInvoiceDetailResult.php" hash="68391a7b4b2a460967ec0018a2300396"/><file name="PaymentRequest.php" hash="dacb43ae8ee78bc6b61a30483cec7453"/><file name="PaymentRequest3d.php" hash="505731df1bb63d6426a11e5d3036552f"/><file name="Recurring.php" hash="ae069455222f0315c2eaee6cdf84f461"/><file name="RecurringRequest.php" hash="aed77050f296df4f48c88038ef3ac547"/><dir name="Server"><file name="Notification.php" hash="51ed88aa2c2035e4cb7b4e992e7c8e4a"/><file name="Openinvoice.php" hash="d94166e3c8337e213061655ab7e48e68"/></dir><file name="ShopperName.php" hash="91bfea9ade01d29fa9053de87ce01560"/></dir><file name="Debug.php" hash="8044ccae24d83db38d9430cf125ada83"/><file name="Dummy.php" hash="a72ccc6e8c5268cf6786db289de4e3d9"/><file name="Elv.php" hash="a4deba8bc252ca4ce219f95bfe714a97"/><file name="Hpp.php" hash="22c3d5624fe03b6f66ee2a668209b4f9"/><file name="Oneclick.php" hash="fd17671dd0d6fdd849da02013f33b3ac"/><file name="Openinvoice.php" hash="b525a2e0fe24b0e289340d42f0dc8182"/><file name="Pos.php" hash="d5bcc939415be259d3afd29f70cc82ac"/><file name="Sepa.php" hash="21b0081b6cba065f58a15ea9276587b4"/><file name="Shared.php" hash="7f3fe961a7107b6fb5625a9efe7854fd"/><file name=".DS_Store" hash="d179556f904a5601ccd01a54743c155f"/></dir><file name="Authenticate.php" hash="d7586579e5c52e989f832013649fe03d"/><dir name="Event"><file name="Queue.php" hash="5c31952d94821703bcaf71c2bcd0d2c3"/></dir><file name="Event.php" hash="af5e6761a755bd53872eaa33306d86f1"/><dir name="Mysql4"><dir name="Adyen"><dir name="Debug"><file name="Collection.php" hash="dee84aa1c2b370a72d79031a09b9bba4"/></dir><file name="Debug.php" hash="123808b460f70ad416ed9bb92e6a1d60"/><dir name="Event"><file name="Collection.php" hash="6bbb986416f3e4cb1dc499e568d43ef7"/><dir name="Queue"><file name="Collection.php" hash="0c1323563dbd45a1bb96697c9629500b"/></dir><file name="Queue.php" hash="79045363aff1d62f995dc260914660b4"/></dir><file name="Event.php" hash="4c52b7e1dfb0778ae5ebf76ce8dd1a15"/></dir><file name="Order.php" hash="05c5ce3b68f877b23d1396d13db18517"/><file name="Setup.php" hash="45997ed47c197cb302d6fbb684489201"/></dir><file name="Observer.php" hash="6863e22a7e3dff259b2e224bf5653e29"/><file name="Process.php" hash="6fa6571184cffe9f85dd8c4ca0719ee6"/><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="PaymentFee.php" hash="a5b1568d998315c1fbfae5c74405e41b"/><file name="PaymentInstallmentFee.php" hash="1e794cd1cbfebd097ff43faf624138ce"/></dir></dir></dir></dir><dir name="Source"><file name="BoletoType.php" hash="1a31476c4ebfdb6b16a1dd3a26015fb1"/><file name="CancelModes.php" hash="b18c30b103cdce97af41e63ef0a25a92"/><file name="CaptureModes.php" hash="d2d138f0a59e1e448531f1fd8f908439"/><file name="CcType.php" hash="97d4e2549bec42b8282636f1e98e853a"/><file name="DefaultPaymentMethods.php" hash="2c06a0cb2d8e526afca2b4342b59b32c"/><file name="DemoModes.php" hash="0ce4142166b9f7dc96ee8e1e3bd03286"/><file name="OpeninvoiceType.php" hash="c39389388338dfe0b85b10a1e9b828cb"/><file name="PayPalCaptureModes.php" hash="efdc4f49677ed257af337bb64d06d132"/><file name="PaymentAction.php" hash="23224178cf58e55c308234036f629bf7"/><file name="PaymentRoutines.php" hash="7aa5525e67554ad35226cf1aaa802c49"/><file name="RecurringType.php" hash="2a3c60c4546d9c02c842a9ea0a5ade26"/><file name="SepaFlow.php" hash="64e6fd9181772db70e3dfc012c117a46"/><dir name="Status"><file name="Complete.php" hash="1580706a7d28010ed5acc678f549df73"/><file name="Refund.php" hash="f763d00e989f39dce9daddb7c1bd28f6"/></dir><file name="VisibleType.php" hash="ecc88ad246d8e52316d53f879d615803"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Installments.php" hash="6c3b60719edb83eaaad1515514dab620"/></dir></dir></dir><dir name="Total"><dir name="PaymentFee"><file name="Creditmemo.php" hash="738f7b84586d51cd875011d6b31dfd3e"/><file name="Invoice.php" hash="8aa607b99f709a5eee9b76675e2d5ada"/></dir><dir name="PaymentInstallmentFee"><file name="Creditmemo.php" hash="b40551c179c19ccea7be11a5edf6be4c"/><file name="Invoice.php" hash="5f4563813511aff2eafb98cf4943d817"/></dir></dir><file name=".DS_Store" hash="286b9ee8ade7883fb60d91c7d0c64900"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Adyen"><dir name="Event"><file name="QueueController.php" hash="a561584895f857c40702f19b285ad8a5"/></dir></dir><file name="ExportAdyenSettingsController.php" hash="bb3ff349303c94071b627b3f2bb8a2ec"/></dir><file name="CheckoutCashController.php" hash="6ff54e58a6797d6e87c733e466f777f7"/><file name="CheckoutPosController.php" hash="c7efe60bb75c06fb279fc051597a37b8"/><file name="GetInstallmentsController.php" hash="e46511c8759a6cd064d90f79af5f97c3"/><file name="ProcessController.php" hash="095220633e60d9f7f31b7cc63848f55f"/><file name="SavedCardController.php" hash="992b62e8cdeda582b459cd55cde3ec6b"/><file name="UpdateCartController.php" hash="c7280eb6b5b5f87e2dd9f06cc4370e97"/></dir><dir name="data"><dir name="adyen_setup"><file name="data-upgrade-2.1.2.3-2.1.2.4.php" hash="8262bf4038ba435fe15bd08c36814936"/></dir></dir><dir name="docs"><dir name="httpauthentication"><file name="cgihtaccess.patch" hash="b1ca6c18002d1c22f53c8dd55aee1845"/><file name="howto" hash="31677f6b34fca607f8751c9eb5bdcac2"/></dir><file name="readme" hash="aae2884b18ed35ab74c7e73f4baec6e3"/><file name="test-cards" hash="d7a4a41bc2bb17f74dcbcfbc41156675"/><dir name="translation"><file name="Adyen_Payment.csv" hash="0094e6a70aca120e94cc395f139f1687"/><file name="Mage_Checkout.csv" hash="7d3bcce1ce01d189d113d02b949b73ca"/><file name="howto" hash="00a8a321b06b7235c6e6ca39cfcef80f"/></dir><file name=".DS_Store" hash="cbdf8e79d5e282650b9b7136c3b9ad33"/></dir><dir name="etc"><file name="Notification.wsdl" hash="cbba67067d372790e91225b4049c7e0d"/><file name="Payment.wsdl" hash="4190412f599a3eac827d7ed0931754da"/><file name="adminhtml.xml" hash="77f449af89755295ba515ea52dfda649"/><file name="config.xml" hash="6c9af0d97019e938c8d8c14d84feaadd"/><file name="system.xml" hash="137c1c1d98f032246417edec71e40781"/></dir><dir name="sql"><dir name="adyen_setup"><file name="mysql4-install-0.0.1.php" hash="3c304ff04d461bc0bfa6205c03dceea0"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="3d687c555ed52be5eeb4eaba126abb2b"/><file name="mysql4-upgrade-0.0.7-0.0.8.php" hash="27b202258c2bd16ee64902df7985862e"/><file name="mysql4-upgrade-0.0.8-0.0.9.php" hash="85d3de753b99b541a4547c39b7713905"/><file name="mysql4-upgrade-0.1.0.3-0.1.0.4.php" hash="91a318943b2ead4fd5d3dc7cfa04023e"/><file name="mysql4-upgrade-0.1.0.8-0.1.0.9.php" hash="0ba22acbe3f48fc1ae1e76212a11dc2a"/><file name="mysql4-upgrade-0.1.0.9-0.1.0.10.php" hash="2b029ba94cea8dd9b6d82a0de265234f"/><file name="mysql4-upgrade-1.0.0.3-1.0.0.7.php" hash="b185927a102e0cefa08fe155cfa16004"/><file name="mysql4-upgrade-2.0.3-2.1.0.php" hash="fc4fc300116a7e471fd35699979f21f7"/><file name="mysql4-upgrade-2.1.1-2.1.2.1.php" hash="50716af509a51f67eb3535f59206d3c1"/><file name="mysql4-upgrade-2.1.2.1-2.1.2.2.php" hash="42480b5f0081e89faa8da76e53d10a91"/><file name="mysql4-upgrade-2.1.2.2-2.1.2.3.php" hash="3c68f09a8bcd44943587428ee24e0947"/><file name="mysql4-upgrade-2.2.0-2.2.0.1.php" hash="62cba81b54d9d8f09733946093da241a"/></dir></dir><file name=".DS_Store" hash="8a387d0ed76f7cabfbc3331dd1caead3"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="adyen.xml" hash="088b576dc010f4a7983837fa13785472"/></dir><dir name="template"><dir name="adyen"><dir name="form"><file name="boleto.phtml" hash="83c7bc35d037f426aa75c0719e8adb86"/><file name="cc.phtml" hash="d54095e88b03dcee8ef3183b24a2468b"/><file name="elv.phtml" hash="4d370d2d737f0a42ebcb33e7151ecee6"/><file name="hpp.phtml" hash="38457f21f239afbed434bdae45bef0e3"/><file name="openinvoice.phtml" hash="33127af4713430e153cccbe8684fab13"/><file name="pos.phtml" hash="c07c11d348fced7d889ded4fc77e3363"/><file name="sepa.phtml" hash="00f368ac2b0b5b402174e36bf94cdcc9"/></dir><dir name="info"><file name="boleto.phtml" hash="353271ac7dd3fdfa13780e470bc3693f"/><file name="cc.phtml" hash="8ad4b1f8362136e1b9524e5ec531ee1e"/><file name="elv.phtml" hash="7b41e3cd069c3323ce6080905c8984c3"/><file name="hpp.phtml" hash="06abc95b4690cbeae8875c79c31a6901"/><file name="openinvoice.phtml" hash="7b2de9b28c0eb8e3315d4f0048cc8adf"/><file name="pos.phtml" hash="d37defb03cfa5697455eee174199d595"/><file name="sepa.phtml" hash="79bc367ff04a042b689156ba93e33521"/></dir><dir name="pdf"><file name="boleto.phtml" hash="50853749a944124f076d129fd5e6cfa9"/><file name="cc.phtml" hash="50853749a944124f076d129fd5e6cfa9"/><file name="elv.phtml" hash="50853749a944124f076d129fd5e6cfa9"/><file name="hpp.phtml" hash="4cdb4f7c88b6556fc847c21d5d4b7ffb"/><file name="openinvoice.phtml" hash="742b87babbb612032d68a8e79d31e89c"/><file name="pos.phtml" hash="a3dc27a6607b4978c93b21d945661e5c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="adyen"><dir name="checkout"><dir name="onepage"><dir name="payment"><file name="methods.phtml" hash="a2a0a92b00c43d49e3d63d6da9bb9f85"/></dir></dir><file name="success.phtml" hash="4c06b168acd8971e20a7c8d1205c264b"/><file name=".DS_Store" hash="21ecd78ea5715d7392b2d8a533c6630a"/></dir><dir name="form"><file name="boleto.phtml" hash="309a0152cd5219e2c22da4270307222c"/><file name="cc.phtml" hash="afe72991c2940ca92563d632d87df647"/><file name="elv.phtml" hash="789610e3d1f8973f6aecb4ef119a59c9"/><file name="hpp.phtml" hash="f6883f24a57fcd913b058863ae551df7"/><file name="oneclick.phtml" hash="61002f39563a0a572f9b73abcbafd338"/><file name="openinvoice.phtml" hash="4465f4e5155f4151fb72b2487358f647"/><file name="pos.phtml" hash="674097ccf62f13c969d39c2f6a6824b8"/><file name="sepa.phtml" hash="101dac131fccc22da5c8fc207a8db650"/></dir><dir name="info"><file name="boleto.phtml" hash="c526f9c4badab3afaa771872bb4687f1"/><file name="cc.phtml" hash="cda685b7c94fc401158bf5901e66c8b6"/><file name="elv.phtml" hash="8b850e97ea84e1de5ead4ec487c4356f"/><file name="hpp.phtml" hash="8999dfee0c638f44b5010779b8bbf711"/><file name="openinvoice.phtml" hash="2bcd711e1255923d53f353819e19529e"/><file name="pos.phtml" hash="9b917920aa1cc77c9e8c3a26943b1335"/><file name="sepa.phtml" hash="c886a3d9923c3ade6ca5056f18c1b856"/></dir><dir name="payment"><file name="payment_method_label.phtml" hash="256b943044431874fbaea43760544fcc"/></dir><file name="pos_express_checkout.phtml" hash="f0bd55cb16b8d3bb01a222066f7194fd"/><file name="saved_cards.phtml" hash="dd6685228f8ef29f49aeb82a5c0e4745"/><file name="scan_product.phtml" hash="b3b84dc6804f832919406644a0378492"/><file name=".DS_Store" hash="ab6d0ae72b40033c9fed5850d3f5d499"/></dir></dir><dir name="layout"><file name="adyen.xml" hash="4368d2521f829dab843db9d8ebf076d6"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Adyen_Payment.xml" hash="e4d297a9b401c4548acb47aea1ae41d9"/></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Adyen_Payment.csv" hash="6512eaeaacdfd84b94dbbae212b3f363"/></dir><dir name="es_ES"><file name="Adyen_Payment.csv" hash="b1b6ec9574d78d34839740daa4f0a6c4"/></dir><dir name="fr_FR"><file name="Adyen_Payment.csv" hash="605f6863ed99f51bf5748a12230c76ae"/></dir><dir name="nl_NL"><file name="Adyen_Payment.csv" hash="8f432cb93fa67ddb723f6bd8cbb9685b"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="adyen"><file name="ABNAMRO.png" hash="a621e7f4cf1c3340ac5147fef5544bfe"/><file name="ABNAMRO.xcf" hash="eac24c953dcf05d40ce928ccab2af90f"/><file name="ASNBANK.png" hash="13034bc0836590cfb0ec7b6c3076e435"/><file name="FORTIS.png" hash="3b68fa26a90f8cd44e2f8dfcb5f72fe8"/><file name="FRIESLANDBANK.png" hash="c1388a9b8a170260b0b72da9b2cd2dbf"/><file name="ING.png" hash="b08f829cf67322875ca12d5fc36ac191"/><file name="KNAB.png" hash="4df678f84bdf11db9b75d1e539a0367c"/><file name="POSTBANK.png" hash="ea0ffd9d3e9717fe0bdc160d8cd92482"/><file name="RABOBANK.png" hash="f09418ebbd0d6daf21786d5bde93e856"/><file name="REGIOBANK.png" hash="0c3a984ce817e4d3ec98549be7704712"/><file name="SNSBANK.png" hash="75f988e3ab935d6d509a86f82422f474"/><file name="SNSREGIOBANK.png" hash="34a70ac0e1e0a8cfb56c77a5b1da3c80"/><file name="TESTISSUER.png" hash="0110aadd0f619b39f357b98b63e3ff69"/><file name="TESTISSUER10.png" hash="b2462fe98e69d211e92771ae75f48552"/><file name="TESTISSUER2.png" hash="471cc38e61077fdaba8fd868fea22dfe"/><file name="TESTISSUER3.png" hash="4ca46be0b7607dc95caccb5ec974e0a8"/><file name="TESTISSUER4.png" hash="6e31a3d3e73390432a84e394a1937c5d"/><file name="TESTISSUER5.png" hash="78b758fef66f220e79b1b9ecda8851d2"/><file name="TESTISSUER6.png" hash="4aefac8baaa06592c8a80f085c0ade08"/><file name="TESTISSUER7.png" hash="0474b1a3264ef45068013747a27158d2"/><file name="TESTISSUER8.png" hash="5e655c4af04b417acecac6fd66623662"/><file name="TESTISSUER9.png" hash="6e378c3b7c75febd0be361ec39c55e45"/><file name="TESTISSUERCANCELLED.png" hash="c794eeb78ef618c3e9dcd8b444b7b23f"/><file name="TESTISSUERPENDING.png" hash="04ee87a5c35a491e624719a3c885d492"/><file name="TESTISSUERREFUSED.png" hash="2f7e2bad6857f39f32afd09eb846e55a"/><file name="TRIODOSBANK.png" hash="922b1fcd51306e0d0da6b15ebe640d8c"/><file name="VANLANSCHOTBANKIERS.png" hash="0a5d713a5c73c54e90507743456c5657"/><file name="achcolombia.png" hash="1f1339c682440cfd7584f9ba00f59722"/><file name="achcolombia_small.png" hash="d6b2899a0039de82788c831b00dd1533"/><file name="achcolombia_small_grey.png" hash="bcae575368bdcdb582423e28ac7a56e9"/><file name="achcolombia_tiny.png" hash="a287c57b8bcc821371758da895db6437"/><file name="advance_payment.png" hash="5aba603621b4b21cc05b7eae1f7455da"/><file name="adyen_logo_large.png" hash="70726ef290d0eee3ed163eb751091813"/><file name="ae_small.png" hash="6ce7c9a2b330c9c46f0213c40db55683"/><file name="afterpay_default.png" hash="a62e3982d50612522be071d4e86eaa6a"/><file name="alipay.png" hash="e3773ada96577e575c9e1300a89a5875"/><file name="alipay_small.png" hash="f9848d15fc7ee22b6687ccdbe7f36a16"/><file name="alipay_small_grey.png" hash="e5ffe7ff272ce2814b7808fd047a9c6b"/><file name="alipay_tiny.png" hash="1a7867dd958ddcdd90ad2400e5be23de"/><file name="amex.png" hash="8e3b962f9ef18e08cf16b77934607d28"/><file name="amex_small.png" hash="6ce7c9a2b330c9c46f0213c40db55683"/><file name="amex_small_grey.png" hash="0f6aabd8dfcbf48dbb555b9191d7795e"/><file name="amex_tiny.png" hash="b7016f4efb163c985d6f1d99a8433d2a"/><file name="asiapay.png" hash="44626dc317e547fb40010498c1096407"/><file name="asiapay_small.png" hash="cca4d86b5abc510f20ca9563d7215c3d"/><file name="asiapay_small_grey.png" hash="00e20b2b2eb0d2ad51c15d8ccc558dc5"/><file name="asiapay_tiny.png" hash="ba0d613d94a64918c0338504fed20ee7"/><file name="autopay.png" hash="4251763c71239e7b1b421e4bc7f5b70a"/><file name="autopay_small.png" hash="ca6941b80b6157bae2411b5620149d2d"/><file name="autopay_small_grey.png" hash="f69d143b4f1fc16a9138ccfacec808a4"/><file name="autopay_tiny.png" hash="4c0c91402daafc63bdb5979dbbd963db"/><file name="babygiftcard.png" hash="91bcbb6604b26565b89898c9a8e1e117"/><file name="babygiftcard_small.png" hash="2558bbdd4d9528b37ba93a8c4af536a4"/><file name="babygiftcard_tiny.png" hash="393a192fab9874e3b167c3bc5d568db7"/><file name="baloto.png" hash="1c172c628f79837c83196b243c636ff5"/><file name="baloto_small.png" hash="c66db84ac7fed6f81010e8058fa39a74"/><file name="baloto_small_grey.png" hash="bdc5eac76e02a658b348a0722fca9ba9"/><file name="baloto_tiny.png" hash="5e10ee14c8a44c3b4c28571664fa045f"/><file name="bancnet.png" hash="a2b687ef27244e448b85635cc1d3ec60"/><file name="bancnet_small.png" hash="4473bc16badc29200ffd09021778b1e3"/><file name="bancnet_small_grey.png" hash="6b108ea906b6d6a5ad51e4de6db732eb"/><file name="bancnet_tiny.png" hash="0ac28b35fd4e09954debcd2eb42e89ce"/><file name="bank24.png" hash="9a921572d6bae73604e1122ec3e5bf7e"/><file name="bankTransfer_AE.png" hash="a6f29729723fa65c732ffc9267b3f8be"/><file name="bankTransfer_AE_small.png" hash="a3322805ab1c40c4e6237943185284ab"/><file name="bankTransfer_AE_tiny.png" hash="dfcf50c97c3b832fd3c17efb2864335c"/><file name="bankTransfer_AT.png" hash="7fa4204d1426a64a4cd26af06af44d41"/><file name="bankTransfer_AT_small.png" hash="31037dcf034d1e9d28254d1962b2ca16"/><file name="bankTransfer_AT_tiny.png" hash="4ee9964118e05d2a81335f3033ec5bf1"/><file name="bankTransfer_AU.png" hash="05716c67579fcf3574037ce69c9e4229"/><file name="bankTransfer_AU_small.png" hash="acd23b8e3ccf3c9d28960fde63c22e85"/><file name="bankTransfer_AU_tiny.png" hash="4a3ee62afdac23a00a0675c763e93470"/><file name="bankTransfer_BE.png" hash="5547426f07e0562ba9b605f1f04a9ad7"/><file name="bankTransfer_BE_small.png" hash="007dbd9f27115b601eb94db09a10b8f3"/><file name="bankTransfer_BE_tiny.png" hash="cf0285a691339efad52d82d40c7aa9f1"/><file name="bankTransfer_BG.png" hash="be209415f5bec0a45bd2bd9cd3c41d0a"/><file name="bankTransfer_BG_small.png" hash="6249144aa579c494988b5bbecb22eb69"/><file name="bankTransfer_BG_tiny.png" hash="7c11956844dbf7cc76db038b32fc7ab1"/><file name="bankTransfer_CH.png" hash="9b20d62386085ac2c9da1227abec5d58"/><file name="bankTransfer_CH_small.png" hash="2887bcf97901ed7ed6bc4fb5d8a00876"/><file name="bankTransfer_CH_tiny.png" hash="c0218d075bbb503689f40007a331ba85"/><file name="bankTransfer_CZ.png" hash="78f7aac275e10af77b3bbab28ba1aa23"/><file name="bankTransfer_CZ_small.png" hash="7bf17799b64aa618945981eb7fa00cce"/><file name="bankTransfer_CZ_tiny.png" hash="7f2a7e2fde701bff21fa388776e73632"/><file name="bankTransfer_DE.png" hash="989d5e1cc2547504b0fbc7aa88e08713"/><file name="bankTransfer_DE_small.png" hash="fb50048c4acfdebf85c4c8f90d8b08d9"/><file name="bankTransfer_DE_small.xcf" hash="cfbc9a47bc116e97a121771c0aa6fe83"/><file name="bankTransfer_DE_tiny.png" hash="d4d68f1068df68f61cb828005c9c0ac9"/><file name="bankTransfer_DK.png" hash="a2e9a409144a8ef18747faafa2937609"/><file name="bankTransfer_DK_small.png" hash="71e75c357b475fe236b633ac8a2a76cd"/><file name="bankTransfer_DK_tiny.png" hash="0103bbe5b8a803aad990bd4ad53c88c0"/><file name="bankTransfer_EE.png" hash="9caa3e1ac3558e9ec372c45df045bae6"/><file name="bankTransfer_EE_small.png" hash="91ffe550444bac13ac29ac1696ffdfac"/><file name="bankTransfer_EE_tiny.png" hash="59ea293d7ba58cd6dd9a9a2b43088093"/><file name="bankTransfer_ES.png" hash="7d0051c7ee32eddca94b89368bb5afbe"/><file name="bankTransfer_ES_small.png" hash="2dc1519510ef7bea726e0bca70859c06"/><file name="bankTransfer_ES_tiny.png" hash="a2338a0d60b2585ac34269daf794d189"/><file name="bankTransfer_FI.png" hash="ffbe8dfa936a4628e3c029bd957f367d"/><file name="bankTransfer_FI_small.png" hash="1db5d45d947502483a2e8c40aab3734d"/><file name="bankTransfer_FI_tiny.png" hash="b9f26cef0fc7f051b6d79ada14c902ba"/><file name="bankTransfer_FR.png" hash="572f77cf0f22103300682c5f89e9d9e9"/><file name="bankTransfer_FR_small.png" hash="58a268c927e4d19858ed3241ceac05f8"/><file name="bankTransfer_FR_tiny.png" hash="dee4c0c47d94fb0e2ab032264c4d1543"/><file name="bankTransfer_GB.png" hash="5a7eee2f31bec7bf422425f31aea2d5a"/><file name="bankTransfer_GB_small.png" hash="17d3c0ca20cee2250e3b6d0f5f080ba9"/><file name="bankTransfer_GB_tiny.png" hash="24d7d3ce5dc62ef776f3f36f24ff78b1"/><file name="bankTransfer_GI.png" hash="e9035b335bd8dc809c7e4afc7d775cc0"/><file name="bankTransfer_GI_small.png" hash="e51bd2f8333a8d8b2163c777c5b12b48"/><file name="bankTransfer_GI_tiny.png" hash="d158401d4dd73a057adac68f3f23ad89"/><file name="bankTransfer_GR.png" hash="aefe60c85d74d77d1c1327538617f297"/><file name="bankTransfer_GR_small.png" hash="b9a0a5d6ec52c80d72d8e8cf903f37f3"/><file name="bankTransfer_GR_tiny.png" hash="1dc0912afd646785eade5d8785baa12c"/><file name="bankTransfer_IBAN.png" hash="f636fcae0c128e08baaef26dacaa078d"/><file name="bankTransfer_IBAN_small.png" hash="ffc0073f2fe405de05206cdfc1565daa"/><file name="bankTransfer_IBAN_tiny.png" hash="4a4f64cb62ca9cfec99d117d0169bb83"/><file name="bankTransfer_IE.png" hash="eb6efba5502d54571022feaef9a9ded3"/><file name="bankTransfer_IE_small.png" hash="d9359e8a2bf8c04d4d43acdcc8b30a5e"/><file name="bankTransfer_IE_tiny.png" hash="b3a0f75656b535960c362baaabc45ce3"/><file name="bankTransfer_IT.png" hash="cd56062b943e4ec6716bc72ebe4b62a9"/><file name="bankTransfer_IT_small.png" hash="29ac58a26ae12dc26dd2d501262ed361"/><file name="bankTransfer_IT_tiny.png" hash="c45892a3e2ae81bb9b4508d79164e556"/><file name="bankTransfer_JP.png" hash="20023e2e93afc881740ea74e89251d86"/><file name="bankTransfer_LU.png" hash="b3dbdeea3429de5280c3a6d911930e9a"/><file name="bankTransfer_LU_small.png" hash="ebb919c647653075be4d9bfaeec8c00c"/><file name="bankTransfer_LU_tiny.png" hash="ec058289aef35f481077c56cdf758032"/><file name="bankTransfer_MT.png" hash="8955bc706cf66307ba69e58d8006af2d"/><file name="bankTransfer_MT_small.png" hash="13ce68bbda83c39b8719d356705da6d2"/><file name="bankTransfer_MT_tiny.png" hash="b05aa11e844f09fa797a3540534e5155"/><file name="bankTransfer_NL.png" hash="ccffd7131f791f7eb44e21b42fd66cc4"/><file name="bankTransfer_NL_small.png" hash="90f18f3784ec4c4733891aafd2e83958"/><file name="bankTransfer_NL_small.xcf" hash="ac17edd9804089820e9d73c76441abfc"/><file name="bankTransfer_NL_tiny.png" hash="61e9d461381aa1fb7e9dbcc8012686e0"/><file name="bankTransfer_NO.png" hash="ffcb1204470ff94a7cf2025e000e4978"/><file name="bankTransfer_NO_small.png" hash="daab5aceaf8e4dd59dfcf29fa69cdc24"/><file name="bankTransfer_NO_tiny.png" hash="3fbbf9e381d8d0d9ada61a54778655cb"/><file name="bankTransfer_PL.png" hash="cd25fefef6bce86a97ab7242138360e2"/><file name="bankTransfer_PL_small.png" hash="880b17d7d090c7bd21965e9b78894851"/><file name="bankTransfer_PL_tiny.png" hash="9579393e3dbb3c2aeb7ebf35e54ef4e7"/><file name="bankTransfer_PT.png" hash="c3c652523d77b5d085da97111c96ef9e"/><file name="bankTransfer_PT_small.png" hash="9d3a979ef52298bcc1545b131bd4a3db"/><file name="bankTransfer_PT_tiny.png" hash="cf2be093140773d75d8993fab7aa347c"/><file name="bankTransfer_SE.png" hash="e5608461fa8bdbac771449f30cde91ec"/><file name="bankTransfer_SE_small.png" hash="0f57f6092f8bef25c9973a140a2d85ad"/><file name="bankTransfer_SE_tiny.png" hash="79f3a00608bf18d686d89562af80a72f"/><file name="bankTransfer_SK.png" hash="2390a923affb1640b1b8bb801ce04705"/><file name="bankTransfer_SK_small.png" hash="50adde906c3a965992bbfb04554a5371"/><file name="bankTransfer_SK_tiny.png" hash="d4866f13969214fd774ea1c427a048e6"/><file name="bankTransfer_US.png" hash="9013561099b618aa954f5a3e1352a6ce"/><file name="bankTransfer_US_small.png" hash="191e204c1216a199229da9d75ed1a2a5"/><file name="bankTransfer_US_tiny.png" hash="9d9e942b93d13a18e38aac0ee932fe15"/><file name="bank_ru.png" hash="2390a923affb1640b1b8bb801ce04705"/><file name="bank_ru_small.png" hash="01c263789dd7e38ac4078f55161ec19b"/><file name="bank_ru_tiny.png" hash="d4866f13969214fd774ea1c427a048e6"/><file name="barras.png" hash="389f5242e23cc5b386392d5d21459f21"/><file name="barras_small.png" hash="9e657657b963a1434e88d4289acf9448"/><file name="barras_small_grey.png" hash="d14dbd53e9a52706bf736525a90d8f63"/><file name="barras_tiny.png" hash="e46d37c7e69ef3722876a0205431f1c8"/><file name="bcmc.png" hash="28dca1b34022f2c653c13556c452fce3"/><file name="bcmc_small.png" hash="49698208e5b73f80773260c3fdb3e5a3"/><file name="bcmc_small_grey.png" hash="5069f14bff23c074af6fe2092a2e482a"/><file name="bcmc_tiny.png" hash="3b4221516dc0d1ace3432a473903991e"/><file name="beelinesms.png" hash="a559096cb240aaf7696be7563498b18b"/><file name="bijcard.png" hash="c93da8e22fac6869d729e961df24b593"/><file name="bijcard_small.png" hash="f188b92b77af1613a91c00450d3eb168"/><file name="bijcard_small_grey.png" hash="08eb4420ac9f7a7f691d688e9550f651"/><file name="bijcard_tiny.png" hash="b88eeed8f7318514f849e3ed3a9a2ce8"/><file name="bill99.png" hash="461213bcf10fb394ef524d3a0ad92ee0"/><file name="bill99_small.png" hash="d6e30f7d3da5ce34af3aa7e2353b4809"/><file name="bill99_small_grey.png" hash="a66c49f3556fa99301f4288341eaa014"/><file name="bill99_tiny.png" hash="d10dbbf6512e15252ad6d1337670a7fd"/><file name="boleto.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="boletobancario_hsbc.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="boletobancario_itau.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="boletobancario_santander.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="bradesco.png" hash="d5ae6f8cb39883cce8c97c0d11257a4c"/><file name="c_cash.png" hash="1b9d5b0c9ece2eaff0be71b4082e0655"/><file name="c_factuur.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="c_factuur_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="c_factuur_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="c_invoice.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="c_invoice_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="c_invoice_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="c_oprekening.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="c_oprekening_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="c_oprekening_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="c_paypal.png" hash="fe5fd0065e4a84e967095f082b329d7f"/><file name="c_paypal_small.png" hash="294698dab8f5aa31f2ad62702bd9d379"/><file name="c_rembours.png" hash="fb2da23375ce5ba67380dc0fb60e7669"/><file name="c_rembours_small.png" hash="0d0f244c1820921db3a6635552cf8129"/><file name="c_rembours_tiny.png" hash="c15d78de45389d475f2786fed3e81c4b"/><file name="card.png" hash="adfe3d9fe45c3f94b9edca852e2cb38c"/><file name="cashticket.png" hash="0dba12beffb7c5ebf47ae1e5701426f3"/><file name="cashticket_small.png" hash="ade5518971a871dd48b0628af6f6cf89"/><file name="cashticket_small_grey.png" hash="348c3721fbedfb2a7121f57db435f43e"/><file name="cashticket_tiny.png" hash="95248971eb69c150748b9acf27f68fb5"/><file name="cashticket_tiny2.png" hash="16ab15f5263fe81ab5233d02ce2cd715"/><file name="cashu.png" hash="1b6d79438ad686cdff44866a66445dca"/><file name="ccavenue.png" hash="aee563b4c9c77d8a881db1e79ad8758d"/><file name="ccavenue_small.png" hash="ffa7390808c679e8d6c580fcf14054fb"/><file name="ccavenue_small_grey.png" hash="9a6c58e88230fb6a167e597752a533ab"/><file name="ccavenue_tiny.png" hash="994d56725d095d107fb33c6f3abf7653"/><file name="cellpaypoint.png" hash="c676483390c0c7e932a320b6326593da"/><file name="cellpaypoint_small.png" hash="f720447e73325b922568a00d0effe75c"/><file name="cellpaypoint_small_grey.png" hash="c6deea99f2099ade43b2b75dcb62f273"/><file name="cellpaypoint_tiny.png" hash="5c00501360e94b3020ff54bccbc2e531"/><file name="ciberpay.png" hash="625d300997f331918e912dc266e1a3a4"/><file name="contact_ru.png" hash="5f70b79ee4232a81a9f7eb0224b0ba3c"/><file name="creditcards.png" hash="cd1a83b970a38307c2899f9949495a00"/><file name="dc_small.png" hash="ecf5d635a74460ca9575bb7d6d8550dd"/><file name="di_small.png" hash="8573aebe4938afb288749badb22aa091"/><file name="dineromail.png" hash="9058ea237d278d5fd238c2d180807c57"/><file name="dineromail_ar_amex.gif" hash="4a94da8ec02c565e8cfcb66fbfffe362"/><file name="dineromail_ar_argencard.gif" hash="422ea3362cc44616f72a887f5cba66c6"/><file name="dineromail_ar_banktransfer.gif" hash="758e12e370a5b213996ea1f39259721a"/><file name="dineromail_ar_bapropago.gif" hash="df51325a4fae890a5a6673f92bb64f5d"/><file name="dineromail_ar_cabal.gif" hash="98f6cc5d54df43b4c4a17d9fc2dfb9bd"/><file name="dineromail_ar_cobroexpress.gif" hash="910960360ea1cd632a69ab500cd627ee"/><file name="dineromail_ar_dm.gif" hash="b458246e266ecb059865ab17b7673882"/><file name="dineromail_ar_italcred.gif" hash="aa4376df77748d39c670001794e7991f"/><file name="dineromail_ar_master.gif" hash="126cdc5db597363e5934cf19205f8f45"/><file name="dineromail_ar_pagofacil.gif" hash="2c85235d6dff444b1b914488d035eb7b"/><file name="dineromail_ar_rapipago.gif" hash="c745eb4d456f03c6643f40e77f9ad6ac"/><file name="dineromail_ar_tshopping.gif" hash="552daaa4621397aaed5cea3ad5fc89ec"/><file name="dineromail_ar_visa.gif" hash="61c86fd2afade160736b1c318a8280a6"/><file name="dineromail_ar_visa_hipotecario.gif" hash="bbdb3933302107611678bd7a87779a6c"/><file name="dineromail_br_amex.gif" hash="4a94da8ec02c565e8cfcb66fbfffe362"/><file name="dineromail_br_aura.gif" hash="b4a8dea00ceebb3d1d64660a997ac22d"/><file name="dineromail_br_bbancario.gif" hash="d9adffbdf626846cfe11b874c5bc0715"/><file name="dineromail_br_diners.gif" hash="b4f437b40f747842cb32becf8af28eb4"/><file name="dineromail_br_dm.gif" hash="65fa3eb604d2d5cd64b76ea0419788a6"/><file name="dineromail_br_hipercard.gif" hash="329dd978884c554fc8c0a37bd6c1ded9"/><file name="dineromail_br_master.gif" hash="126cdc5db597363e5934cf19205f8f45"/><file name="dineromail_br_oipaggo.gif" hash="9cad6e46ea39ec1d6af77ce9322835c1"/><file name="dineromail_br_visa.gif" hash="61c86fd2afade160736b1c318a8280a6"/><file name="dineromail_cl_amex.gif" hash="d4942bf6dab3c072e701e709adaecf78"/><file name="dineromail_cl_diners.gif" hash="9f5bccfc0ab73993405821859dab56b0"/><file name="dineromail_cl_dm.gif" hash="0b886856a701eff48c710a4812f999d0"/><file name="dineromail_cl_magna.gif" hash="bbbbed0d123e619dbf9ffc3308cb4f6e"/><file name="dineromail_cl_master.gif" hash="38b5c034caa6249caf49256f7df4894c"/><file name="dineromail_cl_presto.gif" hash="fa18e40e599f4216d0efea05d9329b5b"/><file name="dineromail_cl_ripley.gif" hash="8a0fe5295feeb9959f2dedf17b304215"/><file name="dineromail_cl_servipag.gif" hash="51cc675b605ce7dd88016743fc324e09"/><file name="dineromail_cl_visa.gif" hash="87fa159904723d830b30d9a0f2f2ff00"/><file name="dineromail_mx_7eleven.gif" hash="7595248bd6c735fc9cd28a0afe9e035c"/><file name="dineromail_mx_amex.gif" hash="4a94da8ec02c565e8cfcb66fbfffe362"/><file name="dineromail_mx_bancomer_tc.gif" hash="b2854f409126920b1c9cf8ed3792a349"/><file name="dineromail_mx_dm.gif" hash="9eede7e49ebcb145494952f6edb749b2"/><file name="dineromail_mx_hsbc_tb.gif" hash="1fb60730a0dfe9d0a0ebef45af1d8fdd"/><file name="dineromail_mx_ixe_tc.gif" hash="6e19e5be52b5bfce749f16b26e933c2e"/><file name="dineromail_mx_otherbank_tc.gif" hash="df05af375e248dcc04324aa92b6163b0"/><file name="dineromail_mx_oxxo.gif" hash="ee69da5b06d9c52ef76dd1a20bab5ebb"/><file name="dineromail_mx_santander_tc.gif" hash="5bb0f9600b1b8ad67d0a418c2412a506"/><file name="dineromail_mx_scotiabank_tc.gif" hash="dbe7bdd2d9327086cae42ee6a842d00c"/><file name="dineromail_small.png" hash="356e06d5a2fd5f98f3da4dfc192e389c"/><file name="dineromail_tiny.png" hash="98f6b908f7025a8babaffafcc1336428"/><file name="diners.png" hash="6310bb53fe7921cf016309d6a75b8c22"/><file name="diners_small.png" hash="ecf5d635a74460ca9575bb7d6d8550dd"/><file name="diners_small_grey.png" hash="77ff46143b8a4aab54eb35c345806a83"/><file name="diners_tiny.png" hash="881b5998d35cc373d294ca21689015d5"/><file name="directEbanking.png" hash="6d7ce2ff213c33743d80ab83fb24e8de"/><file name="directEbanking_axa.png" hash="3d90797ef39a0db23dd6373bdfef9ee8"/><file name="directEbanking_cbc.png" hash="f23617618a9e2ce7863a931947b49adb"/><file name="directEbanking_de.png" hash="9fa16b098e744e94553952c5a28c7dd2"/><file name="directEbanking_de_grey.png" hash="109b1237e5d69d7ae82dc9a64d6ab4fd"/><file name="directEbanking_de_small.png" hash="5f65ee79ae22c4ba52e6a8485cf155cd"/><file name="directEbanking_de_tiny.png" hash="15983a607b8151f0be3b5ecfb067ea7a"/><file name="directEbanking_dexia.png" hash="37ebcc9a12bc9c88d540f78adf9bd679"/><file name="directEbanking_fintro.png" hash="389b1a7b14e5466b7b0dd4721aee0433"/><file name="directEbanking_fortis.png" hash="511cc06fefa644cc7575a0efb227bd64"/><file name="directEbanking_grey.png" hash="109b1237e5d69d7ae82dc9a64d6ab4fd"/><file name="directEbanking_ing.png" hash="ac4f224d0fe9aee23d143acc5198dd72"/><file name="directEbanking_kbc.png" hash="eae3c85e332e4289841bd27a46031db3"/><file name="directEbanking_small.png" hash="db84d47793f8e375d48dc8b17f8a0ddf"/><file name="directEbanking_small_grey.png" hash="7f4fbbcfe647cf8d280238754061d042"/><file name="directEbanking_tiny.png" hash="7d804d09c7df931eb9cafc2d3a4984b1"/><file name="directdebit_BR_bancodobrasil.png" hash="784271e1bf909c95e79ff7de4d92ed5b"/><file name="directdebit_BR_bradesco.png" hash="d5ae6f8cb39883cce8c97c0d11257a4c"/><file name="directdebit_BR_caixa.png" hash="a0d69bc8a40bf120fc2138a694c31186"/><file name="directdebit_BR_hsbc.png" hash="4943f73d211b8111fd81ca8d4e06160d"/><file name="directdebit_BR_itau.png" hash="b24ed466c1d694dca7dc26ee42dbf330"/><file name="directdebit_BR_santander.png" hash="bd73ea7f9f46b0ed583e764f01e9a8d0"/><file name="directdebit_NL.png" hash="cf1246761401ad866b72d7b520506b22"/><file name="directdebit_NL_small.png" hash="2e6a7444f509232818458312f28f8c50"/><file name="directdebit_NL_tiny.png" hash="99ea09a985cf0221ce87d3696211704e"/><file name="discover.png" hash="491378a0e2ae6223ab41fc925b67575d"/><file name="discover_small.png" hash="8573aebe4938afb288749badb22aa091"/><file name="discover_small_grey.png" hash="e60b18fcd2f0509c02a08fa0bf7024b2"/><file name="discover_tiny.png" hash="78a2cb6ccedb121d3138b280e1778f84"/><file name="dotpay.png" hash="a09962a7357374482444accf6b066037"/><file name="dotpay_inteligo.png" hash="25492f3d9eaabae7aa1441fdf24947b3"/><file name="dotpay_moje.png" hash="1c948c8e2db27f09e44e4c6f3591e39c"/><file name="dotpay_mtransfer.png" hash="e9ef4a420639f227e650c9e456235059"/><file name="dotpay_multitransfer.png" hash="b604e3e946b41437bc485b0a95a76b2a"/><file name="dotpay_nordea.png" hash="cfda5216a9ae9b829e5121bbfaaf887b"/><file name="dotpay_potzta.png" hash="88670102fd0e7f532357d06ec66a8ec6"/><file name="dotpay_przelewz.png" hash="06cbe8767f3b1810e2a72b19a1bcc9c7"/><file name="dotpay_przelewz24.png" hash="64143c67feac20a193fd459ba0a6e8b4"/><file name="dotpay_small.png" hash="aabbcc9e2471e044c38ab63d8aa6d48f"/><file name="dotpay_tiny.png" hash="5c746221e7ec781c18bb4d7e6f0a66a0"/><file name="dotpay_zabka.png" hash="a6edae22b53cdd3b997f8c9b50840b2c"/><file name="ebanking_FI.png" hash="7d717c71a9174624d8e30a314c4f091e"/><file name="ebanking_FI_aktia.gif" hash="092c03a2319bd7c5d8fc9dc98516be46"/><file name="ebanking_FI_alandsbanken.png" hash="d64698c6c6dc9b6c8e1d2179dfb61d8d"/><file name="ebanking_FI_handelsbanken.png" hash="06f99903ea285bc5cf392ea6c642a267"/><file name="ebanking_FI_nordea.png" hash="c68ecd7c03b5d6a0819110c56df501e8"/><file name="ebanking_FI_osuuspankki.png" hash="cf9f495363970b9da3dbbaffe1031225"/><file name="ebanking_FI_sampo.png" hash="e5b4bd2ac745258b22ab832be253654a"/><file name="ebanking_FI_small.png" hash="57635f01d33e65d40af90d3ab4088ad7"/><file name="ebanking_FI_spankki.png" hash="e88599e1318b54be1990363607819811"/><file name="ebanking_FI_tapiola.png" hash="27ad56685d2e0e641a8d3e95942630ef"/><file name="ebanking_FI_tiny.png" hash="b0e3de2e531c362daaac6063c7a59d9e"/><file name="ebetalning.png" hash="0bc7c8cc01264df81ad06b0b75ce7c0a"/><file name="ebucks.png" hash="33d683c3a6f4f61df3c36e09d867936e"/><file name="ebucks_small.png" hash="c2afb7964e668ba7ba0416682fdd831b"/><file name="ebucks_small_tiny.png" hash="dd79fc153f0a7fcc79e628383e76ee26"/><file name="ebucks_tiny.png" hash="6085ef04ad96289d6a98e429c6d061ba"/><file name="elba.png" hash="8d2bfd3e8c0953b5d1ba80e201d25069"/><file name="elecsnet.png" hash="4a27849dfd5a8bc6771a962aff3908f4"/><file name="elo.png" hash="d8ed45be5e2a933584a58c78a5ec3568"/><file name="elo_small.png" hash="b0c3bec4e8cccf4339e142365a30fca7"/><file name="elv.png" hash="8e47d6ce919e1be80328665798d387ec"/><file name="elv_small.png" hash="a565fd570c28204b7ed0e92ebf667012"/><file name="elv_tiny.png" hash="3c9d929660d6279f255c7be9bf02ee8f"/><file name="empty.png" hash="65d7e6c42582ea986cb66ad78768b2ae"/><file name="enets.png" hash="5eae578677220e7085374936ffc2ec6a"/><file name="entertainmentcard.png" hash="df44b82c45f98790ea0e8866ecb5fee7"/><file name="entertainmentcard_small.png" hash="0466be6962e63c80c766ca4b092cded6"/><file name="entertainmentcard_small_grey.png" hash="32b0a15b2467decf84db199cd6db3bcf"/><file name="entertainmentcard_tiny.png" hash="2a7610575298bf7029bbbfad2bb86596"/><file name="forwardmobile.png" hash="023348014c3838963e48bdc8b397c387"/><file name="frame.png" hash="5e2226d7539f5d95dabe5988f4446282"/><file name="gallgall.png" hash="2e6b9f6aafaebe09112e089c05aa64ea"/><file name="gallgall_small.png" hash="24fabea2d5af04bedf9dd69e2368b943"/><file name="gallgall_small_tiny.png" hash="671cb1ce378d811cddaf77af7545d365"/><file name="gallgall_tiny.png" hash="769bf04c15a3b81f06940c237c3b3706"/><file name="giropay.png" hash="469cb654fe84b923b86b06723455ef9d"/><file name="giropay_small.png" hash="444f3a6307bb83a1d20d19e1cb8237f9"/><file name="giropay_small_grey.png" hash="565dd52d036a87d5c515c8bec4cef4f3"/><file name="giropay_tiny.png" hash="3a677e8d71ce59332e012db5bc343106"/><file name="globegcash.png" hash="580003d47ef03a6d1c7203bfc250b6d3"/><file name="globegcash_small.png" hash="cd18f17b46acb7ca15370b000f9bfa95"/><file name="globegcash_small_grey.png" hash="36e88a7a7170eb0c5ca7d3a8f2b08f13"/><file name="globegcash_tiny.png" hash="006794f78d9a43a56543a6e6b5a7ebd8"/><file name="hansabank.png" hash="b4dad91137678e09a650e1c6693e98d3"/><file name="hdfc.png" hash="b6e57b76ee8920607a2a0a809ee40d48"/><file name="hdfc_small.png" hash="1b9e555bfab7c0f11631dfecacffa637"/><file name="hdfc_small_grey.png" hash="cadac6a01cdab50cff177a1c0feb6156"/><file name="hdfc_tiny.png" hash="584260909cebec2286b6d1cd9489c7d4"/><file name="hipercard.png" hash="9310c18cee9f43c4019a7560d74ffd4c"/><file name="hipercard_small.png" hash="d4d0e1aab233b3ec3f94cbbe985fd8ad"/><file name="hppPos.png" hash="4780e785c785e93aed6ad13df323d6ef"/><file name="hyvesafrekenen.png" hash="5c8068c5b31a55f043cee6dff3246bb7"/><file name="hyvesafrekenen_small.png" hash="5a4c5747c030ac74cea799032ada3b26"/><file name="hyvesafrekenen_tiny.png" hash="2215dc356edeb426da65f43536960afe"/><file name="ideal.png" hash="6a851bfc5bac2835fd31c18c1224e8c9"/><file name="ideal_small.png" hash="8b115bda559a24a3564e02f7a90caae9"/><file name="ideal_tiny.png" hash="140c2e52427e074f95627a44db1f9f88"/><file name="img_trans.gif" hash="325472601571f31e1bf00674c368d335"/><file name="interac.png" hash="c63021e21273e83423d8af2b4c7c1728"/><file name="interac_small.png" hash="0c74bd42750252eda57b054651afca18"/><file name="interac_tiny.png" hash="1a42ba184555605ab8e2ea1a4956f21a"/><file name="ipay88.png" hash="116aa967091843ee6e8e911ff4c34b22"/><file name="ipay88_small.png" hash="1dfb38797a43657d72b0701c446a841e"/><file name="ipay88_small_grey.png" hash="418f051bc03571334cec46e122fa698f"/><file name="ipay88_tiny.png" hash="0009e8c253c57564c3688010c5192ad4"/><file name="ivr.png" hash="0ebef34ac806802b0d29c1d74f84fdbf"/><file name="ivrLandline.png" hash="0ebef34ac806802b0d29c1d74f84fdbf"/><file name="ivrLandline_small.png" hash="155f9a61db970885782db7cbe997dab4"/><file name="ivrLandline_tiny.png" hash="ecf7994d1e627023dbd47615a8ebb848"/><file name="ivrMobile.png" hash="6a16e39d5deffb8fa3234108ca97b7de"/><file name="ivrMobile_small.png" hash="a9756b756b3ea56dea07a16edcdf39a9"/><file name="ivrMobile_tiny.png" hash="8c35341f8a8f6ca16b752ff7e1bb51bf"/><file name="ivr_small.png" hash="155f9a61db970885782db7cbe997dab4"/><file name="ivr_tiny.png" hash="ecf7994d1e627023dbd47615a8ebb848"/><file name="jcb.png" hash="68303da687ac6e8615196a66f40bb6fb"/><file name="jcb_small.png" hash="f469481ddecb206cfc74478c6b58266e"/><file name="jcb_small_grey.png" hash="ddb4587396f2e7c7ad83d2aa6561cf7a"/><file name="jcb_tiny.png" hash="5d89108481655ee9dc2dbf6476bbcc14"/><file name="kadowereld.png" hash="c2eea3806e2f55ffa2f7eb3154450be5"/><file name="kadowereld_small.png" hash="203f4584e34c3f059025f3d4329b4898"/><file name="kadowereld_small_grey.png" hash="3afa5e33cd29e5c3ce1723ea10607463"/><file name="kadowereld_tiny.png" hash="b2ca2f7f504670555d332f4c5e8d3074"/><file name="klarna.png" hash="51bc6b70472fe29b728192222b88c709"/><file name="klarna_small.png" hash="57a98dc539dd5c329aac8540a3204d1e"/><file name="klarna_tiny.png" hash="fe0295e2cba0b79136e86180d7db5963"/><file name="laser.png" hash="c64699ddd372b4a48e72b8066fd2aa78"/><file name="laser_small.png" hash="abda432193ffcd5388037fa34b9e0737"/><file name="laser_small_grey.png" hash="ef7193af17ae93fa9bb5215a0ec73195"/><file name="laser_tiny.png" hash="2f87b8e37582541355e9b77008cf3853"/><file name="maestro.png" hash="e91fa85475ae74b16b92b7ac05e562c2"/><file name="maestro_small.png" hash="7814fbfff53e57643137fd68889ec807"/><file name="maestro_small_grey.png" hash="31ab5c8168e8a5b075fe1136b221d453"/><file name="maestro_tiny.png" hash="87ff6ebe1ef2e4cbae340881169065c4"/><file name="maestrouk.png" hash="cf0fcc0e1f41ad2301d5814e4a9c88c4"/><file name="maestrouk_small.png" hash="7814fbfff53e57643137fd68889ec807"/><file name="maestrouk_small_grey.png" hash="31ab5c8168e8a5b075fe1136b221d453"/><file name="maestrouk_tiny.png" hash="87ff6ebe1ef2e4cbae340881169065c4"/><file name="mc.png" hash="0d108b48ed7f8e1f0020da611e223800"/><file name="mc_small.png" hash="51ca51c64a8f0277961effeb0a0dedbb"/><file name="mc_small_grey.png" hash="0762490e5dc86277d0e411468b01a269"/><file name="mc_tiny.png" hash="814af4ec011f2f33edb7d38763dea2ea"/><file name="mercadopago.png" hash="e8cdc9cab0494fbaec13ffa7a008f0d6"/><file name="mimoney.png" hash="0f6d07a6156c6dc931636c8c618384ac"/><file name="mimoney_small.png" hash="4a8b0586fd04690de902120a463ca5b2"/><file name="mimoney_small_grey.png" hash="c85a2d63e583a8fd231713d30d484ecb"/><file name="mimoney_tiny.png" hash="0c562f6e53a95ebe2ff12747f9271a56"/><file name="moneta.png" hash="c208f24cbe664e0c9df753d1dd6b8d43"/><file name="moneybookers.png" hash="7bfc54c2a787b53f699f124d7449a169"/><file name="moneybookers_small.png" hash="1290894e479fafda67291355ea65defe"/><file name="moneybookers_tiny.png" hash="4ed8a8052e9b394e174889de6d621604"/><file name="moneymail.png" hash="73d044eac9d9f1679a653dd2e62935f3"/><file name="moneymoney.png" hash="7204b9579b665085d00b1ea2184b678f"/><file name="multibanco.png" hash="178a9292a9743e3b8904f105e7d6715b"/><file name="nedbank.png" hash="a8a2dc3af1e76262b75270a24a041331"/><file name="nedbank_small.png" hash="d386a8672bd21e53580ae32ae529ca3a"/><file name="nedbank_small_grey.png" hash="7085229e1217e47b07663764f8bb1e6e"/><file name="nedbank_tiny.png" hash="af3694515dd8b68ca71324ca20089c58"/><file name="onebip.png" hash="ca289a3c9fd8d72bce90165db98a88b9"/><file name="online_RU.png" hash="afcc9ad6292e2e21feff4af23e2fa46e"/><file name="online_RU_small.png" hash="712fa0be37857b024e3118d96da61bab"/><file name="online_RU_tiny.png" hash="0e3ac8d1ca10dff95657aa9b9ebdc13b"/><file name="online_transfer_de.png" hash="43324fb914cdbf8eff66f3668a353f1e"/><file name="openinvoice.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="openinvoice.xcf" hash="d5f41ec9c48415f65a519c33999a1229"/><file name="openinvoice_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="openinvoice_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="pagosonline.png" hash="04a1d0c0bb46ed7f931b3d4e248f8c0a"/><file name="pagosonline_small.png" hash="9768e52502eb299716268a212a044812"/><file name="pagosonline_small_grey.png" hash="e9f7365e885652200fdb08201e1b13cf"/><file name="pagosonline_tiny.png" hash="70d51512b8bf5215f5865b21a3ca7731"/><file name="paypal.png" hash="02362803ca1d3ab9c9e8dc3176100d66"/><file name="paypal_small.png" hash="294698dab8f5aa31f2ad62702bd9d379"/><file name="paypal_tiny.png" hash="709c47f06297455d8d55d6937245e016"/><file name="paysafecard.png" hash="20861199bb6e8781c0b10e995f1490de"/><file name="paysafecard_small.png" hash="e7452ca00265fdc91dd28a2b326355d3"/><file name="paysafecard_small_grey.png" hash="06377beb14a2666f153b273e89053419"/><file name="paysafecard_tiny.png" hash="92b3df13741ef6f71d2c12206ab3f412"/><file name="payu.png" hash="bc671fff056fd108fe24ba52053111b0"/><file name="payu_small.png" hash="ca3eb82cb24dd1f1bfc34436287dc9d0"/><file name="payu_small_grey.png" hash="6097711eeb2ea309d407c03a467e1653"/><file name="payu_tiny.png" hash="2b89f57174338ba3d3192eb8519ece3f"/><file name="plastix.png" hash="82d3202239d01c6bf49d8dc2399900e2"/><file name="plastix_small.png" hash="447240736bdba2d15a34986395c3fb1f"/><file name="plastix_small_grey.png" hash="7e039f412a96a0e884f86598ebfccfb1"/><file name="plastix_tiny.png" hash="aaff5ff8c33af35fe4ae64e627c0964c"/><file name="platezhru.png" hash="2f36e088146ab75470c7a55177db8c07"/><file name="platika.png" hash="03e93ab41b0d330706e2c4f85cae966a"/><file name="pm_gloss.png" hash="dcfc71b0c819e58a1287cd206cfb9d14"/><file name="postoffice_ru.png" hash="8ade3cd1711071ab73248d4ba62eae64"/><file name="pps.png" hash="29f4efc8d08cfd5ba90920b1fcef6bde"/><file name="pps_small.png" hash="7bf1fa7c4adcd8dfc2b2f56eb172fcaa"/><file name="pps_small_grey.png" hash="08d6188b7f5c13ec9c5f3488b4cbf19e"/><file name="pps_tiny.png" hash="4ed68db4ca98ac69f0557319a8284c8d"/><file name="pse.png" hash="6af65a4a18af66d103473fece5536e1c"/><file name="pse_small.png" hash="1f6695131dca61647b07f7180e695c46"/><file name="pse_small_grey.png" hash="7adf2fdfc48d8b078f7c0aeaa4f50e1c"/><file name="pse_tiny.png" hash="128b2749a126cfade0300f27c6919308"/><file name="qiwi.png" hash="b5e092af3394bc333fe83d073e8a6dfd"/><file name="qiwiwallet.png" hash="623b4c7fec53864fdee6d567da5f61cc"/><file name="refresh.png" hash="69ddc65b628d15a4375e66792c07484f"/><file name="safetypay.png" hash="af4e58d22f816f148faae179d0867b3f"/><file name="safetypay_small.png" hash="26749f1a95011897c8aaf568425df3dc"/><file name="safetypay_small_grey.png" hash="e5f3e5287e3fee2d77c065063b43e17d"/><file name="safetypay_tiny.png" hash="f3700f2d3cda7834cd178ac0f70d6352"/><file name="sendEmail.png" hash="cdddfa5e77d565a0ed23b6c26e0dee09"/><file name="sendEmail_small.png" hash="b5d63cc1613f08a08194442647ee451d"/><file name="sepadirectdebit.png" hash="e565455436d808fa07499131296490de"/><file name="sm_small.png" hash="7814fbfff53e57643137fd68889ec807"/><file name="sms.png" hash="7c6c0fddee039be4d879808b374f06f5"/><file name="sms_small.png" hash="fd1d52278d2446c7fe1c34d4fc70d556"/><file name="sms_tiny.png" hash="ed22de378fdbc717f987f8d4199e0452"/><file name="solo.png" hash="13f13c36cff7835d4a46df140fe432a3"/><file name="solo_small.png" hash="96de4f5f750a415fef573ce28092bf68"/><file name="solo_small_grey.png" hash="75c9b0b2daae0d6d80a5f5ff4f14e8d6"/><file name="solo_tiny.png" hash="3e2d7a21d19b12ed84aabdb26304fae6"/><file name="switch.png" hash="8cf19bb8c744a3f852511e781c176c07"/><file name="template.xcf" hash="e5035cd9e4e96859e50c1a9773098e89"/><file name="tenpay.png" hash="ddd0b5b8e3ff63cf1bfc555fbede0242"/><file name="tenpay_small.png" hash="2aa6c5919108eec42ed5c47ad4155a8f"/><file name="tenpay_small_grey.png" hash="6a21283b21295eefb4db553f877ea4c1"/><file name="tenpay_tiny.png" hash="736275eeec39e56c3c1d29fcb9d8ebb7"/><file name="terminal_RU.png" hash="711ab27d1cbbf6771e0ee133f75c7c46"/><file name="terminal_RU_small.png" hash="9bafe5dd035f73757f553250382764c6"/><file name="terminal_RU_tiny.png" hash="1b4dce2e901d90185933420cd80648cb"/><file name="tnt_rembours.png" hash="a8abb6f51d7893da39fcc2477d7bd2bb"/><file name="tnt_rembours_small.png" hash="72ee2b0ae6742cd325bda44a14093f4c"/><file name="trustly.png" hash="2a82872cc0ada644b0442e05423a2db8"/><file name="trustpay.png" hash="88a3680bf1007661ab4fc63106aa1ff4"/><file name="uhisbank.png" hash="8c0967455a15aefe3cdfb47240a18850"/><file name="ukash.png" hash="b95eb9f2658923c38a6252f5ff9ca9c7"/><file name="ukash_small.png" hash="2210a65cd1fb85bc883d112b12c79e6e"/><file name="ukash_small_grey.png" hash="65e6cc21082ebd3c93e96bbf96499df4"/><file name="ukash_tiny.png" hash="543ab39e6dcbc094188b4f473ac4b998"/><file name="unionpay.png" hash="068dee300e2c12e58e9a47d3556e977c"/><file name="unionpay_small.png" hash="55a00c9d7bbcbe1c448b449974d85af1"/><file name="unionpay_small_grey.png" hash="5c69e46ee4663f2d0e47c7f503bbd1e4"/><file name="unionpay_tiny.png" hash="45d3b4e758237412b524a5c52418da67"/><file name="unknown.png" hash="b2d137147db4d6eb7dacb5414a4f7a30"/><file name="unknown_small.png" hash="a5234e9eb2e4485acb19b196876d762b"/><file name="vi_small.png" hash="cdab39efaf22fcd2ab88f3dc42c32de1"/><file name="vias.png" hash="aca848fa54b173225fe17637699d87c4"/><file name="vias_small.png" hash="37bee85c36b52a07a4529735a194a41e"/><file name="vias_small_grey.png" hash="4da77d558ae9488ee2a85191e9db8748"/><file name="vias_tiny.png" hash="1a45f0a2696b5539195c2fcb69be49b6"/><file name="visa-electron.png" hash="308132b89febd4979bac61594919057f"/><file name="visa-electron_small.png" hash="5ab129027f4f4acbc7a9aa2b5d0e84d3"/><file name="visa-electron_small_grey.png" hash="712b876d4f060613f54f2ec04516e512"/><file name="visa.png" hash="30f9fde31aa41197e71ccd9a63a1fe75"/><file name="visa_fr.png" hash="abd117879295333ac54497e15f81ea18"/><file name="visa_fr_small.png" hash="837db98a87141717dcd1b90bcb5ff5b1"/><file name="visa_fr_small_grey.png" hash="e8cef14608278ab71ef2ffd58e65dc9e"/><file name="visa_small.png" hash="cdab39efaf22fcd2ab88f3dc42c32de1"/><file name="visa_small_grey.png" hash="9411565a7e81c5c3cc484863dc53031a"/><file name="visa_tiny.png" hash="e374bec64dcc345848b43f0a8a3490c2"/><file name="wallet_RU.png" hash="29213300b3cf644c64d915418f259d87"/><file name="wallet_RU_small.png" hash="3308a16ce0f5b474af32505f587079b5"/><file name="wallet_RU_tiny.png" hash="c46cdb588d7a9a21a909e5af842414b5"/><file name="wallie.png" hash="fc97552b8249c3e96aa6f3cf8e3577bd"/><file name="wallie_small.png" hash="c0b60fe348b16e157eb0c64043f410c2"/><file name="wallie_tiny.png" hash="df61209a0e0517bbb3d65119d5ebfcbd"/><file name="webmoney.png" hash="3cca800e0962e0078b64361de11b935f"/><file name="webshopgiftcard.png" hash="09990fe325b20c2fcdaaa855457d5348"/><file name="wiwallet.png" hash="5db11152a23a72b2f4676841261c5db0"/><file name="wiwallet_small.png" hash="a4c5567f59ca4575a316e1bf3eb066c1"/><file name="wiwallet_small_grey.png" hash="b75b2af0b5c6129e8c1d7bc9087222b4"/><file name="wiwallet_tiny.png" hash="8b53e98458e15bc19b242d05ad678f2d"/><file name="yandexmoney.png" hash="e6a38c66b08ba78a68096f8ff1b2a41d"/><file name="yourgift.png" hash="87bd1ef190d75ec64fb66b77aaeb7b8c"/><file name="yourgift_small.png" hash="17300795f7fd31d5cb730685c2eb0098"/><file name="yourgift_small_grey.png" hash="69b235ccb6b7ef0dfb3a2645be60dbc6"/><file name="yourgift_tiny.png" hash="a3bc0b90775458ff9ef8499f7a5437ca"/></dir></dir><dir name="css"><file name="adyenstyle.css" hash="db5907d0d6371df6d2ebf057815d8bb9"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="adyen"><dir name="payment"><file name="adyen.encrypt.js" hash="6e6d006f2ac96f33a4531d3115f2d852"/><file name="cc.js" hash="f438c3a120077faa637cb055c1a85a06"/><file name="elv.js" hash="db612a634c95727ec9db82c50e9aec8e"/><file name="epos-device-2.6.0.js" hash="94c73689bec45b74a311d76400f05ba6"/></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.3.3</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adyen_Payment</name>
4
+ <version>2.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL-3.0)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento Plugin for Payment service provider Adyen</summary>
10
  <description>Magento Plugin for Payment Service Provider Adyen. The plugin supports the Magento Community and Enterprise edition. Inhouse support on magento@adyen.com as well available through GitHub on https://github.com/adyenpayments/magento</description>
11
+ <notes>Features&#xD;
12
+ #225 HPP payment methods now are generated as seperate payment methods inside Magento&#xD;
13
+ #293 Added Payment method PayByMail&#xD;
14
+ #303 Implemented Cash API and added it as a different payment method (Adyen Cash)&#xD;
15
+ #270 Option to redirect to checkout instead of shopping cart&#xD;
16
+ #304 Added option to connect POS payment to shopper account based on provided email address&#xD;
17
+ #288 #299 Added support for Manual Review&#xD;
18
+ #294 Show installments on order print outs, confirmation emails and admin panel&#xD;
19
+ #284 Added Cronjob that executes notifications that are in the adyen event queue&#xD;
20
+ #283 #246 Added extra validation and restrict length on CVC&#xD;
21
+ #276 Added pending status setting&#xD;
22
+ #273 Added authCode and acquirerReference response into payment overview of the order&#xD;
23
+ #248 Added ReceiptOrderLines to Adyen APP for printing out order details for POS payments&#xD;
24
+ #247 Enable Adyen OneClick for backend order&#xD;
25
+ #245 Refactor the code for Notifications and Result URL with better logging&#xD;
26
+ #244 Added validate Webserver username and password in configuration&#xD;
27
+ #242 Added OneClick payment available for Sepa,Ideal(becomes sepa) and ELV&#xD;
28
+ #241 Added recurring cards to billing agreement of magento&#xD;
29
  &#xD;
30
+ Fixes&#xD;
31
+ #317 POS redirect to app fixes for various browsers&#xD;
32
+ #307 Rewrite POS resultUrl and CheckStatus check&#xD;
33
+ #305 Get RegionCode instead of Region to fix payments for PayPal&#xD;
34
+ #301 Added extra check on pspreference for AUTHORISATION success=false notification (for api payments) before canceling the order&#xD;
35
+ #291 Added support for Comorian Franc (KMF) currency&#xD;
36
+ #290 Added extra validation if modus is corresponding with notification (JSON, HTTP POST)&#xD;
37
+ #285 #243 API fixes for MultiShipping method&#xD;
38
+ #282 Fixes that Boleto pdf is not being generated&#xD;
39
+ #264 Separate ResultAction for POS&#xD;
40
+ #259 Only cancel a order when the payment method is the same as on Magento side&#xD;
41
+ #249 Don't show remember these details for credit cards if user is checking out as a quest&#xD;
42
+ #238 Generated OneClick payments as different payment methods&#xD;
43
+ #237 Fixed that previous button on Adyen HPP will not return in a empty basket when you are not logged in on Magento side&#xD;
44
+ #231 bug fixes, simplified frontend templates, fixes queue&#xD;
45
+ #228 Don't cancel the order if the previous AUTHORISATION event was succesfull&#xD;
46
+ #227 Don't cancel orders on Refused result url (only for Ideal)&#xD;
47
+ #224 Fix JS error when selecting card and Ideal is not available.&#xD;
48
+ #223 Magento API do not send email when order is created. Only when AUTHORISATION notification is received bug&#xD;
49
+ #188 Use POS checkout name based on POS payment method title&#xD;
50
+ #187 Pre fill email in POS express checkout if Payment failes&#xD;
51
+ #79 Added option to disable Klarna after first Klarna payment failed</notes>
52
  <authors><author><name>Adyen</name><user>adyen</user><email>magento@adyen.com</email></author></authors>
53
+ <date>2015-06-15</date>
54
+ <time>12:43:54</time>
55
+ <contents><target name="magecommunity"><dir name="Adyen"><dir name="Payment"><dir name="Block"><dir name="Adminhtml"><dir name="Adyen"><dir name="Event"><dir name="Queue"><file name="Grid.php" hash="1565d210471f6b1705484340dcc0618e"/></dir><file name="Queue.php" hash="d9d4d4113656ba4d6c97cf8e4c52b903"/></dir></dir><dir name="Form"><dir name="Field"><file name="Installments.php" hash="e73b36349ac2ac5f9687cd5ce5958e53"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="1460f2048e15c0d08405c00e68653a47"/></dir><dir name="Filter"><file name="Adyen.php" hash="f0428953d0ffb335d0d4a1362500ec2e"/></dir><dir name="Invoice"><file name="Totals.php" hash="40f4258c2e79e25bd38abb8ed7a0a778"/></dir><dir name="Renderer"><file name="Adyen.php" hash="187f435758aaf4d484c7c7a6ed1678b5"/></dir><file name="Totals.php" hash="e56db3fa837b78c3fa79851a82bac575"/></dir></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="1976ae2cccf9cbd106ff369625d5120b"/></dir><file name="TestWebserverConfiguration.php" hash="077e2befacb92e0eb9e5344fd3e0c4a5"/></dir></dir><file name="Version.php" hash="8ae6d538b9616499eb898579bef4abaa"/></dir><dir name="Checkout"><file name="Success.php" hash="b9df579840feb9a3579d563daa61425b"/></dir><file name="Failure.php" hash="ead96fee55fba2cbb5044f09566e85e4"/><dir name="Form"><file name="Boleto.php" hash="3aa44470fbf8a17a9a5df616296fb9b6"/><file name="Cash.php" hash="9e002a75111dced6b0faee374676ed85"/><file name="Cc.php" hash="93dd8057e5b5cb045538f9a2e5c362b4"/><file name="Elv.php" hash="4e2bb10687932be2523670ec73e02395"/><file name="Hpp.php" hash="48c854294efcfea8f2d246364b757188"/><file name="Ideal.php" hash="6a7f476ca4f81a71d607a91df9f287a6"/><file name="Oneclick.php" hash="19d96a47a08d30cbeab3f06b497f99b9"/><file name="Openinvoice.php" hash="45e523e0e8c0a5e34f720d739739016d"/><file name="PayByMail.php" hash="251095b5bbe53c4453980afd198e3c10"/><file name="Pos.php" hash="a80c02b4f15a7c54866ca08adcfca82a"/><file name="Sepa.php" hash="6e440966124884cbb9a1b9cf19bb7192"/></dir><file name="Form.php" hash="77d0589a32cb816dcdc6df16c98f2cd6"/><dir name="Info"><file name="Boleto.php" hash="6068acbb3d3dec90a797390871150956"/><file name="Cash.php" hash="41a920940198d51029ad9cad8f6b6b00"/><file name="Cc.php" hash="11dfe3d43bb6a8d89bb1746c8c2f6415"/><file name="Elv.php" hash="09a10412250e2bed303a189cfb216254"/><file name="Hpp.php" hash="bce3945267dac13f4fd9c9fd1400d11c"/><file name="Oneclick.php" hash="b0fb295f9a0572f92f0a1dc7108b9e8a"/><file name="Openinvoice.php" hash="1e99e4ab3ef75a9fa27626bd946b0407"/><file name="PayByMail.php" hash="3fa120141efed3f402aacf75f80432b4"/><file name="Pos.php" hash="8a6be4f35d43dc7791b9741cfb05b8a5"/><file name="Sepa.php" hash="2f6fbcfeb770a208abc9c8dd4cd1a613"/></dir><file name="PosExpressCheckout.php" hash="ee5348fb15ead9b2adb7c1ebd8b1b4df"/><file name="Redirect.php" hash="e17239447f47ada37fab15ff71141703"/><dir name="Sales"><dir name="Order"><file name="Totals.php" hash="0a566f422191f5e365cc7a1811c00c20"/></dir></dir><file name="SavedCards.php" hash="3fe47b88678d0c30aa3fc6b2b9592eae"/><file name="ScanProduct.php" hash="31c08b14b9e17a8f065b7d553470d518"/></dir><dir name="Helper"><file name="Data.php" hash="4ea34cb714545f19792356d8a7be72da"/><file name="Installments.php" hash="6bfc01af88a457be9f444aade1fd5e1d"/><dir name="Payment"><file name="Data.php" hash="621d8a9f81f35109da2e879db0285b24"/></dir><file name="Pci.php" hash="1ea63057346675d2cbf337d124fc47b7"/></dir><dir name="Model"><dir name="Adyen"><file name="Abstract.php" hash="c36ff3865235dd989a1f5d84af6d8104"/><file name="Boleto.php" hash="4f43d3ca646794f16b8521cc3863690a"/><file name="Cash.php" hash="6f4dd30400a4f0766ca1f526a934234d"/><file name="Cc.php" hash="60eb5ccdb0343b45236be522bddc652a"/><dir name="Data"><file name="Abstract.php" hash="90c19c5a7d79c1a53f85b77728ffc318"/><file name="AdditionalData.php" hash="e4d038a60ac548e0938f75a0452d5717"/><file name="AdditionalDataKVPair.php" hash="cc2e0ba6733ef5139f44ba7c9af303dc"/><file name="Address.php" hash="1ebe7211a9ada35e346d50a43e4d1045"/><file name="Amount.php" hash="73540706cac2c2eef0252615d6200511"/><file name="BankAccount.php" hash="89124b1a311269d878e88acd56391afc"/><file name="BillingAddress.php" hash="05d2568acb382d242635b7fbfef26afe"/><file name="BrowserInfo.php" hash="bd1cca3cc27aea7fad85661c7132e2cd"/><file name="Card.php" hash="ea384e9c2032ba7ad5925edfb434625f"/><file name="Classmap.php" hash="38ab9bfbfb1585852380c0551a35b9ec"/><file name="DeliveryAddress.php" hash="8a97c0555842c9f8108a202125e48724"/><file name="Elv.php" hash="6608688d03b047387a2b28be10c47b87"/><file name="Installments.php" hash="ab285677d94614d631b927b427268eff"/><file name="InvoiceLine.php" hash="2013af2bbae2b07df4db34b4d8565796"/><file name="InvoiceRow.php" hash="caa2f530ea8a2100fee55f9d16fa8235"/><file name="ModificationRequest.php" hash="b6cfbd15724a995350598fa0faaa4862"/><file name="ModificationResult.php" hash="eec37eba3849baa4ad52b194e31ac362"/><file name="NotificationClassmap.php" hash="31166e4ef9ea728c107f5ee501d67fc5"/><file name="NotificationRequest.php" hash="4647bfc558308e8f7795ae97fbf2c066"/><file name="NotificationRequestItem.php" hash="ef0794de69076f4accc5035b3f659808"/><file name="OpenInvoiceDetailResult.php" hash="68391a7b4b2a460967ec0018a2300396"/><file name="PaymentRequest.php" hash="e06538a160005141a4e34be998191780"/><file name="PaymentRequest3d.php" hash="9db425c9bb6cf15498995afeb779a615"/><file name="Recurring.php" hash="ae069455222f0315c2eaee6cdf84f461"/><file name="RecurringRequest.php" hash="aed77050f296df4f48c88038ef3ac547"/><dir name="Server"><file name="Notification.php" hash="51ed88aa2c2035e4cb7b4e992e7c8e4a"/><file name="Openinvoice.php" hash="d94166e3c8337e213061655ab7e48e68"/></dir><file name="ShopperName.php" hash="91bfea9ade01d29fa9053de87ce01560"/></dir><file name="Debug.php" hash="8044ccae24d83db38d9430cf125ada83"/><file name="Dummy.php" hash="a72ccc6e8c5268cf6786db289de4e3d9"/><file name="Elv.php" hash="ab624ee949965819bcc629ce39946334"/><file name="Hpp.php" hash="dd6265bfde24693e92bc2c8e4371bf55"/><file name="Ideal.php" hash="ccd1c07806f9c31e0f391242e9cb4949"/><file name="Oneclick.php" hash="b0e39dec35993b775333b250ea66c339"/><file name="Openinvoice.php" hash="0323e497f44454de9d166a8090a68eb2"/><file name="PayByMail.php" hash="e861fa73b1f5f018430352d09e6e98c7"/><file name="Pos.php" hash="b46c840f6e787fa43fe87a38fadf2c4a"/><file name="Sepa.php" hash="d37538658867fdd5b34b5cb7f2c647d1"/><file name="Shared.php" hash="7f3fe961a7107b6fb5625a9efe7854fd"/><file name=".DS_Store" hash="d179556f904a5601ccd01a54743c155f"/></dir><file name="Authenticate.php" hash="fdc6bc00989a4aaadfc6f4a64395e278"/><file name="Cronjob.php" hash="3fa8291eb3f98a1ab48879fa467686b0"/><dir name="Event"><file name="Queue.php" hash="3f17b99a54cf5d910c3320e7a38d0ea3"/></dir><file name="Event.php" hash="632bfefbb6c2edab79d2be1b082a69bf"/><file name="GetPosOrderStatus.php" hash="682e47f436377b1f3e41f0092051bfc6"/><file name="Observer.php" hash="e8f1d0438068f1569706c7b13082811a"/><file name="Process.php" hash="fdbbfc7b61222edefcf81af81a12d0f4"/><file name="ProcessNotification.php" hash="6b263f4c321ef074a9386a1e1bd44bee"/><file name="ProcessPosResult.php" hash="6630a1ed1d4a81996a7f3714d6ee6990"/><dir name="Resource"><dir name="Adyen"><dir name="Debug"><file name="Collection.php" hash="17ac8dbcf67d0df518ef2d94c3206fd5"/></dir><file name="Debug.php" hash="d1de3e55152ab586971d08950ced8faa"/><dir name="Event"><file name="Collection.php" hash="33b8b85c9c7b3d2428e9b23a9e7e0c72"/></dir><file name="Event.php" hash="4f398e0de5b8a2a9ec5f87480e13da67"/></dir><dir name="Event"><dir name="Queue"><file name="Collection.php" hash="9dffd9015dfa7cd8498e5961f9ab66f3"/></dir><file name="Queue.php" hash="b8a4c3ed5adaaacf8b6192d05937e390"/></dir><file name="Order.php" hash="32950fec5760e2e7f167af451e313129"/><file name="Setup.php" hash="4e2258146a321cad436984ca223a9e5b"/></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="PaymentFee.php" hash="a5b1568d998315c1fbfae5c74405e41b"/><file name="PaymentInstallmentFee.php" hash="da284541372973799ea956771799cb72"/></dir></dir></dir></dir><dir name="Source"><file name="BoletoType.php" hash="1a31476c4ebfdb6b16a1dd3a26015fb1"/><file name="CancelModes.php" hash="b18c30b103cdce97af41e63ef0a25a92"/><file name="CancelRedirect.php" hash="f71a598d56641cc5550812abd7f3d9b7"/><file name="CaptureModes.php" hash="d2d138f0a59e1e448531f1fd8f908439"/><file name="CcType.php" hash="a27d98867f6c9d9245c242919a869ed6"/><file name="DemoModes.php" hash="0ce4142166b9f7dc96ee8e1e3bd03286"/><file name="OpeninvoiceType.php" hash="c39389388338dfe0b85b10a1e9b828cb"/><file name="PayPalCaptureModes.php" hash="efdc4f49677ed257af337bb64d06d132"/><file name="PaymentAction.php" hash="23224178cf58e55c308234036f629bf7"/><file name="PaymentRoutines.php" hash="7aa5525e67554ad35226cf1aaa802c49"/><file name="RecurringType.php" hash="2a3c60c4546d9c02c842a9ea0a5ade26"/><file name="Rendermode.php" hash="5d55655d4bd2a49b113446ec10519be6"/><file name="SepaFlow.php" hash="64e6fd9181772db70e3dfc012c117a46"/><dir name="Status"><file name="Complete.php" hash="1580706a7d28010ed5acc678f549df73"/><file name="Pending.php" hash="53e624a2a6b76b4e6dee7f4eece245b1"/><file name="Refund.php" hash="f763d00e989f39dce9daddb7c1bd28f6"/></dir><file name="VisibleType.php" hash="ecc88ad246d8e52316d53f879d615803"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Installments.php" hash="6c3b60719edb83eaaad1515514dab620"/></dir></dir></dir><dir name="Total"><dir name="PaymentFee"><file name="Creditmemo.php" hash="738f7b84586d51cd875011d6b31dfd3e"/><file name="Invoice.php" hash="8aa607b99f709a5eee9b76675e2d5ada"/></dir><dir name="PaymentInstallmentFee"><file name="Creditmemo.php" hash="b40551c179c19ccea7be11a5edf6be4c"/><file name="Invoice.php" hash="5f4563813511aff2eafb98cf4943d817"/></dir></dir><file name="ValidateResultUrl.php" hash="357d52f7746f993d6c119360f03c6e2e"/><file name=".DS_Store" hash="286b9ee8ade7883fb60d91c7d0c64900"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Adyen"><dir name="Event"><file name="QueueController.php" hash="a561584895f857c40702f19b285ad8a5"/></dir></dir><file name="ExportAdyenSettingsController.php" hash="0e00e37b119d3b5b61d22f93d88046e1"/><file name="ValidateWebserverSettingsController.php" hash="70db09120f59b4933de5b83d5a83e6c0"/></dir><file name="CheckoutCashController.php" hash="33c9f26d8fa0260ec9daccea3638c609"/><file name="CheckoutPosController.php" hash="59a14c7e7e916ab79304551072b574bb"/><file name="GetInstallmentsController.php" hash="e8401d9b5dd01efc8f6ea535087963bd"/><file name="ProcessController.php" hash="f2e8f2c18c0a266385b1e3ffa24eae3a"/><file name="SavedCardController.php" hash="db57de304ee0cccc9bbec470ec27398a"/><file name="UpdateCartController.php" hash="c7280eb6b5b5f87e2dd9f06cc4370e97"/></dir><dir name="data"><dir name="adyen_setup"><file name="data-upgrade-2.1.2.3-2.1.2.4.php" hash="8262bf4038ba435fe15bd08c36814936"/></dir></dir><dir name="etc"><file name="Notification.wsdl" hash="cbba67067d372790e91225b4049c7e0d"/><file name="Payment.wsdl" hash="4190412f599a3eac827d7ed0931754da"/><file name="adminhtml.xml" hash="77f449af89755295ba515ea52dfda649"/><file name="config.xml" hash="d77f6ca76a7b48be1e61374ba3047096"/><file name="system.xml" hash="6944646be130b78c95ef6621c3a58965"/></dir><dir name="sql"><dir name="adyen_setup"><file name="mysql4-install-0.0.1.php" hash="3c304ff04d461bc0bfa6205c03dceea0"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="3d687c555ed52be5eeb4eaba126abb2b"/><file name="mysql4-upgrade-0.0.7-0.0.8.php" hash="27b202258c2bd16ee64902df7985862e"/><file name="mysql4-upgrade-0.0.8-0.0.9.php" hash="85d3de753b99b541a4547c39b7713905"/><file name="mysql4-upgrade-0.1.0.3-0.1.0.4.php" hash="91a318943b2ead4fd5d3dc7cfa04023e"/><file name="mysql4-upgrade-0.1.0.8-0.1.0.9.php" hash="0ba22acbe3f48fc1ae1e76212a11dc2a"/><file name="mysql4-upgrade-0.1.0.9-0.1.0.10.php" hash="2b029ba94cea8dd9b6d82a0de265234f"/><file name="mysql4-upgrade-1.0.0.3-1.0.0.7.php" hash="b185927a102e0cefa08fe155cfa16004"/><file name="mysql4-upgrade-2.0.3-2.1.0.php" hash="fc4fc300116a7e471fd35699979f21f7"/><file name="mysql4-upgrade-2.1.1-2.1.2.1.php" hash="50716af509a51f67eb3535f59206d3c1"/><file name="mysql4-upgrade-2.1.2.1-2.1.2.2.php" hash="42480b5f0081e89faa8da76e53d10a91"/><file name="mysql4-upgrade-2.1.2.2-2.1.2.3.php" hash="3c68f09a8bcd44943587428ee24e0947"/><file name="mysql4-upgrade-2.2.0-2.2.0.1.php" hash="62cba81b54d9d8f09733946093da241a"/><file name="mysql4-upgrade-2.2.2-2.2.2.1.php" hash="c2353636858c03e61e782c7d809bbab5"/></dir></dir><file name=".DS_Store" hash="282419beef00918e7192da78057ace9d"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="adyen.xml" hash="088b576dc010f4a7983837fa13785472"/></dir><dir name="template"><dir name="adyen"><dir name="form"><file name="boleto.phtml" hash="83c7bc35d037f426aa75c0719e8adb86"/><file name="cc.phtml" hash="d54095e88b03dcee8ef3183b24a2468b"/><file name="elv.phtml" hash="4d370d2d737f0a42ebcb33e7151ecee6"/><file name="hpp.phtml" hash="38457f21f239afbed434bdae45bef0e3"/><file name="oneclick.phtml" hash="b02fcaf3400be660b4fcb45c3fbdcd05"/><file name="openinvoice.phtml" hash="33127af4713430e153cccbe8684fab13"/><file name="pos.phtml" hash="c07c11d348fced7d889ded4fc77e3363"/><file name="sepa.phtml" hash="3242268216a2a26cf28b97236cdc92a1"/></dir><dir name="info"><file name="boleto.phtml" hash="78f08b7f59ff049f189d61758b7abced"/><file name="cc.phtml" hash="608567b02456894e5b1dbaa2484a9380"/><file name="elv.phtml" hash="bda2d4870da5a283d9561b66b76e8114"/><file name="hpp.phtml" hash="ee5fd9ccc1b4f7fd1f575d0d53d87c8f"/><file name="openinvoice.phtml" hash="86fecfa81c87af7464f38f43c7db9be6"/><file name="pay_by_mail.phtml" hash="617bf20851918b200a4a980a68908162"/><file name="pos.phtml" hash="dfef416dc70f315bf9904dafce4f19d6"/><file name="sepa.phtml" hash="ca2a1b25f4652e9411ae6ff8b2a0f04e"/></dir><dir name="pdf"><file name="boleto.phtml" hash="50853749a944124f076d129fd5e6cfa9"/><file name="cc.phtml" hash="ecc91b3df7776b2c2a6dc4a52d1892d2"/><file name="elv.phtml" hash="50853749a944124f076d129fd5e6cfa9"/><file name="hpp.phtml" hash="4cdb4f7c88b6556fc847c21d5d4b7ffb"/><file name="openinvoice.phtml" hash="742b87babbb612032d68a8e79d31e89c"/><file name="pos.phtml" hash="a3dc27a6607b4978c93b21d945661e5c"/></dir><dir name="system"><dir name="config"><file name="test_webserver_configuration.phtml" hash="e16033f88d5c5bc4a25cbb860f620022"/></dir></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="adyen"><dir name="checkout"><file name="success.phtml" hash="4c06b168acd8971e20a7c8d1205c264b"/><file name=".DS_Store" hash="21ecd78ea5715d7392b2d8a533c6630a"/></dir><dir name="form"><file name="boleto.phtml" hash="309a0152cd5219e2c22da4270307222c"/><file name="cc.phtml" hash="8c0ff09b5c12e0a7b6b6389c2c7d2a66"/><file name="elv.phtml" hash="789610e3d1f8973f6aecb4ef119a59c9"/><file name="hpp.phtml" hash="5e2f2ed4fb91dec2d62a0311a21415e0"/><file name="ideal.phtml" hash="d693c356f0e7f8eca20ac086c665a135"/><file name="oneclick.phtml" hash="e5c4ea733ca7235555207e4fa7efd4a6"/><file name="openinvoice.phtml" hash="659c5385af90f70f910d1f3605a0613b"/><file name="pos.phtml" hash="07cbc4b9dbbe63849599dbfd4339cd44"/><file name="sepa.phtml" hash="a479f68dd467d0cb7aa1c6fa2ce2aeb2"/></dir><dir name="info"><file name="boleto.phtml" hash="c526f9c4badab3afaa771872bb4687f1"/><file name="cc.phtml" hash="c540dddb22ca1c9f301c445291d82d16"/><file name="elv.phtml" hash="8b850e97ea84e1de5ead4ec487c4356f"/><file name="hpp.phtml" hash="8999dfee0c638f44b5010779b8bbf711"/><file name="openinvoice.phtml" hash="2bcd711e1255923d53f353819e19529e"/><file name="pay_by_mail.phtml" hash="c09d9f774eeefeb465cc3f425bf7d54e"/><file name="pos.phtml" hash="9b917920aa1cc77c9e8c3a26943b1335"/><file name="sepa.phtml" hash="c886a3d9923c3ade6ca5056f18c1b856"/></dir><dir name="payment"><file name="payment_method_label.phtml" hash="256b943044431874fbaea43760544fcc"/></dir><file name="pos_express_checkout.phtml" hash="9dbbc2237dfda2c735bfb853a5f20efd"/><file name="saved_cards.phtml" hash="b0ff50d615273804c0f6fef55ce31cf9"/><file name="scan_product.phtml" hash="b3b84dc6804f832919406644a0378492"/><file name=".DS_Store" hash="ab6d0ae72b40033c9fed5850d3f5d499"/></dir></dir><dir name="layout"><file name="adyen.xml" hash="f17c5283f10c067f85bdcf1b74347cb0"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Adyen_Payment.xml" hash="e4d297a9b401c4548acb47aea1ae41d9"/></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Adyen_Payment.csv" hash="6512eaeaacdfd84b94dbbae212b3f363"/></dir><dir name="es_ES"><file name="Adyen_Payment.csv" hash="b1b6ec9574d78d34839740daa4f0a6c4"/></dir><dir name="fr_FR"><file name="Adyen_Payment.csv" hash="1d55a9a934535f4366744deff69ab94a"/></dir><dir name="nl_NL"><file name="Adyen_Payment.csv" hash="9ff0d198b047eeca70c9fd87b7c96410"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="adyen"><file name="ABNAMRO.png" hash="a621e7f4cf1c3340ac5147fef5544bfe"/><file name="ABNAMRO.xcf" hash="eac24c953dcf05d40ce928ccab2af90f"/><file name="ASNBANK.png" hash="13034bc0836590cfb0ec7b6c3076e435"/><file name="FORTIS.png" hash="3b68fa26a90f8cd44e2f8dfcb5f72fe8"/><file name="FRIESLANDBANK.png" hash="c1388a9b8a170260b0b72da9b2cd2dbf"/><file name="ING.png" hash="b08f829cf67322875ca12d5fc36ac191"/><file name="KNAB.png" hash="4df678f84bdf11db9b75d1e539a0367c"/><file name="POSTBANK.png" hash="ea0ffd9d3e9717fe0bdc160d8cd92482"/><file name="RABOBANK.png" hash="f09418ebbd0d6daf21786d5bde93e856"/><file name="REGIOBANK.png" hash="0c3a984ce817e4d3ec98549be7704712"/><file name="SNSBANK.png" hash="75f988e3ab935d6d509a86f82422f474"/><file name="SNSREGIOBANK.png" hash="34a70ac0e1e0a8cfb56c77a5b1da3c80"/><file name="TESTISSUER.png" hash="0110aadd0f619b39f357b98b63e3ff69"/><file name="TESTISSUER10.png" hash="b2462fe98e69d211e92771ae75f48552"/><file name="TESTISSUER2.png" hash="471cc38e61077fdaba8fd868fea22dfe"/><file name="TESTISSUER3.png" hash="4ca46be0b7607dc95caccb5ec974e0a8"/><file name="TESTISSUER4.png" hash="6e31a3d3e73390432a84e394a1937c5d"/><file name="TESTISSUER5.png" hash="78b758fef66f220e79b1b9ecda8851d2"/><file name="TESTISSUER6.png" hash="4aefac8baaa06592c8a80f085c0ade08"/><file name="TESTISSUER7.png" hash="0474b1a3264ef45068013747a27158d2"/><file name="TESTISSUER8.png" hash="5e655c4af04b417acecac6fd66623662"/><file name="TESTISSUER9.png" hash="6e378c3b7c75febd0be361ec39c55e45"/><file name="TESTISSUERCANCELLED.png" hash="c794eeb78ef618c3e9dcd8b444b7b23f"/><file name="TESTISSUERPENDING.png" hash="04ee87a5c35a491e624719a3c885d492"/><file name="TESTISSUERREFUSED.png" hash="2f7e2bad6857f39f32afd09eb846e55a"/><file name="TRIODOSBANK.png" hash="922b1fcd51306e0d0da6b15ebe640d8c"/><file name="VANLANSCHOTBANKIERS.png" hash="0a5d713a5c73c54e90507743456c5657"/><file name="achcolombia.png" hash="1f1339c682440cfd7584f9ba00f59722"/><file name="achcolombia_small.png" hash="d6b2899a0039de82788c831b00dd1533"/><file name="achcolombia_small_grey.png" hash="bcae575368bdcdb582423e28ac7a56e9"/><file name="achcolombia_tiny.png" hash="a287c57b8bcc821371758da895db6437"/><file name="advance_payment.png" hash="5aba603621b4b21cc05b7eae1f7455da"/><file name="adyen_logo_large.png" hash="70726ef290d0eee3ed163eb751091813"/><file name="ae_small.png" hash="6ce7c9a2b330c9c46f0213c40db55683"/><file name="afterpay_default.png" hash="a62e3982d50612522be071d4e86eaa6a"/><file name="alipay.png" hash="e3773ada96577e575c9e1300a89a5875"/><file name="alipay_small.png" hash="f9848d15fc7ee22b6687ccdbe7f36a16"/><file name="alipay_small_grey.png" hash="e5ffe7ff272ce2814b7808fd047a9c6b"/><file name="alipay_tiny.png" hash="1a7867dd958ddcdd90ad2400e5be23de"/><file name="amex.png" hash="8e3b962f9ef18e08cf16b77934607d28"/><file name="amex_small.png" hash="6ce7c9a2b330c9c46f0213c40db55683"/><file name="amex_small_grey.png" hash="0f6aabd8dfcbf48dbb555b9191d7795e"/><file name="amex_tiny.png" hash="b7016f4efb163c985d6f1d99a8433d2a"/><file name="asiapay.png" hash="44626dc317e547fb40010498c1096407"/><file name="asiapay_small.png" hash="cca4d86b5abc510f20ca9563d7215c3d"/><file name="asiapay_small_grey.png" hash="00e20b2b2eb0d2ad51c15d8ccc558dc5"/><file name="asiapay_tiny.png" hash="ba0d613d94a64918c0338504fed20ee7"/><file name="autopay.png" hash="4251763c71239e7b1b421e4bc7f5b70a"/><file name="autopay_small.png" hash="ca6941b80b6157bae2411b5620149d2d"/><file name="autopay_small_grey.png" hash="f69d143b4f1fc16a9138ccfacec808a4"/><file name="autopay_tiny.png" hash="4c0c91402daafc63bdb5979dbbd963db"/><file name="babygiftcard.png" hash="91bcbb6604b26565b89898c9a8e1e117"/><file name="babygiftcard_small.png" hash="2558bbdd4d9528b37ba93a8c4af536a4"/><file name="babygiftcard_tiny.png" hash="393a192fab9874e3b167c3bc5d568db7"/><file name="baloto.png" hash="1c172c628f79837c83196b243c636ff5"/><file name="baloto_small.png" hash="c66db84ac7fed6f81010e8058fa39a74"/><file name="baloto_small_grey.png" hash="bdc5eac76e02a658b348a0722fca9ba9"/><file name="baloto_tiny.png" hash="5e10ee14c8a44c3b4c28571664fa045f"/><file name="bancnet.png" hash="a2b687ef27244e448b85635cc1d3ec60"/><file name="bancnet_small.png" hash="4473bc16badc29200ffd09021778b1e3"/><file name="bancnet_small_grey.png" hash="6b108ea906b6d6a5ad51e4de6db732eb"/><file name="bancnet_tiny.png" hash="0ac28b35fd4e09954debcd2eb42e89ce"/><file name="bank24.png" hash="9a921572d6bae73604e1122ec3e5bf7e"/><file name="bankTransfer_AE.png" hash="a6f29729723fa65c732ffc9267b3f8be"/><file name="bankTransfer_AE_small.png" hash="a3322805ab1c40c4e6237943185284ab"/><file name="bankTransfer_AE_tiny.png" hash="dfcf50c97c3b832fd3c17efb2864335c"/><file name="bankTransfer_AT.png" hash="7fa4204d1426a64a4cd26af06af44d41"/><file name="bankTransfer_AT_small.png" hash="31037dcf034d1e9d28254d1962b2ca16"/><file name="bankTransfer_AT_tiny.png" hash="4ee9964118e05d2a81335f3033ec5bf1"/><file name="bankTransfer_AU.png" hash="05716c67579fcf3574037ce69c9e4229"/><file name="bankTransfer_AU_small.png" hash="acd23b8e3ccf3c9d28960fde63c22e85"/><file name="bankTransfer_AU_tiny.png" hash="4a3ee62afdac23a00a0675c763e93470"/><file name="bankTransfer_BE.png" hash="5547426f07e0562ba9b605f1f04a9ad7"/><file name="bankTransfer_BE_small.png" hash="007dbd9f27115b601eb94db09a10b8f3"/><file name="bankTransfer_BE_tiny.png" hash="cf0285a691339efad52d82d40c7aa9f1"/><file name="bankTransfer_BG.png" hash="be209415f5bec0a45bd2bd9cd3c41d0a"/><file name="bankTransfer_BG_small.png" hash="6249144aa579c494988b5bbecb22eb69"/><file name="bankTransfer_BG_tiny.png" hash="7c11956844dbf7cc76db038b32fc7ab1"/><file name="bankTransfer_CH.png" hash="9b20d62386085ac2c9da1227abec5d58"/><file name="bankTransfer_CH_small.png" hash="2887bcf97901ed7ed6bc4fb5d8a00876"/><file name="bankTransfer_CH_tiny.png" hash="c0218d075bbb503689f40007a331ba85"/><file name="bankTransfer_CZ.png" hash="78f7aac275e10af77b3bbab28ba1aa23"/><file name="bankTransfer_CZ_small.png" hash="7bf17799b64aa618945981eb7fa00cce"/><file name="bankTransfer_CZ_tiny.png" hash="7f2a7e2fde701bff21fa388776e73632"/><file name="bankTransfer_DE.png" hash="989d5e1cc2547504b0fbc7aa88e08713"/><file name="bankTransfer_DE_small.png" hash="fb50048c4acfdebf85c4c8f90d8b08d9"/><file name="bankTransfer_DE_small.xcf" hash="cfbc9a47bc116e97a121771c0aa6fe83"/><file name="bankTransfer_DE_tiny.png" hash="d4d68f1068df68f61cb828005c9c0ac9"/><file name="bankTransfer_DK.png" hash="a2e9a409144a8ef18747faafa2937609"/><file name="bankTransfer_DK_small.png" hash="71e75c357b475fe236b633ac8a2a76cd"/><file name="bankTransfer_DK_tiny.png" hash="0103bbe5b8a803aad990bd4ad53c88c0"/><file name="bankTransfer_EE.png" hash="9caa3e1ac3558e9ec372c45df045bae6"/><file name="bankTransfer_EE_small.png" hash="91ffe550444bac13ac29ac1696ffdfac"/><file name="bankTransfer_EE_tiny.png" hash="59ea293d7ba58cd6dd9a9a2b43088093"/><file name="bankTransfer_ES.png" hash="7d0051c7ee32eddca94b89368bb5afbe"/><file name="bankTransfer_ES_small.png" hash="2dc1519510ef7bea726e0bca70859c06"/><file name="bankTransfer_ES_tiny.png" hash="a2338a0d60b2585ac34269daf794d189"/><file name="bankTransfer_FI.png" hash="ffbe8dfa936a4628e3c029bd957f367d"/><file name="bankTransfer_FI_small.png" hash="1db5d45d947502483a2e8c40aab3734d"/><file name="bankTransfer_FI_tiny.png" hash="b9f26cef0fc7f051b6d79ada14c902ba"/><file name="bankTransfer_FR.png" hash="572f77cf0f22103300682c5f89e9d9e9"/><file name="bankTransfer_FR_small.png" hash="58a268c927e4d19858ed3241ceac05f8"/><file name="bankTransfer_FR_tiny.png" hash="dee4c0c47d94fb0e2ab032264c4d1543"/><file name="bankTransfer_GB.png" hash="5a7eee2f31bec7bf422425f31aea2d5a"/><file name="bankTransfer_GB_small.png" hash="17d3c0ca20cee2250e3b6d0f5f080ba9"/><file name="bankTransfer_GB_tiny.png" hash="24d7d3ce5dc62ef776f3f36f24ff78b1"/><file name="bankTransfer_GI.png" hash="e9035b335bd8dc809c7e4afc7d775cc0"/><file name="bankTransfer_GI_small.png" hash="e51bd2f8333a8d8b2163c777c5b12b48"/><file name="bankTransfer_GI_tiny.png" hash="d158401d4dd73a057adac68f3f23ad89"/><file name="bankTransfer_GR.png" hash="aefe60c85d74d77d1c1327538617f297"/><file name="bankTransfer_GR_small.png" hash="b9a0a5d6ec52c80d72d8e8cf903f37f3"/><file name="bankTransfer_GR_tiny.png" hash="1dc0912afd646785eade5d8785baa12c"/><file name="bankTransfer_IBAN.png" hash="f636fcae0c128e08baaef26dacaa078d"/><file name="bankTransfer_IBAN_small.png" hash="ffc0073f2fe405de05206cdfc1565daa"/><file name="bankTransfer_IBAN_tiny.png" hash="4a4f64cb62ca9cfec99d117d0169bb83"/><file name="bankTransfer_IE.png" hash="eb6efba5502d54571022feaef9a9ded3"/><file name="bankTransfer_IE_small.png" hash="d9359e8a2bf8c04d4d43acdcc8b30a5e"/><file name="bankTransfer_IE_tiny.png" hash="b3a0f75656b535960c362baaabc45ce3"/><file name="bankTransfer_IT.png" hash="cd56062b943e4ec6716bc72ebe4b62a9"/><file name="bankTransfer_IT_small.png" hash="29ac58a26ae12dc26dd2d501262ed361"/><file name="bankTransfer_IT_tiny.png" hash="c45892a3e2ae81bb9b4508d79164e556"/><file name="bankTransfer_JP.png" hash="20023e2e93afc881740ea74e89251d86"/><file name="bankTransfer_LU.png" hash="b3dbdeea3429de5280c3a6d911930e9a"/><file name="bankTransfer_LU_small.png" hash="ebb919c647653075be4d9bfaeec8c00c"/><file name="bankTransfer_LU_tiny.png" hash="ec058289aef35f481077c56cdf758032"/><file name="bankTransfer_MT.png" hash="8955bc706cf66307ba69e58d8006af2d"/><file name="bankTransfer_MT_small.png" hash="13ce68bbda83c39b8719d356705da6d2"/><file name="bankTransfer_MT_tiny.png" hash="b05aa11e844f09fa797a3540534e5155"/><file name="bankTransfer_NL.png" hash="ccffd7131f791f7eb44e21b42fd66cc4"/><file name="bankTransfer_NL_small.png" hash="90f18f3784ec4c4733891aafd2e83958"/><file name="bankTransfer_NL_small.xcf" hash="ac17edd9804089820e9d73c76441abfc"/><file name="bankTransfer_NL_tiny.png" hash="61e9d461381aa1fb7e9dbcc8012686e0"/><file name="bankTransfer_NO.png" hash="ffcb1204470ff94a7cf2025e000e4978"/><file name="bankTransfer_NO_small.png" hash="daab5aceaf8e4dd59dfcf29fa69cdc24"/><file name="bankTransfer_NO_tiny.png" hash="3fbbf9e381d8d0d9ada61a54778655cb"/><file name="bankTransfer_PL.png" hash="cd25fefef6bce86a97ab7242138360e2"/><file name="bankTransfer_PL_small.png" hash="880b17d7d090c7bd21965e9b78894851"/><file name="bankTransfer_PL_tiny.png" hash="9579393e3dbb3c2aeb7ebf35e54ef4e7"/><file name="bankTransfer_PT.png" hash="c3c652523d77b5d085da97111c96ef9e"/><file name="bankTransfer_PT_small.png" hash="9d3a979ef52298bcc1545b131bd4a3db"/><file name="bankTransfer_PT_tiny.png" hash="cf2be093140773d75d8993fab7aa347c"/><file name="bankTransfer_SE.png" hash="e5608461fa8bdbac771449f30cde91ec"/><file name="bankTransfer_SE_small.png" hash="0f57f6092f8bef25c9973a140a2d85ad"/><file name="bankTransfer_SE_tiny.png" hash="79f3a00608bf18d686d89562af80a72f"/><file name="bankTransfer_SK.png" hash="2390a923affb1640b1b8bb801ce04705"/><file name="bankTransfer_SK_small.png" hash="50adde906c3a965992bbfb04554a5371"/><file name="bankTransfer_SK_tiny.png" hash="d4866f13969214fd774ea1c427a048e6"/><file name="bankTransfer_US.png" hash="9013561099b618aa954f5a3e1352a6ce"/><file name="bankTransfer_US_small.png" hash="191e204c1216a199229da9d75ed1a2a5"/><file name="bankTransfer_US_tiny.png" hash="9d9e942b93d13a18e38aac0ee932fe15"/><file name="bank_ru.png" hash="2390a923affb1640b1b8bb801ce04705"/><file name="bank_ru_small.png" hash="01c263789dd7e38ac4078f55161ec19b"/><file name="bank_ru_tiny.png" hash="d4866f13969214fd774ea1c427a048e6"/><file name="barras.png" hash="389f5242e23cc5b386392d5d21459f21"/><file name="barras_small.png" hash="9e657657b963a1434e88d4289acf9448"/><file name="barras_small_grey.png" hash="d14dbd53e9a52706bf736525a90d8f63"/><file name="barras_tiny.png" hash="e46d37c7e69ef3722876a0205431f1c8"/><file name="bcmc.png" hash="28dca1b34022f2c653c13556c452fce3"/><file name="bcmc_small.png" hash="49698208e5b73f80773260c3fdb3e5a3"/><file name="bcmc_small_grey.png" hash="5069f14bff23c074af6fe2092a2e482a"/><file name="bcmc_tiny.png" hash="3b4221516dc0d1ace3432a473903991e"/><file name="beelinesms.png" hash="a559096cb240aaf7696be7563498b18b"/><file name="bijcard.png" hash="c93da8e22fac6869d729e961df24b593"/><file name="bijcard_small.png" hash="f188b92b77af1613a91c00450d3eb168"/><file name="bijcard_small_grey.png" hash="08eb4420ac9f7a7f691d688e9550f651"/><file name="bijcard_tiny.png" hash="b88eeed8f7318514f849e3ed3a9a2ce8"/><file name="bill99.png" hash="461213bcf10fb394ef524d3a0ad92ee0"/><file name="bill99_small.png" hash="d6e30f7d3da5ce34af3aa7e2353b4809"/><file name="bill99_small_grey.png" hash="a66c49f3556fa99301f4288341eaa014"/><file name="bill99_tiny.png" hash="d10dbbf6512e15252ad6d1337670a7fd"/><file name="boleto.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="boletobancario_hsbc.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="boletobancario_itau.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="boletobancario_santander.png" hash="3968115c3576a14f7cdc8ebd98c8092e"/><file name="bradesco.png" hash="d5ae6f8cb39883cce8c97c0d11257a4c"/><file name="c_cash.png" hash="1b9d5b0c9ece2eaff0be71b4082e0655"/><file name="c_factuur.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="c_factuur_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="c_factuur_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="c_invoice.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="c_invoice_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="c_invoice_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="c_oprekening.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="c_oprekening_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="c_oprekening_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="c_paypal.png" hash="fe5fd0065e4a84e967095f082b329d7f"/><file name="c_paypal_small.png" hash="294698dab8f5aa31f2ad62702bd9d379"/><file name="c_rembours.png" hash="fb2da23375ce5ba67380dc0fb60e7669"/><file name="c_rembours_small.png" hash="0d0f244c1820921db3a6635552cf8129"/><file name="c_rembours_tiny.png" hash="c15d78de45389d475f2786fed3e81c4b"/><file name="card.png" hash="adfe3d9fe45c3f94b9edca852e2cb38c"/><file name="cashticket.png" hash="0dba12beffb7c5ebf47ae1e5701426f3"/><file name="cashticket_small.png" hash="ade5518971a871dd48b0628af6f6cf89"/><file name="cashticket_small_grey.png" hash="348c3721fbedfb2a7121f57db435f43e"/><file name="cashticket_tiny.png" hash="95248971eb69c150748b9acf27f68fb5"/><file name="cashticket_tiny2.png" hash="16ab15f5263fe81ab5233d02ce2cd715"/><file name="cashu.png" hash="1b6d79438ad686cdff44866a66445dca"/><file name="ccavenue.png" hash="aee563b4c9c77d8a881db1e79ad8758d"/><file name="ccavenue_small.png" hash="ffa7390808c679e8d6c580fcf14054fb"/><file name="ccavenue_small_grey.png" hash="9a6c58e88230fb6a167e597752a533ab"/><file name="ccavenue_tiny.png" hash="994d56725d095d107fb33c6f3abf7653"/><file name="cellpaypoint.png" hash="c676483390c0c7e932a320b6326593da"/><file name="cellpaypoint_small.png" hash="f720447e73325b922568a00d0effe75c"/><file name="cellpaypoint_small_grey.png" hash="c6deea99f2099ade43b2b75dcb62f273"/><file name="cellpaypoint_tiny.png" hash="5c00501360e94b3020ff54bccbc2e531"/><file name="ciberpay.png" hash="625d300997f331918e912dc266e1a3a4"/><file name="contact_ru.png" hash="5f70b79ee4232a81a9f7eb0224b0ba3c"/><file name="creditcard.png" hash="87a9f022a38f3e96981c420d6571381f"/><file name="creditcards.png" hash="cd1a83b970a38307c2899f9949495a00"/><file name="cup.png" hash="068dee300e2c12e58e9a47d3556e977c"/><file name="cup_small.png" hash="45d3b4e758237412b524a5c52418da67"/><file name="dankort.png" hash="aac4acc9e43e896973f36d3e7011a5af"/><file name="dc_small.png" hash="ecf5d635a74460ca9575bb7d6d8550dd"/><file name="di_small.png" hash="8573aebe4938afb288749badb22aa091"/><file name="dineromail.png" hash="9058ea237d278d5fd238c2d180807c57"/><file name="dineromail_ar_amex.gif" hash="4a94da8ec02c565e8cfcb66fbfffe362"/><file name="dineromail_ar_argencard.gif" hash="422ea3362cc44616f72a887f5cba66c6"/><file name="dineromail_ar_banktransfer.gif" hash="758e12e370a5b213996ea1f39259721a"/><file name="dineromail_ar_bapropago.gif" hash="df51325a4fae890a5a6673f92bb64f5d"/><file name="dineromail_ar_cabal.gif" hash="98f6cc5d54df43b4c4a17d9fc2dfb9bd"/><file name="dineromail_ar_cobroexpress.gif" hash="910960360ea1cd632a69ab500cd627ee"/><file name="dineromail_ar_dm.gif" hash="b458246e266ecb059865ab17b7673882"/><file name="dineromail_ar_italcred.gif" hash="aa4376df77748d39c670001794e7991f"/><file name="dineromail_ar_master.gif" hash="126cdc5db597363e5934cf19205f8f45"/><file name="dineromail_ar_pagofacil.gif" hash="2c85235d6dff444b1b914488d035eb7b"/><file name="dineromail_ar_rapipago.gif" hash="c745eb4d456f03c6643f40e77f9ad6ac"/><file name="dineromail_ar_tshopping.gif" hash="552daaa4621397aaed5cea3ad5fc89ec"/><file name="dineromail_ar_visa.gif" hash="61c86fd2afade160736b1c318a8280a6"/><file name="dineromail_ar_visa_hipotecario.gif" hash="bbdb3933302107611678bd7a87779a6c"/><file name="dineromail_br_amex.gif" hash="4a94da8ec02c565e8cfcb66fbfffe362"/><file name="dineromail_br_aura.gif" hash="b4a8dea00ceebb3d1d64660a997ac22d"/><file name="dineromail_br_bbancario.gif" hash="d9adffbdf626846cfe11b874c5bc0715"/><file name="dineromail_br_diners.gif" hash="b4f437b40f747842cb32becf8af28eb4"/><file name="dineromail_br_dm.gif" hash="65fa3eb604d2d5cd64b76ea0419788a6"/><file name="dineromail_br_hipercard.gif" hash="329dd978884c554fc8c0a37bd6c1ded9"/><file name="dineromail_br_master.gif" hash="126cdc5db597363e5934cf19205f8f45"/><file name="dineromail_br_oipaggo.gif" hash="9cad6e46ea39ec1d6af77ce9322835c1"/><file name="dineromail_br_visa.gif" hash="61c86fd2afade160736b1c318a8280a6"/><file name="dineromail_cl_amex.gif" hash="d4942bf6dab3c072e701e709adaecf78"/><file name="dineromail_cl_diners.gif" hash="9f5bccfc0ab73993405821859dab56b0"/><file name="dineromail_cl_dm.gif" hash="0b886856a701eff48c710a4812f999d0"/><file name="dineromail_cl_magna.gif" hash="bbbbed0d123e619dbf9ffc3308cb4f6e"/><file name="dineromail_cl_master.gif" hash="38b5c034caa6249caf49256f7df4894c"/><file name="dineromail_cl_presto.gif" hash="fa18e40e599f4216d0efea05d9329b5b"/><file name="dineromail_cl_ripley.gif" hash="8a0fe5295feeb9959f2dedf17b304215"/><file name="dineromail_cl_servipag.gif" hash="51cc675b605ce7dd88016743fc324e09"/><file name="dineromail_cl_visa.gif" hash="87fa159904723d830b30d9a0f2f2ff00"/><file name="dineromail_mx_7eleven.gif" hash="7595248bd6c735fc9cd28a0afe9e035c"/><file name="dineromail_mx_amex.gif" hash="4a94da8ec02c565e8cfcb66fbfffe362"/><file name="dineromail_mx_bancomer_tc.gif" hash="b2854f409126920b1c9cf8ed3792a349"/><file name="dineromail_mx_dm.gif" hash="9eede7e49ebcb145494952f6edb749b2"/><file name="dineromail_mx_hsbc_tb.gif" hash="1fb60730a0dfe9d0a0ebef45af1d8fdd"/><file name="dineromail_mx_ixe_tc.gif" hash="6e19e5be52b5bfce749f16b26e933c2e"/><file name="dineromail_mx_otherbank_tc.gif" hash="df05af375e248dcc04324aa92b6163b0"/><file name="dineromail_mx_oxxo.gif" hash="ee69da5b06d9c52ef76dd1a20bab5ebb"/><file name="dineromail_mx_santander_tc.gif" hash="5bb0f9600b1b8ad67d0a418c2412a506"/><file name="dineromail_mx_scotiabank_tc.gif" hash="dbe7bdd2d9327086cae42ee6a842d00c"/><file name="dineromail_small.png" hash="356e06d5a2fd5f98f3da4dfc192e389c"/><file name="dineromail_tiny.png" hash="98f6b908f7025a8babaffafcc1336428"/><file name="diners.png" hash="6310bb53fe7921cf016309d6a75b8c22"/><file name="diners_small.png" hash="ecf5d635a74460ca9575bb7d6d8550dd"/><file name="diners_small_grey.png" hash="77ff46143b8a4aab54eb35c345806a83"/><file name="diners_tiny.png" hash="881b5998d35cc373d294ca21689015d5"/><file name="directEbanking.png" hash="6d7ce2ff213c33743d80ab83fb24e8de"/><file name="directEbanking_axa.png" hash="3d90797ef39a0db23dd6373bdfef9ee8"/><file name="directEbanking_cbc.png" hash="f23617618a9e2ce7863a931947b49adb"/><file name="directEbanking_de.png" hash="9fa16b098e744e94553952c5a28c7dd2"/><file name="directEbanking_de_grey.png" hash="109b1237e5d69d7ae82dc9a64d6ab4fd"/><file name="directEbanking_de_small.png" hash="5f65ee79ae22c4ba52e6a8485cf155cd"/><file name="directEbanking_de_tiny.png" hash="15983a607b8151f0be3b5ecfb067ea7a"/><file name="directEbanking_dexia.png" hash="37ebcc9a12bc9c88d540f78adf9bd679"/><file name="directEbanking_fintro.png" hash="389b1a7b14e5466b7b0dd4721aee0433"/><file name="directEbanking_fortis.png" hash="511cc06fefa644cc7575a0efb227bd64"/><file name="directEbanking_grey.png" hash="109b1237e5d69d7ae82dc9a64d6ab4fd"/><file name="directEbanking_ing.png" hash="ac4f224d0fe9aee23d143acc5198dd72"/><file name="directEbanking_kbc.png" hash="eae3c85e332e4289841bd27a46031db3"/><file name="directEbanking_small.png" hash="db84d47793f8e375d48dc8b17f8a0ddf"/><file name="directEbanking_small_grey.png" hash="7f4fbbcfe647cf8d280238754061d042"/><file name="directEbanking_tiny.png" hash="7d804d09c7df931eb9cafc2d3a4984b1"/><file name="directdebit_BR_bancodobrasil.png" hash="784271e1bf909c95e79ff7de4d92ed5b"/><file name="directdebit_BR_bradesco.png" hash="d5ae6f8cb39883cce8c97c0d11257a4c"/><file name="directdebit_BR_caixa.png" hash="a0d69bc8a40bf120fc2138a694c31186"/><file name="directdebit_BR_hsbc.png" hash="4943f73d211b8111fd81ca8d4e06160d"/><file name="directdebit_BR_itau.png" hash="b24ed466c1d694dca7dc26ee42dbf330"/><file name="directdebit_BR_santander.png" hash="bd73ea7f9f46b0ed583e764f01e9a8d0"/><file name="directdebit_NL.png" hash="cf1246761401ad866b72d7b520506b22"/><file name="directdebit_NL_small.png" hash="2e6a7444f509232818458312f28f8c50"/><file name="directdebit_NL_tiny.png" hash="99ea09a985cf0221ce87d3696211704e"/><file name="discover.png" hash="491378a0e2ae6223ab41fc925b67575d"/><file name="discover_small.png" hash="8573aebe4938afb288749badb22aa091"/><file name="discover_small_grey.png" hash="e60b18fcd2f0509c02a08fa0bf7024b2"/><file name="discover_tiny.png" hash="78a2cb6ccedb121d3138b280e1778f84"/><file name="dotpay.png" hash="a09962a7357374482444accf6b066037"/><file name="dotpay_inteligo.png" hash="25492f3d9eaabae7aa1441fdf24947b3"/><file name="dotpay_moje.png" hash="1c948c8e2db27f09e44e4c6f3591e39c"/><file name="dotpay_mtransfer.png" hash="e9ef4a420639f227e650c9e456235059"/><file name="dotpay_multitransfer.png" hash="b604e3e946b41437bc485b0a95a76b2a"/><file name="dotpay_nordea.png" hash="cfda5216a9ae9b829e5121bbfaaf887b"/><file name="dotpay_potzta.png" hash="88670102fd0e7f532357d06ec66a8ec6"/><file name="dotpay_przelewz.png" hash="06cbe8767f3b1810e2a72b19a1bcc9c7"/><file name="dotpay_przelewz24.png" hash="64143c67feac20a193fd459ba0a6e8b4"/><file name="dotpay_small.png" hash="aabbcc9e2471e044c38ab63d8aa6d48f"/><file name="dotpay_tiny.png" hash="5c746221e7ec781c18bb4d7e6f0a66a0"/><file name="dotpay_zabka.png" hash="a6edae22b53cdd3b997f8c9b50840b2c"/><file name="ebanking_FI.png" hash="7d717c71a9174624d8e30a314c4f091e"/><file name="ebanking_FI_aktia.gif" hash="092c03a2319bd7c5d8fc9dc98516be46"/><file name="ebanking_FI_alandsbanken.png" hash="d64698c6c6dc9b6c8e1d2179dfb61d8d"/><file name="ebanking_FI_handelsbanken.png" hash="06f99903ea285bc5cf392ea6c642a267"/><file name="ebanking_FI_nordea.png" hash="c68ecd7c03b5d6a0819110c56df501e8"/><file name="ebanking_FI_osuuspankki.png" hash="cf9f495363970b9da3dbbaffe1031225"/><file name="ebanking_FI_sampo.png" hash="e5b4bd2ac745258b22ab832be253654a"/><file name="ebanking_FI_small.png" hash="57635f01d33e65d40af90d3ab4088ad7"/><file name="ebanking_FI_spankki.png" hash="e88599e1318b54be1990363607819811"/><file name="ebanking_FI_tapiola.png" hash="27ad56685d2e0e641a8d3e95942630ef"/><file name="ebanking_FI_tiny.png" hash="b0e3de2e531c362daaac6063c7a59d9e"/><file name="ebetalning.png" hash="0bc7c8cc01264df81ad06b0b75ce7c0a"/><file name="ebucks.png" hash="33d683c3a6f4f61df3c36e09d867936e"/><file name="ebucks_small.png" hash="c2afb7964e668ba7ba0416682fdd831b"/><file name="ebucks_small_tiny.png" hash="dd79fc153f0a7fcc79e628383e76ee26"/><file name="ebucks_tiny.png" hash="6085ef04ad96289d6a98e429c6d061ba"/><file name="elba.png" hash="8d2bfd3e8c0953b5d1ba80e201d25069"/><file name="elecsnet.png" hash="4a27849dfd5a8bc6771a962aff3908f4"/><file name="elo.png" hash="d8ed45be5e2a933584a58c78a5ec3568"/><file name="elo_small.png" hash="b0c3bec4e8cccf4339e142365a30fca7"/><file name="elv.png" hash="8e47d6ce919e1be80328665798d387ec"/><file name="elv_small.png" hash="a565fd570c28204b7ed0e92ebf667012"/><file name="elv_tiny.png" hash="3c9d929660d6279f255c7be9bf02ee8f"/><file name="empty.png" hash="65d7e6c42582ea986cb66ad78768b2ae"/><file name="enets.png" hash="5eae578677220e7085374936ffc2ec6a"/><file name="entertainmentcard.png" hash="df44b82c45f98790ea0e8866ecb5fee7"/><file name="entertainmentcard_small.png" hash="0466be6962e63c80c766ca4b092cded6"/><file name="entertainmentcard_small_grey.png" hash="32b0a15b2467decf84db199cd6db3bcf"/><file name="entertainmentcard_tiny.png" hash="2a7610575298bf7029bbbfad2bb86596"/><file name="forwardmobile.png" hash="023348014c3838963e48bdc8b397c387"/><file name="frame.png" hash="5e2226d7539f5d95dabe5988f4446282"/><file name="gallgall.png" hash="2e6b9f6aafaebe09112e089c05aa64ea"/><file name="gallgall_small.png" hash="24fabea2d5af04bedf9dd69e2368b943"/><file name="gallgall_small_tiny.png" hash="671cb1ce378d811cddaf77af7545d365"/><file name="gallgall_tiny.png" hash="769bf04c15a3b81f06940c237c3b3706"/><file name="giropay.png" hash="469cb654fe84b923b86b06723455ef9d"/><file name="giropay_small.png" hash="444f3a6307bb83a1d20d19e1cb8237f9"/><file name="giropay_small_grey.png" hash="565dd52d036a87d5c515c8bec4cef4f3"/><file name="giropay_tiny.png" hash="3a677e8d71ce59332e012db5bc343106"/><file name="globegcash.png" hash="580003d47ef03a6d1c7203bfc250b6d3"/><file name="globegcash_small.png" hash="cd18f17b46acb7ca15370b000f9bfa95"/><file name="globegcash_small_grey.png" hash="36e88a7a7170eb0c5ca7d3a8f2b08f13"/><file name="globegcash_tiny.png" hash="006794f78d9a43a56543a6e6b5a7ebd8"/><file name="hansabank.png" hash="b4dad91137678e09a650e1c6693e98d3"/><file name="hdfc.png" hash="b6e57b76ee8920607a2a0a809ee40d48"/><file name="hdfc_small.png" hash="1b9e555bfab7c0f11631dfecacffa637"/><file name="hdfc_small_grey.png" hash="cadac6a01cdab50cff177a1c0feb6156"/><file name="hdfc_tiny.png" hash="584260909cebec2286b6d1cd9489c7d4"/><file name="hipercard.png" hash="9310c18cee9f43c4019a7560d74ffd4c"/><file name="hipercard_small.png" hash="d4d0e1aab233b3ec3f94cbbe985fd8ad"/><file name="hppPos.png" hash="4780e785c785e93aed6ad13df323d6ef"/><file name="hyvesafrekenen.png" hash="5c8068c5b31a55f043cee6dff3246bb7"/><file name="hyvesafrekenen_small.png" hash="5a4c5747c030ac74cea799032ada3b26"/><file name="hyvesafrekenen_tiny.png" hash="2215dc356edeb426da65f43536960afe"/><file name="ideal.png" hash="6a851bfc5bac2835fd31c18c1224e8c9"/><file name="ideal_small.png" hash="8b115bda559a24a3564e02f7a90caae9"/><file name="ideal_tiny.png" hash="140c2e52427e074f95627a44db1f9f88"/><file name="img_trans.gif" hash="325472601571f31e1bf00674c368d335"/><file name="interac.png" hash="c63021e21273e83423d8af2b4c7c1728"/><file name="interac_small.png" hash="0c74bd42750252eda57b054651afca18"/><file name="interac_tiny.png" hash="1a42ba184555605ab8e2ea1a4956f21a"/><file name="ipay88.png" hash="116aa967091843ee6e8e911ff4c34b22"/><file name="ipay88_small.png" hash="1dfb38797a43657d72b0701c446a841e"/><file name="ipay88_small_grey.png" hash="418f051bc03571334cec46e122fa698f"/><file name="ipay88_tiny.png" hash="0009e8c253c57564c3688010c5192ad4"/><file name="ivr.png" hash="0ebef34ac806802b0d29c1d74f84fdbf"/><file name="ivrLandline.png" hash="0ebef34ac806802b0d29c1d74f84fdbf"/><file name="ivrLandline_small.png" hash="155f9a61db970885782db7cbe997dab4"/><file name="ivrLandline_tiny.png" hash="ecf7994d1e627023dbd47615a8ebb848"/><file name="ivrMobile.png" hash="6a16e39d5deffb8fa3234108ca97b7de"/><file name="ivrMobile_small.png" hash="a9756b756b3ea56dea07a16edcdf39a9"/><file name="ivrMobile_tiny.png" hash="8c35341f8a8f6ca16b752ff7e1bb51bf"/><file name="ivr_small.png" hash="155f9a61db970885782db7cbe997dab4"/><file name="ivr_tiny.png" hash="ecf7994d1e627023dbd47615a8ebb848"/><file name="jcb.png" hash="68303da687ac6e8615196a66f40bb6fb"/><file name="jcb_small.png" hash="f469481ddecb206cfc74478c6b58266e"/><file name="jcb_small_grey.png" hash="ddb4587396f2e7c7ad83d2aa6561cf7a"/><file name="jcb_tiny.png" hash="5d89108481655ee9dc2dbf6476bbcc14"/><file name="kadowereld.png" hash="c2eea3806e2f55ffa2f7eb3154450be5"/><file name="kadowereld_small.png" hash="203f4584e34c3f059025f3d4329b4898"/><file name="kadowereld_small_grey.png" hash="3afa5e33cd29e5c3ce1723ea10607463"/><file name="kadowereld_tiny.png" hash="b2ca2f7f504670555d332f4c5e8d3074"/><file name="klarna.png" hash="51bc6b70472fe29b728192222b88c709"/><file name="klarna_small.png" hash="57a98dc539dd5c329aac8540a3204d1e"/><file name="klarna_tiny.png" hash="fe0295e2cba0b79136e86180d7db5963"/><file name="laser.png" hash="c64699ddd372b4a48e72b8066fd2aa78"/><file name="laser_small.png" hash="abda432193ffcd5388037fa34b9e0737"/><file name="laser_small_grey.png" hash="ef7193af17ae93fa9bb5215a0ec73195"/><file name="laser_tiny.png" hash="2f87b8e37582541355e9b77008cf3853"/><file name="maestro.png" hash="e91fa85475ae74b16b92b7ac05e562c2"/><file name="maestro_small.png" hash="7814fbfff53e57643137fd68889ec807"/><file name="maestro_small_grey.png" hash="31ab5c8168e8a5b075fe1136b221d453"/><file name="maestro_tiny.png" hash="87ff6ebe1ef2e4cbae340881169065c4"/><file name="maestrouk.png" hash="cf0fcc0e1f41ad2301d5814e4a9c88c4"/><file name="maestrouk_small.png" hash="7814fbfff53e57643137fd68889ec807"/><file name="maestrouk_small_grey.png" hash="31ab5c8168e8a5b075fe1136b221d453"/><file name="maestrouk_tiny.png" hash="87ff6ebe1ef2e4cbae340881169065c4"/><file name="mc.png" hash="0d108b48ed7f8e1f0020da611e223800"/><file name="mc_small.png" hash="51ca51c64a8f0277961effeb0a0dedbb"/><file name="mc_small_grey.png" hash="0762490e5dc86277d0e411468b01a269"/><file name="mc_tiny.png" hash="814af4ec011f2f33edb7d38763dea2ea"/><file name="mercadopago.png" hash="e8cdc9cab0494fbaec13ffa7a008f0d6"/><file name="mimoney.png" hash="0f6d07a6156c6dc931636c8c618384ac"/><file name="mimoney_small.png" hash="4a8b0586fd04690de902120a463ca5b2"/><file name="mimoney_small_grey.png" hash="c85a2d63e583a8fd231713d30d484ecb"/><file name="mimoney_tiny.png" hash="0c562f6e53a95ebe2ff12747f9271a56"/><file name="moneta.png" hash="c208f24cbe664e0c9df753d1dd6b8d43"/><file name="moneybookers.png" hash="7bfc54c2a787b53f699f124d7449a169"/><file name="moneybookers_small.png" hash="1290894e479fafda67291355ea65defe"/><file name="moneybookers_tiny.png" hash="4ed8a8052e9b394e174889de6d621604"/><file name="moneymail.png" hash="73d044eac9d9f1679a653dd2e62935f3"/><file name="moneymoney.png" hash="7204b9579b665085d00b1ea2184b678f"/><file name="multibanco.png" hash="178a9292a9743e3b8904f105e7d6715b"/><file name="nedbank.png" hash="a8a2dc3af1e76262b75270a24a041331"/><file name="nedbank_small.png" hash="d386a8672bd21e53580ae32ae529ca3a"/><file name="nedbank_small_grey.png" hash="7085229e1217e47b07663764f8bb1e6e"/><file name="nedbank_tiny.png" hash="af3694515dd8b68ca71324ca20089c58"/><file name="onebip.png" hash="ca289a3c9fd8d72bce90165db98a88b9"/><file name="online_RU.png" hash="afcc9ad6292e2e21feff4af23e2fa46e"/><file name="online_RU_small.png" hash="712fa0be37857b024e3118d96da61bab"/><file name="online_RU_tiny.png" hash="0e3ac8d1ca10dff95657aa9b9ebdc13b"/><file name="online_transfer_de.png" hash="43324fb914cdbf8eff66f3668a353f1e"/><file name="openinvoice.png" hash="cd46b7d11c9dd79b1cc9c073c0696aff"/><file name="openinvoice.xcf" hash="d5f41ec9c48415f65a519c33999a1229"/><file name="openinvoice_small.png" hash="63d4c6fd1e5b214d018f3e00ca687cd5"/><file name="openinvoice_tiny.png" hash="153791c1eb5bae6095e1210787ffe4fa"/><file name="pagosonline.png" hash="04a1d0c0bb46ed7f931b3d4e248f8c0a"/><file name="pagosonline_small.png" hash="9768e52502eb299716268a212a044812"/><file name="pagosonline_small_grey.png" hash="e9f7365e885652200fdb08201e1b13cf"/><file name="pagosonline_tiny.png" hash="70d51512b8bf5215f5865b21a3ca7731"/><file name="paypal.png" hash="02362803ca1d3ab9c9e8dc3176100d66"/><file name="paypal_small.png" hash="294698dab8f5aa31f2ad62702bd9d379"/><file name="paypal_tiny.png" hash="709c47f06297455d8d55d6937245e016"/><file name="paysafecard.png" hash="20861199bb6e8781c0b10e995f1490de"/><file name="paysafecard_small.png" hash="e7452ca00265fdc91dd28a2b326355d3"/><file name="paysafecard_small_grey.png" hash="06377beb14a2666f153b273e89053419"/><file name="paysafecard_tiny.png" hash="92b3df13741ef6f71d2c12206ab3f412"/><file name="payshop.png" hash="c9c79c76313370d9165e814d3d81e062"/><file name="payu.png" hash="bc671fff056fd108fe24ba52053111b0"/><file name="payu_small.png" hash="ca3eb82cb24dd1f1bfc34436287dc9d0"/><file name="payu_small_grey.png" hash="6097711eeb2ea309d407c03a467e1653"/><file name="payu_tiny.png" hash="2b89f57174338ba3d3192eb8519ece3f"/><file name="plastix.png" hash="82d3202239d01c6bf49d8dc2399900e2"/><file name="plastix_small.png" hash="447240736bdba2d15a34986395c3fb1f"/><file name="plastix_small_grey.png" hash="7e039f412a96a0e884f86598ebfccfb1"/><file name="plastix_tiny.png" hash="aaff5ff8c33af35fe4ae64e627c0964c"/><file name="platezhru.png" hash="2f36e088146ab75470c7a55177db8c07"/><file name="platika.png" hash="03e93ab41b0d330706e2c4f85cae966a"/><file name="pm_gloss.png" hash="dcfc71b0c819e58a1287cd206cfb9d14"/><file name="poli.png" hash="4e14e9d246fdbc07ae58ed8ae639f7b0"/><file name="postoffice_ru.png" hash="8ade3cd1711071ab73248d4ba62eae64"/><file name="pps.png" hash="29f4efc8d08cfd5ba90920b1fcef6bde"/><file name="pps_small.png" hash="7bf1fa7c4adcd8dfc2b2f56eb172fcaa"/><file name="pps_small_grey.png" hash="08d6188b7f5c13ec9c5f3488b4cbf19e"/><file name="pps_tiny.png" hash="4ed68db4ca98ac69f0557319a8284c8d"/><file name="pse.png" hash="6af65a4a18af66d103473fece5536e1c"/><file name="pse_small.png" hash="1f6695131dca61647b07f7180e695c46"/><file name="pse_small_grey.png" hash="7adf2fdfc48d8b078f7c0aeaa4f50e1c"/><file name="pse_tiny.png" hash="128b2749a126cfade0300f27c6919308"/><file name="qiwi.png" hash="b5e092af3394bc333fe83d073e8a6dfd"/><file name="qiwiwallet.png" hash="623b4c7fec53864fdee6d567da5f61cc"/><file name="refresh.png" hash="69ddc65b628d15a4375e66792c07484f"/><file name="safetypay.png" hash="af4e58d22f816f148faae179d0867b3f"/><file name="safetypay_small.png" hash="26749f1a95011897c8aaf568425df3dc"/><file name="safetypay_small_grey.png" hash="e5f3e5287e3fee2d77c065063b43e17d"/><file name="safetypay_tiny.png" hash="f3700f2d3cda7834cd178ac0f70d6352"/><file name="sendEmail.png" hash="cdddfa5e77d565a0ed23b6c26e0dee09"/><file name="sendEmail_small.png" hash="b5d63cc1613f08a08194442647ee451d"/><file name="sepadirectdebit.png" hash="e565455436d808fa07499131296490de"/><file name="sm_small.png" hash="7814fbfff53e57643137fd68889ec807"/><file name="sms.png" hash="7c6c0fddee039be4d879808b374f06f5"/><file name="sms_small.png" hash="fd1d52278d2446c7fe1c34d4fc70d556"/><file name="sms_tiny.png" hash="ed22de378fdbc717f987f8d4199e0452"/><file name="solo.png" hash="13f13c36cff7835d4a46df140fe432a3"/><file name="solo_small.png" hash="96de4f5f750a415fef573ce28092bf68"/><file name="solo_small_grey.png" hash="75c9b0b2daae0d6d80a5f5ff4f14e8d6"/><file name="solo_tiny.png" hash="3e2d7a21d19b12ed84aabdb26304fae6"/><file name="switch.png" hash="8cf19bb8c744a3f852511e781c176c07"/><file name="template.xcf" hash="e5035cd9e4e96859e50c1a9773098e89"/><file name="tenpay.png" hash="ddd0b5b8e3ff63cf1bfc555fbede0242"/><file name="tenpay_small.png" hash="2aa6c5919108eec42ed5c47ad4155a8f"/><file name="tenpay_small_grey.png" hash="6a21283b21295eefb4db553f877ea4c1"/><file name="tenpay_tiny.png" hash="736275eeec39e56c3c1d29fcb9d8ebb7"/><file name="terminal_RU.png" hash="711ab27d1cbbf6771e0ee133f75c7c46"/><file name="terminal_RU_small.png" hash="9bafe5dd035f73757f553250382764c6"/><file name="terminal_RU_tiny.png" hash="1b4dce2e901d90185933420cd80648cb"/><file name="tnt_rembours.png" hash="a8abb6f51d7893da39fcc2477d7bd2bb"/><file name="tnt_rembours_small.png" hash="72ee2b0ae6742cd325bda44a14093f4c"/><file name="trustly.png" hash="2a82872cc0ada644b0442e05423a2db8"/><file name="trustpay.png" hash="88a3680bf1007661ab4fc63106aa1ff4"/><file name="uhisbank.png" hash="8c0967455a15aefe3cdfb47240a18850"/><file name="ukash.png" hash="b95eb9f2658923c38a6252f5ff9ca9c7"/><file name="ukash_small.png" hash="2210a65cd1fb85bc883d112b12c79e6e"/><file name="ukash_small_grey.png" hash="65e6cc21082ebd3c93e96bbf96499df4"/><file name="ukash_tiny.png" hash="543ab39e6dcbc094188b4f473ac4b998"/><file name="unionpay.png" hash="068dee300e2c12e58e9a47d3556e977c"/><file name="unionpay_small.png" hash="55a00c9d7bbcbe1c448b449974d85af1"/><file name="unionpay_small_grey.png" hash="5c69e46ee4663f2d0e47c7f503bbd1e4"/><file name="unionpay_tiny.png" hash="45d3b4e758237412b524a5c52418da67"/><file name="unknown.png" hash="b2d137147db4d6eb7dacb5414a4f7a30"/><file name="unknown_small.png" hash="a5234e9eb2e4485acb19b196876d762b"/><file name="vi_small.png" hash="cdab39efaf22fcd2ab88f3dc42c32de1"/><file name="vias.png" hash="aca848fa54b173225fe17637699d87c4"/><file name="vias_small.png" hash="37bee85c36b52a07a4529735a194a41e"/><file name="vias_small_grey.png" hash="4da77d558ae9488ee2a85191e9db8748"/><file name="vias_tiny.png" hash="1a45f0a2696b5539195c2fcb69be49b6"/><file name="visa-electron.png" hash="308132b89febd4979bac61594919057f"/><file name="visa-electron_small.png" hash="5ab129027f4f4acbc7a9aa2b5d0e84d3"/><file name="visa-electron_small_grey.png" hash="712b876d4f060613f54f2ec04516e512"/><file name="visa.png" hash="30f9fde31aa41197e71ccd9a63a1fe75"/><file name="visa_fr.png" hash="abd117879295333ac54497e15f81ea18"/><file name="visa_fr_small.png" hash="837db98a87141717dcd1b90bcb5ff5b1"/><file name="visa_fr_small_grey.png" hash="e8cef14608278ab71ef2ffd58e65dc9e"/><file name="visa_small.png" hash="cdab39efaf22fcd2ab88f3dc42c32de1"/><file name="visa_small_grey.png" hash="9411565a7e81c5c3cc484863dc53031a"/><file name="visa_tiny.png" hash="e374bec64dcc345848b43f0a8a3490c2"/><file name="wallet_RU.png" hash="29213300b3cf644c64d915418f259d87"/><file name="wallet_RU_small.png" hash="3308a16ce0f5b474af32505f587079b5"/><file name="wallet_RU_tiny.png" hash="c46cdb588d7a9a21a909e5af842414b5"/><file name="wallie.png" hash="fc97552b8249c3e96aa6f3cf8e3577bd"/><file name="wallie_small.png" hash="c0b60fe348b16e157eb0c64043f410c2"/><file name="wallie_tiny.png" hash="df61209a0e0517bbb3d65119d5ebfcbd"/><file name="webmoney.png" hash="3cca800e0962e0078b64361de11b935f"/><file name="webshopgiftcard.png" hash="09990fe325b20c2fcdaaa855457d5348"/><file name="wiwallet.png" hash="5db11152a23a72b2f4676841261c5db0"/><file name="wiwallet_small.png" hash="a4c5567f59ca4575a316e1bf3eb066c1"/><file name="wiwallet_small_grey.png" hash="b75b2af0b5c6129e8c1d7bc9087222b4"/><file name="wiwallet_tiny.png" hash="8b53e98458e15bc19b242d05ad678f2d"/><file name="yandexmoney.png" hash="e6a38c66b08ba78a68096f8ff1b2a41d"/><file name="yourgift.png" hash="87bd1ef190d75ec64fb66b77aaeb7b8c"/><file name="yourgift_small.png" hash="17300795f7fd31d5cb730685c2eb0098"/><file name="yourgift_small_grey.png" hash="69b235ccb6b7ef0dfb3a2645be60dbc6"/><file name="yourgift_tiny.png" hash="a3bc0b90775458ff9ef8499f7a5437ca"/></dir></dir><dir name="css"><file name="adyenstyle.css" hash="29f9866a0b5932a9784c063cfee17293"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="adyen"><dir name="payment"><file name="adyen.encrypt.js" hash="6e6d006f2ac96f33a4531d3115f2d852"/><file name="cc.js" hash="2e7a07ae072be379ae707b14771e5d0d"/><file name="elv.js" hash="db612a634c95727ec9db82c50e9aec8e"/><file name="epos-device-2.6.0.js" hash="94c73689bec45b74a311d76400f05ba6"/><file name="epos-device-3.0.0.js" hash="0056bb4902efed998d1fdcfbb7ab3495"/></dir></dir></dir></target></contents>
56
  <compatible/>
57
  <dependencies><required><php><min>5.3.3</min><max>6.0.0</max></php></required></dependencies>
58
  </package>
skin/frontend/base/default/css/adyenstyle.css CHANGED
@@ -28,32 +28,37 @@
28
 
29
  /* Adyen Customs */
30
 
31
- #co-payment-form .sp-methods dt { margin:0px 0 5px;}
32
- #co-payment-form .sp-methods dt input.radio { margin:20px 0 0 ; padding:0; }
33
- #co-payment-form .sp-methods dt label {background:none; padding:0 0 0 6px; }
34
- #co-payment-form .sp-methods dt label span { display:block; padding-top:9px;}
35
-
36
- #co-payment-form .sp-methods #payment_form_adyen_cc .v-fix label { float:none; vertical-align: middle;}
37
-
38
- .sp-methods img.adyen-payment-method-icon { margin-right: 14px; margin-left:2px; border:none !important; width:66px; height:43px; background:url(../images/adyen/pm_gloss.png) left top no-repeat; }
39
- .sp-methods img.adyen-payment-method-icon.adyen_cc { background-position: 0px -272px; }
40
- .sp-methods img.adyen-payment-method-icon.adyen_boleto { background-position: 0px -2092px; }
41
- .sp-methods img.adyen-payment-method-icon.adyen_elv {background-position: 0px -2000px; }
42
- .sp-methods img.adyen-payment-method-icon.adyen_openinvoice_afterpay_default {background-position: 0px -1637px; }
43
- .sp-methods img.adyen-payment-method-icon.adyen_openinvoice_klarna {background-position: 0px -1728px; }
44
- .sp-methods img.adyen-payment-method-icon.adyen_pos { background-position: 0px -1818px; }
45
- .sp-methods img.adyen-payment-method-icon.adyen_sepa { background-position: 0px -1910px; }
46
-
47
- .sp-methods .adyen-payment-method-icon .no-mc { background-position: left top; }
48
- #co-payment-form .sp-methods dd { clear:both; }
49
- #co-payment-form .sp-methods dd li { margin:5px 0 -10px 0px;}
 
 
 
 
 
50
 
 
51
  .sp-methods .form-list li.adyen_payment_creditcard_labels { margin-top:15px; }
52
  .adyen_payment_creditcard_labels img.grey {
53
  -webkit-filter: grayscale(100%);
54
  filter: grayscale(100%);
55
  filter: gray;
56
- filter: url("data:image/svg+xml;utf8,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' height='0'><filter id='greyscale'><feColorMatrix type='matrix' values='0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0' /></filter></svg>#greyscale");
57
  }
58
 
59
  .sp-methods .adyen_payment_input_fields { clear:both; }
@@ -62,15 +67,14 @@
62
  .sp-methods #payment_form_adyen_hpp { }
63
  .sp-methods #payment_form_adyen_hpp .input-box table { margin-bottom: 5px; }
64
  .sp-methods #payment_form_adyen_hpp .input-box table td { vertical-align: middle;}
65
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal { width: 160px; margin-top:5px; display: block; position: relative; z-index: 1; }
66
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal label.required { border: 0; padding: 0; background: none; }
67
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal label { }
68
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal table.banks { padding: 5px; border: 1px solid #bebebe; width: 175px; margin-bottom: 5px; background: #fff; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; }
69
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal table.banks label { font-weight: normal; line-height: 42px; float: none; }
70
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal table.banks td.label_hpp_ideal_type { width: 100px; }
71
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal table td input { margin-top: 15px; margin-left: 4px; /*margin-top: -38px; margin-left: 2px; position: relative; z-index: 1;*/ }
72
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal table td img { /*margin-left: -25px;*/ }
73
- .sp-methods #payment_form_adyen_hpp #payment_form_ideal .adyen_select_ideal { margin-bottom:10px;}
74
 
75
  /* for onepagecheckout */
76
  .payment-methods dd#container_payment_method_adyen_hpp { margin:0; padding:0;}
@@ -109,27 +113,27 @@
109
  height:30px;
110
  }
111
 
112
- .sp-methods #oneclick_payment_form_adyen_oneclick .creditcard-block .columns .update-expiration-date,
113
  .saved-cards .creditcard-block .creditcard-block .columns .update-expiration-date {
114
- display:inline; float:none;
115
  }
116
 
117
- .sp-methods #oneclick_payment_form_adyen_oneclick .creditcard-block label,
118
  .saved-cards .creditcard-block label {
119
  display:block;
120
  }
121
 
122
- .sp-methods #oneclick_payment_form_adyen_oneclick .creditcard-block .columns.three.b label,
123
  .creditcard-holder-name, .saved-cards .creditcard-block .columns.three.b label {
124
  width:175px;
125
  }
126
 
127
- .sp-methods #oneclick_payment_form_adyen_oneclick .creditcard-block .creditcard-holder-name,
128
  .saved-cards .creditcard-block .creditcard-holder-name {
129
  margin-top:20px;
130
  }
131
 
132
- .sp-methods #oneclick_payment_form_adyen_oneclick .creditcard-block .adyen-oneclick-installments,
133
  .saved-cards .creditcard-block .adyen-oneclick-installments {
134
  margin-top:10px;
135
  }
@@ -139,6 +143,53 @@
139
  #pos-redirect-page .logo { margin:10px 0 0 10px; width:336px; height:111px; background:url(../images/adyen/adyen_logo_large.png) left top no-repeat; }
140
  #pos-redirect-page .grey-header { background-color: #4C4C4C; width:100%; margin:10px 0;}
141
  #pos-redirect-page .grey-header h1 { padding: 16px 10px; font-family: sans-serif; font-size:24px;color:white; }
142
- #pos-redirect-page .amount-box { width:300px; height:150px; padding-top:75px; margin:50px auto; border:1px solid #797c83; color:#797c83; text-align:center; font-weight:bold; font-size:34px; background-color: #f5f5f5; box-shadow: 0 0 2px 2px #888;}
143
- #pos-redirect-page #launchlink { margin-top:10px; clear:both; display:block; color:#797C83; text-decoration:none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
28
 
29
  /* Adyen Customs */
30
 
31
+ /* Checkout Page */
32
+ #co-payment-form .sp-methods dt img {
33
+ vertical-align: middle; display:inline-block;
34
+ }
35
+ /*#co-payment-form .sp-methods dt { margin:0px 0 5px;}*/
36
+ /*#co-payment-form .sp-methods dt input.radio { margin:20px 0 0 ; padding:0; }*/
37
+ /*#co-payment-form .sp-methods dt label {background:none; padding:0 0 0 6px; }*/
38
+ /*#co-payment-form .sp-methods dt label span { display:block; padding-top:9px;}*/
39
+
40
+ /*.sp-methods #payment_form_adyen_cc .v-fix label { float:none; vertical-align: middle;}*/
41
+
42
+ .adyen-payment-method-icon { margin-right: 6px; margin-left:2px; border:none !important; width:66px; height:43px; background:url(../images/adyen/pm_gloss.png) left top no-repeat; }
43
+ .adyen-payment-method-icon.adyen_cc { background-position: 0 -272px; }
44
+ .adyen-payment-method-icon.adyen_boleto { background-position: 0 -2092px; }
45
+ .adyen-payment-method-icon.adyen_elv {background-position: 0 -2000px; }
46
+ .adyen-payment-method-icon.adyen_openinvoice_afterpay_default {background-position: 0 -1637px; }
47
+ .adyen-payment-method-icon.adyen_openinvoice_klarna {background-position: 0 -1728px; }
48
+ .adyen-payment-method-icon.adyen_pos { background-position: 0 -1818px; }
49
+ .adyen-payment-method-icon.adyen_sepa { background-position: 0 -1910px; }
50
+ .adyen-payment-method-icon.adyen_ideal { background-position: 0 -636px; }
51
+
52
+
53
+ .adyen-payment-method-icon .no-mc { background-position: left top; }
54
+
55
 
56
+ /* Credit Cards */
57
  .sp-methods .form-list li.adyen_payment_creditcard_labels { margin-top:15px; }
58
  .adyen_payment_creditcard_labels img.grey {
59
  -webkit-filter: grayscale(100%);
60
  filter: grayscale(100%);
61
  filter: gray;
 
62
  }
63
 
64
  .sp-methods .adyen_payment_input_fields { clear:both; }
67
  .sp-methods #payment_form_adyen_hpp { }
68
  .sp-methods #payment_form_adyen_hpp .input-box table { margin-bottom: 5px; }
69
  .sp-methods #payment_form_adyen_hpp .input-box table td { vertical-align: middle;}
70
+ .adyen-ideal-image-label {
71
+ display: block;
72
+ }
73
+ .adyen-ideal-image-label img {
74
+ display: inline;
75
+ vertical-align: middle;
76
+ }
77
+
 
78
 
79
  /* for onepagecheckout */
80
  .payment-methods dd#container_payment_method_adyen_hpp { margin:0; padding:0;}
113
  height:30px;
114
  }
115
 
116
+ .sp-methods .adyen_oneclick .columns .update-expiration-date,
117
  .saved-cards .creditcard-block .creditcard-block .columns .update-expiration-date {
118
+ display:inline; float:none; margin:0;
119
  }
120
 
121
+ .sp-methods .adyen_oneclick .columns label,
122
  .saved-cards .creditcard-block label {
123
  display:block;
124
  }
125
 
126
+ .sp-methods .adyen_oneclick .columns .columns.three.b label,
127
  .creditcard-holder-name, .saved-cards .creditcard-block .columns.three.b label {
128
  width:175px;
129
  }
130
 
131
+ .sp-methods .adyen_oneclick .columns .creditcard-holder-name,
132
  .saved-cards .creditcard-block .creditcard-holder-name {
133
  margin-top:20px;
134
  }
135
 
136
+ .sp-methods .adyen_oneclick .columns .adyen-oneclick-installments,
137
  .saved-cards .creditcard-block .adyen-oneclick-installments {
138
  margin-top:10px;
139
  }
143
  #pos-redirect-page .logo { margin:10px 0 0 10px; width:336px; height:111px; background:url(../images/adyen/adyen_logo_large.png) left top no-repeat; }
144
  #pos-redirect-page .grey-header { background-color: #4C4C4C; width:100%; margin:10px 0;}
145
  #pos-redirect-page .grey-header h1 { padding: 16px 10px; font-family: sans-serif; font-size:24px;color:white; }
146
+ #pos-redirect-page .amount-box { width:300px; padding-top:75px; margin:50px auto; border:1px solid #797c83; color:#797c83; text-align:center; font-weight:bold; font-size:34px; background-color: #f5f5f5; box-shadow: 0 0 2px 2px #888;}
147
+ #pos-redirect-page #launchlink { margin-top:10px; clear:both; display:block; color:#797C83; text-decoration:none;
148
+
149
+ background: #3c8a2e;
150
+ color:white;
151
+ margin:20px;
152
+ padding:30px;
153
+ overflow:hidden;
154
+
155
+ }
156
+
157
+ #pos-redirect-page #adyen-redirect-text { font-size:18px; padding-bottom:15px; display:block;}
158
+
159
+ #pos-redirect-page #launchlink:hover, #pos-redirect-page #launchlink:active { opacity: 0.9; }
160
+
161
+ .adyenExpressCheckoutBlockLeft { float:left; padding-right:10px; }
162
+ .adyenExpressCheckoutBlockLeft .input-box label { max-width:100%;}
163
+ .adyenExpressCheckoutBlockLeft .input-box .checkbox { margin-left:2px; }
164
+ #adyenEmailLoader img { display:block; margin:0 auto;}
165
+
166
+ div.adyenAutocomplete {
167
+ position:absolute;
168
+ width:250px;
169
+ background-color:white;
170
+ border:1px solid #888;
171
+ margin:0;
172
+ padding:0;
173
+ z-index:99;
174
+ text-align: left;
175
+ }
176
+ div.adyenAutocomplete ul {
177
+ list-style-type:none;
178
+ margin:0;
179
+ padding:0;
180
+ }
181
+ div.adyenAutocomplete ul li.selected { background-color: #3c8a2e; color:white;}
182
+ div.adyenAutocomplete ul li {
183
+ list-style-type:none;
184
+ display:block;
185
+ margin:0;
186
+ padding:2px;
187
+ height:32px;
188
+ cursor:pointer;
189
+ }
190
+
191
+ #AdyenAccountInfo { text-align: left; margin-top:10px; padding-left:5px;}
192
+ #AdyenAccountInfo h3 { margin-bottom:0; }
193
+ #AdyenAccountInfo .creditcard-block { margin-bottom:5px; }
194
+ #AdyenAccountInfo .AdyenSavedCards { margin-top:10px; }
195
 
skin/frontend/base/default/images/adyen/creditcard.png ADDED
Binary file
skin/frontend/base/default/images/adyen/cup.png ADDED
Binary file
skin/frontend/base/default/images/adyen/cup_small.png ADDED
Binary file
skin/frontend/base/default/images/adyen/dankort.png ADDED
Binary file
skin/frontend/base/default/images/adyen/payshop.png ADDED
Binary file
skin/frontend/base/default/images/adyen/poli.png ADDED
Binary file