Endora_PayLane2 - Version 0.1.0

Version Notes

- Add credit card payment channel
- Add PayPal payment channel
- Add iDEAL payment channel
- Add bank transfer payment channel
- Add SOFORT Banking payment channel
- Add Direct Debit payment channel
- Implement automatic notifications about payments
- Allow credit card authorization
- Add recurring payments component

Download this release

Release Info

Developer ENDORA
Extension Endora_PayLane2
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (62) hide show
  1. app/code/community/Endora/PayLane/Block/Adminhtml/Notification/Url.php +22 -0
  2. app/code/community/Endora/PayLane/Block/Customer/Account.php +17 -0
  3. app/code/community/Endora/PayLane/Block/Form.php +74 -0
  4. app/code/community/Endora/PayLane/Block/Info.php +53 -0
  5. app/code/community/Endora/PayLane/Block/Payment/BankTransfer.php +21 -0
  6. app/code/community/Endora/PayLane/Block/Payment/CreditCard.php +61 -0
  7. app/code/community/Endora/PayLane/Block/Payment/DirectDebit.php +9 -0
  8. app/code/community/Endora/PayLane/Block/Payment/Ideal.php +14 -0
  9. app/code/community/Endora/PayLane/Block/Payment/PayPal.php +9 -0
  10. app/code/community/Endora/PayLane/Block/Payment/SecureForm.php +9 -0
  11. app/code/community/Endora/PayLane/Block/Payment/Sofort.php +9 -0
  12. app/code/community/Endora/PayLane/Block/Redirect.php +24 -0
  13. app/code/community/Endora/PayLane/Helper/Data.php +288 -0
  14. app/code/community/Endora/PayLane/Helper/Notification.php +52 -0
  15. app/code/community/Endora/PayLane/Model/Api/Client.php +43 -0
  16. app/code/community/Endora/PayLane/Model/Api/Notification.php +21 -0
  17. app/code/community/Endora/PayLane/Model/Api/Payment/BankTransfer.php +69 -0
  18. app/code/community/Endora/PayLane/Model/Api/Payment/CreditCard.php +211 -0
  19. app/code/community/Endora/PayLane/Model/Api/Payment/DirectDebit.php +67 -0
  20. app/code/community/Endora/PayLane/Model/Api/Payment/Ideal.php +103 -0
  21. app/code/community/Endora/PayLane/Model/Api/Payment/PayPal.php +68 -0
  22. app/code/community/Endora/PayLane/Model/Api/Payment/SecureForm.php +42 -0
  23. app/code/community/Endora/PayLane/Model/Api/Payment/Sofort.php +42 -0
  24. app/code/community/Endora/PayLane/Model/Api/Payment/Type/Abstract.php +133 -0
  25. app/code/community/Endora/PayLane/Model/Api/Refund.php +40 -0
  26. app/code/community/Endora/PayLane/Model/Api/Resale.php +43 -0
  27. app/code/community/Endora/PayLane/Model/Interface/PaymentTypeExtendedInfo.php +24 -0
  28. app/code/community/Endora/PayLane/Model/Observer.php +118 -0
  29. app/code/community/Endora/PayLane/Model/Payment.php +378 -0
  30. app/code/community/Endora/PayLane/Model/Resource/Setup.php +8 -0
  31. app/code/community/Endora/PayLane/Model/Source/Avs/Check/Level.php +20 -0
  32. app/code/community/Endora/PayLane/Model/Source/Gateway/Type.php +18 -0
  33. app/code/community/Endora/PayLane/Model/Source/Notification/Mode.php +18 -0
  34. app/code/community/Endora/PayLane/Model/Source/Order/Status.php +39 -0
  35. app/code/community/Endora/PayLane/Model/Source/Redirect/Version.php +18 -0
  36. app/code/community/Endora/PayLane/controllers/CustomerController.php +51 -0
  37. app/code/community/Endora/PayLane/controllers/NotificationController.php +286 -0
  38. app/code/community/Endora/PayLane/controllers/PaymentController.php +187 -0
  39. app/code/community/Endora/PayLane/etc/config.xml +176 -0
  40. app/code/community/Endora/PayLane/etc/system.xml +591 -0
  41. app/code/community/Endora/PayLane/sql/paylane_setup/install-0.1.0.php +47 -0
  42. app/design/adminhtml/base/default/template/paylane/form.phtml +0 -0
  43. app/design/adminhtml/base/default/template/paylane/info.phtml +22 -0
  44. app/design/frontend/base/default/layout/paylane.xml +38 -0
  45. app/design/frontend/base/default/template/paylane/customer/account.phtml +39 -0
  46. app/design/frontend/base/default/template/paylane/empty.phtml +1 -0
  47. app/design/frontend/base/default/template/paylane/form.phtml +63 -0
  48. app/design/frontend/base/default/template/paylane/info.phtml +22 -0
  49. app/design/frontend/base/default/template/paylane/payment/banktransfer.phtml +24 -0
  50. app/design/frontend/base/default/template/paylane/payment/creditcard.phtml +62 -0
  51. app/design/frontend/base/default/template/paylane/payment/creditcard/form.phtml +45 -0
  52. app/design/frontend/base/default/template/paylane/payment/directdebit.phtml +32 -0
  53. app/design/frontend/base/default/template/paylane/payment/ideal.phtml +21 -0
  54. app/design/frontend/base/default/template/paylane/payment/paypal.phtml +1 -0
  55. app/design/frontend/base/default/template/paylane/payment/secureform.phtml +1 -0
  56. app/design/frontend/base/default/template/paylane/payment/sofort.phtml +1 -0
  57. app/design/frontend/base/default/template/paylane/redirect.phtml +12 -0
  58. app/etc/modules/Endora_PayLane.xml +9 -0
  59. app/locale/pl_PL/Endora_PayLane.csv +59 -0
  60. lib/paylane/client/paylane/PayLaneRestClient.php +591 -0
  61. package.xml +28 -0
  62. skin/frontend/base/default/paylane/style.css +36 -0
