Total_Web_Solutions_Payment_Gateway_Module - Version 1.8.2

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.8.2
Comparing to
See all releases


Code changes from version 1.8 to 1.8.2

app/code/local/KuafuSoft/EcomPayment/Model/Api/Standard.php CHANGED
@@ -1,154 +1,154 @@
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', '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
- );
49
-
50
- /**
51
- * Generate Ecom Standard checkout request fields
52
- * Depending on whether there are cart line items set, will aggregate everything or display items specifically
53
- * Shipping amount in cart line items is implemented as a separate "fake" line item
54
- */
55
- public function getStandardCheckoutRequest()
56
- {
57
- $request = $this->_exportToRequest($this->_commonRequestFields);
58
- // payer address
59
- // not required $this->_importAddress($request);
60
- $this->_debug(array('request' => $request)); // TODO: this is not supposed to be called in getter
61
- return $request;
62
- }
63
-
64
- /**
65
- * Merchant account ID getter
66
- * @return string
67
- */
68
- public function getBusinessAccount()
69
- {
70
- return $this->_config->customer_id;
71
- }
72
-
73
- /**
74
- * Payment action getter
75
- * @return string
76
- */
77
- public function getPaymentAction()
78
- {
79
- return strtolower(parent::getPaymentAction());
80
- }
81
-
82
- /**
83
- * @deprecated after 1.4.1.0
84
- *
85
- * @param array $request
86
- */
87
- public function debugRequest($request)
88
- {
89
- return;
90
- }
91
-
92
- /**
93
- * Import address object, if set, to the request
94
- *
95
- * @param array $request
96
- */
97
- protected function _importAddress(&$request)
98
- {
99
- $address = $this->getAddress();
100
- if (!$address) {
101
- return;
102
- }
103
- $request = Varien_Object_Mapper::accumulateByMap($address, $request, array_flip($this->_addressMap));
104
- }
105
-
106
- public function getCurrencyCode()
107
- {
108
- $code = strtoupper($this->getData('currency_code'));
109
- switch($code)
110
- {
111
- case 'AUD':
112
- return 036;
113
- case 'CAD':
114
- return 124;
115
- case 'DKK':
116
- return 208;
117
- case 'HKD':
118
- return 344;
119
- case 'ILR':
120
- return 376;
121
- case 'JPY':
122
- return 392;
123
- case 'KPW':
124
- return 578;
125
- case 'NOK':
126
- return 036;
127
- case 'GBP':
128
- return 826;
129
- case 'SAR':
130
- return 682;
131
- case 'SEK':
132
- return 752;
133
- case 'CHF':
134
- return 756;
135
- case 'USD':
136
- return 840;
137
- case 'EUR':
138
- return 978;
139
- default:
140
- Mage::throwException(Mage::helper('ecompayment')->__('Currency not supported by payment, please select another payment method.'));
141
- }
142
- }
143
-
144
- public function getPayPageType()
145
- {
146
- return 4;
147
- }
148
-
149
- public function getAmount1()
150
- {
151
- return $this->getData('amount');
152
- }
153
- }
154
-
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,14 +65,11 @@ 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
- // PF I've commented this out as it seemed to duplicate the order when payment failed
73
- // 12/11/10
74
- // if ($order->getId()) {
75
- // //reimport items into cart
76
  // $cart = Mage::getSingleton('checkout/cart');
77
  // $cartTruncated = false;
78
  // /* @var $cart Mage_Checkout_Model_Cart */
@@ -86,13 +83,12 @@ class KuafuSoft_EcomPayment_StandardController extends Mage_Core_Controller_Fron
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
 
@@ -118,10 +114,18 @@ class KuafuSoft_EcomPayment_StandardController extends Mage_Core_Controller_Fron
118
  ->addStatusToHistory($order->getStatus(), '', false)
119
  ->save();
120
  $this->_redirect('checkout/onepage/success', array('_secure'=>true));
 
 
 
 
 
 
 
 
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
+ // Following lines seem to duplicate items if transaction fails
71
+ // if ($order->getId()) {
72
+ //reimport items into cart
 
 
73
  // $cart = Mage::getSingleton('checkout/cart');
74
  // $cartTruncated = false;
75
  // /* @var $cart Mage_Checkout_Model_Cart */
83
  // }
84
  // }
85
  // $cart->save();
86
+
87
  //cancel failed order
88
  $order->cancel()->save();
89
  // }
90
  }
91
+ $session->addError(Mage::helper('ecompayment')->__('Ecom payment request failed, please try again'));
 
92
  $this->_redirect('checkout/cart');
93
  }
94
 
114
  ->addStatusToHistory($order->getStatus(), '', false)
115
  ->save();
116
  $this->_redirect('checkout/onepage/success', array('_secure'=>true));
117
+
118
+ // Send a confirmation email to customer
119
+ $order = Mage::getModel('sales/order');
120
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
121
+ if($order->getId()){
122
+ $order->sendNewOrderEmail();
123
+ }
124
+
125
  }
126
  else
127
  {
128
+ $session->addError(Mage::helper('ecompayment')->__('Invalid Ecom payment request, please try again'));
129
  $this->_redirect('checkout/cart');
130
  }
131
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Total_Web_Solutions_Payment_Gateway_Module</name>
4
- <version>1.8</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>
@@ -13,9 +13,9 @@ Total Web Solutions offers EcomMerchant, one of the lowest priced payment gatewa
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>2011-01-13</date>
17
- <time>09:15:43</time>
18
- <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="KuafuSoft_EcomPayment.xml" hash="71a369f4269773b4fbcf212f9a75de6e"/></dir></dir></dir></target><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></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="a98d4f42c848447c60106bff00a4ca2e"/></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="f92ece8d0a96c21c6ede880b8ef1dabd"/></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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Total_Web_Solutions_Payment_Gateway_Module</name>
4
+ <version>1.8.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
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>2011-02-02</date>
17
+ <time>14:40:20</time>
18
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="KuafuSoft_EcomPayment.xml" hash="71a369f4269773b4fbcf212f9a75de6e"/></dir></dir></dir></target><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></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="057e657a23a663f931da4658e777e0ce"/></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>