Phoenix_Worldpay - Version 1.4.2

Version Notes

- accept callback from *.worldpay.com
- updated admin url
(http://www.worldpay.com/support/index.php?page=domain-change&c=WW)

Download this release

Release Info

Developer Magento Core Team
Extension Phoenix_Worldpay
Version 1.4.2
Comparing to
See all releases


Code changes from version 1.4.1 to 1.4.2

app/code/community/Phoenix/Worldpay/Model/Cc.php CHANGED
@@ -45,8 +45,8 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
45
  protected $_testUrl = 'https://secure-test.worldpay.com/wcc/purchase';
46
  protected $_liveUrl = 'https://secure.worldpay.com/wcc/purchase';
47
 
48
- protected $_testAdminUrl = 'https://secure-test.worldpay.com/wcc/itransaction';
49
- protected $_liveAdminUrl = 'https://secure.worldpay.com/wcc/itransaction';
50
 
51
  protected $_formBlockType = 'worldpay/form';
52
  protected $_infoBlockType = 'worldpay/info';
@@ -185,8 +185,9 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
185
  /**
186
  * Refund money
187
  *
188
- * @param Varien_Object $invoicePayment
189
- * @return Mage_GoogleCheckout_Model_Payment
 
190
  */
191
  public function refund(Varien_Object $payment, $amount)
192
  {
@@ -211,8 +212,10 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
211
 
212
  /**
213
  * Capture preatutharized amount
 
214
  * @param Varien_Object $payment
215
- * @param <type> $amount
 
216
  */
217
  public function capture(Varien_Object $payment, $amount)
218
  {
@@ -311,7 +314,7 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
311
  /**
312
  * Log debug data to file
313
  *
314
- * Prior Magento 1.4.1 this method doesn't exists. So it is mainly to provide
315
  * BC.
316
  *
317
  * @param mixed $debugData
45
  protected $_testUrl = 'https://secure-test.worldpay.com/wcc/purchase';
46
  protected $_liveUrl = 'https://secure.worldpay.com/wcc/purchase';
47
 
48
+ protected $_testAdminUrl = 'https://secure-test.worldpay.com/wcc/iadmin';
49
+ protected $_liveAdminUrl = 'https://secure.worldpay.com/wcc/iadmin';
50
 
51
  protected $_formBlockType = 'worldpay/form';
52
  protected $_infoBlockType = 'worldpay/info';
185
  /**
186
  * Refund money
187
  *
188
+ * @param Varien_Object $payment
189
+ * @param float $amount
190
+ * @return Phoenix_Worldpay_Model_Cc
191
  */
192
  public function refund(Varien_Object $payment, $amount)
193
  {
212
 
213
  /**
214
  * Capture preatutharized amount
215
+ *
216
  * @param Varien_Object $payment
217
+ * @param float $amount
218
+ * @return $this
219
  */
220
  public function capture(Varien_Object $payment, $amount)
221
  {
314
  /**
315
  * Log debug data to file
316
  *
317
+ * Prior Magento 1.4.1 this method doesn't exist. So it is mainly to provide
318
  * BC.
319
  *
320
  * @param mixed $debugData
app/code/community/Phoenix/Worldpay/controllers/ProcessingController.php CHANGED
@@ -90,7 +90,7 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
90
  } elseif ($request['transStatus'] == 'C') {
91
  $this->_processCancel($request);
92
  } else {
93
- Mage::throwException('Transaction was not successfull.');
94
  }
95
  } catch (Mage_Core_Exception $e) {
96
  $this->_debug('Worldpay response error: ' . $e->getMessage());
@@ -149,11 +149,12 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
149
  */
150
  protected function _checkReturnedPost()
151
  {
152
- // check request type
153
- if (!$this->getRequest()->isPost())
154
  Mage::throwException('Wrong request type.');
 
155
 
156
- // validate request ip coming from WorldPay/RBS subnet
157
  $helper = Mage::helper('core/http');
158
  if (method_exists($helper, 'getRemoteAddr')) {
159
  $remoteAddr = $helper->getRemoteAddr();
@@ -161,30 +162,34 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
161
  $request = $this->getRequest()->getServer();
162
  $remoteAddr = $request['REMOTE_ADDR'];
163
  }
164
- if (substr($remoteAddr,0,11) != '155.136.16.') {
 
165
  Mage::throwException('IP can\'t be validated as WorldPay-IP.');
166
  }
167
 
168
- // get request variables
169
  $request = $this->getRequest()->getPost();
170
- if (empty($request))
171
  Mage::throwException('Request doesn\'t contain POST elements.');
 
172
 
173
- // check order id
174
- if (empty($request['MC_orderid']) || strlen($request['MC_orderid']) > 50)
175
  Mage::throwException('Missing or invalid order ID');
 
176
 
177
- // load order for further validation
178
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($request['MC_orderid']);
179
- if (!$this->_order->getId())
180
  Mage::throwException('Order not found');
 
181
 
182
  $this->_paymentInst = $this->_order->getPayment()->getMethodInstance();
183
 
184
- // check transaction password
185
- if ($this->_paymentInst->getConfigData('transaction_password') != $request['callbackPW'])
186
  Mage::throwException('Transaction password wrong');
187
-
188
 
189
  return $request;
190
  }
@@ -204,12 +209,14 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
204
  }
205
 
206
  // check transaction amount
207
- if ($price != $request['authAmount'])
208
  Mage::throwException('Transaction currency doesn\'t match.');
 
209
 
210
  // check transaction currency
211
- if ($currency != $request['authCurrency'])
212
  Mage::throwException('Transaction currency doesn\'t match.');
 
213
 
214
  // save transaction information
215
  $this->_order->getPayment()
90
  } elseif ($request['transStatus'] == 'C') {
91
  $this->_processCancel($request);
92
  } else {
93
+ Mage::throwException('Transaction was not successful.');
94
  }
95
  } catch (Mage_Core_Exception $e) {
96
  $this->_debug('Worldpay response error: ' . $e->getMessage());
149
  */
150
  protected function _checkReturnedPost()
151
  {
152
+ // check request type
153
+ if (!$this->getRequest()->isPost()) {
154
  Mage::throwException('Wrong request type.');
155
+ }
156
 
157
+ // validate request ip coming from WorldPay/RBS subnet
158
  $helper = Mage::helper('core/http');
159
  if (method_exists($helper, 'getRemoteAddr')) {
160
  $remoteAddr = $helper->getRemoteAddr();
162
  $request = $this->getRequest()->getServer();
163
  $remoteAddr = $request['REMOTE_ADDR'];
164
  }
165
+ if ((substr($remoteAddr, 0, 11) != '155.136.16.') ||
166
+ preg_match('/\.worldpay\.com$/', gethostbyaddr($remoteAddr))) {
167
  Mage::throwException('IP can\'t be validated as WorldPay-IP.');
168
  }
169
 
170
+ // get request variables
171
  $request = $this->getRequest()->getPost();
172
+ if (empty($request)) {
173
  Mage::throwException('Request doesn\'t contain POST elements.');
174
+ }
175
 
176
+ // check order id
177
+ if (empty($request['MC_orderid']) || strlen($request['MC_orderid']) > 50) {
178
  Mage::throwException('Missing or invalid order ID');
179
+ }
180
 
181
+ // load order for further validation
182
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($request['MC_orderid']);
183
+ if (!$this->_order->getId()) {
184
  Mage::throwException('Order not found');
185
+ }
186
 
187
  $this->_paymentInst = $this->_order->getPayment()->getMethodInstance();
188
 
189
+ // check transaction password
190
+ if ($this->_paymentInst->getConfigData('transaction_password') != $request['callbackPW']) {
191
  Mage::throwException('Transaction password wrong');
192
+ }
193
 
194
  return $request;
195
  }
209
  }
210
 
211
  // check transaction amount
212
+ if ($price != $request['authAmount']) {
213
  Mage::throwException('Transaction currency doesn\'t match.');
214
+ }
215
 
216
  // check transaction currency
217
+ if ($currency != $request['authCurrency']) {
218
  Mage::throwException('Transaction currency doesn\'t match.');
219
+ }
220
 
221
  // save transaction information
222
  $this->_order->getPayment()
app/code/community/Phoenix/Worldpay/etc/config.xml CHANGED
@@ -21,7 +21,7 @@
21
  <config>
22
  <modules>
23
  <Phoenix_Worldpay>
24
- <version>1.4.1</version>
25
  </Phoenix_Worldpay>
26
  </modules>
27
  <global>
21
  <config>
22
  <modules>
23
  <Phoenix_Worldpay>
24
+ <version>1.4.2</version>
25
  </Phoenix_Worldpay>
26
  </modules>
27
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Phoenix_Worldpay</name>
4
- <version>1.4.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -19,11 +19,13 @@ Notice: This extension is still beta. We recommend to test all transactions in y
19
  The extension is developed and maintained by the German Magento Silver Partner Phoenix Medien (http://www.phoenix-medien.de).
20
 
21
  The development was sponsored by liaison dangereuse (http://www.liaison-dangereuse.de).</description>
22
- <notes>- updated gateway urls</notes>
 
 
23
  <authors><author><name>Phoenix Medien</name><user>auto-converted</user><email>info@phoenix-medien.de</email></author></authors>
24
- <date>2012-08-12</date>
25
- <time>18:21:25</time>
26
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="worldpay"><dir name="pdf"><file name="info.phtml" hash="3a92c60f5c05a3e51df366cee651edd6"/></dir><file name="info.phtml" hash="ca932cd58bc6e0c951e6119d4ee40185"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="worldpay.xml" hash="ac4191773623ae2ad6170f363866ed43"/></dir><dir name="template"><dir name="worldpay"><file name="blank.phtml" hash="8b7d8aa0521878b2dd796acfd4d655b6"/><file name="cancel.phtml" hash="350348b8fecb9b7c2b1045d1a8edd9c7"/><file name="failure.phtml" hash="9126748b39206ddd936ad72357bcf9b7"/><file name="form.phtml" hash="8c7184cbaffc115349de415d12273528"/><file name="info.phtml" hash="9c17afe371e23674979aad7e6ce82fe3"/><file name="redirect.phtml" hash="441b182afae33e16b26bbfdae2f12a87"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_Worldpay.csv" hash="a261960a7cd06a38f6fc686cfa7c08e2"/></dir><dir name="en_GB"><file name="Phoenix_Worldpay.csv" hash="7ab5f7f407e252616b2bd04ebe0564cd"/></dir><dir name="en_US"><file name="Phoenix_Worldpay.csv" hash="49947b473e21e818ce0d39db5896cf96"/></dir></target><target name="mageetc"><dir name="modules"><file name="Phoenix_Worldpay.xml" hash="52b9dc5cd0d94ab43d8691438f090617"/></dir></target><target name="magecommunity"><dir name="Phoenix"><dir name="Worldpay"><dir name="Block"><file name="Cancel.php" hash="b0f213ee8e45d0b8b48a6fad48f05017"/><file name="Failure.php" hash="5add6ed9890109ba624b7a16bc0504f5"/><file name="Form.php" hash="d279b2d502e875e155101007eef7ebc5"/><file name="Info.php" hash="845d37c36ea2973599324f9e294969a4"/><file name="Redirect.php" hash="ee8eb2b8cdabaf9ae0dea66fd7362777"/><file name="Success.php" hash="0c072e272d53a0b24e5157201cd65877"/></dir><dir name="controllers"><file name="ProcessingController.php" hash="678edad8cc33d581199ffd8cdfb3631a"/></dir><dir name="etc"><file name="config.xml" hash="d6728527bf08ccb3de0522712618b367"/><file name="system.xml" hash="b5f29fbcc56636bd519058804f08d66d"/></dir><dir name="Helper"><file name="Data.php" hash="954555e22d7867b2eb2b698b86405d63"/></dir><dir name="Model"><dir name="Config"><dir name="Backend"><file name="Instid.php" hash="07147ceac69c3c19593b4a24873f15cc"/></dir></dir><dir name="Source"><file name="RequestType.php" hash="795d51b4c3f04bb00cf6cca5a3180cd7"/><file name="SignatureType.php" hash="68e8267596e0c040633f2ce8e40472fe"/><file name="TransactionMode.php" hash="da4cadb5df1213edc34f22b67235d374"/></dir><file name="Cc.php" hash="ab7bf6a2e2ef1516240b24f67962bd01"/><file name="Config.php" hash="9098369b245a824396354e1b64cd47ab"/></dir></dir></dir></target></contents>
27
  <compatible/>
28
  <dependencies/>
29
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Phoenix_Worldpay</name>
4
+ <version>1.4.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
19
  The extension is developed and maintained by the German Magento Silver Partner Phoenix Medien (http://www.phoenix-medien.de).
20
 
21
  The development was sponsored by liaison dangereuse (http://www.liaison-dangereuse.de).</description>
22
+ <notes>- accept callback from *.worldpay.com
23
+ - updated admin url
24
+ (http://www.worldpay.com/support/index.php?page=domain-change&amp;c=WW)</notes>
25
  <authors><author><name>Phoenix Medien</name><user>auto-converted</user><email>info@phoenix-medien.de</email></author></authors>
26
+ <date>2013-04-29</date>
27
+ <time>07:54:31</time>
28
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="worldpay"><dir name="pdf"><file name="info.phtml" hash="3a92c60f5c05a3e51df366cee651edd6"/></dir><file name="info.phtml" hash="ca932cd58bc6e0c951e6119d4ee40185"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="worldpay.xml" hash="ac4191773623ae2ad6170f363866ed43"/></dir><dir name="template"><dir name="worldpay"><file name="blank.phtml" hash="8b7d8aa0521878b2dd796acfd4d655b6"/><file name="cancel.phtml" hash="350348b8fecb9b7c2b1045d1a8edd9c7"/><file name="failure.phtml" hash="9126748b39206ddd936ad72357bcf9b7"/><file name="form.phtml" hash="8c7184cbaffc115349de415d12273528"/><file name="info.phtml" hash="9c17afe371e23674979aad7e6ce82fe3"/><file name="redirect.phtml" hash="441b182afae33e16b26bbfdae2f12a87"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_Worldpay.csv" hash="a261960a7cd06a38f6fc686cfa7c08e2"/></dir><dir name="en_GB"><file name="Phoenix_Worldpay.csv" hash="7ab5f7f407e252616b2bd04ebe0564cd"/></dir><dir name="en_US"><file name="Phoenix_Worldpay.csv" hash="49947b473e21e818ce0d39db5896cf96"/></dir></target><target name="mageetc"><dir name="modules"><file name="Phoenix_Worldpay.xml" hash="52b9dc5cd0d94ab43d8691438f090617"/></dir></target><target name="magecommunity"><dir name="Phoenix"><dir name="Worldpay"><dir name="Block"><file name="Cancel.php" hash="b0f213ee8e45d0b8b48a6fad48f05017"/><file name="Failure.php" hash="5add6ed9890109ba624b7a16bc0504f5"/><file name="Form.php" hash="d279b2d502e875e155101007eef7ebc5"/><file name="Info.php" hash="845d37c36ea2973599324f9e294969a4"/><file name="Redirect.php" hash="ee8eb2b8cdabaf9ae0dea66fd7362777"/><file name="Success.php" hash="0c072e272d53a0b24e5157201cd65877"/></dir><dir name="controllers"><file name="ProcessingController.php" hash="d6cf3ada50c502b6432a3811af1f9065"/></dir><dir name="etc"><file name="config.xml" hash="e84e5a96136f1c74ce47adef3942de46"/><file name="system.xml" hash="b5f29fbcc56636bd519058804f08d66d"/></dir><dir name="Helper"><file name="Data.php" hash="954555e22d7867b2eb2b698b86405d63"/></dir><dir name="Model"><dir name="Config"><dir name="Backend"><file name="Instid.php" hash="07147ceac69c3c19593b4a24873f15cc"/></dir></dir><dir name="Source"><file name="RequestType.php" hash="795d51b4c3f04bb00cf6cca5a3180cd7"/><file name="SignatureType.php" hash="68e8267596e0c040633f2ce8e40472fe"/><file name="TransactionMode.php" hash="da4cadb5df1213edc34f22b67235d374"/></dir><file name="Cc.php" hash="ea421e006f1c15ffd5aeb558a83e86dd"/><file name="Config.php" hash="9098369b245a824396354e1b64cd47ab"/></dir></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies/>
31
  </package>