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.6 |
| Comparing to | |
| See all releases | |
Code changes from version 1.5 to 1.6
- app/code/local/KuafuSoft/EcomPayment/Block/Payment/Info.php +4 -4
- app/code/local/KuafuSoft/EcomPayment/Block/Standard/Form.php +41 -41
- app/code/local/KuafuSoft/EcomPayment/Block/Standard/Redirect.php +25 -25
- app/code/local/KuafuSoft/EcomPayment/Model/Api/Abstract.php +279 -279
- app/code/local/KuafuSoft/EcomPayment/Model/Api/Standard.php +154 -154
- app/code/local/KuafuSoft/EcomPayment/Model/Config.php +343 -343
- app/code/local/KuafuSoft/EcomPayment/Model/Standard.php +147 -147
- app/code/local/KuafuSoft/EcomPayment/Model/Status.php +14 -14
- app/code/local/KuafuSoft/EcomPayment/Model/sql/ecompayment_setup/mysql4-install-0.1.0.php +0 -1
- app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php +128 -123
- app/code/local/KuafuSoft/EcomPayment/etc/system.xml +85 -85
- app/design/frontend/base/default/template/ecompayment/payment/redirect.phtml +0 -9
- app/etc/modules/KuafuSoft_EcomPayment.xml +14 -14
- package.xml +4 -4
app/code/local/KuafuSoft/EcomPayment/Block/Payment/Info.php
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class KuafuSoft_EcomPayment_Block_Payment_Info extends Mage_Payment_Block_Info_Cc
|
| 3 |
-
{
|
| 4 |
-
}
|
| 1 |
+
<?php
|
| 2 |
+
class KuafuSoft_EcomPayment_Block_Payment_Info extends Mage_Payment_Block_Info_Cc
|
| 3 |
+
{
|
| 4 |
+
}
|
app/code/local/KuafuSoft/EcomPayment/Block/Standard/Form.php
CHANGED
|
@@ -1,41 +1,41 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class KuafuSoft_EcomPayment_Block_Standard_Form extends Mage_Payment_Block_Form
|
| 3 |
-
{
|
| 4 |
-
/**
|
| 5 |
-
* Payment method code
|
| 6 |
-
* @var string
|
| 7 |
-
*/
|
| 8 |
-
protected $_methodCode = KuafuSoft_EcomPayment_Model_Config::METHOD_STANDARD;
|
| 9 |
-
|
| 10 |
-
/**
|
| 11 |
-
* Config model instance
|
| 12 |
-
*
|
| 13 |
-
* @var KuafuSoft_EcomPayment_Model_Config
|
| 14 |
-
*/
|
| 15 |
-
protected $_config;
|
| 16 |
-
|
| 17 |
-
/**
|
| 18 |
-
* Set template and redirect message
|
| 19 |
-
*/
|
| 20 |
-
protected function _construct()
|
| 21 |
-
{
|
| 22 |
-
$this->_config = Mage::getModel('ecompayment/config')->setMethod($this->getMethodCode());
|
| 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);
|
| 30 |
-
return parent::_construct();
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
/**
|
| 34 |
-
* Payment method code getter
|
| 35 |
-
* @return string
|
| 36 |
-
*/
|
| 37 |
-
public function getMethodCode()
|
| 38 |
-
{
|
| 39 |
-
return $this->_methodCode;
|
| 40 |
-
}
|
| 41 |
-
}
|
| 1 |
+
<?php
|
| 2 |
+
class KuafuSoft_EcomPayment_Block_Standard_Form extends Mage_Payment_Block_Form
|
| 3 |
+
{
|
| 4 |
+
/**
|
| 5 |
+
* Payment method code
|
| 6 |
+
* @var string
|
| 7 |
+
*/
|
| 8 |
+
protected $_methodCode = KuafuSoft_EcomPayment_Model_Config::METHOD_STANDARD;
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Config model instance
|
| 12 |
+
*
|
| 13 |
+
* @var KuafuSoft_EcomPayment_Model_Config
|
| 14 |
+
*/
|
| 15 |
+
protected $_config;
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Set template and redirect message
|
| 19 |
+
*/
|
| 20 |
+
protected function _construct()
|
| 21 |
+
{
|
| 22 |
+
$this->_config = Mage::getModel('ecompayment/config')->setMethod($this->getMethodCode());
|
| 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);
|
| 30 |
+
return parent::_construct();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Payment method code getter
|
| 35 |
+
* @return string
|
| 36 |
+
*/
|
| 37 |
+
public function getMethodCode()
|
| 38 |
+
{
|
| 39 |
+
return $this->_methodCode;
|
| 40 |
+
}
|
| 41 |
+
}
|
app/code/local/KuafuSoft/EcomPayment/Block/Standard/Redirect.php
CHANGED
|
@@ -1,25 +1,25 @@
|
|
| 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 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>';
|
| 22 |
-
|
| 23 |
-
return $html;
|
| 24 |
-
}
|
| 25 |
-
}
|
| 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 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>';
|
| 22 |
+
|
| 23 |
+
return $html;
|
| 24 |
+
}
|
| 25 |
+
}
|
app/code/local/KuafuSoft/EcomPayment/Model/Api/Abstract.php
CHANGED
|
@@ -1,279 +1,279 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
abstract class KuafuSoft_EcomPayment_Model_Api_Abstract extends Varien_Object
|
| 3 |
-
{
|
| 4 |
-
/**
|
| 5 |
-
* Config instance
|
| 6 |
-
* @var KuafuSoft_EcomPayment_Model_Config
|
| 7 |
-
*/
|
| 8 |
-
protected $_config = null;
|
| 9 |
-
|
| 10 |
-
/**
|
| 11 |
-
* Global private to public interface map
|
| 12 |
-
* @var array
|
| 13 |
-
*/
|
| 14 |
-
protected $_globalMap = array();
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Filter callbacks for exporting $this data to API call
|
| 18 |
-
*
|
| 19 |
-
* @var array
|
| 20 |
-
*/
|
| 21 |
-
protected $_exportToRequestFilters = array();
|
| 22 |
-
|
| 23 |
-
/**
|
| 24 |
-
* Filter callbacks for importing API result to $this data
|
| 25 |
-
*
|
| 26 |
-
* @var array
|
| 27 |
-
*/
|
| 28 |
-
protected $_importFromRequestFilters = array();
|
| 29 |
-
|
| 30 |
-
/**
|
| 31 |
-
* Fields that should be replaced in debug with '***'
|
| 32 |
-
*
|
| 33 |
-
* @var array
|
| 34 |
-
*/
|
| 35 |
-
protected $_debugReplacePrivateDataKeys = array();
|
| 36 |
-
|
| 37 |
-
/**
|
| 38 |
-
* @deprecated after 1.4.1.0
|
| 39 |
-
*
|
| 40 |
-
* @return bool
|
| 41 |
-
*/
|
| 42 |
-
public function getDebug()
|
| 43 |
-
{
|
| 44 |
-
return $this->getDebugFlag();
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
/**
|
| 48 |
-
* Ecom merchant Id getter
|
| 49 |
-
*/
|
| 50 |
-
public function getBusinessAccount()
|
| 51 |
-
{
|
| 52 |
-
return $this->_getDataOrConfig('customer_id');
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
-
/**
|
| 56 |
-
* Import $this public data to specified object or array
|
| 57 |
-
*
|
| 58 |
-
* @param array|Varien_Object $to
|
| 59 |
-
* @param array $publicMap
|
| 60 |
-
* @return array|Varien_Object
|
| 61 |
-
*/
|
| 62 |
-
public function &import($to, array $publicMap = array())
|
| 63 |
-
{
|
| 64 |
-
return Varien_Object_Mapper::accumulateByMap(array($this, 'getDataUsingMethod'), $to, $publicMap);
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
/**
|
| 68 |
-
* Export $this public data from specified object or array
|
| 69 |
-
*
|
| 70 |
-
* @param array|Varien_Object $from
|
| 71 |
-
* @param array $publicMap
|
| 72 |
-
* @return KuafuSoft_EcomPayment_Model_Api_Abstract
|
| 73 |
-
*/
|
| 74 |
-
public function export($from, array $publicMap = array())
|
| 75 |
-
{
|
| 76 |
-
Varien_Object_Mapper::accumulateByMap($from, array($this, 'setDataUsingMethod'), $publicMap);
|
| 77 |
-
return $this;
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
/**
|
| 81 |
-
* Config instance setter
|
| 82 |
-
* @param KuafuSoft_EcomPayment_Model_Config $config
|
| 83 |
-
* @return KuafuSoft_EcomPayment_Model_Api_Abstract
|
| 84 |
-
*/
|
| 85 |
-
public function setConfigObject(KuafuSoft_EcomPayment_Model_Config $config)
|
| 86 |
-
{
|
| 87 |
-
$this->_config = $config;
|
| 88 |
-
return $this;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
/**
|
| 92 |
-
* Current locale code getter
|
| 93 |
-
*
|
| 94 |
-
* @return string
|
| 95 |
-
*/
|
| 96 |
-
public function getLocaleCode()
|
| 97 |
-
{
|
| 98 |
-
return Mage::app()->getLocale()->getLocaleCode();
|
| 99 |
-
}
|
| 100 |
-
|
| 101 |
-
/**
|
| 102 |
-
* Export $this public data to private request array
|
| 103 |
-
*
|
| 104 |
-
* @param array $internalRequestMap
|
| 105 |
-
* @param array $request
|
| 106 |
-
* @return array
|
| 107 |
-
*/
|
| 108 |
-
protected function &_exportToRequest(array $privateRequestMap, array $request = array())
|
| 109 |
-
{
|
| 110 |
-
$map = array();
|
| 111 |
-
foreach ($privateRequestMap as $key) {
|
| 112 |
-
if (isset($this->_globalMap[$key])) {
|
| 113 |
-
$map[$this->_globalMap[$key]] = $key;
|
| 114 |
-
}
|
| 115 |
-
}
|
| 116 |
-
$result = Varien_Object_Mapper::accumulateByMap(array($this, 'getDataUsingMethod'), $request, $map);
|
| 117 |
-
foreach ($privateRequestMap as $key) {
|
| 118 |
-
if (isset($this->_exportToRequestFilters[$key]) && isset($result[$key])) {
|
| 119 |
-
$callback = $this->_exportToRequestFilters[$key];
|
| 120 |
-
$privateKey = $result[$key];
|
| 121 |
-
$publicKey = $map[$this->_globalMap[$key]];
|
| 122 |
-
$result[$key] = call_user_func(array($this, $callback), $privateKey, $publicKey);
|
| 123 |
-
}
|
| 124 |
-
}
|
| 125 |
-
return $result;
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
/**
|
| 129 |
-
* Import $this public data from a private response array
|
| 130 |
-
*
|
| 131 |
-
* @param array $privateResponseMap
|
| 132 |
-
* @param array $response
|
| 133 |
-
*/
|
| 134 |
-
protected function _importFromResponse(array $privateResponseMap, array $response)
|
| 135 |
-
{
|
| 136 |
-
$map = array();
|
| 137 |
-
foreach ($privateResponseMap as $key) {
|
| 138 |
-
if (isset($this->_globalMap[$key])) {
|
| 139 |
-
$map[$key] = $this->_globalMap[$key];
|
| 140 |
-
}
|
| 141 |
-
if (isset($response[$key]) && isset($this->_importFromRequestFilters[$key])) {
|
| 142 |
-
$callback = $this->_importFromRequestFilters[$key];
|
| 143 |
-
$response[$key] = call_user_func(array($this, $callback), $response[$key], $key, $map[$key]);
|
| 144 |
-
}
|
| 145 |
-
}
|
| 146 |
-
Varien_Object_Mapper::accumulateByMap($response, array($this, 'setDataUsingMethod'), $map);
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
/**
|
| 150 |
-
* Filter amounts in API calls
|
| 151 |
-
* @param float|string $value
|
| 152 |
-
* @return string
|
| 153 |
-
*/
|
| 154 |
-
protected function _filterAmount($value)
|
| 155 |
-
{
|
| 156 |
-
return sprintf('%.2F', $value);
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
/**
|
| 160 |
-
* Filter boolean values in API calls
|
| 161 |
-
*
|
| 162 |
-
* @param mixed $value
|
| 163 |
-
* @return string
|
| 164 |
-
*/
|
| 165 |
-
protected function _filterBool($value)
|
| 166 |
-
{
|
| 167 |
-
return ($value) ? 'true' : 'false';
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
/**
|
| 171 |
-
* Filter int values in API calls
|
| 172 |
-
*
|
| 173 |
-
* @param mixed $value
|
| 174 |
-
* @return int
|
| 175 |
-
*/
|
| 176 |
-
protected function _filterInt($value)
|
| 177 |
-
{
|
| 178 |
-
return (int)$value;
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
/**
|
| 182 |
-
* Unified getter that looks in data or falls back to config
|
| 183 |
-
*
|
| 184 |
-
* @param string $key
|
| 185 |
-
* @param mixed $default
|
| 186 |
-
* @return mixed
|
| 187 |
-
*/
|
| 188 |
-
protected function _getDataOrConfig($key, $default = null)
|
| 189 |
-
{
|
| 190 |
-
if ($this->hasData($key)) {
|
| 191 |
-
return $this->getData($key);
|
| 192 |
-
}
|
| 193 |
-
return $this->_config->$key ? $this->_config->$key : $default;
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
/**
|
| 197 |
-
* Street address workaround: divides address lines into parts by specified keys
|
| 198 |
-
* (keys should go as 3rd, 4th[...] parameters)
|
| 199 |
-
*
|
| 200 |
-
* @param Varien_Object $address
|
| 201 |
-
* @param array $request
|
| 202 |
-
*/
|
| 203 |
-
protected function _importStreetFromAddress(Varien_Object $address, array &$to)
|
| 204 |
-
{
|
| 205 |
-
$keys = func_get_args(); array_shift($keys); array_shift($keys);
|
| 206 |
-
$street = $address->getStreet();
|
| 207 |
-
if (!$keys || !$street || !is_array($street)) {
|
| 208 |
-
return;
|
| 209 |
-
}
|
| 210 |
-
foreach ($keys as $key) {
|
| 211 |
-
if ($value = array_pop($street)) {
|
| 212 |
-
$to[$key] = $value;
|
| 213 |
-
}
|
| 214 |
-
}
|
| 215 |
-
}
|
| 216 |
-
|
| 217 |
-
/**
|
| 218 |
-
* Build query string from request
|
| 219 |
-
*
|
| 220 |
-
* @param array $request
|
| 221 |
-
* @return string
|
| 222 |
-
*/
|
| 223 |
-
protected function _buildQuery($request)
|
| 224 |
-
{
|
| 225 |
-
return http_build_query($request);
|
| 226 |
-
}
|
| 227 |
-
|
| 228 |
-
/**
|
| 229 |
-
* Filter qty in API calls
|
| 230 |
-
*
|
| 231 |
-
* @param float|string|int $value
|
| 232 |
-
* @return string
|
| 233 |
-
*/
|
| 234 |
-
protected function _filterQty($value)
|
| 235 |
-
{
|
| 236 |
-
return intval($value);
|
| 237 |
-
}
|
| 238 |
-
|
| 239 |
-
/**
|
| 240 |
-
* Log debug data to file
|
| 241 |
-
*
|
| 242 |
-
* @param mixed $debugData
|
| 243 |
-
*/
|
| 244 |
-
protected function _debug($debugData)
|
| 245 |
-
{
|
| 246 |
-
if ($this->getDebugFlag()) {
|
| 247 |
-
Mage::log($this->_filterDebugData($debugData), null, $this->_config->getMethodCode() . '.log', true);
|
| 248 |
-
// Mage::getModel('core/log_adapter', 'payment_' . $this->_config->getMethodCode() . '.log')
|
| 249 |
-
// ->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
|
| 250 |
-
// ->log($debugData);
|
| 251 |
-
}
|
| 252 |
-
}
|
| 253 |
-
private function _filterDebugData($debugData)
|
| 254 |
-
{
|
| 255 |
-
if (is_array($debugData) && is_array($this->_debugReplacePrivateDataKeys)) {
|
| 256 |
-
foreach ($debugData as $key => $value) {
|
| 257 |
-
if (in_array($key, $this->_debugReplacePrivateDataKeys)) {
|
| 258 |
-
$debugData[$key] = '****';
|
| 259 |
-
}
|
| 260 |
-
else {
|
| 261 |
-
if (is_array($debugData[$key])) {
|
| 262 |
-
$debugData[$key] = $this->_filterDebugData($debugData[$key]);
|
| 263 |
-
}
|
| 264 |
-
}
|
| 265 |
-
}
|
| 266 |
-
}
|
| 267 |
-
return $debugData;
|
| 268 |
-
}
|
| 269 |
-
|
| 270 |
-
/**
|
| 271 |
-
* Define if debugging is enabled
|
| 272 |
-
*
|
| 273 |
-
* @return bool
|
| 274 |
-
*/
|
| 275 |
-
public function getDebugFlag()
|
| 276 |
-
{
|
| 277 |
-
return $this->_config->debug;
|
| 278 |
-
}
|
| 279 |
-
}
|
| 1 |
+
<?php
|
| 2 |
+
abstract class KuafuSoft_EcomPayment_Model_Api_Abstract extends Varien_Object
|
| 3 |
+
{
|
| 4 |
+
/**
|
| 5 |
+
* Config instance
|
| 6 |
+
* @var KuafuSoft_EcomPayment_Model_Config
|
| 7 |
+
*/
|
| 8 |
+
protected $_config = null;
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Global private to public interface map
|
| 12 |
+
* @var array
|
| 13 |
+
*/
|
| 14 |
+
protected $_globalMap = array();
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Filter callbacks for exporting $this data to API call
|
| 18 |
+
*
|
| 19 |
+
* @var array
|
| 20 |
+
*/
|
| 21 |
+
protected $_exportToRequestFilters = array();
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Filter callbacks for importing API result to $this data
|
| 25 |
+
*
|
| 26 |
+
* @var array
|
| 27 |
+
*/
|
| 28 |
+
protected $_importFromRequestFilters = array();
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Fields that should be replaced in debug with '***'
|
| 32 |
+
*
|
| 33 |
+
* @var array
|
| 34 |
+
*/
|
| 35 |
+
protected $_debugReplacePrivateDataKeys = array();
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* @deprecated after 1.4.1.0
|
| 39 |
+
*
|
| 40 |
+
* @return bool
|
| 41 |
+
*/
|
| 42 |
+
public function getDebug()
|
| 43 |
+
{
|
| 44 |
+
return $this->getDebugFlag();
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Ecom merchant Id getter
|
| 49 |
+
*/
|
| 50 |
+
public function getBusinessAccount()
|
| 51 |
+
{
|
| 52 |
+
return $this->_getDataOrConfig('customer_id');
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Import $this public data to specified object or array
|
| 57 |
+
*
|
| 58 |
+
* @param array|Varien_Object $to
|
| 59 |
+
* @param array $publicMap
|
| 60 |
+
* @return array|Varien_Object
|
| 61 |
+
*/
|
| 62 |
+
public function &import($to, array $publicMap = array())
|
| 63 |
+
{
|
| 64 |
+
return Varien_Object_Mapper::accumulateByMap(array($this, 'getDataUsingMethod'), $to, $publicMap);
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Export $this public data from specified object or array
|
| 69 |
+
*
|
| 70 |
+
* @param array|Varien_Object $from
|
| 71 |
+
* @param array $publicMap
|
| 72 |
+
* @return KuafuSoft_EcomPayment_Model_Api_Abstract
|
| 73 |
+
*/
|
| 74 |
+
public function export($from, array $publicMap = array())
|
| 75 |
+
{
|
| 76 |
+
Varien_Object_Mapper::accumulateByMap($from, array($this, 'setDataUsingMethod'), $publicMap);
|
| 77 |
+
return $this;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Config instance setter
|
| 82 |
+
* @param KuafuSoft_EcomPayment_Model_Config $config
|
| 83 |
+
* @return KuafuSoft_EcomPayment_Model_Api_Abstract
|
| 84 |
+
*/
|
| 85 |
+
public function setConfigObject(KuafuSoft_EcomPayment_Model_Config $config)
|
| 86 |
+
{
|
| 87 |
+
$this->_config = $config;
|
| 88 |
+
return $this;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Current locale code getter
|
| 93 |
+
*
|
| 94 |
+
* @return string
|
| 95 |
+
*/
|
| 96 |
+
public function getLocaleCode()
|
| 97 |
+
{
|
| 98 |
+
return Mage::app()->getLocale()->getLocaleCode();
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Export $this public data to private request array
|
| 103 |
+
*
|
| 104 |
+
* @param array $internalRequestMap
|
| 105 |
+
* @param array $request
|
| 106 |
+
* @return array
|
| 107 |
+
*/
|
| 108 |
+
protected function &_exportToRequest(array $privateRequestMap, array $request = array())
|
| 109 |
+
{
|
| 110 |
+
$map = array();
|
| 111 |
+
foreach ($privateRequestMap as $key) {
|
| 112 |
+
if (isset($this->_globalMap[$key])) {
|
| 113 |
+
$map[$this->_globalMap[$key]] = $key;
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
$result = Varien_Object_Mapper::accumulateByMap(array($this, 'getDataUsingMethod'), $request, $map);
|
| 117 |
+
foreach ($privateRequestMap as $key) {
|
| 118 |
+
if (isset($this->_exportToRequestFilters[$key]) && isset($result[$key])) {
|
| 119 |
+
$callback = $this->_exportToRequestFilters[$key];
|
| 120 |
+
$privateKey = $result[$key];
|
| 121 |
+
$publicKey = $map[$this->_globalMap[$key]];
|
| 122 |
+
$result[$key] = call_user_func(array($this, $callback), $privateKey, $publicKey);
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
return $result;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
/**
|
| 129 |
+
* Import $this public data from a private response array
|
| 130 |
+
*
|
| 131 |
+
* @param array $privateResponseMap
|
| 132 |
+
* @param array $response
|
| 133 |
+
*/
|
| 134 |
+
protected function _importFromResponse(array $privateResponseMap, array $response)
|
| 135 |
+
{
|
| 136 |
+
$map = array();
|
| 137 |
+
foreach ($privateResponseMap as $key) {
|
| 138 |
+
if (isset($this->_globalMap[$key])) {
|
| 139 |
+
$map[$key] = $this->_globalMap[$key];
|
| 140 |
+
}
|
| 141 |
+
if (isset($response[$key]) && isset($this->_importFromRequestFilters[$key])) {
|
| 142 |
+
$callback = $this->_importFromRequestFilters[$key];
|
| 143 |
+
$response[$key] = call_user_func(array($this, $callback), $response[$key], $key, $map[$key]);
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
Varien_Object_Mapper::accumulateByMap($response, array($this, 'setDataUsingMethod'), $map);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Filter amounts in API calls
|
| 151 |
+
* @param float|string $value
|
| 152 |
+
* @return string
|
| 153 |
+
*/
|
| 154 |
+
protected function _filterAmount($value)
|
| 155 |
+
{
|
| 156 |
+
return sprintf('%.2F', $value);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Filter boolean values in API calls
|
| 161 |
+
*
|
| 162 |
+
* @param mixed $value
|
| 163 |
+
* @return string
|
| 164 |
+
*/
|
| 165 |
+
protected function _filterBool($value)
|
| 166 |
+
{
|
| 167 |
+
return ($value) ? 'true' : 'false';
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
/**
|
| 171 |
+
* Filter int values in API calls
|
| 172 |
+
*
|
| 173 |
+
* @param mixed $value
|
| 174 |
+
* @return int
|
| 175 |
+
*/
|
| 176 |
+
protected function _filterInt($value)
|
| 177 |
+
{
|
| 178 |
+
return (int)$value;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* Unified getter that looks in data or falls back to config
|
| 183 |
+
*
|
| 184 |
+
* @param string $key
|
| 185 |
+
* @param mixed $default
|
| 186 |
+
* @return mixed
|
| 187 |
+
*/
|
| 188 |
+
protected function _getDataOrConfig($key, $default = null)
|
| 189 |
+
{
|
| 190 |
+
if ($this->hasData($key)) {
|
| 191 |
+
return $this->getData($key);
|
| 192 |
+
}
|
| 193 |
+
return $this->_config->$key ? $this->_config->$key : $default;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* Street address workaround: divides address lines into parts by specified keys
|
| 198 |
+
* (keys should go as 3rd, 4th[...] parameters)
|
| 199 |
+
*
|
| 200 |
+
* @param Varien_Object $address
|
| 201 |
+
* @param array $request
|
| 202 |
+
*/
|
| 203 |
+
protected function _importStreetFromAddress(Varien_Object $address, array &$to)
|
| 204 |
+
{
|
| 205 |
+
$keys = func_get_args(); array_shift($keys); array_shift($keys);
|
| 206 |
+
$street = $address->getStreet();
|
| 207 |
+
if (!$keys || !$street || !is_array($street)) {
|
| 208 |
+
return;
|
| 209 |
+
}
|
| 210 |
+
foreach ($keys as $key) {
|
| 211 |
+
if ($value = array_pop($street)) {
|
| 212 |
+
$to[$key] = $value;
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* Build query string from request
|
| 219 |
+
*
|
| 220 |
+
* @param array $request
|
| 221 |
+
* @return string
|
| 222 |
+
*/
|
| 223 |
+
protected function _buildQuery($request)
|
| 224 |
+
{
|
| 225 |
+
return http_build_query($request);
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
/**
|
| 229 |
+
* Filter qty in API calls
|
| 230 |
+
*
|
| 231 |
+
* @param float|string|int $value
|
| 232 |
+
* @return string
|
| 233 |
+
*/
|
| 234 |
+
protected function _filterQty($value)
|
| 235 |
+
{
|
| 236 |
+
return intval($value);
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
/**
|
| 240 |
+
* Log debug data to file
|
| 241 |
+
*
|
| 242 |
+
* @param mixed $debugData
|
| 243 |
+
*/
|
| 244 |
+
protected function _debug($debugData)
|
| 245 |
+
{
|
| 246 |
+
if ($this->getDebugFlag()) {
|
| 247 |
+
Mage::log($this->_filterDebugData($debugData), null, $this->_config->getMethodCode() . '.log', true);
|
| 248 |
+
// Mage::getModel('core/log_adapter', 'payment_' . $this->_config->getMethodCode() . '.log')
|
| 249 |
+
// ->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
|
| 250 |
+
// ->log($debugData);
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
private function _filterDebugData($debugData)
|
| 254 |
+
{
|
| 255 |
+
if (is_array($debugData) && is_array($this->_debugReplacePrivateDataKeys)) {
|
| 256 |
+
foreach ($debugData as $key => $value) {
|
| 257 |
+
if (in_array($key, $this->_debugReplacePrivateDataKeys)) {
|
| 258 |
+
$debugData[$key] = '****';
|
| 259 |
+
}
|
| 260 |
+
else {
|
| 261 |
+
if (is_array($debugData[$key])) {
|
| 262 |
+
$debugData[$key] = $this->_filterDebugData($debugData[$key]);
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
return $debugData;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
/**
|
| 271 |
+
* Define if debugging is enabled
|
| 272 |
+
*
|
| 273 |
+
* @return bool
|
| 274 |
+
*/
|
| 275 |
+
public function getDebugFlag()
|
| 276 |
+
{
|
| 277 |
+
return $this->_config->debug;
|
| 278 |
+
}
|
| 279 |
+
}
|
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', '
|
| 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 |
-
|
| 52 |
-
*
|
| 53 |
-
*
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
$this->
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
*
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
*
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
*
|
| 85 |
-
*
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
*
|
| 95 |
-
*
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
$code
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 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', '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 |
+
|
app/code/local/KuafuSoft/EcomPayment/Model/Config.php
CHANGED
|
@@ -1,343 +1,343 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class KuafuSoft_EcomPayment_Model_Config
|
| 3 |
-
{
|
| 4 |
-
const METHOD_STANDARD = 'ecompayment_standard';
|
| 5 |
-
|
| 6 |
-
/**
|
| 7 |
-
* Payment actions
|
| 8 |
-
* @var string
|
| 9 |
-
*/
|
| 10 |
-
const PAYMENT_ACTION_SALE = 'Sale';
|
| 11 |
-
const PAYMENT_ACTION_ORDER = 'Order';
|
| 12 |
-
const PAYMENT_ACTION_AUTH = 'Authorization';
|
| 13 |
-
|
| 14 |
-
/**
|
| 15 |
-
* Current payment method code
|
| 16 |
-
* @var string
|
| 17 |
-
*/
|
| 18 |
-
protected $_methodCode = null;
|
| 19 |
-
|
| 20 |
-
/**
|
| 21 |
-
* Current store id
|
| 22 |
-
* @var int
|
| 23 |
-
*/
|
| 24 |
-
protected $_storeId = null;
|
| 25 |
-
|
| 26 |
-
protected $_supportedCurrencyCodes = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN',
|
| 27 |
-
'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD');
|
| 28 |
-
|
| 29 |
-
protected $_supportedCountryCodes = array(
|
| 30 |
-
'AE','AR','AT','AU','BE','BG','BR','CA','CH','CL','CR','CY','CZ','DE','DK','DO','EC','EE','ES','FI','FR','GB',
|
| 31 |
-
'GF','GI','GP','GR','HK','HU','ID','IE','IL','IN','IS','IT','JM','JP','KR','LI','LT','LU','LV','MQ','MT','MX',
|
| 32 |
-
'MY','NL','NO','NZ','PH','PL','PT','RE','RO','SE','SG','SI','SK','SM','TH','TR','TW','US','UY','VE','VN','ZA');
|
| 33 |
-
|
| 34 |
-
protected $_supportedBuyerCountryCodes = array(
|
| 35 |
-
'AF ', 'AX ', 'AL ', 'DZ ', 'AS ', 'AD ', 'AO ', 'AI ', 'AQ ', 'AG ', 'AR ', 'AM ', 'AW ', 'AU ', 'AT ', 'AZ ',
|
| 36 |
-
'BS ', 'BH ', 'BD ', 'BB ', 'BY ', 'BE ', 'BZ ', 'BJ ', 'BM ', 'BT ', 'BO ', 'BA ', 'BW ', 'BV ', 'BR ', 'IO ',
|
| 37 |
-
'BN ', 'BG ', 'BF ', 'BI ', 'KH ', 'CM ', 'CA ', 'CV ', 'KY ', 'CF ', 'TD ', 'CL ', 'CN ', 'CX ', 'CC ', 'CO ',
|
| 38 |
-
'KM ', 'CG ', 'CD ', 'CK ', 'CR ', 'CI ', 'HR ', 'CU ', 'CY ', 'CZ ', 'DK ', 'DJ ', 'DM ', 'DO ', 'EC ', 'EG ',
|
| 39 |
-
'SV ', 'GQ ', 'ER ', 'EE ', 'ET ', 'FK ', 'FO ', 'FJ ', 'FI ', 'FR ', 'GF ', 'PF ', 'TF ', 'GA ', 'GM ', 'GE ',
|
| 40 |
-
'DE ', 'GH ', 'GI ', 'GR ', 'GL ', 'GD ', 'GP ', 'GU ', 'GT ', 'GG ', 'GN ', 'GW ', 'GY ', 'HT ', 'HM ', 'VA ',
|
| 41 |
-
'HN ', 'HK ', 'HU ', 'IS ', 'IN ', 'ID ', 'IR ', 'IQ ', 'IE ', 'IM ', 'IL ', 'IT ', 'JM ', 'JP ', 'JE ', 'JO ',
|
| 42 |
-
'KZ ', 'KE ', 'KI ', 'KP ', 'KR ', 'KW ', 'KG ', 'LA ', 'LV ', 'LB ', 'LS ', 'LR ', 'LY ', 'LI ', 'LT ', 'LU ',
|
| 43 |
-
'MO ', 'MK ', 'MG ', 'MW ', 'MY ', 'MV ', 'ML ', 'MT ', 'MH ', 'MQ ', 'MR ', 'MU ', 'YT ', 'MX ', 'FM ', 'MD ',
|
| 44 |
-
'MC ', 'MN ', 'MS ', 'MA ', 'MZ ', 'MM ', 'NA ', 'NR ', 'NP ', 'NL ', 'AN ', 'NC ', 'NZ ', 'NI ', 'NE ', 'NG ',
|
| 45 |
-
'NU ', 'NF ', 'MP ', 'NO ', 'OM ', 'PK ', 'PW ', 'PS ', 'PA ', 'PG ', 'PY ', 'PE ', 'PH ', 'PN ', 'PL ', 'PT ',
|
| 46 |
-
'PR ', 'QA ', 'RE ', 'RO ', 'RU ', 'RW ', 'SH ', 'KN ', 'LC ', 'PM ', 'VC ', 'WS ', 'SM ', 'ST ', 'SA ', 'SN ',
|
| 47 |
-
'CS ', 'SC ', 'SL ', 'SG ', 'SK ', 'SI ', 'SB ', 'SO ', 'ZA ', 'GS ', 'ES ', 'LK ', 'SD ', 'SR ', 'SJ ', 'SZ ',
|
| 48 |
-
'SE ', 'CH ', 'SY ', 'TW ', 'TJ ', 'TZ ', 'TH ', 'TL ', 'TG ', 'TK ', 'TO ', 'TT ', 'TN ', 'TR ', 'TM ', 'TC ',
|
| 49 |
-
'TV ', 'UG ', 'UA ', 'AE ', 'GB ', 'US ', 'UM ', 'UY ', 'UZ ', 'VU ', 'VE ', 'VN ', 'VG ', 'VI ', 'WF ', 'EH ',
|
| 50 |
-
'YE ', 'ZM ', 'ZW'
|
| 51 |
-
);
|
| 52 |
-
|
| 53 |
-
/**
|
| 54 |
-
* Set method and store id, if specified
|
| 55 |
-
* @param array $params
|
| 56 |
-
*/
|
| 57 |
-
public function __construct($params = array())
|
| 58 |
-
{
|
| 59 |
-
if ($params) {
|
| 60 |
-
$method = array_shift($params);
|
| 61 |
-
$this->setMethod($method);
|
| 62 |
-
if ($params) {
|
| 63 |
-
$storeId = array_shift($params);
|
| 64 |
-
$this->setStoreId($storeId);
|
| 65 |
-
}
|
| 66 |
-
}
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
/**
|
| 70 |
-
* Method code setter
|
| 71 |
-
*
|
| 72 |
-
* @param string|Mage_Payment_Model_Method_Abstract $method
|
| 73 |
-
* @return KuafuSoft_EcomPayment_Model_Config
|
| 74 |
-
*/
|
| 75 |
-
public function setMethod($method)
|
| 76 |
-
{
|
| 77 |
-
if ($method instanceof Mage_Payment_Model_Method_Abstract) {
|
| 78 |
-
$this->_methodCode = $method->getCode();
|
| 79 |
-
} elseif (is_string($method)) {
|
| 80 |
-
$this->_methodCode = $method;
|
| 81 |
-
}
|
| 82 |
-
return $this;
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
/**
|
| 86 |
-
* Payment method instance code getter
|
| 87 |
-
* @return string
|
| 88 |
-
*/
|
| 89 |
-
public function getMethodCode()
|
| 90 |
-
{
|
| 91 |
-
return $this->_methodCode;
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
/**
|
| 95 |
-
* Store ID setter
|
| 96 |
-
* @param int $storeId
|
| 97 |
-
* @return KuafuSoft_EcomPayment_Model_Config
|
| 98 |
-
*/
|
| 99 |
-
public function setStoreId($storeId)
|
| 100 |
-
{
|
| 101 |
-
$this->_storeId = (int)$storeId;
|
| 102 |
-
return $this;
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
/**
|
| 106 |
-
* Check whether method active in configuration and supported for merchant country or not
|
| 107 |
-
*
|
| 108 |
-
* @param string $method Method code
|
| 109 |
-
* @return bool
|
| 110 |
-
*/
|
| 111 |
-
public function isMethodActive($method)
|
| 112 |
-
{
|
| 113 |
-
return Mage::getStoreConfigFlag("payment/{$method}/active", $this->_storeId);
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
/**
|
| 117 |
-
* Config field magic getter
|
| 118 |
-
* The specified key can be either in camelCase or under_score format
|
| 119 |
-
* Tries to map specified value according to set payment method code, into the configuration value
|
| 120 |
-
* Sets the values into public class parameters, to avoid redundant calls of this method
|
| 121 |
-
*
|
| 122 |
-
* @param string $key
|
| 123 |
-
* @return string|null
|
| 124 |
-
*/
|
| 125 |
-
public function __get($key)
|
| 126 |
-
{
|
| 127 |
-
$underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key));
|
| 128 |
-
$value = Mage::getStoreConfig($this->_getSpecificConfigPath($underscored), $this->_storeId);
|
| 129 |
-
$value = $this->_prepareValue($underscored, $value);
|
| 130 |
-
$this->$key = $value;
|
| 131 |
-
$this->$underscored = $value;
|
| 132 |
-
return $value;
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
/**
|
| 136 |
-
* Perform additional config value preparation and return new value if needed
|
| 137 |
-
*
|
| 138 |
-
* @param string $key Underscored key
|
| 139 |
-
* @param string $value Old value
|
| 140 |
-
* @return string Modified value or old value
|
| 141 |
-
*/
|
| 142 |
-
protected function _prepareValue($key, $value)
|
| 143 |
-
{
|
| 144 |
-
if ($key == 'payment_action'
|
| 145 |
-
&& $value != self::PAYMENT_ACTION_SALE
|
| 146 |
-
&& $this->_methodCode == self::METHOD_STANDARD)
|
| 147 |
-
{
|
| 148 |
-
return self::PAYMENT_ACTION_SALE;
|
| 149 |
-
}
|
| 150 |
-
return $value;
|
| 151 |
-
}
|
| 152 |
-
|
| 153 |
-
/**
|
| 154 |
-
* Return merchant country codes supported by Ecompayment
|
| 155 |
-
*
|
| 156 |
-
* @return array
|
| 157 |
-
*/
|
| 158 |
-
public function getSupportedMerchantCountryCodes()
|
| 159 |
-
{
|
| 160 |
-
return $this->_supportedCountryCodes;
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
/**
|
| 164 |
-
* Return buyer country codes supported by Ecompayment
|
| 165 |
-
*
|
| 166 |
-
* @return array
|
| 167 |
-
*/
|
| 168 |
-
public function getSupportedBuyerCountryCodes()
|
| 169 |
-
{
|
| 170 |
-
return $this->_supportedBuyerCountryCodes;
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
-
/**
|
| 174 |
-
* Return merchant country code, use default country if it not specified in General settings
|
| 175 |
-
*
|
| 176 |
-
* @return string
|
| 177 |
-
*/
|
| 178 |
-
public function getMerchantCountry()
|
| 179 |
-
{
|
| 180 |
-
$countryCode = Mage::getStoreConfig($this->_mapGeneralFieldset('merchant_country'), $this->_storeId);
|
| 181 |
-
if (!$countryCode) {
|
| 182 |
-
$countryCode = Mage::getStoreConfig('general/country/default', $this->_storeId);
|
| 183 |
-
}
|
| 184 |
-
return $countryCode;
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
/**
|
| 188 |
-
* Ecompayment web URL generic getter
|
| 189 |
-
*
|
| 190 |
-
* @param array $params
|
| 191 |
-
* @return string
|
| 192 |
-
*/
|
| 193 |
-
public function getPayPageUrl(array $params = array())
|
| 194 |
-
{
|
| 195 |
-
return sprintf('https://%ssecure.totalwebsecure.com/paypage/clear.asp%s',
|
| 196 |
-
$this->test ? 'test' : '',
|
| 197 |
-
$params ? '?' . http_build_query($params) : ''
|
| 198 |
-
);
|
| 199 |
-
}
|
| 200 |
-
|
| 201 |
-
public function getConfirmPageUrl(array $params = array())
|
| 202 |
-
{
|
| 203 |
-
return sprintf('https://%ssecure.totalwebsecure.com/paypage/confirm.asp%s',
|
| 204 |
-
$this->test ? 'test' : '',
|
| 205 |
-
$params ? '?' . http_build_query($params) : ''
|
| 206 |
-
);
|
| 207 |
-
}
|
| 208 |
-
|
| 209 |
-
/**
|
| 210 |
-
* Mapper from Ecom-specific payment actions to Magento payment actions
|
| 211 |
-
* @return string|null
|
| 212 |
-
*/
|
| 213 |
-
public function getPaymentAction()
|
| 214 |
-
{
|
| 215 |
-
switch ($this->paymentAction) {
|
| 216 |
-
case self::PAYMENT_ACTION_AUTH:
|
| 217 |
-
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
|
| 218 |
-
case self::PAYMENT_ACTION_SALE:
|
| 219 |
-
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE;
|
| 220 |
-
case self::PAYMENT_ACTION_ORDER:
|
| 221 |
-
return;
|
| 222 |
-
}
|
| 223 |
-
}
|
| 224 |
-
|
| 225 |
-
/**
|
| 226 |
-
* Check whether the specified payment method is a CC-based one
|
| 227 |
-
*
|
| 228 |
-
* @param string $code
|
| 229 |
-
* @return bool
|
| 230 |
-
*/
|
| 231 |
-
public static function getIsCreditCardMethod($code)
|
| 232 |
-
{
|
| 233 |
-
return false;
|
| 234 |
-
}
|
| 235 |
-
|
| 236 |
-
/**
|
| 237 |
-
* Check whether specified currency code is supported
|
| 238 |
-
* @param string $code
|
| 239 |
-
* @return bool
|
| 240 |
-
*/
|
| 241 |
-
public function isCurrencyCodeSupported($code)
|
| 242 |
-
{
|
| 243 |
-
return in_array($code, $this->_supportedCurrencyCodes);
|
| 244 |
-
}
|
| 245 |
-
|
| 246 |
-
/**
|
| 247 |
-
* Check whether specified locale code is supported. Fallback to en_US
|
| 248 |
-
*
|
| 249 |
-
* @param string $localeCode
|
| 250 |
-
* @return string
|
| 251 |
-
*/
|
| 252 |
-
protected function _getSupportedLocaleCode($localeCode = null)
|
| 253 |
-
{
|
| 254 |
-
if (!$localeCode || !in_array($localeCode, $this->_supportedImageLocales)) {
|
| 255 |
-
return 'en_US';
|
| 256 |
-
}
|
| 257 |
-
return $localeCode;
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
-
/**
|
| 261 |
-
* Map any supported payment method into a config path by specified field name
|
| 262 |
-
* @param string $fieldName
|
| 263 |
-
* @return string|null
|
| 264 |
-
*/
|
| 265 |
-
protected function _getSpecificConfigPath($fieldName)
|
| 266 |
-
{
|
| 267 |
-
$path = null;
|
| 268 |
-
switch ($this->_methodCode) {
|
| 269 |
-
case self::METHOD_STANDARD:
|
| 270 |
-
$path = $this->_mapStandardFieldset($fieldName);
|
| 271 |
-
break;
|
| 272 |
-
}
|
| 273 |
-
|
| 274 |
-
if ($path === null) {
|
| 275 |
-
$path = $this->_mapGeneralFieldset($fieldName);
|
| 276 |
-
}
|
| 277 |
-
return $path;
|
| 278 |
-
}
|
| 279 |
-
|
| 280 |
-
/**
|
| 281 |
-
* Map Ecom Standard config fields
|
| 282 |
-
*
|
| 283 |
-
* @param string $fieldName
|
| 284 |
-
* @return string|null
|
| 285 |
-
*/
|
| 286 |
-
protected function _mapStandardFieldset($fieldName)
|
| 287 |
-
{
|
| 288 |
-
switch ($fieldName)
|
| 289 |
-
{
|
| 290 |
-
case 'line_items_summary':
|
| 291 |
-
case 'sandbox_flag':
|
| 292 |
-
case 'test':
|
| 293 |
-
return 'payment/' . self::METHOD_STANDARD . "/{$fieldName}";
|
| 294 |
-
default:
|
| 295 |
-
return $this->_mapMethodFieldset($fieldName);
|
| 296 |
-
}
|
| 297 |
-
}
|
| 298 |
-
|
| 299 |
-
/**
|
| 300 |
-
* Map Ecom General Settings
|
| 301 |
-
*
|
| 302 |
-
* @param string $fieldName
|
| 303 |
-
* @return string|null
|
| 304 |
-
*/
|
| 305 |
-
protected function _mapGeneralFieldset($fieldName)
|
| 306 |
-
{
|
| 307 |
-
switch ($fieldName)
|
| 308 |
-
{
|
| 309 |
-
case 'business_account':
|
| 310 |
-
case 'merchant_country':
|
| 311 |
-
return "ecompayment/general/{$fieldName}";
|
| 312 |
-
default:
|
| 313 |
-
return null;
|
| 314 |
-
}
|
| 315 |
-
}
|
| 316 |
-
|
| 317 |
-
/**
|
| 318 |
-
* Map Ecom General Settings
|
| 319 |
-
*
|
| 320 |
-
* @param string $fieldName
|
| 321 |
-
* @return string|null
|
| 322 |
-
*/
|
| 323 |
-
protected function _mapMethodFieldset($fieldName)
|
| 324 |
-
{
|
| 325 |
-
if (!$this->_methodCode) {
|
| 326 |
-
return null;
|
| 327 |
-
}
|
| 328 |
-
switch ($fieldName)
|
| 329 |
-
{
|
| 330 |
-
case 'customer_id':
|
| 331 |
-
case 'active':
|
| 332 |
-
case 'title':
|
| 333 |
-
case 'payment_action':
|
| 334 |
-
case 'allowspecific':
|
| 335 |
-
case 'specificcountry':
|
| 336 |
-
case 'debug':
|
| 337 |
-
return "payment/{$this->_methodCode}/{$fieldName}";
|
| 338 |
-
default:
|
| 339 |
-
return null;
|
| 340 |
-
}
|
| 341 |
-
}
|
| 342 |
-
}
|
| 343 |
-
|
| 1 |
+
<?php
|
| 2 |
+
class KuafuSoft_EcomPayment_Model_Config
|
| 3 |
+
{
|
| 4 |
+
const METHOD_STANDARD = 'ecompayment_standard';
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Payment actions
|
| 8 |
+
* @var string
|
| 9 |
+
*/
|
| 10 |
+
const PAYMENT_ACTION_SALE = 'Sale';
|
| 11 |
+
const PAYMENT_ACTION_ORDER = 'Order';
|
| 12 |
+
const PAYMENT_ACTION_AUTH = 'Authorization';
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Current payment method code
|
| 16 |
+
* @var string
|
| 17 |
+
*/
|
| 18 |
+
protected $_methodCode = null;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Current store id
|
| 22 |
+
* @var int
|
| 23 |
+
*/
|
| 24 |
+
protected $_storeId = null;
|
| 25 |
+
|
| 26 |
+
protected $_supportedCurrencyCodes = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN',
|
| 27 |
+
'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD');
|
| 28 |
+
|
| 29 |
+
protected $_supportedCountryCodes = array(
|
| 30 |
+
'AE','AR','AT','AU','BE','BG','BR','CA','CH','CL','CR','CY','CZ','DE','DK','DO','EC','EE','ES','FI','FR','GB',
|
| 31 |
+
'GF','GI','GP','GR','HK','HU','ID','IE','IL','IN','IS','IT','JM','JP','KR','LI','LT','LU','LV','MQ','MT','MX',
|
| 32 |
+
'MY','NL','NO','NZ','PH','PL','PT','RE','RO','SE','SG','SI','SK','SM','TH','TR','TW','US','UY','VE','VN','ZA');
|
| 33 |
+
|
| 34 |
+
protected $_supportedBuyerCountryCodes = array(
|
| 35 |
+
'AF ', 'AX ', 'AL ', 'DZ ', 'AS ', 'AD ', 'AO ', 'AI ', 'AQ ', 'AG ', 'AR ', 'AM ', 'AW ', 'AU ', 'AT ', 'AZ ',
|
| 36 |
+
'BS ', 'BH ', 'BD ', 'BB ', 'BY ', 'BE ', 'BZ ', 'BJ ', 'BM ', 'BT ', 'BO ', 'BA ', 'BW ', 'BV ', 'BR ', 'IO ',
|
| 37 |
+
'BN ', 'BG ', 'BF ', 'BI ', 'KH ', 'CM ', 'CA ', 'CV ', 'KY ', 'CF ', 'TD ', 'CL ', 'CN ', 'CX ', 'CC ', 'CO ',
|
| 38 |
+
'KM ', 'CG ', 'CD ', 'CK ', 'CR ', 'CI ', 'HR ', 'CU ', 'CY ', 'CZ ', 'DK ', 'DJ ', 'DM ', 'DO ', 'EC ', 'EG ',
|
| 39 |
+
'SV ', 'GQ ', 'ER ', 'EE ', 'ET ', 'FK ', 'FO ', 'FJ ', 'FI ', 'FR ', 'GF ', 'PF ', 'TF ', 'GA ', 'GM ', 'GE ',
|
| 40 |
+
'DE ', 'GH ', 'GI ', 'GR ', 'GL ', 'GD ', 'GP ', 'GU ', 'GT ', 'GG ', 'GN ', 'GW ', 'GY ', 'HT ', 'HM ', 'VA ',
|
| 41 |
+
'HN ', 'HK ', 'HU ', 'IS ', 'IN ', 'ID ', 'IR ', 'IQ ', 'IE ', 'IM ', 'IL ', 'IT ', 'JM ', 'JP ', 'JE ', 'JO ',
|
| 42 |
+
'KZ ', 'KE ', 'KI ', 'KP ', 'KR ', 'KW ', 'KG ', 'LA ', 'LV ', 'LB ', 'LS ', 'LR ', 'LY ', 'LI ', 'LT ', 'LU ',
|
| 43 |
+
'MO ', 'MK ', 'MG ', 'MW ', 'MY ', 'MV ', 'ML ', 'MT ', 'MH ', 'MQ ', 'MR ', 'MU ', 'YT ', 'MX ', 'FM ', 'MD ',
|
| 44 |
+
'MC ', 'MN ', 'MS ', 'MA ', 'MZ ', 'MM ', 'NA ', 'NR ', 'NP ', 'NL ', 'AN ', 'NC ', 'NZ ', 'NI ', 'NE ', 'NG ',
|
| 45 |
+
'NU ', 'NF ', 'MP ', 'NO ', 'OM ', 'PK ', 'PW ', 'PS ', 'PA ', 'PG ', 'PY ', 'PE ', 'PH ', 'PN ', 'PL ', 'PT ',
|
| 46 |
+
'PR ', 'QA ', 'RE ', 'RO ', 'RU ', 'RW ', 'SH ', 'KN ', 'LC ', 'PM ', 'VC ', 'WS ', 'SM ', 'ST ', 'SA ', 'SN ',
|
| 47 |
+
'CS ', 'SC ', 'SL ', 'SG ', 'SK ', 'SI ', 'SB ', 'SO ', 'ZA ', 'GS ', 'ES ', 'LK ', 'SD ', 'SR ', 'SJ ', 'SZ ',
|
| 48 |
+
'SE ', 'CH ', 'SY ', 'TW ', 'TJ ', 'TZ ', 'TH ', 'TL ', 'TG ', 'TK ', 'TO ', 'TT ', 'TN ', 'TR ', 'TM ', 'TC ',
|
| 49 |
+
'TV ', 'UG ', 'UA ', 'AE ', 'GB ', 'US ', 'UM ', 'UY ', 'UZ ', 'VU ', 'VE ', 'VN ', 'VG ', 'VI ', 'WF ', 'EH ',
|
| 50 |
+
'YE ', 'ZM ', 'ZW'
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Set method and store id, if specified
|
| 55 |
+
* @param array $params
|
| 56 |
+
*/
|
| 57 |
+
public function __construct($params = array())
|
| 58 |
+
{
|
| 59 |
+
if ($params) {
|
| 60 |
+
$method = array_shift($params);
|
| 61 |
+
$this->setMethod($method);
|
| 62 |
+
if ($params) {
|
| 63 |
+
$storeId = array_shift($params);
|
| 64 |
+
$this->setStoreId($storeId);
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Method code setter
|
| 71 |
+
*
|
| 72 |
+
* @param string|Mage_Payment_Model_Method_Abstract $method
|
| 73 |
+
* @return KuafuSoft_EcomPayment_Model_Config
|
| 74 |
+
*/
|
| 75 |
+
public function setMethod($method)
|
| 76 |
+
{
|
| 77 |
+
if ($method instanceof Mage_Payment_Model_Method_Abstract) {
|
| 78 |
+
$this->_methodCode = $method->getCode();
|
| 79 |
+
} elseif (is_string($method)) {
|
| 80 |
+
$this->_methodCode = $method;
|
| 81 |
+
}
|
| 82 |
+
return $this;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Payment method instance code getter
|
| 87 |
+
* @return string
|
| 88 |
+
*/
|
| 89 |
+
public function getMethodCode()
|
| 90 |
+
{
|
| 91 |
+
return $this->_methodCode;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* Store ID setter
|
| 96 |
+
* @param int $storeId
|
| 97 |
+
* @return KuafuSoft_EcomPayment_Model_Config
|
| 98 |
+
*/
|
| 99 |
+
public function setStoreId($storeId)
|
| 100 |
+
{
|
| 101 |
+
$this->_storeId = (int)$storeId;
|
| 102 |
+
return $this;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Check whether method active in configuration and supported for merchant country or not
|
| 107 |
+
*
|
| 108 |
+
* @param string $method Method code
|
| 109 |
+
* @return bool
|
| 110 |
+
*/
|
| 111 |
+
public function isMethodActive($method)
|
| 112 |
+
{
|
| 113 |
+
return Mage::getStoreConfigFlag("payment/{$method}/active", $this->_storeId);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* Config field magic getter
|
| 118 |
+
* The specified key can be either in camelCase or under_score format
|
| 119 |
+
* Tries to map specified value according to set payment method code, into the configuration value
|
| 120 |
+
* Sets the values into public class parameters, to avoid redundant calls of this method
|
| 121 |
+
*
|
| 122 |
+
* @param string $key
|
| 123 |
+
* @return string|null
|
| 124 |
+
*/
|
| 125 |
+
public function __get($key)
|
| 126 |
+
{
|
| 127 |
+
$underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key));
|
| 128 |
+
$value = Mage::getStoreConfig($this->_getSpecificConfigPath($underscored), $this->_storeId);
|
| 129 |
+
$value = $this->_prepareValue($underscored, $value);
|
| 130 |
+
$this->$key = $value;
|
| 131 |
+
$this->$underscored = $value;
|
| 132 |
+
return $value;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
* Perform additional config value preparation and return new value if needed
|
| 137 |
+
*
|
| 138 |
+
* @param string $key Underscored key
|
| 139 |
+
* @param string $value Old value
|
| 140 |
+
* @return string Modified value or old value
|
| 141 |
+
*/
|
| 142 |
+
protected function _prepareValue($key, $value)
|
| 143 |
+
{
|
| 144 |
+
if ($key == 'payment_action'
|
| 145 |
+
&& $value != self::PAYMENT_ACTION_SALE
|
| 146 |
+
&& $this->_methodCode == self::METHOD_STANDARD)
|
| 147 |
+
{
|
| 148 |
+
return self::PAYMENT_ACTION_SALE;
|
| 149 |
+
}
|
| 150 |
+
return $value;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
/**
|
| 154 |
+
* Return merchant country codes supported by Ecompayment
|
| 155 |
+
*
|
| 156 |
+
* @return array
|
| 157 |
+
*/
|
| 158 |
+
public function getSupportedMerchantCountryCodes()
|
| 159 |
+
{
|
| 160 |
+
return $this->_supportedCountryCodes;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Return buyer country codes supported by Ecompayment
|
| 165 |
+
*
|
| 166 |
+
* @return array
|
| 167 |
+
*/
|
| 168 |
+
public function getSupportedBuyerCountryCodes()
|
| 169 |
+
{
|
| 170 |
+
return $this->_supportedBuyerCountryCodes;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
/**
|
| 174 |
+
* Return merchant country code, use default country if it not specified in General settings
|
| 175 |
+
*
|
| 176 |
+
* @return string
|
| 177 |
+
*/
|
| 178 |
+
public function getMerchantCountry()
|
| 179 |
+
{
|
| 180 |
+
$countryCode = Mage::getStoreConfig($this->_mapGeneralFieldset('merchant_country'), $this->_storeId);
|
| 181 |
+
if (!$countryCode) {
|
| 182 |
+
$countryCode = Mage::getStoreConfig('general/country/default', $this->_storeId);
|
| 183 |
+
}
|
| 184 |
+
return $countryCode;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
/**
|
| 188 |
+
* Ecompayment web URL generic getter
|
| 189 |
+
*
|
| 190 |
+
* @param array $params
|
| 191 |
+
* @return string
|
| 192 |
+
*/
|
| 193 |
+
public function getPayPageUrl(array $params = array())
|
| 194 |
+
{
|
| 195 |
+
return sprintf('https://%ssecure.totalwebsecure.com/paypage/clear.asp%s',
|
| 196 |
+
$this->test ? 'test' : '',
|
| 197 |
+
$params ? '?' . http_build_query($params) : ''
|
| 198 |
+
);
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
public function getConfirmPageUrl(array $params = array())
|
| 202 |
+
{
|
| 203 |
+
return sprintf('https://%ssecure.totalwebsecure.com/paypage/confirm.asp%s',
|
| 204 |
+
$this->test ? 'test' : '',
|
| 205 |
+
$params ? '?' . http_build_query($params) : ''
|
| 206 |
+
);
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
/**
|
| 210 |
+
* Mapper from Ecom-specific payment actions to Magento payment actions
|
| 211 |
+
* @return string|null
|
| 212 |
+
*/
|
| 213 |
+
public function getPaymentAction()
|
| 214 |
+
{
|
| 215 |
+
switch ($this->paymentAction) {
|
| 216 |
+
case self::PAYMENT_ACTION_AUTH:
|
| 217 |
+
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
|
| 218 |
+
case self::PAYMENT_ACTION_SALE:
|
| 219 |
+
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE;
|
| 220 |
+
case self::PAYMENT_ACTION_ORDER:
|
| 221 |
+
return;
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
/**
|
| 226 |
+
* Check whether the specified payment method is a CC-based one
|
| 227 |
+
*
|
| 228 |
+
* @param string $code
|
| 229 |
+
* @return bool
|
| 230 |
+
*/
|
| 231 |
+
public static function getIsCreditCardMethod($code)
|
| 232 |
+
{
|
| 233 |
+
return false;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/**
|
| 237 |
+
* Check whether specified currency code is supported
|
| 238 |
+
* @param string $code
|
| 239 |
+
* @return bool
|
| 240 |
+
*/
|
| 241 |
+
public function isCurrencyCodeSupported($code)
|
| 242 |
+
{
|
| 243 |
+
return in_array($code, $this->_supportedCurrencyCodes);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/**
|
| 247 |
+
* Check whether specified locale code is supported. Fallback to en_US
|
| 248 |
+
*
|
| 249 |
+
* @param string $localeCode
|
| 250 |
+
* @return string
|
| 251 |
+
*/
|
| 252 |
+
protected function _getSupportedLocaleCode($localeCode = null)
|
| 253 |
+
{
|
| 254 |
+
if (!$localeCode || !in_array($localeCode, $this->_supportedImageLocales)) {
|
| 255 |
+
return 'en_US';
|
| 256 |
+
}
|
| 257 |
+
return $localeCode;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/**
|
| 261 |
+
* Map any supported payment method into a config path by specified field name
|
| 262 |
+
* @param string $fieldName
|
| 263 |
+
* @return string|null
|
| 264 |
+
*/
|
| 265 |
+
protected function _getSpecificConfigPath($fieldName)
|
| 266 |
+
{
|
| 267 |
+
$path = null;
|
| 268 |
+
switch ($this->_methodCode) {
|
| 269 |
+
case self::METHOD_STANDARD:
|
| 270 |
+
$path = $this->_mapStandardFieldset($fieldName);
|
| 271 |
+
break;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
if ($path === null) {
|
| 275 |
+
$path = $this->_mapGeneralFieldset($fieldName);
|
| 276 |
+
}
|
| 277 |
+
return $path;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
/**
|
| 281 |
+
* Map Ecom Standard config fields
|
| 282 |
+
*
|
| 283 |
+
* @param string $fieldName
|
| 284 |
+
* @return string|null
|
| 285 |
+
*/
|
| 286 |
+
protected function _mapStandardFieldset($fieldName)
|
| 287 |
+
{
|
| 288 |
+
switch ($fieldName)
|
| 289 |
+
{
|
| 290 |
+
case 'line_items_summary':
|
| 291 |
+
case 'sandbox_flag':
|
| 292 |
+
case 'test':
|
| 293 |
+
return 'payment/' . self::METHOD_STANDARD . "/{$fieldName}";
|
| 294 |
+
default:
|
| 295 |
+
return $this->_mapMethodFieldset($fieldName);
|
| 296 |
+
}
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
/**
|
| 300 |
+
* Map Ecom General Settings
|
| 301 |
+
*
|
| 302 |
+
* @param string $fieldName
|
| 303 |
+
* @return string|null
|
| 304 |
+
*/
|
| 305 |
+
protected function _mapGeneralFieldset($fieldName)
|
| 306 |
+
{
|
| 307 |
+
switch ($fieldName)
|
| 308 |
+
{
|
| 309 |
+
case 'business_account':
|
| 310 |
+
case 'merchant_country':
|
| 311 |
+
return "ecompayment/general/{$fieldName}";
|
| 312 |
+
default:
|
| 313 |
+
return null;
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
/**
|
| 318 |
+
* Map Ecom General Settings
|
| 319 |
+
*
|
| 320 |
+
* @param string $fieldName
|
| 321 |
+
* @return string|null
|
| 322 |
+
*/
|
| 323 |
+
protected function _mapMethodFieldset($fieldName)
|
| 324 |
+
{
|
| 325 |
+
if (!$this->_methodCode) {
|
| 326 |
+
return null;
|
| 327 |
+
}
|
| 328 |
+
switch ($fieldName)
|
| 329 |
+
{
|
| 330 |
+
case 'customer_id':
|
| 331 |
+
case 'active':
|
| 332 |
+
case 'title':
|
| 333 |
+
case 'payment_action':
|
| 334 |
+
case 'allowspecific':
|
| 335 |
+
case 'specificcountry':
|
| 336 |
+
case 'debug':
|
| 337 |
+
return "payment/{$this->_methodCode}/{$fieldName}";
|
| 338 |
+
default:
|
| 339 |
+
return null;
|
| 340 |
+
}
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
|
app/code/local/KuafuSoft/EcomPayment/Model/Standard.php
CHANGED
|
@@ -1,147 +1,147 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class KuafuSoft_EcomPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
| 3 |
-
{
|
| 4 |
-
protected $_code = KuafuSoft_EcomPayment_Model_Config::METHOD_STANDARD;
|
| 5 |
-
protected $_formBlockType = 'ecompayment/standard_form';
|
| 6 |
-
protected $_infoBlockType = 'ecompayment/payment_info';
|
| 7 |
-
protected $_isInitializeNeeded = true;
|
| 8 |
-
protected $_canUseInternal = false;
|
| 9 |
-
protected $_canUseForMultishipping = false;
|
| 10 |
-
|
| 11 |
-
/**
|
| 12 |
-
* Config instance
|
| 13 |
-
* @var KuafuSoft_EcomPayment_Model_Config
|
| 14 |
-
*/
|
| 15 |
-
protected $_config = null;
|
| 16 |
-
|
| 17 |
-
/**
|
| 18 |
-
* Whether method is available for specified currency
|
| 19 |
-
*
|
| 20 |
-
* @param string $currencyCode
|
| 21 |
-
* @return bool
|
| 22 |
-
*/
|
| 23 |
-
public function canUseForCurrency($currencyCode)
|
| 24 |
-
{
|
| 25 |
-
return $this->getConfig()->isCurrencyCodeSupported($currencyCode);
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
/**
|
| 29 |
-
* Get checkout session namespace
|
| 30 |
-
*
|
| 31 |
-
* @return Mage_Checkout_Model_Session
|
| 32 |
-
*/
|
| 33 |
-
public function getCheckout()
|
| 34 |
-
{
|
| 35 |
-
return Mage::getSingleton('checkout/session');
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
/**
|
| 39 |
-
* Get current quote
|
| 40 |
-
*
|
| 41 |
-
* @return Mage_Sales_Model_Quote
|
| 42 |
-
*/
|
| 43 |
-
public function getQuote()
|
| 44 |
-
{
|
| 45 |
-
return $this->getCheckout()->getQuote();
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
/**
|
| 49 |
-
* Create main block for standard form
|
| 50 |
-
*
|
| 51 |
-
*/
|
| 52 |
-
public function createFormBlock($name)
|
| 53 |
-
{
|
| 54 |
-
$block = $this->getLayout()->createBlock('ecompayment/standard_form', $name)
|
| 55 |
-
->setMethod($this->_code)
|
| 56 |
-
->setPayment($this->getPayment())
|
| 57 |
-
->setTemplate('ecompayment/standard/form.phtml');
|
| 58 |
-
|
| 59 |
-
return $block;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
/**
|
| 63 |
-
* Return Order place redirect url
|
| 64 |
-
*
|
| 65 |
-
* @return string
|
| 66 |
-
*/
|
| 67 |
-
public function getOrderPlaceRedirectUrl()
|
| 68 |
-
{
|
| 69 |
-
return Mage::getUrl('ecompayment/standard/redirect', array('_secure' => true));
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
/**
|
| 73 |
-
* Return form field array
|
| 74 |
-
*
|
| 75 |
-
* @return array
|
| 76 |
-
*/
|
| 77 |
-
public function getStandardCheckoutFormFields()
|
| 78 |
-
{
|
| 79 |
-
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
|
| 80 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
| 81 |
-
$api = Mage::getModel('ecompayment/api_standard')->setConfigObject($this->getConfig());
|
| 82 |
-
$api->setOrderId($orderIncrementId)
|
| 83 |
-
->setCurrencyCode($order->getBaseCurrencyCode())
|
| 84 |
-
->setRedirectorSuccess(Mage::getUrl('ecompayment/standard/success', array('order_id' => $order->getId())) . '?')
|
| 85 |
-
->setRedirectorFailed(Mage::getUrl('ecompayment/standard/fail', array('order_id' => $order->getId())) . '?');
|
| 86 |
-
|
| 87 |
-
// export address
|
| 88 |
-
$isOrderVirtual = $order->getIsVirtual();
|
| 89 |
-
$address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress();
|
| 90 |
-
if ($isOrderVirtual) {
|
| 91 |
-
$api->setNoShipping(true);
|
| 92 |
-
}
|
| 93 |
-
else{
|
| 94 |
-
$api->setAddress($address);
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
$api->setCustomerEmail($address->getEmail() ? $address->getEmail() : $order->getCustomerEmail());
|
| 98 |
-
|
| 99 |
-
$grandTotal = $order->getBaseGrandTotal();
|
| 100 |
-
$api->setAmount($grandTotal);
|
| 101 |
-
$api->setNotes(Mage::helper('ecompayment')->__('Transaction#: %s', $orderIncrementId));
|
| 102 |
-
|
| 103 |
-
$result = $api->getStandardCheckoutRequest();
|
| 104 |
-
return $result;
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
/**
|
| 108 |
-
* Instantiate state and set it to state object
|
| 109 |
-
* @param string $paymentAction
|
| 110 |
-
* @param Varien_Object
|
| 111 |
-
*/
|
| 112 |
-
public function initialize($paymentAction, $stateObject)
|
| 113 |
-
{
|
| 114 |
-
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
| 115 |
-
$stateObject->setState($state);
|
| 116 |
-
$stateObject->setStatus('pending_payment');
|
| 117 |
-
$stateObject->setIsNotified(false);
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
/**
|
| 121 |
-
* Config instance getter
|
| 122 |
-
* @return KuafuSoft_EcomPayment_Model_Config
|
| 123 |
-
*/
|
| 124 |
-
public function getConfig()
|
| 125 |
-
{
|
| 126 |
-
if (null === $this->_config) {
|
| 127 |
-
$params = array($this->_code);
|
| 128 |
-
if ($store = $this->getStore()) {
|
| 129 |
-
$params[] = is_object($store) ? $store->getId() : $store;
|
| 130 |
-
}
|
| 131 |
-
$this->_config = Mage::getModel('ecompayment/config', $params);
|
| 132 |
-
}
|
| 133 |
-
return $this->_config;
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
/**
|
| 137 |
-
* Custom getter for payment configuration
|
| 138 |
-
*
|
| 139 |
-
* @param string $field
|
| 140 |
-
* @param int $storeId
|
| 141 |
-
* @return mixed
|
| 142 |
-
*/
|
| 143 |
-
public function getConfigData($field, $storeId = null)
|
| 144 |
-
{
|
| 145 |
-
return $this->getConfig()->$field;
|
| 146 |
-
}
|
| 147 |
-
}
|
| 1 |
+
<?php
|
| 2 |
+
class KuafuSoft_EcomPayment_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
| 3 |
+
{
|
| 4 |
+
protected $_code = KuafuSoft_EcomPayment_Model_Config::METHOD_STANDARD;
|
| 5 |
+
protected $_formBlockType = 'ecompayment/standard_form';
|
| 6 |
+
protected $_infoBlockType = 'ecompayment/payment_info';
|
| 7 |
+
protected $_isInitializeNeeded = true;
|
| 8 |
+
protected $_canUseInternal = false;
|
| 9 |
+
protected $_canUseForMultishipping = false;
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Config instance
|
| 13 |
+
* @var KuafuSoft_EcomPayment_Model_Config
|
| 14 |
+
*/
|
| 15 |
+
protected $_config = null;
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Whether method is available for specified currency
|
| 19 |
+
*
|
| 20 |
+
* @param string $currencyCode
|
| 21 |
+
* @return bool
|
| 22 |
+
*/
|
| 23 |
+
public function canUseForCurrency($currencyCode)
|
| 24 |
+
{
|
| 25 |
+
return $this->getConfig()->isCurrencyCodeSupported($currencyCode);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Get checkout session namespace
|
| 30 |
+
*
|
| 31 |
+
* @return Mage_Checkout_Model_Session
|
| 32 |
+
*/
|
| 33 |
+
public function getCheckout()
|
| 34 |
+
{
|
| 35 |
+
return Mage::getSingleton('checkout/session');
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Get current quote
|
| 40 |
+
*
|
| 41 |
+
* @return Mage_Sales_Model_Quote
|
| 42 |
+
*/
|
| 43 |
+
public function getQuote()
|
| 44 |
+
{
|
| 45 |
+
return $this->getCheckout()->getQuote();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Create main block for standard form
|
| 50 |
+
*
|
| 51 |
+
*/
|
| 52 |
+
public function createFormBlock($name)
|
| 53 |
+
{
|
| 54 |
+
$block = $this->getLayout()->createBlock('ecompayment/standard_form', $name)
|
| 55 |
+
->setMethod($this->_code)
|
| 56 |
+
->setPayment($this->getPayment())
|
| 57 |
+
->setTemplate('ecompayment/standard/form.phtml');
|
| 58 |
+
|
| 59 |
+
return $block;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Return Order place redirect url
|
| 64 |
+
*
|
| 65 |
+
* @return string
|
| 66 |
+
*/
|
| 67 |
+
public function getOrderPlaceRedirectUrl()
|
| 68 |
+
{
|
| 69 |
+
return Mage::getUrl('ecompayment/standard/redirect', array('_secure' => true));
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Return form field array
|
| 74 |
+
*
|
| 75 |
+
* @return array
|
| 76 |
+
*/
|
| 77 |
+
public function getStandardCheckoutFormFields()
|
| 78 |
+
{
|
| 79 |
+
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
|
| 80 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
| 81 |
+
$api = Mage::getModel('ecompayment/api_standard')->setConfigObject($this->getConfig());
|
| 82 |
+
$api->setOrderId($orderIncrementId)
|
| 83 |
+
->setCurrencyCode($order->getBaseCurrencyCode())
|
| 84 |
+
->setRedirectorSuccess(Mage::getUrl('ecompayment/standard/success', array('order_id' => $order->getId())) . '?')
|
| 85 |
+
->setRedirectorFailed(Mage::getUrl('ecompayment/standard/fail', array('order_id' => $order->getId())) . '?');
|
| 86 |
+
|
| 87 |
+
// export address
|
| 88 |
+
$isOrderVirtual = $order->getIsVirtual();
|
| 89 |
+
$address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress();
|
| 90 |
+
if ($isOrderVirtual) {
|
| 91 |
+
$api->setNoShipping(true);
|
| 92 |
+
}
|
| 93 |
+
else{
|
| 94 |
+
$api->setAddress($address);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
$api->setCustomerEmail($address->getEmail() ? $address->getEmail() : $order->getCustomerEmail());
|
| 98 |
+
|
| 99 |
+
$grandTotal = $order->getBaseGrandTotal();
|
| 100 |
+
$api->setAmount($grandTotal);
|
| 101 |
+
$api->setNotes(Mage::helper('ecompayment')->__('Transaction#: %s', $orderIncrementId));
|
| 102 |
+
|
| 103 |
+
$result = $api->getStandardCheckoutRequest();
|
| 104 |
+
return $result;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Instantiate state and set it to state object
|
| 109 |
+
* @param string $paymentAction
|
| 110 |
+
* @param Varien_Object
|
| 111 |
+
*/
|
| 112 |
+
public function initialize($paymentAction, $stateObject)
|
| 113 |
+
{
|
| 114 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
| 115 |
+
$stateObject->setState($state);
|
| 116 |
+
$stateObject->setStatus('pending_payment');
|
| 117 |
+
$stateObject->setIsNotified(false);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
* Config instance getter
|
| 122 |
+
* @return KuafuSoft_EcomPayment_Model_Config
|
| 123 |
+
*/
|
| 124 |
+
public function getConfig()
|
| 125 |
+
{
|
| 126 |
+
if (null === $this->_config) {
|
| 127 |
+
$params = array($this->_code);
|
| 128 |
+
if ($store = $this->getStore()) {
|
| 129 |
+
$params[] = is_object($store) ? $store->getId() : $store;
|
| 130 |
+
}
|
| 131 |
+
$this->_config = Mage::getModel('ecompayment/config', $params);
|
| 132 |
+
}
|
| 133 |
+
return $this->_config;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* Custom getter for payment configuration
|
| 138 |
+
*
|
| 139 |
+
* @param string $field
|
| 140 |
+
* @param int $storeId
|
| 141 |
+
* @return mixed
|
| 142 |
+
*/
|
| 143 |
+
public function getConfigData($field, $storeId = null)
|
| 144 |
+
{
|
| 145 |
+
return $this->getConfig()->$field;
|
| 146 |
+
}
|
| 147 |
+
}
|
app/code/local/KuafuSoft/EcomPayment/Model/Status.php
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class KuafuSoft_EcomPayment_Model_Status extends Varien_Object
|
| 4 |
-
{
|
| 5 |
-
const STATUS_ENABLED = 1;
|
| 6 |
-
const STATUS_DISABLED = 2;
|
| 7 |
-
|
| 8 |
-
static public function getOptionArray()
|
| 9 |
-
{
|
| 10 |
-
return array(
|
| 11 |
-
self::STATUS_ENABLED => Mage::helper('ecompayment')->__('Enabled'),
|
| 12 |
-
self::STATUS_DISABLED => Mage::helper('ecompayment')->__('Disabled')
|
| 13 |
-
);
|
| 14 |
-
}
|
| 15 |
}
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class KuafuSoft_EcomPayment_Model_Status extends Varien_Object
|
| 4 |
+
{
|
| 5 |
+
const STATUS_ENABLED = 1;
|
| 6 |
+
const STATUS_DISABLED = 2;
|
| 7 |
+
|
| 8 |
+
static public function getOptionArray()
|
| 9 |
+
{
|
| 10 |
+
return array(
|
| 11 |
+
self::STATUS_ENABLED => Mage::helper('ecompayment')->__('Enabled'),
|
| 12 |
+
self::STATUS_DISABLED => Mage::helper('ecompayment')->__('Disabled')
|
| 13 |
+
);
|
| 14 |
+
}
|
| 15 |
}
|
app/code/local/KuafuSoft/EcomPayment/Model/sql/ecompayment_setup/mysql4-install-0.1.0.php
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
<?php
|
|
|
app/code/local/KuafuSoft/EcomPayment/controllers/StandardController.php
CHANGED
|
@@ -1,123 +1,128 @@
|
|
| 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 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
$
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
$this->_redirect('checkout/
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 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 */
|
| 79 |
+
//
|
| 80 |
+
// $items = $order->getItemsCollection();
|
| 81 |
+
// foreach ($items as $item) {
|
| 82 |
+
// try {
|
| 83 |
+
// $cart->addOrderItem($item);
|
| 84 |
+
// } catch (Mage_Core_Exception $e){
|
| 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 |
+
|
| 99 |
+
/**
|
| 100 |
+
* when ecompayment returns
|
| 101 |
+
* The order information at this point is in POST
|
| 102 |
+
* variables. However, you don't want to "process" the order until you
|
| 103 |
+
* get validation from the IPN.
|
| 104 |
+
*/
|
| 105 |
+
public function successAction()
|
| 106 |
+
{
|
| 107 |
+
$status = $this->getRequest()->getParam('Status');
|
| 108 |
+
$transId= $this->getRequest()->getParam('TransID');
|
| 109 |
+
$amount = $this->getRequest()->getparam('Amount');
|
| 110 |
+
$md5Check = $this->getRequest()->getParam('Crypt');
|
| 111 |
+
$session = Mage::getSingleton('checkout/session');
|
| 112 |
+
if($md5Check == md5($status . $transId . $amount . Mage::getStoreConfig('payment/ecompayment_standard/secret_key')))
|
| 113 |
+
{
|
| 114 |
+
$session->setQuoteId($session->getEcomPaymentStandardQuoteId(true));
|
| 115 |
+
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
| 116 |
+
$order = Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id'));
|
| 117 |
+
$order->setState(Mage::getStoreConfig('payment/ecompayment_standard/order_status'), true)
|
| 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 |
+
}
|
| 128 |
+
}
|
app/code/local/KuafuSoft/EcomPayment/etc/system.xml
CHANGED
|
@@ -1,85 +1,85 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<!--
|
| 3 |
-
* @category KuafuSoft
|
| 4 |
-
* @package KuafuSoft_EcomPayment
|
| 5 |
-
* @author http://www.kuafusoft.com
|
| 6 |
-
*/
|
| 7 |
-
-->
|
| 8 |
-
<config>
|
| 9 |
-
<sections>
|
| 10 |
-
<payment>
|
| 11 |
-
<groups>
|
| 12 |
-
<ecompayment_standard translate="label" module="paygate">
|
| 13 |
-
<label>Ecom Payment Standard</label>
|
| 14 |
-
<frontend_type>text</frontend_type>
|
| 15 |
-
<sort_order>90</sort_order>
|
| 16 |
-
<show_in_default>1</show_in_default>
|
| 17 |
-
<show_in_website>1</show_in_website>
|
| 18 |
-
<show_in_store>1</show_in_store>
|
| 19 |
-
<fields>
|
| 20 |
-
<title translate="label">
|
| 21 |
-
<label>Title</label>
|
| 22 |
-
<frontend_type>text</frontend_type>
|
| 23 |
-
<sort_order>10</sort_order>
|
| 24 |
-
<show_in_default>1</show_in_default>
|
| 25 |
-
<show_in_website>1</show_in_website>
|
| 26 |
-
<show_in_store>1</show_in_store>
|
| 27 |
-
</title>
|
| 28 |
-
<active translate="label">
|
| 29 |
-
<label>Enabled</label>
|
| 30 |
-
<frontend_type>select</frontend_type>
|
| 31 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 32 |
-
<sort_order>20</sort_order>
|
| 33 |
-
<show_in_default>1</show_in_default>
|
| 34 |
-
<show_in_website>1</show_in_website>
|
| 35 |
-
<show_in_store>0</show_in_store>
|
| 36 |
-
</active>
|
| 37 |
-
<order_status translate="label">
|
| 38 |
-
<label>New Order Status</label>
|
| 39 |
-
<frontend_type>select</frontend_type>
|
| 40 |
-
<source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
|
| 41 |
-
<sort_order>2</sort_order>
|
| 42 |
-
<show_in_default>1</show_in_default>
|
| 43 |
-
<show_in_website>1</show_in_website>
|
| 44 |
-
<show_in_store>0</show_in_store>
|
| 45 |
-
</order_status>
|
| 46 |
-
<customer_id translate="label">
|
| 47 |
-
<label>Merchant Customer ID</label>
|
| 48 |
-
<frontend_type>text</frontend_type>
|
| 49 |
-
<sort_order>30</sort_order>
|
| 50 |
-
<show_in_default>1</show_in_default>
|
| 51 |
-
<show_in_website>1</show_in_website>
|
| 52 |
-
<show_in_store>0</show_in_store>
|
| 53 |
-
</customer_id>
|
| 54 |
-
<secret_key translate="label">
|
| 55 |
-
<label>Secret Key</label>
|
| 56 |
-
<frontend_type>text</frontend_type>
|
| 57 |
-
<sort_order>35</sort_order>
|
| 58 |
-
<show_in_default>1</show_in_default>
|
| 59 |
-
<show_in_website>1</show_in_website>
|
| 60 |
-
<show_in_store>0</show_in_store>
|
| 61 |
-
</secret_key>
|
| 62 |
-
<test translate="label">
|
| 63 |
-
<label>Test mode</label>
|
| 64 |
-
<frontend_type>select</frontend_type>
|
| 65 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 66 |
-
<sort_order>40</sort_order>
|
| 67 |
-
<show_in_default>1</show_in_default>
|
| 68 |
-
<show_in_website>1</show_in_website>
|
| 69 |
-
<show_in_store>0</show_in_store>
|
| 70 |
-
</test>
|
| 71 |
-
<debug translate="label">
|
| 72 |
-
<label>Debug</label>
|
| 73 |
-
<frontend_type>select</frontend_type>
|
| 74 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 75 |
-
<sort_order>50</sort_order>
|
| 76 |
-
<show_in_default>1</show_in_default>
|
| 77 |
-
<show_in_website>1</show_in_website>
|
| 78 |
-
<show_in_store>0</show_in_store>
|
| 79 |
-
</debug>
|
| 80 |
-
</fields>
|
| 81 |
-
</ecompayment_standard>
|
| 82 |
-
</groups>
|
| 83 |
-
</payment>
|
| 84 |
-
</sections>
|
| 85 |
-
</config>
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
* @category KuafuSoft
|
| 4 |
+
* @package KuafuSoft_EcomPayment
|
| 5 |
+
* @author http://www.kuafusoft.com
|
| 6 |
+
*/
|
| 7 |
+
-->
|
| 8 |
+
<config>
|
| 9 |
+
<sections>
|
| 10 |
+
<payment>
|
| 11 |
+
<groups>
|
| 12 |
+
<ecompayment_standard translate="label" module="paygate">
|
| 13 |
+
<label>Ecom Payment Standard</label>
|
| 14 |
+
<frontend_type>text</frontend_type>
|
| 15 |
+
<sort_order>90</sort_order>
|
| 16 |
+
<show_in_default>1</show_in_default>
|
| 17 |
+
<show_in_website>1</show_in_website>
|
| 18 |
+
<show_in_store>1</show_in_store>
|
| 19 |
+
<fields>
|
| 20 |
+
<title translate="label">
|
| 21 |
+
<label>Title</label>
|
| 22 |
+
<frontend_type>text</frontend_type>
|
| 23 |
+
<sort_order>10</sort_order>
|
| 24 |
+
<show_in_default>1</show_in_default>
|
| 25 |
+
<show_in_website>1</show_in_website>
|
| 26 |
+
<show_in_store>1</show_in_store>
|
| 27 |
+
</title>
|
| 28 |
+
<active translate="label">
|
| 29 |
+
<label>Enabled</label>
|
| 30 |
+
<frontend_type>select</frontend_type>
|
| 31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 32 |
+
<sort_order>20</sort_order>
|
| 33 |
+
<show_in_default>1</show_in_default>
|
| 34 |
+
<show_in_website>1</show_in_website>
|
| 35 |
+
<show_in_store>0</show_in_store>
|
| 36 |
+
</active>
|
| 37 |
+
<order_status translate="label">
|
| 38 |
+
<label>New Order Status</label>
|
| 39 |
+
<frontend_type>select</frontend_type>
|
| 40 |
+
<source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
|
| 41 |
+
<sort_order>2</sort_order>
|
| 42 |
+
<show_in_default>1</show_in_default>
|
| 43 |
+
<show_in_website>1</show_in_website>
|
| 44 |
+
<show_in_store>0</show_in_store>
|
| 45 |
+
</order_status>
|
| 46 |
+
<customer_id translate="label">
|
| 47 |
+
<label>Merchant Customer ID</label>
|
| 48 |
+
<frontend_type>text</frontend_type>
|
| 49 |
+
<sort_order>30</sort_order>
|
| 50 |
+
<show_in_default>1</show_in_default>
|
| 51 |
+
<show_in_website>1</show_in_website>
|
| 52 |
+
<show_in_store>0</show_in_store>
|
| 53 |
+
</customer_id>
|
| 54 |
+
<secret_key translate="label">
|
| 55 |
+
<label>Secret Key</label>
|
| 56 |
+
<frontend_type>text</frontend_type>
|
| 57 |
+
<sort_order>35</sort_order>
|
| 58 |
+
<show_in_default>1</show_in_default>
|
| 59 |
+
<show_in_website>1</show_in_website>
|
| 60 |
+
<show_in_store>0</show_in_store>
|
| 61 |
+
</secret_key>
|
| 62 |
+
<test translate="label">
|
| 63 |
+
<label>Test mode</label>
|
| 64 |
+
<frontend_type>select</frontend_type>
|
| 65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 66 |
+
<sort_order>40</sort_order>
|
| 67 |
+
<show_in_default>1</show_in_default>
|
| 68 |
+
<show_in_website>1</show_in_website>
|
| 69 |
+
<show_in_store>0</show_in_store>
|
| 70 |
+
</test>
|
| 71 |
+
<debug translate="label">
|
| 72 |
+
<label>Debug</label>
|
| 73 |
+
<frontend_type>select</frontend_type>
|
| 74 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 75 |
+
<sort_order>50</sort_order>
|
| 76 |
+
<show_in_default>1</show_in_default>
|
| 77 |
+
<show_in_website>1</show_in_website>
|
| 78 |
+
<show_in_store>0</show_in_store>
|
| 79 |
+
</debug>
|
| 80 |
+
</fields>
|
| 81 |
+
</ecompayment_standard>
|
| 82 |
+
</groups>
|
| 83 |
+
</payment>
|
| 84 |
+
</sections>
|
| 85 |
+
</config>
|
app/design/frontend/base/default/template/ecompayment/payment/redirect.phtml
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/KuafuSoft_EcomPayment.xml
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<modules>
|
| 4 |
-
<KuafuSoft_EcomPayment>
|
| 5 |
-
<active>true</active>
|
| 6 |
-
<codePool>local</codePool>
|
| 7 |
-
<depends>
|
| 8 |
-
<Mage_Paygate />
|
| 9 |
-
<Mage_Checkout />
|
| 10 |
-
<Mage_Sales />
|
| 11 |
-
</depends>
|
| 12 |
-
</KuafuSoft_EcomPayment>
|
| 13 |
-
</modules>
|
| 14 |
-
</config>
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<KuafuSoft_EcomPayment>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Paygate />
|
| 9 |
+
<Mage_Checkout />
|
| 10 |
+
<Mage_Sales />
|
| 11 |
+
</depends>
|
| 12 |
+
</KuafuSoft_EcomPayment>
|
| 13 |
+
</modules>
|
| 14 |
+
</config>
|
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.
|
| 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>
|
| 17 |
-
<time>
|
| 18 |
-
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="KuafuSoft_EcomPayment.xml" hash="
|
| 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.6</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-01-06</date>
|
| 17 |
+
<time>09:19:23</time>
|
| 18 |
+
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="KuafuSoft_EcomPayment.xml" hash="dbcd6c1a5dfe93b7cf7c16e6d5ba2a42"/></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=""/></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="ee0eb46e6d58a1dd2b7d8c9336400117"/></dir><dir name="Standard"><file name="Form.php" hash="762974198651f0fb46f2a9fcc93f22b1"/><file name="Redirect.php" hash="d755755961038a234c0b96c0dabbebff"/></dir></dir><dir name="controllers"><file name="StandardController.php" hash="4d5dad4af05cd9c0dee4ebeb6d60e761"/></dir><dir name="etc"><file name="config.xml" hash="e56ac6f19bc75a5bcfdcab3d5c2bb608"/><file name="system.xml" hash="a5822493a12dd14b6eda3801e3aa0bd7"/></dir><dir name="Helper"><file name="Data.php" hash="0b62c17838ed0e134643d5c3c0fe3fe6"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="f288d9bce89816624dbc5213a0fe6d03"/><file name="Standard.php" hash="f92ece8d0a96c21c6ede880b8ef1dabd"/></dir><dir name="sql"><dir name="ecompayment_setup"><file name="mysql4-install-0.1.0.php" hash=""/></dir></dir><file name="Config.php" hash="418fca6afea20f9a7e557a2355e90a8d"/><file name="Standard.php" hash="91a7b0031a516fe011e2f1d4e8ae4cb9"/><file name="Status.php" hash="aca7ab7f4723eb4cb2dfe76d488dabdd"/></dir></dir></dir></target></contents>
|
| 19 |
<compatible/>
|
| 20 |
<dependencies/>
|
| 21 |
</package>
|
