MageBase_DpsPaymentExpress - Version 1.1.6

Version Notes

retrieve quote object from infoInstance instead of from session

Download this release

Release Info

Developer Magento Core Team
Extension MageBase_DpsPaymentExpress
Version 1.1.6
Comparing to
See all releases


Code changes from version 1.1.3 to 1.1.6

Files changed (22) hide show
  1. app/code/community/MageBase/DpsPaymentExpress/Block/Form/Pxpay.php +0 -159
  2. app/code/community/MageBase/DpsPaymentExpress/Block/Form/Pxpost.php +0 -35
  3. app/code/community/MageBase/DpsPaymentExpress/Block/Info/Pxpay.php +0 -115
  4. app/code/community/MageBase/DpsPaymentExpress/Block/Info/Pxpost.php +0 -41
  5. app/code/community/MageBase/DpsPaymentExpress/Block/Pxpay/Redirect.php +0 -49
  6. app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpay.php +18 -10
  7. app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php +6 -3
  8. app/code/community/MageBase/DpsPaymentExpress/controllers/PxpayController.php +26 -10
  9. app/design/frontend/{base → default}/default/template/magebase/dps/pxpay/form.phtml +0 -0
  10. app/design/frontend/{base → default}/default/template/magebase/dps/pxpay/info.phtml +1 -1
  11. app/design/frontend/{base → default}/default/template/magebase/dps/pxpost/form.phtml +0 -0
  12. app/design/frontend/{base → default}/default/template/magebase/dps/pxpost/info.phtml +1 -1
  13. package.xml +5 -5
  14. skin/frontend/{base → default}/default/images/magebase/dps/AmexLogo.png +0 -0
  15. skin/frontend/{base → default}/default/images/magebase/dps/DinersLogo.png +0 -0
  16. skin/frontend/{base → default}/default/images/magebase/dps/JCBLogo.png +0 -0
  17. skin/frontend/{base → default}/default/images/magebase/dps/MCSecureCodeLogo.png +0 -0
  18. skin/frontend/{base → default}/default/images/magebase/dps/MasterCardLogo.png +0 -0
  19. skin/frontend/{base → default}/default/images/magebase/dps/VisaLogo.png +0 -0
  20. skin/frontend/{base → default}/default/images/magebase/dps/VisaVerifiedLogo.png +0 -0
  21. skin/frontend/{base → default}/default/images/magebase/dps/dpslogo.png +0 -0
  22. skin/frontend/{base → default}/default/images/magebase/dps/dpspxlogo.png +0 -0
