multon_everypay - Version 1.2.4

Version Notes

1.2.4
link jquery in header, iframe changes

1.2.3
New log
No redirect after failed payment

1.2.2
NEW: Live/Test url selection, separate credentials

1.2.1
NEW: Support iframe payment form

1.2.0
API protocol update
FIX: remove SID from callback_url

1.1.1
Use billing address if shipping address not present (downloadable products)

1.1.0
Converted to stand-alone community extension

1.0.6
Description and contact info

1.0.5
API protocol update: separated fail/cancelled transaction status

1.0.4
API protocol update

1.0.3
add account id

1.0.2
FIX: return url
FIX: return verification
new gateway url

1.0.1
FIX: redirect template

1.0.0
Stable release

Download this release

Release Info

Developer Multon
Extension multon_everypay
Version 1.2.4
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.4

app/code/community/Multon/Everypay/Block/Everypay.php CHANGED
@@ -28,7 +28,7 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
28
  */
29
  public function getMethodLogoUrl()
30
  {
31
- return $this->getSkinUrl('images/multon/everypay/mastercard_visa_acceptance.jpg');
32
  }
33
 
34
  /**
@@ -38,7 +38,7 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
38
  */
39
  public function getMethodLabelAfterHtml()
40
  {
41
- if (Mage::getStoreConfig('payment/' . $this->_code . '/hide_logo'))
42
  return '';
43
 
44
  $blockHtml = sprintf(
@@ -99,10 +99,15 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
99
  if (!$shipping)
100
  $shipping = $billing;
101
 
 
 
 
 
 
102
  $fields = array(
103
  'account_id' => Mage::getStoreConfig('payment/' . $this->_code . '/account_id'),
104
  'amount' => number_format($order->getTotalDue(), 2, '.', ''),
105
- 'api_username' => Mage::getStoreConfig('payment/' . $this->_code . '/api_username'),
106
  'billing_address' => $billing->getStreetFull(),
107
  'billing_city' => $billing->getCity(),
108
  'billing_country' => $billing->getCountry(),
@@ -125,6 +130,8 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
125
 
126
  $fields['hmac'] = $this->signData($this->prepareData($fields));
127
  $fields['locale'] = $language;
 
 
128
 
129
  // Mage::log(print_r($fields, 1), null, $this->logFile);
130
 
@@ -170,7 +177,11 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
170
 
171
  protected function signData($data)
172
  {
173
- return hash_hmac('sha1', $data, Mage::getStoreConfig('payment/' . $this->_code . '/api_secret'));
 
 
 
 
174
  }
175
 
176
  }
28
  */
29
  public function getMethodLogoUrl()
30
  {
31
+ return $this->getSkinUrl('images/multon/everypay/mastercard_visa_acceptance.png');
32
  }
33
 
34
  /**
38
  */
39
  public function getMethodLabelAfterHtml()
40
  {
41
+ if (!Mage::getStoreConfig('payment/' . $this->_code . '/show_logo'))
42
  return '';
43
 
44
  $blockHtml = sprintf(
99
  if (!$shipping)
100
  $shipping = $billing;
101
 
102
+ if ($this->getGatewayUrl() == Multon_Everypay_Model_Source_ApiUrl::$urlList['LIVE'])
103
+ $username = Mage::getStoreConfig('payment/' . $this->_code . '/api_username');
104
+ else
105
+ $username = Mage::getStoreConfig('payment/' . $this->_code . '/api_username_test');
106
+
107
  $fields = array(
108
  'account_id' => Mage::getStoreConfig('payment/' . $this->_code . '/account_id'),
109
  'amount' => number_format($order->getTotalDue(), 2, '.', ''),
110
+ 'api_username' => $username,
111
  'billing_address' => $billing->getStreetFull(),
112
  'billing_city' => $billing->getCity(),
113
  'billing_country' => $billing->getCountry(),
130
 
131
  $fields['hmac'] = $this->signData($this->prepareData($fields));
132
  $fields['locale'] = $language;
133
+ if (Mage::getStoreConfig('payment/multon_everypay/connection_type'))
134
+ $fields['skin_name'] = Mage::getStoreConfig('payment/multon_everypay/skin_name');
135
 
136
  // Mage::log(print_r($fields, 1), null, $this->logFile);
137
 
177
 
178
  protected function signData($data)
179
  {
180
+ if ($this->getGatewayUrl() == Multon_Everypay_Model_Source_ApiUrl::$urlList['LIVE'])
181
+ $secret = Mage::getStoreConfig('payment/' . $this->_code . '/api_secret');
182
+ else
183
+ $secret = Mage::getStoreConfig('payment/' . $this->_code . '/api_secret_test');
184
+ return hash_hmac('sha1', $data, $secret);
185
  }
186
 
187
  }
app/code/community/Multon/Everypay/Model/Everypay.php CHANGED
@@ -10,7 +10,6 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
10
  protected $_isGateway = true;
11
  protected $_canUseCheckout = true;
12
  protected $logFile = 'everypay.log';
13
-
14
  protected $_code = 'multon_everypay';
15
  protected $_formBlockType = 'everypay/everypay';
16
  private $statuses = array(
@@ -43,7 +42,17 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
43
 
44
  // $this->log($data, __METHOD__, __LINE__);
45
 
46
- $hmac = hash_hmac('sha1', substr($data, 0, -1), Mage::getStoreConfig('payment/' . $this->_code . '/api_secret'));
 
 
 
 
 
 
 
 
 
 
47
  if ($params['hmac'] != $hmac)
48
  {
49
  $this->log('(Everypay) Invalid HMAC (Expected: ' . $hmac . ')', __METHOD__, __LINE__);
@@ -65,7 +74,7 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
65
  // $this->log('(Everypay) Warnings: ' . print_r($warnings, 1), __METHOD__, __LINE__);
66
  // }
67
 
68
- if (!isset($params['api_username']) || ($params['api_username'] !== Mage::getStoreConfig('payment/' . $this->_code . '/api_username')))
69
  {
70
  $this->log('(Everypay) Invalid username', __METHOD__, __LINE__);
71
  Mage::getSingleton('checkout/session')->addError('Invalid username.');
@@ -111,7 +120,7 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
111
  $orderMethod = $order->getPayment()->getMethod();
112
  if ($orderMethod != $this->_code)
113
  {
114
- $this->log('(Everypay): Wrong payment method. Order has: '.$orderMethod, __METHOD__, __LINE__);
115
  Mage::getSingleton('checkout/session')->addError('Wrong payment method.');
116
  return self::_VERIFY_CORRUPT;
117
  }
@@ -163,11 +172,13 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
163
  }
164
  } else
165
  {
166
- $this->log('Failed to create invoice for order ' . $this->getOrderId() . '. Reason: invoice already created', __METHOD__, __LINE__);
 
167
  }
168
  } else
169
  {
170
- $this->log('Failed to create invoice for order ' . $this->getOrderId() . '. Reason: order locked', __METHOD__, __LINE__);
 
171
  }
172
  }
173
 
10
  protected $_isGateway = true;
11
  protected $_canUseCheckout = true;
12
  protected $logFile = 'everypay.log';
 
13
  protected $_code = 'multon_everypay';
14
  protected $_formBlockType = 'everypay/everypay';
15
  private $statuses = array(
42
 
43
  // $this->log($data, __METHOD__, __LINE__);
44
 
45
+ if ($this->getGatewayUrl() == Multon_Everypay_Model_Source_ApiUrl::$urlList['LIVE'])
46
+ {
47
+ $username = Mage::getStoreConfig('payment/' . $this->_code . '/api_username');
48
+ $secret = Mage::getStoreConfig('payment/' . $this->_code . '/api_secret');
49
+ } else
50
+ {
51
+ $username = Mage::getStoreConfig('payment/' . $this->_code . '/api_username_test');
52
+ $secret = Mage::getStoreConfig('payment/' . $this->_code . '/api_secret_test');
53
+ }
54
+
55
+ $hmac = hash_hmac('sha1', substr($data, 0, -1), $secret);
56
  if ($params['hmac'] != $hmac)
57
  {
58
  $this->log('(Everypay) Invalid HMAC (Expected: ' . $hmac . ')', __METHOD__, __LINE__);
74
  // $this->log('(Everypay) Warnings: ' . print_r($warnings, 1), __METHOD__, __LINE__);
75
  // }
76
 
77
+ if (!isset($params['api_username']) || ($params['api_username'] !== $username))
78
  {
79
  $this->log('(Everypay) Invalid username', __METHOD__, __LINE__);
80
  Mage::getSingleton('checkout/session')->addError('Invalid username.');
120
  $orderMethod = $order->getPayment()->getMethod();
121
  if ($orderMethod != $this->_code)
122
  {
123
+ $this->log('(Everypay): Wrong payment method. Order has: ' . $orderMethod, __METHOD__, __LINE__);
124
  Mage::getSingleton('checkout/session')->addError('Wrong payment method.');
125
  return self::_VERIFY_CORRUPT;
126
  }
172
  }
173
  } else
174
  {
175
+ $this->log('Failed to create invoice for order ' . $this->getOrderId() . '. Reason: invoice already created',
176
+ __METHOD__, __LINE__);
177
  }
178
  } else
179
  {
180
+ $this->log('Failed to create invoice for order ' . $this->getOrderId() . '. Reason: order locked', __METHOD__,
181
+ __LINE__);
182
  }
183
  }
184
 
app/code/community/Multon/Everypay/Model/Source/ApiUrl.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Multon_Everypay_Model_Source_ApiUrl
4
+ {
5
+ public static $urlList = array(
6
+ 'TEST' => 'https://igw-demo.every-pay.com/',
7
+ 'LIVE' => 'https://pay.every-pay.eu/'
8
+ );
9
+
10
+ public function toOptionArray()
11
+ {
12
+ $arr = array();
13
+ $urls = self::$urlList;
14
+
15
+ foreach ($urls as $key => $url)
16
+ $arr[] = array(
17
+ 'value' => $url,
18
+ 'label' => $key,
19
+ );
20
+
21
+ return $arr;
22
+ }
23
+
24
+ }
app/code/community/Multon/Everypay/Model/Source/ConnectionType.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Multon_Everypay_Model_Source_ConnectionType
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array(
8
+ 'value' => 0,
9
+ 'label' => 'Redirect'
10
+ ),
11
+ array(
12
+ 'value' => 1,
13
+ 'label' => 'iFrame'
14
+ ),
15
+ );
16
+ }
17
+ }
app/code/community/Multon/Everypay/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Multon_Everypay>
5
- <version>1.2.0</version>
6
  </Multon_Everypay>
