Phoenix_Worldpay - Version 1.2.0

Version Notes

- Remote admin functionalities for capture and refund in the backend
- Rework of the complete controller
- Cancel now reloads shopping cart correctly
- Fixes session issue during callback
- AVS Status is now visible in the backend

Download this release

Release Info

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


Code changes from version 1.1.3 to 1.2.0

app/code/community/Phoenix/Worldpay/Block/Cancel.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Phoenix
16
+ * @package Phoenix_Worldpay
17
+ * @copyright Copyright (c) 2008 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
+ */
19
+
20
+ class Phoenix_Worldpay_Block_Cancel extends Mage_Core_Block_Template
21
+ {
22
+ protected function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->setTemplate('worldpay/cancel.phtml');
26
+ }
27
+
28
+ /**
29
+ * Get continue shopping url
30
+ */
31
+ public function getContinueShoppingUrl()
32
+ {
33
+ return Mage::getUrl('*/*/cancel', array('_nosid' => true));
34
+ }
35
+ }
app/code/community/Phoenix/Worldpay/Block/Failure.php CHANGED
@@ -30,6 +30,6 @@ class Phoenix_Worldpay_Block_Failure extends Mage_Core_Block_Template
30
  */
31
  public function getContinueShoppingUrl()
32
  {
33
- return Mage::getUrl('checkout/cart');
34
  }
35
  }
30
  */
31
  public function getContinueShoppingUrl()
32
  {
33
+ return Mage::getUrl('checkout/cart', array('_nosid' => true));
34
  }
35
  }
