Version Notes
Total Web Solutions Payment Gateway Module
Download this release
Release Info
Developer | Magento Core Team |
Extension | Total_Web_Solutions_Payment_Gateway_Module |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.4
- app/code/local/KuafuSoft/EcomPayment/Block/Standard/Form.php +1 -1
- app/code/local/KuafuSoft/EcomPayment/Block/Standard/Redirect.php +1 -2
- app/code/local/KuafuSoft/EcomPayment/Block/Standard/Redirect.php.sav +0 -25
- app/code/local/KuafuSoft/EcomPayment/Model/Api/Standard.php +2 -3
- app/code/local/KuafuSoft/EcomPayment/Model/Api/Standard.php.new +0 -154
- app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php +19 -24
- app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php.mod +0 -120
- app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php.new +0 -123
- app/design/frontend/default/default/template/ecompayment/payment/redirect.phtml +9 -0
- package.xml +6 -6
app/code/local/KuafuSoft/EcomPayment/Block/Standard/Form.php
CHANGED
@@ -23,7 +23,7 @@ class KuafuSoft_EcomPayment_Block_Standard_Form extends Mage_Payment_Block_Form
|
|
23 |
$locale = Mage::app()->getLocale();
|
24 |
$this->setTemplate('ecompayment/payment/redirect.phtml')
|
25 |
->setRedirectMessage(
|
26 |
-
Mage::helper('ecompayment')->__('You will be redirected to
|
27 |
)
|
28 |
->setMethodTitle('')
|
29 |
->setMethodLabelAfterHtml($this->_config->title);
|
23 |
$locale = Mage::app()->getLocale();
|
24 |
$this->setTemplate('ecompayment/payment/redirect.phtml')
|
25 |
->setRedirectMessage(
|
26 |
+
Mage::helper('ecompayment')->__('You will be redirected to Ecompayment website when you place an order.')
|
27 |
)
|
28 |
->setMethodTitle('')
|
29 |
->setMethodLabelAfterHtml($this->_config->title);
|
app/code/local/KuafuSoft/EcomPayment/Block/Standard/Redirect.php
CHANGED
@@ -15,7 +15,7 @@ class KuafuSoft_EcomPayment_Block_Standard_Redirect extends Mage_Core_Block_Abst
|
|
15 |
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
|
16 |
}
|
17 |
$html = '<html><body>';
|
18 |
-
$html.= $this->__('You will be redirected to
|
19 |
$html.= $form->toHtml();
|
20 |
$html.= '<script type="text/javascript">document.getElementById("ecompayment_standard_checkout").submit();</script>';
|
21 |
$html.= '</body></html>';
|
@@ -23,4 +23,3 @@ class KuafuSoft_EcomPayment_Block_Standard_Redirect extends Mage_Core_Block_Abst
|
|
23 |
return $html;
|
24 |
}
|
25 |
}
|
26 |
-
|
15 |
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
|
16 |
}
|
17 |
$html = '<html><body>';
|
18 |
+
$html.= $this->__('You will be redirected to Ecompayment in a few seconds.');
|
19 |
$html.= $form->toHtml();
|
20 |
$html.= '<script type="text/javascript">document.getElementById("ecompayment_standard_checkout").submit();</script>';
|
21 |
$html.= '</body></html>';
|
23 |
return $html;
|
24 |
}
|
25 |
}
|
|
app/code/local/KuafuSoft/EcomPayment/Block/Standard/Redirect.php.sav
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class KuafuSoft_EcomPayment_Block_Standard_Redirect extends Mage_Core_Block_Abstract
|
3 |
-
{
|
4 |
-
protected function _toHtml()
|
5 |
-
{
|
6 |
-
$standard = Mage::getModel('ecompayment/standard');
|
7 |
-
|
8 |
-
$form = new Varien_Data_Form();
|
9 |
-
$form->setAction($standard->getConfig()->getPayPageUrl())
|
10 |
-
->setId('ecompayment_standard_checkout')
|
11 |
-
->setName('ecompayment_standard_checkout')
|
12 |
-
->setMethod('POST')
|
13 |
-
->setUseContainer(true);
|
14 |
-
foreach ($standard->getStandardCheckoutFormFields() as $field=>$value) {
|
15 |
-
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
|
16 |
-
}
|
17 |
-
$html = '<html><body>';
|
18 |
-
$html.= $this->__('You will be redirected to the payment page in a few seconds.');
|
19 |
-
$html.= $form->toHtml();
|
20 |
-
$html.= '<script type="text/javascript">document.getElementById("ecompayment_standard_checkout").submit();</script>';
|
21 |
-
$html.= '</body></html>';
|
22 |
-
|
23 |
-
return $html;
|
24 |
-
}
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/KuafuSoft/EcomPayment/Model/Api/Standard.php
CHANGED
@@ -57,7 +57,7 @@ class KuafuSoft_EcomPayment_Model_Api_Standard extends KuafuSoft_EcomPayment_Mod
|
|
57 |
{
|
58 |
$request = $this->_exportToRequest($this->_commonRequestFields);
|
59 |
// payer address
|
60 |
-
|
61 |
$this->_debug(array('request' => $request)); // TODO: this is not supposed to be called in getter
|
62 |
return $request;
|
63 |
}
|
@@ -138,7 +138,7 @@ class KuafuSoft_EcomPayment_Model_Api_Standard extends KuafuSoft_EcomPayment_Mod
|
|
138 |
case 'EUR':
|
139 |
return 978;
|
140 |
default:
|
141 |
-
Mage::throwException(Mage::helper('ecompayment')->__('Currency not supported by
|
142 |
}
|
143 |
}
|
144 |
|
@@ -152,4 +152,3 @@ class KuafuSoft_EcomPayment_Model_Api_Standard extends KuafuSoft_EcomPayment_Mod
|
|
152 |
return $this->getData('amount');
|
153 |
}
|
154 |
}
|
155 |
-
|
57 |
{
|
58 |
$request = $this->_exportToRequest($this->_commonRequestFields);
|
59 |
// payer address
|
60 |
+
$this->_importAddress($request);
|
61 |
$this->_debug(array('request' => $request)); // TODO: this is not supposed to be called in getter
|
62 |
return $request;
|
63 |
}
|
138 |
case 'EUR':
|
139 |
return 978;
|
140 |
default:
|
141 |
+
Mage::throwException(Mage::helper('ecompayment')->__('Currency not supported by ecompayment, please select another payment method.'));
|
142 |
}
|
143 |
}
|
144 |
|
152 |
return $this->getData('amount');
|
153 |
}
|
154 |
}
|
|
app/code/local/KuafuSoft/EcomPayment/Model/Api/Standard.php.new
DELETED
@@ -1,154 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class KuafuSoft_EcomPayment_Model_Api_Standard extends KuafuSoft_EcomPayment_Model_Api_Abstract
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Global interface map and export filters
|
6 |
-
* @var array
|
7 |
-
*/
|
8 |
-
protected $_globalMap = array(
|
9 |
-
// commands
|
10 |
-
'CustomerID' => 'business_account',
|
11 |
-
'CustomerEmail' => 'customer_email',
|
12 |
-
'TransactionCurrency' => 'currency_code',
|
13 |
-
'TransactionAmount' => 'amount',
|
14 |
-
'Notes' => 'notes',
|
15 |
-
'RedirectorSuccess' => 'redirector_success',
|
16 |
-
'RedirectorFailed' => 'redirector_failed',
|
17 |
-
'PayPageType' => 'pay_page_type',
|
18 |
-
'Amount' => 'amount1',
|
19 |
-
);
|
20 |
-
protected $_exportToRequestFilters = array(
|
21 |
-
'amount' => '_filterAmount',
|
22 |
-
'shipping' => '_filterAmount'
|
23 |
-
);
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Interface for common and "aggregated order" specific fields
|
27 |
-
* @var array
|
28 |
-
*/
|
29 |
-
protected $_commonRequestFields = array(
|
30 |
-
'CustomerID', 'TransactionCurrency', 'TransactionAmount', 'CustomerEmail', 'Notes', 'RedirectorSuccess', 'RedirectorFailed', 'HouseNumber', 'PostCode', 'CHCountry',
|
31 |
-
'PayPageType', 'Amount',
|
32 |
-
);
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Fields that should be replaced in debug with '***'
|
36 |
-
*
|
37 |
-
* @var array
|
38 |
-
*/
|
39 |
-
protected $_debugReplacePrivateDataKeys = array('business');
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Address export to request map
|
43 |
-
* @var array
|
44 |
-
*/
|
45 |
-
protected $_addressMap = array(
|
46 |
-
'CHCountry' => 'country_id',
|
47 |
-
'PostCode' => 'postcode',
|
48 |
-
'HouseNumber' => 'street',
|
49 |
-
);
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Generate Ecom Standard checkout request fields
|
53 |
-
* Depending on whether there are cart line items set, will aggregate everything or display items specifically
|
54 |
-
* Shipping amount in cart line items is implemented as a separate "fake" line item
|
55 |
-
*/
|
56 |
-
public function getStandardCheckoutRequest()
|
57 |
-
{
|
58 |
-
$request = $this->_exportToRequest($this->_commonRequestFields);
|
59 |
-
// payer address
|
60 |
-
$this->_importAddress($request);
|
61 |
-
$this->_debug(array('request' => $request)); // TODO: this is not supposed to be called in getter
|
62 |
-
return $request;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Merchant account ID getter
|
67 |
-
* @return string
|
68 |
-
*/
|
69 |
-
public function getBusinessAccount()
|
70 |
-
{
|
71 |
-
return $this->_config->customer_id;
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Payment action getter
|
76 |
-
* @return string
|
77 |
-
*/
|
78 |
-
public function getPaymentAction()
|
79 |
-
{
|
80 |
-
return strtolower(parent::getPaymentAction());
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* @deprecated after 1.4.1.0
|
85 |
-
*
|
86 |
-
* @param array $request
|
87 |
-
*/
|
88 |
-
public function debugRequest($request)
|
89 |
-
{
|
90 |
-
return;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Import address object, if set, to the request
|
95 |
-
*
|
96 |
-
* @param array $request
|
97 |
-
*/
|
98 |
-
protected function _importAddress(&$request)
|
99 |
-
{
|
100 |
-
$address = $this->getAddress();
|
101 |
-
if (!$address) {
|
102 |
-
return;
|
103 |
-
}
|
104 |
-
$request = Varien_Object_Mapper::accumulateByMap($address, $request, array_flip($this->_addressMap));
|
105 |
-
}
|
106 |
-
|
107 |
-
public function getCurrencyCode()
|
108 |
-
{
|
109 |
-
$code = strtoupper($this->getData('currency_code'));
|
110 |
-
switch($code)
|
111 |
-
{
|
112 |
-
case 'AUD':
|
113 |
-
return 036;
|
114 |
-
case 'CAD':
|
115 |
-
return 124;
|
116 |
-
case 'DKK':
|
117 |
-
return 208;
|
118 |
-
case 'HKD':
|
119 |
-
return 344;
|
120 |
-
case 'ILR':
|
121 |
-
return 376;
|
122 |
-
case 'JPY':
|
123 |
-
return 392;
|
124 |
-
case 'KPW':
|
125 |
-
return 578;
|
126 |
-
case 'NOK':
|
127 |
-
return 036;
|
128 |
-
case 'GBP':
|
129 |
-
return 826;
|
130 |
-
case 'SAR':
|
131 |
-
return 682;
|
132 |
-
case 'SEK':
|
133 |
-
return 752;
|
134 |
-
case 'CHF':
|
135 |
-
return 756;
|
136 |
-
case 'USD':
|
137 |
-
return 840;
|
138 |
-
case 'EUR':
|
139 |
-
return 978;
|
140 |
-
default:
|
141 |
-
Mage::throwException(Mage::helper('ecompayment')->__('Currency not supported by ecompayment, please select another payment method.'));
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
public function getPayPageType()
|
146 |
-
{
|
147 |
-
return 4;
|
148 |
-
}
|
149 |
-
|
150 |
-
public function getAmount1()
|
151 |
-
{
|
152 |
-
return $this->getData('amount');
|
153 |
-
}
|
154 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php
CHANGED
@@ -65,34 +65,29 @@ class KuafuSoft_EcomPayment_StandardController extends Mage_Core_Controller_Fron
|
|
65 |
public function failAction()
|
66 |
{
|
67 |
$session = Mage::getSingleton('checkout/session');
|
68 |
-
|
69 |
if ($session->getLastRealOrderId()) {
|
70 |
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
71 |
-
|
72 |
-
//
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
// }
|
88 |
-
// $cart->save();
|
89 |
-
//
|
90 |
//cancel failed order
|
91 |
$order->cancel()->save();
|
92 |
-
|
93 |
}
|
94 |
-
|
95 |
-
$session->addError(Mage::helper('ecompayment')->__('Payment request failed, please try again'));
|
96 |
$this->_redirect('checkout/cart');
|
97 |
}
|
98 |
|
@@ -121,7 +116,7 @@ class KuafuSoft_EcomPayment_StandardController extends Mage_Core_Controller_Fron
|
|
121 |
}
|
122 |
else
|
123 |
{
|
124 |
-
$session->addError(Mage::helper('ecompayment')->__('Invalid payment request, please try again'));
|
125 |
$this->_redirect('checkout/cart');
|
126 |
}
|
127 |
}
|
65 |
public function failAction()
|
66 |
{
|
67 |
$session = Mage::getSingleton('checkout/session');
|
|
|
68 |
if ($session->getLastRealOrderId()) {
|
69 |
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
70 |
+
if ($order->getId()) {
|
71 |
+
//reimport items into cart
|
72 |
+
$cart = Mage::getSingleton('checkout/cart');
|
73 |
+
$cartTruncated = false;
|
74 |
+
/* @var $cart Mage_Checkout_Model_Cart */
|
75 |
+
|
76 |
+
$items = $order->getItemsCollection();
|
77 |
+
foreach ($items as $item) {
|
78 |
+
try {
|
79 |
+
$cart->addOrderItem($item);
|
80 |
+
} catch (Mage_Core_Exception $e){
|
81 |
+
;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
$cart->save();
|
85 |
+
|
|
|
|
|
|
|
86 |
//cancel failed order
|
87 |
$order->cancel()->save();
|
88 |
+
}
|
89 |
}
|
90 |
+
$session->addError(Mage::helper('ecompayment')->__('Ecom payment request failed, please try again'));
|
|
|
91 |
$this->_redirect('checkout/cart');
|
92 |
}
|
93 |
|
116 |
}
|
117 |
else
|
118 |
{
|
119 |
+
$session->addError(Mage::helper('ecompayment')->__('Invalid Ecom payment request, please try again'));
|
120 |
$this->_redirect('checkout/cart');
|
121 |
}
|
122 |
}
|
app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php.mod
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class KuafuSoft_EcomPayment_StandardController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Order instance
|
6 |
-
*/
|
7 |
-
protected $_order;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Get order
|
11 |
-
*
|
12 |
-
* @return Mage_Sales_Model_Order
|
13 |
-
*/
|
14 |
-
public function getOrder()
|
15 |
-
{
|
16 |
-
if ($this->_order == null) {
|
17 |
-
}
|
18 |
-
return $this->_order;
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Send expire header to ajax response
|
23 |
-
*
|
24 |
-
*/
|
25 |
-
protected function _expireAjax()
|
26 |
-
{
|
27 |
-
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
|
28 |
-
$this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
|
29 |
-
exit;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* When a customer chooses ecom on Checkout/Payment page
|
35 |
-
*
|
36 |
-
*/
|
37 |
-
public function redirectAction()
|
38 |
-
{
|
39 |
-
$session = Mage::getSingleton('checkout/session');
|
40 |
-
$session->setEcomPaymentStandardQuoteId($session->getQuoteId());
|
41 |
-
$this->getResponse()->setBody($this->getLayout()->createBlock('ecompayment/standard_redirect')->toHtml());
|
42 |
-
$session->unsQuoteId();
|
43 |
-
$session->unsRedirectUrl();
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* When a customer cancel payment from ecompayment.
|
48 |
-
*/
|
49 |
-
public function cancelAction()
|
50 |
-
{
|
51 |
-
$session = Mage::getSingleton('checkout/session');
|
52 |
-
$session->setQuoteId($session->getEcomPaymentStandardQuoteId(true));
|
53 |
-
if ($session->getLastRealOrderId()) {
|
54 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
55 |
-
if ($order->getId()) {
|
56 |
-
$order->cancel()->save();
|
57 |
-
}
|
58 |
-
}
|
59 |
-
$this->_redirect('checkout/cart');
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* When ecompayment fail
|
64 |
-
*/
|
65 |
-
public function failAction()
|
66 |
-
{
|
67 |
-
$session = Mage::getSingleton('checkout/session');
|
68 |
-
if ($session->getLastRealOrderId()) {
|
69 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
70 |
-
if ($order->getId()) {
|
71 |
-
//reimport items into cart
|
72 |
-
$cart = Mage::getSingleton('checkout/cart');
|
73 |
-
$cartTruncated = false;
|
74 |
-
/* @var $cart Mage_Checkout_Model_Cart */
|
75 |
-
|
76 |
-
$items = $order->getItemsCollection();
|
77 |
-
foreach ($items as $item) {
|
78 |
-
try {
|
79 |
-
$cart->addOrderItem($item);
|
80 |
-
} catch (Mage_Core_Exception $e){
|
81 |
-
;
|
82 |
-
}
|
83 |
-
}
|
84 |
-
$cart->save();
|
85 |
-
|
86 |
-
//cancel failed order
|
87 |
-
$order->cancel()->save();
|
88 |
-
}
|
89 |
-
}
|
90 |
-
$session->addError(Mage::helper('ecompayment')->__('Payment request failed, please try again'));
|
91 |
-
$this->_redirect('checkout/cart');
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* when ecompayment returns
|
96 |
-
* The order information at this point is in POST
|
97 |
-
* variables. However, you don't want to "process" the order until you
|
98 |
-
* get validation from the IPN.
|
99 |
-
*/
|
100 |
-
public function successAction()
|
101 |
-
{
|
102 |
-
$status = $this->getRequest()->getParam('Status');
|
103 |
-
$transId= $this->getRequest()->getParam('TransID');
|
104 |
-
$amount = $this->getRequest()->getparam('Amount');
|
105 |
-
$md5Check = $this->getRequest()->getParam('Crypt');
|
106 |
-
$session = Mage::getSingleton('checkout/session');
|
107 |
-
if($md5Check == md5($status . $transId . $amount . Mage::getStoreConfig('payment/ecompayment_standard/secret_key')))
|
108 |
-
{
|
109 |
-
$session->setQuoteId($session->getEcomPaymentStandardQuoteId(true));
|
110 |
-
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
111 |
-
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
112 |
-
}
|
113 |
-
else
|
114 |
-
{
|
115 |
-
$session->addError(Mage::helper('ecompayment')->__('Invalid payment request, please try again'));
|
116 |
-
$this->_redirect('checkout/cart');
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php.new
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class KuafuSoft_EcomPayment_StandardController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Order instance
|
6 |
-
*/
|
7 |
-
protected $_order;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Get order
|
11 |
-
*
|
12 |
-
* @return Mage_Sales_Model_Order
|
13 |
-
*/
|
14 |
-
public function getOrder()
|
15 |
-
{
|
16 |
-
if ($this->_order == null) {
|
17 |
-
}
|
18 |
-
return $this->_order;
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Send expire header to ajax response
|
23 |
-
*
|
24 |
-
*/
|
25 |
-
protected function _expireAjax()
|
26 |
-
{
|
27 |
-
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
|
28 |
-
$this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
|
29 |
-
exit;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* When a customer chooses ecom on Checkout/Payment page
|
35 |
-
*
|
36 |
-
*/
|
37 |
-
public function redirectAction()
|
38 |
-
{
|
39 |
-
$session = Mage::getSingleton('checkout/session');
|
40 |
-
$session->setEcomPaymentStandardQuoteId($session->getQuoteId());
|
41 |
-
$this->getResponse()->setBody($this->getLayout()->createBlock('ecompayment/standard_redirect')->toHtml());
|
42 |
-
$session->unsQuoteId();
|
43 |
-
$session->unsRedirectUrl();
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* When a customer cancel payment from ecompayment.
|
48 |
-
*/
|
49 |
-
public function cancelAction()
|
50 |
-
{
|
51 |
-
$session = Mage::getSingleton('checkout/session');
|
52 |
-
$session->setQuoteId($session->getEcomPaymentStandardQuoteId(true));
|
53 |
-
if ($session->getLastRealOrderId()) {
|
54 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
55 |
-
if ($order->getId()) {
|
56 |
-
$order->cancel()->save();
|
57 |
-
}
|
58 |
-
}
|
59 |
-
$this->_redirect('checkout/cart');
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* When ecompayment fail
|
64 |
-
*/
|
65 |
-
public function failAction()
|
66 |
-
{
|
67 |
-
$session = Mage::getSingleton('checkout/session');
|
68 |
-
if ($session->getLastRealOrderId()) {
|
69 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
70 |
-
if ($order->getId()) {
|
71 |
-
//reimport items into cart
|
72 |
-
$cart = Mage::getSingleton('checkout/cart');
|
73 |
-
$cartTruncated = false;
|
74 |
-
/* @var $cart Mage_Checkout_Model_Cart */
|
75 |
-
|
76 |
-
$items = $order->getItemsCollection();
|
77 |
-
foreach ($items as $item) {
|
78 |
-
try {
|
79 |
-
$cart->addOrderItem($item);
|
80 |
-
} catch (Mage_Core_Exception $e){
|
81 |
-
;
|
82 |
-
}
|
83 |
-
}
|
84 |
-
$cart->save();
|
85 |
-
|
86 |
-
//cancel failed order
|
87 |
-
$order->cancel()->save();
|
88 |
-
}
|
89 |
-
}
|
90 |
-
$session->addError(Mage::helper('ecompayment')->__('Ecom payment request failed, please try again'));
|
91 |
-
$this->_redirect('checkout/cart');
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* when ecompayment returns
|
96 |
-
* The order information at this point is in POST
|
97 |
-
* variables. However, you don't want to "process" the order until you
|
98 |
-
* get validation from the IPN.
|
99 |
-
*/
|
100 |
-
public function successAction()
|
101 |
-
{
|
102 |
-
$status = $this->getRequest()->getParam('Status');
|
103 |
-
$transId= $this->getRequest()->getParam('TransID');
|
104 |
-
$amount = $this->getRequest()->getparam('Amount');
|
105 |
-
$md5Check = $this->getRequest()->getParam('Crypt');
|
106 |
-
$session = Mage::getSingleton('checkout/session');
|
107 |
-
if($md5Check == md5($status . $transId . $amount . Mage::getStoreConfig('payment/ecompayment_standard/secret_key')))
|
108 |
-
{
|
109 |
-
$session->setQuoteId($session->getEcomPaymentStandardQuoteId(true));
|
110 |
-
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
111 |
-
$order = Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id'));
|
112 |
-
$order->setState(Mage::getStoreConfig('payment/ecompayment_standard/order_status'), true)
|
113 |
-
->addStatusToHistory($order->getStatus(), '', false)
|
114 |
-
->save();
|
115 |
-
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
116 |
-
}
|
117 |
-
else
|
118 |
-
{
|
119 |
-
$session->addError(Mage::helper('ecompayment')->__('Invalid Ecom payment request, please try again'));
|
120 |
-
$this->_redirect('checkout/cart');
|
121 |
-
}
|
122 |
-
}
|
123 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/default/default/template/ecompayment/payment/redirect.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<ul class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
|
2 |
+
<li class="form-alt"><?php echo $this->getRedirectMessage() ?></li>
|
3 |
+
<?php if ($code = $this->getCreateBACode()): ?>
|
4 |
+
<li class="form-alt">
|
5 |
+
<label for="<?php echo $code ?>"><input type="checkbox" id="<?php echo $code ?>" value="1" name="payment[<?php echo $code ?>]" class="checkbox" />
|
6 |
+
<?php echo $this->__('Sign a billing agreement to streamline further purchases with Ecompayment.') ?></label>
|
7 |
+
</li>
|
8 |
+
<?php endif; ?>
|
9 |
+
</ul>
|
package.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Total_Web_Solutions_Payment_Gateway_Module</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Total Web Solutions Payment Gateway Module</summary>
|
@@ -11,11 +11,11 @@
|
|
11 |
|
12 |
Total Web Solutions offers EcomMerchant, one of the lowest priced payment gateways available in the UK. Total Web Solutions is PCI Level 1 accredited and has been providing business critical solutions to organisations of all sizes since 1995. EcomMerchant offers a customisable pay page and merchant tool for reporting, issuing refunds (full and partial) and viewing stats. Optional add-ons include Virtual Terminal, Multi-Currency, 3D Secure authentication and many others. EcomMerchant works in conjunction with an Internet Merchant Account from Barclays, HSBC or Streamline (Natwest/RBS).
|
13 |
To learn more about the service visit: http://payments.totalwebsolutions.com/</description>
|
14 |
-
<notes>
|
15 |
<authors><author><name>Simon Lowe</name><user>auto-converted</user><email>sales@totalwebsolutions.com</email></author></authors>
|
16 |
-
<date>2010-11-
|
17 |
-
<time>
|
18 |
-
<contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ecompayment"><dir name="payment"><file name="redirect.phtml" hash="f26e571f8d5cad38481b8f53c60a6e58"/></dir></dir></dir></dir></dir
|
19 |
<compatible/>
|
20 |
<dependencies/>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Total_Web_Solutions_Payment_Gateway_Module</name>
|
4 |
+
<version>1.4</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Total Web Solutions Payment Gateway Module</summary>
|
11 |
|
12 |
Total Web Solutions offers EcomMerchant, one of the lowest priced payment gateways available in the UK. Total Web Solutions is PCI Level 1 accredited and has been providing business critical solutions to organisations of all sizes since 1995. EcomMerchant offers a customisable pay page and merchant tool for reporting, issuing refunds (full and partial) and viewing stats. Optional add-ons include Virtual Terminal, Multi-Currency, 3D Secure authentication and many others. EcomMerchant works in conjunction with an Internet Merchant Account from Barclays, HSBC or Streamline (Natwest/RBS).
|
13 |
To learn more about the service visit: http://payments.totalwebsolutions.com/</description>
|
14 |
+
<notes>Total Web Solutions Payment Gateway Module</notes>
|
15 |
<authors><author><name>Simon Lowe</name><user>auto-converted</user><email>sales@totalwebsolutions.com</email></author></authors>
|
16 |
+
<date>2010-11-29</date>
|
17 |
+
<time>09:30:00</time>
|
18 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ecompayment"><dir name="payment"><file name="redirect.phtml" hash="f26e571f8d5cad38481b8f53c60a6e58"/></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="ecompayment"><dir name="payment"><file name="redirect.phtml" hash="f26e571f8d5cad38481b8f53c60a6e58"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="KuafuSoft"><dir name="EcomPayment"><dir name="Block"><dir name="Payment"><file name="Info.php" hash="33f4efd0baab7e8072c9cdda22c6019e"/></dir><dir name="Standard"><file name="Form.php" hash="86a5a2dcc1354e1cbec2658952941a40"/><file name="Redirect.php" hash="6e5898a226bf107252049fd46733a6c9"/></dir></dir><dir name="controllers"><file name="StandardController.php" hash="20743e9d3c6904b32d77280312fa9ce0"/></dir><dir name="etc"><file name="config.xml" hash="e56ac6f19bc75a5bcfdcab3d5c2bb608"/><file name="system.xml" hash="910ad97aaedc4fa2aa275e88fc7c2cc0"/></dir><dir name="Helper"><file name="Data.php" hash="0b62c17838ed0e134643d5c3c0fe3fe6"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="b766487ac87cc06b67966ecba8201cb8"/><file name="Standard.php" hash="24852e2b0992c8c32a449f979ce718bf"/></dir><dir name="sql"><dir name="ecompayment_setup"><file name="mysql4-install-0.1.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/></dir></dir><file name="Config.php" hash="54380402c12f02a2207b2418f1577728"/><file name="Standard.php" hash="d6ddc5e714f87af581df13f9cbd1b4b6"/><file name="Status.php" hash="375570e3be74a06203f27e500e82e7be"/></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies/>
|
21 |
</package>
|