7
  </modules>
8
  <global>
@@ -66,15 +66,19 @@
66
  <active>0</active>
67
  <title>EveryPay</title>
68
  <order_status>pending</order_status>
69
- <gateway_url>https://pay.every-pay.eu/transactions/</gateway_url>
 
 
70
  <api_username></api_username>
71
  <api_secret></api_secret>
72
  <account_id></account_id>
73
- <transaction_type>authorisation</transaction_type>
74
  <order_confirmation>0</order_confirmation>
75
  <invoice_confirmation>1</invoice_confirmation>
76
  <model>everypay/everypay</model>
77
  <payment_action>authorize</payment_action>
 
 
78
  </multon_everypay>
79
  </payment>
80
  </default>
2
  <config>
3
  <modules>
4
  <Multon_Everypay>
5
+ <version>1.2.4</version>
6
  </Multon_Everypay>
7
  </modules>
8
  <global>
66
  <active>0</active>
67
  <title>EveryPay</title>
68
  <order_status>pending</order_status>
69
+ <connection_type>1</connection_type>
70
+ <skin_name>default</skin_name>
71
+ <gateway_url>https://pay.every-pay.eu/</gateway_url>
72
  <api_username></api_username>
73
  <api_secret></api_secret>
74
  <account_id></account_id>