app/code/community/Phoenix/Worldpay/Block/Redirect.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Phoenix
16
+ * @package Phoenix_Worldpay
17
+ * @copyright Copyright (c) 2008 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
+ */
19
+
20
+ class Phoenix_Worldpay_Block_Redirect extends Mage_Core_Block_Template
21
+ {
22
+
23
+ protected function _construct()
24
+ {
25
+ parent::_construct();
26
+ }
27
+
28
+ /**
29
+ * Return checkout session instance
30
+ *
31
+ * @return Mage_Checkout_Model_Session
32
+ */
33
+ protected function _getCheckout()
34
+ {
35
+ return Mage::getSingleton('checkout/session');
36
+ }
37
+
38
+ /**
39
+ * Return order instance
40
+ *
41
+ * @return Mage_Sales_Model_Order|null
42
+ */
43
+ protected function _getOrder()
44
+ {
45
+ if ($this->getOrder()) {
46
+ return $this->getOrder();
47
+ } elseif ($orderIncrementId = $this->_getCheckout()->getLastRealOrderId()) {
48
+ return Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
49
+ } else {
50
+ return null;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Get Form data by using ogone payment api
56
+ *
57
+ * @return array
58
+ */
59
+ public function getFormData()
60
+ {
61
+ return $this->_getOrder()->getPayment()->getMethodInstance()->getFormFields();
62
+ }
63
+
64
+ /**
65
+ * Getting gateway url
66
+ *
67
+ * @return string
68
+ */
69
+ public function getFormAction()
70
+ {
71
+ return $this->_getOrder()->getPayment()->getMethodInstance()->getUrl();
72
+ }
73
+ }
app/code/community/Phoenix/Worldpay/Block/Success.php CHANGED
@@ -21,8 +21,8 @@ class Phoenix_Worldpay_Block_Success extends Mage_Core_Block_Abstract
21
  {
22
  protected function _toHtml()
23
  {
24
- $successUrl = Mage::getUrl('*/*/success');
25
-
26
  $html = '<html>'
27
  . '<meta http-equiv="refresh" content="0; URL='.$successUrl.'">'
28
  . '<body>'
21
  {
22
  protected function _toHtml()
23
  {
24
+ $successUrl = Mage::getUrl('*/*/success', array('_nosid' => true));
25
+
26
  $html = '<html>'
27
  . '<meta http-equiv="refresh" content="0; URL='.$successUrl.'">'
28
  . '<body>'
app/code/community/Phoenix/Worldpay/Model/Cc.php CHANGED
@@ -14,26 +14,24 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_Worldpay
17
- * @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
  */
19
 
20
 
21
  class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
22
 
23
- {
24
 
25
- /**
26
- * unique internal payment method identifier
27
- *
28
- * @var string [a-z0-9_]
29
  **/
30
  protected $_code = 'worldpay_cc';
31
 
32
  protected $_isGateway = false;
33
  protected $_canAuthorize = true;
34
  protected $_canCapture = true;
35
- protected $_canCapturePartial = false;
36
- protected $_canRefund = false;
37
  protected $_canVoid = false;
38
  protected $_canUseInternal = false;
39
  protected $_canUseCheckout = true;
@@ -41,13 +39,16 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
41
 
42
  protected $_paymentMethod = 'cc';
43
  protected $_defaultLocale = 'en';
44
-
45
  protected $_testUrl = 'https://secure-test.wp3.rbsworldpay.com/wcc/purchase';
46
  protected $_liveUrl = 'https://secure.wp3.rbsworldpay.com/wcc/purchase';
47
 
 
 
 
48
  protected $_formBlockType = 'worldpay/form';
49
  protected $_infoBlockType = 'worldpay/info';
50
-
51
  protected $_order;
52
 
53
  /**
@@ -57,33 +58,15 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
57
  */
58
  public function getOrder()
59
  {
60
- if (!$this->_order) {
61
- $paymentInfo = $this->getInfoInstance();
62
- $this->_order = Mage::getModel('sales/order')
63
- ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId());
64
- }
65
- return $this->_order;
66
  }
67
 
68
  public function getOrderPlaceRedirectUrl()
69
  {
70
- return Mage::getUrl('worldpay/processing/redirect', array('_secure'=>true));
71
- }
72
-
73
- public function capture(Varien_Object $payment, $amount)
74
- {
75
- $payment->setStatus(self::STATUS_APPROVED)
76
- ->setLastTransId($this->getTransactionId());
77
-
78
- return $this;
79
- }
80
-
81
- public function cancel(Varien_Object $payment)
82
- {
83
- $payment->setStatus(self::STATUS_DECLINED)
84
- ->setLastTransId($this->getTransactionId());
85
-
86
- return $this;
87
  }
88
 
89
  /**
@@ -95,14 +78,22 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
95
  {
96
  return $this->_paymentMethod;
97
  }
98
-
99
  public function getUrl()
100
  {
101
  if ($this->getConfigData('transaction_mode') == 'live')
102
  return $this->_liveUrl;
103
  return $this->_testUrl;
104
  }
105
-
 
 
 
 
 
 
 
 
106
  /**
107
  * prepare params array to send it to gateway page via POST
108
  *
@@ -118,16 +109,15 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
118
  $price = number_format($this->getOrder()->getBaseGrandTotal(),2,'.','');
119
  $currency = $this->getOrder()->getBaseCurrencyCode();
120
  }
121
-
122
  $billing = $this->getOrder()->getBillingAddress();
123
- $street = $billing->getStreet();
124
-
125
  $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
126
  if (is_array($locale) && !empty($locale))
127
  $locale = $locale[0];
128
  else
129
  $locale = $this->getDefaultLocale();
130
-
131
  $params = array(
132
  'instId' => $this->getConfigData('inst_id'),
133
  'cartId' => $this->getOrder()->getRealOrderId() . '-' . $this->getOrder()->getQuoteId(),
@@ -138,14 +128,14 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
138
  'hideCurrency' => 'true',
139
  'desc' => Mage::helper('worldpay')->__('Your purchase at') . ' ' . Mage::app()->getStore()->getName(),
140
  'name' => Mage::helper('core')->removeAccents($billing->getFirstname().' '.$billing->getLastname()),
141
- 'address' => Mage::helper('core')->removeAccents($street[0]).'&#10;'.Mage::helper('core')->removeAccents($billing->getCity()),
142
  'postcode' => $billing->getPostcode() ,
143
  'country' => $billing->getCountry(),
144
  'tel' => $billing->getTelephone(),
145
- 'email' => $this->getOrder()->getCustomerEmail(),
146
  'lang' => $locale,
147
  'MC_orderid' => $this->getOrder()->getRealOrderId(),
148
- 'MC_callback' => Mage::getUrl('worldpay/processing/response', array('_secure'=>true))
149
  );
150
 
151
  // set additional flags
@@ -153,7 +143,7 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
153
  $params['fixContact'] = 1;
154
  if ($this->getConfigData('hide_contact') == 1)
155
  $params['hideContact'] = 1;
156
-
157
  // add md5 hash
158
  if ($this->getConfigData('security_key') != '') {
159
  $params['signatureFields'] = 'amount:currency:instId:cartId:authMode:email';
@@ -167,7 +157,128 @@ class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
167
  $params['email']
168
  );
169
  }
170
-
171
  return $params;
172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  }
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_Worldpay
17
+ * @copyright Copyright (c) 2010 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
  */
19
 
20
 
21
  class Phoenix_Worldpay_Model_Cc extends Mage_Payment_Model_Method_Abstract
22
 
23
+ {
24
 
25
+ /**
26
+ * unique internal payment method identifier
27
+ *
28
+ * @var string [a-z0-9_]
29
  **/
30
  protected $_code = 'worldpay_cc';
31
 
32
  protected $_isGateway = false;
33
  protected $_canAuthorize = true;
34
  protected $_canCapture = true;
 
 
35
  protected $_canVoid = false;
36
  protected $_canUseInternal = false;
37
  protected $_canUseCheckout = true;
39
 
40
  protected $_paymentMethod = 'cc';
41
  protected $_defaultLocale = 'en';
42
+
43
  protected $_testUrl = 'https://secure-test.wp3.rbsworldpay.com/wcc/purchase';
44
  protected $_liveUrl = 'https://secure.wp3.rbsworldpay.com/wcc/purchase';
45
 
46
+ protected $_testAdminUrl = 'https://secure-test.wp3.rbsworldpay.com/wcc/itransaction';
47
+ protected $_liveAdminUrl = 'https://secure.wp3.rbsworldpay.com/wcc/itransaction';
48
+
49
  protected $_formBlockType = 'worldpay/form';
50
  protected $_infoBlockType = 'worldpay/info';
51
+
52
  protected $_order;
53
 
54
  /**
58
  */
59
  public function getOrder()
60
  {
61
+ if (!$this->_order) {
62
+ $this->_order = $this->getInfoInstance()->getOrder();
63
+ }
64
+ return $this->_order;
 
 
65
  }
66
 
67
  public function getOrderPlaceRedirectUrl()
68
  {
69
+ return Mage::getUrl('worldpay/processing/redirect');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
71
 
72
  /**
78
  {
79
  return $this->_paymentMethod;
80
  }
81
+
82
  public function getUrl()
83
  {
84
  if ($this->getConfigData('transaction_mode') == 'live')
85
  return $this->_liveUrl;
86
  return $this->_testUrl;
87
  }
88
+
89
+ public function getAdminUrl()
90
+ {
91
+ if ($this->getConfigData('transaction_mode') == 'live')
92
+ return $this->_liveAdminUrl;
93
+ return $this->_testAdminUrl;
94
+ }
95
+
96
+
97
  /**
98
  * prepare params array to send it to gateway page via POST
99
  *
109
  $price = number_format($this->getOrder()->getBaseGrandTotal(),2,'.','');
110
  $currency = $this->getOrder()->getBaseCurrencyCode();
111
  }
112
+
113
  $billing = $this->getOrder()->getBillingAddress();
114
+
 
115
  $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
116
  if (is_array($locale) && !empty($locale))
117
  $locale = $locale[0];
118
  else
119
  $locale = $this->getDefaultLocale();
120
+
121
  $params = array(
122
  'instId' => $this->getConfigData('inst_id'),
123
  'cartId' => $this->getOrder()->getRealOrderId() . '-' . $this->getOrder()->getQuoteId(),
128
  'hideCurrency' => 'true',
129
  'desc' => Mage::helper('worldpay')->__('Your purchase at') . ' ' . Mage::app()->getStore()->getName(),
130
  'name' => Mage::helper('core')->removeAccents($billing->getFirstname().' '.$billing->getLastname()),
131
+ 'address' => Mage::helper('core')->removeAccents($billing->getStreet(-1)).'&#10;'.Mage::helper('core')->removeAccents($billing->getCity()),
132
  'postcode' => $billing->getPostcode() ,
133
  'country' => $billing->getCountry(),
134
  'tel' => $billing->getTelephone(),
135
+ 'email' => $this->getOrder()->getCustomerEmail(),
136
  'lang' => $locale,
137
  'MC_orderid' => $this->getOrder()->getRealOrderId(),
138
+ 'MC_callback' => Mage::getUrl('worldpay/processing/response')
139
  );
140
 
141
  // set additional flags
143
  $params['fixContact'] = 1;
144
  if ($this->getConfigData('hide_contact') == 1)
145
  $params['hideContact'] = 1;
146
+
147
  // add md5 hash
148
  if ($this->getConfigData('security_key') != '') {
149
  $params['signatureFields'] = 'amount:currency:instId:cartId:authMode:email';
157
  $params['email']
158
  );
159
  }
 
160
  return $params;
161
  }
162
+
163
+ /**
164
+ * Refund money
165
+ *
166
+ * @param Varien_Object $invoicePayment
167
+ * @return Mage_GoogleCheckout_Model_Payment
168
+ */
169
+ public function refund(Varien_Object $payment, $amount)
170
+ {
171
+ $transactionId = $payment->getLastTransId();
172
+ $params = $this->_prepareAdminRequestParams();
173
+
174
+ $params['cartId'] = 'Refund';
175
+ $params['op'] = 'refund-partial';
176
+ $params['transId'] = $transactionId;
177
+ $params['amount'] = $amount;
178
+ $params['currency'] = $payment->getOrder()->getBaseCurrencyCode();
179
+
180
+ $responseBody = $this->processAdminRequest($params);
181
+ $response = explode(',', $responseBody);
182
+ if (count($response) <= 0 || $response[0] != 'A' || $response[1] != $transactionId) {
183
+ Mage::throwException($this->_getHelper()->__('Error during refunding online. Server response: %s', $responseBody));
184
+ }
185
+ return $this;
186
+ }
187
+
188
+ /**
189
+ * Capture preatutharized amount
190
+ * @param Varien_Object $payment
191
+ * @param <type> $amount
192
+ */
193
+ public function capture(Varien_Object $payment, $amount)
194
+ {
195
+ if (!$this->canCapture()) {
196
+ return $this;
197
+ }
198
+
199
+ if (Mage::app()->getRequest()->getParam('transId')) {
200
+ // Capture is called from response action
201
+ $payment->setStatus(self::STATUS_APPROVED);
202
+ return $this;
203
+ }
204
+ $transactionId = $payment->getLastTransId();
205
+ $params = $this->_prepareAdminRequestParams();
206
+ $params['transId'] = $transactionId;
207
+ $params['authMode'] = '0';
208
+ $params['op'] = 'postAuth-full';
209
+
210
+ $responseBody = $this->processAdminRequest($params);
211
+ $response = explode(',', $responseBody);
212
+
213
+ if (count($response) <= 0 || $response[0] != 'A' || $response[1] != $transactionId) {
214
+ Mage::throwException($this->_getHelper()->__('Error during capture online. Server response: %s', $responseBody));
215
+ } else {
216
+ $payment->getOrder()->addStatusToHistory($payment->getOrder()->getStatus(), $this->_getHelper()->__('Worldpay transaction has been captured.'));
217
+ }
218
+ }
219
+
220
+
221
+ /**
222
+ * Check refund availability
223
+ *
224
+ * @return bool
225
+ */
226
+ public function canRefund ()
227
+ {
228
+ return $this->getConfigData('enable_online_operations');
229
+ }
230
+
231
+ public function canRefundInvoicePartial()
232
+ {
233
+ return $this->getConfigData('enable_online_operations');
234
+ }
235
+
236
+ public function canRefundPartialPerInvoice()
237
+ {
238
+ return $this->canRefundInvoicePartial();
239
+ }
240
+
241
+ public function canCapturePartial()
242
+ {
243
+ if (Mage::app()->getFrontController()->getAction()->getFullActionName() != 'adminhtml_sales_order_creditmemo_new'){
244
+ return false;
245
+ }
246
+ return $this->getConfigData('enable_online_operations');
247
+ }
248
+
249
+ protected function processAdminRequest($params, $requestTimeout = 60)
250
+ {
251
+ try {
252
+ $client = new Varien_Http_Client();
253
+ $client->setUri($this->getAdminUrl())
254
+ ->setConfig(array('timeout'=>$requestTimeout,))
255
+ ->setParameterPost($params)
256
+ ->setMethod(Zend_Http_Client::POST);
257
+
258
+ $response = $client->request();
259
+ $responseBody = $response->getBody();
260
+
261
+ if (empty($responseBody))
262
+ Mage::throwException($this->_getHelper()->__('Worldpay API failure. The request has not been processed.'));
263
+ // create array out of response
264
+
265
+ } catch (Exception $e) {
266
+ Mage::log($e->getMessage());
267
+ Mage::throwException($this->_getHelper()->__('Worldpay API connection error. The request has not been processed.'));
268
+ }
269
+
270
+ return $responseBody;
271
+ }
272
+
273
+ protected function _prepareAdminRequestParams()
274
+ {
275
+ $params = array (
276
+ 'authPW' => $this->getConfigData('auth_password'),
277
+ 'instId' => $this->getConfigData('admin_inst_id'),
278
+ );
279
+ if ($this->getConfigData('transaction_mode') == 'test') {
280
+ $params['testMode'] = 100;
281
+ }
282
+ return $params;
283
+ }
284
  }
app/code/community/Phoenix/Worldpay/controllers/ProcessingController.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_Worldpay
17
- * @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
  */
19
 
20
  class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_Action
@@ -22,26 +22,19 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
22
  protected $_redirectBlockType = 'worldpay/processing';
23
  protected $_successBlockType = 'worldpay/success';
24
  protected $_failureBlockType = 'worldpay/failure';
25
-
26
- protected $_sendNewOrderEmail = true;
27
-
28
  protected $_order = NULL;
29
  protected $_paymentInst = NULL;
30
-
31
- protected function _expireAjax()
32
- {
33
- if (!$this->getCheckout()->getQuote()->hasItems()) {
34
- $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
35
- exit;
36
- }
37
- }
38
 
39
  /**
40
  * Get singleton of Checkout Session Model
41
  *
42
  * @return Mage_Checkout_Model_Session
43
  */
44
- public function getCheckout()
45
  {
46
  return Mage::getSingleton('checkout/session');
47
  }
@@ -51,58 +44,43 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
51
  */
52
  public function redirectAction()
53
  {
54
- $session = $this->getCheckout();
55
- $session->setWorldpayQuoteId($session->getQuoteId());
56
- $session->setWorldpayRealOrderId($session->getLastRealOrderId());
57
-
58
- $order = Mage::getModel('sales/order');
59
- $order->loadByIncrementId($session->getLastRealOrderId());
60
- $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_HOLDED, Mage::helper('worldpay')->__('Customer was redirected to Worldpay.'));
61
- $order->save();
62
-
63
- $this->getResponse()->setBody(
64
- $this->getLayout()
65
- ->createBlock($this->_redirectBlockType)
66
- ->setOrder($order)
67
- ->toHtml()
68
- );
69
-
70
- $session->unsQuoteId();
 
 
 
71
  }
72
-
73
  /**
74
  * Worldpay returns POST variables to this action
75
  */
76
  public function responseAction()
77
  {
78
  try {
79
- $request = $this->_checkReturnedPost();
80
-
81
- // save transaction ID and AVS info
82
- $this->_paymentInst
83
- ->setTransactionId($request['transId'])
84
- ->setCcAvsStatus($request['AVS']);
85
- if ($this->_order->canInvoice()) {
86
- $invoice = $this->_order->prepareInvoice();
87
-
88
- $invoice->register()->capture();
89
- Mage::getModel('core/resource_transaction')
90
- ->addObject($invoice)
91
- ->addObject($invoice->getOrder())
92
- ->save();
93
  }
94
- $this->_order->addStatusToHistory($this->_paymentInst->getConfigData('order_status'), Mage::helper('worldpay')->__($this->_paymentInst->getConfigData('request_type').':Customer returned successfully'));
95
- $this->_order->save();
96
-
97
- $this->getResponse()->setBody(
98
- $this->getLayout()
99
- ->createBlock($this->_successBlockType)
100
- ->setOrder($this->_order)
101
- ->toHtml()
102
- );
103
-
104
- } catch (Exception $e) {
105
- Mage::log($e->getMessage());
106
  $this->getResponse()->setBody(
107
  $this->getLayout()
108
  ->createBlock($this->_failureBlockType)
@@ -115,22 +93,33 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
115
  /**
116
  * Worldpay return action
117
  */
118
- protected function successAction()
119
  {
120
- $session = $this->getCheckout();
121
-
122
- $session->unsWorldpayRealOrderId();
123
- $session->setQuoteId($session->getWorldpayQuoteId(true));
124
- $session->getQuote()->setIsActive(false)->save();
125
-
126
- $order = Mage::getModel('sales/order');
127
- $order->load($this->getCheckout()->getLastOrderId());
128
- if($order->getId() && $this->_sendNewOrderEmail)
129
- $order->sendNewOrderEmail();
 
 
 
130
 
131
- $this->_redirect('checkout/onepage/success');
 
 
 
 
 
 
 
132
  }
133
 
 
134
  /**
135
  * Checking POST variables.
136
  * Creating invoice if payment was successfull or cancel order if payment was declined
@@ -139,46 +128,99 @@ class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_A
139
  {
140
  // check request type
141
  if (!$this->getRequest()->isPost())
142
- throw new Exception('Wrong request type.', 10);
143
 
144
  // get request variables
145
  $request = $this->getRequest()->getPost();
146
  if (empty($request))
147
- throw new Exception('Request doesn\'t contain POST elements.', 20);
148
-
149
  // check order id
150
  if (empty($request['MC_orderid']) || strlen($request['MC_orderid']) > 50)
151
- throw new Exception('Missing or invalid order ID', 40);
152
-
153
  // load order for further validation
154
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($request['MC_orderid']);
 
 
 
155
  $this->_paymentInst = $this->_order->getPayment()->getMethodInstance();
156
-
157
  // check transaction password
158
  if ($this->_paymentInst->getConfigData('transaction_password') != $request['callbackPW'])
159
- throw new Exception('Transaction password wrong');
 
160
 
161
- // check transaction status
162
- if (!empty($request['transStatus']) && $request['transStatus'] != 'Y')
163
- throw new Exception('Transaction was not successfull.');
164
 
 
 
 
 
 
165
  // check transaction amount and currency
166
- if ($this->_order->getPayment()->getMethodInstance()->getConfigData('use_store_currency')) {
167
  $price = number_format($this->_order->getGrandTotal(),2,'.','');
168
  $currency = $this->_order->getOrderCurrencyCode();
169
  } else {
170
  $price = number_format($this->_order->getBaseGrandTotal(),2,'.','');
171
  $currency = $this->_order->getBaseCurrencyCode();
172
  }
173
-
174
  // check transaction amount
175
  if ($price != $request['authAmount'])
176
- throw new Exception('Transaction currency doesn\'t match.');
177
-
178
  // check transaction currency
179
  if ($currency != $request['authCurrency'])
180
- throw new Exception('Transaction currency doesn\'t match.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
- return $request;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
  }
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_Worldpay
17
+ * @copyright Copyright (c) 2010 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
  */
19
 
20
  class Phoenix_Worldpay_ProcessingController extends Mage_Core_Controller_Front_Action
22
  protected $_redirectBlockType = 'worldpay/processing';
23
  protected $_successBlockType = 'worldpay/success';
24
  protected $_failureBlockType = 'worldpay/failure';
25
+ protected $_cancelBlockType = 'worldpay/cancel';
26
+
27
+
28
  protected $_order = NULL;
29
  protected $_paymentInst = NULL;
30
+
 
 
 
 
 
 
 
31
 
32
  /**
33
  * Get singleton of Checkout Session Model
34
  *
35
  * @return Mage_Checkout_Model_Session
36
  */
37
+ protected function _getCheckout()
38
  {
39
  return Mage::getSingleton('checkout/session');
40
  }
44
  */
45
  public function redirectAction()
46
  {
47
+ try {
48
+ $session = $this->_getCheckout();
49
+
50
+ $order = Mage::getModel('sales/order');
51
+ $order->loadByIncrementId($session->getLastRealOrderId());
52
+ $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_HOLDED, Mage::helper('worldpay')->__('Customer was redirected to Worldpay.'));
53
+ $order->save();
54
+
55
+ $session->getQuote()->setIsActive(false)->save();
56
+ $session->setWorldpayQuoteId($session->getQuoteId());
57
+ $session->setWorldpayRealOrderId($session->getLastRealOrderId());
58
+ $session->clear();
59
+
60
+ $this->loadLayout();
61
+ $this->renderLayout();
62
+ } catch (Mage_Core_Exception $e) {
63
+ $this->_getCheckout()->addError($e->getMessage());
64
+ } catch(Exception $e) {
65
+ Mage::logException($e);
66
+ }
67
  }
68
+
69
  /**
70
  * Worldpay returns POST variables to this action
71
  */
72
  public function responseAction()
73
  {
74
  try {
75
+ $request = $this->_checkReturnedPost();
76
+ if ($request['transStatus'] == 'Y') {
77
+ $this->_processSale($request);
78
+ } elseif ($request['transStatus'] == 'C') {
79
+ $this->_processCancel($request);
80
+ } else {
81
+ Mage::throwException('Transaction was not successfull.');
 
 
 
 
 
 
 
82
  }
83
+ } catch (Mage_Core_Exception $e) {
 
 
 
 
 
 
 
 
 
 
 
84
  $this->getResponse()->setBody(
85
  $this->getLayout()
86
  ->createBlock($this->_failureBlockType)
93
  /**
94
  * Worldpay return action
95
  */
96
+ public function successAction()
97
  {
98
+ try {
99
+ $session = $this->_getCheckout();
100
+ $quoteId = $session->getWorldpayQuoteId();
101
+ $this->_getCheckout()->setLastSuccessQuoteId($quoteId);
102
+ $this->_redirect('checkout/onepage/success');
103
+ return;
104
+ } catch (Mage_Core_Exception $e) {
105
+ $this->_getCheckout()->addError($e->getMessage());
106
+ } catch(Exception $e) {
107
+ Mage::logException($e);
108
+ }
109
+ $this->_redirect('checkout/cart');
110
+ }
111
 
112
+ /**
113
+ * Worldpay return action
114
+ */
115
+ public function cancelAction()
116
+ {
117
+ $this->_getCheckout()->setQuoteId($this->_getCheckout()->getWorldpayQuoteId());
118
+ $this->_getCheckout()->addError(Mage::helper('worldpay')->__('Payment was canceled'));
119
+ $this->_redirect('checkout/cart');
120
  }
121
 
122
+
123
  /**
124
  * Checking POST variables.
125
  * Creating invoice if payment was successfull or cancel order if payment was declined
128
  {
129
  // check request type
130
  if (!$this->getRequest()->isPost())
131
+ Mage::throwException('Wrong request type.');
132
 
133
  // get request variables
134
  $request = $this->getRequest()->getPost();
135
  if (empty($request))
136
+ Mage::throwException('Request doesn\'t contain POST elements.');
137
+
138
  // check order id
139
  if (empty($request['MC_orderid']) || strlen($request['MC_orderid']) > 50)
140
+ Mage::throwException('Missing or invalid order ID');
141
+
142
  // load order for further validation
143
  $this->_order = Mage::getModel('sales/order')->loadByIncrementId($request['MC_orderid']);
144
+ if (!$this->_order->getId())
145
+ Mage::throwException('Order not found');
146
+
147
  $this->_paymentInst = $this->_order->getPayment()->getMethodInstance();
148
+
149
  // check transaction password
150
  if ($this->_paymentInst->getConfigData('transaction_password') != $request['callbackPW'])
151
+ Mage::throwException('Transaction password wrong');
152
+
153
 
154
+ return $request;
155
+ }
 
156
 
157
+ /**
158
+ * Process success response
159
+ */
160
+ protected function _processSale($request)
161
+ {
162
  // check transaction amount and currency
163
+ if ($this->_paymentInst->getConfigData('use_store_currency')) {
164
  $price = number_format($this->_order->getGrandTotal(),2,'.','');
165
  $currency = $this->_order->getOrderCurrencyCode();
166
  } else {
167
  $price = number_format($this->_order->getBaseGrandTotal(),2,'.','');
168
  $currency = $this->_order->getBaseCurrencyCode();
169
  }
170
+
171
  // check transaction amount
172
  if ($price != $request['authAmount'])
173
+ Mage::throwException('Transaction currency doesn\'t match.');
174
+
175
  // check transaction currency
176
  if ($currency != $request['authCurrency'])
177
+ Mage::throwException('Transaction currency doesn\'t match.');
178
+
179
+ // save transaction ID and AVS info
180
+ $this->_order->getPayment()->setLastTransId($request['transId']);
181
+ $this->_order->getPayment()->setCcAvsStatus($request['AVS']);
182
+
183
+ switch($request['authMode']) {
184
+ case 'A':
185
+ if ($this->_order->canInvoice()) {
186
+ $invoice = $this->_order->prepareInvoice();
187
+ $invoice->register()->capture();
188
+ $this->_order->addRelatedObject($invoice);
189
+ }
190
+ $this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, Mage::helper('worldpay')->__('authorize: Customer returned successfully'));
191
+ break;
192
+ case 'E':
193
+ $this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, Mage::helper('worldpay')->__('preauthorize: Customer returned successfully'));
194
+ break;
195
+ }
196
 
197
+ $this->_order->sendNewOrderEmail();
198
+ $this->_order->setEmailSent(true);
199
+
200
+ $this->_order->save();
201
+
202
+ $this->getResponse()->setBody(
203
+ $this->getLayout()
204
+ ->createBlock($this->_successBlockType)
205
+ ->setOrder($this->_order)
206
+ ->toHtml()
207
+ );
208
+ }
209
+
210
+ /**
211
+ * Process success response
212
+ */
213
+ protected function _processCancel($request)
214
+ {
215
+ $this->_order->cancel();
216
+ $this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_CANCELED, Mage::helper('worldpay')->__('Payment was canceled'));
217
+ $this->_order->save();
218
+
219
+ $this->getResponse()->setBody(
220
+ $this->getLayout()
221
+ ->createBlock($this->_cancelBlockType)
222
+ ->setOrder($this->_order)
223
+ ->toHtml()
224
+ );
225
  }
226
  }
app/code/community/Phoenix/Worldpay/etc/config.xml CHANGED
@@ -15,13 +15,13 @@
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_Worldpay
18
- * @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
19
  */
20
  -->
21
  <config>
22
  <modules>
23
  <Phoenix_Worldpay>
24
- <version>1.1.3</version>
25
  </Phoenix_Worldpay>
26
  </modules>
27
  <global>
@@ -75,6 +75,9 @@
75
  </payment>
76
  </global>
77
  <frontend>
 
 
 
78
  <routers>
79
  <worldpay>
80
  <use>standard</use>
@@ -130,6 +133,7 @@
130
  <transaction_mode>test</transaction_mode>
131
  <fix_contact>1</fix_contact>
132
  <hide_contact>0</hide_contact>
 
133
  </worldpay_cc>
134
  </payment>
135
  </default>
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_Worldpay
18
+ * @copyright Copyright (c) 2010 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
19
  */
20
  -->
21
  <config>
22
  <modules>
23
  <Phoenix_Worldpay>
24
+ <version>1.2.0</version>
25
  </Phoenix_Worldpay>
26
  </modules>
27
  <global>
75
  </payment>
76
  </global>
77
  <frontend>
78
+ <secure_url>
79
+ <worldpay_processing>/worldpay/processing</worldpay_processing>
80
+ </secure_url>
81
  <routers>
82
  <worldpay>
83
  <use>standard</use>
133
  <transaction_mode>test</transaction_mode>
134
  <fix_contact>1</fix_contact>
135
  <hide_contact>0</hide_contact>
136
+ <enable_online_operations>0</enable_online_operations>
137
  </worldpay_cc>
138
  </payment>
139
  </default>
app/code/community/Phoenix/Worldpay/etc/system.xml CHANGED
@@ -13,8 +13,8 @@
13
  * obtain it through the world-wide-web, please send an email
14
  * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
- * @category Phoenix
17
- * @package Phoenix_Worldpay
18
  * @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
19
  */
20
  -->
@@ -30,14 +30,14 @@
30
  <show_in_website>1</show_in_website>
31
  <show_in_store>0</show_in_store>
32
  <fields>
33
- <active translate="label">
34
- <label>Enabled</label>
35
- <frontend_type>select</frontend_type>
36
- <source_model>adminhtml/system_config_source_yesno</source_model>
37
- <sort_order>1</sort_order>
38
- <show_in_default>1</show_in_default>
39
- <show_in_website>1</show_in_website>
40
- <show_in_store>0</show_in_store>
41
  </active>
42
  <order_status translate="label">
43
  <label>New order status</label>
@@ -100,27 +100,27 @@
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
- </inst_id>
104
- <transaction_password>
105
- <label>Payment Response password</label>
106
- <frontend_type>text</frontend_type>
107
- <sort_order>8</sort_order>
108
- <show_in_default>1</show_in_default>
109
- <show_in_website>1</show_in_website>
110
- <show_in_store>0</show_in_store>
111
  </transaction_password>
112
- <security_key>
113
  <label>MD5 secret</label>
114
- <comment>Should be between 8-16 characters.</comment>
115
- <frontend_type>text</frontend_type>
116
- <sort_order>9</sort_order>
117
- <show_in_default>1</show_in_default>
118
- <show_in_website>1</show_in_website>
119
- <show_in_store>0</show_in_store>
120
- </security_key>
121
  <request_type>
122
  <label>Request Type</label>
123
- <frontend_type>select</frontend_type>
124
  <source_model>worldpay/source_requestType</source_model>
125
  <sort_order>10</sort_order>
126
  <show_in_default>1</show_in_default>
@@ -129,33 +129,62 @@
129
  </request_type>
130
  <transaction_mode>
131
  <label>Transaction Mode</label>
132
- <frontend_type>select</frontend_type>
133
  <source_model>worldpay/source_transactionMode</source_model>
134
  <sort_order>11</sort_order>
135
  <show_in_default>1</show_in_default>
136
  <show_in_website>1</show_in_website>
137
  <show_in_store>0</show_in_store>
138
- </transaction_mode>
139
- <fix_contact>
140
- <label>Fix contact</label>
141
- <frontend_type>select</frontend_type>
142
- <source_model>adminhtml/system_config_source_yesno</source_model>
143
- <sort_order>12</sort_order>
144
- <show_in_default>1</show_in_default>
145
- <show_in_website>1</show_in_website>
146
- <show_in_store>0</show_in_store>
147
- </fix_contact>
148
- <hide_contact>
149
- <label>Hide contact</label>
150
- <frontend_type>select</frontend_type>
151
- <source_model>adminhtml/system_config_source_yesno</source_model>
152
- <sort_order>13</sort_order>
153
- <show_in_default>1</show_in_default>
154
- <show_in_website>1</show_in_website>
155
- <show_in_store>0</show_in_store>
156
  </hide_contact>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  </fields>
158
- </worldpay_cc>
159
  </groups>
160
  </payment>
161
  </sections>
13
  * obtain it through the world-wide-web, please send an email
14
  * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
+ * @category Phoenix
17
+ * @package Phoenix_Worldpay
18
  * @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
19
  */
20
  -->
30
  <show_in_website>1</show_in_website>
31
  <show_in_store>0</show_in_store>
32
  <fields>
33
+ <active translate="label">
34
+ <label>Enabled</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>adminhtml/system_config_source_yesno</source_model>
37
+ <sort_order>1</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
  </active>
42
  <order_status translate="label">
43
  <label>New order status</label>
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
+ </inst_id>
104
+ <transaction_password>
105
+ <label>Payment Response password</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>8</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>0</show_in_store>
111
  </transaction_password>
112
+ <security_key>
113
  <label>MD5 secret</label>
114
+ <comment>Should be between 8-16 characters.</comment>
115
+ <frontend_type>text</frontend_type>
116
+ <sort_order>9</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>0</show_in_store>
120
+ </security_key>
121
  <request_type>
122
  <label>Request Type</label>
123
+ <frontend_type>select</frontend_type>
124
  <source_model>worldpay/source_requestType</source_model>
125
  <sort_order>10</sort_order>
126
  <show_in_default>1</show_in_default>
129
  </request_type>
130
  <transaction_mode>
131
  <label>Transaction Mode</label>
132
+ <frontend_type>select</frontend_type>
133
  <source_model>worldpay/source_transactionMode</source_model>
134
  <sort_order>11</sort_order>
135
  <show_in_default>1</show_in_default>
136
  <show_in_website>1</show_in_website>
137
  <show_in_store>0</show_in_store>
138
+ </transaction_mode>
139
+ <fix_contact>
140
+ <label>Fix contact</label>
141
+ <frontend_type>select</frontend_type>
142
+ <source_model>adminhtml/system_config_source_yesno</source_model>
143
+ <sort_order>12</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>0</show_in_store>
147
+ </fix_contact>
148
+ <hide_contact>
149
+ <label>Hide contact</label>
150
+ <frontend_type>select</frontend_type>
151
+ <source_model>adminhtml/system_config_source_yesno</source_model>
152
+ <sort_order>13</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>0</show_in_store>
156
  </hide_contact>
157
+ <enable_online_operations>
158
+ <label>Enable online operations</label>
159
+ <comment>Remote admin installation is needed to perform online refund</comment>
160
+ <frontend_type>select</frontend_type>
161
+ <source_model>adminhtml/system_config_source_yesno</source_model>
162
+ <sort_order>14</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>0</show_in_store>
166
+ </enable_online_operations>
167
+ <admin_inst_id>
168
+ <label>Remote Admin Installation ID</label>
169
+ <frontend_type>text</frontend_type>
170
+ <comment>Required for Remote Admin</comment>
171
+ <backend_model>worldpay/config_backend_instid</backend_model>
172
+ <sort_order>15</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>0</show_in_store>
176
+ </admin_inst_id>
177
+ <auth_password>
178
+ <label>Authorisation password</label>
179
+ <comment>Required for Remote Admin</comment>
180
+ <frontend_type>text</frontend_type>
181
+ <sort_order>16</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>0</show_in_store>
185
+ </auth_password>
186
  </fields>
187
+ </worldpay_cc>
188
  </groups>
189
  </payment>
190
  </sections>
app/design/adminhtml/default/default/template/worldpay/info.phtml CHANGED
@@ -20,9 +20,9 @@
20
  <?php
21
  echo $this->getMethod()->getTitle() . '<br/>';
22
  if ($this->getInfo()->getLastTransId() == '') {
23
- echo $this->__('Payment has not been processed yet.') . '<br/>';
24
  } else {
25
- echo $this->__('Worldpay Transaction ID: %s', $this->htmlEscape($this->getInfo()->getLastTransId())) . '<br/>';
26
- echo $this->__('AVS status: %s', $this->htmlEscape($this->getInfo()->getCcAvsStatus())) . '<br/>';
27
  }
28
  ?>
20
  <?php
21
  echo $this->getMethod()->getTitle() . '<br/>';
22
  if ($this->getInfo()->getLastTransId() == '') {
23
+ echo Mage::helper('worldpay')->__('Payment has not been processed yet.') . '<br/>';
24
  } else {
25
+ echo Mage::helper('worldpay')->__('Worldpay Transaction ID: %s', $this->htmlEscape($this->getInfo()->getLastTransId())) . '<br/>';
26
+ echo Mage::helper('worldpay')->__('AVS status: %s', $this->htmlEscape($this->getInfo()->getCcAvsStatus())) . '<br/>';
27
  }
28
  ?>
app/design/frontend/default/default/layout/worldpay.xml CHANGED
@@ -31,5 +31,12 @@ Worldpay Failure Response Review
31
  <block type="worldpay/failure" name="worldpay_failure" template="worldpay/failure.phtml" />
32
  </reference>
33
  </worldpay_processing_failure>
34
-
 
 
 
 
 
 
 
35
  </layout>
31
  <block type="worldpay/failure" name="worldpay_failure" template="worldpay/failure.phtml" />
32
  </reference>
33
  </worldpay_processing_failure>
34
+ <worldpay_processing_redirect>
35
+ <reference name="root">
36
+ <action method="setTemplate"><template>worldpay/blank.phtml</template></action>
37
+ </reference>
38
+ <reference name="content">
39
+ <block type="worldpay/redirect" name="worldpay_redirect" template="worldpay/redirect.phtml" />
40
+ </reference>
41
+ </worldpay_processing_redirect>
42
  </layout>
app/design/frontend/default/default/template/worldpay/blank.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category design_default
16
+ * @package Phoenix_Worldpay
17
+ * @copyright Copyright (c) 2008 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
+ */
19
+ ?>
20
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
21
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
22
+ <head>
23
+ </head>
24
+ <body>
25
+ <?php echo $this->getChildHtml('content') ?>
26
+ </body>
27
+ </html>
app/design/frontend/default/default/template/worldpay/cancel.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category design_default
16
+ * @package Phoenix_Worldpay
17
+ * @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
+ */
19
+ ?>
20
+ <html>
21
+ <meta http-equiv="refresh" content="0; URL=<?php echo $this->getContinueShoppingUrl()?>">
22
+ <body>
23
+ <div class="page-head">
24
+ <h3><?php echo Mage::helper('worldpay')->__('Payment was canceled') ?></h3>
25
+ </div>
26
+ <p><?php echo Mage::helper('worldpay')->__('Please <a href="%s">continue shopping</a>.', $this->getContinueShoppingUrl()) ?></p>
27
+ </body>
28
+ </html>
app/design/frontend/default/default/template/worldpay/failure.phtml CHANGED
@@ -21,8 +21,8 @@
21
  <meta http-equiv="refresh" content="0; URL=<?php echo $this->getContinueShoppingUrl()?>">
22
  <body>
23
  <div class="page-head">
24
- <h3><?php echo $this->__('Error occured') ?></h3>
25
  </div>
26
- <p><?php echo $this->__('Please <a href="%s">continue shopping</a>.', $this->getContinueShoppingUrl()) ?></p>
27
  </body>
28
  </html>
21
  <meta http-equiv="refresh" content="0; URL=<?php echo $this->getContinueShoppingUrl()?>">
22
  <body>
23
  <div class="page-head">
24
+ <h3><?php echo Mage::helper('worldpay')->__('Error occured') ?></h3>
25
  </div>
26
+ <p><?php echo Mage::helper('worldpay')->__('Please <a href="%s">continue shopping</a>.', $this->getContinueShoppingUrl()) ?></p>
27
  </body>
28
  </html>
app/design/frontend/default/default/template/worldpay/form.phtml CHANGED
@@ -21,7 +21,7 @@
21
  <?php $_code=$this->getMethodCode() ?>
22
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
23
  <li>
24
- <?php echo $this->__($_code.':You will be redirected to Worldpay website when you place an order.') ?>
25
  </li>
26
  </ul>
27
  </fieldset>
21
  <?php $_code=$this->getMethodCode() ?>
22
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
23
  <li>
24
+ <?php echo Mage::helper('worldpay')->__($_code.':You will be redirected to Worldpay website when you place an order.') ?>
25
  </li>
26
  </ul>
27
  </fieldset>
app/design/frontend/default/default/template/worldpay/info.phtml CHANGED
@@ -20,8 +20,8 @@
20
  <?php
21
  echo $this->getMethod()->getTitle() . '<br/>';
22
  if ($this->getInfo()->getLastTransId() == '') {
23
- echo '<em>' . $this->__($this->getMethodCode().':You will be redirected to Worldpay website when you place an order.') . '</em>';
24
  } else {
25
- echo $this->__('Worldpay Transaction ID: %s', $this->htmlEscape($this->getInfo()->getLastTransId())) . '<br/>';
26
  }
27
  ?>
20
  <?php
21
  echo $this->getMethod()->getTitle() . '<br/>';
22
  if ($this->getInfo()->getLastTransId() == '') {
23
+ echo '<em>' . Mage::helper('worldpay')->__($this->getMethodCode().':You will be redirected to Worldpay website when you place an order.') . '</em>';
24
  } else {
25
+ echo Mage::helper('worldpay')->__('Worldpay Transaction ID: %s', $this->htmlEscape($this->getInfo()->getLastTransId())) . '<br/>';
26
  }
27
  ?>
app/design/frontend/default/default/template/worldpay/redirect.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category design_default
16
+ * @package Phoenix_Worldpay
17
+ * @copyright Copyright (c) 2008 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
+ */
19
+ ?>
20
+ <b><?php echo Mage::helper('worldpay')->__('You will be redirected to Worldpay in a few seconds.'); ?></b>
21
+ <form name="worldpay_checkout" id="worldpay_checkout" action="<?php echo $this->getFormAction();?>" method="POST">
22
+ <?php if (is_array($this->getFormData())): ?>
23
+ <?php foreach ($this->getFormData() as $name => $value): ?>
24
+ <input type="hidden" name="<?php echo $name; ?>" value="<?php echo $value; ?>"/>
25
+ <?php endforeach; ?>
26
+ <?php endif; ?>
27
+ </form>
28
+
29
+ <script type="text/javascript">
30
+ //<![CDATA[
31
+ var paymentform = document.getElementById('worldpay_checkout');
32
+ window.onload = paymentform.submit();
33
+ //]]>
34
+ </script>
app/locale/de_DE/Phoenix_Worldpay.csv CHANGED
@@ -2,8 +2,8 @@
2
  "Your payment has been successfully processed by our shop system.","Ihre Zahlung war erfolgreich."
3
  "Please click <a href="%s">here</a> if you are not redirected automatically.","Bitte klicken Sie <a href="%s">hier</a> wenn Sie nicht automatisch weitergeleitet werden."
4
  "Customer was redirected to Worldpay.","Kunde wurde an Worldpay weitergeleitet."
5
- "authorize:Customer returned successfully","Der Betrag wurde bei Worldpay vorautorisiert."
6
- "authorize_capture:Customer returned successfully","Der Betrag wurde bei Worldpay autorisiert und abgebucht."
7
  "Customer was rejected by Worldpay","Kunde wurde von Worldpay abgelehnt"
8
  "Error occured","Ein Fehler trat auf"
9
  "Please <a href=""%s"">continue shopping</a>.","<a href=""%s"">Weiter einkaufen</a>."
@@ -14,4 +14,6 @@
14
  "Payment has not been processed yet.","Die Zahlung wurde noch nicht durchgeführt."
15
  "Authorization","Autorisierung"
16
  "Preauthorization","Vorautorisierung"
17
- "Your purchase at","Ihr Einkauf bei"
 
 
2
  "Your payment has been successfully processed by our shop system.","Ihre Zahlung war erfolgreich."
3
  "Please click <a href="%s">here</a> if you are not redirected automatically.","Bitte klicken Sie <a href="%s">hier</a> wenn Sie nicht automatisch weitergeleitet werden."
4
  "Customer was redirected to Worldpay.","Kunde wurde an Worldpay weitergeleitet."
5
+ "preauthorize: Customer returned successfully","Der Betrag wurde bei Worldpay vorautorisiert."
6
+ "authorize: Customer returned successfully","Der Betrag wurde bei Worldpay autorisiert und abgebucht."
7
  "Customer was rejected by Worldpay","Kunde wurde von Worldpay abgelehnt"
8
  "Error occured","Ein Fehler trat auf"
9
  "Please <a href=""%s"">continue shopping</a>.","<a href=""%s"">Weiter einkaufen</a>."
14
  "Payment has not been processed yet.","Die Zahlung wurde noch nicht durchgeführt."
15
  "Authorization","Autorisierung"
16
  "Preauthorization","Vorautorisierung"
17
+ "Your purchase at","Ihr Einkauf bei"
18
+ "Error during refunding online. Server response: %s", "Fehler während der Gutschrift-Erteilung. Server-Antwort: %s"
19
+ "Worldpay transaction has been captured.", "Worldpay Transaktion wurde abgebucht."
app/locale/en_US/Phoenix_Worldpay.csv CHANGED
@@ -2,8 +2,8 @@
2
  "Your payment has been successfully processed by our shop system.","Your payment has been successfully processed by our shop system."
3
  "Please click <a href="%s">here</a> if you are not redirected automatically.","Please click <a href="%s">here</a> if you are not redirected automatically."
4
  "Customer was redirected to Worldpay.","Customer was redirected to Worldpay."
5
- "authorize:Customer returned successfully","The amount has been preauthorized by Worldpay."
6
- "authorize_capture:Customer returned successfully","The amount has been authorized and captured by Worldpay."
7
  "Customer was rejected by Worldpay","Customer was rejected by Worldpay"
8
  "Error occured","Error occured"
9
  "Please <a href=""%s"">continue shopping</a>.","Please <a href=""%s"">continue shopping</a>."
@@ -14,4 +14,6 @@
14
  "Payment has not been processed yet.", "Payment has not been processed yet."
15
  "Authorization","Authorization"
16
  "Preauthorization","Preauthorization"
17
- "Your purchase at","Your purchase at"
 
 
2
  "Your payment has been successfully processed by our shop system.","Your payment has been successfully processed by our shop system."
3
  "Please click <a href="%s">here</a> if you are not redirected automatically.","Please click <a href="%s">here</a> if you are not redirected automatically."
4
  "Customer was redirected to Worldpay.","Customer was redirected to Worldpay."
5
+ "preauthorize: Customer returned successfully","The amount has been preauthorized by Worldpay."
6
+ "authorize: Customer returned successfully","The amount has been authorized and captured by Worldpay."
7
  "Customer was rejected by Worldpay","Customer was rejected by Worldpay"
8
  "Error occured","Error occured"
9
  "Please <a href=""%s"">continue shopping</a>.","Please <a href=""%s"">continue shopping</a>."
14
  "Payment has not been processed yet.", "Payment has not been processed yet."
15
  "Authorization","Authorization"
16
  "Preauthorization","Preauthorization"
17
+ "Your purchase at","Your purchase at"
18
+ "Error during refunding online. Server response: %s", "Error during refunding online. Server response: %s"
19
+ "Worldpay transaction has been captured.", "Worldpay transaction has been captured."
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Phoenix_Worldpay</name>
4
- <version>1.1.3</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,15 @@ 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>- Added new WorldPay URLs</notes>
 
 
 
 
23
  <authors><author><name>Phoenix Medien</name><user>auto-converted</user><email>info@phoenix-medien.de</email></author></authors>
24
- <date>2009-11-06</date>
25
- <time>13:46:41</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="bbf2f9a11fd73ceb7aff46b763d95adc"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="worldpay.xml" hash="a229b174eff5a9320862ec72743961f4"/></dir><dir name="template"><dir name="worldpay"><file name="failure.phtml" hash="383014063d48c501abb9a3f78a5758eb"/><file name="form.phtml" hash="e9a5067faeea45f941e2df6a7eb02920"/><file name="info.phtml" hash="c1f61ee39bc04f0783c192236d2db39f"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_Worldpay.csv" hash="b0224148b4cc03ea52016b985d19b0ae"/></dir><dir name="en_US"><file name="Phoenix_Worldpay.csv" hash="30b93daeda3bdfdaadbf15ecbd18c0b5"/></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="Failure.php" hash="e96caa77dcdeb5b4e46145e1f032db90"/><file name="Form.php" hash="d279b2d502e875e155101007eef7ebc5"/><file name="Info.php" hash="24bc51b1b86cd3a020982b09e8695c22"/><file name="Processing.php" hash="0f495f4f01f213d999291164d8d6a0c6"/><file name="Success.php" hash="cec01e1f56b8321bb4cafbfc0e330678"/></dir><dir name="controllers"><file name="ProcessingController.php" hash="51718aa6b752d5104a0e14095ec4e7f5"/></dir><dir name="etc"><file name="config.xml" hash="c3b3e4ab937f25be15ac7a7e0101b82e"/><file name="system.xml" hash="56b88292f4c8ace49aa2f7bc677546b6"/></dir><dir name="Helper"><file name="Data.php" hash="354473f472247a9dae11a1fac0cef407"/></dir><dir name="Model"><dir name="Config"><dir name="Backend"><file name="Instid.php" hash="20c846f756ccc1edc0673e6c9ab464bf"/></dir></dir><dir name="Source"><file name="RequestType.php" hash="795d51b4c3f04bb00cf6cca5a3180cd7"/><file name="TransactionMode.php" hash="da4cadb5df1213edc34f22b67235d374"/></dir><file name="Cc.php" hash="04352414daf1d382b6c7cd1488946705"/><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.2.0</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>- Remote admin functionalities for capture and refund in the backend
23
+ - Rework of the complete controller
24
+ - Cancel now reloads shopping cart correctly
25
+ - Fixes session issue during callback
26
+ - AVS Status is now visible in the backend</notes>
27
  <authors><author><name>Phoenix Medien</name><user>auto-converted</user><email>info@phoenix-medien.de</email></author></authors>
28
+ <date>2010-02-04</date>
29
+ <time>18:21:10</time>
30
+ <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="d70ad71aa960ce0c6d4ec8609dadf7e3"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><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="77b202de38902c9e6458218bdce07de8"/><file name="form.phtml" hash="8c7184cbaffc115349de415d12273528"/><file name="info.phtml" hash="d33c7ffde885e4953a975201562cba8e"/><file name="redirect.phtml" hash="84d38770a43262c890094c132dc2bd5c"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_Worldpay.csv" hash="8a41fe546b9f6fb3d18c0ccf727ea082"/></dir><dir name="en_US"><file name="Phoenix_Worldpay.csv" hash="d5ff38bb74afd4e7715cfa54134fd57d"/></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="24bc51b1b86cd3a020982b09e8695c22"/><file name="Processing.php" hash="0f495f4f01f213d999291164d8d6a0c6"/><file name="Redirect.php" hash="c17fea696a1900eef85226022efe4670"/><file name="Success.php" hash="0c072e272d53a0b24e5157201cd65877"/></dir><dir name="controllers"><file name="ProcessingController.php" hash="22d14717383048a6ec1c57ca3ea9d7d0"/></dir><dir name="etc"><file name="config.xml" hash="d75b8d2203cb2331d5cee474b8aa4f21"/><file name="system.xml" hash="5361e90063e729e4c01ae95a074d0fc4"/></dir><dir name="Helper"><file name="Data.php" hash="354473f472247a9dae11a1fac0cef407"/></dir><dir name="Model"><dir name="Config"><dir name="Backend"><file name="Instid.php" hash="20c846f756ccc1edc0673e6c9ab464bf"/></dir></dir><dir name="Source"><file name="RequestType.php" hash="795d51b4c3f04bb00cf6cca5a3180cd7"/><file name="TransactionMode.php" hash="da4cadb5df1213edc34f22b67235d374"/></dir><file name="Cc.php" hash="cf6b3bff52b5aedd85ff94cc59a0fc8e"/><file name="Config.php" hash="9098369b245a824396354e1b64cd47ab"/></dir></dir></dir></target></contents>
31
  <compatible/>
32
  <dependencies/>
33
  </package>