Version Notes
local testing mode
configurable if sending invoice or order confirmation email
automatic page reload of success page due to connection error
Download this release
Release Info
Developer | Magento Core Team |
Extension | MageBase_DpsPaymentExpress |
Version | 1.5.17 |
Comparing to | |
See all releases |
Code changes from version 1.5.10 to 1.5.17
- app/code/community/MageBase/DpsPaymentExpress/Helper/Data.php +58 -19
- app/code/community/MageBase/DpsPaymentExpress/Model/Method/Common.php +3 -1
- app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpay.php +112 -65
- app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php +49 -44
- app/code/community/MageBase/DpsPaymentExpress/Model/System/PxPayUrl.php +38 -0
- app/code/community/MageBase/DpsPaymentExpress/etc/config.xml +2 -1
- app/code/community/MageBase/DpsPaymentExpress/etc/system.xml +12 -3
- app/design/adminhtml/default/default/template/magebase/dps/pxpay/info.phtml +1 -1
- app/design/adminhtml/default/default/template/magebase/dps/pxpost/info.phtml +1 -1
- app/design/frontend/base/default/template/magebase/dps/pxpay/info.phtml +3 -3
- app/design/frontend/base/default/template/magebase/dps/pxpost/info.phtml +2 -2
- package.xml +4 -4
app/code/community/MageBase/DpsPaymentExpress/Helper/Data.php
CHANGED
@@ -27,28 +27,52 @@ class MageBase_DpsPaymentExpress_Helper_Data extends Mage_Core_Helper_Abstract
|
|
27 |
* Currency codes supported by DPS
|
28 |
*
|
29 |
* @var array
|
|
|
30 |
*/
|
31 |
protected $_supportedCurrencies
|
32 |
= array(
|
33 |
-
'
|
34 |
-
'
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
);
|
53 |
|
54 |
public function canUseCurrency($currencyCode)
|
@@ -125,4 +149,19 @@ class MageBase_DpsPaymentExpress_Helper_Data extends Mage_Core_Helper_Abstract
|
|
125 |
}
|
126 |
}
|
127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
27 |
* Currency codes supported by DPS
|
28 |
*
|
29 |
* @var array
|
30 |
+
* @see http://www.paymentexpress.com/Knowledge_Base/Merchant_Info/Multi_Currency
|
31 |
*/
|
32 |
protected $_supportedCurrencies
|
33 |
= array(
|
34 |
+
'AUD', //Australian Dollar
|
35 |
+
'BRL', //Brazil Real
|
36 |
+
'BND', //Brunei Dollar
|
37 |
+
'CAD', //Canadian Dollar
|
38 |
+
'CNY', //Chinese Yuan Renminbi
|
39 |
+
'CZK', //Czech Korunaor
|
40 |
+
'DKK', //Danish Kroner
|
41 |
+
'EGP', //Egyptian Pound
|
42 |
+
'EUR', //Euros
|
43 |
+
'FJD', //Fiji Dollar
|
44 |
+
'HKD', //Hong Kong Dollar
|
45 |
+
'HUF', //Hungarian Forint
|
46 |
+
'INR', //Indian Rupee
|
47 |
+
'IDR', //Indonesia Rupiah
|
48 |
+
'JPY', //Japanese Yen
|
49 |
+
'KRW', //Korean Won
|
50 |
+
'MOP', //Macau Pataca
|
51 |
+
'MYR', //Malaysian Ringgit
|
52 |
+
'MUR', //Mauritius Rupee
|
53 |
+
'ANG', //Netherlands Guilder
|
54 |
+
'TWD', //New Taiwan Dollar
|
55 |
+
'NOK', //Norwegian Kronor
|
56 |
+
'NZD', //New Zealand Dollar
|
57 |
+
'PGK', //Papua New Guinea Kina
|
58 |
+
'PHP', //Philippine Peso
|
59 |
+
'PLN', //Polish Zloty
|
60 |
+
'GBP', //Pound Sterling
|
61 |
+
'PKR', //Pakistan Rupee
|
62 |
+
'WST', //Samoan Tala
|
63 |
+
'SAR', //Saudi Riyal
|
64 |
+
'SBD', //Solomon Islands Dollar
|
65 |
+
'LKR', //Sri Lankan Rupee
|
66 |
+
'SGD', //Singapore Dollar
|
67 |
+
'ZAR', //South African Rand
|
68 |
+
'SEK', //Swedish Kronor
|
69 |
+
'CHF', //Swiss Franc
|
70 |
+
'TWD', //Taiwan Dollar
|
71 |
+
'THB', //Thai Baht
|
72 |
+
'TOP', //Tongan Pa'anga
|
73 |
+
'AED', //UAE Dirham
|
74 |
+
'USD', //United States Dollar
|
75 |
+
'VUV' //Vanuatu Vatu
|
76 |
);
|
77 |
|
78 |
public function canUseCurrency($currencyCode)
|
149 |
}
|
150 |
}
|
151 |
}
|
152 |
+
|
153 |
+
public function getErrorMessage($error = array())
|
154 |
+
{
|
155 |
+
if (isset($error['message'])) {
|
156 |
+
$message = Mage::helper('magebasedps')->__(
|
157 |
+
'There has been an error processing your payment (%s). Please try again later or contact us for help.',
|
158 |
+
$error['message']
|
159 |
+
);
|
160 |
+
} else {
|
161 |
+
$message = Mage::helper('magebasedps')->__(
|
162 |
+
'There has been an error processing your payment. Please try later or contact us for help.'
|
163 |
+
);
|
164 |
+
}
|
165 |
+
return $message;
|
166 |
+
}
|
167 |
}
|
app/code/community/MageBase/DpsPaymentExpress/Model/Method/Common.php
CHANGED
@@ -66,6 +66,8 @@ class MageBase_DpsPaymentExpress_Model_Method_Common extends Mage_Payment_Model_
|
|
66 |
*/
|
67 |
public $errorCodes
|
68 |
= array(
|
|
|
|
|
69 |
'IC' => 'Invalid Key or Username. Also check that if a TxnId is being supplied that it is unique.',
|
70 |
'ID' => 'Invalid transaction type. Esure that the transaction type is either Auth or Purchase.',
|
71 |
'IK' => 'Invalid UrlSuccess. Ensure that the URL being supplied does not contain a query string.',
|
@@ -86,6 +88,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Common extends Mage_Payment_Model_
|
|
86 |
'NQ' => 'User not enabled for PxPay. Contact DPS.',
|
87 |
'NT' => 'Key is not 64 characters.',
|
88 |
'U5' => 'Invalid User / Password',
|
|
|
89 |
'QD' => 'The transaction was Declined.', //Invalid TxnRef
|
90 |
'Q4' => 'Invalid Amount Entered. Transaction has not been Approved',
|
91 |
'Q8' => 'Invalid Currency',
|
@@ -102,7 +105,6 @@ class MageBase_DpsPaymentExpress_Model_Method_Common extends Mage_Payment_Model_
|
|
102 |
'D4' => 'Maximum number of logon attempts exceeded'
|
103 |
);
|
104 |
|
105 |
-
|
106 |
public function returnErrorExplanation($code)
|
107 |
{
|
108 |
$code = (string)$code;
|
66 |
*/
|
67 |
public $errorCodes
|
68 |
= array(
|
69 |
+
'51' => 'Card with Insufficient Funds',
|
70 |
+
'54' => 'Expired Card',
|
71 |
'IC' => 'Invalid Key or Username. Also check that if a TxnId is being supplied that it is unique.',
|
72 |
'ID' => 'Invalid transaction type. Esure that the transaction type is either Auth or Purchase.',
|
73 |
'IK' => 'Invalid UrlSuccess. Ensure that the URL being supplied does not contain a query string.',
|
88 |
'NQ' => 'User not enabled for PxPay. Contact DPS.',
|
89 |
'NT' => 'Key is not 64 characters.',
|
90 |
'U5' => 'Invalid User / Password',
|
91 |
+
'U9' => 'Timeout for Transaction',
|
92 |
'QD' => 'The transaction was Declined.', //Invalid TxnRef
|
93 |
'Q4' => 'Invalid Amount Entered. Transaction has not been Approved',
|
94 |
'Q8' => 'Invalid Currency',
|
105 |
'D4' => 'Maximum number of logon attempts exceeded'
|
106 |
);
|
107 |
|
|
|
108 |
public function returnErrorExplanation($code)
|
109 |
{
|
110 |
$code = (string)$code;
|
app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpay.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* MageBase DPS Payment Express
|
4 |
*
|
@@ -19,11 +20,12 @@
|
|
19 |
* @copyright Copyright (c) 2010 Fooman Ltd (http://www.fooman.co.nz)
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
22 |
-
|
23 |
class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_Method_Abstract
|
24 |
{
|
25 |
|
26 |
const URL_PXPAY = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx';
|
|
|
|
|
27 |
const URL_PXPAY_SUCCESS = 'magebasedps/pxpay/success';
|
28 |
const URL_PXPAY_FAIL = 'magebasedps/pxpay/fail';
|
29 |
|
@@ -86,6 +88,17 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
86 |
);
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
/**
|
90 |
* retrieve payment action from database
|
91 |
* Auth or Purchase
|
@@ -243,6 +256,70 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
243 |
return $responseXml;
|
244 |
}
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
/**
|
247 |
* retrieve PxPayUrl to redirect customer to (generated by DPS)
|
248 |
*
|
@@ -252,52 +329,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
252 |
{
|
253 |
try {
|
254 |
$txnId = substr(uniqid(rand()), 0, 16);
|
255 |
-
$
|
256 |
-
$client->setUri(self::URL_PXPAY);
|
257 |
-
$client->setConfig(
|
258 |
-
array(
|
259 |
-
'maxredirects' => 0,
|
260 |
-
'timeout' => 30,
|
261 |
-
)
|
262 |
-
);
|
263 |
-
$quote = $this->getInfoInstance()->getQuote();
|
264 |
-
|
265 |
-
$xml = new SimpleXMLElement('<GenerateRequest></GenerateRequest>');
|
266 |
-
$xml->addChild('PxPayUserId', htmlentities($this->_getPxPayUserId()));
|
267 |
-
$xml->addChild('PxPayKey', htmlentities($this->_getPxPayKey()));
|
268 |
-
$xml->addChild('AmountInput', trim(htmlentities(sprintf("%9.2f", $quote->getBaseGrandTotal()))));
|
269 |
-
$xml->addChild('BillingId', '');
|
270 |
-
$xml->addChild('CurrencyInput', htmlentities($quote->getBaseCurrencyCode()));
|
271 |
-
$xml->addChild('EmailAddress', htmlentities($quote->getCustomerEmail()));
|
272 |
-
$xml->addChild('EnableAddBillCard', '0');
|
273 |
-
$xml->addChild('MerchantReference', htmlentities($this->_getOrderId()));
|
274 |
-
$xml->addChild('TxnData1', $quote->getStore()->getName());
|
275 |
-
$xml->addChild('TxnData2', $quote->getId());
|
276 |
-
$xml->addChild('TxnData3', '');
|
277 |
-
$xml->addChild('TxnType', htmlentities($this->_getPxPayPaymentAction()));
|
278 |
-
$xml->addChild('TxnId', $txnId);
|
279 |
-
$xml->addChild('UrlFail', htmlentities(Mage::getUrl(self::URL_PXPAY_FAIL, array('_nosid' => true))));
|
280 |
-
$xml->addChild('UrlSuccess', htmlentities(Mage::getUrl(self::URL_PXPAY_SUCCESS, array('_nosid' => true))));
|
281 |
-
$xml->addChild('Opt', '');
|
282 |
-
|
283 |
-
$client->setParameterPost('xml', $xml->asXML());
|
284 |
-
|
285 |
-
if ($this->debugToDb()) {
|
286 |
-
$debugEntry = Mage::getModel('magebasedps/debug')
|
287 |
-
->setRequestBody($xml->asXML())
|
288 |
-
->save();
|
289 |
-
}
|
290 |
-
$response = $client->request('POST');
|
291 |
-
|
292 |
-
$responseXml = simplexml_load_string($response->getBody());
|
293 |
-
if ($this->debugToDb()) {
|
294 |
-
$debugEntry->setResponseBody($response->getBody())
|
295 |
-
->save();
|
296 |
-
}
|
297 |
-
if ($responseXml['valid'] == 1) {
|
298 |
-
return strval($responseXml->URI);
|
299 |
-
}
|
300 |
-
return false;
|
301 |
} catch (Exception $e) {
|
302 |
Mage::logException($e);
|
303 |
return false;
|
@@ -315,11 +347,11 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
315 |
{
|
316 |
try {
|
317 |
$client = new Zend_Http_Client();
|
318 |
-
$client->setUri(self::
|
319 |
$client->setConfig(
|
320 |
array(
|
321 |
-
|
322 |
-
|
323 |
)
|
324 |
);
|
325 |
$xml = new SimpleXMLElement('<ProcessResponse></ProcessResponse>');
|
@@ -373,11 +405,11 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
373 |
return MageBase_DpsPaymentExpress_Model_Method_Common::STATUS_ERROR;
|
374 |
}
|
375 |
$order = $this->_getOrder($resultXml);
|
376 |
-
if (!$order->getId()) {
|
377 |
Mage::log("Error in DPS Response Validation: No Order", null, self::DPS_LOG_FILENAME);
|
378 |
return MageBase_DpsPaymentExpress_Model_Method_Common::STATUS_ERROR;
|
379 |
}
|
380 |
-
if (abs((float)$resultXml->AmountSettlement - sprintf("%9.2f"
|
381 |
Mage::log(
|
382 |
$order->getIncrementId() . " Error in DPS Response Validation: Mismatched totals",
|
383 |
null,
|
@@ -508,7 +540,6 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
508 |
$order->setStatus(Mage::getStoreConfig('payment/' . $this->_code . '/order_status', $this->getStore()));
|
509 |
$order->save();
|
510 |
$this->_sendEmails($order, $invoice);
|
511 |
-
$order->save();
|
512 |
}
|
513 |
|
514 |
/**
|
@@ -523,18 +554,14 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
523 |
switch (Mage::getStoreConfig('payment/' . $this->_code . '/emailstosend', $this->getStore())) {
|
524 |
case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_INVOICE: // send invoice email only
|
525 |
$invoice->sendEmail();
|
526 |
-
$invoice->setEmailSent(true);
|
527 |
break;
|
528 |
case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_BOTH: // send both
|
529 |
$order->sendNewOrderEmail();
|
530 |
-
$order->setEmailSent(true);
|
531 |
$invoice->sendEmail();
|
532 |
-
$invoice->setEmailSent(true);
|
533 |
break;
|
534 |
case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_ORDER: // default - send order email only
|
535 |
default:
|
536 |
$order->sendNewOrderEmail();
|
537 |
-
$order->setEmailSent(true);
|
538 |
break;
|
539 |
}
|
540 |
}
|
@@ -554,9 +581,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
554 |
$order->save();
|
555 |
if (!$order->getEmailSent()) {
|
556 |
$order->sendNewOrderEmail();
|
557 |
-
$order->setEmailSent(true);
|
558 |
}
|
559 |
-
$order->save();
|
560 |
}
|
561 |
|
562 |
/**
|
@@ -576,21 +601,43 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_M
|
|
576 |
}
|
577 |
if ($order && $order->getId() && $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
|
578 |
$order->registerCancellation(
|
579 |
-
Mage::helper('magebasedps')->
|
580 |
-
'There has been an error processing your payment. Please try later or contact us for help.'
|
581 |
-
), false
|
582 |
)->save();
|
583 |
}
|
584 |
}
|
585 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
protected function _getOrderId()
|
587 |
{
|
588 |
$info = $this->getInfoInstance();
|
589 |
|
590 |
-
if (
|
591 |
-
$info->
|
|
|
|
|
|
|
|
|
|
|
592 |
}
|
593 |
-
return $info->getQuote()->getReservedOrderId();
|
594 |
}
|
595 |
|
596 |
/**
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* MageBase DPS Payment Express
|
5 |
*
|
20 |
* @copyright Copyright (c) 2010 Fooman Ltd (http://www.fooman.co.nz)
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
|
|
23 |
class MageBase_DpsPaymentExpress_Model_Method_Pxpay extends Mage_Payment_Model_Method_Abstract
|
24 |
{
|
25 |
|
26 |
const URL_PXPAY = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx';
|
27 |
+
const URL_PXPAY20 = 'https://sec.paymentexpress.com/pxaccess/pxpay.aspx';
|
28 |
+
|
29 |
const URL_PXPAY_SUCCESS = 'magebasedps/pxpay/success';
|
30 |
const URL_PXPAY_FAIL = 'magebasedps/pxpay/fail';
|
31 |
|
88 |
);
|
89 |
}
|
90 |
|
91 |
+
/**
|
92 |
+
* retrieve PxPay URL to post to from database
|
93 |
+
*
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
protected function _getPxPayPostUrl()
|
97 |
+
{
|
98 |
+
return Mage::getStoreConfig('payment/' . $this->_code . '/pxpayurl', $this->getStore());
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
/**
|
103 |
* retrieve payment action from database
|
104 |
* Auth or Purchase
|
256 |
return $responseXml;
|
257 |
}
|
258 |
|
259 |
+
/**
|
260 |
+
* sending request to retrieve redirectURI
|
261 |
+
*
|
262 |
+
* @param string $paymentAction
|
263 |
+
*
|
264 |
+
* @param $txnId
|
265 |
+
* @param string $billingId
|
266 |
+
* @param string $enableAddBillCard
|
267 |
+
* @param string $txnDataThree
|
268 |
+
*
|
269 |
+
* @return string
|
270 |
+
*/
|
271 |
+
protected function _getPxPayUrlResponse(
|
272 |
+
$paymentAction, $txnId, $billingId = '', $enableAddBillCard = '0', $txnDataThree = ''
|
273 |
+
) {
|
274 |
+
$client = new Zend_Http_Client();
|
275 |
+
$client->setUri(self::_getPxPayPostUrl());
|
276 |
+
$client->setConfig(
|
277 |
+
array(
|
278 |
+
'maxredirects' => 0,
|
279 |
+
'timeout' => 30,
|
280 |
+
)
|
281 |
+
);
|
282 |
+
$quote = $this->getInfoInstance()->getQuote();
|
283 |
+
|
284 |
+
$xml = new SimpleXMLElement('<GenerateRequest></GenerateRequest>');
|
285 |
+
$xml->addChild('PxPayUserId', htmlentities($this->_getPxPayUserId()));
|
286 |
+
$xml->addChild('PxPayKey', htmlentities($this->_getPxPayKey()));
|
287 |
+
$xml->addChild('AmountInput', trim(htmlentities(sprintf("%9.2f", $quote->getBaseGrandTotal()))));
|
288 |
+
$xml->addChild('BillingId', $billingId);
|
289 |
+
$xml->addChild('CurrencyInput', htmlentities($quote->getBaseCurrencyCode()));
|
290 |
+
$xml->addChild('EmailAddress', htmlentities($quote->getCustomerEmail()));
|
291 |
+
$xml->addChild('EnableAddBillCard', $enableAddBillCard);
|
292 |
+
$xml->addChild('MerchantReference', htmlentities($this->_getOrderId()));
|
293 |
+
$xml->addChild('TxnData1', $quote->getStore()->getName());
|
294 |
+
$xml->addChild('TxnData2', $quote->getId());
|
295 |
+
$xml->addChild('TxnData3', $txnDataThree);
|
296 |
+
$xml->addChild('TxnType', $paymentAction);
|
297 |
+
$xml->addChild('TxnId', $txnId);
|
298 |
+
$xml->addChild('UrlFail', htmlentities(Mage::getUrl(self::URL_PXPAY_FAIL, array('_nosid' => true))));
|
299 |
+
$xml->addChild('UrlSuccess', htmlentities(Mage::getUrl(self::URL_PXPAY_SUCCESS, array('_nosid' => true))));
|
300 |
+
$xml->addChild('Opt', '');
|
301 |
+
|
302 |
+
Mage::dispatchEvent('magebasedps_pxpay_xml_before', array('method_instance' => $this, 'xml' => $xml));
|
303 |
+
$client->setParameterPost('xml', $xml->asXML());
|
304 |
+
|
305 |
+
if ($this->debugToDb()) {
|
306 |
+
$debugEntry = Mage::getModel('magebasedps/debug')
|
307 |
+
->setRequestBody($xml->asXML())
|
308 |
+
->save();
|
309 |
+
}
|
310 |
+
$response = $client->request(Zend_Http_Client::POST);
|
311 |
+
|
312 |
+
$responseXml = simplexml_load_string($response->getBody());
|
313 |
+
if ($this->debugToDb()) {
|
314 |
+
$debugEntry->setResponseBody($response->getBody())
|
315 |
+
->save();
|
316 |
+
}
|
317 |
+
if ($responseXml['valid'] == 1) {
|
318 |
+
return strval($responseXml->URI);
|
319 |
+
}
|
320 |
+
return false;
|
321 |
+
}
|
322 |
+
|
323 |
/**
|
324 |
* retrieve PxPayUrl to redirect customer to (generated by DPS)
|
325 |
*
|
329 |
{
|
330 |
try {
|
331 |
$txnId = substr(uniqid(rand()), 0, 16);
|
332 |
+
return $this->_getPxPayUrlResponse(htmlentities($this->_getPxPayPaymentAction()), $txnId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
} catch (Exception $e) {
|
334 |
Mage::logException($e);
|
335 |
return false;
|
347 |
{
|
348 |
try {
|
349 |
$client = new Zend_Http_Client();
|
350 |
+
$client->setUri(self::_getPxPayPostUrl());
|
351 |
$client->setConfig(
|
352 |
array(
|
353 |
+
'maxredirects' => 0,
|
354 |
+
'timeout' => 30,
|
355 |
)
|
356 |
);
|
357 |
$xml = new SimpleXMLElement('<ProcessResponse></ProcessResponse>');
|
405 |
return MageBase_DpsPaymentExpress_Model_Method_Common::STATUS_ERROR;
|
406 |
}
|
407 |
$order = $this->_getOrder($resultXml);
|
408 |
+
if (!$order || !$order->getId()) {
|
409 |
Mage::log("Error in DPS Response Validation: No Order", null, self::DPS_LOG_FILENAME);
|
410 |
return MageBase_DpsPaymentExpress_Model_Method_Common::STATUS_ERROR;
|
411 |
}
|
412 |
+
if (abs((float)$resultXml->AmountSettlement - sprintf("%9.2f", $order->getBaseGrandTotal())) > 0.05) {
|
413 |
Mage::log(
|
414 |
$order->getIncrementId() . " Error in DPS Response Validation: Mismatched totals",
|
415 |
null,
|
540 |
$order->setStatus(Mage::getStoreConfig('payment/' . $this->_code . '/order_status', $this->getStore()));
|
541 |
$order->save();
|
542 |
$this->_sendEmails($order, $invoice);
|
|
|
543 |
}
|
544 |
|
545 |
/**
|
554 |
switch (Mage::getStoreConfig('payment/' . $this->_code . '/emailstosend', $this->getStore())) {
|
555 |
case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_INVOICE: // send invoice email only
|
556 |
$invoice->sendEmail();
|
|
|
557 |
break;
|
558 |
case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_BOTH: // send both
|
559 |
$order->sendNewOrderEmail();
|
|
|
560 |
$invoice->sendEmail();
|
|
|
561 |
break;
|
562 |
case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_ORDER: // default - send order email only
|
563 |
default:
|
564 |
$order->sendNewOrderEmail();
|
|
|
565 |
break;
|
566 |
}
|
567 |
}
|
581 |
$order->save();
|
582 |
if (!$order->getEmailSent()) {
|
583 |
$order->sendNewOrderEmail();
|
|
|
584 |
}
|
|
|
585 |
}
|
586 |
|
587 |
/**
|
601 |
}
|
602 |
if ($order && $order->getId() && $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
|
603 |
$order->registerCancellation(
|
604 |
+
Mage::helper('magebasedps')->getErrorMessage(), false
|
|
|
|
|
605 |
)->save();
|
606 |
}
|
607 |
}
|
608 |
|
609 |
+
/**
|
610 |
+
* Whether current operation is order placement
|
611 |
+
*
|
612 |
+
* @return bool
|
613 |
+
*/
|
614 |
+
protected function _isPlaceOrder()
|
615 |
+
{
|
616 |
+
$info = $this->getInfoInstance();
|
617 |
+
if ($info instanceof Mage_Sales_Model_Quote_Payment) {
|
618 |
+
return false;
|
619 |
+
} elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
|
620 |
+
return true;
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
/**
|
625 |
+
* Order increment ID getter (either real from order or a reserved from quote)
|
626 |
+
*
|
627 |
+
* @return string
|
628 |
+
*/
|
629 |
protected function _getOrderId()
|
630 |
{
|
631 |
$info = $this->getInfoInstance();
|
632 |
|
633 |
+
if ($this->_isPlaceOrder()) {
|
634 |
+
return $info->getOrder()->getIncrementId();
|
635 |
+
} else {
|
636 |
+
if (!$info->getQuote()->getReservedOrderId()) {
|
637 |
+
$info->getQuote()->reserveOrderId();
|
638 |
+
}
|
639 |
+
return $info->getQuote()->getReservedOrderId();
|
640 |
}
|
|
|
641 |
}
|
642 |
|
643 |
/**
|
app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* MageBase DPS Payment Express
|
4 |
*
|
@@ -20,7 +21,6 @@
|
|
20 |
* @copyright Copyright (c) 2010 Fooman Ltd (http://www.fooman.co.nz)
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
-
|
24 |
class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_Method_Cc
|
25 |
{
|
26 |
const URL_PXPOST = 'https://sec.paymentexpress.com/pxpost.aspx';
|
@@ -129,15 +129,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
129 |
->setLastTransId($dpsTxnRef)
|
130 |
->setTransactionId($dpsTxnRef);
|
131 |
} else {
|
132 |
-
$
|
133 |
-
if (isset($error['message'])) {
|
134 |
-
$message = Mage::helper('magebasedps')->__('There has been an error processing your payment.')
|
135 |
-
. ' ' . $error['message'];
|
136 |
-
} else {
|
137 |
-
$message = Mage::helper('magebasedps')->__(
|
138 |
-
'There has been an error processing your payment. Please try later or contact us for help.'
|
139 |
-
);
|
140 |
-
}
|
141 |
Mage::throwException($message);
|
142 |
}
|
143 |
return $this;
|
@@ -176,15 +168,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
176 |
//$payment->registerCaptureNotification($amount);
|
177 |
}
|
178 |
} else {
|
179 |
-
$
|
180 |
-
if (isset($error['message'])) {
|
181 |
-
$message = Mage::helper('magebasedps')->__('There has been an error processing your payment.')
|
182 |
-
. ' ' . $error['message'];
|
183 |
-
} else {
|
184 |
-
$message = Mage::helper('magebasedps')->__(
|
185 |
-
'There has been an error processing your payment. Please try later or contact us for help.'
|
186 |
-
);
|
187 |
-
}
|
188 |
Mage::throwException($message);
|
189 |
}
|
190 |
return $this;
|
@@ -201,15 +185,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
201 |
$payment->setStatus(self::STATUS_APPROVED)
|
202 |
->setLastTransId($dpsTxnRef);
|
203 |
} else {
|
204 |
-
$
|
205 |
-
if (isset($error['message'])) {
|
206 |
-
$message = Mage::helper('magebasedps')->__('There has been an error processing your payment.')
|
207 |
-
. $error['message'];
|
208 |
-
} else {
|
209 |
-
$message = Mage::helper('magebasedps')->__(
|
210 |
-
'There has been an error processing your payment. Please try later or contact us for help.'
|
211 |
-
);
|
212 |
-
}
|
213 |
Mage::throwException($message);
|
214 |
}
|
215 |
return $this;
|
@@ -218,21 +194,23 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
218 |
/**
|
219 |
* create transaction object in xml and submit to server
|
220 |
*
|
221 |
-
* @
|
|
|
|
|
|
|
|
|
222 |
*/
|
223 |
-
|
224 |
{
|
225 |
-
|
226 |
-
$payment = $this->getPayment();
|
227 |
-
|
228 |
$client = new Zend_Http_Client();
|
229 |
$client->setUri(self::URL_PXPOST);
|
230 |
$client->setConfig(
|
231 |
array(
|
232 |
-
|
233 |
-
|
234 |
)
|
235 |
);
|
|
|
236 |
//Completing a previously authorized transaction
|
237 |
//or refunding
|
238 |
if ($this->getPaymentAction() == MageBase_DpsPaymentExpress_Model_Method_Common::ACTION_COMPLETE
|
@@ -244,8 +222,10 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
244 |
$xml->addChild('Amount', trim(sprintf("%9.2f", $this->getAmount())));
|
245 |
$xml->addChild('TxnType', $this->getPaymentAction());
|
246 |
$xml->addChild('MerchantReference', $this->_getOrderId());
|
247 |
-
$
|
248 |
-
|
|
|
|
|
249 |
$txnId = substr(uniqid(rand()), 0, 16);
|
250 |
$this->setTransactionId($txnId);
|
251 |
$xml->addChild('TxnId', $txnId);
|
@@ -262,14 +242,18 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
262 |
$xml->addChild('CardNumber', $payment->getCcNumber());
|
263 |
//$xml->addChild('BillingId', '');
|
264 |
$xml->addChild('Cvc2', htmlentities($payment->getCcCid()));
|
265 |
-
$xml->addChild('Cvc2Presence', '1');
|
266 |
$xml->addChild(
|
267 |
'DateExpiry',
|
268 |
str_pad($payment->getCcExpMonth(), 2, '0', STR_PAD_LEFT) . substr($payment->getCcExpYear(), 2, 2)
|
269 |
);
|
270 |
-
|
|
|
|
|
271 |
//$xml->addChild('DpsTxnRef', '');
|
272 |
-
|
|
|
|
|
273 |
$xml->addChild('InputCurrency', $this->_getCurrencyCode());
|
274 |
$xml->addChild('MerchantReference', $this->_getOrderId());
|
275 |
$xml->addChild('PostUsername', htmlentities($this->getPostUsername($this->getStore())));
|
@@ -287,6 +271,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
287 |
//$xml->addChild('IssueNumber', '');
|
288 |
//$xml->addChild('Track2', '');
|
289 |
}
|
|
|
290 |
$responseXml = $this->_requestResponse($client, $xml);
|
291 |
|
292 |
//check if we have to send another Post to request the status of the transaction
|
@@ -298,6 +283,19 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
298 |
$xml->addChild('TxnId', $txnId);
|
299 |
$responseXml = $this->_requestResponse($client, $xml);
|
300 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
|
302 |
if ($responseXml && $this->_validateResponse($responseXml)) {
|
303 |
$this->unsError();
|
@@ -396,10 +394,12 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
396 |
}
|
397 |
if (!(int)$resultXml->Transaction[0]['success']) {
|
398 |
$common = Mage::getModel('magebasedps/method_common');
|
|
|
399 |
if (isset($resultXml->Transaction[0]['reco'])) {
|
|
|
400 |
Mage::log(
|
401 |
"Error in DPS Response Validation: " .
|
402 |
-
$
|
403 |
self::DPS_LOG_FILENAME
|
404 |
);
|
405 |
} else {
|
@@ -407,7 +407,9 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
407 |
"Error in DPS Response Validation: No reco code.", null, self::DPS_LOG_FILENAME
|
408 |
);
|
409 |
}
|
410 |
-
if ($
|
|
|
|
|
411 |
$this->setError(array('message' => $resultXml->HelpText));
|
412 |
}
|
413 |
return false;
|
@@ -420,7 +422,9 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
420 |
if ($this->getPaymentAction() != MageBase_DpsPaymentExpress_Model_Method_Common::ACTION_COMPLETE
|
421 |
&& $this->getPaymentAction() != MageBase_DpsPaymentExpress_Model_Method_Common::ACTION_REFUND
|
422 |
) {
|
423 |
-
if (abs((float)$resultXml->Transaction[0]->Amount - sprintf("%9.2f", $order->getBaseGrandTotal()))
|
|
|
|
|
424 |
Mage::log("Error in DPS Response Validation: Mismatched totals", null, self::DPS_LOG_FILENAME);
|
425 |
return false;
|
426 |
}
|
@@ -485,7 +489,8 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
|
|
485 |
'ResponseText' => (string)$responseXml->ResponseText,
|
486 |
'HelpText' => (string)$responseXml->HelpText,
|
487 |
'AcquirerTxnRef' => (string)$responseXml->Transaction[0]->AcquirerTxnRef,
|
488 |
-
'Cvc2ResultCode' => (string)$responseXml->Transaction[0]->Cvc2ResultCode
|
|
|
489 |
);
|
490 |
Mage::helper('magebasedps')->setAdditionalData($payment, $data);
|
491 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* MageBase DPS Payment Express
|
5 |
*
|
21 |
* @copyright Copyright (c) 2010 Fooman Ltd (http://www.fooman.co.nz)
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
*/
|
|
|
24 |
class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_Method_Cc
|
25 |
{
|
26 |
const URL_PXPOST = 'https://sec.paymentexpress.com/pxpost.aspx';
|
129 |
->setLastTransId($dpsTxnRef)
|
130 |
->setTransactionId($dpsTxnRef);
|
131 |
} else {
|
132 |
+
$message = Mage::helper('magebasedps')->getErrorMessage($this->getError());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
Mage::throwException($message);
|
134 |
}
|
135 |
return $this;
|
168 |
//$payment->registerCaptureNotification($amount);
|
169 |
}
|
170 |
} else {
|
171 |
+
$message = Mage::helper('magebasedps')->getErrorMessage($this->getError());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
Mage::throwException($message);
|
173 |
}
|
174 |
return $this;
|
185 |
$payment->setStatus(self::STATUS_APPROVED)
|
186 |
->setLastTransId($dpsTxnRef);
|
187 |
} else {
|
188 |
+
$message = Mage::helper('magebasedps')->getErrorMessage($this->getError());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
Mage::throwException($message);
|
190 |
}
|
191 |
return $this;
|
194 |
/**
|
195 |
* create transaction object in xml and submit to server
|
196 |
*
|
197 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
198 |
+
* @param boolean $enableAddBillCard
|
199 |
+
* @param boolean $rebill
|
200 |
+
*
|
201 |
+
* @return SimpleXMLElement $responseXml
|
202 |
*/
|
203 |
+
protected function getRequestToDpsResult($payment, $enableAddBillCard = false, $rebill = false)
|
204 |
{
|
|
|
|
|
|
|
205 |
$client = new Zend_Http_Client();
|
206 |
$client->setUri(self::URL_PXPOST);
|
207 |
$client->setConfig(
|
208 |
array(
|
209 |
+
'maxredirects' => 0,
|
210 |
+
'timeout' => 30,
|
211 |
)
|
212 |
);
|
213 |
+
|
214 |
//Completing a previously authorized transaction
|
215 |
//or refunding
|
216 |
if ($this->getPaymentAction() == MageBase_DpsPaymentExpress_Model_Method_Common::ACTION_COMPLETE
|
222 |
$xml->addChild('Amount', trim(sprintf("%9.2f", $this->getAmount())));
|
223 |
$xml->addChild('TxnType', $this->getPaymentAction());
|
224 |
$xml->addChild('MerchantReference', $this->_getOrderId());
|
225 |
+
$xml->addChild('DpsTxnRef', Mage::helper('magebasedps')->getAdditionalData($payment, 'DpsTxnRef'));
|
226 |
+
if ($rebill) {
|
227 |
+
$xml->addChild('DpsBillingId', $rebill);
|
228 |
+
}
|
229 |
$txnId = substr(uniqid(rand()), 0, 16);
|
230 |
$this->setTransactionId($txnId);
|
231 |
$xml->addChild('TxnId', $txnId);
|
242 |
$xml->addChild('CardNumber', $payment->getCcNumber());
|
243 |
//$xml->addChild('BillingId', '');
|
244 |
$xml->addChild('Cvc2', htmlentities($payment->getCcCid()));
|
245 |
+
$xml->addChild('Cvc2Presence', ($payment->getCcCid()) ? '1' : '0');
|
246 |
$xml->addChild(
|
247 |
'DateExpiry',
|
248 |
str_pad($payment->getCcExpMonth(), 2, '0', STR_PAD_LEFT) . substr($payment->getCcExpYear(), 2, 2)
|
249 |
);
|
250 |
+
if ($rebill) {
|
251 |
+
$xml->addChild('DpsBillingId', $rebill);
|
252 |
+
}
|
253 |
//$xml->addChild('DpsTxnRef', '');
|
254 |
+
if ($enableAddBillCard) {
|
255 |
+
$xml->addChild('EnableAddBillCard', $enableAddBillCard);
|
256 |
+
}
|
257 |
$xml->addChild('InputCurrency', $this->_getCurrencyCode());
|
258 |
$xml->addChild('MerchantReference', $this->_getOrderId());
|
259 |
$xml->addChild('PostUsername', htmlentities($this->getPostUsername($this->getStore())));
|
271 |
//$xml->addChild('IssueNumber', '');
|
272 |
//$xml->addChild('Track2', '');
|
273 |
}
|
274 |
+
Mage::dispatchEvent('magebasedps_pxpost_xml_before', array('method_instance' => $this, 'xml' => $xml));
|
275 |
$responseXml = $this->_requestResponse($client, $xml);
|
276 |
|
277 |
//check if we have to send another Post to request the status of the transaction
|
283 |
$xml->addChild('TxnId', $txnId);
|
284 |
$responseXml = $this->_requestResponse($client, $xml);
|
285 |
}
|
286 |
+
return $responseXml;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* create transaction object in xml and submit to server
|
291 |
+
*
|
292 |
+
* @return bool
|
293 |
+
*/
|
294 |
+
public function buildRequestAndSubmitToDps()
|
295 |
+
{
|
296 |
+
$payment = $this->getPayment();
|
297 |
+
|
298 |
+
$responseXml = $this->getRequestToDpsResult($payment);
|
299 |
|
300 |
if ($responseXml && $this->_validateResponse($responseXml)) {
|
301 |
$this->unsError();
|
394 |
}
|
395 |
if (!(int)$resultXml->Transaction[0]['success']) {
|
396 |
$common = Mage::getModel('magebasedps/method_common');
|
397 |
+
$errExplained = false;
|
398 |
if (isset($resultXml->Transaction[0]['reco'])) {
|
399 |
+
$errExplained = $common->returnErrorExplanation($resultXml->Transaction[0]['reco']);
|
400 |
Mage::log(
|
401 |
"Error in DPS Response Validation: " .
|
402 |
+
$errExplained, null,
|
403 |
self::DPS_LOG_FILENAME
|
404 |
);
|
405 |
} else {
|
407 |
"Error in DPS Response Validation: No reco code.", null, self::DPS_LOG_FILENAME
|
408 |
);
|
409 |
}
|
410 |
+
if ($errExplained) {
|
411 |
+
$this->setError(array('message' => $errExplained));
|
412 |
+
} elseif ($resultXml->HelpText) {
|
413 |
$this->setError(array('message' => $resultXml->HelpText));
|
414 |
}
|
415 |
return false;
|
422 |
if ($this->getPaymentAction() != MageBase_DpsPaymentExpress_Model_Method_Common::ACTION_COMPLETE
|
423 |
&& $this->getPaymentAction() != MageBase_DpsPaymentExpress_Model_Method_Common::ACTION_REFUND
|
424 |
) {
|
425 |
+
if (abs((float)$resultXml->Transaction[0]->Amount - sprintf("%9.2f", $order->getBaseGrandTotal()))
|
426 |
+
> 0.0005
|
427 |
+
) {
|
428 |
Mage::log("Error in DPS Response Validation: Mismatched totals", null, self::DPS_LOG_FILENAME);
|
429 |
return false;
|
430 |
}
|
489 |
'ResponseText' => (string)$responseXml->ResponseText,
|
490 |
'HelpText' => (string)$responseXml->HelpText,
|
491 |
'AcquirerTxnRef' => (string)$responseXml->Transaction[0]->AcquirerTxnRef,
|
492 |
+
'Cvc2ResultCode' => (string)$responseXml->Transaction[0]->Cvc2ResultCode,
|
493 |
+
'DateExpiry' => (string)$responseXml->Transaction[0]->DateExpiry
|
494 |
);
|
495 |
Mage::helper('magebasedps')->setAdditionalData($payment, $data);
|
496 |
}
|
app/code/community/MageBase/DpsPaymentExpress/Model/System/PxPayUrl.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* MageBase DPS Payment Express
|
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 Magento 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 MageBase
|
16 |
+
* @package MageBase_DpsPaymentExpress
|
17 |
+
* @author Kristof Ringleff
|
18 |
+
* @copyright Copyright (c) 2010 MageBase (http://www.magebase.com)
|
19 |
+
* @copyright Copyright (c) 2010 Fooman Ltd (http://www.fooman.co.nz)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class MageBase_DpsPaymentExpress_Model_System_PxPayUrl
|
24 |
+
{
|
25 |
+
public function toOptionArray()
|
26 |
+
{
|
27 |
+
return array(
|
28 |
+
array(
|
29 |
+
'value' => MageBase_DpsPaymentExpress_Model_Method_Pxpay::URL_PXPAY,
|
30 |
+
'label' => Mage::helper('magebasedps')->__('PxPay')
|
31 |
+
),
|
32 |
+
array(
|
33 |
+
'value' => MageBase_DpsPaymentExpress_Model_Method_Pxpay::URL_PXPAY20,
|
34 |
+
'label' => Mage::helper('magebasedps')->__('PxPay 2.0')
|
35 |
+
),
|
36 |
+
);
|
37 |
+
}
|
38 |
+
}
|
app/code/community/MageBase/DpsPaymentExpress/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<MageBase_DpsPaymentExpress>
|
5 |
-
<version>1.5.
|
6 |
</MageBase_DpsPaymentExpress>
|
7 |
</modules>
|
8 |
<global>
|
@@ -127,6 +127,7 @@
|
|
127 |
<model>magebasedps/method_pxpay</model>
|
128 |
<pxpayuserid/>
|
129 |
<pxpaykey/>
|
|
|
130 |
<payment_action>authorize_capture</payment_action>
|
131 |
<unpaid_order_status>pending_dps</unpaid_order_status>
|
132 |
<order_status>processing</order_status>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<MageBase_DpsPaymentExpress>
|
5 |
+
<version>1.5.17</version>
|
6 |
</MageBase_DpsPaymentExpress>
|
7 |
</modules>
|
8 |
<global>
|
127 |
<model>magebasedps/method_pxpay</model>
|
128 |
<pxpayuserid/>
|
129 |
<pxpaykey/>
|
130 |
+
<pxpayurl>https://sec.paymentexpress.com/pxpay/pxaccess.aspx</pxpayurl>
|
131 |
<payment_action>authorize_capture</payment_action>
|
132 |
<unpaid_order_status>pending_dps</unpaid_order_status>
|
133 |
<order_status>processing</order_status>
|
app/code/community/MageBase/DpsPaymentExpress/etc/system.xml
CHANGED
@@ -182,11 +182,20 @@
|
|
182 |
<show_in_website>1</show_in_website>
|
183 |
<show_in_store>1</show_in_store>
|
184 |
</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
<pxpayuserid translate="label">
|
186 |
<label>PxPayUserId</label>
|
187 |
<frontend_type>text</frontend_type>
|
188 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
189 |
-
<sort_order>
|
190 |
<show_in_default>1</show_in_default>
|
191 |
<show_in_website>1</show_in_website>
|
192 |
<show_in_store>1</show_in_store>
|
@@ -195,7 +204,7 @@
|
|
195 |
<label>PxPayKey</label>
|
196 |
<frontend_type>text</frontend_type>
|
197 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
198 |
-
<sort_order>
|
199 |
<show_in_default>1</show_in_default>
|
200 |
<show_in_website>1</show_in_website>
|
201 |
<show_in_store>1</show_in_store>
|
@@ -204,7 +213,7 @@
|
|
204 |
<label>Payment Action</label>
|
205 |
<frontend_type>select</frontend_type>
|
206 |
<source_model>magebasedps/system_paymentAction</source_model>
|
207 |
-
<sort_order>
|
208 |
<show_in_default>1</show_in_default>
|
209 |
<show_in_website>1</show_in_website>
|
210 |
<show_in_store>0</show_in_store>
|
182 |
<show_in_website>1</show_in_website>
|
183 |
<show_in_store>1</show_in_store>
|
184 |
</title>
|
185 |
+
<pxpayurl translate="label">
|
186 |
+
<label>Post URL</label>
|
187 |
+
<frontend_type>select</frontend_type>
|
188 |
+
<source_model>magebasedps/system_pxpayurl</source_model>
|
189 |
+
<sort_order>6</sort_order>
|
190 |
+
<show_in_default>1</show_in_default>
|
191 |
+
<show_in_website>1</show_in_website>
|
192 |
+
<show_in_store>1</show_in_store>
|
193 |
+
</pxpayurl>
|
194 |
<pxpayuserid translate="label">
|
195 |
<label>PxPayUserId</label>
|
196 |
<frontend_type>text</frontend_type>
|
197 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
198 |
+
<sort_order>7</sort_order>
|
199 |
<show_in_default>1</show_in_default>
|
200 |
<show_in_website>1</show_in_website>
|
201 |
<show_in_store>1</show_in_store>
|
204 |
<label>PxPayKey</label>
|
205 |
<frontend_type>text</frontend_type>
|
206 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
207 |
+
<sort_order>8</sort_order>
|
208 |
<show_in_default>1</show_in_default>
|
209 |
<show_in_website>1</show_in_website>
|
210 |
<show_in_store>1</show_in_store>
|
213 |
<label>Payment Action</label>
|
214 |
<frontend_type>select</frontend_type>
|
215 |
<source_model>magebasedps/system_paymentAction</source_model>
|
216 |
+
<sort_order>9</sort_order>
|
217 |
<show_in_default>1</show_in_default>
|
218 |
<show_in_website>1</show_in_website>
|
219 |
<show_in_store>0</show_in_store>
|
app/design/adminhtml/default/default/template/magebase/dps/pxpay/info.phtml
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
</table>
|
33 |
<?php $maxmindData = $this->getMaxmindData() ?>
|
34 |
<?php if($maxmindData) :?>
|
35 |
-
<?php $isFraud = $maxmindData['Suspected Fraud'] == '
|
36 |
<div class="entry-edit">
|
37 |
<div style="<?php echo $isFraud?'background-color:red;':'background-color:green;' ?>" class="entry-edit-head collapseable <?php echo $isFraud?'open':'' ?>">
|
38 |
<a onclick="$$('.magebasedps_maxmind_details').invoke('toggle');this.toggleClassName('open'); return false;" href="#" class=""><?php echo $this->__('Fraud Details')?></a>
|
32 |
</table>
|
33 |
<?php $maxmindData = $this->getMaxmindData() ?>
|
34 |
<?php if($maxmindData) :?>
|
35 |
+
<?php $isFraud = $maxmindData['Suspected Fraud'] == 'Fraud Suspected - Review Pending' || $maxmindData['Suspected Fraud'] == 'Fraud Suspected - Rejected' ?>
|
36 |
<div class="entry-edit">
|
37 |
<div style="<?php echo $isFraud?'background-color:red;':'background-color:green;' ?>" class="entry-edit-head collapseable <?php echo $isFraud?'open':'' ?>">
|
38 |
<a onclick="$$('.magebasedps_maxmind_details').invoke('toggle');this.toggleClassName('open'); return false;" href="#" class=""><?php echo $this->__('Fraud Details')?></a>
|
app/design/adminhtml/default/default/template/magebase/dps/pxpost/info.phtml
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
</table>
|
33 |
<?php $maxmindData = $this->getMaxmindData() ?>
|
34 |
<?php if($maxmindData) :?>
|
35 |
-
<?php $isFraud = $maxmindData['Suspected Fraud'] == '
|
36 |
<div class="entry-edit">
|
37 |
<div style="<?php echo $isFraud?'background-color:red;':'background-color:green;' ?>" class="entry-edit-head collapseable <?php echo $isFraud?'open':'' ?>">
|
38 |
<a onclick="$$('.magebasedps_maxmind_details').invoke('toggle');this.toggleClassName('open'); return false;" href="#" class=""><?php echo $this->__('Fraud Details')?></a>
|
32 |
</table>
|
33 |
<?php $maxmindData = $this->getMaxmindData() ?>
|
34 |
<?php if($maxmindData) :?>
|
35 |
+
<?php $isFraud = ($maxmindData['Suspected Fraud'] == 'Fraud Suspected - Review Pending' || $maxmindData['Suspected Fraud'] == 'Fraud Suspected - Rejected');?>
|
36 |
<div class="entry-edit">
|
37 |
<div style="<?php echo $isFraud?'background-color:red;':'background-color:green;' ?>" class="entry-edit-head collapseable <?php echo $isFraud?'open':'' ?>">
|
38 |
<a onclick="$$('.magebasedps_maxmind_details').invoke('toggle');this.toggleClassName('open'); return false;" href="#" class=""><?php echo $this->__('Fraud Details')?></a>
|
app/design/frontend/base/default/template/magebase/dps/pxpay/info.phtml
CHANGED
@@ -23,11 +23,11 @@
|
|
23 |
<p><?php echo $this->getMethod()->getTitle() ?></p>
|
24 |
<?php if($this->getAdditionalData('CardName')) :?>
|
25 |
<table width="100%" border="0">
|
26 |
-
<tr><td width="35%"><?php echo $this->__('Card Type') ?></td><td><?php echo $this->getAdditionalData('CardName') ?></td>
|
27 |
<?php if($this->getAdditionalData('CardHolderName')) :?>
|
28 |
-
<tr><td width="35%"><?php echo $this->__('Name on Card') ?></td><td><?php echo $this->getAdditionalData('CardHolderName') ?></td>
|
29 |
<?php endif;?>
|
30 |
</table>
|
31 |
<?php else:?>
|
32 |
<img src="<?php echo $this->getSkinUrl('images/magebase/dps/dpslogo.png'); ?>" alt="" />
|
33 |
-
<?php endif;?>
|
23 |
<p><?php echo $this->getMethod()->getTitle() ?></p>
|
24 |
<?php if($this->getAdditionalData('CardName')) :?>
|
25 |
<table width="100%" border="0">
|
26 |
+
<tr><td width="35%"><?php echo $this->__('Card Type') ?></td><td><?php echo $this->getAdditionalData('CardName') ?></td></tr>
|
27 |
<?php if($this->getAdditionalData('CardHolderName')) :?>
|
28 |
+
<tr><td width="35%"><?php echo $this->__('Name on Card') ?></td><td><?php echo $this->getAdditionalData('CardHolderName') ?></td></tr>
|
29 |
<?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/template/magebase/dps/pxpost/info.phtml
CHANGED
@@ -22,6 +22,6 @@
|
|
22 |
?>
|
23 |
<p><?php echo $this->getMethod()->getTitle() ?></p>
|
24 |
<table width="100%" border="0">
|
25 |
-
<tr><td width="35%"><?php echo $this->__('Card Type') ?></td><td><?php echo $this->getCcTypeName() ?></td>
|
26 |
-
<tr><td width="35%"><?php echo $this->__('Name on Card') ?></td><td><?php echo $this->getInfo()->getCcOwner() ?></td>
|
27 |
</table>
|
22 |
?>
|
23 |
<p><?php echo $this->getMethod()->getTitle() ?></p>
|
24 |
<table width="100%" border="0">
|
25 |
+
<tr><td width="35%"><?php echo $this->__('Card Type') ?></td><td><?php echo $this->getCcTypeName() ?></td></tr>
|
26 |
+
<tr><td width="35%"><?php echo $this->__('Name on Card') ?></td><td><?php echo $this->getInfo()->getCcOwner() ?></td></tr>
|
27 |
</table>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MageBase_DpsPaymentExpress</name>
|
4 |
-
<version>1.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -12,9 +12,9 @@
|
|
12 |
configurable if sending invoice or order confirmation email
|
13 |
automatic page reload of success page due to connection error</notes>
|
14 |
<authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>info@magebase.com</email></author><author><name>Kristof Ringleff</name><user>auto-converted</user><email>info@magebase.com</email></author></authors>
|
15 |
-
<date>2014-
|
16 |
-
<time>
|
17 |
-
<contents><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="dbf4f7b363d04d120199380dc2365a49"/></dir><dir name="Pxpost"><file name="Form.php" hash="fde018518598b03e892c43f636c14fa6"/><file name="Info.php" hash="32fd512cb7ade17f751b9385c90e04fd"/></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MageBase_DpsPaymentExpress</name>
|
4 |
+
<version>1.5.17</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>
|
12 |
configurable if sending invoice or order confirmation email
|
13 |
automatic page reload of success page due to connection error</notes>
|
14 |
<authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>info@magebase.com</email></author><author><name>Kristof Ringleff</name><user>auto-converted</user><email>info@magebase.com</email></author></authors>
|
15 |
+
<date>2014-06-03</date>
|
16 |
+
<time>10:16:34</time>
|
17 |
+
<contents><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="dbf4f7b363d04d120199380dc2365a49"/></dir><dir name="Pxpost"><file name="Form.php" hash="fde018518598b03e892c43f636c14fa6"/><file name="Info.php" hash="32fd512cb7ade17f751b9385c90e04fd"/></dir></dir><dir name="Helper"><file name="Data.php" hash="8ebc763e3f66641c9e792a1998a4c01a"/></dir><dir name="Model"><dir name="Method"><file name="Common.php" hash="a7a04f045f6749f8fc90cbb758dc2a09"/><file name="Pxpay.php" hash="1d8206d36ea29f9eab18a03ce8e5627a"/><file name="Pxpost.php" hash="5cb87f8f038a600eb349f9bdff7b00c8"/></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="InvoiceConfig.php" hash="1759209b7c34c8d6234894c25384d423"/><file name="Logos.php" hash="bfca463fa7d292fbd2b69a33d332d55a"/><file name="PaymentAction.php" hash="0be4f9a5c602b2d2723203ec56f51a8c"/><file name="PendingOrder.php" hash="31d7bd6f5fad8e1fa4315d32d123be0f"/><file name="PxPayUrl.php" hash="4bfb0cdbb892ee59f91765ce8b817c76"/></dir><file name="Debug.php" hash="dadf96f68c9cf4d09aad73ff0bacab0e"/><file name="Observer.php" hash="839408f7a4cee3ce2fa637e59fd90c23"/></dir><dir name="controllers"><file name="PxpayController.php" hash="6a2c83f98c0f03f385c4a96410d5cd6a"/></dir><dir name="etc"><file name="config-1.4.xml" hash="bf4a7cb912271d30624d53a240f7a612"/><file name="config.xml" hash="5e6611279eaa5f0d108972cb7c077717"/><file name="system.xml" hash="410ea61932e6640e16b032f5a64b6011"/></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"/><file name="mysql4-upgrade-1.2.5-1.3.0.php" hash="0136d93e9b741febf3d1a6802efb82da"/></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="JCBLogo.png" hash="73f9e8b87c6c2dbf252bbb0de43591bc"/><file name="MCSecureCodeLogo.png" hash="9f31e5ccadd98dc15d0110d0e3b450f7"/><file name="MasterCardLogo.png" hash="801014f81e405cec951076f4080b04f5"/><file name="VisaLogo.png" hash="17173fb8723d34cea61a50c01c4845ed"/><file name="VisaVerifiedLogo.png" hash="af7f6a27a6449a50d1d623d925585c47"/><file name="dpslogo.png" hash="a79b9df3fe45acb4b714cabed162ebda"/><file name="dpspxlogo.png" hash="31b1338586485c872a0f39a41813b248"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><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="de8ca6f2a3d0ef31c58f44d8fd82d6d4"/><file name="successproblem.phtml" hash="3c800184f106995844be8d9fabf6e8bf"/></dir><dir name="pxpost"><file name="form.phtml" hash="a4602fd81ac65be2dc2bd2be4a16142c"/><file name="info.phtml" hash="0e794a15e009b61e8032cf2d1a89427a"/></dir></dir></dir></dir></dir></dir></dir><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="4aa4e8f899b1096e0c41d7719c74b92b"/></dir><dir name="pxpost"><dir name="pdf"><file name="pxpost.phtml" hash="81e5f3b568e748460a5ca61e42138f8e"/></dir><file name="form.phtml" hash="7d1fa5e90ed0627b93ff7343d4bf019f"/><file name="info.phtml" hash="cd3e2a22f419e1406523594263a7b310"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|