75
+ <transaction_type>charge</transaction_type>
76
  <order_confirmation>0</order_confirmation>
77
  <invoice_confirmation>1</invoice_confirmation>
78
  <model>everypay/everypay</model>
79
  <payment_action>authorize</payment_action>
80
+ <show_logo>1</show_logo>
81
+ <show_title>0</show_title>
82
  </multon_everypay>
83
  </payment>
84
  </default>
app/code/community/Multon/Everypay/etc/system.xml CHANGED
@@ -44,34 +44,71 @@
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>0</show_in_store>
46
  </order_status>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  <gateway_url translate="label">
48
  <label>Gateway URL</label>
49
- <frontend_type>text</frontend_type>
50
- <sort_order>14</sort_order>
 
51
  <show_in_default>1</show_in_default>
52
  <show_in_website>0</show_in_website>
53
  <show_in_store>0</show_in_store>
54
  </gateway_url>
55
  <api_username translate="label">
56
- <label>API username</label>
57
  <frontend_type>text</frontend_type>
58
- <sort_order>15</sort_order>
59
  <show_in_default>1</show_in_default>
60
  <show_in_website>1</show_in_website>
61
  <show_in_store>0</show_in_store>
62
  </api_username>
63
  <api_secret translate="label">
64
- <label>API secret</label>
65
  <frontend_type>text</frontend_type>