app/code/community/Endora/PayLane/Block/Adminhtml/Notification/Url.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add read-only input field with Automatic POST handler URL
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ * @link http://devzone.paylane.pl/powiadomienia-o-transakcjach/ Description of automatic transaction
7
+ */
8
+ class Endora_PayLane_Block_Adminhtml_Notification_Url extends Mage_Adminhtml_Block_System_Config_Form_Field {
9
+ /**
10
+ * Returns html part of the setting
11
+ *
12
+ * @param Varien_Data_Form_Element_Abstract $element
13
+ * @return string
14
+ */
15
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
16
+ {
17
+ $this->setElement($element);
18
+ $html = '<input type="text" value ="'. Mage::getUrl('paylane/notification/handleAuto') .'" class="input-text" readonly>';
19
+
20
+ return $html;
21
+ }
22
+ }
app/code/community/Endora/PayLane/Block/Customer/Account.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Endora_PayLane_Block_Customer_Account extends Mage_Core_Block_Template {
4
+
5
+ public function isCustomerAuthorized()
6
+ {
7
+ $customerId = Mage::getSingleton('customer/session')->getId();
8
+
9
+ $customer = Mage::getModel('customer/customer')->load($customerId);
10
+ if($customer->getCardAuthorizationId()) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
16
+
17
+ }
app/code/community/Endora/PayLane/Block/Form.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment form markup block.
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Form extends Mage_Core_Block_Template {
8
+ protected $helper;
9
+
10
+ protected function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->setTemplate('paylane/form.phtml');
14
+ $this->helper = Mage::helper('paylane');
15
+ }
16
+
17
+ /**
18
+ * Returns payment types with labels and payment type image
19
+ *
20
+ * @return array(
21
+ * paymentTypeCode => array(
22
+ * label => "Label that will be shown on checkout page. Can be translated.",
23
+ * img => Url to image file, that will be displayed instead of label
24
+ * )
25
+ * )
26
+ */
27
+ public function getPaymentMethods()
28
+ {
29
+ $classNames = $this->helper->getPaymentTypeClasses();
30
+
31
+ foreach ($classNames as $class) {
32
+ $paymentClass = Mage::getModel('paylane/api_payment_'.$class);
33
+ $result[$paymentClass->getCode()] = array(
34
+ 'label' => $paymentClass->getLabel(),
35
+ 'img' => $paymentClass->getImageUrl(),
36
+ 'recurring' => $paymentClass->isRecurringPayment()
37
+ );
38
+ }
39
+
40
+ return $result;
41
+ }
42
+
43
+ /**
44
+ * Check whether payment method is active
45
+ *
46
+ * @param string $code
47
+ * @return boolean
48
+ */
49
+ public function isPaymentMethodActive($code)
50
+ {
51
+ return Mage::getStoreConfig($this->helper->getPaymentMethodStoreConfigStringPrefix($code) . '/active');
52
+ }
53
+
54
+ /**
55
+ * Check whether recurring item is in a shopping cart
56
+ *
57
+ * @return boolean
58
+ */
59
+ public function isRecurringItemInCart()
60
+ {
61
+ $result = false;
62
+ $cartItems = Mage::getSingleton('checkout/cart')->getItems();
63
+
64
+ foreach ($cartItems as $item) {
65
+ if($item->getProduct()->getIsRecurring()){
66
+ $result = true;
67
+ break;
68
+ }
69
+ }
70
+
71
+ return $result;
72
+ }
73
+
74
+ }
app/code/community/Endora/PayLane/Block/Info.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Endora_PayLane_Block_Info extends Mage_Payment_Block_Info {
4
+
5
+ protected $result;
6
+ protected $order;
7
+ protected $payment;
8
+
9
+ public function _construct() {
10
+ parent::_construct();
11
+ $this->setTemplate('paylane/info.phtml');
12
+ }
13
+
14
+ protected function getOrder() {
15
+ if (!$this->order) {
16
+ $this->order = $this->getInfo()->getOrder();
17
+ }
18
+ return $this->order;
19
+ }
20
+
21
+ protected function getQuote() {
22
+ if (!$this->quote) {
23
+ $this->quote = $this->getInfo()->getQuote();
24
+ }
25
+ return $this->quote;
26
+ }
27
+
28
+ public function getMoreInfo() {
29
+ $order = $this->getOrder();
30
+
31
+ if ($order) {
32
+ $payment = $order->getPayment();
33
+ } else {
34
+ $quote = $this->getQuote();
35
+ $payment = $quote->getPayment();
36
+ }
37
+
38
+ $paymentType = $payment->getAdditionalInformation('paylane_payment_type');
39
+ $paymentModel = Mage::getModel('paylane/api_payment_'.$paymentType);
40
+
41
+ $result = array(
42
+ 'Payment channel' => $paymentModel->getLabel()
43
+ );
44
+
45
+ if($paymentModel instanceof Endora_PayLane_Model_Interface_PaymentTypeExtendedInfo) {
46
+ $additionalInfo = $paymentModel->getAdditionalInfo($payment);
47
+ $result = array_merge($result, $additionalInfo);
48
+ }
49
+
50
+ return $result;
51
+ }
52
+
53
+ }
app/code/community/Endora/PayLane/Block/Payment/BankTransfer.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to handle bank transfer payment type
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Payment_BankTransfer extends Mage_Core_Block_Template {
8
+
9
+ /**
10
+ * Returns list of payment types
11
+ *
12
+ * @link http://devzone.paylane.pl/opis-funkcji/#banktransfers-sale
13
+ * @return array
14
+ */
15
+ public function getPaymentTypes()
16
+ {
17
+ $result = Mage::helper('paylane')->getBankTransferPaymentTypes();
18
+ return $result;
19
+ }
20
+
21
+ }
app/code/community/Endora/PayLane/Block/Payment/CreditCard.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to handle credit card payment type
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Payment_CreditCard extends Mage_Core_Block_Template {
8
+ private $customer = null;
9
+
10
+ public function isCustomerAuthorized()
11
+ {
12
+ $customer = $this->_getCustomer();
13
+ if($customer->getCardAuthorizationId()) {
14
+ return true;
15
+ } else {
16
+ return false;
17
+ }
18
+ }
19
+
20
+ public function isCustomerFirstOrder()
21
+ {
22
+ $customer = $this->_getCustomer();
23
+ $orderAmount = Mage::getResourceModel('sales/order_collection')
24
+ ->addFieldToSelect('entity_id')
25
+ ->addFieldToFilter('customer_id', $customer->getId())
26
+ ->count();
27
+
28
+ if ($orderAmount - 1 <= 0) { // without currently processed
29
+ return true;
30
+ } else {
31
+ return false;
32
+ }
33
+ }
34
+
35
+ public function getCustomerLastOrderPaylaneSaleId()
36
+ {
37
+ $customer = $this->_getCustomer();
38
+ $order = Mage::getResourceModel('sales/order_collection')
39
+ ->addFieldToSelect('entity_id')
40
+ ->addAttributeToSelect('paylane_sale_id')
41
+ ->addFieldToFilter('customer_id', $customer->getId())
42
+ ->addFieldToFilter('paylane_sale_id', array('notnull' => true))
43
+ ->addAttributeToSort('created_at', 'DESC')
44
+ ->setCurPage(1)
45
+ ->setPageSize(1)
46
+ ->getFirstItem();
47
+
48
+ return $order->getPaylaneSaleId();
49
+ }
50
+
51
+ protected function _getCustomer()
52
+ {
53
+ if(is_null($this->customer)) {
54
+ $customerId = Mage::getSingleton('customer/session')->getId();
55
+ $this->customer = Mage::getModel('customer/customer')->load($customerId);
56
+ }
57
+
58
+ return $this->customer;
59
+ }
60
+
61
+ }
app/code/community/Endora/PayLane/Block/Payment/DirectDebit.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to handle DirectDebit payment type
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Payment_DirectDebit extends Mage_Core_Block_Template {
8
+ // created because it must be
9
+ }
app/code/community/Endora/PayLane/Block/Payment/Ideal.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to handle iDEAL payment type
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Payment_Ideal extends Mage_Core_Block_Template {
8
+
9
+ public function getBankCodes()
10
+ {
11
+ return Mage::getModel('paylane/api_payment_ideal')->getBankCodes();
12
+ }
13
+
14
+ }
app/code/community/Endora/PayLane/Block/Payment/PayPal.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to handle PayPal payment type
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Payment_PayPal extends Mage_Core_Block_Template {
8
+ // created because it must be
9
+ }
app/code/community/Endora/PayLane/Block/Payment/SecureForm.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to handle SOFORT Banking payment type
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Payment_SecureForm extends Mage_Core_Block_Template {
8
+ // created because it must be
9
+ }
app/code/community/Endora/PayLane/Block/Payment/Sofort.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to handle SOFORT Banking payment type
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Payment_Sofort extends Mage_Core_Block_Template {
8
+ // created because it must be
9
+ }
app/code/community/Endora/PayLane/Block/Redirect.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handle redirect with POST data
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Block_Redirect extends Mage_Core_Block_Template {
8
+
9
+ public function getFormHtml() {
10
+ $paymentModel = Mage::getModel('paylane/payment');
11
+
12
+ $form = new Varien_Data_Form();
13
+ $form->setAction($paymentModel->getGatewayUrl())
14
+ ->setId('paylane_checkout_secureform')
15
+ ->setName('paylane_checkout_secureform')
16
+ ->setMethod('POST')
17
+ ->setUseContainer(true);
18
+
19
+ foreach ($paymentModel->preparePostData($this->getOrder()) as $field => $value) {
20
+ $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
21
+ }
22
+ return $form->toHtml();
23
+ }
24
+ }
app/code/community/Endora/PayLane/Helper/Data.php ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Basic module helper
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Helper_Data extends Mage_Core_Helper_Data {
8
+ const XML_CONFIG_SEND_CUSTOMER_DATA = 'payment/paylane_secureform/send_customer_data';
9
+ const XML_CONFIG_MERCHANT_ID = 'payment/paylane_secureform/merchant_id';
10
+ const XML_CONFIG_HASH_SALT = 'payment/paylane_general/hash_salt';
11
+ const XML_CONFIG_GATEWAY_TYPE = 'payment/paylane/gateway_type';
12
+ const XML_CONFIG_REDIRECT_VERSION = 'payment/paylane_general/redirect_version';
13
+ const XML_CONFIG_PENDING_ORDER_STATUS = 'payment/paylane_general/pending_order_status';
14
+ const XML_CONFIG_PERFORMED_ORDER_STATUS = 'payment/paylane_general/performed_order_status';
15
+ const XML_CONFIG_CLEARED_ORDER_STATUS = 'payment/paylane_general/cleared_order_status';
16
+ const XML_CONFIG_ERROR_ORDER_STATUS = 'payment/paylane_general/error_order_status';
17
+ const XML_CONFIG_FRAUD_CHECK = 'payment/paylane_creditcard/fraud_check';
18
+ const XML_CONFIG_OVERWRITE_FRAUD_CHECK = 'payment/paylane_creditcard/fraud_check_overwrite';
19
+ const XML_CONFIG_CREDIT_CARD_AUTHORIZATION_AMOUNT = 'payment/paylane_creditcard/authorization_amount';
20
+ const XML_CONFIG_CREDIT_CARD_SINGLE_CLICK_ACTIVE = 'payment/paylane_creditcard/single_click_active';
21
+ const XML_CONFIG_AVS_CHECK_LEVEL = 'payment/paylane_creditcard/avs_check_level';
22
+ const XML_CONFIG_OVERWRITE_AVS_CHECK_LEVEL = 'payment/paylane_creditcard/avs_check_level_overwrite';
23
+ const XML_CONFIG_NOTIFICATIONS_USERNAME = 'payment/paylane_notifications/username';
24
+ const XML_CONFIG_NOTIFICATIONS_PASSWORD = 'payment/paylane_notifications/password';
25
+
26
+ const GATEWAY_TYPE_SECURE_FORM = 'secureForm';
27
+ const GATEWAY_TYPE_API = 'API';
28
+
29
+ const URL_SUCCESS_PATH = 'checkout/onepage/success';
30
+ const URL_FAILURE_PATH = 'checkout/onepage/failure';
31
+
32
+ public function isSingleClickActive()
33
+ {
34
+ return Mage::getStoreConfig(self::XML_CONFIG_CREDIT_CARD_SINGLE_CLICK_ACTIVE);
35
+ }
36
+
37
+ public function canOverwriteFraudCheck()
38
+ {
39
+ return Mage::getStoreConfig(self::XML_CONFIG_OVERWRITE_FRAUD_CHECK);
40
+ }
41
+
42
+ public function canOverwriteAvsCheckLevel()
43
+ {
44
+ return Mage::getStoreConfig(self::XML_CONFIG_OVERWRITE_AVS_CHECK_LEVEL);
45
+ }
46
+
47
+ public function getAvsCheckLevel()
48
+ {
49
+ return Mage::getStoreConfig(self::XML_CONFIG_AVS_CHECK_LEVEL); //temporarily disabled
50
+ }
51
+
52
+ public function isFraudCheck()
53
+ {
54
+ return Mage::getStoreConfig(self::XML_CONFIG_FRAUD_CHECK);
55
+ }
56
+
57
+ public function getRedirectVersion()
58
+ {
59
+ return Mage::getStoreConfig(self::XML_CONFIG_REDIRECT_VERSION);
60
+ }
61
+
62
+ public function getGatewayType()
63
+ {
64
+ return Mage::getStoreConfig(self::XML_CONFIG_GATEWAY_TYPE);
65
+ }
66
+
67
+ public function isCustomerDataEnabled()
68
+ {
69
+ return Mage::getStoreConfig(self::XML_CONFIG_SEND_CUSTOMER_DATA);
70
+ }
71
+
72
+ public function getMerchantId()
73
+ {
74
+ return Mage::getStoreConfig(self::XML_CONFIG_MERCHANT_ID);
75
+ }
76
+
77
+ public function getHashSalt($paymentMethod = null)
78
+ {
79
+ if(is_null($paymentMethod)) {
80
+ $hashSalt = Mage::getStoreConfig(self::XML_CONFIG_HASH_SALT);
81
+ } else {
82
+ $hashSalt = Mage::getStoreConfig($this->getPaymentMethodStoreConfigStringPrefix($paymentMethod).'/hash_salt');
83
+ }
84
+
85
+ return $hashSalt;
86
+ }
87
+
88
+ public function getPendingOrderStatus()
89
+ {
90
+ return Mage::getStoreConfig(self::XML_CONFIG_PENDING_ORDER_STATUS);
91
+ }
92
+
93
+ public function getPerformedOrderStatus()
94
+ {
95
+ return Mage::getStoreConfig(self::XML_CONFIG_PERFORMED_ORDER_STATUS);
96
+ }
97
+
98
+ public function getClearedOrderStatus()
99
+ {
100
+ return Mage::getStoreConfig(self::XML_CONFIG_CLEARED_ORDER_STATUS);
101
+ }
102
+
103
+ public function getErrorOrderStatus()
104
+ {
105
+ return Mage::getStoreConfig(self::XML_CONFIG_ERROR_ORDER_STATUS);
106
+ }
107
+
108
+ public function getBackUrl()
109
+ {
110
+ return Mage::getUrl('paylane/payment/secureFormResponse', array('_secure' => true));
111
+ }
112
+
113
+ public function getRedirectUrl($errors = false)
114
+ {
115
+ $redirect = self::URL_FAILURE_PATH;
116
+
117
+ if(!$errors) {
118
+ $redirect = self::URL_SUCCESS_PATH;
119
+ }
120
+
121
+ return $redirect;
122
+ }
123
+
124
+ public function getStateByStatus($status) {
125
+ $model = Mage::getResourceModel('sales/order_status_collection')
126
+ ->joinStates()
127
+ ->addFieldToFilter('main_table.status', $status)
128
+ ->getFirstItem();
129
+
130
+ return $model['state'];
131
+ }
132
+
133
+ /**
134
+ * Method that gets payment type classes. It search for payment types
135
+ * implemented in Endora/PayLane/Model/Api/Payment and return
136
+ * list of class names. It is useful for simple extending number
137
+ * of implemented payment classes without changes in other files.
138
+ *
139
+ * @return array Class names connected with payment types
140
+ */
141
+ public function getPaymentTypeClasses()
142
+ {
143
+ $paymentTypes = glob(__DIR__ . '/../Model/Api/Payment/*.php');
144
+ $classNames = array();
145
+
146
+ foreach($paymentTypes as $paymentType) {
147
+ $paymentType = str_replace(__DIR__ . '/../Model/Api/Payment/', '', $paymentType);
148
+ $paymentType = str_replace('.php', '', $paymentType);
149
+ $classNames[] = $paymentType;
150
+ }
151
+
152
+ return $classNames;
153
+ }
154
+
155
+ public function getBankTransferPaymentTypes()
156
+ {
157
+ $result = array(
158
+ 'AB' => array(
159
+ 'label' => 'Alior Bank',
160
+ 'img' => null
161
+ ),
162
+ 'AS' => array(
163
+ 'label' => 'T-Mobile Usługi Bankowe',
164
+ 'img' => null
165
+ ),
166
+ 'MU' => array(
167
+ 'label' => 'Multibank',
168
+ 'img' => null
169
+ ),
170
+ 'MT' => array(
171
+ 'label' => 'mTransfer',
172
+ 'img' => null
173
+ ),
174
+ 'IN' => array(
175
+ 'label' => 'Inteligo',
176
+ 'img' => null
177
+ ),
178
+ 'IP' => array(
179
+ 'label' => 'iPKO',
180
+ 'img' => null
181
+ ),
182
+ 'DB' => array(
183
+ 'label' => 'Deutsche Bank',
184
+ 'img' => null
185
+ ),
186
+ 'MI' => array(
187
+ 'label' => 'Millenium',
188
+ 'img' => null
189
+ ),
190
+ 'CA' => array(
191
+ 'label' => 'Credit Agricole',
192
+ 'img' => null
193
+ ),
194
+ 'PP' => array(
195
+ 'label' => 'Poczta Polska',
196
+ 'img' => null
197
+ ),
198
+ 'BP' => array(
199
+ 'label' => 'Bank BPH',
200
+ 'img' => null
201
+ ),
202
+ 'IB' => array(
203
+ 'label' => 'Idea Bank',
204
+ 'img' => null
205
+ ),
206
+ 'PO' => array(
207
+ 'label' => 'Pekao S.A.',
208
+ 'img' => null
209
+ ),
210
+ 'GB' => array(
211
+ 'label' => 'Getin Bank',
212
+ 'img' => null
213
+ ),
214
+ 'IG' => array(
215
+ 'label' => 'ING Bank Śląski',
216
+ 'img' => null
217
+ ),
218
+ 'WB' => array(
219
+ 'label' => 'Bank Zachodni WBK',
220
+ 'img' => null
221
+ ),
222
+ 'OH' => array(
223
+ 'label' => 'Other',
224
+ 'img' => null
225
+ ),
226
+ );
227
+
228
+ return $result;
229
+ }
230
+
231
+ /**
232
+ * Returns XML Config Path for appropriate Payment Method
233
+ *
234
+ * @param string $methodCode
235
+ * @return string
236
+ */
237
+ public function getPaymentMethodStoreConfigStringPrefix($methodCode)
238
+ {
239
+ return 'payment/paylane_' . strtolower($methodCode);
240
+ }
241
+
242
+ public function getNotificationsUsername()
243
+ {
244
+ return Mage::getStoreConfig(self::XML_CONFIG_NOTIFICATIONS_USERNAME);
245
+ }
246
+
247
+ public function getNotificationsPassword()
248
+ {
249
+ return Mage::getStoreConfig(self::XML_CONFIG_NOTIFICATIONS_PASSWORD);
250
+ }
251
+
252
+ public function getCreditCardAuthorizationAmount()
253
+ {
254
+ return Mage::getStoreConfig(self::XML_CONFIG_CREDIT_CARD_AUTHORIZATION_AMOUNT);
255
+ }
256
+
257
+ public function getOrderByPaylaneSaleId($saleId)
258
+ {
259
+ return Mage::getModel('sales/order')->load($saleId, 'paylane_sale_id');
260
+ }
261
+
262
+ public function generateMonthsNumber()
263
+ {
264
+ $result = array();
265
+
266
+ for($i=1;$i<=12;$i++) {
267
+ $result[$i] = sprintf("%02d", $i);
268
+ }
269
+
270
+ return $result;
271
+ }
272
+
273
+ /**
274
+ * Generate array with years list
275
+ *
276
+ * @return array List of years from current year to 100 years later
277
+ */
278
+ public function generateCreditCardValidYears()
279
+ {
280
+ $result = array();
281
+ $currYear = date("Y");
282
+ for($i = $currYear; $i < $currYear + 100; $i++) {
283
+ $result[$i] = $i;
284
+ }
285
+
286
+ return $result;
287
+ }
288
+ }
app/code/community/Endora/PayLane/Helper/Notification.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper class for API Notifications component
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Helper_Notification extends Mage_Core_Helper_Data {
8
+ const LOG_FILE_NAME = 'paylane-notifications.log';
9
+ const XML_CONFIG_LOG_ENABLED = 'payment/paylane_notifications/enable_log';
10
+ const XML_CONFIG_NOTIFICATION_MODE = 'payment/paylane_notifications/notification_mode';
11
+ const XML_CONFIG_NOTIFICATION_TOKEN = 'payment/paylane_notifications/notification_token';
12
+
13
+ const NOTIFICATION_MODE_MANUAL = 'manual';
14
+ const NOTIFICATION_MODE_AUTO = 'auto';
15
+
16
+ const NOTIFICATION_TYPE_SALE = 'S';
17
+ const NOTIFICATION_TYPE_REFUND = 'R';
18
+ const NOTIFICATION_TYPE_CHARGEBACK = 'CB';
19
+
20
+ protected $transactionTypes = array(
21
+ self::NOTIFICATION_TYPE_SALE,
22
+ self::NOTIFICATION_TYPE_REFUND,
23
+ self::NOTIFICATION_TYPE_CHARGEBACK
24
+ );
25
+
26
+ public function isLogEnabled()
27
+ {
28
+ return Mage::getStoreConfig(self::XML_CONFIG_LOG_ENABLED);
29
+ }
30
+
31
+ public function isManualMode()
32
+ {
33
+ return (Mage::getStoreConfig(self::XML_CONFIG_NOTIFICATION_MODE) == self::NOTIFICATION_MODE_MANUAL);
34
+ }
35
+
36
+ public function isAutoMode()
37
+ {
38
+ return (Mage::getStoreConfig(self::XML_CONFIG_NOTIFICATION_MODE) == self::NOTIFICATION_MODE_AUTO);
39
+ }
40
+
41
+ public function log($msg)
42
+ {
43
+ if($this->isLogEnabled()) {
44
+ Mage::log($msg, null, self::LOG_FILE_NAME);
45
+ }
46
+ }
47
+
48
+ public function getNotificationToken()
49
+ {
50
+ return Mage::getStoreConfig(self::XML_CONFIG_NOTIFICATION_TOKEN);
51
+ }
52
+ }
app/code/community/Endora/PayLane/Model/Api/Client.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API Client Adapter
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ * @see {MAGENTO_DIR}/lib/paylane/client/paylane/PayLaneRestClient.php
7
+ */
8
+ require_once Mage::getBaseDir('lib') . '/paylane/client/paylane/PayLaneRestClient.php';
9
+
10
+ class Endora_PayLane_Model_Api_Client extends PayLaneRestClient {
11
+ private $helper;
12
+
13
+ public function __construct()
14
+ {
15
+ /**
16
+ * authorization is defined in separated method "authorize()"
17
+ */
18
+ parent::__construct(null, null);
19
+ $this->helper = Mage::helper('paylane');
20
+ }
21
+
22
+ /**
23
+ * Allows to authorize in PayLane REST Client
24
+ *
25
+ * @param string $methodCodeOrUsername - In one argument variant method it is payment method code, in two argument variant method it is username
26
+ * @param string $pass - Password to PayLane Merchant Account
27
+ */
28
+ public function authorize($methodCodeOrUsername = null, $pass = null)
29
+ {
30
+ if(is_null($pass)) {
31
+ // if(is_null($methodCodeOrUsername)) {
32
+ // $this->username = $this->helper->getDefaultUsername();
33
+ // $this->password = $this->helper->getDefaultPassword();
34
+ // } else {
35
+ $this->username = Mage::getStoreConfig($this->helper->getPaymentMethodStoreConfigStringPrefix($methodCodeOrUsername).'/username');
36
+ $this->password = Mage::getStoreConfig($this->helper->getPaymentMethodStoreConfigStringPrefix($methodCodeOrUsername).'/password');
37
+ // }
38
+ } else {
39
+ $this->username = $methodCodeOrUsername;
40
+ $this->password = $pass;
41
+ }
42
+ }
43
+ }
app/code/community/Endora/PayLane/Model/Api/Notification.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API Notifications handler
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+
8
+ class Endora_PayLane_Model_Api_Notification extends Mage_Core_Model_Abstract {
9
+ protected $_client;
10
+
11
+ public function __construct()
12
+ {
13
+ $this->_client = Mage::getModel('paylane/api_client');
14
+ $this->_client->authorize('notifications');
15
+ }
16
+
17
+ public function getSaleInfo($saleId)
18
+ {
19
+ return $this->_client->getSaleInfo(array('id_sale' => $saleId));
20
+ }
21
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/BankTransfer.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for Bank transfer payment channel
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Api_Payment_BankTransfer extends Endora_PayLane_Model_Api_Payment_Type_Abstract
8
+ implements Endora_PayLane_Model_Interface_PaymentTypeExtendedInfo {
9
+ const RETURN_URL_PATH = 'paylane/payment/externalUrlResponse';
10
+
11
+ protected $_paymentTypeCode = 'bankTransfer';
12
+
13
+ public function handlePayment(Mage_Sales_Model_Order $order, $params = null) {
14
+ $data = array();
15
+ $client = $this->getClient();
16
+ $helper = Mage::helper('paylane');
17
+
18
+ $data['sale'] = $this->_prepareSaleData($order);
19
+ $data['customer'] = $this->_prepareCustomerData($order);
20
+ $data['payment_type'] = $params['payment_type'];
21
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
22
+
23
+ $payment = $order->getPayment();
24
+ $additional = $payment->getAdditionalInformation();
25
+ $additional['paylane_payment_bank'] = $params['payment_type'];
26
+ $payment->setAdditionalInformation($additional);
27
+ $payment->save();
28
+
29
+ $result = $client->bankTransferSale($data);
30
+
31
+ //probably should be in externalUrlResponseAction
32
+ if($result['success']) {
33
+ header('Location: ' . $result['redirect_url']);
34
+ die;
35
+ } else {
36
+ $orderStatus = $helper->getErrorOrderStatus();
37
+ $errorCode = '';
38
+ $errorText = '';
39
+ if(!empty($result['error'])) {
40
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
41
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
42
+ }
43
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
44
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
45
+ $order->save();
46
+ }
47
+
48
+ return $result['success'];
49
+ }
50
+
51
+ /**
52
+ * Method that allows to use additional info in order summary in admin panel
53
+ *
54
+ * @see Endora_PayLane_Block_Info
55
+ * @see design/adminhtml/base/default/template/paylane/info.phtml
56
+ */
57
+ public function getAdditionalInfo($payment = null)
58
+ {
59
+ $result = array();
60
+ $paymentBank = $payment->getAdditionalInformation('paylane_payment_bank');
61
+
62
+ if($paymentBank) {
63
+ $paymentBanks = Mage::helper('paylane')->getBankTransferPaymentTypes();
64
+ $result['Chosen bank'] = $paymentBanks[$paymentBank]['label'];
65
+ }
66
+
67
+ return $result;
68
+ }
69
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/CreditCard.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for Credit card payment channel
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Api_Payment_CreditCard extends Endora_PayLane_Model_Api_Payment_Type_Abstract {
8
+
9
+ protected $_paymentTypeCode = 'creditCard';
10
+ protected $_isRecurringPayment = true;
11
+
12
+ /**
13
+ * Method to handle payment process
14
+ *
15
+ * @param Mage_Sales_Model_Order $order
16
+ * @return boolean Success flag
17
+ */
18
+ public function handlePayment(Mage_Sales_Model_Order $order, $paymentParams = null)
19
+ {
20
+ $helper = Mage::helper('paylane');
21
+ $data = array();
22
+ $client = $this->getClient();
23
+
24
+ if(!empty($paymentParams['authorization_id']) || !empty($paymentParams['sale_id'])) { //using single-click way
25
+ $result = $this->_handleSingleClickPayment($order, $paymentParams);
26
+ } else {
27
+ $data['sale'] = $this->_prepareSaleData($order);
28
+ $data['customer'] = $this->_prepareCustomerData($order);
29
+ $data['card'] = $paymentParams;
30
+
31
+ $result = $client->cardSale($data);
32
+ }
33
+
34
+ if($result['success']) {
35
+ $orderStatus = $helper->getPerformedOrderStatus();
36
+ $comment = $helper->__('Payment handled via PayLane module | Transaction ID: %s', $result['id_sale']);
37
+ $order->setPaylaneSaleId($result['id_sale']);
38
+ } else {
39
+ $orderStatus = $helper->getErrorOrderStatus();
40
+ $errorCode = '';
41
+ $errorText = '';
42
+ if(!empty($result['error'])) {
43
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
44
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
45
+ }
46
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
47
+ }
48
+
49
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
50
+ $order->save();
51
+
52
+ return $result['success'];
53
+ }
54
+
55
+ /**
56
+ * Method to handle recurring payment process
57
+ *
58
+ * @param Mage_Payment_Model_Recurring_Profile $profile
59
+ * @param array $params
60
+ * @return boolean Success flag
61
+ */
62
+ public function handleRecurringPayment(Mage_Payment_Model_Recurring_Profile $profile, $params = null)
63
+ {
64
+ $data = array();
65
+ $client = $this->getClient();
66
+
67
+ $data['sale'] = $this->_prepareRecurringSaleData($profile);
68
+ $data['customer'] = $this->_prepareRecurringCustomerData($profile);
69
+ $data['card'] = $params;
70
+
71
+ $result = $client->cardSale($data);
72
+
73
+ return $result;
74
+ }
75
+
76
+ public function handleCardAuthorization($customerId, $params)
77
+ {
78
+ $helper = Mage::helper('paylane');
79
+ $data = array();
80
+ $client = $this->getClient();
81
+ $customer = Mage::getModel('customer/customer')->load($customerId);
82
+
83
+ $data['sale'] = array(
84
+ 'amount' => sprintf('%01.2f', $helper->getCreditCardAuthorizationAmount()),
85
+ 'currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
86
+ 'description' => 'Credit card authorization for customer with ID ' . $customerId
87
+ );
88
+ $data['customer'] = $this->_prepareCustomerDataForAuthorization($customer);
89
+ $data['card'] = $params;
90
+
91
+ $result = $client->cardAuthorization($data);
92
+
93
+ if($result['success']) {
94
+ $customer->setCardAuthorizationId($result['id_authorization']);
95
+ $customer->save();
96
+ return true;
97
+ } else {
98
+ return false;
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Prepares order data for API request
104
+ *
105
+ * @param Mage_Sales_Model_Order $order
106
+ * @return array Array of order data
107
+ */
108
+ protected function _prepareSaleData($order)
109
+ {
110
+ $helper = Mage::helper('paylane');
111
+ $result = array();
112
+ $result['amount'] = sprintf('%01.2f', $order->getGrandTotal());
113
+ $result['currency'] = $order->getOrderCurrencyCode();
114
+ $result['description'] = $order->getIncrementId();
115
+ if($helper->canOverwriteFraudCheck()) {
116
+ $result['fraud_check_on'] = $helper->isFraudCheck();
117
+ }
118
+ if($helper->canOverwriteAvsCheckLevel()) {
119
+ $result['avs_check_level'] = $helper->getAvsCheckLevel();
120
+ }
121
+
122
+ return $result;
123
+ }
124
+
125
+ /**
126
+ * Prepares sale data for recurring payment
127
+ *
128
+ * @param Mage_Payment_Model_Recurring_Profile $profile
129
+ * @return type
130
+ */
131
+ protected function _prepareRecurringSaleData(Mage_Payment_Model_Recurring_Profile $profile)
132
+ {
133
+ $helper = Mage::helper('paylane');
134
+ $result = array();
135
+ $result['amount'] = sprintf('%01.2f', $profile->getBillingAmount());
136
+ $result['currency'] = $profile->getCurrencyCode();
137
+ $result['description'] = $profile->getScheduleDescription();
138
+ if($helper->canOverwriteFraudCheck()) {
139
+ $result['fraud_check_on'] = $helper->isFraudCheck();
140
+ }
141
+ if($helper->canOverwriteAvsCheckLevel()) {
142
+ $result['avs_check_level'] = $helper->getAvsCheckLevel();
143
+ }
144
+
145
+ return $result;
146
+ }
147
+
148
+ /**
149
+ * Prepares customer data from $customer for API request
150
+ * to authorize card
151
+ *
152
+ * @param Mage_Customer_Model_Customer $customer
153
+ * @return array Array of customer data
154
+ */
155
+ protected function _prepareCustomerDataForAuthorization($customer)
156
+ {
157
+ $result = array();
158
+ $address = $customer->getDefaultBilling();
159
+ if ($address){
160
+ $address = Mage::getModel('customer/address')->load($address);
161
+ }
162
+
163
+ $result['name'] = $customer->getName();
164
+ $result['email'] = $customer->getEmail();
165
+ $result['ip'] = Mage::helper('core/http')->getRemoteAddr();
166
+ $result['address'] = array(
167
+ 'city' => $address->getCity(),
168
+ 'state' => $address->getRegion(),
169
+ 'country_code' => $address->getCountry(),
170
+ 'zip' => $address->getPostcode(),
171
+ 'street_house' => $address->getStreet(true)
172
+ );
173
+
174
+ return $result;
175
+ }
176
+
177
+ /**
178
+ * Handle payment in single-click type
179
+ *
180
+ * @link http://devzone.paylane.pl/api/karty/platnosci-single-click/ Single-click payment explanation
181
+ *
182
+ * @param type $order
183
+ * @param type $paymentParams
184
+ * @return type
185
+ */
186
+ protected function _handleSingleClickPayment($order, $paymentParams = null)
187
+ {
188
+ $data = array();
189
+ $client = $this->getClient();
190
+
191
+ if(!empty($paymentParams['sale_id'])) {
192
+ $data['id_sale'] = $paymentParams['sale_id'];
193
+ }
194
+ if(!empty($paymentParams['authorization_id'])) {
195
+ $data['id_authorization'] = $paymentParams['authorization_id'];
196
+ }
197
+
198
+ $data['amount'] = sprintf('%01.2f', $order->getGrandTotal());
199
+ $data['currency'] = $order->getOrderCurrencyCode();
200
+ $data['description'] = $order->getIncrementId();
201
+
202
+ if(!empty($paymentParams['sale_id'])) {
203
+ $result = $client->resaleBySale($data);
204
+ }
205
+ if(!empty($paymentParams['authorization_id'])) {
206
+ $result = $client->resaleByAuthorization($data);
207
+ }
208
+
209
+ return $result;
210
+ }
211
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/DirectDebit.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for Direct Debit payment channel
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Api_Payment_DirectDebit extends Endora_PayLane_Model_Api_Payment_Type_Abstract {
8
+ const RETURN_URL_PATH = 'paylane/payment/externalUrlResponse';
9
+
10
+ protected $_paymentTypeCode = 'directDebit';
11
+ protected $_isRecurringPayment = true;
12
+
13
+ public function handlePayment(Mage_Sales_Model_Order $order, $params = null) {
14
+ $data = array();
15
+ $client = $this->getClient();
16
+ $helper = Mage::helper('paylane');
17
+
18
+ $data['sale'] = $this->_prepareSaleData($order);
19
+ $data['customer'] = $this->_prepareCustomerData($order);
20
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
21
+ $data['account'] = $params;
22
+
23
+ $result = $client->directDebitSale($data);
24
+
25
+ if($result['success']) {
26
+ $orderStatus = $helper->getPerformedOrderStatus();
27
+ $comment = $helper->__('Payment handled via PayLane module | Transaction ID: %s', $result['id_sale']);
28
+ $order->setPaylaneSaleId($result['id_sale']);
29
+ } else {
30
+ $orderStatus = $helper->getErrorOrderStatus();
31
+ $errorCode = '';
32
+ $errorText = '';
33
+ if(!empty($result['error'])) {
34
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
35
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
36
+ }
37
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
38
+ }
39
+
40
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
41
+ $order->save();
42
+
43
+ return $result['success'];
44
+ }
45
+
46
+ /**
47
+ * Method to handle recurring payment process
48
+ *
49
+ * @param Mage_Payment_Model_Recurring_Profile $profile
50
+ * @param array $params
51
+ * @return boolean Success flag
52
+ */
53
+ public function handleRecurringPayment(Mage_Payment_Model_Recurring_Profile $profile, $params = null)
54
+ {
55
+ $data = array();
56
+ $client = $this->getClient();
57
+
58
+ $data['sale'] = $this->_prepareRecurringSaleData($profile);
59
+ $data['customer'] = $this->_prepareRecurringCustomerData($profile);
60
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
61
+ $data['account'] = $params;
62
+
63
+ $result = $client->directDebitSale($data);
64
+
65
+ return $result;
66
+ }
67
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/Ideal.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for iDEAL Banking payment channel
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Api_Payment_Ideal extends Endora_PayLane_Model_Api_Payment_Type_Abstract
8
+ implements Endora_PayLane_Model_Interface_PaymentTypeExtendedInfo {
9
+ const RETURN_URL_PATH = 'paylane/payment/externalUrlResponse';
10
+
11
+ protected $_paymentTypeCode = 'ideal';
12
+
13
+ public function handlePayment(Mage_Sales_Model_Order $order, $params = null) {
14
+ $data = array();
15
+ $client = $this->getClient();
16
+ $helper = Mage::helper('paylane');
17
+
18
+ $data['sale'] = $this->_prepareSaleData($order);
19
+ $data['customer'] = $this->_prepareCustomerData($order);
20
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
21
+ $data['bank_code'] = $params['bank_code'];
22
+
23
+ $payment = $order->getPayment();
24
+ $additional = $payment->getAdditionalInformation();
25
+ $additional['paylane_payment_bank'] = $params['bank_code'];
26
+ $payment->setAdditionalInformation($additional);
27
+ $payment->save();
28
+
29
+ $result = $client->idealSale($data);
30
+
31
+ //probably should be in externalUrlResponseAction
32
+ if($result['success']) {
33
+ header('Location: ' . $result['redirect_url']);
34
+ die;
35
+ } else {
36
+ $orderStatus = $helper->getErrorOrderStatus();
37
+ $errorCode = '';
38
+ $errorText = '';
39
+ if(!empty($result['error'])) {
40
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
41
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
42
+ }
43
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
44
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
45
+ $order->save();
46
+ }
47
+
48
+ return $result['success'];
49
+ }
50
+
51
+ /**
52
+ * Fetch list of iDEAL bank codes
53
+ *
54
+ * @return boolean
55
+ */
56
+ public function getBankCodes()
57
+ {
58
+ try {
59
+ $client = $this->getClient();
60
+ $result = $client->idealBankCodes();
61
+ } catch (Exception $e) {
62
+ return false;
63
+ }
64
+
65
+ /**
66
+ * @todo Better error handling
67
+ */
68
+ if (!$client->isSuccess()) {
69
+ $error_number = $result['error']['error_number'];
70
+ $error_description = $result['error']['error_description'];
71
+ return false;
72
+ }
73
+
74
+ return $result['data'];
75
+ }
76
+
77
+ /**
78
+ * Method that allows to use additional info in order summary in admin panel
79
+ *
80
+ * @see Endora_PayLane_Block_Info
81
+ * @see design/adminhtml/base/default/template/paylane/info.phtml
82
+ */
83
+ public function getAdditionalInfo($payment = null)
84
+ {
85
+ $result = array();
86
+ $paymentBank = $payment->getAdditionalInformation('paylane_payment_bank');
87
+ $bankCodes = $this->getBankCodes();
88
+ $label = 'Unknown';
89
+
90
+ if($paymentBank) {
91
+ foreach($bankCodes as $bank) {
92
+ if($bank['bank_code'] == $paymentBank) {
93
+ $label = $bank['bank_name'];
94
+ break;
95
+ }
96
+ }
97
+
98
+ $result['Chosen bank'] = $label;
99
+ }
100
+
101
+ return $result;
102
+ }
103
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/PayPal.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for PayPal payment channel
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Api_Payment_PayPal extends Endora_PayLane_Model_Api_Payment_Type_Abstract {
8
+ const RETURN_URL_PATH = 'paylane/payment/externalUrlResponse';
9
+
10
+ protected $_paymentTypeCode = 'payPal';
11
+ protected $_isRecurringPayment = true;
12
+
13
+ public function handlePayment(Mage_Sales_Model_Order $order, $params = null) {
14
+ $data = array();
15
+ $client = $this->getClient();
16
+ $helper = Mage::helper('paylane');
17
+
18
+ $data['sale'] = $this->_prepareSaleData($order);
19
+ if(!empty($params['redirect_url'])) {
20
+ $data['back_url'] = $params['redirect_url'];
21
+ } else {
22
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
23
+ }
24
+
25
+ $result = $client->paypalSale($data);
26
+
27
+ //probably should be in externalUrlResponseAction
28
+ if($result['success']) {
29
+ header('Location: ' . $result['redirect_url']);
30
+ die;
31
+ } else {
32
+ $orderStatus = $helper->getErrorOrderStatus();
33
+ $errorCode = '';
34
+ $errorText = '';
35
+ if(!empty($result['error'])) {
36
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
37
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
38
+ }
39
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
40
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
41
+ $order->save();
42
+ }
43
+
44
+ return $result['success'];
45
+ }
46
+
47
+ /**
48
+ * Method to handle recurring payment process
49
+ *
50
+ * @param Mage_Payment_Model_Recurring_Profile $profile
51
+ * @param array $params
52
+ * @return boolean Success flag
53
+ */
54
+ public function handleRecurringPayment(Mage_Payment_Model_Recurring_Profile $profile, $params = null)
55
+ {
56
+ $data = array();
57
+ $client = $this->getClient();
58
+
59
+ $data['sale'] = $this->_prepareRecurringSaleData($profile);
60
+ $data['customer'] = $this->_prepareRecurringCustomerData($profile);
61
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
62
+ $data['account'] = $params;
63
+
64
+ $result = $client->paypalSale($data);
65
+
66
+ return $result;
67
+ }
68
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/SecureForm.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for SecureForm payment channel
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Api_Payment_SecureForm extends Endora_PayLane_Model_Api_Payment_Type_Abstract {
8
+ const RETURN_URL_PATH = 'paylane/payment/externalUrlResponse';
9
+
10
+ protected $_paymentTypeCode = 'secureForm';
11
+
12
+ public function handlePayment(Mage_Sales_Model_Order $order, $params = null) {
13
+ $data = array();
14
+ $client = $this->getClient();
15
+ $helper = Mage::helper('paylane');
16
+
17
+ $data['sale'] = $this->_prepareSaleData($order);
18
+ $data['customer'] = $this->_prepareCustomerData($order);
19
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
20
+
21
+ $result = $client->sofortSale($data);
22
+
23
+ //probably should be in externalUrlResponseAction
24
+ if($result['success']) {
25
+ header('Location: ' . $result['redirect_url']);
26
+ die;
27
+ } else {
28
+ $orderStatus = $helper->getErrorOrderStatus();
29
+ $errorCode = '';
30
+ $errorText = '';
31
+ if(!empty($result['error'])) {
32
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
33
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
34
+ }
35
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
36
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
37
+ $order->save();
38
+ }
39
+
40
+ return $result['success'];
41
+ }
42
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/Sofort.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for SOFORT Banking payment channel
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Api_Payment_Sofort extends Endora_PayLane_Model_Api_Payment_Type_Abstract {
8
+ const RETURN_URL_PATH = 'paylane/payment/externalUrlResponse';
9
+
10
+ protected $_paymentTypeCode = 'sofort';
11
+
12
+ public function handlePayment(Mage_Sales_Model_Order $order, $params = null) {
13
+ $data = array();
14
+ $client = $this->getClient();
15
+ $helper = Mage::helper('paylane');
16
+
17
+ $data['sale'] = $this->_prepareSaleData($order);
18
+ $data['customer'] = $this->_prepareCustomerData($order);
19
+ $data['back_url'] = Mage::getUrl(self::RETURN_URL_PATH, array('_secure' => true));
20
+
21
+ $result = $client->sofortSale($data);
22
+
23
+ //probably should be in externalUrlResponseAction
24
+ if($result['success']) {
25
+ header('Location: ' . $result['redirect_url']);
26
+ die;
27
+ } else {
28
+ $orderStatus = $helper->getErrorOrderStatus();
29
+ $errorCode = '';
30
+ $errorText = '';
31
+ if(!empty($result['error'])) {
32
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
33
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
34
+ }
35
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
36
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
37
+ $order->save();
38
+ }
39
+
40
+ return $result['success'];
41
+ }
42
+ }
app/code/community/Endora/PayLane/Model/Api/Payment/Type/Abstract.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Abstract class that handles basic function of API payment model
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ abstract class Endora_PayLane_Model_Api_Payment_Type_Abstract extends Mage_Core_Model_Abstract {
8
+ protected $_paymentTypeCode = 'paymentType';
9
+ protected $_isRecurringPayment = false;
10
+ protected $_paymentImgUrl = null;
11
+ protected $_client;
12
+
13
+ public function __construct() {
14
+ $this->_client = Mage::getSingleton('paylane/api_client');
15
+ $this->_client->authorize($this->_paymentTypeCode);
16
+ }
17
+
18
+ abstract public function handlePayment(Mage_Sales_Model_Order $order, $additionalParameters = null);
19
+
20
+ public function getCode()
21
+ {
22
+ return $this->_paymentTypeCode;
23
+ }
24
+
25
+ public function getStoreConfigStringPrefix()
26
+ {
27
+ return Mage::helper('paylane')->getPaymentMethodStoreConfigStringPrefix($this->_paymentTypeCode);
28
+ }
29
+
30
+ public function getLabel()
31
+ {
32
+ return Mage::getStoreConfig($this->getStoreConfigStringPrefix() . '/title');
33
+ }
34
+
35
+ public function getImageUrl()
36
+ {
37
+ return $this->_paymentImgUrl;
38
+ }
39
+
40
+ public function getClient()
41
+ {
42
+ return $this->_client;
43
+ }
44
+
45
+ public function isRecurringPayment()
46
+ {
47
+ return $this->_isRecurringPayment;
48
+ }
49
+
50
+ /**
51
+ * Prepares order data for API request
52
+ *
53
+ * @param Mage_Sales_Model_Order $order
54
+ * @return array Array of order data
55
+ */
56
+ protected function _prepareSaleData($order)
57
+ {
58
+ $result = array();
59
+ $result['amount'] = sprintf('%01.2f', $order->getGrandTotal());
60
+ $result['currency'] = $order->getOrderCurrencyCode();
61
+ $result['description'] = $order->getIncrementId();
62
+
63
+ return $result;
64
+ }
65
+
66
+ /**
67
+ * Prepares customer data from order for API request
68
+ *
69
+ * @param Mage_Sales_Model_Order $order
70
+ * @return array Array of order data
71
+ */
72
+ protected function _prepareCustomerData($order)
73
+ {
74
+ $result = array();
75
+
76
+ $address = $order->getBillingAddress();
77
+ $result['name'] = $order->getCustomerName();
78
+ $result['email'] = $address->getEmail();
79
+ $result['ip'] = $order->getRemoteIp();
80
+ $result['address'] = array(
81
+ 'city' => $address->getCity(),
82
+ 'state' => $address->getRegion(),
83
+ 'country_code' => $address->getCountry(),
84
+ 'zip' => $address->getPostcode(),
85
+ 'street_house' => $address->getStreet(true)
86
+ );
87
+
88
+ return $result;
89
+ }
90
+
91
+ /**
92
+ * Prepares sale data for recurring payment
93
+ *
94
+ * @param Mage_Payment_Model_Recurring_Profile $profile
95
+ * @return type
96
+ */
97
+ protected function _prepareRecurringSaleData(Mage_Payment_Model_Recurring_Profile $profile)
98
+ {
99
+ $result = array();
100
+ $result['amount'] = sprintf('%01.2f', $profile->getBillingAmount());
101
+ $result['currency'] = $profile->getCurrencyCode();
102
+ $result['description'] = $profile->getScheduleDescription();
103
+
104
+ return $result;
105
+ }
106
+
107
+ /**
108
+ * Prepares customer data from recurring profile for API request
109
+ * Used in recurring payments
110
+ *
111
+ * @param Mage_Payment_Model_Recurring_Profile $profile
112
+ * @return array Array of order data
113
+ */
114
+ protected function _prepareRecurringCustomerData(Mage_Payment_Model_Recurring_Profile $profile)
115
+ {
116
+ $result = array();
117
+ $order = $profile->getOrderInfo();
118
+ $address = $profile->getBillingAddressInfo();
119
+
120
+ $result['name'] = $order['customer_firstname'] . ' ' . $order['customer_lastname'];
121
+ $result['email'] = $order['customer_email'];
122
+ $result['ip'] = $order['remote_ip'];
123
+ $result['address'] = array(
124
+ 'city' => $address['city'],
125
+ 'state' => $address['region'],
126
+ 'country_code' => $address['country_id'],
127
+ 'zip' => $address['postcode'],
128
+ 'street_house' => $address['street']
129
+ );
130
+
131
+ return $result;
132
+ }
133
+ }
app/code/community/Endora/PayLane/Model/Api/Refund.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API Resales handler
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+
8
+ class Endora_PayLane_Model_Api_Refund extends Mage_Core_Model_Abstract {
9
+ protected $_client;
10
+
11
+ public function __construct()
12
+ {
13
+ $this->_client = Mage::getModel('paylane/api_client');
14
+ }
15
+
16
+ public function refund(Mage_Sales_Model_Order $order, $amount, $reason = null)
17
+ {
18
+ $saleId = $order->getPaylaneSaleId();
19
+ $paymentCode = strtolower($order->getPayment()->getAdditionalInformation('paylane_payment_type'));
20
+
21
+ if(is_null($saleId)) {
22
+ return false;
23
+ }
24
+
25
+ if(is_null($reason)) {
26
+ $reason = 'Refund for order #' . $order->getIncrementId();
27
+ }
28
+
29
+ $refundParams = array(
30
+ 'id_sale' => $saleId,
31
+ 'amount' => $amount,
32
+ 'reason' => $reason,
33
+ );
34
+
35
+ $this->_client->authorize($paymentCode);
36
+ $result = $this->_client->refund($refundParams);
37
+
38
+ return $result;
39
+ }
40
+ }
app/code/community/Endora/PayLane/Model/Api/Resale.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API Resales handler
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+
8
+ class Endora_PayLane_Model_Api_Resale extends Mage_Core_Model_Abstract {
9
+ protected $_client;
10
+
11
+ public function __construct()
12
+ {
13
+ $this->_client = Mage::getModel('paylane/api_client');
14
+ $this->_client->authorize('notifications');
15
+ }
16
+
17
+ public function resaleBySaleId($saleId, Mage_Sales_Model_Order $order)
18
+ {
19
+ $saleArray = array('id_sale' => $saleId);
20
+ return $this->_resale($saleArray, $order);
21
+ }
22
+
23
+ public function resaleByAuthorization($authorizationId, Mage_Sales_Model_Order $order)
24
+ {
25
+ $authorizationArray = array('id_authorization' => $authorizationId);
26
+ return $this->_resale($authorizationArray, $order);
27
+ }
28
+
29
+ protected function _resale($transactionArray, Mage_Sales_Model_Order $order)
30
+ {
31
+ $resaleParams = array(
32
+ 'amount' => sprintf('%01.2f', $order->getGrandTotal()),
33
+ 'currency' => $order->getOrderCurrencyCode(),
34
+ 'description' => 'Recurring sale for order #' . $order->getIncrementId(),
35
+ );
36
+
37
+ $resaleParams = array_merge($resaleParams, $transactionArray);
38
+
39
+ $result = $this->_client->resaleBySale($resaleParams);
40
+
41
+ return $this->_client->isSuccess();
42
+ }
43
+ }
app/code/community/Endora/PayLane/Model/Interface/PaymentTypeExtendedInfo.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Interface to handle additional payment type extended info
4
+ *
5
+ * If you want to show additional data in order summary connected with your payment type
6
+ * then you have to implement that interface
7
+ *
8
+ * For example @see Endora_PayLane_Model_Api_Payment_Ideal
9
+ *
10
+ * @see Endora_PayLane_Block_Info
11
+ * @see design/adminhtml/base/default/template/paylane/info.phtml
12
+ *
13
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
14
+ */
15
+ interface Endora_PayLane_Model_Interface_PaymentTypeExtendedInfo {
16
+
17
+ /**
18
+ * Allows to prepare additional info about payment $payment
19
+ *
20
+ * @param type Mage_Payment_Model_Method_Abstract $payment
21
+ */
22
+ public function getAdditionalInfo($payment = null);
23
+
24
+ }
app/code/community/Endora/PayLane/Model/Observer.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Observer model
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Observer {
8
+
9
+ /**
10
+ * Setting payment type parameters to be used in
11
+ * payment type model
12
+ *
13
+ * @param type $observer
14
+ */
15
+ public function preparePaymentTypeFormData($observer)
16
+ {
17
+ $data = Mage::app()->getRequest()->getParams();
18
+ if(!empty($data['payment_params'])) {
19
+ Mage::getSingleton('checkout/session')->setData('payment_params', $data['payment_params']);
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Cron job method that charge recurring profiles according
25
+ * to their settings
26
+ *
27
+ * @param Mage_Cron_Model_Schedule $schedule
28
+ */
29
+ public function handleRecurringProfileCron(Mage_Cron_Model_Schedule $schedule)
30
+ {
31
+ $resourceModel = Mage::getSingleton('core/resource');
32
+ $tableName = $resourceModel->getTableName('sales_recurring_profile');
33
+
34
+ $query = 'SELECT
35
+ CASE rpt.period_unit
36
+ WHEN "day" THEN FLOOR(DATEDIFF(NOW(), rpt.updated_at) / rpt.period_frequency)
37
+ WHEN "week" THEN FLOOR(FLOOR(DATEDIFF(NOW(), rpt.updated_at) / 7) / rpt.period_frequency)
38
+ WHEN "semi_month" THEN FLOOR(FLOOR(DATEDIFF(NOW(), rpt.updated_at) / 14) / rpt.period_frequency)
39
+ WHEN "month" THEN FLOOR(PERIOD_DIFF(DATE_FORMAT(NOW(), "%Y%m"), DATE_FORMAT(rpt.updated_at, "%Y%m")) - (DATE_FORMAT(NOW(), "%d") < DATE_FORMAT(rpt.updated_at, "%d")) / rpt.period_frequency)
40
+ WHEN "year" THEN FLOOR(YEAR(NOW()) - YEAR(rpt.updated_at) - (DATE_FORMAT(NOW(), "%m%d") < DATE_FORMAT(rpt.updated_at, "%m%d")) / rpt.period_frequency)
41
+ END
42
+ AS billing_count,
43
+ rpt.*
44
+ FROM '.$tableName.' AS rpt
45
+ WHERE
46
+ rpt.state = "'.Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE.'" AND
47
+ rpt.updated_at <= NOW() AND
48
+ rpt.start_datetime <= NOW() AND
49
+ rpt.method_code = "paylane" AND
50
+ NOW() >= CASE rpt.period_unit
51
+ WHEN "day" THEN DATE_ADD(rpt.updated_at, INTERVAL rpt.period_frequency DAY)
52
+ WHEN "week" THEN DATE_ADD(rpt.updated_at, INTERVAL rpt.period_frequency WEEK)
53
+ WHEN "semi_month" THEN DATE_ADD(rpt.updated_at, INTERVAL (rpt.period_frequency * 2) WEEK)
54
+ WHEN "month" THEN DATE_ADD(rpt.updated_at, INTERVAL rpt.period_frequency MONTH)
55
+ WHEN "year" THEN DATE_ADD(rpt.updated_at, INTERVAL rpt.period_frequency YEAR)
56
+ END';
57
+
58
+ $connection = $resourceModel->getConnection('core_read');
59
+ $queryResult = $connection->fetchAll($query);
60
+
61
+ foreach ($queryResult as $profileData) {
62
+ $profile = Mage::getModel('sales/recurring_profile')->addData($profileData);
63
+ $billingCounter = count($profile->getResource()->getChildOrderIds($profile));
64
+
65
+ if ($profile->getInitAmount()) {
66
+ $billingCounter--;
67
+ }
68
+
69
+ if ($profile->getBillFailedLater()){
70
+ $billingCounter = $this->_multiChargeRecurringProfile($profile, $billingCounter);
71
+ } else {
72
+ $billingCounter = $this->_singleChargeRecurringProfile($profile, $billingCounter);
73
+ }
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Doing multiple charges to recurring profile
79
+ *
80
+ * @param Mage_Sales_Model_Recurring_Profile $profile
81
+ * @param type $billingCounter
82
+ * @return integer Number of charged orders
83
+ */
84
+ protected function _multiChargeRecurringProfile(Mage_Sales_Model_Recurring_Profile $profile, $billingCounter)
85
+ {
86
+ for ($i = 0; $i < $profile->getBillingCount(); $i++){
87
+ $billingCounter = $this->_singleChargeRecurringProfile($profile, $billingCounter);
88
+
89
+ if ($billingCounter >= $profile->getPeriodMaxCycles()){
90
+ break;
91
+ }
92
+ }
93
+
94
+ return $billingCounter;
95
+ }
96
+
97
+ /**
98
+ * Doing single charge to recurring profile
99
+ *
100
+ * @param Mage_Sales_Model_Recurring_Profile $profile
101
+ * @param type $billingCounter
102
+ * @return integer Number of charged orders
103
+ */
104
+ protected function _singleChargeRecurringProfile(Mage_Sales_Model_Recurring_Profile $profile, $billingCounter)
105
+ {
106
+ $paymentModel = Mage::getModel('paylane/payment');
107
+
108
+ if ($paymentModel->chargeRecurringProfile($profile)) {
109
+ $billingCounter++;
110
+ }
111
+
112
+ if ($billingCounter >= $profile->getPeriodMaxCycles()) {
113
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED);
114
+ }
115
+
116
+ return $billingCounter;
117
+ }
118
+ }
app/code/community/Endora/PayLane/Model/Payment.php ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment model for PayLane payment method
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Payment extends Mage_Payment_Model_Method_Abstract
8
+ implements Mage_Payment_Model_Recurring_Profile_MethodInterface {
9
+ const TRANSACTION_TYPE_SALE = 'S';
10
+ const TRANSACTON_TYPE_AUTHORIZATION = 'A';
11
+ const SECURE_FORM_DEFAULT_LANGUAGE = 'en';
12
+ const SECURE_FORM_GATEWAY_URL = 'https://secure.paylane.com/order/cart.html';
13
+
14
+ /**
15
+ * @see http://devzone.paylane.pl/secure-form/realizacja/
16
+ */
17
+ const PAYMENT_STATUS_PENDING = 'PENDING';
18
+ const PAYMENT_STATUS_PERFORMED = 'PERFORMED';
19
+ const PAYMENT_STATUS_CLEARED = 'CLEARED';
20
+ const PAYMENT_STATUS_ERROR = 'ERROR';
21
+
22
+ protected $secureFormAllowedLanguages = array('pl', 'en', 'de', 'es', 'fr', 'nl');
23
+
24
+ protected $_code = 'paylane';
25
+ protected $_formBlockType = 'paylane/form';
26
+ protected $_infoBlockType = 'paylane/info';
27
+
28
+ /**
29
+ * Updated payment Method features
30
+ *
31
+ * @var bool
32
+ * @see Mage_Payment_Model_Method_Abstract
33
+ */
34
+ protected $_isGateway = false;
35
+ protected $_canOrder = false;
36
+ protected $_canAuthorize = false;
37
+ protected $_canCapture = true;
38
+ protected $_canCapturePartial = false;
39
+ protected $_canCaptureOnce = false;
40
+ protected $_canRefund = true;
41
+ protected $_canRefundInvoicePartial = true;
42
+ protected $_canVoid = false;
43
+ protected $_canUseInternal = true;
44
+ protected $_canUseCheckout = true;
45
+ protected $_canUseForMultishipping = false;
46
+ protected $_isInitializeNeeded = false;
47
+ protected $_canFetchTransactionInfo = true;
48
+ protected $_canReviewPayment = true;
49
+ protected $_canCreateBillingAgreement = false;
50
+ protected $_canManageRecurringProfiles = true;
51
+
52
+ /**
53
+ * Return Order place redirect url
54
+ *
55
+ * @return string
56
+ */
57
+ public function getOrderPlaceRedirectUrl()
58
+ {
59
+ //when you click on place order you will be redirected on this url, if you don't want this action remove this method
60
+ return Mage::getUrl('paylane/payment/redirect', array('_secure' => true));
61
+ }
62
+
63
+ public function getSecureFormLanguage($langCode)
64
+ {
65
+ return in_array($langCode, $this->secureFormAllowedLanguages) ? $langCode : self::SECURE_FORM_DEFAULT_LANGUAGE;
66
+ }
67
+
68
+ public function getGatewayUrl()
69
+ {
70
+ return self::SECURE_FORM_GATEWAY_URL;
71
+ }
72
+
73
+ /**
74
+ * Calculating verification hash - used only in SecureForm
75
+ *
76
+ * @param type $description
77
+ * @param type $amount
78
+ * @param type $currency
79
+ * @param type $transactionType
80
+ * @return type
81
+ */
82
+ public function calculateHash($description, $amount, $currency, $transactionType)
83
+ {
84
+ $secureForm = Mage::getModel('paylane/api_payment_secureForm');
85
+ $salt = Mage::helper('paylane')->getHashSalt($secureForm->getCode());
86
+ $hash = sha1($salt . '|' . $description . '|' . $amount . '|' . $currency . '|' . $transactionType);
87
+
88
+ return $hash;
89
+ }
90
+
91
+ public function getTransactionId($params)
92
+ {
93
+ $id = null;
94
+
95
+ if(!empty($params['id_sale'])) {
96
+ $id = $params['id_sale'];
97
+ } else if (!empty($params['id_authorization'])) {
98
+ $id = $params['id_authorization'];
99
+ }
100
+
101
+ return $id;
102
+ }
103
+
104
+ public function verifyResponseHash($params, $paymentType = null)
105
+ {
106
+ $id = $this->getTransactionId($params);
107
+ $salt = Mage::helper('paylane')->getHashSalt($paymentType);
108
+
109
+ $calculatedHash = sha1($salt . '|' . $params['status'] . '|' . $params['description'] . '|' . $params['amount'] . '|' . $params['currency'] . '|' . $id);
110
+
111
+ return ($calculatedHash == $params['hash']);
112
+ }
113
+
114
+ public function preparePostData($order)
115
+ {
116
+ $helper = Mage::helper('paylane');
117
+ /**
118
+ * collect data for PayLane request
119
+ *
120
+ * @see http://devzone.paylane.pl/secure-form/realizacja/
121
+ */
122
+ $postData = array();
123
+ $postData['merchant_id'] = $helper->getMerchantId();
124
+ $postData['description'] = $order->getIncrementId();
125
+ $postData['transaction_description'] = $this->_buildTransactionDescription($order);
126
+ $postData['amount'] = sprintf('%01.2f', $order->getGrandTotal());
127
+ $postData['currency'] = $order->getOrderCurrencyCode();
128
+ $postData['transaction_type'] = Endora_PayLane_Model_Payment::TRANSACTION_TYPE_SALE;
129
+ $postData['back_url'] = $helper->getBackUrl();
130
+ $postData['hash'] = $this->calculateHash($postData['description'], $postData['amount'], $postData['currency'], $postData['transaction_type']);
131
+ $postData['language'] = $this->getSecureFormLanguage(substr(Mage::app()->getLocale()->getLocaleCode(), 0 , 2));
132
+
133
+ if ($helper->isCustomerDataEnabled()) {
134
+ $address = $order->getBillingAddress();
135
+ $postData['customer_name'] = $order->getCustomerName();
136
+ $postData['customer_email'] = $address->getEmail();
137
+ $postData['customer_address'] = $address->getStreet(true);
138
+ $postData['customer_zip'] = $address->getPostcode();
139
+ $postData['customer_city'] = $address->getCity();
140
+ $postData['customer_state'] = $address->getRegion();
141
+ $postData['customer_country'] = $address->getCountry();
142
+ }
143
+
144
+ return $postData;
145
+ }
146
+
147
+ protected function _buildTransactionDescription($order)
148
+ {
149
+ $resultString = Mage::helper('paylane')->__('Order #%s, %s (%s)', $order->getIncrementId(), $order->getCustomerName(), $order->getCustomerEmail());
150
+
151
+ return $resultString;
152
+ }
153
+
154
+ public function capture(Varien_Object $payment, $amount) {
155
+ $paylaneId = $payment->getOrder()->getPaylaneSaleId();
156
+
157
+ if(!$paylaneId) { // in case when paylane sale id is not yet set
158
+ $paylaneId = rand();
159
+ }
160
+
161
+ $payment->setTransactionId($paylaneId);
162
+ $payment->setParentTransactionId($payment->getTransactionId());
163
+ $transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, null, true, "");
164
+ $transaction->setIsClosed(true);
165
+ $payment->setIsTransactionClosed(1);
166
+
167
+ return $this;
168
+ }
169
+
170
+ public function processBeforeRefund($invoice, $payment)
171
+ {
172
+ return parent::processBeforeRefund($invoice, $payment);
173
+ }
174
+
175
+ public function refund(Varien_Object $payment, $amount)
176
+ {
177
+ $helper = Mage::helper('paylane');
178
+ $refundModel = Mage::getModel('paylane/api_refund');
179
+ $order = $payment->getOrder();
180
+
181
+ $result = $refundModel->refund($order, $amount);
182
+
183
+ if($result['success']) {
184
+ $order->addStatusHistoryComment($helper->__('Refund was handled via PayLane module | Refund ID: %s', $result['id_refund']));
185
+ $order->save();
186
+ } else {
187
+ $errorMsg = $helper->__('Error Processing the request | PayLane module refund process failed');
188
+ Mage::throwException($errorMsg);
189
+ }
190
+
191
+ return $this;
192
+ }
193
+
194
+ public function processCreditmemo($creditmemo, $payment)
195
+ {
196
+ return parent::processCreditmemo($creditmemo, $payment);
197
+ }
198
+
199
+ /**
200
+ * Submit to the gateway
201
+ *
202
+ * @param Mage_Payment_Model_Recurring_Profile $profile
203
+ * @param Mage_Payment_Model_Info $payment
204
+ */
205
+ public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $payment)
206
+ {
207
+ $paymentType = $payment->getAdditionalInformation('paylane_payment_type');
208
+ $paymentParams = Mage::getSingleton('checkout/session')->getData('payment_params');
209
+ Mage::getSingleton('checkout/session')->unsetData('payment_params');
210
+ $paymentParams['redirect_url'] = Mage::getUrl('paylane/payment/recurringProfileResponse', array('_secure' => true));
211
+ $apiPayment = Mage::getModel('paylane/api_payment_' . $paymentType);
212
+ $result = $apiPayment->handleRecurringPayment($profile, $paymentParams);
213
+
214
+ if($result['success']) {
215
+ $profile->setReferenceId( $result['id_sale'] );
216
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
217
+ $payment->setSkipTransactionCreation(true);
218
+
219
+ if ((float)$profile->getInitAmount()){
220
+ $orderItem = new Varien_Object;
221
+ $orderItem->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_INITIAL);
222
+ $orderItem->setPrice($profile->getInitAmount());
223
+
224
+ $order = $profile->createOrder($orderItem);
225
+ $transactionId = 'paylane-trans-' . uniqid();
226
+ $payment = $order->getPayment();
227
+ $payment->setTransactionId($transactionId)->setIsTransactionClosed(1);
228
+ $order->save();
229
+
230
+ $profile->addOrderRelation($order->getId());
231
+ $order->save();
232
+ $payment->save();
233
+
234
+ $this->_createOrderTransaction($transactionId, $order, $payment);
235
+ }
236
+ }
237
+
238
+ return $this;
239
+ }
240
+
241
+ /**
242
+ * Handle charging for recurring profile
243
+ *
244
+ * @param Mage_Payment_Model_Recurring_Profile $profile
245
+ * @return boolean
246
+ */
247
+ public function chargeRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile){
248
+
249
+ $client = Mage::getModel('paylane/api_client');
250
+ $client->authorize('notifications');
251
+ $params = array(
252
+ 'id_sale' => $profile->getReferenceId(),
253
+ 'amount' => $profile->getBillingAmount(),
254
+ 'currency' => $profile->getCurrencyCode(),
255
+ 'description' => 'Recuring payment for Sale ID ' . $profile->getReferenceId()
256
+ );
257
+ $result = $client->resaleBySale($params);
258
+
259
+ if ($result['success']){
260
+ $orderItem = new Varien_Object;
261
+ $orderItem->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR);
262
+ $orderItem->setPrice( $profile->getTaxAmount() + $profile->getBillingAmount() + $profile->getShippingAmount() );
263
+
264
+ $order = $profile->createOrder($orderItem);
265
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW);
266
+ $transactionId = 'paylane-trans-' . uniqid();
267
+ $payment = $order->getPayment();
268
+ $payment->setTransactionId($transactionId)->setIsTransactionClosed(1);
269
+ $order->save();
270
+
271
+ $profile->addOrderRelation($order->getId());
272
+ $payment->save();
273
+
274
+ $this->_createOrderTransaction($transactionId, $order, $payment);
275
+ $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
276
+ $this->_setNextPeriodDate($profile->getId());
277
+
278
+ return true;
279
+
280
+ }
281
+
282
+ return false;
283
+ }
284
+
285
+ /**
286
+ * Manage status
287
+ *
288
+ * @param Mage_Payment_Model_Recurring_Profile $profile
289
+ */
290
+ public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
291
+ {
292
+ return $this;
293
+ }
294
+
295
+ /**
296
+ * Validate data
297
+ *
298
+ * @param Mage_Payment_Model_Recurring_Profile $profile
299
+ * @throws Mage_Core_Exception
300
+ */
301
+ public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
302
+ {
303
+ return $this;
304
+ }
305
+
306
+ /**
307
+ * Fetch details
308
+ *
309
+ * @param string $referenceId
310
+ * @param Varien_Object $result
311
+ */
312
+ public function getRecurringProfileDetails($referenceId, Varien_Object $result)
313
+ {
314
+ return $this;
315
+ }
316
+
317
+ /**
318
+ * Check whether can get recurring profile details
319
+ *
320
+ * @return bool
321
+ */
322
+ public function canGetRecurringProfileDetails()
323
+ {
324
+ return true;
325
+ }
326
+
327
+ /**
328
+ * Update data
329
+ *
330
+ * @param Mage_Payment_Model_Recurring_Profile $profile
331
+ */
332
+ public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
333
+ {
334
+ return $this;
335
+ }
336
+
337
+ protected function _setNextPeriodDate($profileId){
338
+ $resourceModel = Mage::getSingleton('core/resource');
339
+ $tableName = $resourceModel->getTableName('sales_recurring_profile');
340
+
341
+ $sql = 'UPDATE '.$tableName.'
342
+ SET updated_at = CASE period_unit
343
+ WHEN "day" THEN DATE_ADD(updated_at, INTERVAL period_frequency DAY)
344
+ WHEN "week" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*7) DAY)
345
+ WHEN "semi_month" THEN DATE_ADD(updated_at, INTERVAL (period_frequency*14) DAY)
346
+ WHEN "month" THEN DATE_ADD(updated_at, INTERVAL period_frequency MONTH)
347
+ WHEN "year" THEN DATE_ADD(updated_at, INTERVAL period_frequency YEAR)
348
+ END
349
+ WHERE profile_id = :profileId';
350
+
351
+ $connection = $resourceModel->getConnection('core_write');
352
+ $statement = $connection->prepare($sql);
353
+ $statement->bindValue(':profileId', $profileId);
354
+ return $statement->execute();
355
+ }
356
+
357
+ /**
358
+ * Create transaction for order from recurring profile
359
+ *
360
+ * @param string $transactionId
361
+ * @param Mage_Sales_Model_Order $order
362
+ * @param Mage_Payment_Model_Info $payment
363
+ * @return string|NULL Returns created transaction ID or NULL if transaction doesn't exist
364
+ */
365
+ protected function _createOrderTransaction($transactionId, Mage_Sales_Model_Order $order, Mage_Payment_Model_Info $payment)
366
+ {
367
+ $txn= Mage::getModel('sales/order_payment_transaction');
368
+ $txn->setTxnId($transactionId);
369
+ $txn->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
370
+ $txn->setPaymentId($payment->getId());
371
+ $txn->setOrderId($order->getId());
372
+ $txn->setOrderPaymentObject($payment);
373
+ $txn->setIsClosed(1);
374
+ $txn->save();
375
+
376
+ return $txn->getTxnId();
377
+ }
378
+ }
app/code/community/Endora/PayLane/Model/Resource/Setup.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup resource class for setup scripts
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Resource_Setup extends Mage_Sales_Model_Resource_Setup {
8
+ }
app/code/community/Endora/PayLane/Model/Source/Avs/Check/Level.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Source model for allowed AVS check levels
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Source_Avs_Check_Level {
8
+
9
+ public function toOptionArray()
10
+ {
11
+ return array(
12
+ array('value' => 0, 'label' => '0'),
13
+ array('value' => 1, 'label' => '1'),
14
+ array('value' => 2, 'label' => '2'),
15
+ array('value' => 3, 'label' => '3'),
16
+ array('value' => 4, 'label' => '4'),
17
+ );
18
+ }
19
+
20
+ }
app/code/community/Endora/PayLane/Model/Source/Gateway/Type.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Source model for allowed gateway types
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Source_Gateway_Type {
8
+
9
+ public function toOptionArray()
10
+ {
11
+ $helper = Mage::helper('paylane');
12
+ return array(
13
+ array('value' => 'SecureForm', 'label' => $helper->__('SecureForm')),
14
+ array('value' => 'API', 'label' => $helper->__('API')),
15
+ );
16
+ }
17
+
18
+ }
app/code/community/Endora/PayLane/Model/Source/Notification/Mode.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Option array for
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Source_Notification_Mode {
8
+
9
+ public function toOptionArray()
10
+ {
11
+ $helper = Mage::helper('paylane');
12
+ return array(
13
+ array('value' => Endora_PayLane_Helper_Notification::NOTIFICATION_MODE_MANUAL, 'label' => $helper->__('Manual')),
14
+ array('value' => Endora_PayLane_Helper_Notification::NOTIFICATION_MODE_AUTO, 'label' => $helper->__('Automatic')),
15
+ );
16
+ }
17
+
18
+ }
app/code/community/Endora/PayLane/Model/Source/Order/Status.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Order Statuses source model
4
+ */
5
+ class Endora_PayLane_Model_Source_Order_Status
6
+ {
7
+ // set null to enable all possible
8
+ protected $_stateStatuses = array(
9
+ Mage_Sales_Model_Order::STATE_NEW,
10
+ Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
11
+ Mage_Sales_Model_Order::STATE_PROCESSING,
12
+ // Mage_Sales_Model_Order::STATE_COMPLETE,
13
+ Mage_Sales_Model_Order::STATE_CLOSED,
14
+ Mage_Sales_Model_Order::STATE_CANCELED,
15
+ Mage_Sales_Model_Order::STATE_HOLDED,
16
+ );
17
+
18
+ public function toOptionArray()
19
+ {
20
+ if ($this->_stateStatuses) {
21
+ $statuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->_stateStatuses);
22
+ }
23
+ else {
24
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
25
+ }
26
+ $options = array();
27
+ $options[] = array(
28
+ 'value' => '',
29
+ 'label' => Mage::helper('adminhtml')->__('-- Please Select --')
30
+ );
31
+ foreach ($statuses as $code=>$label) {
32
+ $options[] = array(
33
+ 'value' => $code,
34
+ 'label' => $label
35
+ );
36
+ }
37
+ return $options;
38
+ }
39
+ }
app/code/community/Endora/PayLane/Model/Source/Redirect/Version.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Source model for allowed redirect version
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_Model_Source_Redirect_Version {
8
+
9
+ public function toOptionArray()
10
+ {
11
+ $helper = Mage::helper('paylane');
12
+ return array(
13
+ array('value' => 'GET', 'label' => $helper->__('GET')),
14
+ array('value' => 'POST', 'label' => $helper->__('POST')),
15
+ );
16
+ }
17
+
18
+ }
app/code/community/Endora/PayLane/controllers/CustomerController.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Controller to handle settings in customer "My Account" page
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_CustomerController extends Mage_Core_Controller_Front_Action {
8
+
9
+ public function indexAction()
10
+ {
11
+ $this->loadLayout();
12
+ $this->renderLayout();
13
+ }
14
+
15
+ public function authorizeCreditCardAction()
16
+ {
17
+ $params = $this->getRequest()->getParams();
18
+ $helper = Mage::helper('paylane');
19
+ $customerId = Mage::getSingleton('customer/session')->getId();
20
+ $creditCardModel = Mage::getModel('paylane/api_payment_creditCard');
21
+ $result = $creditCardModel->handleCardAuthorization($customerId, $params['payment_params']);
22
+ $session = Mage::getSingleton('core/session');
23
+
24
+ if($result) {
25
+ $session->addSuccess($helper->__('Authorization ends successfully'));
26
+ } else {
27
+ $session->addError($helper->__('An error occurs in authorization process - please try again later'));
28
+ }
29
+
30
+ $this->_redirect('paylane/customer/index');
31
+ }
32
+
33
+ public function unauthorizeCreditCardAction()
34
+ {
35
+ $customerId = Mage::getSingleton('customer/session')->getId();
36
+ $session = Mage::getSingleton('core/session');
37
+ $helper = Mage::helper('paylane');
38
+
39
+ try {
40
+ $customer = Mage::getModel('customer/customer')->load($customerId);
41
+ $customer->setCardAuthorizationId(null);
42
+ $customer->save();
43
+ $session->addSuccess($helper->__('Unauthorization process ends successfully'));
44
+ } catch(Exception $e) {
45
+ $session->addError($helper->__('An error occurs in unauthorization process - please try again later'));
46
+ }
47
+
48
+ $this->_redirect('paylane/customer/index');
49
+ }
50
+
51
+ }
app/code/community/Endora/PayLane/controllers/NotificationController.php ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Controller to handle notification sent from PayLane
4
+ *
5
+ * @link http://devzone.paylane.pl/powiadomienia-o-transakcjach/
6
+ *
7
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
8
+ */
9
+ class Endora_PayLane_NotificationController extends Mage_Core_Controller_Front_Action {
10
+
11
+ public function handleManualAction()
12
+ {
13
+ if(Mage::helper('paylane/notification')->isManualMode()) {
14
+ $helper = Mage::helper('paylane');
15
+ $this->_log('--- START HANDLING NOTIFICATIONS PROCESS - MANUAL MODE ---');
16
+ $notification = Mage::getModel('paylane/api_notification');
17
+ $this->_log('Preparing order collection...');
18
+ $orders = $this->_prepareOrderCollection();
19
+ $this->_log('Order collection prepared');
20
+
21
+ foreach($orders as $order) {
22
+ $this->_log('Handle order #' . $order->getIncrementId());
23
+ $saleId = $order->getPaylaneSaleId();
24
+ $this->_log('Paylane Sale ID: ' . $saleId);
25
+ if(!is_null($saleId)) {
26
+ $result = $notification->getSaleInfo($saleId);
27
+ if($result['success'] && $saleId == $result['id_sale']) {
28
+ if($result['status'] == Endora_PayLane_Model_Payment::PAYMENT_STATUS_PERFORMED
29
+ && $order->getStatus() != $helper->getPerformedOrderStatus()) {
30
+ $orderStatus = $helper->getPerformedOrderStatus();
31
+ $comment = $helper->__('Order status changed via PayLane module');
32
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
33
+ $order->save();
34
+ $this->_log('Changed order status to: ' . $orderStatus . ', ('.Endora_PayLane_Model_Payment::PAYMENT_STATUS_PERFORMED.' in PayLane)');
35
+ } else if($result['status'] == Endora_PayLane_Model_Payment::PAYMENT_STATUS_CLEARED
36
+ && $order->getStatus() != $helper->getClearedOrderStatus()) {
37
+ $orderStatus = $helper->getClearedOrderStatus();
38
+ $comment = $helper->__('Order status changed via PayLane module');
39
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
40
+ $order->save();
41
+ $this->_log('Changed order status to: ' . $orderStatus . ', ('.Endora_PayLane_Model_Payment::PAYMENT_STATUS_CLEARED.' in PayLane)');
42
+ } else {
43
+ $this->_log('No changes needed');
44
+ }
45
+ }
46
+ } else {
47
+ $this->_log('Paylane Sale ID is NULL, skip order');
48
+ }
49
+ }
50
+ $this->_log('--- STOP HANDLING NOTIFICATIONS PROCESS - MANUAL MODE ---');
51
+ echo '--- HANDLING NOTIFICATIONS PROCESS COMPLETE - MANUAL MODE ---';
52
+ } else {
53
+ die('--- NOTIFICATIONS PROCESS IN MANUAL MODE IS DISABLED ---');
54
+ }
55
+ }
56
+
57
+ public function handleAutoAction()
58
+ {
59
+ $notificationHelper = Mage::helper('paylane/notification');
60
+ $notificationModel = Mage::getModel('paylane/api_notification'); //needed to initialize $_SERVER variables
61
+ $helper = Mage::helper('paylane');
62
+
63
+ if($notificationHelper->isAutoMode()) {
64
+ if(!empty($helper->getNotificationsUsername()) && !empty($helper->getNotificationsPassword())) {
65
+ if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
66
+ $this->_failAuthorization();
67
+ }
68
+
69
+ if($helper->getNotificationsUsername() != $_SERVER['PHP_AUTH_USER'] ||
70
+ $helper->getNotificationsPassword() != $_SERVER['PHP_AUTH_PW']) {
71
+ $this->_failAuthorization();
72
+ }
73
+ }
74
+
75
+ $this->_log('--- START HANDLING NOTIFICATIONS PROCESS - AUTO MODE ---');
76
+ $params = $this->getRequest()->getParams();
77
+
78
+ $this->_log($params);
79
+
80
+ if (empty($params['communication_id'])) {
81
+ $msg = 'Empty communication id';
82
+ $this->_log($msg);
83
+ die($msg);
84
+ }
85
+
86
+ if (!empty($params['token']) && ($notificationHelper->getNotificationToken() !== $params['token'])) {
87
+ $msg = 'Wrong token';
88
+ $this->_log($msg);
89
+ die($msg);
90
+ }
91
+
92
+ $messages = $params['content'];
93
+
94
+ $this->_handleAutoMessages($messages);
95
+
96
+ $this->_log('--- STOP HANDLING NOTIFICATIONS PROCESS - AUTO MODE ---');
97
+ $this->_log($params['communication_id']);
98
+ die($params['communication_id']);
99
+ } else {
100
+ $msg = '--- NOTIFICATIONS PROCESS IN AUTO MODE IS DISABLED ---';
101
+ $this->_log($msg);
102
+ die($msg);
103
+ }
104
+ }
105
+
106
+ protected function _failAuthorization()
107
+ {
108
+ // authentication failed
109
+ header("WWW-Authenticate: Basic realm=\"Secure Area\"");
110
+ header("HTTP/1.0 401 Unauthorized");
111
+ exit();
112
+ }
113
+
114
+ protected function _log($msg)
115
+ {
116
+ Mage::helper('paylane/notification')->log($msg);
117
+ }
118
+
119
+ protected function _prepareOrderCollection()
120
+ {
121
+ $paymentCode = Mage::getModel('paylane/payment')->getCode();
122
+ $orders = Mage::getModel('sales/order')->getCollection()
123
+ ->join(
124
+ array('payment' => 'sales/order_payment'),
125
+ 'main_table.entity_id=payment.parent_id',
126
+ array('payment.method' => 'payment.method')
127
+ );
128
+ $orders->addFieldToFilter('payment.method', array('eq' => $paymentCode))
129
+ ->setOrder('increment_id','DESC');
130
+
131
+ return $orders;
132
+ }
133
+
134
+ protected function _handleAutoMessages($messages)
135
+ {
136
+ $helper = Mage::helper('paylane');
137
+ foreach($messages as $message) {
138
+ if(empty($message['text'])) {
139
+ $this->_log('Message without Magento increment ID - skip');
140
+ continue;
141
+ }
142
+
143
+ $this->_log('Handle message for PayLane Sale ID ' . $message['id_sale'] . ', order #' . $message['text']);
144
+ //$order = $helper->getOrderByPaylaneSaleId($message['id_sale']);
145
+ $order = Mage::getModel('sales/order')->load($message['text'], 'increment_id');
146
+ $this->_log('Fetch order #' . $order->getIncrementId());
147
+
148
+ if(!empty($order)) {
149
+ switch($message['type']) {
150
+ case Endora_PayLane_Helper_Notification::NOTIFICATION_TYPE_SALE :
151
+ $orderStatus = $helper->getClearedOrderStatus();
152
+ $comment = $helper->__('Order status changed via PayLane module');
153
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
154
+ $order->save();
155
+ $this->_log('Changed order status to: ' . $orderStatus . ', ('.Endora_PayLane_Model_Payment::PAYMENT_STATUS_CLEARED.' in PayLane)');
156
+ break;
157
+
158
+ case Endora_PayLane_Helper_Notification::NOTIFICATION_TYPE_REFUND :
159
+ try { //do offline refund because it is already done on the PayLane side
160
+ $data = array(
161
+ 'do_offline' => 1,
162
+ 'shipping_amount' => 0,
163
+ 'adjustment_positive' => $message['amount'],
164
+ 'adjustment_negative' => 0
165
+ );
166
+ $this->_handleRefund($order, $data);
167
+ $order->addStatusHistoryComment($helper->__('Refund was handled via PayLane module | Refund ID: %s', $message['id']));
168
+ $order->save();
169
+ $this->_log('Order #' . $order->getIncrementId() . ' was refunded to amout ' . $message['amount']);
170
+ } catch (Exception $e) {
171
+ $this->_log('There was an error in refunding: ' . $e->getMessage());
172
+ }
173
+ break;
174
+
175
+ default :
176
+ $msg = 'Unrecognized message type (' . $message['type'] . ')';
177
+ $this->_log($msg);
178
+ die($msg);
179
+ break;
180
+ }
181
+ } else {
182
+ $this->_log('Order with PayLane Sale ID ' . $message['id_sale'] . ' doesn\'t exist - skip');
183
+ }
184
+ }
185
+ }
186
+
187
+ protected function _handleRefund(Mage_Sales_Model_Order $order, $data)
188
+ {
189
+ try {
190
+ $creditmemo = $this->_initCreditmemo($order, $data);
191
+ if ($creditmemo) {
192
+ if (($creditmemo->getGrandTotal() <=0) && (!$creditmemo->getAllowZeroGrandTotal())) {
193
+ Mage::throwException(
194
+ $this->__('Credit memo\'s total must be positive.')
195
+ );
196
+ }
197
+
198
+ $this->_saveCreditmemo($creditmemo);
199
+ return;
200
+ } else {
201
+ Mage::throwException(
202
+ $this->__('Credit memo\'s not created')
203
+ );
204
+ }
205
+ } catch (Mage_Core_Exception $e) {
206
+ Mage::throwException($e->getMessage());
207
+ } catch (Exception $e) {
208
+ Mage::logException($e);
209
+ Mage::throwException(
210
+ $this->__('Cannot save the credit memo.')
211
+ );
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Initialize creditmemo model instance
217
+ *
218
+ * @return Mage_Sales_Model_Order_Creditmemo
219
+ */
220
+ protected function _initCreditmemo(Mage_Sales_Model_Order $order, $data = array(), $update = false)
221
+ {
222
+ $creditmemo = false;
223
+
224
+ if ($order) {
225
+ $invoice = $this->_initInvoice($order);
226
+
227
+ if (!$order->_canCreditmemo($order)) {
228
+ return false;
229
+ }
230
+
231
+ $qtys = array();
232
+ $data['qtys'] = $qtys;
233
+
234
+ $service = Mage::getModel('sales/service_order', $order);
235
+ if ($invoice) {
236
+ $creditmemo = $service->prepareInvoiceCreditmemo($invoice, $data);
237
+ } else {
238
+ $creditmemo = $service->prepareCreditmemo($data);
239
+ }
240
+
241
+ /**
242
+ * Process back to stock flags
243
+ */
244
+ foreach ($creditmemo->getAllItems() as $creditmemoItem) {
245
+ $creditmemoItem->setBackToStock(false);
246
+ }
247
+ }
248
+
249
+ return $creditmemo;
250
+ }
251
+
252
+ /**
253
+ * Save creditmemo and related order, invoice in one transaction
254
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
255
+ */
256
+ protected function _saveCreditmemo($creditmemo)
257
+ {
258
+ $transactionSave = Mage::getModel('core/resource_transaction')
259
+ ->addObject($creditmemo)
260
+ ->addObject($creditmemo->getOrder());
261
+ if ($creditmemo->getInvoice()) {
262
+ $transactionSave->addObject($creditmemo->getInvoice());
263
+ }
264
+ $transactionSave->save();
265
+
266
+ return $this;
267
+ }
268
+
269
+ /**
270
+ * Initialize requested invoice instance
271
+ * @param unknown_type $order
272
+ */
273
+ protected function _initInvoice($order)
274
+ {
275
+ $invoiceId = $this->getRequest()->getParam('invoice_id');
276
+ if ($invoiceId) {
277
+ $invoice = Mage::getModel('sales/order_invoice')
278
+ ->load($invoiceId)
279
+ ->setOrder($order);
280
+ if ($invoice->getId()) {
281
+ return $invoice;
282
+ }
283
+ }
284
+ return false;
285
+ }
286
+ }
app/code/community/Endora/PayLane/controllers/PaymentController.php ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Controller to handle payment flow
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ class Endora_PayLane_PaymentController extends Mage_Core_Controller_Front_Action {
8
+
9
+ /**
10
+ * Controller for test purposes only
11
+ */
12
+ public function indexAction()
13
+ {
14
+ $helper = Mage::helper('paylane');
15
+
16
+ echo 'PaymentController | indexAction() works!'; die;
17
+ }
18
+
19
+ public function redirectAction()
20
+ {
21
+ $helper = Mage::helper('paylane');
22
+
23
+ $lastOrderId = Mage::getSingleton('checkout/session')
24
+ ->getLastRealOrderId();
25
+ $order = Mage::getModel('sales/order')
26
+ ->loadByIncrementId($lastOrderId);
27
+ $paymentType = $order->getPayment()->getAdditionalInformation('paylane_payment_type');
28
+
29
+ if($paymentType == Endora_PayLane_Helper_Data::GATEWAY_TYPE_SECURE_FORM) {
30
+ $this->_redirect('paylane/payment/secureForm', array('_secure' => true));
31
+ } else {
32
+ $paymentParams = Mage::getSingleton('checkout/session')->getData('payment_params');
33
+ Mage::getSingleton('checkout/session')->unsetData('payment_params');
34
+ $apiPayment = Mage::getModel('paylane/api_payment_' . $paymentType);
35
+ $result = $apiPayment->handlePayment($order, $paymentParams);
36
+
37
+ $this->_redirect($helper->getRedirectUrl(!$result), array('_secure' => true));
38
+ }
39
+ }
40
+
41
+ public function secureFormAction()
42
+ {
43
+ $lastOrderId = Mage::getSingleton('checkout/session')
44
+ ->getLastRealOrderId();
45
+ $order = Mage::getModel('sales/order')
46
+ ->loadByIncrementId($lastOrderId);
47
+ $this->loadLayout();
48
+ $this->getLayout()->getBlock('paylane_redirect')->setOrder($order);
49
+ $this->renderLayout();
50
+ }
51
+
52
+ public function secureFormResponseAction()
53
+ {
54
+ $helper = Mage::helper('paylane');
55
+ $payment = Mage::getModel('paylane/payment');
56
+ $params = $this->getRequest()->getParams();
57
+
58
+ $error = false;
59
+ $orderStatus = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
60
+ $orderIncrementId = $params['description'];
61
+ $transactionId = $payment->getTransactionId($params);
62
+ $order = Mage::getModel('sales/order')->load($orderIncrementId, 'increment_id');
63
+ $comment = $helper->__('Payment handled via PayLane module | Transaction ID: %s', $transactionId);
64
+
65
+ if($payment->verifyResponseHash($params)) {
66
+ switch($params['status']) {
67
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_PENDING :
68
+ $orderStatus = $helper->getPendingOrderStatus();
69
+ break;
70
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_PERFORMED :
71
+ $orderStatus = $helper->getPerformedOrderStatus();
72
+ break;
73
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_CLEARED :
74
+ $orderStatus = $helper->getClearedOrderStatus();
75
+ break;
76
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_ERROR :
77
+ default:
78
+ $orderStatus = $helper->getErrorOrderStatus();
79
+ $error = true;
80
+ }
81
+ } else {
82
+ $orderStatus = Mage_Core_Sales_Order::STATE_HOLDED;
83
+ $error = true;
84
+ }
85
+
86
+ if(!empty($params['id_error']) || $error) {
87
+ $errorCode = (!empty($params['error_code'])) ? $params['error_code'] : '';
88
+ $errorText = (!empty($params['error_text'])) ? $params['error_text'] : '';
89
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error ID: %s , Error code: %s, Error text: %s)', $params['id_error'], $errorCode, $errorText);
90
+ } else {
91
+ $comment = $helper->__('Payment handled via PayLane module | Transaction ID: %s', $transactionId);
92
+ $order->setPaylaneSaleId($transactionId);
93
+ }
94
+
95
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
96
+ $order->save();
97
+
98
+ $this->_redirect($helper->getRedirectUrl($error), array('_secure' => true));
99
+ }
100
+
101
+ public function fetchPaymentTemplateAction()
102
+ {
103
+ $paymentType = $this->getRequest()->getParam('paymentType');
104
+ $templatePath = strtolower($paymentType);
105
+
106
+ echo $this->getLayout()->createBlock('paylane/payment_'.$paymentType)->setTemplate('paylane/payment/'.$templatePath.'.phtml')->toHtml();
107
+ }
108
+
109
+ public function externalUrlResponseAction()
110
+ {
111
+ $lastOrderId = Mage::getSingleton('checkout/session')
112
+ ->getLastRealOrderId();
113
+ $order = Mage::getModel('sales/order')
114
+ ->loadByIncrementId($lastOrderId);
115
+ $helper = Mage::helper('paylane');
116
+ $payment = Mage::getModel('paylane/payment');
117
+ $result = $this->getRequest()->getParams();
118
+ $success = false;
119
+ $paymentType = $order->getPayment()->getAdditionalInformation('paylane_payment_type');
120
+
121
+ $id = '';
122
+ if($result['status'] != Endora_PayLane_Model_Payment::PAYMENT_STATUS_ERROR) {
123
+ $id = $result['id_sale'];
124
+ }
125
+
126
+ // var_dump($result, $paymentType); die;
127
+
128
+ if($payment->verifyResponseHash($result, $paymentType)) {
129
+ switch($result['status']) {
130
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_CLEARED :
131
+ $orderStatus = $helper->getClearedOrderStatus();
132
+ $comment = $helper->__('Payment handled via PayLane module | Transaction ID: %s', $result['id_sale']);
133
+ $order->setPaylaneSaleId($result['id_sale']);
134
+ $success = true;
135
+ break;
136
+
137
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_PERFORMED :
138
+ $orderStatus = $helper->getPerformedOrderStatus();
139
+ $comment = $helper->__('Payment handled via PayLane module | Transaction ID: %s', $result['id_sale']);
140
+ $order->setPaylaneSaleId($result['id_sale']);
141
+ $success = true;
142
+ break;
143
+
144
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_ERROR :
145
+ $orderStatus = $helper->getErrorOrderStatus();
146
+ $errorCode = '';
147
+ $errorText = '';
148
+ if(!empty($result['error'])) {
149
+ $errorCode = (!empty($result['error']['error_number'])) ? $result['error']['error_number'] : '';
150
+ $errorText = (!empty($result['error']['error_description'])) ? $result['error']['error_description'] : '';
151
+ }
152
+ $comment = $helper->__('There was an error in payment process via PayLane module (Error code: %s, Error text: %s)', $errorCode, $errorText);
153
+ break;
154
+
155
+ case Endora_PayLane_Model_Payment::PAYMENT_STATUS_PENDING :
156
+ default :
157
+ $orderStatus = $helper->getPendingOrderStatus();
158
+ $comment = $helper->__('Payment handled via PayLane module | Transaction ID: %s', $result['id_sale']);
159
+ $order->setPaylaneSaleId($result['id_sale']);
160
+ $success = true;
161
+ break;
162
+ }
163
+ } else {
164
+ $orderStatus = $helper->getErrorOrderStatus();
165
+ $comment = $helper->__('There was an error in payment process via PayLane module (hash verification failed)');
166
+ }
167
+
168
+ $order->setState($helper->getStateByStatus($orderStatus), $orderStatus, $comment, false);
169
+ $order->save();
170
+
171
+ $this->_redirect($helper->getRedirectUrl(!$success), array('_secure' => true));
172
+ }
173
+
174
+ public function recurringProfileResponseAction()
175
+ {
176
+ $lastOrderId = Mage::getSingleton('checkout/session')
177
+ ->getLastRealOrderId();
178
+ $order = Mage::getModel('sales/order')
179
+ ->loadByIncrementId($lastOrderId);
180
+ $helper = Mage::helper('paylane');
181
+ $payment = Mage::getModel('paylane/payment');
182
+ $result = $this->getRequest()->getParams();
183
+ $success = false;
184
+
185
+ var_dump($result); die;
186
+ }
187
+ }
app/code/community/Endora/PayLane/etc/config.xml ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Endora_PayLane>
5
+ <version>0.1.0</version>
6
+ </Endora_PayLane>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <paylane>
11
+ <class>Endora_PayLane_Model</class>
12
+ </paylane>
13
+ </models>
14
+ <helpers>
15
+ <paylane>
16
+ <class>Endora_PayLane_Helper</class>
17
+ </paylane>
18
+ </helpers>
19
+ <blocks>
20
+ <paylane>
21
+ <class>Endora_PayLane_Block</class>
22
+ </paylane>
23
+ </blocks>
24
+ <resources>
25
+ <paylane_setup>
26
+ <setup>
27
+ <module>Endora_PayLane</module>
28
+ <class>Endora_PayLane_Model_Resource_Setup</class>
29
+ </setup>
30
+ </paylane_setup>
31
+ </resources>
32
+ <events>
33
+ <controller_action_predispatch_checkout_onepage_saveOrder>
34
+ <observers>
35
+ <endora_paylane_observer>
36
+ <type>singleton</type>
37
+ <class>paylane/observer</class>
38
+ <method>preparePaymentTypeFormData</method>
39
+ </endora_paylane_observer>
40
+ </observers>
41
+ </controller_action_predispatch_checkout_onepage_saveOrder>
42
+ </events>
43
+ <fieldsets>
44
+ <sales_convert_quote>
45
+ <paylane_sale_id>
46
+ <to_order>*</to_order>
47
+ </paylane_sale_id>
48
+ </sales_convert_quote>
49
+ <sales_convert_order>
50
+ <paylane_sale_id>
51
+ <to_quote>*</to_quote>
52
+ </paylane_sale_id>
53
+ </sales_convert_order>
54
+ </fieldsets>
55
+ </global>
56
+ <frontend>
57
+ <routers>
58
+ <paylane>
59
+ <use>standard</use>
60
+ <args>
61
+ <module>Endora_PayLane</module>
62
+ <frontName>paylane</frontName>
63
+ </args>
64
+ </paylane>
65
+ </routers>
66
+ <translate>
67
+ <modules>
68
+ <Endora_PayLane>
69
+ <files>
70
+ <default>Endora_PayLane.csv</default>
71
+ </files>
72
+ </Endora_PayLane>
73
+ </modules>
74
+ </translate>
75
+ <layout>
76
+ <updates>
77
+ <Endora_PayLane>
78
+ <file>paylane.xml</file>
79
+ </Endora_PayLane>
80
+ </updates>
81
+ </layout>
82
+ </frontend>
83
+ <admin>
84
+ <routers>
85
+ <paylane>
86
+ <use>admin</use>
87
+ <args>
88
+ <module>Endora_PayLane</module>
89
+ <frontName>paylane</frontName>
90
+ </args>
91
+ </paylane>
92
+ </routers>
93
+ </admin>
94
+ <adminhtml>
95
+ <acl>
96
+ <resources>
97
+ <all>
98
+ <title>Allow Everything</title>
99
+ </all>
100
+ <admin>
101
+ <children>
102
+ <system>
103
+ <children>
104
+ <config>
105
+ <children>
106
+ <paylane>
107
+ <title>PayLane</title>
108
+ </paylane>
109
+ </children>
110
+ </config>
111
+ </children>
112
+ </system>
113
+ </children>
114
+ </admin>
115
+ </resources>
116
+ </acl>
117
+ <translate>
118
+ <modules>
119
+ <Endora_PayLane>
120
+ <files>
121
+ <default>Endora_PayLane.csv</default>
122
+ </files>
123
+ </Endora_PayLane>
124
+ </modules>
125
+ </translate>
126
+ </adminhtml>
127
+ <default>
128
+ <payment>
129
+ <paylane>
130
+ <model>paylane/payment</model>
131
+ </paylane>
132
+ <paylane_banktransfer>
133
+ <title>PayLane Bank Transfer</title>
134
+ </paylane_banktransfer>
135
+ <paylane_paypal>
136
+ <title>PayLane PayPal</title>
137
+ </paylane_paypal>
138
+ <paylane_directdebit>
139
+ <title>PayLane Direct Debit</title>
140
+ </paylane_directdebit>
141
+ <paylane_sofort>
142
+ <title>PayLane SOFORT Banking</title>
143
+ </paylane_sofort>
144
+ <paylane_ideal>
145
+ <title>PayLane iDEAL</title>
146
+ </paylane_ideal>
147
+ <paylane_secureform>
148
+ <title>PayLane SecureForm</title>
149
+ <send_customer_data>1</send_customer_data>
150
+ </paylane_secureform>
151
+ <paylane_notifications>
152
+ <notification_mode>auto</notification_mode>
153
+ <notifications_interval>15</notifications_interval>
154
+ </paylane_notifications>
155
+ <paylane_creditcard>
156
+ <title>PayLane Credit Card</title>
157
+ <fraud_check_overwrite>0</fraud_check_overwrite>
158
+ <avs_check_overwrite>0</avs_check_overwrite>
159
+ <authorization_amount>1</authorization_amount>
160
+ <single_click_active>0</single_click_active>
161
+ </paylane_creditcard>
162
+ </payment>
163
+ </default>
164
+ <crontab>
165
+ <jobs>
166
+ <paylane_charge>
167
+ <schedule>
168
+ <cron_expr>* * * * *</cron_expr>
169
+ </schedule>
170
+ <run>
171
+ <model>paylane/observer::handleRecurringProfileCron</model>
172
+ </run>
173
+ </paylane_charge>
174
+ </jobs>
175
+ </crontab>
176
+ </config>
app/code/community/Endora/PayLane/etc/system.xml ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <paylane translate="label" module="paylane">
7
+ <label>PayLane</label>
8
+ <tab>sales</tab>
9
+ <sort_order>100</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <frontend_class>complex</frontend_class>
14
+ <frontend_model>adminhtml/system_config_form_fieldset</frontend_model>
15
+ <fields>
16
+ <active translate="label">
17
+ <label>Enable this solution</label>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <frontend_type>select</frontend_type>
20
+ <sort_order>10</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>0</show_in_store>
24
+ </active>
25
+ <title translate="label">
26
+ <label>Title</label>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>20</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ </title>
33
+ <sort_order translate="label">
34
+ <label>Sort order</label>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>30</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </sort_order>
41
+ <pending_order_status translate="label">
42
+ <label>Pending Order Status</label>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>paylane/source_order_status</source_model>
45
+ <sort_order>50</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>0</show_in_store>
49
+ </pending_order_status>
50
+ <performed_order_status translate="label">
51
+ <label>Performed Order Status</label>
52
+ <frontend_type>select</frontend_type>
53
+ <source_model>paylane/source_order_status</source_model>
54
+ <sort_order>60</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ </performed_order_status>
59
+ <cleared_order_status translate="label">
60
+ <label>Cleared Order Status</label>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>paylane/source_order_status</source_model>
63
+ <sort_order>70</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </cleared_order_status>
68
+ <error_order_status translate="label">
69
+ <label>Error Order Status</label>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>paylane/source_order_status</source_model>
72
+ <sort_order>80</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>0</show_in_store>
76
+ </error_order_status>
77
+ <redirect_version translate="label">
78
+ <label>Redirect version</label>
79
+ <source_model>paylane/source_redirect_version</source_model>
80
+ <frontend_type>select</frontend_type>
81
+ <sort_order>90</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>0</show_in_store>
85
+ </redirect_version>
86
+ <paylane_notifications type="group" translate="label comment">
87
+ <label>Notifications settings</label>
88
+ <frontend_type>text</frontend_type>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ <sort_order>100</sort_order>
93
+ <group>paylane</group>
94
+ <fields>
95
+ <notifications_url translate="label comment">
96
+ <label>URL that handles automatic notifications</label>
97
+ <comment>If you want to handle automatic notifications in your store, you have to inform PayLane support about that URL</comment>
98
+ <frontend_model>paylane/adminhtml_notification_url</frontend_model>
99
+ <sort_order>10</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>0</show_in_store>
103
+ </notifications_url>
104
+ <notifications_token translate="label comment">
105
+ <label>Notification Token</label>
106
+ <comment><![CDATA[Optional, can be configured in <a href="http://merchant.paylane.com" target="_blank">Merchant Panel</a>]]></comment>
107
+ <frontend_type>text</frontend_type>
108
+ <sort_order>25</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>0</show_in_store>
112
+ </notifications_token>
113
+ <username translate="label comment" module="paylane">
114
+ <label>Notification username</label>
115
+ <comment><![CDATA[Optional, can be configured in <a href="http://merchant.paylane.com" target="_blank">Merchant Panel</a>]]></comment>
116
+ <frontend_type>text</frontend_type>
117
+ <sort_order>30</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>0</show_in_store>
121
+ </username>
122
+ <password translate="label comment">
123
+ <label>Notification password</label>
124
+ <comment><![CDATA[Optional, can be configured in <a href="http://merchant.paylane.com" target="_blank">Merchant Panel</a>]]></comment>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>40</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ </password>
131
+ <enable_log translate="label comment">
132
+ <label>Enable logging</label>
133
+ <comment><![CDATA[Log will be able in /var/log/paylane-notifications.log]]></comment>
134
+ <source_model>adminhtml/system_config_source_yesno</source_model>
135
+ <frontend_type>select</frontend_type>
136
+ <sort_order>100</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>0</show_in_store>
140
+ </enable_log>
141
+ </fields>
142
+ </paylane_notifications>
143
+ <paylane_secureform type="group" translate="label comment">
144
+ <label>SecureForm</label>
145
+ <frontend_type>text</frontend_type>
146
+ <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
+ <show_in_store>1</show_in_store>
149
+ <sort_order>200</sort_order>
150
+ <group>paylane</group>
151
+ <fields>
152
+ <active translate="label">
153
+ <label>Enable this solution</label>
154
+ <source_model>adminhtml/system_config_source_yesno</source_model>
155
+ <frontend_type>select</frontend_type>
156
+ <sort_order>10</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>0</show_in_store>
160
+ </active>
161
+ <merchant_id translate="label">
162
+ <label>Merchant ID</label>
163
+ <frontend_type>text</frontend_type>
164
+ <sort_order>30</sort_order>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>0</show_in_store>
168
+ </merchant_id>
169
+ <send_customer_data translate="label comment">
170
+ <label>Send Customer Data</label>
171
+ <comment>Send additional customer data while redirecting to SecureForm</comment>
172
+ <source_model>adminhtml/system_config_source_yesno</source_model>
173
+ <frontend_type>select</frontend_type>
174
+ <sort_order>140</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>0</show_in_store>
178
+ </send_customer_data>
179
+ <hash_salt translate="label">
180
+ <label>Hash salt</label>
181
+ <frontend_type>text</frontend_type>
182
+ <sort_order>20</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>0</show_in_store>
186
+ </hash_salt>
187
+ </fields>
188
+ </paylane_secureform>
189
+ <paylane_creditcard type="group" translate="label comment">
190
+ <label>Credit card</label>
191
+ <frontend_type>text</frontend_type>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>1</show_in_store>
195
+ <sort_order>300</sort_order>
196
+ <group>paylane</group>
197
+ <fields>
198
+ <active translate="label">
199
+ <label>Enable this solution</label>
200
+ <source_model>adminhtml/system_config_source_yesno</source_model>
201
+ <frontend_type>select</frontend_type>
202
+ <sort_order>10</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>0</show_in_store>
206
+ </active>
207
+ <title translate="label">
208
+ <label>Title</label>
209
+ <frontend_type>text</frontend_type>
210
+ <sort_order>20</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </title>
215
+ <hash_salt translate="label">
216
+ <label>Hash salt</label>
217
+ <frontend_type>text</frontend_type>
218
+ <sort_order>25</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>0</show_in_store>
222
+ </hash_salt>
223
+ <username translate="label comment" module="paylane">
224
+ <label>Username</label>
225
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
226
+ <frontend_type>text</frontend_type>
227
+ <sort_order>30</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>0</show_in_store>
231
+ </username>
232
+ <password translate="label comment">
233
+ <label>Password</label>
234
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
235
+ <frontend_type>text</frontend_type>
236
+ <sort_order>40</sort_order>
237
+ <show_in_default>1</show_in_default>
238
+ <show_in_website>1</show_in_website>
239
+ <show_in_store>0</show_in_store>
240
+ </password>
241
+ <fraud_check_overwrite translate="label comment">
242
+ <label>Overwrite Fraud check?</label>
243
+ <comment><![CDATA[Be sure that you can do a overwrite - you can check it in your <a href="http://merchant.paylane.com" target="_blank">Merchant Panel</a>]]></comment>
244
+ <source_model>adminhtml/system_config_source_yesno</source_model>
245
+ <frontend_type>select</frontend_type>
246
+ <sort_order>55</sort_order>
247
+ <show_in_default>1</show_in_default>
248
+ <show_in_website>1</show_in_website>
249
+ <show_in_store>0</show_in_store>
250
+ </fraud_check_overwrite>
251
+ <fraud_check translate="label">
252
+ <label>Fraud check</label>
253
+ <source_model>adminhtml/system_config_source_yesno</source_model>
254
+ <frontend_type>select</frontend_type>
255
+ <sort_order>60</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>0</show_in_store>
259
+ <depends>
260
+ <fraud_check_overwrite>1</fraud_check_overwrite>
261
+ </depends>
262
+ </fraud_check>
263
+ <avs_check_overwrite translate="label comment">
264
+ <label>Overwrite AVS check level?</label>
265
+ <comment><![CDATA[Be sure that you can do a overwrite - you can check it in your <a href="http://merchant.paylane.com" target="_blank">Merchant Panel</a>]]></comment>
266
+ <source_model>adminhtml/system_config_source_yesno</source_model>
267
+ <frontend_type>select</frontend_type>
268
+ <sort_order>65</sort_order>
269
+ <show_in_default>1</show_in_default>
270
+ <show_in_website>1</show_in_website>
271
+ <show_in_store>0</show_in_store>
272
+ </avs_check_overwrite>
273
+ <avs_check_level translate="label">
274
+ <label>AVS check level</label>
275
+ <source_model>paylane/source_avs_check_level</source_model>
276
+ <frontend_type>select</frontend_type>
277
+ <sort_order>70</sort_order>
278
+ <show_in_default>1</show_in_default>
279
+ <show_in_website>1</show_in_website>
280
+ <show_in_store>0</show_in_store>
281
+ <depends>
282
+ <avs_check_overwrite>1</avs_check_overwrite>
283
+ </depends>
284
+ </avs_check_level>
285
+ <ds3_check translate="label">
286
+ <label>3DS check</label>
287
+ <source_model>adminhtml/system_config_source_yesno</source_model>
288
+ <frontend_type>select</frontend_type>
289
+ <sort_order>80</sort_order>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ <show_in_store>0</show_in_store>
293
+ </ds3_check>
294
+ <authorization_amount translate="label comment">
295
+ <label>Blocked amount in authorization process</label>
296
+ <comment>Set in default store currency</comment>
297
+ <frontend_type>text</frontend_type>
298
+ <validate>validate-number</validate>
299
+ <sort_order>80</sort_order>
300
+ <show_in_default>1</show_in_default>
301
+ <show_in_website>1</show_in_website>
302
+ <show_in_store>0</show_in_store>
303
+ </authorization_amount>
304
+ <single_click_active translate="label comment">
305
+ <label>Enable Single-click payment</label>
306
+ <comment><![CDATA[More info about Single click available at <a href="http://devzone.paylane.pl/api/karty/platnosci-single-click/" target="_blank">http://devzone.paylane.pl/api/karty/platnosci-single-click/</a>]]></comment>
307
+ <source_model>adminhtml/system_config_source_yesno</source_model>
308
+ <frontend_type>select</frontend_type>
309
+ <sort_order>80</sort_order>
310
+ <show_in_default>1</show_in_default>
311
+ <show_in_website>1</show_in_website>
312
+ <show_in_store>0</show_in_store>
313
+ </single_click_active>
314
+ </fields>
315
+ </paylane_creditcard>
316
+ <paylane_banktransfer type="group" translate="label comment">
317
+ <label>Bank transfer</label>
318
+ <frontend_type>text</frontend_type>
319
+ <show_in_default>1</show_in_default>
320
+ <show_in_website>1</show_in_website>
321
+ <show_in_store>1</show_in_store>
322
+ <sort_order>400</sort_order>
323
+ <group>paylane</group>
324
+ <fields>
325
+ <active translate="label">
326
+ <label>Enable this solution</label>
327
+ <source_model>adminhtml/system_config_source_yesno</source_model>
328
+ <frontend_type>select</frontend_type>
329
+ <sort_order>10</sort_order>
330
+ <show_in_default>1</show_in_default>
331
+ <show_in_website>1</show_in_website>
332
+ <show_in_store>0</show_in_store>
333
+ </active>
334
+ <title translate="label">
335
+ <label>Title</label>
336
+ <frontend_type>text</frontend_type>
337
+ <sort_order>20</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
+ </title>
342
+ <hash_salt translate="label">
343
+ <label>Hash salt</label>
344
+ <frontend_type>text</frontend_type>
345
+ <sort_order>25</sort_order>
346
+ <show_in_default>1</show_in_default>
347
+ <show_in_website>1</show_in_website>
348
+ <show_in_store>0</show_in_store>
349
+ </hash_salt>
350
+ <username translate="label comment" module="paylane">
351
+ <label>API Username</label>
352
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
353
+ <frontend_type>text</frontend_type>
354
+ <sort_order>30</sort_order>
355
+ <show_in_default>1</show_in_default>
356
+ <show_in_website>1</show_in_website>
357
+ <show_in_store>0</show_in_store>
358
+ </username>
359
+ <password translate="label comment">
360
+ <label>API Password</label>
361
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
362
+ <frontend_type>text</frontend_type>
363
+ <sort_order>40</sort_order>
364
+ <show_in_default>1</show_in_default>
365
+ <show_in_website>1</show_in_website>
366
+ <show_in_store>0</show_in_store>
367
+ </password>
368
+ </fields>
369
+ </paylane_banktransfer>
370
+ <paylane_paypal type="group" translate="label comment">
371
+ <label>PayPal</label>
372
+ <frontend_type>text</frontend_type>
373
+ <show_in_default>1</show_in_default>
374
+ <show_in_website>1</show_in_website>
375
+ <show_in_store>1</show_in_store>
376
+ <sort_order>500</sort_order>
377
+ <group>paylane</group>
378
+ <fields>
379
+ <active translate="label">
380
+ <label>Enable this solution</label>
381
+ <source_model>adminhtml/system_config_source_yesno</source_model>
382
+ <frontend_type>select</frontend_type>
383
+ <sort_order>10</sort_order>
384
+ <show_in_default>1</show_in_default>
385
+ <show_in_website>1</show_in_website>
386
+ <show_in_store>0</show_in_store>
387
+ </active>
388
+ <title translate="label">
389
+ <label>Title</label>
390
+ <frontend_type>text</frontend_type>
391
+ <sort_order>20</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>1</show_in_store>
395
+ </title>
396
+ <hash_salt translate="label">
397
+ <label>Hash salt</label>
398
+ <frontend_type>text</frontend_type>
399
+ <sort_order>25</sort_order>
400
+ <show_in_default>1</show_in_default>
401
+ <show_in_website>1</show_in_website>
402
+ <show_in_store>0</show_in_store>
403
+ </hash_salt>
404
+ <username translate="label comment" module="paylane">
405
+ <label>API Username</label>
406
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
407
+ <frontend_type>text</frontend_type>
408
+ <sort_order>30</sort_order>
409
+ <show_in_default>1</show_in_default>
410
+ <show_in_website>1</show_in_website>
411
+ <show_in_store>0</show_in_store>
412
+ </username>
413
+ <password translate="label comment">
414
+ <label>API Password</label>
415
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
416
+ <frontend_type>text</frontend_type>
417
+ <sort_order>40</sort_order>
418
+ <show_in_default>1</show_in_default>
419
+ <show_in_website>1</show_in_website>
420
+ <show_in_store>0</show_in_store>
421
+ </password>
422
+ </fields>
423
+ </paylane_paypal>
424
+ <paylane_directdebit type="group" translate="label comment">
425
+ <label>Direct Debit</label>
426
+ <frontend_type>text</frontend_type>
427
+ <show_in_default>1</show_in_default>
428
+ <show_in_website>1</show_in_website>
429
+ <show_in_store>1</show_in_store>
430
+ <sort_order>600</sort_order>
431
+ <group>paylane</group>
432
+ <fields>
433
+ <active translate="label">
434
+ <label>Enable this solution</label>
435
+ <source_model>adminhtml/system_config_source_yesno</source_model>
436
+ <frontend_type>select</frontend_type>
437
+ <sort_order>10</sort_order>
438
+ <show_in_default>1</show_in_default>
439
+ <show_in_website>1</show_in_website>
440
+ <show_in_store>0</show_in_store>
441
+ </active>
442
+ <title translate="label">
443
+ <label>Title</label>
444
+ <frontend_type>text</frontend_type>
445
+ <sort_order>20</sort_order>
446
+ <show_in_default>1</show_in_default>
447
+ <show_in_website>1</show_in_website>
448
+ <show_in_store>1</show_in_store>
449
+ </title>
450
+ <hash_salt translate="label">
451
+ <label>Hash salt</label>
452
+ <frontend_type>text</frontend_type>
453
+ <sort_order>25</sort_order>
454
+ <show_in_default>1</show_in_default>
455
+ <show_in_website>1</show_in_website>
456
+ <show_in_store>0</show_in_store>
457
+ </hash_salt>
458
+ <username translate="label comment" module="paylane">
459
+ <label>API Username</label>
460
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
461
+ <frontend_type>text</frontend_type>
462
+ <sort_order>30</sort_order>
463
+ <show_in_default>1</show_in_default>
464
+ <show_in_website>1</show_in_website>
465
+ <show_in_store>0</show_in_store>
466
+ </username>
467
+ <password translate="label comment">
468
+ <label>API Password</label>
469
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
470
+ <frontend_type>text</frontend_type>
471
+ <sort_order>40</sort_order>
472
+ <show_in_default>1</show_in_default>
473
+ <show_in_website>1</show_in_website>
474
+ <show_in_store>0</show_in_store>
475
+ </password>
476
+ </fields>
477
+ </paylane_directdebit>
478
+ <paylane_sofort type="group" translate="label comment">
479
+ <label>SOFORT Banking</label>
480
+ <frontend_type>text</frontend_type>
481
+ <show_in_default>1</show_in_default>
482
+ <show_in_website>1</show_in_website>
483
+ <show_in_store>1</show_in_store>
484
+ <sort_order>700</sort_order>
485
+ <group>paylane</group>
486
+ <fields>
487
+ <active translate="label">
488
+ <label>Enable this solution</label>
489
+ <source_model>adminhtml/system_config_source_yesno</source_model>
490
+ <frontend_type>select</frontend_type>
491
+ <sort_order>10</sort_order>
492
+ <show_in_default>1</show_in_default>
493
+ <show_in_website>1</show_in_website>
494
+ <show_in_store>0</show_in_store>
495
+ </active>
496
+ <title translate="label">
497
+ <label>Title</label>
498
+ <frontend_type>text</frontend_type>
499
+ <sort_order>20</sort_order>
500
+ <show_in_default>1</show_in_default>
501
+ <show_in_website>1</show_in_website>
502
+ <show_in_store>1</show_in_store>
503
+ </title>
504
+ <hash_salt translate="label">
505
+ <label>Hash salt</label>
506
+ <frontend_type>text</frontend_type>
507
+ <sort_order>25</sort_order>
508
+ <show_in_default>1</show_in_default>
509
+ <show_in_website>1</show_in_website>
510
+ <show_in_store>0</show_in_store>
511
+ </hash_salt>
512
+ <username translate="label comment" module="paylane">
513
+ <label>API Username</label>
514
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
515
+ <frontend_type>text</frontend_type>
516
+ <sort_order>30</sort_order>
517
+ <show_in_default>1</show_in_default>
518
+ <show_in_website>1</show_in_website>
519
+ <show_in_store>0</show_in_store>
520
+ </username>
521
+ <password translate="label comment">
522
+ <label>API Password</label>
523
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
524
+ <frontend_type>text</frontend_type>
525
+ <sort_order>40</sort_order>
526
+ <show_in_default>1</show_in_default>
527
+ <show_in_website>1</show_in_website>
528
+ <show_in_store>0</show_in_store>
529
+ </password>
530
+ </fields>
531
+ </paylane_sofort>
532
+ <paylane_ideal type="group" translate="label comment">
533
+ <label>iDEAL</label>
534
+ <frontend_type>text</frontend_type>
535
+ <show_in_default>1</show_in_default>
536
+ <show_in_website>1</show_in_website>
537
+ <show_in_store>1</show_in_store>
538
+ <sort_order>800</sort_order>
539
+ <group>paylane</group>
540
+ <fields>
541
+ <active translate="label">
542
+ <label>Enable this solution</label>
543
+ <source_model>adminhtml/system_config_source_yesno</source_model>
544
+ <frontend_type>select</frontend_type>
545
+ <sort_order>10</sort_order>
546
+ <show_in_default>1</show_in_default>
547
+ <show_in_website>1</show_in_website>
548
+ <show_in_store>0</show_in_store>
549
+ </active>
550
+ <title translate="label">
551
+ <label>Title</label>
552
+ <frontend_type>text</frontend_type>
553
+ <sort_order>20</sort_order>
554
+ <show_in_default>1</show_in_default>
555
+ <show_in_website>1</show_in_website>
556
+ <show_in_store>1</show_in_store>
557
+ </title>
558
+ <hash_salt translate="label">
559
+ <label>Hash salt</label>
560
+ <frontend_type>text</frontend_type>
561
+ <sort_order>25</sort_order>
562
+ <show_in_default>1</show_in_default>
563
+ <show_in_website>1</show_in_website>
564
+ <show_in_store>0</show_in_store>
565
+ </hash_salt>
566
+ <username translate="label comment" module="paylane">
567
+ <label>API Username</label>
568
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
569
+ <frontend_type>text</frontend_type>
570
+ <sort_order>30</sort_order>
571
+ <show_in_default>1</show_in_default>
572
+ <show_in_website>1</show_in_website>
573
+ <show_in_store>0</show_in_store>
574
+ </username>
575
+ <password translate="label comment">
576
+ <label>API Password</label>
577
+ <comment><![CDATA[Get from <a href="http://merchant.paylane.com" target="_blank">http://merchant.paylane.com</a>]]></comment>
578
+ <frontend_type>text</frontend_type>
579
+ <sort_order>40</sort_order>
580
+ <show_in_default>1</show_in_default>
581
+ <show_in_website>1</show_in_website>
582
+ <show_in_store>0</show_in_store>
583
+ </password>
584
+ </fields>
585
+ </paylane_ideal>
586
+ </fields>
587
+ </paylane>
588
+ </groups>
589
+ </payment>
590
+ </sections>
591
+ </config>
app/code/community/Endora/PayLane/sql/paylane_setup/install-0.1.0.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * - Add Paylane Sale ID to order
4
+ * - Add Card Authorization ID to customer
5
+ *
6
+ * @author Michał Zabielski <michal.zabielski@orba.pl>
7
+ */
8
+ Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
9
+
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+
14
+ $paylaneSaleId = array(
15
+ 'type' => 'varchar',
16
+ 'backend_type' => 'text',
17
+ 'frontend_input' => 'text',
18
+ 'is_user_defined' => true,
19
+ 'label' => 'Paylane Sale ID',
20
+ 'visible' => true,
21
+ 'required' => false,
22
+ 'user_defined' => false,
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'default' => null
27
+ );
28
+
29
+ $cardAuthorizationId = array(
30
+ 'type' => 'varchar',
31
+ 'backend_type' => 'text',
32
+ 'frontend_input' => 'text',
33
+ 'is_user_defined' => true,
34
+ 'label' => 'Paylane Card Authorization ID',
35
+ 'visible' => true,
36
+ 'required' => false,
37
+ 'user_defined' => false,
38
+ 'searchable' => false,
39
+ 'filterable' => false,
40
+ 'comparable' => false,
41
+ 'default' => null
42
+ );
43
+
44
+ $installer->addAttribute('order', 'paylane_sale_id', $paylaneSaleId);
45
+ $installer->addAttribute('customer', 'card_authorization_id', $cardAuthorizationId);
46
+
47
+ $installer->endSetup();
app/design/adminhtml/base/default/template/paylane/form.phtml ADDED
File without changes
app/design/adminhtml/base/default/template/paylane/info.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Endora_PayLane_Block_Info
4
+ */
5
+ $infos = $this->getMoreInfo();
6
+ ?>
7
+ <table class="form-list">
8
+ <tr>
9
+ <td class="label"><?php echo $this->__('Method'); ?>:</td>
10
+ <td class="value"><strong><?php echo $this->htmlEscape($this->getMethod()->getTitle()); ?></strong></td>
11
+ </tr>
12
+ <?php if ($infos):?>
13
+ <?php foreach ($infos as $label => $info):?>
14
+ <tr>
15
+ <td class="label"><?php echo $this->escapeHtml(Mage::helper('paylane')->__($label))?>:</td>
16
+ <td class="value"><strong><?php echo nl2br(implode($this->getValueAsArray($info, true), "\n"))?></strong></td>
17
+ </tr>
18
+ <?php endforeach; ?>
19
+ <?php endif;?>
20
+ </table>
21
+ <br>
22
+ <?php echo $this->getChildHtml();
app/design/frontend/base/default/layout/paylane.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+ <paylane_payment_secureform>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>paylane/empty.phtml</template></action>
6
+ <block type="paylane/redirect" name="paylane_redirect" template="paylane/redirect.phtml" />
7
+ </reference>
8
+ </paylane_payment_secureform>
9
+
10
+ <checkout_onepage_index>
11
+ <reference name="head">
12
+ <action method="addItem"><type>skin_css</type><name>paylane/style.css</name></action>
13
+ </reference>
14
+ </checkout_onepage_index>
15
+
16
+ <customer_account>
17
+ <reference name="customer_account_navigation">
18
+ <action method="addLink" translate="label" module="paylane"><name>settings</name><path>paylane/customer/</path><label>PayLane Settings</label></action>
19
+ </reference>
20
+ </customer_account>
21
+
22
+ <paylane_customer_index translate="label">
23
+ <label>PayLane Customer Settings</label>
24
+ <update handle="customer_account"/>
25
+ <reference name="root">
26
+ <action method="setHeaderTitle" translate="title" module="paylane"><title>PayLane Customer Settings</title></action>
27
+ </reference>
28
+ <reference name="my.account.wrapper">
29
+ <block type="paylane/customer_account" name="customer_account" template="paylane/customer/account.phtml">
30
+ <block type="core/template" name="credit_card_form" template="paylane/payment/creditcard/form.phtml" />
31
+ </block>
32
+ </reference>
33
+
34
+ <reference name="left">
35
+ <action method="unsetChild"><name>left.permanent.callout</name></action>
36
+ </reference>
37
+ </paylane_customer_index>
38
+ </layout>
app/design/frontend/base/default/template/paylane/customer/account.phtml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template to show creadit card authorization settings
4
+ * in customer My Account page
5
+ *
6
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
7
+ * @see Endora_PayLane_Block_Customer_Account
8
+ */
9
+ ?>
10
+ <?php $authStatus = $this->isCustomerAuthorized(); ?>
11
+ <div class="page-title">
12
+ <h1><?php echo $this->__('PayLane Customer Settings') ?></h1>
13
+ </div>
14
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
15
+ <div class="fieldset">
16
+ <?php
17
+ echo $this->__('Authorization status') . ': ';
18
+
19
+ if($authStatus): ?>
20
+ <span style="color: green;"><?php echo $this->__('Authorized'); ?></span>
21
+ <?php else: ?>
22
+ <span style="color: red;"><?php echo $this->__('Unauthorized'); ?></span>
23
+ <?php endif; ?>
24
+ </div>
25
+ <div class="fieldset">
26
+ <?php echo $this->__('If you want to authorize or reauthorize with new data fill the form below'); ?>
27
+ </div>
28
+ <form action="<?php echo $this->getUrl('paylane/customer/authorizeCreditCard') ?>" method="post" autocomplete="off" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
29
+ <div class="fieldset">
30
+ <h2 class="legend"><?php echo $this->__('Credit Card Authorization') ?></h2>
31
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
32
+
33
+ <?php echo $this->getChildHtml('credit_card_form'); ?>
34
+ </div>
35
+ <div class="buttons-set">
36
+ <button type="submit" title="<?php echo $this->__('Authorize') ?>" class="button"><span><span><?php echo $this->__('Authorize') ?></span></span></button>
37
+ <button type="button" onclick="setLocation('<?php echo $this->getUrl('paylane/customer/unauthorizeCreditCard'); ?>')" title="<?php echo $this->__('Unauthorize') ?>" class="button"><span><span><?php echo $this->__('Unauthorize') ?></span></span></button>
38
+ </div>
39
+ </form>
app/design/frontend/base/default/template/paylane/empty.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getChildHtml('paylane_redirect');
app/design/frontend/base/default/template/paylane/form.phtml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Allows redirect to Secure Form
4
+ *
5
+ * @link http://devzone.paylane.pl/secure-form/
6
+ * @see Endora_PayLane_Block_Form
7
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
8
+ */
9
+ ?>
10
+ <?php
11
+ $paymentMethods = $this->getPaymentMethods();
12
+ $isRecurring = $this->isRecurringItemInCart();
13
+ ?>
14
+ <div class="paylane-payment-container">
15
+ <div id="payment_form_paylane">
16
+ <div class="paylane-payment-method-container-title"><?php echo $this->__('Choose payment method'); ?>:</div>
17
+ <div class="paylane-payment-method-container">
18
+ <ul class="form-list">
19
+ <?php foreach($paymentMethods as $code => $method): ?>
20
+ <?php if($this->isPaymentMethodActive($code)): ?>
21
+ <?php if( ($isRecurring && $method['recurring'] === true) || !$isRecurring): ?>
22
+ <li>
23
+ <input type="radio" name="payment[additional_information][paylane_payment_type]" id="paylane_payment_type_<?php echo $code; ?>" value="<?php echo $code; ?>" />
24
+ <label for="paylane_payment_type_<?php echo $code; ?>">
25
+ <?php if(empty($method['img'])): ?>
26
+ <?php echo $this->__($method['label']); ?>
27
+ <?php else: ?>
28
+ <img src="<?php echo $method['img']; ?>" title="<?php echo $this->__($method['label']); ?>" alt="" />
29
+ <?php endif; ?>
30
+ </label>
31
+ </li>
32
+ <?php endif; ?>
33
+ <?php endif; ?>
34
+ <?php endforeach; ?>
35
+ </ul>
36
+ <div class="clearfix"></div>
37
+ </div>
38
+ <div id="paylane-payment-method-additional-container"><?php //loaded via AJAX request ?></div>
39
+ </div>
40
+ </div>
41
+
42
+ <script type="text/javascript">
43
+ //<![CDATA[
44
+ if(jQuery('input[type=radio][name="payment[method]"]:checked').val() === "paylane") {
45
+ jQuery(".paylane-payment-container").show();
46
+ }
47
+
48
+ jQuery('input[type=radio][name="payment[method]"]').change(function() {
49
+ if(this.value === "paylane") {
50
+ jQuery(".paylane-payment-container").slideDown();
51
+ } else {
52
+ jQuery(".paylane-payment-container").slideUp();
53
+ }
54
+ });
55
+
56
+ jQuery('input[type=radio][name="payment[additional_information][paylane_payment_type]"]').change(function() {
57
+ var paymentType = this.value;
58
+ jQuery.post( "<?php echo Mage::getUrl('paylane/payment/fetchPaymentTemplate'); ?>", { paymentType : paymentType }).done(function (data) {
59
+ jQuery("#paylane-payment-method-additional-container").html(data);
60
+ });
61
+ });
62
+ //]]>
63
+ </script>
app/design/frontend/base/default/template/paylane/info.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Endora_PayLane_Block_Info
4
+ */
5
+ $infos = $this->getMoreInfo();
6
+ ?>
7
+ <table class="form-list paylane-payment-info">
8
+ <tr>
9
+ <td class="label"><?php echo $this->__('Method'); ?>:</td>
10
+ <td class="value"><strong><?php echo $this->htmlEscape($this->getMethod()->getTitle()); ?></strong></td>
11
+ </tr>
12
+ <?php if ($infos):?>
13
+ <?php foreach ($infos as $label => $info):?>
14
+ <tr>
15
+ <td class="label"><?php echo $this->escapeHtml(Mage::helper('paylane')->__($label))?>: </td>
16
+ <td class="value"><strong><?php echo nl2br(implode($this->getValueAsArray($info, true), "\n"))?></strong></td>
17
+ </tr>
18
+ <?php endforeach; ?>
19
+ <?php endif;?>
20
+ </table>
21
+ <br>
22
+ <?php echo $this->getChildHtml();
app/design/frontend/base/default/template/paylane/payment/banktransfer.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Display list of payment types for bank transfer
4
+ *
5
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
6
+ */
7
+ ?>
8
+ <?php $paymentTypes = $this->getPaymentTypes(); ?>
9
+ <div class="paylane-payment-method-container-title"><?php echo $this->__('Choose payment type'); ?>:</div>
10
+ <ul class="form-list payment-types-list">
11
+ <?php foreach($paymentTypes as $code => $data): ?>
12
+ <li>
13
+ <input type="radio" name="payment_params[payment_type]" id="payment_type_<?php echo $code; ?>" value="<?php echo $code; ?>">
14
+ <label for="payment_type_<?php echo $code; ?>">
15
+ <?php if(empty($data['img'])): ?>
16
+ <?php echo $this->__($data['label']); ?>
17
+ <?php else: ?>
18
+ <img src="<?php echo $data['img']; ?>" title="<?php echo $this->__($data['label']); ?>" alt="" />
19
+ <?php endif; ?>
20
+ </label>
21
+ </li>
22
+ <?php endforeach; ?>
23
+ </ul>
24
+ <div class="clearfix"></div>
app/design/frontend/base/default/template/paylane/payment/creditcard.phtml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('paylane');
3
+ $isSingleClickActive = $helper->isSingleClickActive();
4
+ $isAuthorized = $this->isCustomerAuthorized();
5
+ $isFirstOrder = $this->isCustomerFirstOrder();
6
+ $months = $helper->generateMonthsNumber();
7
+ $years = $helper->generateCreditCardValidYears();
8
+ ?>
9
+ <?php if(!$isSingleClickActive || ($isSingleClickActive && $isFirstOrder)): ?>
10
+ <div class="form-list">
11
+ <div class="field">
12
+ <label for="payment_params:card_numer" class="required"><em>*</em><?php echo $this->__('Card number'); ?></label>
13
+ <div class="input-box">
14
+ <input type="text" id="payment_params:card_numer" name="payment_params[card_number]" size="19" class="input-text required-entry">
15
+ </div>
16
+ </div>
17
+ <div class="field">
18
+ <label for="payment_params:name_on_card" class="required"><em>*</em><?php echo $this->__('Name on card'); ?></label>
19
+ <div class="input-box">
20
+ <input type="text" id="payment_params:name_on_card" name="payment_params[name_on_card]" size="50" class="input-text required-entry">
21
+ </div>
22
+ </div>
23
+ <div class="field">
24
+ <label for="payment_params:expiration_month" class="required"><em>*</em><?php echo $this->__('Expiration month'); ?></label>
25
+ <div class="input-box">
26
+ <select id="payment_params:expiration_month" name="payment_params[expiration_month]" class="required-entry">
27
+ <?php foreach($months as $month): ?>
28
+ <option value="<?php echo $month; ?>"><?php echo $month; ?></option>
29
+ <?php endforeach; ?>
30
+ </select>
31
+ </div>
32
+ </div>
33
+ <div class="field">
34
+ <label for="payment_params:expiration_year" class="required"><em>*</em><?php echo $this->__('Expiration year'); ?></label>
35
+ <div class="input-box">
36
+ <select id="payment_params:expiration_year" name="payment_params[expiration_year]" class="required-entry">
37
+ <?php foreach($years as $year): ?>
38
+ <option value="<?php echo $year; ?>"><?php echo $year; ?></option>
39
+ <?php endforeach; ?>
40
+ </select>
41
+ </div>
42
+ </div>
43
+ <div class="field">
44
+ <label for="payment_params:card_code" class="required"><em>*</em><?php echo $this->__('CVV/CVC'); ?></label>
45
+ <div class="input-box">
46
+ <input type="text" id="payment_params:card_code" name="payment_params[card_code]" size="4" class="input-text required-entry">
47
+ </div>
48
+ </div>
49
+ </div>
50
+ <?php else: ?>
51
+ <?php if($isAuthorized): ?>
52
+ <?php $authId = Mage::getModel('customer/customer')->load(Mage::getSingleton('customer/session')->getId())
53
+ ->getCardAuthorizationId();
54
+ ?>
55
+ <input type="hidden" id="payment_params:authorization_id" name="payment_params[authorization_id]" value="<?php echo $authId; ?>">
56
+ <?php echo $this->__('User authorized earlier - no additional data required'); ?>
57
+ <?php else: ?>
58
+ <?php $saleId = $this->getCustomerLastOrderPaylaneSaleId(); ?>
59
+ <input type="hidden" id="payment_params:sale_id" name="payment_params[sale_id]" value="<?php echo $saleId; ?>">
60
+ <?php echo $this->__('Using Single-click method - get card data from earlier order'); ?>
61
+ <?php endif; ?>
62
+ <?php endif;
app/design/frontend/base/default/template/paylane/payment/creditcard/form.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('paylane');
3
+ $months = $helper->generateMonthsNumber();
4
+ $years = $helper->generateCreditCardValidYears();
5
+ ?>
6
+ <div class="form-list">
7
+ <div class="field">
8
+ <label for="payment_params:card_numer" class="required"><em>*</em><?php echo $this->__('Card number'); ?></label>
9
+ <div class="input-box">
10
+ <input type="text" id="payment_params:card_numer" name="payment_params[card_number]" size="19" class="input-text required-entry">
11
+ </div>
12
+ </div>
13
+ <div class="field">
14
+ <label for="payment_params:name_on_card" class="required"><em>*</em><?php echo $this->__('Name on card'); ?></label>
15
+ <div class="input-box">
16
+ <input type="text" id="payment_params:name_on_card" name="payment_params[name_on_card]" size="50" class="input-text required-entry">
17
+ </div>
18
+ </div>
19
+ <div class="field">
20
+ <label for="payment_params:expiration_month" class="required"><em>*</em><?php echo $this->__('Expiration month'); ?></label>
21
+ <div class="input-box">
22
+ <select id="payment_params:expiration_month" name="payment_params[expiration_month]" class="required-entry">
23
+ <?php foreach($months as $month): ?>
24
+ <option value="<?php echo $month; ?>"><?php echo $month; ?></option>
25
+ <?php endforeach; ?>
26
+ </select>
27
+ </div>
28
+ </div>
29
+ <div class="field">
30
+ <label for="payment_params:expiration_year" class="required"><em>*</em><?php echo $this->__('Expiration year'); ?></label>
31
+ <div class="input-box">
32
+ <select id="payment_params:expiration_year" name="payment_params[expiration_year]" class="required-entry">
33
+ <?php foreach($years as $year): ?>
34
+ <option value="<?php echo $year; ?>"><?php echo $year; ?></option>
35
+ <?php endforeach; ?>
36
+ </select>
37
+ </div>
38
+ </div>
39
+ <div class="field">
40
+ <label for="payment_params:card_code" class="required"><em>*</em><?php echo $this->__('CVV/CVC'); ?></label>
41
+ <div class="input-box">
42
+ <input type="text" id="payment_params:card_code" name="payment_params[card_code]" size="4" class="input-text required-entry">
43
+ </div>
44
+ </div>
45
+ </div>
app/design/frontend/base/default/template/paylane/payment/directdebit.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="form-list">
2
+ <div class="field">
3
+ <label for="payment_params:account_holder" class="required"><em>*</em><?php echo $this->__('Account holder'); ?></label>
4
+ <div class="input-box">
5
+ <input type="text" id="payment_params:account_holder" name="payment_params[account_holder]" size="30" class="input-text required-entry">
6
+ </div>
7
+ </div>
8
+ <div class="field">
9
+ <label for="payment_params:account_country" class="required"><em>*</em><?php echo $this->__('Bank account country'); ?></label>
10
+ <div class="input-box">
11
+ <input type="text" id="payment_params:account_country" name="payment_params[account_country]" size="2" class="input-text required-entry">
12
+ </div>
13
+ </div>
14
+ <div class="field">
15
+ <label for="payment_params:iban" class="required"><em>*</em><?php echo $this->__('IBAN Number'); ?></label>
16
+ <div class="input-box">
17
+ <input type="text" id="payment_params:iban" name="payment_params[iban]" size="31" class="input-text required-entry">
18
+ </div>
19
+ </div>
20
+ <div class="field">
21
+ <label for="payment_params:bic" class="required"><em>*</em><?php echo $this->__('Bank Identifier Code (BIC)'); ?></label>
22
+ <div class="input-box">
23
+ <input type="text" id="payment_params:bic" name="payment_params[bic]" size="4" class="input-text required-entry">
24
+ </div>
25
+ </div>
26
+ <div class="field">
27
+ <label for="payment_params:mandate_id" class="required"><em>*</em><?php echo $this->__('Mandate ID'); ?></label>
28
+ <div class="input-box">
29
+ <input type="text" id="payment_params:mandate_id" name="payment_params[mandate_id]" size="35" class="input-text required-entry">
30
+ </div>
31
+ </div>
32
+ </div>
app/design/frontend/base/default/template/paylane/payment/ideal.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Endora_PayLane_Block_Payment_Ideal
4
+ */
5
+
6
+ $bankData = $this->getBankCodes();
7
+ ?>
8
+ <div class="form-list">
9
+ <div class="field">
10
+ <label for="payment_params:bank_code" class="required"><em>*</em><?php echo $this->__('Choose bank'); ?></label>
11
+ <div class="input-box">
12
+ <select id="payment_params:bank_code" name="payment_params[bank_code]">
13
+ <?php
14
+ foreach ($bankData as $bank) {
15
+ echo sprintf('<option value="%s">%s</option>', $bank['bank_code'], $bank['bank_name']), "\n";
16
+ }
17
+ ?>
18
+ </select>
19
+ </div>
20
+ </div>
21
+ </div>
app/design/frontend/base/default/template/paylane/payment/paypal.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->__('You will be redirected to PayPal website to pay for the order');
app/design/frontend/base/default/template/paylane/payment/secureform.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->__('You will be redirected to PayLane Secure Form to pay for the order'); ?>
app/design/frontend/base/default/template/paylane/payment/sofort.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->__('You will be redirected to SOFORT website to pay for the order');
app/design/frontend/base/default/template/paylane/redirect.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Allows redirect to Secure Form
4
+ *
5
+ * @see http://devzone.paylane.pl/secure-form/
6
+ * @author Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
7
+ */
8
+ ?>
9
+ <html><body>
10
+ <?php echo $this->getFormHtml(); ?>
11
+ <script type="text/javascript">document.getElementById("paylane_checkout_secureform").submit();</script>
12
+ </body></html>
app/etc/modules/Endora_PayLane.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Endora_PayLane>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Endora_PayLane>
8
+ </modules>
9
+ </config>
app/locale/pl_PL/Endora_PayLane.csv ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Order #%s, %s (%s)","Zamówienie numer %s, %s (%s)"
2
+ "There was an error in payment process via PayLane module (Error ID: %s , Error code: %s, Error text: %s)","Wystąpił błąd w procesie płatności przez moduł PayLane (ID błędu: %s, kod błędu %s, treść błędu: %s)"
3
+ "There was an error in payment process via PayLane module (Error code: %s, Error text: %s)","Wystąpił błąd w procesie płatności przez moduł PayLane (kod błędu %s, treść błędu: %s)"
4
+ "Payment handled via PayLane module | Transaction ID: %s","Płatność została obsłużona przez moduł PayLane | ID transakcji: %s"
5
+ "You will be redirected to PayLane Secure Form to pay for the order","W celu opłacenia zamówienia zostaniesz przekierowany na stronę PayLane"
6
+ "Choose payment method","Wybierz metodę płatności"
7
+ "Choose payment type","Wybierz typ płatności"
8
+ "Method","Metoda płatności"
9
+ "Payment channel","Kanał płatności"
10
+ "Choose bank","Wybierz bank"
11
+ "Chosen bank","Wybrany bank"
12
+ "Bank transfer","Przelew bankowy"
13
+ "Other","Inny"
14
+ "Notifications settings","Ustawienia powiadomień"
15
+ "Manual","Ręczny"
16
+ "Automatic","Automatyczny"
17
+ "Notification mode","Tryb powiadamiania"
18
+ "Check notifications interval","Interwał sprawdzania powiadomień"
19
+ "Username","Nazwa użytkownika"
20
+ "Password","Hasło"
21
+ "Place number of minutes","Wprowadź liczbę minut"
22
+ "Credit card","Karta kredytowa"
23
+ "Order status changed via PayLane module","Status zamówienia został zmieniony przez moduł PayLane"
24
+ "Enable this solution","Moduł aktywny"
25
+ "Title","Tytuł"
26
+ "Sort order","Porządek sortowania"
27
+ "Gateway type","Typ bramki płatności"
28
+ "Enable logging","Logowanie aktywne"
29
+ "Log will be able in /var/log/paylane-notifications.log","Plik logów będzie dostępny w /var/log/paylane-notifications.log"
30
+ "Hash salt","Sól hashu"
31
+ "URL that handles automatic notifications","URL do obsługi automatycznych powiadomień"
32
+ "Notification Token","Token dla powiadomień"
33
+ "If you want to handle automatic notifications in your store, you have to inform PayLane support about that URL","Jeśli chcesz korzystać z automatycznych powiadomień musisz poinformować PayLane o tym adresie URL"
34
+ "Pending Order Status","Status oczekującego zamówienia (Pending)"
35
+ "Performed Order Status","Status przetwarzanego zamówienia (Performed)"
36
+ "Cleared Order Status","Status obsłużonego zamówienia (Cleared)"
37
+ "Error Order Status","Status błędnego zamówienia (Error)"
38
+ "Redirect version","Wersja przekierowania"
39
+ "Merchant ID","ID Sprzedawcy"
40
+ "Send Customer Data","Wysyłaj dane klienta"
41
+ "API Key","Klucz API"
42
+ "Overwrite Fraud check?","Napisywać kontrolę oszustw?"
43
+ "Overwrite AVS check level?","Nadpisywać poziom wyboru AVS?"
44
+ "Fraud check","Kontrola oszustw"
45
+ "AVS check level","Poziom wyboru AVS"
46
+ "Enable Single-click payment","Aktywuj płatności typu Single-click"
47
+ "Blocked amount in authorization process","Kwota blokowana podczas procesu autoryzacji"
48
+ "3DS check","Sprawdzenie 3DS"
49
+ "Get from <a href=""http://merchant.paylane.com"" target=""_blank"">http://merchant.paylane.com</a>","Dane dostępne na stronie <a href=""http://merchant.paylane.com"" target=""_blank"">http://merchant.paylane.com</a>"
50
+ "See <a href=""http://devzone.paylane.pl/powiadomienia-o-transakcjach/"" target=""_blank"">http://devzone.paylane.pl/powiadomienia-o-transakcjach/</a> for more information","Po więcej informacji odwiedź stronę <a href=""http://devzone.paylane.pl/powiadomienia-o-transakcjach/"" target=""_blank"">http://devzone.paylane.pl/powiadomienia-o-transakcjach/</a>"
51
+ "Optional, can be configured in <a href=""http://merchant.paylane.com"" target=""_blank"">Merchant Panel</a>","Opcjonalne, można skonfigurować w <a href=""http://merchant.paylane.com"" target=""_blank"">Panelu Sprzedawcy</a>"
52
+ "Send additional customer data while redirecting to SecureForm","Wysyłaj dodatkowe dane o kliencie podczas przekierowania do SecureForm"
53
+ "Be sure that you can do a overwrite - you can check it in your <a href=""http://merchant.paylane.com"" target=""_blank"">Merchant Panel</a>","Sprawdź czy masz możliwość nadpisywania tego ustawienia - informacja taka dostępna jest w <a href=""http://merchant.paylane.com"" target=""_blank"">Panelu Sprzedawcy</a>"
54
+ "More info about Single click available at <a href=""http://devzone.paylane.pl/api/karty/platnosci-single-click/"" target=""_blank"">http://devzone.paylane.pl/api/karty/platnosci-single-click/</a>","Więcej informacji o płatnościach Single-click dostępnych na stronie <a href=""http://devzone.paylane.pl/api/karty/platnosci-single-click/"" target=""_blank"">http://devzone.paylane.pl/api/karty/platnosci-single-click/</a>"
55
+ "Set in default store currency","Podaj kwotę w domyślnej walucie sklepu"
56
+ "Notification username","Użytkownik dla powiadomień"
57
+ "Notification password","Hasło dla powiadomień"
58
+ "API Username","Użytkownik API"
59
+ "API Password","Hasło API"
lib/paylane/client/paylane/PayLaneRestClient.php ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Client library for Paylane REST Server.
5
+ * More info at http://devzone.paylane.com
6
+ */
7
+ class PayLaneRestClient
8
+ {
9
+ /**
10
+ * @var string
11
+ */
12
+ protected $api_url = 'https://direct.paylane.com/rest/';
13
+
14
+ /**
15
+ * @var string
16
+ */
17
+ protected $username = null, $password = null;
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $http_errors = array
23
+ (
24
+ 400 => '400 Bad Request',
25
+ 401 => '401 Unauthorized',
26
+ 500 => '500 Internal Server Error',
27
+ 501 => '501 Not Implemented',
28
+ 502 => '502 Bad Gateway',
29
+ 503 => '503 Service Unavailable',
30
+ 504 => '504 Gateway Timeout',
31
+ );
32
+
33
+ /**
34
+ * @var bool
35
+ */
36
+ protected $is_success = false;
37
+
38
+ /**
39
+ * @var array
40
+ */
41
+ protected $allowed_request_methods = array(
42
+ 'get',
43
+ 'put',
44
+ 'post',
45
+ 'delete',
46
+ );
47
+
48
+ /**
49
+ * @var boolean
50
+ */
51
+ protected $ssl_verify = true;
52
+
53
+ /**
54
+ * Constructor
55
+ *
56
+ * @param string $username Username
57
+ * @param string $password Password
58
+ */
59
+ public function __construct($username, $password)
60
+ {
61
+ $this->username = $username;
62
+ $this->password = $password;
63
+
64
+ $validate_params = array
65
+ (
66
+ false === extension_loaded('curl') => 'The curl extension must be loaded for using this class!',
67
+ false === extension_loaded('json') => 'The json extension must be loaded for using this class!'
68
+ );
69
+ $this->checkForErrors($validate_params);
70
+ }
71
+
72
+ /**
73
+ * Set Api URL
74
+ *
75
+ * @param string $url Api URL
76
+ */
77
+ public function setUrl($url)
78
+ {
79
+ $this->api_url = $url;
80
+ }
81
+
82
+ /**
83
+ * Sets SSL verify
84
+ *
85
+ * @param bool $ssl_verify SSL verify
86
+ */
87
+ public function setSSLverify($ssl_verify)
88
+ {
89
+ $this->ssl_verify = $ssl_verify;
90
+ }
91
+
92
+ /**
93
+ * Request state getter
94
+ *
95
+ * @return bool
96
+ */
97
+ public function isSuccess()
98
+ {
99
+ return $this->is_success;
100
+ }
101
+
102
+ /**
103
+ * Performs card sale
104
+ *
105
+ * @param array $params Sale Params
106
+ * @return array
107
+ */
108
+ public function cardSale($params)
109
+ {
110
+ return $this->call(
111
+ 'cards/sale',
112
+ 'post',
113
+ $params
114
+ );
115
+ }
116
+
117
+ /**
118
+ * Performs card sale by token
119
+ *
120
+ * @param array $params Sale Params
121
+ * @return array
122
+ */
123
+ public function cardSaleByToken($params)
124
+ {
125
+ return $this->call(
126
+ 'cards/saleByToken',
127
+ 'post',
128
+ $params
129
+ );
130
+ }
131
+
132
+ /**
133
+ * Card authorization
134
+ *
135
+ * @param array $params Authorization params
136
+ * @return array
137
+ */
138
+ public function cardAuthorization($params)
139
+ {
140
+ return $this->call(
141
+ 'cards/authorization',
142
+ 'post',
143
+ $params
144
+ );
145
+ }
146
+
147
+ /**
148
+ * Card authorization by token
149
+ *
150
+ * @param array $params Authorization params
151
+ * @return array
152
+ */
153
+ public function cardAuthorizationByToken($params)
154
+ {
155
+ return $this->call(
156
+ 'cards/authorizationByToken',
157
+ 'post',
158
+ $params
159
+ );
160
+ }
161
+
162
+ /**
163
+ * PayPal authorization
164
+ *
165
+ * @param $params
166
+ * @return array
167
+ */
168
+ public function paypalAuthorization($params)
169
+ {
170
+ return $this->call(
171
+ 'paypal/authorization',
172
+ 'post',
173
+ $params
174
+ );
175
+ }
176
+
177
+ /**
178
+ * Performs capture from authorized card
179
+ *
180
+ * @param array $params Capture authorization params
181
+ * @return array
182
+ */
183
+ public function captureAuthorization($params)
184
+ {
185
+ return $this->call(
186
+ 'authorizations/capture',
187
+ 'post',
188
+ $params
189
+ );
190
+ }
191
+
192
+ /**
193
+ * Performs closing of card authorization, basing on authorization card ID
194
+ *
195
+ * @param array $params Close authorization params
196
+ * @return array
197
+ */
198
+ public function closeAuthorization($params)
199
+ {
200
+ return $this->call(
201
+ 'authorizations/close',
202
+ 'post',
203
+ $params
204
+ );
205
+ }
206
+
207
+ /**
208
+ * Performs refund
209
+ *
210
+ * @param array $params Refund params
211
+ * @return array
212
+ */
213
+ public function refund($params)
214
+ {
215
+ return $this->call(
216
+ 'refunds',
217
+ 'post',
218
+ $params
219
+ );
220
+ }
221
+
222
+ /**
223
+ * Get sale info
224
+ *
225
+ * @param array $params Get sale info params
226
+ * @return array
227
+ */
228
+ public function getSaleInfo($params)
229
+ {
230
+ return $this->call(
231
+ 'sales/info',
232
+ 'get',
233
+ $params
234
+ );
235
+ }
236
+
237
+ /**
238
+ * Get sale authorization info
239
+ *
240
+ * @param array $params Get sale authorization info params
241
+ * @return array
242
+ */
243
+ public function getAuthorizationInfo($params)
244
+ {
245
+ return $this->call(
246
+ 'authorizations/info',
247
+ 'get',
248
+ $params
249
+ );
250
+ }
251
+
252
+ /**
253
+ * Performs sale status check
254
+ *
255
+ * @param array $params Check sale status
256
+ * @return array
257
+ */
258
+ public function checkSaleStatus($params)
259
+ {
260
+ return $this->call(
261
+ 'sales/status',
262
+ 'get',
263
+ $params
264
+ );
265
+ }
266
+
267
+ /**
268
+ * Direct debit sale
269
+ *
270
+ * @param array $params Direct debit params
271
+ * @return array
272
+ */
273
+ public function directDebitSale($params)
274
+ {
275
+ return $this->call(
276
+ 'directdebits/sale',
277
+ 'post',
278
+ $params
279
+ );
280
+ }
281
+
282
+ /**
283
+ * Sofort sale
284
+ *
285
+ * @param array $params Sofort params
286
+ * @return array
287
+ */
288
+ public function sofortSale($params)
289
+ {
290
+ return $this->call(
291
+ 'sofort/sale',
292
+ 'post',
293
+ $params
294
+ );
295
+ }
296
+
297
+ /**
298
+ * iDeal sale
299
+ *
300
+ * @param $params iDeal transaction params
301
+ * @return array
302
+ */
303
+ public function idealSale($params)
304
+ {
305
+ return $this->call(
306
+ 'ideal/sale',
307
+ 'post',
308
+ $params
309
+ );
310
+ }
311
+
312
+ /**
313
+ * iDeal banks list
314
+ *
315
+ * @return array
316
+ */
317
+ public function idealBankCodes()
318
+ {
319
+ return $this->call(
320
+ 'ideal/bankcodes',
321
+ 'get',
322
+ array()
323
+ );
324
+ }
325
+
326
+ /**
327
+ * Bank transfer sale
328
+ *
329
+ * @param array $params Bank transfer sale params
330
+ * @return array
331
+ */
332
+ public function bankTransferSale($params)
333
+ {
334
+ return $this->call(
335
+ 'banktransfers/sale',
336
+ 'post',
337
+ $params
338
+ );
339
+ }
340
+
341
+ /**
342
+ * PayPal sale
343
+ *
344
+ * @param array $params Paypal sale params
345
+ * @return array
346
+ */
347
+ public function paypalSale($params)
348
+ {
349
+ return $this->call(
350
+ 'paypal/sale',
351
+ 'post',
352
+ $params
353
+ );
354
+ }
355
+
356
+ /**
357
+ * Cancels Paypal recurring profile
358
+ *
359
+ * @param array $params Paypal params
360
+ * @return array
361
+ */
362
+ public function paypalStopRecurring($params)
363
+ {
364
+ return $this->call('paypal/stopRecurring',
365
+ 'post',
366
+ $params
367
+ );
368
+ }
369
+
370
+ /**
371
+ * Performs resale by sale ID
372
+ *
373
+ * @param array $params Resale by sale params
374
+ * @return array
375
+ */
376
+ public function resaleBySale($params)
377
+ {
378
+ return $this->call(
379
+ 'resales/sale',
380
+ 'post',
381
+ $params
382
+ );
383
+ }
384
+
385
+ /**
386
+ * Performs resale by authorization ID
387
+ *
388
+ * @param array $params Resale by authorization params
389
+ * @return array
390
+ */
391
+ public function resaleByAuthorization($params)
392
+ {
393
+ return $this->call(
394
+ 'resales/authorization',
395
+ 'post',
396
+ $params
397
+ );
398
+ }
399
+
400
+ /**
401
+ * Checks if a card is enrolled in the 3D-Secure program.
402
+ *
403
+ * @param array $params Is card 3d secure params
404
+ * @return array
405
+ */
406
+ public function checkCard3DSecure($params)
407
+ {
408
+ return $this->call(
409
+ '3DSecure/checkCard',
410
+ 'get',
411
+ $params
412
+ );
413
+ }
414
+
415
+ /**
416
+ * Checks if a card is enrolled in the 3D-Secure program, based on the card's token.
417
+ *
418
+ * @param array $params Is card 3d secure params
419
+ * @return array
420
+ */
421
+ public function checkCard3DSecureByToken($params)
422
+ {
423
+ return $this->call(
424
+ '3DSecure/checkCardByToken',
425
+ 'get',
426
+ $params
427
+ );
428
+ }
429
+
430
+ /**
431
+ * Performs sale by ID 3d secure authorization
432
+ *
433
+ * @param array $params Sale by 3d secure authorization params
434
+ * @return array
435
+ */
436
+ public function saleBy3DSecureAuthorization($params)
437
+ {
438
+ return $this->call(
439
+ '3DSecure/authSale',
440
+ 'post',
441
+ $params
442
+ );
443
+ }
444
+
445
+ /**
446
+ * Perform check card
447
+ *
448
+ * @param array $params Check card params
449
+ * @return array
450
+ */
451
+ public function checkCard($params)
452
+ {
453
+ return $this->call(
454
+ 'cards/check',
455
+ 'get',
456
+ $params
457
+ );
458
+ }
459
+
460
+ /**
461
+ * Perform check card by token
462
+ *
463
+ * @param array $params Check card params
464
+ * @return array
465
+ */
466
+ public function checkCardByToken($params)
467
+ {
468
+ return $this->call(
469
+ 'cards/checkByToken',
470
+ 'get',
471
+ $params
472
+ );
473
+ }
474
+
475
+ /**
476
+ * Method responsible for preparing, setting state and returning answer from rest server
477
+ *
478
+ * @param string $method
479
+ * @param string $request
480
+ * @param array $params
481
+ * @return array
482
+ */
483
+ protected function call($method, $request, $params)
484
+ {
485
+ $this->is_success = false;
486
+
487
+ if (is_object($params))
488
+ {
489
+ $params = (array) $params;
490
+ }
491
+
492
+ $validate_params = array
493
+ (
494
+ false === is_string($method) => 'Method name must be string',
495
+ false === $this->checkRequestMethod($request) => 'Not allowed request method type',
496
+ );
497
+
498
+ $this->checkForErrors($validate_params);
499
+
500
+ $params_encoded = json_encode($params);
501
+
502
+ $response = $this->pushData($method, $request, $params_encoded);
503
+
504
+ $response = json_decode($response, true);
505
+
506
+ if (isset($response['success']) && $response['success'] === true)
507
+ {
508
+ $this->is_success = true;
509
+ }
510
+
511
+ return $response;
512
+ }
513
+
514
+ /**
515
+ * Checking error mechanism
516
+ *
517
+ * @param array $validate_params
518
+ * @throws \Exception
519
+ */
520
+ protected function checkForErrors($validate_params)
521
+ {
522
+ foreach ($validate_params as $key => $error)
523
+ {
524
+ if ($key)
525
+ {
526
+ throw new \Exception($error);
527
+ }
528
+ }
529
+ }
530
+
531
+ /**
532
+ * Check if method is allowed
533
+ *
534
+ * @param string $method_type
535
+ * @return bool
536
+ */
537
+ protected function checkRequestMethod($method_type)
538
+ {
539
+ $request_method = strtolower($method_type);
540
+
541
+ if(in_array($request_method, $this->allowed_request_methods))
542
+ {
543
+ return true;
544
+ }
545
+
546
+ return false;
547
+ }
548
+
549
+ /**
550
+ * Method responsible for pushing data to REST server
551
+ *
552
+ * @param string $method
553
+ * @param string $method_type
554
+ * @param string $request - JSON
555
+ * @return array
556
+ * @throws \Exception
557
+ */
558
+ protected function pushData($method, $method_type, $request)
559
+ {
560
+ $ch = curl_init();
561
+
562
+ curl_setopt($ch, CURLOPT_URL, $this->api_url . $method);
563
+ curl_setopt($ch, CURLOPT_POST, 1);
564
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
565
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
566
+ curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
567
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method_type));
568
+ curl_setopt($ch, CURLOPT_HTTPAUTH, 1);
569
+ curl_setopt($ch, CURLOPT_USERPWD, $this->username . ':' . $this->password);
570
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
571
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->ssl_verify);
572
+
573
+ $response = curl_exec($ch);
574
+
575
+ $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
576
+
577
+ if (isset($this->http_errors[$http_code]))
578
+ {
579
+ throw new \Exception('Response Http Error - ' . $this->http_errors[$http_code]);
580
+ }
581
+
582
+ if (0 < curl_errno($ch))
583
+ {
584
+ throw new \Exception('Unable to connect to ' . $this->api_url . ' Error: ' . curl_error($ch));
585
+ }
586
+
587
+ curl_close($ch);
588
+
589
+ return $response;
590
+ }
591
+ }
package.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Endora_PayLane2</name>
4
+ <version>0.1.0</version>
5
+ <stability>beta</stability>
6
+ <license uri="http://opensource.org/licenses/MIT">Massachusetts Institute of Technology License (MITL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension allows you to add PayLane as a new payment method in Magento</summary>
10
+ <description>The extension adds a new payment method to your shop which gives your customers the possibility to use PayLane system to pay for their orders.&#xD;
11
+ It allows to use recurring payments, credit card authorization, single-click payments and much more.&#xD;
12
+ If you are interested in technical support, e-mail us at it@paylane.com or magento@endora.pl.</description>
13
+ <notes>- Add credit card payment channel&#xD;
14
+ - Add PayPal payment channel&#xD;
15
+ - Add iDEAL payment channel&#xD;
16
+ - Add bank transfer payment channel&#xD;
17
+ - Add SOFORT Banking payment channel&#xD;
18
+ - Add Direct Debit payment channel&#xD;
19
+ - Implement automatic notifications about payments&#xD;
20
+ - Allow credit card authorization&#xD;
21
+ - Add recurring payments component</notes>
22
+ <authors><author><name>ENDORA</name><user>EndoraPL</user><email>magento@endora.pl</email></author><author><name>PayLane</name><user>PayLane</user><email>it@paylane.com</email></author></authors>
23
+ <date>2015-10-14</date>
24
+ <time>07:03:34</time>
25
+ <contents><target name="magecommunity"><dir name="Endora"><dir name="PayLane"><dir name="Block"><dir name="Adminhtml"><dir name="Notification"><file name="Url.php" hash="b491c97ac7ca8060126955b8bfde3223"/></dir></dir><dir name="Customer"><file name="Account.php" hash="08f9172d3c0a67efa0224ab88e4a8a08"/></dir><file name="Form.php" hash="06be776bf1aa2bc9eb05102951d8f0e7"/><file name="Info.php" hash="09e95490e5e3ac986c3310dbe48836ba"/><dir name="Payment"><file name="BankTransfer.php" hash="14a260bf8d26801feafedcf58d100d0d"/><file name="CreditCard.php" hash="cab7f3675d88aaa94c3646b561eddd7d"/><file name="DirectDebit.php" hash="65293319e7cc9ea66db5cf389e093cc2"/><file name="Ideal.php" hash="b79f7a64a62814f9aa2cf58faa354e0d"/><file name="PayPal.php" hash="ba9d7453188615938cec8fbc721c4729"/><file name="SecureForm.php" hash="cf9535309d7cd742524b331b7199f78b"/><file name="Sofort.php" hash="aaf6ce265b89185d56eb8742834a0771"/></dir><file name="Redirect.php" hash="7704b9996a4ce1526870d43c3b3cb045"/></dir><dir name="Helper"><file name="Data.php" hash="352b449e21882b12cb84d49756ced739"/><file name="Notification.php" hash="c251b24d81ccce3701f7241a9fe5b4b5"/></dir><dir name="Model"><dir name="Api"><file name="Client.php" hash="4a740e7950563688add55d2238573c64"/><file name="Notification.php" hash="de4044b032810219bc56cb93fc89c4a0"/><dir name="Payment"><file name="BankTransfer.php" hash="f23a8788efe83350717990f17aa607d1"/><file name="CreditCard.php" hash="a65a6dfffa6345bf7980cd678a3ed200"/><file name="DirectDebit.php" hash="3e8975b991bd5821a514a54a734b1132"/><file name="Ideal.php" hash="58e404bf763488a5cdfdfe5466fecb20"/><file name="PayPal.php" hash="90bfc3fb0c111373513a6ba25997839f"/><file name="SecureForm.php" hash="f2e53045afaf4ec90040673619ac1c0c"/><file name="Sofort.php" hash="06b840e2728d0393c75dd9e148caa4d6"/><dir name="Type"><file name="Abstract.php" hash="da38cad3a485bb714a547f949d313e90"/></dir></dir><file name="Refund.php" hash="c9535f2cf997dabbf3b5a828614530d8"/><file name="Resale.php" hash="59017bfede23168a8d1d0ffbe7f03fd0"/></dir><dir name="Interface"><file name="PaymentTypeExtendedInfo.php" hash="f005bc12af5050eda938a2f5a80236ad"/></dir><file name="Observer.php" hash="4ad654b32b9112a9c68a40bfe915389a"/><file name="Payment.php" hash="eb9ff93443f4af87e28e1036cdfe2d3e"/><dir name="Resource"><file name="Setup.php" hash="2f425d97cb103e7a1204464874c71283"/></dir><dir name="Source"><dir name="Avs"><dir name="Check"><file name="Level.php" hash="f76217494c46a5818035f88f050031e0"/></dir></dir><dir name="Gateway"><file name="Type.php" hash="ca8618440dfdccd1d80902ab537deb64"/></dir><dir name="Notification"><file name="Mode.php" hash="4a908cfc0dddb86c4fa48c0624e5390e"/></dir><dir name="Order"><file name="Status.php" hash="b85eb3793a9d8eede03c958793737d7e"/></dir><dir name="Redirect"><file name="Version.php" hash="fc24a211a510b8103c5be2f9d08e7417"/></dir></dir></dir><dir name="controllers"><file name="CustomerController.php" hash="b41789b114e929a5d52a437d61388a00"/><file name="NotificationController.php" hash="5ec895288f43914b6ace5d877cb5f540"/><file name="PaymentController.php" hash="d60ed9bccb6185d67834a311846b3fa9"/></dir><dir name="etc"><file name="config.xml" hash="d81a32d6021499ac6b53844e23b88293"/><file name="system.xml" hash="d33e8cd088730d30baee95b0c766810e"/></dir><dir name="sql"><dir name="paylane_setup"><file name="install-0.1.0.php" hash="a23c9f7d3284978bd0669ae444aedc3b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Endora_PayLane.xml" hash="21f68dbfe96b2045ab9b5e1a6c2e52f7"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="paylane"><file name="form.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="info.phtml" hash="75e1c24c1080f58b9fc5d0aa9f4db5e1"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="paylane.xml" hash="36f7e64d3e49a389e3494fe8ae093224"/></dir><dir name="template"><dir name="paylane"><dir name="customer"><file name="account.phtml" hash="4304270ba499911e68ded48bce15560c"/></dir><file name="empty.phtml" hash="45d25a0ef85fa6de271e61a9d76db4c5"/><file name="form.phtml" hash="1505a077aa777b6de124bf493639399a"/><file name="info.phtml" hash="00b405c4f6f8e23e086e1ba2100059b1"/><dir name="payment"><file name="banktransfer.phtml" hash="c6c49d9eab6261269990e7ff0f6bfe04"/><dir name="creditcard"><file name="form.phtml" hash="5ccd16ebdf4a4dd3d66586c8f36db00d"/></dir><file name="creditcard.phtml" hash="dd37d0b8ae1a5d4f3c1e5d34ad935273"/><file name="directdebit.phtml" hash="94e2a1c3139a8fc8675c183d1e85db56"/><file name="ideal.phtml" hash="771945c3f9b07505390754f762819be2"/><file name="paypal.phtml" hash="18aff72598fc73b80b223cccb0a1d713"/><file name="secureform.phtml" hash="8cfd06e9b48f16bdbe9037c364a3e5d8"/><file name="sofort.phtml" hash="a0c661e5d92b01602188dec75927c829"/></dir><file name="redirect.phtml" hash="7f891fad1eb61edcc33b3cf9f54a3911"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="paylane"><file name="style.css" hash="586293871591cf1bb458c855b4a3b457"/></dir></dir></dir></dir></target><target name="magelib"><dir name="paylane"><dir name="client"><dir name="paylane"><file name="PayLaneRestClient.php" hash="b63633cb8349c53db85af6d12dc60533"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="pl_PL"><file name="Endora_PayLane.csv" hash="e20e9bb29fab8d6348c8c8e8f89270cf"/></dir></dir></target></contents>
26
+ <compatible/>
27
+ <dependencies><required><php><min>5.0.0</min><max>5.6.8</max></php></required></dependencies>
28
+ </package>
skin/frontend/base/default/paylane/style.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Created on : 2015-06-12, 22:23:32
3
+ Author : Michał Zabielski <michal.zabielski@endora.pl> http://www.endora.pl
4
+ */
5
+ .clearfix {
6
+ clear: both;
7
+ }
8
+
9
+ .paylane-payment-container {
10
+ display: none;
11
+ }
12
+
13
+ .paylane-payment-method-container-title {
14
+ margin-top: 20px;
15
+ font-weight: bold;
16
+ }
17
+
18
+ .paylane-payment-method-container ul li {
19
+ float: left;
20
+ width: 50%;
21
+ }
22
+
23
+ #paylane-payment-method-additional-container {
24
+ /*display: none;*/
25
+ margin-top: 10px;
26
+ }
27
+
28
+ .payment-types-list li {
29
+ float: left;
30
+ width: 25%;
31
+ }
32
+
33
+ .paylane-payment-info {
34
+ font-family: Georgia, Times, "Times New Roman", serif;
35
+ font-size: 13px;
36
+ }