app/code/community/MageBase/DpsPaymentExpress/Block/Form/Pxpay.php DELETED
@@ -1,159 +0,0 @@
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
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Payment
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- class Mage_Payment_Block_Form_Cc extends Mage_Payment_Block_Form
29
- {
30
- protected function _construct()
31
- {
32
- parent::_construct();
33
- $this->setTemplate('payment/form/cc.phtml');
34
- }
35
-
36
- /**
37
- * Retrieve payment configuration object
38
- *
39
- * @return Mage_Payment_Model_Config
40
- */
41
- protected function _getConfig()
42
- {
43
- return Mage::getSingleton('payment/config');
44
- }
45
-
46
- /**
47
- * Retrieve availables credit card types
48
- *
49
- * @return array
50
- */
51
- public function getCcAvailableTypes()
52
- {
53
- $types = $this->_getConfig()->getCcTypes();
54
- if ($method = $this->getMethod()) {
55
- $availableTypes = $method->getConfigData('cctypes');
56
- if ($availableTypes) {
57
- $availableTypes = explode(',', $availableTypes);
58
- foreach ($types as $code=>$name) {
59
- if (!in_array($code, $availableTypes)) {
60
- unset($types[$code]);
61
- }
62
- }
63
- }
64
- }
65
- return $types;
66
- }
67
-
68
- /**
69
- * Retrieve credit card expire months
70
- *
71
- * @return array
72
- */
73
- public function getCcMonths()
74
- {
75
- $months = $this->getData('cc_months');
76
- if (is_null($months)) {
77
- $months[0] = $this->__('Month');
78
- $months = array_merge($months, $this->_getConfig()->getMonths());
79
- $this->setData('cc_months', $months);
80
- }
81
- return $months;
82
- }
83
-
84
- /**
85
- * Retrieve credit card expire years
86
- *
87
- * @return array
88
- */
89
- public function getCcYears()
90
- {
91
- $years = $this->getData('cc_years');
92
- if (is_null($years)) {
93
- $years = $this->_getConfig()->getYears();
94
- $years = array(0=>$this->__('Year'))+$years;
95
- $this->setData('cc_years', $years);
96
- }
97
- return $years;
98
- }
99
-
100
- /**
101
- * Retrive has verification configuration
102
- *
103
- * @return boolean
104
- */
105
- public function hasVerification()
106
- {
107
- if ($this->getMethod()) {
108
- $configData = $this->getMethod()->getConfigData('useccv');
109
- if(is_null($configData)){
110
- return true;
111
- }
112
- return (bool) $configData;
113
- }
114
- return true;
115
- }
116
-
117
- /*
118
- * Whether switch/solo card type available
119
- */
120
- public function hasSsCardType()
121
- {
122
- $availableTypes =$this->getMethod()->getConfigData('cctypes');
123
- if ($availableTypes && in_array('SS', explode(',', $availableTypes))) {
124
- return true;
125
- }
126
- return false;
127
- }
128
-
129
- /*
130
- * solo/switch card start year
131
- * @return array
132
- */
133
- public function getSsStartYears()
134
- {
135
- $years = array();
136
- $first = date("Y");
137
-
138
- for ($index=5; $index>=0; $index--) {
139
- $year = $first - $index;
140
- $years[$year] = $year;
141
- }
142
- $years = array(0=>$this->__('Year'))+$years;
143
- return $years;
144
- }
145
-
146
- /**
147
- * Render block HTML
148
- *
149
- * @return string
150
- */
151
- protected function _toHtml()
152
- {
153
- Mage::dispatchEvent('payment_form_block_to_html_before', array(
154
- 'block' => $this
155
- ));
156
- return parent::_toHtml();
157
- }
158
- }
159
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/MageBase/DpsPaymentExpress/Block/Form/Pxpost.php DELETED
@@ -1,35 +0,0 @@
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
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Payment
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- class Mage_Payment_Block_Form_Purchaseorder extends Mage_Payment_Block_Form
29
- {
30
- protected function _construct()
31
- {
32
- parent::_construct();
33
- $this->setTemplate('payment/form/purchaseorder.phtml');
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/MageBase/DpsPaymentExpress/Block/Info/Pxpay.php DELETED
@@ -1,115 +0,0 @@
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
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Payment
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Credit card generic payment info
29
- */
30
- class Mage_Payment_Block_Info_Cc extends Mage_Payment_Block_Info
31
- {
32
- /**
33
- * Retrieve credit card type name
34
- *
35
- * @return string
36
- */
37
- public function getCcTypeName()
38
- {
39
- $types = Mage::getSingleton('payment/config')->getCcTypes();
40
- $ccType = $this->getInfo()->getCcType();
41
- if (isset($types[$ccType])) {
42
- return $types[$ccType];
43
- }
44
- return (empty($ccType)) ? Mage::helper('payment')->__('N/A') : $ccType;
45
- }
46
-
47
- /**
48
- * Retrieve CC expiration month
49
- *
50
- * @return string
51
- */
52
- public function getCcExpMonth()
53
- {
54
- $month = $this->getInfo()->getCcExpMonth();
55
- if ($month<10) {
56
- $month = '0'.$month;
57
- }
58
- return $month;
59
- }
60
-
61
- /**
62
- * Retrieve CC expiration date
63
- *
64
- * @return Zend_Date
65
- */
66
- public function getCcExpDate()
67
- {
68
- $date = Mage::app()->getLocale()->date(0);
69
- $date->setYear($this->getInfo()->getCcExpYear());
70
- $date->setMonth($this->getInfo()->getCcExpMonth());
71
- return $date;
72
- }
73
-
74
- /**
75
- * Prepare credit card related payment info
76
- *
77
- * @param Varien_Object|array $transport
78
- * @return Varien_Object
79
- */
80
- protected function _prepareSpecificInformation($transport = null)
81
- {
82
- if (null !== $this->_paymentSpecificInformation) {
83
- return $this->_paymentSpecificInformation;
84
- }
85
- $transport = parent::_prepareSpecificInformation($transport);
86
- $data[Mage::helper('payment')->__('Credit Card Type')] = $this->getCcTypeName();
87
-
88
- if ($this->getInfo()->getCcLast4()) {
89
- $data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
90
- } else {
91
- $data[Mage::helper('payment')->__('Credit Card Number')] = Mage::helper('payment')->__('N/A');
92
- }
93
- if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
94
- $data[Mage::helper('payment')->__('Switch/Solo Issue Number')] = $ccSsIssue;
95
- }
96
- if (!$this->getIsSecureMode()) {
97
- if ($year = $this->getInfo()->getCcSsStartYear() && $month = $this->getInfo()->getCcStartMonth()) {
98
- $data[Mage::helper('payment')->__('Switch/Solo Start Date')] = $this->_formatCardDate($year, $month);
99
- }
100
- }
101
- return $transport->setData(array_merge($data, $transport->getData()));
102
- }
103
-
104
- /**
105
- * Format year/month on the credit card
106
- *
107
- * @param string $year
108
- * @param string $month
109
- * @return string
110
- */
111
- protected function _formatCardDate($year, $month)
112
- {
113
- return sprintf('%s/%s', sprintf('%02d', $month), $year);
114
- }
115
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/MageBase/DpsPaymentExpress/Block/Info/Pxpost.php DELETED
@@ -1,41 +0,0 @@
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
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Payment
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- class Mage_Payment_Block_Info_Purchaseorder extends Mage_Payment_Block_Info
29
- {
30
- protected function _construct()
31
- {
32
- parent::_construct();
33
- $this->setTemplate('payment/info/purchaseorder.phtml');
34
- }
35
-
36
- public function toPdf()
37
- {
38
- $this->setTemplate('payment/info/pdf/purchaseorder.phtml');
39
- return $this->toHtml();
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/MageBase/DpsPaymentExpress/Block/Pxpay/Redirect.php DELETED
@@ -1,49 +0,0 @@
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
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Paypal
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
- class MageBase_DpsPaymentExpress_Block_Pxpay_Redirect extends Mage_Core_Block_Abstract
27
- {
28
- protected function _toHtml()
29
- {
30
- $standard = Mage::getModel('paypal/standard');
31
-
32
- $form = new Varien_Data_Form();
33
- $form->setAction($standard->getConfig()->getPaypalUrl())
34
- ->setId('paypal_standard_checkout')
35
- ->setName('paypal_standard_checkout')
36
- ->setMethod('POST')
37
- ->setUseContainer(true);
38
- foreach ($standard->getStandardCheckoutFormFields() as $field=>$value) {
39
- $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
40
- }
41
- $html = '<html><body>';
42
- $html.= $this->__('You will be redirected to DPS in a few seconds.');
43
- $html.= $form->toHtml();
44
- $html.= '<script type="text/javascript">document.getElementById("paypal_standard_checkout").submit();</script>';
45
- $html.= '</body></html>';
46
-
47
- return $html;
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpay.php CHANGED
@@ -208,9 +208,8 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
208
  * @param string $result [encrypted]
209
  * @return SimpleXMLElement
210
  */
211
- public function processFailResponse($result)
212
- {
213
- if (!$this->_isActive()) {
214
  throw new Exception("Payment method is not available.");
215
  }
216
  $responseXml = $this->getRealResponse($result);
@@ -235,7 +234,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
235
  'timeout'=>30,
236
  )
237
  );
238
- $quote = Mage::getSingleton('checkout/session')->getQuote();
239
 
240
  $xml = new SimpleXMLElement('<GenerateRequest></GenerateRequest>');
241
  $xml->addChild('PxPayUserId', htmlentities($this->_getPxPayUserId()));
@@ -245,13 +244,12 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
245
  $xml->addChild('CurrencyInput', htmlentities($quote->getBaseCurrencyCode()));
246
  $xml->addChild('EmailAddress', htmlentities($quote->getCustomerEmail()));
247
  $xml->addChild('EnableAddBillCard', '0');
248
- $xml->addChild('MerchantReference', htmlentities($quote->getReservedOrderId()));
249
  $xml->addChild('TxnData1', $quote->getStore()->getName());
250
  $xml->addChild('TxnData2', $quote->getId());
251
  $xml->addChild('TxnData3', '');
252
  $xml->addChild('TxnType', htmlentities($this->_getPxPayPaymentAction()));
253
  $xml->addChild('TxnId', $txnId);
254
- $xml->addChild('BillingId', '');
255
  $xml->addChild('UrlFail', htmlentities(Mage::getUrl(self::URL_PXPAY_FAIL)));
256
  $xml->addChild('UrlSuccess', htmlentities(Mage::getUrl(self::URL_PXPAY_SUCCESS)));
257
  $xml->addChild('Opt', '');
@@ -351,7 +349,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
351
  Mage::log("Error in DPS Response Validation: No Order", null, self::DPS_LOG_FILENAME);
352
  return MageBase_DpsPaymentExpress_Model_Method_Common::STATUS_ERROR;
353
  }
354
- if ((float)$resultXml->AmountSettlement != $order->getBaseGrandTotal()) {
355
  Mage::log(
356
  $order->getIncrementId(). " Error in DPS Response Validation: Mismatched totals",
357
  null,
@@ -452,6 +450,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
452
  'ResponseText' => (string)$responseXml->ResponseText
453
  );
454
  $payment->setAdditionalData(serialize($data));
 
455
  }
456
 
457
  /**
@@ -505,9 +504,18 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
505
  $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
506
  }
507
  if ($order->getId() && $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
508
- $order->registerCancellation(Mage::helper('magebasedps')->__('There has been an error processing your payment. Please try later or contact us for help.'), false)
509
- ->save();
 
 
 
 
 
 
 
 
510
  }
 
511
  }
512
 
513
  /**
@@ -520,4 +528,4 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
520
  return Mage::getStoreConfig('payment/'.$this->_code.'/debug');
521
  }
522
 
523
- }
208
  * @param string $result [encrypted]
209
  * @return SimpleXMLElement
210
  */
211
+ public function processFailResponse($result) {
212
+ if(!$this->_isActive()) {
 
213
  throw new Exception("Payment method is not available.");
214
  }
215
  $responseXml = $this->getRealResponse($result);
234
  'timeout'=>30,
235
  )
236
  );
237
+ $quote = $this->getInfoInstance()->getQuote();
238
 
239
  $xml = new SimpleXMLElement('<GenerateRequest></GenerateRequest>');
240
  $xml->addChild('PxPayUserId', htmlentities($this->_getPxPayUserId()));
244
  $xml->addChild('CurrencyInput', htmlentities($quote->getBaseCurrencyCode()));
245
  $xml->addChild('EmailAddress', htmlentities($quote->getCustomerEmail()));
246
  $xml->addChild('EnableAddBillCard', '0');
247
+ $xml->addChild('MerchantReference', htmlentities($this->_getOrderId()));
248
  $xml->addChild('TxnData1', $quote->getStore()->getName());
249
  $xml->addChild('TxnData2', $quote->getId());
250
  $xml->addChild('TxnData3', '');
251
  $xml->addChild('TxnType', htmlentities($this->_getPxPayPaymentAction()));
252
  $xml->addChild('TxnId', $txnId);
 
253
  $xml->addChild('UrlFail', htmlentities(Mage::getUrl(self::URL_PXPAY_FAIL)));
254
  $xml->addChild('UrlSuccess', htmlentities(Mage::getUrl(self::URL_PXPAY_SUCCESS)));
255
  $xml->addChild('Opt', '');
349
  Mage::log("Error in DPS Response Validation: No Order", null, self::DPS_LOG_FILENAME);
350
  return MageBase_DpsPaymentExpress_Model_Method_Common::STATUS_ERROR;
351
  }
352
+ if (abs((float)$resultXml->AmountSettlement - $order->getBaseGrandTotal() >0.0005)) {
353
  Mage::log(
354
  $order->getIncrementId(). " Error in DPS Response Validation: Mismatched totals",
355
  null,
450
  'ResponseText' => (string)$responseXml->ResponseText
451
  );
452
  $payment->setAdditionalData(serialize($data));
453
+
454
  }
455
 
456
  /**
504
  $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
505
  }
506
  if ($order->getId() && $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
507
+ $order->cancel()->save();
508
+ }
509
+ }
510
+
511
+ private function _getOrderId ()
512
+ {
513
+ $info = $this->getInfoInstance();
514
+
515
+ if (!$info->getQuote()->getReservedOrderId()) {
516
+ $info->getQuote()->reserveOrderId();
517
  }
518
+ return $info->getQuote()->getReservedOrderId();
519
  }
520
 
521
  /**
528
  return Mage::getStoreConfig('payment/'.$this->_code.'/debug');
529
  }
530
 
531
+ }
app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php CHANGED
@@ -303,6 +303,9 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
303
  if ($xml->CardNumber) {
304
  $xml->CardNumber = substr($xml->CardNumber, 0, 6).".........".substr($xml->CardNumber, -1);
305
  }
 
 
 
306
  Mage::getModel('magebasedps/debug')
307
  ->setRequestBody($xml->asXML())
308
  ->save();
@@ -338,7 +341,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
338
  self::DPS_LOG_FILENAME
339
  );
340
  }
341
- if (!(int)$resultXml->Transaction[0]['success'] && !(int)$resultXml->Transaction[0]->Authorized) {
342
  $common = Mage::getModel('magebasedps/method_common');
343
  try{
344
  Mage::log(
@@ -359,7 +362,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
359
  Mage::log("Error in DPS Response Validation: No Order", null, self::DPS_LOG_FILENAME);
360
  return false;
361
  }
362
- if ((float)$resultXml->Transaction[0]->Amount != $order->getBaseGrandTotal()) {
363
  Mage::log("Error in DPS Response Validation: Mismatched totals", null, self::DPS_LOG_FILENAME);
364
  return false;
365
  }
@@ -498,4 +501,4 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
498
  return $this->_order;
499
  }
500
 
501
- }
303
  if ($xml->CardNumber) {
304
  $xml->CardNumber = substr($xml->CardNumber, 0, 6).".........".substr($xml->CardNumber, -1);
305
  }
306
+ if ($xml->Cvc2) {
307
+ $xml->Cvc2 = str_replace(array('0','1','2','3','4','5','6','7','8','9'),'*',$xml->Cvc2);
308
+ }
309
  Mage::getModel('magebasedps/debug')
310
  ->setRequestBody($xml->asXML())
311
  ->save();
341
  self::DPS_LOG_FILENAME
342
  );
343
  }
344
+ if (!(int)$resultXml->Transaction[0]['success']) {
345
  $common = Mage::getModel('magebasedps/method_common');
346
  try{
347
  Mage::log(
362
  Mage::log("Error in DPS Response Validation: No Order", null, self::DPS_LOG_FILENAME);
363
  return false;
364
  }
365
+ if (abs((float)$resultXml->Transaction[0]->Amount - $order->getBaseGrandTotal() >0.0005)) {
366
  Mage::log("Error in DPS Response Validation: Mismatched totals", null, self::DPS_LOG_FILENAME);
367
  return false;
368
  }
501
  return $this->_order;
502
  }
503
 
504
+ }
app/code/community/MageBase/DpsPaymentExpress/controllers/PxpayController.php CHANGED
@@ -31,9 +31,10 @@ class MageBase_DpsPaymentExpress_PxpayController extends Mage_Core_Controller_Fr
31
  * once by DPS's FailProofNotification
32
  * and also by the customer when returning
33
  * DPS has no session
34
- * only the DPS response is processed to prevent double handling
35
  */
36
  $session = Mage::getSingleton('checkout/session');
 
37
  if ($session->getLastOrderId()) {
38
  Mage::log(
39
  $session->getLastRealOrderId().' MageBaseDps User returned to Success Url',
@@ -42,6 +43,7 @@ class MageBase_DpsPaymentExpress_PxpayController extends Mage_Core_Controller_Fr
42
  );
43
  $result = $this->getRequest()->getParam('result');
44
  $resultXml = $this->_getRealResponse($result);
 
45
  if ($resultXml) {
46
  if ((int)$resultXml->Success == 1) {
47
  $session->setLastQuoteId((int)$resultXml->TxnData2)
@@ -53,17 +55,30 @@ class MageBase_DpsPaymentExpress_PxpayController extends Mage_Core_Controller_Fr
53
  ->setLastSuccessQuoteId((int)$resultXml->TxnData2);
54
  $this->_redirect('checkout/onepage/success', array('_secure'=>true));
55
  } else {
56
- $this->_redirect('checkout/onepage/failure', array('_secure'=>true));
 
 
 
 
 
 
 
 
 
 
57
  }
 
58
  } else {
59
- $session->setLastQuoteId((int)$resultXml->TxnData2)
60
- ->setLastOrderId(
61
- Mage::getModel('sales/order')->loadByIncrementId((string)$resultXml->MerchantReference)
62
- ->getId()
63
- )
64
- ->setLastRealOrderId((string)$resultXml->MerchantReference);
65
- $this->_redirect('checkout/onepage/failure', array('_secure'=>true));
 
66
  }
 
67
  } else {
68
  try {
69
  $result = $this->getRequest()->getParam('result');
@@ -89,7 +104,8 @@ class MageBase_DpsPaymentExpress_PxpayController extends Mage_Core_Controller_Fr
89
  $this->_redirect('checkout/onepage/failure', array('_secure'=>true));
90
  }
91
  $this->_redirect('checkout/onepage/success', array('_secure'=>true));
92
- }
 
93
  } else {
94
  Mage::log(
95
  'MageBaseDps successAction, but wrong PxPayUserId',
31
  * once by DPS's FailProofNotification
32
  * and also by the customer when returning
33
  * DPS has no session
34
+ * only the DPS response is processed to prevent double handling / order locking
35
  */
36
  $session = Mage::getSingleton('checkout/session');
37
+ //session exists = user with browser
38
  if ($session->getLastOrderId()) {
39
  Mage::log(
40
  $session->getLastRealOrderId().' MageBaseDps User returned to Success Url',
43
  );
44
  $result = $this->getRequest()->getParam('result');
45
  $resultXml = $this->_getRealResponse($result);
46
+ //we have a reponse from DPS
47
  if ($resultXml) {
48
  if ((int)$resultXml->Success == 1) {
49
  $session->setLastQuoteId((int)$resultXml->TxnData2)
55
  ->setLastSuccessQuoteId((int)$resultXml->TxnData2);
56
  $this->_redirect('checkout/onepage/success', array('_secure'=>true));
57
  } else {
58
+ if ((int) $resultXml->TxnData2) {
59
+ $session->setLastQuoteId((int) $resultXml->TxnData2);
60
+ }
61
+ if ((string) $resultXml->MerchantReference) {
62
+ $session->setLastOrderId(
63
+ Mage::getModel('sales/order')->loadByIncrementId((string) $resultXml->MerchantReference)
64
+ ->getId()
65
+ )
66
+ ->setLastRealOrderId((string) $resultXml->MerchantReference);
67
+ }
68
+ $this->_redirect('checkout/onepage/failure', array('_secure' => true));
69
  }
70
+ //we didn't get a succesful response
71
  } else {
72
+ //we don't have a proper response - fail but we don't know why
73
+ Mage::log(
74
+ $session->getLastRealOrderId().' MageBaseDps User returned to Success Url but we were unable to retrieve a
75
+ positive response from DPS',
76
+ null,
77
+ MageBase_DpsPaymentExpress_Model_Method_Pxpay::DPS_LOG_FILENAME
78
+ );
79
+ $this->_redirect('checkout/onepage/failure', array('_secure' => true));
80
  }
81
+ //session doesn't exist = DPS notification
82
  } else {
83
  try {
84
  $result = $this->getRequest()->getParam('result');
104
  $this->_redirect('checkout/onepage/failure', array('_secure'=>true));
105
  }
106
  $this->_redirect('checkout/onepage/success', array('_secure'=>true));
107
+ }
108
+ //url tampering = wrong PxPayUserId
109
  } else {
110
  Mage::log(
111
  'MageBaseDps successAction, but wrong PxPayUserId',
app/design/frontend/{base → default}/default/template/magebase/dps/pxpay/form.phtml RENAMED
File without changes
app/design/frontend/{base → default}/default/template/magebase/dps/pxpay/info.phtml RENAMED
@@ -30,4 +30,4 @@
30
  </table>
31
  <?php else:?>
32
  <img src="<?php echo $this->getSkinUrl('images/magebase/dps/dpslogo.png'); ?>" alt="" />
33
- <?php endif;?>
30
  </table>
31
  <?php else:?>
32
  <img src="<?php echo $this->getSkinUrl('images/magebase/dps/dpslogo.png'); ?>" alt="" />
33
+ <?php endif;?>
app/design/frontend/{base → default}/default/template/magebase/dps/pxpost/form.phtml RENAMED
File without changes
app/design/frontend/{base → default}/default/template/magebase/dps/pxpost/info.phtml RENAMED
@@ -24,4 +24,4 @@
24
  <table width="100%" border="0">
25
  <tr><td width="35%"><?php echo $this->__('Card Type') ?></td><td><?php echo $this->getAdditionalData('CardName') ?></td>
26
  <tr><td width="35%"><?php echo $this->__('Name on Card') ?></td><td><?php echo $this->getAdditionalData('CardHolderName') ?></td>
27
- </table>
24
  <table width="100%" border="0">
25
  <tr><td width="35%"><?php echo $this->__('Card Type') ?></td><td><?php echo $this->getAdditionalData('CardName') ?></td>
26
  <tr><td width="35%"><?php echo $this->__('Name on Card') ?></td><td><?php echo $this->getAdditionalData('CardHolderName') ?></td>
27
+ </table>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MageBase_DpsPaymentExpress</name>
4
- <version>1.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Accept credit card payments via Payment Express from DPS - this extension supports PxPay and PxPost.</summary>
10
  <description>Accept credit card payments via Payment Express from DPS - this extension supports PxPay and PxPost.</description>
11
- <notes>Fix missing files</notes>
12
  <authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>info@magebase.com</email></author></authors>
13
- <date>2010-06-30</date>
14
- <time>01:52:27</time>
15
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="magebase"><dir name="dps"><dir name="pxpay"><dir name="pdf"><file name="pxpay.phtml" hash="30691a7b7eddbf52217c2d8194fe3f52"/></dir><file name="form.phtml" hash="1b6d58c3bde68990b743c93a9be529aa"/><file name="info.phtml" hash="36d793186537097726671bb6cd3ae5c2"/></dir><dir name="pxpost"><dir name="pdf"><file name="pxpost.phtml" hash="81e5f3b568e748460a5ca61e42138f8e"/></dir><file name="form.phtml" hash="27bec2c3b982473d7c0c1a44762adac4"/><file name="info.phtml" hash="011493fb070138a7c99b07c792a9c9b2"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="magebase"><dir name="dps"><dir name="pxpay"><file name="form.phtml" hash="d1ec1d94031a875ba2819c5f799899c7"/><file name="info.phtml" hash="c53fb2bf0a1afdc81fac85afc15b35e3"/></dir><dir name="pxpost"><file name="form.phtml" hash="84c23e6c9202d6573c44f6ff3c6cd6b5"/><file name="info.phtml" hash="e370c27cfb4bd8e926315f7d2c47fb8f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="MageBase_DpsPaymentExpress.xml" hash="fae6ba260c006016d14d9a508d17cf14"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="magebase"><dir name="dps"><file name="AmexLogo.png" hash="775a3f26a4b5f7a6201b1331e4fe5579"/><file name="DinersLogo.png" hash="64500fdde86e960ac894f7cf0c44b2d8"/><file name="dpslogo.png" hash="8cc607a6a0bb32cea44d71fdc6086970"/><file name="dpspxlogo.png" hash="2f4e2d293b1e67f4a380f034bb49c788"/><file name="JCBLogo.png" hash="73f9e8b87c6c2dbf252bbb0de43591bc"/><file name="MasterCardLogo.png" hash="801014f81e405cec951076f4080b04f5"/><file name="MCSecureCodeLogo.png" hash="9f31e5ccadd98dc15d0110d0e3b450f7"/><file name="VisaLogo.png" hash="17173fb8723d34cea61a50c01c4845ed"/><file name="VisaVerifiedLogo.png" hash="af7f6a27a6449a50d1d623d925585c47"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="MageBase"><dir name="DpsPaymentExpress"><dir name="Block"><dir name="Form"><file name="Pxpay.php" hash="cfee1e51334484335b8f4b6640a502c6"/><file name="Pxpost.php" hash="d16ec81082d5a3c3f7a9f0ec017c1138"/></dir><dir name="Info"><file name="Pxpay.php" hash="9807aac8b02f40efa157c0afceb54438"/><file name="Pxpost.php" hash="cca613e91361f3411e4bcd56bc02b56f"/></dir><dir name="Pxpay"><file name="Form.php" hash="0513bd45150f03dab2c2b08dc0456de8"/><file name="Info.php" hash="68328c0824a4666c618cf3742dd4baff"/><file name="Redirect.php" hash="6b14c55b1f8aa8361891e7816bcb95b8"/></dir><dir name="Pxpost"><file name="Form.php" hash="48cda517e5c97bf8b031d195b79d76f9"/><file name="Info.php" hash="498c831213c26a78c12e28203273e937"/></dir></dir><dir name="controllers"><file name="PxpayController.php" hash="3cbf83bd7bc38dcea6667be113f814f7"/></dir><dir name="etc"><file name="config.xml" hash="b93eaa11723750631a534e466c603fa2"/><file name="system.xml" hash="87051f2d48e3720938b28142e7f37bb1"/></dir><dir name="Helper"><file name="Data.php" hash="0eea8b0b6d3c48e7e64666d4576d9a30"/></dir><dir name="Model"><dir name="Method"><file name="Common.php" hash="1261a0121dff3725f85d9a7c955ada7c"/><file name="Pxpay.php" hash="98fdb1b3b569d081588b25586690113a"/><file name="Pxpost.php" hash="37c817dce1dacc8caedd8cf07c9800fc"/></dir><dir name="Mysql4"><dir name="Debug"><file name="Collection.php" hash="6ef2919222f3dcb32599349245e76214"/></dir><file name="Debug.php" hash="56eb2bc341b9cb4ba8d9ae239169766e"/><file name="Setup.php" hash="8a395090a44fda7530548abd2d87835e"/></dir><dir name="System"><file name="Logos.php" hash="bfca463fa7d292fbd2b69a33d332d55a"/><file name="PaymentAction.php" hash="0be4f9a5c602b2d2723203ec56f51a8c"/><file name="PendingOrder.php" hash="31d7bd6f5fad8e1fa4315d32d123be0f"/></dir><file name="Debug.php" hash="dadf96f68c9cf4d09aad73ff0bacab0e"/></dir><dir name="sql"><dir name="magebasedps_setup"><file name="mysql4-install-0.5.0.php" hash="c512ded8c0dd63b1dcd8e8cbfb5893e8"/><file name="mysql4-upgrade-0.5.0-1.0.0.php" hash="6dbc67541449a0f2d43460acb9b6bbff"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MageBase_DpsPaymentExpress</name>
4
+ <version>1.1.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Accept credit card payments via Payment Express from DPS - this extension supports PxPay and PxPost.</summary>
10
  <description>Accept credit card payments via Payment Express from DPS - this extension supports PxPay and PxPost.</description>
11
+ <notes>retrieve quote object from infoInstance instead of from session</notes>
12
  <authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>info@magebase.com</email></author></authors>
13
+ <date>2010-10-05</date>
14
+ <time>05:11:40</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="magebase"><dir name="dps"><dir name="pxpay"><dir name="pdf"><file name="pxpay.phtml" hash="30691a7b7eddbf52217c2d8194fe3f52"/></dir><file name="form.phtml" hash="1b6d58c3bde68990b743c93a9be529aa"/><file name="info.phtml" hash="36d793186537097726671bb6cd3ae5c2"/></dir><dir name="pxpost"><dir name="pdf"><file name="pxpost.phtml" hash="81e5f3b568e748460a5ca61e42138f8e"/></dir><file name="form.phtml" hash="27bec2c3b982473d7c0c1a44762adac4"/><file name="info.phtml" hash="011493fb070138a7c99b07c792a9c9b2"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="magebase"><dir name="dps"><dir name="pxpay"><file name="form.phtml" hash="d1ec1d94031a875ba2819c5f799899c7"/><file name="info.phtml" hash="d3ddb92a85edaffc585948f52c122535"/></dir><dir name="pxpost"><file name="form.phtml" hash="84c23e6c9202d6573c44f6ff3c6cd6b5"/><file name="info.phtml" hash="c89cbdc1023b6d348aefb826efc02a24"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="MageBase_DpsPaymentExpress.xml" hash="fae6ba260c006016d14d9a508d17cf14"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><dir name="magebase"><dir name="dps"><file name="AmexLogo.png" hash="775a3f26a4b5f7a6201b1331e4fe5579"/><file name="DinersLogo.png" hash="64500fdde86e960ac894f7cf0c44b2d8"/><file name="dpslogo.png" hash="8cc607a6a0bb32cea44d71fdc6086970"/><file name="dpspxlogo.png" hash="2f4e2d293b1e67f4a380f034bb49c788"/><file name="JCBLogo.png" hash="73f9e8b87c6c2dbf252bbb0de43591bc"/><file name="MasterCardLogo.png" hash="801014f81e405cec951076f4080b04f5"/><file name="MCSecureCodeLogo.png" hash="9f31e5ccadd98dc15d0110d0e3b450f7"/><file name="VisaLogo.png" hash="17173fb8723d34cea61a50c01c4845ed"/><file name="VisaVerifiedLogo.png" hash="af7f6a27a6449a50d1d623d925585c47"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="MageBase"><dir name="DpsPaymentExpress"><dir name="Block"><dir name="Pxpay"><file name="Form.php" hash="0513bd45150f03dab2c2b08dc0456de8"/><file name="Info.php" hash="68328c0824a4666c618cf3742dd4baff"/></dir><dir name="Pxpost"><file name="Form.php" hash="48cda517e5c97bf8b031d195b79d76f9"/><file name="Info.php" hash="498c831213c26a78c12e28203273e937"/></dir></dir><dir name="controllers"><file name="PxpayController.php" hash="c81620b6757b9819d600e74f4eea6f89"/></dir><dir name="etc"><file name="config.xml" hash="b93eaa11723750631a534e466c603fa2"/><file name="system.xml" hash="87051f2d48e3720938b28142e7f37bb1"/></dir><dir name="Helper"><file name="Data.php" hash="0eea8b0b6d3c48e7e64666d4576d9a30"/></dir><dir name="Model"><dir name="Method"><file name="Common.php" hash="1261a0121dff3725f85d9a7c955ada7c"/><file name="Pxpay.php" hash="7511acec917c4f35cdf8a13a7b69f50c"/><file name="Pxpost.php" hash="bd518dec2435ea91a04d3be4e0da3b73"/></dir><dir name="Mysql4"><dir name="Debug"><file name="Collection.php" hash="6ef2919222f3dcb32599349245e76214"/></dir><file name="Debug.php" hash="56eb2bc341b9cb4ba8d9ae239169766e"/><file name="Setup.php" hash="8a395090a44fda7530548abd2d87835e"/></dir><dir name="System"><file name="Logos.php" hash="bfca463fa7d292fbd2b69a33d332d55a"/><file name="PaymentAction.php" hash="0be4f9a5c602b2d2723203ec56f51a8c"/><file name="PendingOrder.php" hash="31d7bd6f5fad8e1fa4315d32d123be0f"/></dir><file name="Debug.php" hash="dadf96f68c9cf4d09aad73ff0bacab0e"/></dir><dir name="sql"><dir name="magebasedps_setup"><file name="mysql4-install-0.5.0.php" hash="c512ded8c0dd63b1dcd8e8cbfb5893e8"/><file name="mysql4-upgrade-0.5.0-1.0.0.php" hash="6dbc67541449a0f2d43460acb9b6bbff"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
skin/frontend/{base → default}/default/images/magebase/dps/AmexLogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/DinersLogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/JCBLogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/MCSecureCodeLogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/MasterCardLogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/VisaLogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/VisaVerifiedLogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/dpslogo.png RENAMED
File without changes
skin/frontend/{base → default}/default/images/magebase/dps/dpspxlogo.png RENAMED
File without changes