66
- <sort_order>16</sort_order>
67
  <show_in_default>1</show_in_default>
68
  <show_in_website>1</show_in_website>
69
  <show_in_store>0</show_in_store>
70
  </api_secret>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  <account_id translate="label">
72
  <label>Processing Account</label>
73
  <frontend_type>text</frontend_type>
74
- <sort_order>17</sort_order>
75
  <show_in_default>1</show_in_default>
76
  <show_in_website>1</show_in_website>
77
  <show_in_store>0</show_in_store>
@@ -80,7 +117,7 @@
80
  <label>Transaction Type</label>
81
  <frontend_type>select</frontend_type>
82
  <source_model>everypay/source_paymentAction</source_model>
83
- <sort_order>18</sort_order>
84
  <show_in_default>1</show_in_default>
85
  <show_in_website>1</show_in_website>
86
  <show_in_store>0</show_in_store>
@@ -89,7 +126,7 @@
89
  <label>Send Order Confirmation</label>
90
  <frontend_type>select</frontend_type>
91
  <source_model>adminhtml/system_config_source_yesno</source_model>
92
- <sort_order>19</sort_order>
93
  <show_in_default>1</show_in_default>
94
  <show_in_website>1</show_in_website>
95
  <show_in_store>1</show_in_store>
@@ -98,7 +135,7 @@
98
  <label>Send Invoice</label>
99
  <frontend_type>select</frontend_type>
100
  <source_model>adminhtml/system_config_source_yesno</source_model>
101
- <sort_order>20</sort_order>
102
  <show_in_default>1</show_in_default>
103
  <show_in_website>1</show_in_website>
104
  <show_in_store>1</show_in_store>
@@ -109,21 +146,24 @@
109
  </description>
110
  <frontend_type>select</frontend_type>
111
  <source_model>adminhtml/system_config_source_yesno</source_model>
112
- <sort_order>25</sort_order>
113
  <show_in_default>1</show_in_default>
114
  <show_in_website>1</show_in_website>
115
  <show_in_store>1</show_in_store>
 
 
 
116
  </quick_redirect>
117
- <hide_logo translate="label">
118
- <label>Hide Logo</label>
119
  <frontend_type>select</frontend_type>
120
- <sort_order>30</sort_order>
121
  <source_model>adminhtml/system_config_source_yesno</source_model>
122
  <show_in_default>1</show_in_default>
123
  <show_in_website>1</show_in_website>
124
  <show_in_store>1</show_in_store>
125
- <comment>Hide logo in checkout</comment>
126
- </hide_logo>
127
  <sort_order translate="label">
128
  <label>Sort order</label>
129
  <frontend_type>text</frontend_type>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>0</show_in_store>
46
  </order_status>
47
+ <connection_type>
48
+ <label>Connection type</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>everypay/source_connectionType</source_model>
51
+ <sort_order>14</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>0</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </connection_type>
56
+ <skin_name>
57
+ <label>iFrame skin name</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>15</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ <depends>
64
+ <connection_type>1</connection_type>
65
+ </depends>
66
+ </skin_name>
67
  <gateway_url translate="label">
68
  <label>Gateway URL</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>everypay/source_apiUrl</source_model>
71
+ <sort_order>15</sort_order>
72
  <show_in_default>1</show_in_default>
73
  <show_in_website>0</show_in_website>
74
  <show_in_store>0</show_in_store>
75
  </gateway_url>
76
  <api_username translate="label">
77
+ <label>API username LIVE</label>
78
  <frontend_type>text</frontend_type>
79
+ <sort_order>16</sort_order>
80
  <show_in_default>1</show_in_default>
81
  <show_in_website>1</show_in_website>
82
  <show_in_store>0</show_in_store>
83
  </api_username>
84
  <api_secret translate="label">
85
+ <label>API secret LIVE</label>
86
  <frontend_type>text</frontend_type>
87
+ <sort_order>17</sort_order>
88
  <show_in_default>1</show_in_default>
89
  <show_in_website>1</show_in_website>
90
  <show_in_store>0</show_in_store>
91
  </api_secret>
92
+ <api_username_test translate="label">
93
+ <label>API username TEST</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>18</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>0</show_in_store>
99
+ </api_username_test>
100
+ <api_secret_test translate="label">
101
+ <label>API secret TEST</label>
102
+ <frontend_type>text</frontend_type>
103
+ <sort_order>19</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>0</show_in_store>
107
+ </api_secret_test>
108
  <account_id translate="label">
109
  <label>Processing Account</label>
110
  <frontend_type>text</frontend_type>
111
+ <sort_order>20</sort_order>
112
  <show_in_default>1</show_in_default>
113
  <show_in_website>1</show_in_website>
114
  <show_in_store>0</show_in_store>
117
  <label>Transaction Type</label>
118
  <frontend_type>select</frontend_type>
119
  <source_model>everypay/source_paymentAction</source_model>
120
+ <sort_order>21</sort_order>
121
  <show_in_default>1</show_in_default>
122
  <show_in_website>1</show_in_website>
123
  <show_in_store>0</show_in_store>
126
  <label>Send Order Confirmation</label>
127
  <frontend_type>select</frontend_type>
128
  <source_model>adminhtml/system_config_source_yesno</source_model>
129
+ <sort_order>30</sort_order>
130
  <show_in_default>1</show_in_default>
131
  <show_in_website>1</show_in_website>
132
  <show_in_store>1</show_in_store>
135
  <label>Send Invoice</label>
136
  <frontend_type>select</frontend_type>
137
  <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <sort_order>31</sort_order>
139
  <show_in_default>1</show_in_default>
140
  <show_in_website>1</show_in_website>
141
  <show_in_store>1</show_in_store>
146
  </description>
147
  <frontend_type>select</frontend_type>
148
  <source_model>adminhtml/system_config_source_yesno</source_model>
149
+ <sort_order>40</sort_order>
150
  <show_in_default>1</show_in_default>
151
  <show_in_website>1</show_in_website>
152
  <show_in_store>1</show_in_store>
153
+ <depends>
154
+ <connection_type>0</connection_type>
155
+ </depends>
156
  </quick_redirect>
157
+ <show_logo translate="label">
158
+ <label>Show Logo</label>
159
  <frontend_type>select</frontend_type>
160
+ <sort_order>50</sort_order>
161
  <source_model>adminhtml/system_config_source_yesno</source_model>
162
  <show_in_default>1</show_in_default>
163
  <show_in_website>1</show_in_website>
164
  <show_in_store>1</show_in_store>
165
+ <comment>Show logo in checkout</comment>
166
+ </show_logo>
167
  <sort_order translate="label">
168
  <label>Sort order</label>
169
  <frontend_type>text</frontend_type>
app/code/community/Multon/Everypay/sql/everypay_setup/upgrade-1.2.0-1.2.1.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ $this->run("update core_config_data set path='payment/multon_everypay/show_logo',value=if(value,0,1) where path like 'payment/multon_everypay/hide_logo'");
app/design/frontend/base/default/layout/multon/everypay.xml CHANGED
@@ -12,6 +12,13 @@
12
  </reference>
13
  </everypay_everypay_redirect>
14
  <default>
 
 
 
 
 
 
 
15
  <reference name="footer">
16
  <block type="everypay/info" name="everypay_info" template="multon/everypay/info.phtml" />
17
  </reference>
12
  </reference>
13
  </everypay_everypay_redirect>
14
  <default>
15
+ <reference name="head">
16
+ <block type="core/text" name="cdn.jquery">
17
+ <action method="setText">
18
+ <text><![CDATA[<script src="//code.jquery.com/jquery-2.1.4.min.js"></script><script>jQuery.noConflict();</script>]]></text>
19
+ </action>
20
+ </block>
21
+ </reference>
22
  <reference name="footer">
23
  <block type="everypay/info" name="everypay_info" template="multon/everypay/info.phtml" />
24
  </reference>
app/design/frontend/base/default/template/multon/everypay/everypay.phtml CHANGED
@@ -1,10 +1,103 @@
 
 
 
 
 
 
 
 
 
1
  <div class="payment_everyay_container payment_method_everypay">
2
- <?php echo $this->getChildHtml('everypay_everypay_description') ?>
3
- <form id="GatewayForm" name="everypay" action="<?php echo $this->getGatewayUrl() ?>" method="POST" target="_top">
 
 
 
 
 
 
 
 
 
 
4
  <input type="image" src="<?php echo $this->getMethodLogoUrl(); ?>" onclick="this.form.submit()" class="payment-gateway-logo everypay_logo"/>
5
- <?php foreach ($this->getFields() as $key => $value) { ?>
6
- <input type="hidden" name="<?php echo $key ?>" value="<?php echo $value ?>"/>
7
- <?php } ?>
 
8
  </form>
9
- <?php echo $this->getQuickRedirectScript(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  </div>
1
+ <?php
2
+ $type = Mage::getStoreConfig('payment/multon_everypay/connection_type');
3
+
4
+ if ($type)
5
+ {
6
+ ?>
7
+ <iframe id="iframe-payment-container" name="iframe-payment-container" width="460" height="400" style="border: none"></iframe>
8
+ <?php } ?>
9
+
10
  <div class="payment_everyay_container payment_method_everypay">
11
+ <?php echo $this->getChildHtml('everypay_everypay_description') ?>
12
+ <form
13
+ <?php if (!$type)
14
+ {
15
+ ?>
16
+ id="GatewayForm" target="_top"
17
+ <?php } else
18
+ {
19
+ ?>
20
+ id="iframe_form" style="display: none" target="iframe-payment-container"
21
+ <?php } ?>
22
+ name="everypay" action="<?php echo $this->getGatewayUrl() ?>transactions/" method="POST">
23
  <input type="image" src="<?php echo $this->getMethodLogoUrl(); ?>" onclick="this.form.submit()" class="payment-gateway-logo everypay_logo"/>
24
+ <?php foreach ($this->getFields() as $key => $value)
25
+ { ?>
26
+ <input type="hidden" name="<?php echo $key ?>" value="<?php echo $value ?>"/>
27
+ <?php } ?>
28
  </form>
29
+ <?php
30
+ if (!$type)
31
+ echo $this->getQuickRedirectScript();
32
+ else
33
+ {
34
+ ?>
35
+ <script>
36
+ window.onload = function () {
37
+ document.getElementById("iframe_form").submit();
38
+ };
39
+
40
+ var shrinked_iframe_data;
41
+ var iframe = jQuery('#iframe-payment-container'); // iframe selector should be used
42
+
43
+ var shrinkIframe = function (iframe, iframe_data) {
44
+ iframe.css(iframe_data);
45
+ jQuery("#dimmed_background_box").remove();
46
+ };
47
+ var expandIframe = function () {
48
+ var iframe_data = {
49
+ position: iframe.attr("position") || "static",
50
+ top: iframe.position().top,
51
+ left: iframe.position().left,
52
+ width: iframe.width(),
53
+ height: iframe.height(),
54
+ zIndex: iframe.attr("zIndex"),
55
+ marginLeft: iframe.attr("marginLeft"),
56
+ marginRight: iframe.attr("marginRight")
57
+ };
58
+
59
+ jQuery('body').append("<div id='dimmed_background_box'></div>");
60
+ jQuery('#dimmed_background_box').css({height: '100%', width: '100%', position: 'fixed', top: 0, left: 0, zIndex: 9998, backgroundColor: '#000000', opacity: 0.5});
61
+
62
+ var window_height = jQuery(window).height();
63
+ var window_width = jQuery(window).width();
64
+
65
+ if (window_width < 960) {
66
+ iframe.css({height: window_height, width: window_width, top: 0});
67
+ } else {
68
+ iframe.css({height: 640, width: 960, top: (window_height - 640) / 2, left: (window_width - 960) / 2});
69
+ }
70
+ iframe.css({position: 'fixed', zIndex: 9999, margin: 'auto'});
71
+ return iframe_data;
72
+ };
73
+
74
+ window.addEventListener('message', function (event) {
75
+ if (event.origin.concat("/") !== "<?php echo $this->getGatewayUrl() ?>") {
76
+ return;
77
+ }
78
+
79
+ var message = JSON.parse(event.data);
80
+ /*
81
+ 1. An "expand" message is sent from the iframe page when 3D secure page is going to be displayed.
82
+ The size of the iframe should be adjusted to hold 3D secure page
83
+ 2. A "shrink" message is sent from the iframe page when a user has provided authorisation details on the 3D secure page.
84
+ The size of the iframe should be set to the initial values
85
+ */
86
+ if (message.resize_iframe === "expand") {
87
+ shrinked_iframe_data = expandIframe(iframe);
88
+ } else if (message.resize_iframe === "shrink") {
89
+ shrinkIframe(iframe, shrinked_iframe_data);
90
+ }
91
+
92
+ // It receives a message from the iframe about transaction's result. Possible states: completed, failed.
93
+ if (message.transaction_result) {
94
+ if (message.transaction_result === "completed")
95
+ {
96
+ window.location="<?php echo Mage::getUrl('checkout/onepage/success'); ?>";
97
+ }
98
+ }
99
+ }, false);
100
+
101
+ </script>
102
+ <?php } ?>
103
  </div>
package.xml CHANGED
@@ -1,14 +1,27 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>multon_everypay</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Multon Everypay</summary>
10
  <description>Multon Everypay</description>
11
- <notes>1.2.0&#xD;
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  API protocol update&#xD;
13
  FIX: remove SID from callback_url&#xD;
14
  &#xD;
@@ -41,9 +54,9 @@ FIX: redirect template&#xD;
41
  1.0.0&#xD;
42
  Stable release</notes>
43
  <authors><author><name>Multon</name><user>eepohs</user><email>magento@multon.ee</email></author><author><name>Jaanus Vapper</name><user>hullkuri</user><email>hullkuri@gmail.com</email></author><author><name>Tanel Raja</name><user>Pronto</user><email>tanel.raja@gmail.com</email></author></authors>
44
- <date>2015-08-26</date>
45
- <time>09:13:49</time>
46
- <contents><target name="magecommunity"><dir name="Multon"><dir name="Everypay"><dir name="Block"><dir name="Adminhtml"><file name="Fieldset.php" hash="324c82a14594133019deef5c98e8ec78"/><dir name="System"><dir name="Config"><file name="Intro.php" hash="25a5c87ee274de259ede0decc040f643"/><file name="Outro.php" hash="21e9865c5f85cc0c8a601cc171d3f5d0"/><file name="Version.php" hash="63d888085e44f1b99e77aec70f12f62a"/></dir></dir></dir><file name="Everypay.php" hash="1cfdfa0e4bbf6ce982eef838109bb5ce"/><file name="Info.php" hash="4755af2b544c9f5de39098046e6da0fb"/></dir><dir name="Model"><file name="Everypay.php" hash="13b66cd6daa91592992d0a9be5b67382"/><dir name="Source"><file name="PaymentAction.php" hash="27787205d1886997aeccecb4028d488f"/></dir></dir><dir name="controllers"><file name="EverypayController.php" hash="4d70fc06e227af4e6fcf920be2e89ec1"/></dir><dir name="etc"><file name="config.xml" hash="3b9ed7ae94be4ecea5d1ca5305fe1b57"/><file name="system.xml" hash="c337dd813b2f7bc4a162ac624e0499c2"/></dir><dir name="sql"><dir name="everypay_setup"><file name="install-1.0.0.php" hash="201924647c609f33835712ab2c81e4d4"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Multon_Everypay.xml" hash="99a2dd0a396a3a1b937d767e48ce237f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="multon"><file name="everypay.xml" hash="d85234989ed7853a5f29e10e82945056"/></dir></dir><dir name="template"><dir name="multon"><dir name="everypay"><file name="everypay.phtml" hash="1e168f001770918f4d4fa934767854d8"/><file name="info.phtml" hash="91eb9c88527bc6b0076f382df0f6809c"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="multon"><dir name="everypay"><file name="everypay_logo_220x44.png" hash="be48db5df549b24058f4e5c889791f6b"/><file name="mastercard_visa_acceptance.jpg" hash="2e7bf5940eeab9863caf8d641ac6f1e9"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="everypay-logo.jpg" hash="909c46f5e89be9de1d0d2ad7fdfb8bc6"/></dir></dir></dir></dir></target></contents>
47
  <compatible/>
48
  <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
49
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>multon_everypay</name>
4
+ <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Multon Everypay</summary>
10
  <description>Multon Everypay</description>
11
+ <notes>1.2.4&#xD;
12
+ link jquery in header, iframe changes &#xD;
13
+ &#xD;
14
+ 1.2.3&#xD;
15
+ New log&#xD;
16
+ No redirect after failed payment&#xD;
17
+ &#xD;
18
+ 1.2.2&#xD;
19
+ NEW: Live/Test url selection, separate credentials&#xD;
20
+ &#xD;
21
+ 1.2.1&#xD;
22
+ NEW: Support iframe payment form&#xD;
23
+ &#xD;
24
+ 1.2.0&#xD;
25
  API protocol update&#xD;
26
  FIX: remove SID from callback_url&#xD;
27
  &#xD;
54
  1.0.0&#xD;
55
  Stable release</notes>
56
  <authors><author><name>Multon</name><user>eepohs</user><email>magento@multon.ee</email></author><author><name>Jaanus Vapper</name><user>hullkuri</user><email>hullkuri@gmail.com</email></author><author><name>Tanel Raja</name><user>Pronto</user><email>tanel.raja@gmail.com</email></author></authors>
57
+ <date>2015-10-20</date>
58
+ <time>12:04:11</time>
59
+ <contents><target name="magecommunity"><dir name="Multon"><dir name="Everypay"><dir name="Block"><dir name="Adminhtml"><file name="Fieldset.php" hash="324c82a14594133019deef5c98e8ec78"/><dir name="System"><dir name="Config"><file name="Intro.php" hash="25a5c87ee274de259ede0decc040f643"/><file name="Outro.php" hash="21e9865c5f85cc0c8a601cc171d3f5d0"/><file name="Version.php" hash="63d888085e44f1b99e77aec70f12f62a"/></dir></dir></dir><file name="Everypay.php" hash="c494180c3b109e5477eb805d7aa6c795"/><file name="Info.php" hash="4755af2b544c9f5de39098046e6da0fb"/></dir><dir name="Model"><file name="Everypay.php" hash="56e86b0afb72ef77b04aab70491a03d7"/><dir name="Source"><file name="ApiUrl.php" hash="e1b55560b85996fccd3492d45f02844f"/><file name="ConnectionType.php" hash="0857dfbb0deee17ca3459dc2bf5f8569"/><file name="PaymentAction.php" hash="27787205d1886997aeccecb4028d488f"/></dir></dir><dir name="controllers"><file name="EverypayController.php" hash="4d70fc06e227af4e6fcf920be2e89ec1"/></dir><dir name="etc"><file name="config.xml" hash="6ec14f33ee5b54c4844b9d254e46f406"/><file name="system.xml" hash="36974d802cf6c2b165e76d8ec5866773"/></dir><dir name="sql"><dir name="everypay_setup"><file name="install-1.0.0.php" hash="201924647c609f33835712ab2c81e4d4"/><file name="upgrade-1.2.0-1.2.1.php" hash="1ff58987d6575a8c018e80fc600897bd"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Multon_Everypay.xml" hash="99a2dd0a396a3a1b937d767e48ce237f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="multon"><file name="everypay.xml" hash="9b5e6ce111deb2114547dca090d7fab2"/></dir></dir><dir name="template"><dir name="multon"><dir name="everypay"><file name="everypay.phtml" hash="886f83c265e8be7ff76f0a3a8ef19bc5"/><file name="info.phtml" hash="91eb9c88527bc6b0076f382df0f6809c"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="multon"><dir name="everypay"><file name="mastercard_visa_acceptance.png" hash="d448d1eff4e623c1b35c67ad80c189fb"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="everypay-logo.jpg" hash="909c46f5e89be9de1d0d2ad7fdfb8bc6"/></dir></dir></dir></dir></target></contents>
60
  <compatible/>
61
  <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
62
  </package>
skin/frontend/base/default/images/multon/everypay/everypay_logo_220x44.png DELETED
Binary file
skin/frontend/base/default/images/multon/everypay/mastercard_visa_acceptance.jpg DELETED
Binary file
skin/frontend/base/default/images/multon/everypay/mastercard_visa_acceptance.png ADDED
Binary file