Version Notes
version 1.0.0
Download this release
Release Info
Developer | KRPartners Co.,Ltd |
Extension | Eximbay |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/core/Mage/Eximbay/Block/Form.php +76 -0
- app/code/core/Mage/Eximbay/Block/Info.php +30 -0
- app/code/core/Mage/Eximbay/Block/Jsinit.php +47 -0
- app/code/core/Mage/Eximbay/Block/Payment.php +33 -0
- app/code/core/Mage/Eximbay/Block/Placeform.php +65 -0
- app/code/core/Mage/Eximbay/Block/Redirect.php +28 -0
- app/code/core/Mage/Eximbay/Helper/Data.php +124 -0
- app/code/core/Mage/Eximbay/Model/Abstract.php +225 -0
- app/code/core/Mage/Eximbay/Model/Abstract.php.bak +245 -0
- app/code/core/Mage/Eximbay/Model/Acc.php +25 -0
- app/code/core/Mage/Eximbay/Model/Event.php +224 -0
- app/code/core/Mage/Eximbay/controllers/EximbayController.php +85 -0
- app/code/core/Mage/Eximbay/controllers/ProcessingController.php +141 -0
- app/code/core/Mage/Eximbay/etc/config.xml +146 -0
- app/code/core/Mage/Eximbay/etc/system.xml +91 -0
- app/code/core/Mage/Eximbay/etc/system.xml.bak +91 -0
- app/code/core/Mage/Eximbay/sql/eximbay_setup/mysql4-install-0.1.0.php +14 -0
- app/code/core/Mage/Eximbay/sql/eximbay_setup/mysql4-ugrade-0.1.0-0.2.0.php +35 -0
- app/etc/modules/Mage_Eximbay.xml +17 -0
- app/locale/en_US/Mage_Eximbay.csv +22 -0
- package.xml +18 -0
app/code/core/Mage/Eximbay/Block/Form.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_Block_Form extends Mage_Payment_Block_Form
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Available locales for content URL generation
|
22 |
+
*
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
protected $_supportedInfoLocales = array('de');
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Default locale for content URL generation
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_defaultInfoLocale = 'en';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor. Set template.
|
36 |
+
*/
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
parent::_construct();
|
40 |
+
$this->setTemplate('eximbay/form.phtml');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Return payment logo image src
|
45 |
+
*
|
46 |
+
* @param string $payment Payment Code
|
47 |
+
* @return string|bool
|
48 |
+
*/
|
49 |
+
public function getPaymentImageSrc($payment)
|
50 |
+
{
|
51 |
+
$imageFilename = Mage::getDesign()
|
52 |
+
->getFilename('images' . DS . 'eximbay' . DS . $payment, array('_type' => 'skin'));
|
53 |
+
|
54 |
+
if (file_exists($imageFilename . '.png')) {
|
55 |
+
return $this->getSkinUrl('images/eximbay/' . $payment . '.png');
|
56 |
+
} else if (file_exists($imageFilename . '.gif')) {
|
57 |
+
return $this->getSkinUrl('images/eximbay/' . $payment . '.gif');
|
58 |
+
}
|
59 |
+
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Return supported locale for information text
|
65 |
+
*
|
66 |
+
* @return string
|
67 |
+
*/
|
68 |
+
public function getInfoLocale()
|
69 |
+
{
|
70 |
+
$locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
|
71 |
+
if (!in_array($locale, $this->_supportedInfoLocales)) {
|
72 |
+
$locale = $this->_defaultInfoLocale;
|
73 |
+
}
|
74 |
+
return $locale;
|
75 |
+
}
|
76 |
+
}
|
app/code/core/Mage/Eximbay/Block/Info.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://opensource.org/licenses/osl-3.0.php If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@magentocommerce.com so we can send you a copy immediately.
|
6 |
+
* @category Mage
|
7 |
+
* @package Mage_Eximbay
|
8 |
+
*/
|
9 |
+
class Mage_Eximbay_Block_Info extends Mage_Payment_Block_Info
|
10 |
+
{
|
11 |
+
/** Constructor. Set template. */
|
12 |
+
protected function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->setTemplate('eximbay/info.phtml');
|
16 |
+
}
|
17 |
+
|
18 |
+
/** Returns code of payment method @return string */
|
19 |
+
public function getMethodCode()
|
20 |
+
{
|
21 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
22 |
+
}
|
23 |
+
|
24 |
+
/** Build PDF content of info block @return string */
|
25 |
+
public function toPdf()
|
26 |
+
{
|
27 |
+
$this->setTemplate('eximbay/pdf/info.phtml');
|
28 |
+
return $this->toHtml();
|
29 |
+
}
|
30 |
+
}
|
app/code/core/Mage/Eximbay/Block/Jsinit.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_Block_Jsinit extends Mage_Adminhtml_Block_Template
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Include JS in head if section is eximbay
|
22 |
+
*/
|
23 |
+
protected function _prepareLayout()
|
24 |
+
{
|
25 |
+
$section = $this->getAction()->getRequest()->getParam('section', false);
|
26 |
+
if ($section == 'eximbay') {
|
27 |
+
$this->getLayout()
|
28 |
+
->getBlock('head')
|
29 |
+
->addJs('mage/adminhtml/eximbay.js');
|
30 |
+
}
|
31 |
+
parent::_prepareLayout();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Print init JS script into body
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
protected function _toHtml()
|
39 |
+
{
|
40 |
+
$section = $this->getAction()->getRequest()->getParam('section', false);
|
41 |
+
if ($section == 'eximbay') {
|
42 |
+
return parent::_toHtml();
|
43 |
+
} else {
|
44 |
+
return '';
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
app/code/core/Mage/Eximbay/Block/Payment.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_Block_Payment extends Mage_Core_Block_Template
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Return Payment logo src
|
22 |
+
*
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
+
public function getEximbayLogoSrc()
|
26 |
+
{
|
27 |
+
$locale = Mage::getModel('eximbay/acc')->getLocale();
|
28 |
+
$logoFilename = Mage::getDesign()
|
29 |
+
->getFilename('images' . DS . 'eximbay' . DS . 'banner_120_' . $locale . '.gif', array('_type' => 'skin'));
|
30 |
+
|
31 |
+
return $this->getSkinUrl('images/eximbay/banner_120_int.gif');
|
32 |
+
}
|
33 |
+
}
|
app/code/core/Mage/Eximbay/Block/Placeform.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_Block_Placeform extends Mage_Core_Block_Template
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Return checkout session instance
|
22 |
+
*
|
23 |
+
* @return Mage_Checkout_Model_Session
|
24 |
+
*/
|
25 |
+
protected function _getCheckout()
|
26 |
+
{
|
27 |
+
return Mage::getSingleton('checkout/session');
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Return order instance
|
32 |
+
*
|
33 |
+
* @return Mage_Sales_Model_Order|null
|
34 |
+
*/
|
35 |
+
protected function _getOrder()
|
36 |
+
{
|
37 |
+
if ($this->getOrder()) {
|
38 |
+
return $this->getOrder();
|
39 |
+
} elseif ($orderIncrementId = $this->_getCheckout()->getLastRealOrderId()) {
|
40 |
+
return Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
41 |
+
} else {
|
42 |
+
return null;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get Form data by using ogone payment api
|
48 |
+
*
|
49 |
+
* @return array
|
50 |
+
*/
|
51 |
+
public function getFormData()
|
52 |
+
{
|
53 |
+
return $this->_getOrder()->getPayment()->getMethodInstance()->getFormFields();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Getting gateway url
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function getFormAction()
|
62 |
+
{
|
63 |
+
return $this->_getOrder()->getPayment()->getMethodInstance()->getUrl();
|
64 |
+
}
|
65 |
+
}
|
app/code/core/Mage/Eximbay/Block/Redirect.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_Block_Redirect extends Mage_Core_Block_Template
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Constructor. Set template.
|
22 |
+
*/
|
23 |
+
protected function _construct()
|
24 |
+
{
|
25 |
+
parent::_construct();
|
26 |
+
$this->setTemplate('eximbay/redirect.phtml');
|
27 |
+
}
|
28 |
+
}
|
app/code/core/Mage/Eximbay/Helper/Data.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_Helper_Data extends Mage_Payment_Helper_Data
|
19 |
+
{
|
20 |
+
const XML_PATH_EMAIL = '';
|
21 |
+
const XML_PATH_MERCHANT_ID = '';
|
22 |
+
const XML_PATH_SECRET_KEY = '';
|
23 |
+
|
24 |
+
|
25 |
+
// Include your code to send activation email
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Send activation Email
|
29 |
+
*/
|
30 |
+
|
31 |
+
/*
|
32 |
+
public function activateEmail()
|
33 |
+
{
|
34 |
+
$storeId = Mage::app()->getStore()->getId();
|
35 |
+
|
36 |
+
$translate = Mage::getSingleton('core/translate');
|
37 |
+
// @var $translate Mage_Core_Model_Translate
|
38 |
+
$translate->setTranslateInline(false);
|
39 |
+
|
40 |
+
Mage::getModel('core/email_template')
|
41 |
+
->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
|
42 |
+
->sendTransactional(
|
43 |
+
'eximbay_activateemail',
|
44 |
+
Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId),
|
45 |
+
$this->_activationEmailTo,
|
46 |
+
null,
|
47 |
+
array(
|
48 |
+
'subject' => $this->_activationEmailSubject,
|
49 |
+
'email_addr' => Mage::getStoreConfig(self::XML_PATH_EMAIL),
|
50 |
+
'url' => Mage::getBaseUrl(),
|
51 |
+
'merchant_id' => Mage::getStoreConfig(self::XML_PATH_MERCHANT_ID),
|
52 |
+
'language' => Mage::getModel('core/locale')->getDefaultLocale()
|
53 |
+
)
|
54 |
+
);
|
55 |
+
|
56 |
+
$translate->setTranslateInline(true);
|
57 |
+
}*/
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Check if email is registered at eximbay
|
61 |
+
*
|
62 |
+
* @param array $params
|
63 |
+
* @return array
|
64 |
+
*/
|
65 |
+
|
66 |
+
/*
|
67 |
+
public function checkEmailRequest(Array $params) {
|
68 |
+
$response = null;
|
69 |
+
try {
|
70 |
+
$response = $this->_getHttpsPage($this->_eximbayServer . $this->_checkEmailUrl, array(
|
71 |
+
'email' => $params['email'],
|
72 |
+
'cust_id' => $this->_checkEmailCustId,
|
73 |
+
'password' => $this->_checkEmailPassword)
|
74 |
+
);
|
75 |
+
} catch (Exception $e) {
|
76 |
+
Mage::log($e->getMessage());
|
77 |
+
return null;
|
78 |
+
}
|
79 |
+
return $response;
|
80 |
+
}*/
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Check if entered secret is valid
|
84 |
+
* @param array $params
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
/*
|
88 |
+
public function checkSecretRequest(Array $params)
|
89 |
+
{
|
90 |
+
$response = null;
|
91 |
+
try {
|
92 |
+
$response = $this->_getHttpsPage($this->_eximbayServer . $this->_checkSecretUrl, array(
|
93 |
+
'email' => $params['email'],
|
94 |
+
'secret' => hash("sha256", hash("sha256", $params['secret']) . $this->_eximbayMasterSecretHash)),
|
95 |
+
'cust_id' => $this->_eximbayMasterCustId)
|
96 |
+
);
|
97 |
+
} catch (Exception $e) {
|
98 |
+
Mage::log($e->getMessage());
|
99 |
+
return null;
|
100 |
+
}
|
101 |
+
return $response;
|
102 |
+
}*/
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Reading a page via HTTPS and returning its content.
|
106 |
+
*/
|
107 |
+
/*
|
108 |
+
protected function _getHttpsPage($host, $parameter)
|
109 |
+
{
|
110 |
+
$client = new Varien_Http_Client();
|
111 |
+
$client->setUri($host)
|
112 |
+
->setConfig(array('timeout' => 30))
|
113 |
+
->setHeaders('accept-encoding', '')
|
114 |
+
->setParameterGet($parameter)
|
115 |
+
->setMethod(Zend_Http_Client::GET);
|
116 |
+
$request = $client->request();
|
117 |
+
// Workaround for pseudo chunked messages which are yet too short, so
|
118 |
+
// only an exception is is thrown instead of returning raw body
|
119 |
+
if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $request->getRawBody(), $m))
|
120 |
+
return $request->getRawBody();
|
121 |
+
|
122 |
+
return $request->getBody();
|
123 |
+
}*/
|
124 |
+
}
|
app/code/core/Mage/Eximbay/Model/Abstract.php
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
abstract class Mage_Eximbay_Model_Abstract extends Mage_Payment_Model_Method_Abstract
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* unique internal payment method identifier
|
22 |
+
*/
|
23 |
+
protected $_code = 'eximbay_abstract';
|
24 |
+
|
25 |
+
protected $_formBlockType = 'eximbay/form';
|
26 |
+
protected $_infoBlockType = 'eximbay/info';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Availability options
|
30 |
+
*/
|
31 |
+
protected $_isGateway = true;
|
32 |
+
protected $_canAuthorize = true;
|
33 |
+
protected $_canCapture = true;
|
34 |
+
protected $_canCapturePartial = false;
|
35 |
+
protected $_canRefund = false;
|
36 |
+
protected $_canVoid = false;
|
37 |
+
protected $_canUseInternal = false;
|
38 |
+
protected $_canUseCheckout = true;
|
39 |
+
protected $_canUseForMultishipping = false;
|
40 |
+
|
41 |
+
protected $_paymentMethod = 'abstract';
|
42 |
+
protected $_defaultLocale = 'en';
|
43 |
+
protected $_supportedLocales = array('cn', 'cz', 'da', 'en', 'es', 'fi', 'de', 'fr', 'gr', 'it', 'nl', 'ro', 'ru', 'pl', 'sv', 'tr');
|
44 |
+
protected $_hidelogin = '1';
|
45 |
+
|
46 |
+
protected $_order;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get order model
|
50 |
+
*
|
51 |
+
* @return Mage_Sales_Model_Order
|
52 |
+
*/
|
53 |
+
public function getOrder()
|
54 |
+
{
|
55 |
+
if (!$this->_order) {
|
56 |
+
$this->_order = $this->getInfoInstance()->getOrder();
|
57 |
+
}
|
58 |
+
return $this->_order;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Return url for redirection after order placed
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function getOrderPlaceRedirectUrl()
|
66 |
+
{
|
67 |
+
return Mage::getUrl('eximbay/processing/payment');
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Capture payment through Moneybookers api
|
72 |
+
*
|
73 |
+
* @param Varien_Object $payment
|
74 |
+
* @param decimal $amount
|
75 |
+
* @return Phoenix_Moneybookers_Model_Abstract
|
76 |
+
*/
|
77 |
+
public function capture(Varien_Object $payment, $amount)
|
78 |
+
{
|
79 |
+
$payment->setStatus(self::STATUS_APPROVED)
|
80 |
+
->setTransactionId($this->getTransactionId())
|
81 |
+
->setIsTransactionClosed(0);
|
82 |
+
|
83 |
+
return $this;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Cancel payment
|
88 |
+
*
|
89 |
+
* @param Varien_Object $payment
|
90 |
+
* @return Phoenix_Moneybookers_Model_Abstract
|
91 |
+
*/
|
92 |
+
public function cancel(Varien_Object $payment)
|
93 |
+
{
|
94 |
+
$payment->setStatus(self::STATUS_DECLINED)
|
95 |
+
->setTransactionId($this->getTransactionId())
|
96 |
+
->setIsTransactionClosed(1);
|
97 |
+
|
98 |
+
return $this;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Return url of payment method
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getUrl()
|
107 |
+
{
|
108 |
+
return 'http://www.test2.eximbay.com/web/payment2.0/payment_real.do';
|
109 |
+
// return 'https://www.eximbay.com/web/payment2.0/payment_real.do';
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Return url of payment method
|
114 |
+
*
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function getLocale()
|
118 |
+
{
|
119 |
+
$locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
|
120 |
+
if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLocales)) {
|
121 |
+
return $locale[0];
|
122 |
+
}
|
123 |
+
return $this->getDefaultLocale();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* prepare params array to send it to gateway page via POST
|
128 |
+
*
|
129 |
+
* @return array
|
130 |
+
*/
|
131 |
+
public function getFormFields()
|
132 |
+
{
|
133 |
+
$order_id = $this->getOrder()->getRealOrderId();
|
134 |
+
$billing = $this->getOrder()->getBillingAddress();
|
135 |
+
$shipping = $this->getOrder()->getShippingAddress();
|
136 |
+
if ($this->getOrder()->getBillingAddress()->getEmail()) {
|
137 |
+
$email = $this->getOrder()->getBillingAddress()->getEmail();
|
138 |
+
} else {
|
139 |
+
$email = $this->getOrder()->getCustomerEmail();
|
140 |
+
}
|
141 |
+
$amt = round($this->getOrder()->getGrandTotal(), 2);
|
142 |
+
$secretKey = "289F40E6640124B2628640168C3C5464"; // test secret key
|
143 |
+
$mid = "1849705C64"; // test mid
|
144 |
+
$ref = "abcd1234567890";
|
145 |
+
$linkBuf = $secretKey. "?mid=" . $mid ."&ref=" . $ref ."&cur=" ."USD" ."&amt=" .$amt;
|
146 |
+
|
147 |
+
//$fgkey = md5($linkBuf);
|
148 |
+
$fgkey = hash("sha256", $linkBuf);
|
149 |
+
|
150 |
+
$quantity = $this->getOrder()->getTotalItemCount();
|
151 |
+
$total = 0;
|
152 |
+
|
153 |
+
$params = array(
|
154 |
+
'ver' => '170',
|
155 |
+
'mid' => $mid,
|
156 |
+
'txntype' => 'SALE',
|
157 |
+
'displaytype' => 'I',
|
158 |
+
'secretkey' => $secretKey,
|
159 |
+
'ref' => $ref,
|
160 |
+
'email' => $email,
|
161 |
+
'transid' => $order_id,
|
162 |
+
'returnurl' => Mage::getUrl('eximbay/processing/success', array('transid' => $order_id)),
|
163 |
+
'fgkey' => $fgkey,
|
164 |
+
'lang' => 'KR', //$this->getLocale(),
|
165 |
+
'amt' => round($this->getOrder()->getGrandTotal(), 2),
|
166 |
+
'cur' => 'USD', //$this->getOrder()->getOrderCurrencyCode(),
|
167 |
+
'shop' => $this->getOrder()->getStore(),
|
168 |
+
'buyer' => $billing->getFirstname() . $billing->getLastname(),
|
169 |
+
'product' => $order_id,
|
170 |
+
'tel' => $billing->getTelephone(),
|
171 |
+
'payment_methods' => $this->_paymentMethod,
|
172 |
+
'hide_login' => $this->_hidelogin,
|
173 |
+
'new_window_redirect' => '1',
|
174 |
+
'rescode' => '',
|
175 |
+
'resmsg' => '',
|
176 |
+
'authcode' => '',
|
177 |
+
'visitorid' => '',
|
178 |
+
'dm_item_0_product' => $order_id,
|
179 |
+
'dm_item_0_quantity' => $quantity,
|
180 |
+
'dm_item_0_unitPrice' => round($this->getOrder()->getGrandTotal(), 2),
|
181 |
+
'dm_shipTo_city' => $shipping->getData("city"),
|
182 |
+
'dm_shipTo_country' => $shipping->getCountry(),
|
183 |
+
'dm_shipTo_firstName' => $shipping->getData("firstname"),
|
184 |
+
'dm_shipTo_lastName' => $shipping->getData("lastname"),
|
185 |
+
'dm_shipTo_phoneNumber' => $shipping->getTelephone(),
|
186 |
+
'dm_shipTo_postalCode' => $shipping->getData("postcode"),
|
187 |
+
'dm_shipTo_state' => $shipping->getRegionCode(),
|
188 |
+
'dm_shipTo_street1' => $shipping->getData("street")
|
189 |
+
);
|
190 |
+
|
191 |
+
return $params;
|
192 |
+
}
|
193 |
+
/**
|
194 |
+
* Get initialized flag status
|
195 |
+
* @return true
|
196 |
+
*/
|
197 |
+
public function isInitializeNeeded()
|
198 |
+
{
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Instantiate state and set it to state onject
|
204 |
+
* //@param
|
205 |
+
* //@param
|
206 |
+
*/
|
207 |
+
public function initialize($paymentAction, $stateObject)
|
208 |
+
{
|
209 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
210 |
+
$stateObject->setState($state);
|
211 |
+
$stateObject->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
212 |
+
$stateObject->setIsNotified(false);
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Get config action to process initialization
|
217 |
+
*
|
218 |
+
* @return string
|
219 |
+
*/
|
220 |
+
public function getConfigPaymentAction()
|
221 |
+
{
|
222 |
+
$paymentAction = $this->getConfigData('payment_action');
|
223 |
+
return empty($paymentAction) ? true : $paymentAction;
|
224 |
+
}
|
225 |
+
}
|
app/code/core/Mage/Eximbay/Model/Abstract.php.bak
ADDED
@@ -0,0 +1,245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
abstract class Mage_Eximbay_Model_Abstract extends Mage_Payment_Model_Method_Abstract
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* unique internal payment method identifier
|
22 |
+
*/
|
23 |
+
protected $_code = 'eximbay_abstract';
|
24 |
+
|
25 |
+
protected $_formBlockType = 'eximbay/form';
|
26 |
+
protected $_infoBlockType = 'eximbay/info';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Availability options
|
30 |
+
*/
|
31 |
+
protected $_isGateway = true;
|
32 |
+
protected $_canAuthorize = true;
|
33 |
+
protected $_canCapture = true;
|
34 |
+
protected $_canCapturePartial = false;
|
35 |
+
protected $_canRefund = false;
|
36 |
+
protected $_canVoid = false;
|
37 |
+
protected $_canUseInternal = false;
|
38 |
+
protected $_canUseCheckout = true;
|
39 |
+
protected $_canUseForMultishipping = false;
|
40 |
+
|
41 |
+
protected $_paymentMethod = 'abstract';
|
42 |
+
protected $_defaultLocale = 'en';
|
43 |
+
protected $_supportedLocales = array('cn', 'cz', 'da', 'en', 'es', 'fi', 'de', 'fr', 'gr', 'it', 'nl', 'ro', 'ru', 'pl', 'sv', 'tr');
|
44 |
+
protected $_hidelogin = '1';
|
45 |
+
|
46 |
+
protected $_order;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get order model
|
50 |
+
*
|
51 |
+
* @return Mage_Sales_Model_Order
|
52 |
+
*/
|
53 |
+
public function getOrder()
|
54 |
+
{
|
55 |
+
if (!$this->_order) {
|
56 |
+
$this->_order = $this->getInfoInstance()->getOrder();
|
57 |
+
}
|
58 |
+
return $this->_order;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Return url for redirection after order placed
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function getOrderPlaceRedirectUrl()
|
66 |
+
{
|
67 |
+
return Mage::getUrl('eximbay/processing/payment');
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Capture payment through Moneybookers api
|
72 |
+
*
|
73 |
+
* @param Varien_Object $payment
|
74 |
+
* @param decimal $amount
|
75 |
+
* @return Phoenix_Moneybookers_Model_Abstract
|
76 |
+
*/
|
77 |
+
public function capture(Varien_Object $payment, $amount)
|
78 |
+
{
|
79 |
+
$payment->setStatus(self::STATUS_APPROVED)
|
80 |
+
->setTransactionId($this->getTransactionId())
|
81 |
+
->setIsTransactionClosed(0);
|
82 |
+
|
83 |
+
return $this;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Cancel payment
|
88 |
+
*
|
89 |
+
* @param Varien_Object $payment
|
90 |
+
* @return Phoenix_Moneybookers_Model_Abstract
|
91 |
+
*/
|
92 |
+
public function cancel(Varien_Object $payment)
|
93 |
+
{
|
94 |
+
$payment->setStatus(self::STATUS_DECLINED)
|
95 |
+
->setTransactionId($this->getTransactionId())
|
96 |
+
->setIsTransactionClosed(1);
|
97 |
+
|
98 |
+
return $this;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Return url of payment method
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getUrl()
|
107 |
+
{
|
108 |
+
return 'http://www.test2.eximbay.com/web/payment2.0/payment_real.do';
|
109 |
+
// return 'https://www.eximbay.com/web/payment2.0/payment_real.do';
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Return url of payment method
|
114 |
+
*
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function getLocale()
|
118 |
+
{
|
119 |
+
$locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
|
120 |
+
if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLocales)) {
|
121 |
+
return $locale[0];
|
122 |
+
}
|
123 |
+
return $this->getDefaultLocale();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* prepare params array to send it to gateway page via POST
|
128 |
+
*
|
129 |
+
* @return array
|
130 |
+
*/
|
131 |
+
public function getFormFields()
|
132 |
+
{
|
133 |
+
$order_id = $this->getOrder()->getRealOrderId();
|
134 |
+
$billing = $this->getOrder()->getBillingAddress();
|
135 |
+
$shipping = $this->getOrder()->getShippingAddress();
|
136 |
+
if ($this->getOrder()->getBillingAddress()->getEmail()) {
|
137 |
+
$email = $this->getOrder()->getBillingAddress()->getEmail();
|
138 |
+
} else {
|
139 |
+
$email = $this->getOrder()->getCustomerEmail();
|
140 |
+
}
|
141 |
+
$amt = round($this->getOrder()->getGrandTotal(), 2);
|
142 |
+
$secretKey = "289F40E6640124B2628640168C3C5464"; // test secret key
|
143 |
+
$mid = "1849705C64"; // test mid
|
144 |
+
$ref = "abcd1234567890";
|
145 |
+
$linkBuf = $secretKey. "?mid=" . $mid ."&ref=" . $ref ."&cur=" ."USD" ."&amt=" .$amt;
|
146 |
+
|
147 |
+
//$fgkey = md5($linkBuf);
|
148 |
+
$fgkey = hash("sha256", $linkBuf);
|
149 |
+
|
150 |
+
$quantity = $this->getOrder()->getTotalItemCount();
|
151 |
+
$total = 0;
|
152 |
+
|
153 |
+
//$quote = $this->getQuote();
|
154 |
+
//$billingaddress = $quote->getBillingAddress();
|
155 |
+
//$shippingaddress = $quote->getShippingAddress();
|
156 |
+
//billing
|
157 |
+
/* echo $billing->getData("street") . " ";
|
158 |
+
echo $billing->getData("postcode") . " ";
|
159 |
+
echo $billing->getData("city") . " ";
|
160 |
+
echo $billing->getRegionCode();
|
161 |
+
echo $billing->getCountry();
|
162 |
+
//shipping
|
163 |
+
echo $shipping->getName();
|
164 |
+
echo $shipping->getData("company");
|
165 |
+
echo $shipping->getData("street");
|
166 |
+
echo $shipping->getData("postcode");
|
167 |
+
echo $shipping->getData("city");
|
168 |
+
echo $shipping->getRegionCode();
|
169 |
+
echo $shipping->getRegion();
|
170 |
+
echo $shipping->getCountry();
|
171 |
+
echo $shipping->getCountryModel()->getName();*/
|
172 |
+
|
173 |
+
$params = array(
|
174 |
+
'ver' => '170',
|
175 |
+
'mid' => $mid,
|
176 |
+
'txntype' => 'SALE',
|
177 |
+
'displaytype' => 'I',
|
178 |
+
'secretkey' => $secretKey,
|
179 |
+
'ref' => $ref,
|
180 |
+
'email' => $email,
|
181 |
+
'transid' => $order_id,
|
182 |
+
'returnurl' => Mage::getUrl('eximbay/processing/success', array('transid' => $order_id)),
|
183 |
+
'fgkey' => $fgkey,
|
184 |
+
'lang' => 'KR', //$this->getLocale(),
|
185 |
+
'amt' => round($this->getOrder()->getGrandTotal(), 2),
|
186 |
+
'cur' => 'USD', //$this->getOrder()->getOrderCurrencyCode(),
|
187 |
+
'shop' => $this->getOrder()->getStore(),
|
188 |
+
'buyer' => $billing->getFirstname() . $billing->getLastname(),
|
189 |
+
'product' => $order_id,
|
190 |
+
'tel' => $billing->getTelephone(),
|
191 |
+
'payment_methods' => $this->_paymentMethod,
|
192 |
+
'hide_login' => $this->_hidelogin,
|
193 |
+
'new_window_redirect' => '1',
|
194 |
+
'rescode' => '',
|
195 |
+
'resmsg' => '',
|
196 |
+
'authcode' => '',
|
197 |
+
'visitorid' => '',
|
198 |
+
'dm_item_0_product' => $order_id,
|
199 |
+
'dm_item_0_quantity' => $quantity,
|
200 |
+
'dm_item_0_unitPrice' => round($this->getOrder()->getGrandTotal(), 2),
|
201 |
+
'dm_shipTo_city' => $shipping->getData("city"),
|
202 |
+
'dm_shipTo_country' => $shipping->getCountry(),
|
203 |
+
'dm_shipTo_firstName' => $shipping->getData("firstname"),
|
204 |
+
'dm_shipTo_lastName' => $shipping->getData("lastname"),
|
205 |
+
'dm_shipTo_phoneNumber' => $shipping->getTelephone(),
|
206 |
+
'dm_shipTo_postalCode' => $shipping->getData("postcode"),
|
207 |
+
'dm_shipTo_state' => $shipping->getRegionCode(),
|
208 |
+
'dm_shipTo_street1' => $shipping->getData("street")
|
209 |
+
);
|
210 |
+
|
211 |
+
return $params;
|
212 |
+
}
|
213 |
+
/**
|
214 |
+
* Get initialized flag status
|
215 |
+
* @return true
|
216 |
+
*/
|
217 |
+
public function isInitializeNeeded()
|
218 |
+
{
|
219 |
+
return true;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Instantiate state and set it to state onject
|
224 |
+
* //@param
|
225 |
+
* //@param
|
226 |
+
*/
|
227 |
+
public function initialize($paymentAction, $stateObject)
|
228 |
+
{
|
229 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
230 |
+
$stateObject->setState($state);
|
231 |
+
$stateObject->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
232 |
+
$stateObject->setIsNotified(false);
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Get config action to process initialization
|
237 |
+
*
|
238 |
+
* @return string
|
239 |
+
*/
|
240 |
+
public function getConfigPaymentAction()
|
241 |
+
{
|
242 |
+
$paymentAction = $this->getConfigData('payment_action');
|
243 |
+
return empty($paymentAction) ? true : $paymentAction;
|
244 |
+
}
|
245 |
+
}
|
app/code/core/Mage/Eximbay/Model/Acc.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_Model_Acc extends Mage_Eximbay_Model_Abstract
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* unique internal payment method identifier
|
22 |
+
*/
|
23 |
+
protected $_code = 'eximbay_acc';
|
24 |
+
protected $_paymentMethod = 'ACC';
|
25 |
+
}
|
app/code/core/Mage/Eximbay/Model/Event.php
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Eximbay's notification processor model
|
21 |
+
*/
|
22 |
+
class Mage_Eximbay_Model_Event
|
23 |
+
{
|
24 |
+
const EXIMBAY_STATUS_NOT_SUCCESS = -2;
|
25 |
+
const EXIMBAY_STATUS_SUCCESS = 2;
|
26 |
+
|
27 |
+
/*
|
28 |
+
* @param Mage_Sales_Model_Order
|
29 |
+
*/
|
30 |
+
protected $_order = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Event request data
|
34 |
+
* @var array
|
35 |
+
*/
|
36 |
+
protected $_eventData = array();
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Enent request data setter
|
40 |
+
* @param array $data
|
41 |
+
* @return Mage_Eximbay_Model_Event
|
42 |
+
*/
|
43 |
+
public function setEventData(array $data)
|
44 |
+
{
|
45 |
+
$this->_eventData = $data;
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Event request data getter
|
51 |
+
* @param string $key
|
52 |
+
* @return array|string
|
53 |
+
*/
|
54 |
+
public function getEventData($key = null)
|
55 |
+
{
|
56 |
+
if (null === $key) {
|
57 |
+
return $this->_eventData;
|
58 |
+
}
|
59 |
+
return isset($this->_eventData[$key]) ? $this->_eventData[$key] : null;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Get singleton of Checkout Session Model
|
64 |
+
*
|
65 |
+
* @return Mage_Checkout_Model_Session
|
66 |
+
*/
|
67 |
+
protected function _getCheckout()
|
68 |
+
{
|
69 |
+
return Mage::getSingleton('checkout/session');
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Process status notification from server
|
74 |
+
*
|
75 |
+
* @return String
|
76 |
+
*/
|
77 |
+
public function processStatusEvent()
|
78 |
+
{
|
79 |
+
try {
|
80 |
+
$params = $this->_validateEventData();
|
81 |
+
$msg = '';
|
82 |
+
switch($params['status']) {
|
83 |
+
case self::EXIMBAY_STATUS_NOT_SUCCESS: //fail or cancel
|
84 |
+
$msg = Mage::helper('eximbay')->__('Payment was not successful.');
|
85 |
+
$this->_processCancel($msg);
|
86 |
+
break;
|
87 |
+
case self::EXIMBAY_STATUS_SUCCESS: //ok
|
88 |
+
$msg = Mage::helper('eximbay')->__('The amount has been authorized and captured by EXIMBAY.');
|
89 |
+
$this->_processSale($params['status'], $msg);
|
90 |
+
break;
|
91 |
+
}
|
92 |
+
return $msg;
|
93 |
+
} catch (Mage_Core_Exception $e) {
|
94 |
+
return $e->getMessage();
|
95 |
+
} catch(Exception $e) {
|
96 |
+
Mage::logException($e);
|
97 |
+
}
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Process cancelation or fail
|
103 |
+
*/
|
104 |
+
public function cancelEvent() {
|
105 |
+
try {
|
106 |
+
$this->_validateEventData(false);
|
107 |
+
$this->_processCancel('Payment was not successful.');
|
108 |
+
return Mage::helper('eximbay')->__('The order was not completed.');
|
109 |
+
} catch (Mage_Core_Exception $e) {
|
110 |
+
return $e->getMessage();
|
111 |
+
} catch(Exception $e) {
|
112 |
+
Mage::logException($e);
|
113 |
+
}
|
114 |
+
return '';
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Validate request and return QuoteId
|
119 |
+
* Can throw Mage_Core_Exception and Exception
|
120 |
+
*
|
121 |
+
* @return int
|
122 |
+
*/
|
123 |
+
public function successEvent(){
|
124 |
+
$this->_validateEventData(false);
|
125 |
+
return $this->_order->getQuoteId();
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Processed order cancelation or fail
|
130 |
+
* @param string $msg Order history message
|
131 |
+
*/
|
132 |
+
protected function _processCancel($msg)
|
133 |
+
{
|
134 |
+
$this->_order->cancel();
|
135 |
+
$this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, $msg);
|
136 |
+
$this->_order->save();
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Processes payment confirmation, creates invoice if necessary, updates order status,
|
141 |
+
* sends order confirmation to customer
|
142 |
+
* @param string $msg Order history message
|
143 |
+
*/
|
144 |
+
protected function _processSale($status, $msg)
|
145 |
+
{
|
146 |
+
switch ($status) {
|
147 |
+
case self::EXIMBAY_STATUS_SUCCESS:
|
148 |
+
$this->_createInvoice();
|
149 |
+
$this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $msg);
|
150 |
+
$this->_order->setStatus(Mage_Sales_Model_Order::STATE_COMPLETE);
|
151 |
+
$this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_COMPLETE, 'Payment Completed', true);
|
152 |
+
// save transaction ID
|
153 |
+
$this->_order->getPayment()->setLastTransId($this->getEventData('transid'));
|
154 |
+
// send new order email
|
155 |
+
$this->_order->sendNewOrderEmail();
|
156 |
+
$this->_order->setEmailSent(true);
|
157 |
+
break;
|
158 |
+
}
|
159 |
+
$this->_order->save();
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Builds invoice for order
|
164 |
+
*/
|
165 |
+
protected function _createInvoice()
|
166 |
+
{
|
167 |
+
if (!$this->_order->canInvoice()) {
|
168 |
+
return;
|
169 |
+
}
|
170 |
+
$invoice = $this->_order->prepareInvoice();
|
171 |
+
$invoice->register()->capture();
|
172 |
+
$this->_order->addRelatedObject($invoice);
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Checking returned parameters
|
177 |
+
* Thorws Mage_Core_Exception if error
|
178 |
+
* @param bool $fullCheck Whether to make additional validations such as payment status etc.
|
179 |
+
*
|
180 |
+
* @return array $params request params
|
181 |
+
*/
|
182 |
+
protected function _validateEventData($fullCheck = true)
|
183 |
+
{
|
184 |
+
|
185 |
+
// get request variables
|
186 |
+
$params = $this->_eventData;
|
187 |
+
|
188 |
+
if (empty($params)) {
|
189 |
+
Mage::throwException('Request does not contain any elements.');
|
190 |
+
}
|
191 |
+
|
192 |
+
// check order ID
|
193 |
+
if (empty($params['transid'])
|
194 |
+
|| ($fullCheck == false && $this->_getCheckout()->getEximbayRealOrderId() != $params['transid'])
|
195 |
+
) {
|
196 |
+
Mage::throwException('Missing or invalid order ID.');
|
197 |
+
}
|
198 |
+
// load order for further validation
|
199 |
+
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($params['transid']);
|
200 |
+
if (!$this->_order->getId()) {
|
201 |
+
Mage::throwException('Order not found.');
|
202 |
+
}
|
203 |
+
|
204 |
+
if (0 !== strpos($this->_order->getPayment()->getMethodInstance()->getCode(), 'eximbay_')) {
|
205 |
+
Mage::throwException('Unknown payment method.');
|
206 |
+
}
|
207 |
+
|
208 |
+
// make additional validation
|
209 |
+
if ($fullCheck) {
|
210 |
+
// check payment status
|
211 |
+
if (empty($params['status'])) {
|
212 |
+
Mage::throwException('Unknown payment status.');
|
213 |
+
}
|
214 |
+
|
215 |
+
// check transaction amount if currency matches
|
216 |
+
if ($this->_order->getOrderCurrencyCode() == $params['cur']) {
|
217 |
+
if (round($this->_order->getGrandTotal(), 2) != $params['amt']) {
|
218 |
+
Mage::throwException('Transaction amount does not match.');
|
219 |
+
}
|
220 |
+
}
|
221 |
+
}
|
222 |
+
return $params;
|
223 |
+
}
|
224 |
+
}
|
app/code/core/Mage/Eximbay/controllers/EximbayController.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_EximbayController extends Mage_Adminhtml_Controller_Action
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Retrieve Eximbay's helper
|
22 |
+
*
|
23 |
+
* @return Mage_Eximbay_Helper_Data
|
24 |
+
*/
|
25 |
+
protected function _getHelper()
|
26 |
+
{
|
27 |
+
return Mage::helper('eximbay');
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Send activation Email
|
32 |
+
*/
|
33 |
+
public function activateemailAction()
|
34 |
+
{
|
35 |
+
$this->_getHelper()->activateEmail();
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Check if email is registered
|
40 |
+
*/
|
41 |
+
public function checkemailAction()
|
42 |
+
{
|
43 |
+
try {
|
44 |
+
$params = $this->getRequest()->getParams();
|
45 |
+
if (empty($params['email'])) {
|
46 |
+
Mage::throwException('Error: No parameters specified');
|
47 |
+
}
|
48 |
+
$response = $this->_getHelper()->checkEmailRequest($params);
|
49 |
+
if (empty($response)) {
|
50 |
+
Mage::throwException('Error: Connection to eximbay.com failed');
|
51 |
+
}
|
52 |
+
$this->getResponse()->setBody($response);
|
53 |
+
return;
|
54 |
+
} catch (Mage_Core_Exception $e) {
|
55 |
+
$response = $e->getMessage();
|
56 |
+
} catch (Exception $e) {
|
57 |
+
$response = 'Error: System error during request';
|
58 |
+
}
|
59 |
+
$this->getResponse()->setBody($response);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Check if entered secret is valid
|
64 |
+
*/
|
65 |
+
public function checksecretAction()
|
66 |
+
{
|
67 |
+
try {
|
68 |
+
$params = $this->getRequest()->getParams();
|
69 |
+
if (empty($params['email']) || empty($params['secret'])) {
|
70 |
+
Mage::throwException('Error: No parameters specified');
|
71 |
+
}
|
72 |
+
$response = $this->_getHelper()->checkSecretRequest($params);
|
73 |
+
if (empty($response)) {
|
74 |
+
Mage::throwException('Error: Connection to eximbay.com failed');
|
75 |
+
}
|
76 |
+
$this->getResponse()->setBody($response);
|
77 |
+
return;
|
78 |
+
} catch (Mage_Core_Exception $e) {
|
79 |
+
$response = $e->getMessage();
|
80 |
+
} catch (Exception $e) {
|
81 |
+
$response = 'Error: System error during request';
|
82 |
+
}
|
83 |
+
$this->getResponse()->setBody($response);
|
84 |
+
}
|
85 |
+
}
|
app/code/core/Mage/Eximbay/controllers/ProcessingController.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Mage
|
16 |
+
* @package Mage_Eximbay
|
17 |
+
*/
|
18 |
+
class Mage_Eximbay_ProcessingController extends Mage_Core_Controller_Front_Action
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Get singleton of Checkout Session Model
|
22 |
+
*
|
23 |
+
* @return Mage_Checkout_Model_Session
|
24 |
+
*/
|
25 |
+
protected function _getCheckout()
|
26 |
+
{
|
27 |
+
return Mage::getSingleton('checkout/session');
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Iframe page which submits the payment data to eximbay.
|
32 |
+
*/
|
33 |
+
public function placeformAction()
|
34 |
+
{
|
35 |
+
$this->loadLayout();
|
36 |
+
$this->renderLayout();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Show orderPlaceRedirect page which contains the eximbay iframe.
|
41 |
+
*/
|
42 |
+
public function paymentAction()
|
43 |
+
{
|
44 |
+
try {
|
45 |
+
$session = $this->_getCheckout();
|
46 |
+
|
47 |
+
$order = Mage::getModel('sales/order');
|
48 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
49 |
+
if (!$order->getId()) {
|
50 |
+
Mage::throwException('No order for processing found');
|
51 |
+
}
|
52 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
53 |
+
Mage::helper('eximbay')->__('The customer was redirected to eximbay.')
|
54 |
+
);
|
55 |
+
$order->save();
|
56 |
+
|
57 |
+
$session->setEximbayQuoteId($session->getQuoteId());
|
58 |
+
$session->setEximbayRealOrderId($session->getLastRealOrderId());
|
59 |
+
$session->getQuote()->setIsActive(false)->save();
|
60 |
+
$session->clear();
|
61 |
+
|
62 |
+
$this->loadLayout();
|
63 |
+
$this->renderLayout();
|
64 |
+
} catch (Exception $e){
|
65 |
+
Mage::logException($e);
|
66 |
+
parent::_redirect('checkout/cart');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Action to which the customer will be returned when the payment is successful or not successful.
|
72 |
+
*/
|
73 |
+
public function successAction()
|
74 |
+
{
|
75 |
+
$event = Mage::getModel('eximbay/event')
|
76 |
+
->setEventData($this->getRequest()->getParams());
|
77 |
+
|
78 |
+
$data = $event->getEventData();
|
79 |
+
|
80 |
+
try {
|
81 |
+
if ($data['rescode'] == '0000') // payment successful
|
82 |
+
{
|
83 |
+
$data["status"] = 2;
|
84 |
+
$event->setEventData($data);
|
85 |
+
$message = $event->processStatusEvent();
|
86 |
+
$quoteId = $event->successEvent();
|
87 |
+
$this->_getCheckout()->setLastSuccessQuoteId($quoteId);
|
88 |
+
$this->_redirect('checkout/onepage/success');
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
else // payment not successful
|
92 |
+
{
|
93 |
+
/*
|
94 |
+
$data['status'] = -2;
|
95 |
+
$event->setEventData($data);
|
96 |
+
$message = $event->processStatusEvent();
|
97 |
+
*/
|
98 |
+
$message = $event->cancelEvent();
|
99 |
+
|
100 |
+
// set quote to active
|
101 |
+
$session = $this->_getCheckout();
|
102 |
+
if ($quoteId = $session->getEximbayQuoteId()) {
|
103 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
104 |
+
if ($quote->getId()) {
|
105 |
+
$quote->setIsActive(true)->save();
|
106 |
+
$session->setQuoteId($quoteId);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
$session->addError($message);
|
111 |
+
$this->_redirect('checkout/cart');
|
112 |
+
}
|
113 |
+
|
114 |
+
} catch (Mage_Core_Exception $e) {
|
115 |
+
$this->_getCheckout()->addError($e->getMessage());
|
116 |
+
} catch(Exception $e) {
|
117 |
+
Mage::logException($e);
|
118 |
+
}
|
119 |
+
|
120 |
+
$this->getResponse()->setBody($message);
|
121 |
+
$this->_redirect('checkout/cart');
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Set redirect into responce. This has to be encapsulated in an JavaScript
|
126 |
+
* call to jump out of the iframe.
|
127 |
+
*
|
128 |
+
* @param string $path
|
129 |
+
* @param array $arguments
|
130 |
+
*/
|
131 |
+
protected function _redirect($path, $arguments=array())
|
132 |
+
{
|
133 |
+
$this->getResponse()->setBody(
|
134 |
+
$this->getLayout()
|
135 |
+
->createBlock('eximbay/redirect')
|
136 |
+
->setRedirectUrl(Mage::getUrl($path, $arguments))
|
137 |
+
->toHtml()
|
138 |
+
);
|
139 |
+
return $this;
|
140 |
+
}
|
141 |
+
}
|
app/code/core/Mage/Eximbay/etc/config.xml
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!-- /** *
|
3 |
+
*
|
4 |
+
* @title Magento -> Eximbay online payment
|
5 |
+
* @category Mage
|
6 |
+
* @package Mage_Eximbay
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<global>
|
11 |
+
<!-- declare model group for new module -->
|
12 |
+
<models>
|
13 |
+
<!-- model group alias to be used in Mage::getModel('newmodule/...') -->
|
14 |
+
<eximbay>
|
15 |
+
<!-- base class name for the model group -->
|
16 |
+
<class>Mage_Eximbay_Model</class>
|
17 |
+
</eximbay>
|
18 |
+
</models>
|
19 |
+
<helpers>
|
20 |
+
<eximbay>
|
21 |
+
<class>Mage_Eximbay_Helper</class>
|
22 |
+
</eximbay>
|
23 |
+
</helpers>
|
24 |
+
|
25 |
+
<!-- declare resource setup for new module -->
|
26 |
+
<resources> <!-- resource identifier -->
|
27 |
+
<eximbay_setup>
|
28 |
+
<!-- specify that this resource is a setup resource and used for upgrades -->
|
29 |
+
<setup>
|
30 |
+
<!-- which module to look for install/upgrade files in -->
|
31 |
+
<module>Mage_Eximbay</module>
|
32 |
+
</setup>
|
33 |
+
<!-- specify database connection for this resource -->
|
34 |
+
<connection>
|
35 |
+
<!-- do not create new connection, use predefined core setup connection -->
|
36 |
+
<use>core_setup</use>
|
37 |
+
</connection>
|
38 |
+
</eximbay_setup>
|
39 |
+
<eximbay_write>
|
40 |
+
<use>core_write</use>
|
41 |
+
</eximbay_write>
|
42 |
+
<eximbay_read>
|
43 |
+
<use>core_read</use>
|
44 |
+
</eximbay_read>
|
45 |
+
</resources>
|
46 |
+
<blocks>
|
47 |
+
<eximbay><class>Mage_Eximbay_Block</class></eximbay>
|
48 |
+
</blocks>
|
49 |
+
<payment>
|
50 |
+
<groups>
|
51 |
+
<xbay>Eximbay</xbay>
|
52 |
+
</groups>
|
53 |
+
</payment>
|
54 |
+
</global>
|
55 |
+
|
56 |
+
<frontend>
|
57 |
+
<secure_url>
|
58 |
+
<eximbay_processing>/eximbay/processing</eximbay_processing>
|
59 |
+
</secure_url>
|
60 |
+
<routers>
|
61 |
+
<eximbay>
|
62 |
+
<use>standard</use>
|
63 |
+
<args>
|
64 |
+
<module>Mage_Eximbay</module>
|
65 |
+
<frontName>eximbay</frontName>
|
66 |
+
</args>
|
67 |
+
</eximbay>
|
68 |
+
</routers>
|
69 |
+
<layout>
|
70 |
+
<updates>
|
71 |
+
<eximbay>
|
72 |
+
<file>eximbay.xml</file>
|
73 |
+
</eximbay>
|
74 |
+
</updates>
|
75 |
+
</layout>
|
76 |
+
</frontend>
|
77 |
+
<admin>
|
78 |
+
<routers>
|
79 |
+
<adminhtml>
|
80 |
+
<args>
|
81 |
+
<modules>
|
82 |
+
<eximbay after="Mage_Adminhtml">Mage_Eximbay</eximbay>
|
83 |
+
</modules>
|
84 |
+
</args>
|
85 |
+
</adminhtml>
|
86 |
+
</routers>
|
87 |
+
</admin>
|
88 |
+
<adminhtml>
|
89 |
+
<translate>
|
90 |
+
<modules>
|
91 |
+
<Mage_Eximbay>
|
92 |
+
<files>
|
93 |
+
<default>Mage_Eximbay.csv</default>
|
94 |
+
</files>
|
95 |
+
</Mage_Eximbay>
|
96 |
+
</modules>
|
97 |
+
</translate>
|
98 |
+
<layout>
|
99 |
+
<updates>
|
100 |
+
<eximbay>
|
101 |
+
<file>eximbay.xml</file>
|
102 |
+
</eximbay>
|
103 |
+
</updates>
|
104 |
+
</layout>
|
105 |
+
<acl>
|
106 |
+
<resources>
|
107 |
+
<admin>
|
108 |
+
<children>
|
109 |
+
<system>
|
110 |
+
<children>
|
111 |
+
<config>
|
112 |
+
<children>
|
113 |
+
<eximbay translate="title" module="eximbay">
|
114 |
+
<title>Eximbay Settings</title>
|
115 |
+
</eximbay>
|
116 |
+
</children>
|
117 |
+
</config>
|
118 |
+
</children>
|
119 |
+
</system>
|
120 |
+
</children>
|
121 |
+
</admin>
|
122 |
+
</resources>
|
123 |
+
</acl>
|
124 |
+
</adminhtml>
|
125 |
+
|
126 |
+
<!-- declare default configuration values for this module -->
|
127 |
+
<default>
|
128 |
+
<!-- 'payment' configuration section (tab) -->
|
129 |
+
<payment>
|
130 |
+
<!-- 'newmodule' configuration group (fieldset) -->
|
131 |
+
|
132 |
+
<eximbay_acc>
|
133 |
+
<group>xbay</group>
|
134 |
+
<active>1</active>
|
135 |
+
<model>eximbay/acc</model>
|
136 |
+
<title>Eximbay</title>
|
137 |
+
<allowspecific>0</allowspecific>
|
138 |
+
</eximbay_acc>
|
139 |
+
</payment>
|
140 |
+
<eximbay>
|
141 |
+
<settings>
|
142 |
+
<activationstatus>0</activationstatus>
|
143 |
+
</settings>
|
144 |
+
</eximbay>
|
145 |
+
</default>
|
146 |
+
</config>
|
app/code/core/Mage/Eximbay/etc/system.xml
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!-- /** *
|
3 |
+
* @title Magento -> Eximbay online payment
|
4 |
+
* @category Mage
|
5 |
+
* @package Mage_Eximbay
|
6 |
+
*/ -->
|
7 |
+
<config>
|
8 |
+
<sections>
|
9 |
+
<!-- payment tab -->
|
10 |
+
<payment>
|
11 |
+
<groups>
|
12 |
+
|
13 |
+
<!-- newmodule fieldset -->
|
14 |
+
<eximbay translate="label" module="paygate">
|
15 |
+
<!-- will have title 'Cash On Delivery' -->
|
16 |
+
<label>Eximbay</label>
|
17 |
+
<!-- position between other payment methods -->
|
18 |
+
<sort_order>670</sort_order>
|
19 |
+
<!-- do not show this configuration options in store scope -->
|
20 |
+
<show_in_default>1</show_in_default>
|
21 |
+
<show_in_website>1</show_in_website>
|
22 |
+
<show_in_store>0</show_in_store>
|
23 |
+
<fields>
|
24 |
+
<!-- is this payment method active for the website? -->
|
25 |
+
<active translate="label">
|
26 |
+
<!-- label for the field -->
|
27 |
+
<label>Enabled</label>
|
28 |
+
<!-- input type for configuration value -->
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<!-- model to take the option values from -->
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<!-- field position -->
|
33 |
+
<sort_order>1</sort_order>
|
34 |
+
<!-- do not show this field in store scope -->
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</active>
|
39 |
+
<order_status translate="label">
|
40 |
+
<label>New order status</label>
|
41 |
+
<frontend_type>select</frontend_type>
|
42 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
43 |
+
<!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
|
44 |
+
<!--<source_model>adminhtml/system_config_source_order_status_processing</source_model>-->
|
45 |
+
<sort_order>4</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>0</show_in_store>
|
49 |
+
</order_status>
|
50 |
+
<allowspecific translate="label">
|
51 |
+
<label>Payment from applicable countries</label>
|
52 |
+
<frontend_type>allowspecific</frontend_type>
|
53 |
+
<sort_order>50</sort_order>
|
54 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>1</show_in_store>
|
58 |
+
</allowspecific>
|
59 |
+
|
60 |
+
<!--<submit_url>
|
61 |
+
<label>Gateway URL</label>
|
62 |
+
<frontend_type>text</frontend_type>
|
63 |
+
<sort_order>58</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>0</show_in_store>
|
67 |
+
</submit_url>
|
68 |
+
-->
|
69 |
+
<specificcountry translate="label">
|
70 |
+
<label>Payment from Specific countries</label>
|
71 |
+
<frontend_type>multiselect</frontend_type>
|
72 |
+
<sort_order>51</sort_order>
|
73 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
74 |
+
<show_in_default>1</show_in_default>
|
75 |
+
<show_in_website>1</show_in_website>
|
76 |
+
<show_in_store>1</show_in_store>
|
77 |
+
</specificcountry>
|
78 |
+
<title translate="label">
|
79 |
+
<label>Title</label>
|
80 |
+
<frontend_type>text</frontend_type>
|
81 |
+
<sort_order>2</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>0</show_in_store>
|
85 |
+
</title>
|
86 |
+
</fields>
|
87 |
+
</eximbay>
|
88 |
+
</groups>
|
89 |
+
</payment>
|
90 |
+
</sections>
|
91 |
+
</config>
|
app/code/core/Mage/Eximbay/etc/system.xml.bak
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!-- /** *
|
3 |
+
* @title Magento -> Eximbay online payment
|
4 |
+
* @category Mage
|
5 |
+
* @package Mage_Eximbay
|
6 |
+
*/ -->
|
7 |
+
<config>
|
8 |
+
<sections>
|
9 |
+
<!-- payment tab -->
|
10 |
+
<payment>
|
11 |
+
<groups>
|
12 |
+
|
13 |
+
<!-- newmodule fieldset -->
|
14 |
+
<eximbay translate="label" module="paygate">
|
15 |
+
<!-- will have title 'Cash On Delivery' -->
|
16 |
+
<label>クレジット決済</label>
|
17 |
+
<!-- position between other payment methods -->
|
18 |
+
<sort_order>670</sort_order>
|
19 |
+
<!-- do not show this configuration options in store scope -->
|
20 |
+
<show_in_default>1</show_in_default>
|
21 |
+
<show_in_website>1</show_in_website>
|
22 |
+
<show_in_store>0</show_in_store>
|
23 |
+
<fields>
|
24 |
+
<!-- is this payment method active for the website? -->
|
25 |
+
<active translate="label">
|
26 |
+
<!-- label for the field -->
|
27 |
+
<label>Enabled</label>
|
28 |
+
<!-- input type for configuration value -->
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<!-- model to take the option values from -->
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<!-- field position -->
|
33 |
+
<sort_order>1</sort_order>
|
34 |
+
<!-- do not show this field in store scope -->
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</active>
|
39 |
+
<order_status translate="label">
|
40 |
+
<label>New order status</label>
|
41 |
+
<frontend_type>select</frontend_type>
|
42 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
43 |
+
<!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
|
44 |
+
<!--<source_model>adminhtml/system_config_source_order_status_processing</source_model>-->
|
45 |
+
<sort_order>4</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>0</show_in_store>
|
49 |
+
</order_status>
|
50 |
+
<allowspecific translate="label">
|
51 |
+
<label>Payment from applicable countries</label>
|
52 |
+
<frontend_type>allowspecific</frontend_type>
|
53 |
+
<sort_order>50</sort_order>
|
54 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>1</show_in_store>
|
58 |
+
</allowspecific>
|
59 |
+
|
60 |
+
<!--<submit_url>
|
61 |
+
<label>Gateway URL</label>
|
62 |
+
<frontend_type>text</frontend_type>
|
63 |
+
<sort_order>58</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>0</show_in_store>
|
67 |
+
</submit_url>
|
68 |
+
-->
|
69 |
+
<specificcountry translate="label">
|
70 |
+
<label>Payment from Specific countries</label>
|
71 |
+
<frontend_type>multiselect</frontend_type>
|
72 |
+
<sort_order>51</sort_order>
|
73 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
74 |
+
<show_in_default>1</show_in_default>
|
75 |
+
<show_in_website>1</show_in_website>
|
76 |
+
<show_in_store>1</show_in_store>
|
77 |
+
</specificcountry>
|
78 |
+
<title translate="label">
|
79 |
+
<label>Title</label>
|
80 |
+
<frontend_type>text</frontend_type>
|
81 |
+
<sort_order>2</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>0</show_in_store>
|
85 |
+
</title>
|
86 |
+
</fields>
|
87 |
+
</eximbay>
|
88 |
+
</groups>
|
89 |
+
</payment>
|
90 |
+
</sections>
|
91 |
+
</config>
|
app/code/core/Mage/Eximbay/sql/eximbay_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
<?php
|
3 |
+
// here are the table creation for this module e.g.:
|
4 |
+
$this->startSetup();
|
5 |
+
$this->run("HERE YOUR SQL");
|
6 |
+
$this->endSetup(); ?>
|
7 |
+
*/
|
8 |
+
|
9 |
+
<?php
|
10 |
+
|
11 |
+
$code = 'eximbay';
|
12 |
+
$installer = $this;
|
13 |
+
|
14 |
+
?>
|
app/code/core/Mage/Eximbay/sql/eximbay_setup/mysql4-ugrade-0.1.0-0.2.0.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
6 |
+
* that is bundled with this package in the file LICENSE.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://opensource.org/licenses/osl-3.0.php
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
12 |
+
* @category Mage
|
13 |
+
* @package Mage_Eximbay
|
14 |
+
*/
|
15 |
+
|
16 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
17 |
+
$installer = $this;
|
18 |
+
|
19 |
+
$installer->startSetup();
|
20 |
+
$conn = $installer->getConnection();
|
21 |
+
|
22 |
+
$select = $conn
|
23 |
+
->select()
|
24 |
+
->from($this->getTable('core/config_data'), array('scope', 'scope_id', 'path', 'value'))
|
25 |
+
->where(new Zend_Db_Expr("path LIKE 'eximbay/eximbay%'"));
|
26 |
+
$data = $conn->fetchAll($select);
|
27 |
+
|
28 |
+
if (!empty($data)) {
|
29 |
+
foreach ($data as $key => $value) {
|
30 |
+
$data[$key]['path'] = preg_replace('/^eximbay\/eximbay/', 'payment/eximbay', $value['path']);
|
31 |
+
}
|
32 |
+
$conn->insertOnDuplicate($this->getTable('core/config_data'), $data, array('path'));
|
33 |
+
$conn->delete($this->getTable('core/config_data'), new Zend_Db_Expr("path LIKE 'eximbay/eximbay%'"));
|
34 |
+
}
|
35 |
+
$installer->endSetup();
|
app/etc/modules/Mage_Eximbay.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<!-- declare Mage_NewModule module -->
|
4 |
+
<Mage_Eximbay>
|
5 |
+
<!-- this is an active module -->
|
6 |
+
<active>true</active>
|
7 |
+
<!-- this module will be located in app/code/core code pool -->
|
8 |
+
<codePool>core</codePool>
|
9 |
+
<!-- specify dependencies for correct module loading order -->
|
10 |
+
<depends>
|
11 |
+
<Mage_Payment />
|
12 |
+
</depends>
|
13 |
+
<!-- declare module's version information for database updates -->
|
14 |
+
<!--<version>0.1.0</version> -->
|
15 |
+
</Mage_Eximbay>
|
16 |
+
</modules>
|
17 |
+
</config>
|
app/locale/en_US/Mage_Eximbay.csv
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"All Credit Cards / Visa, Mastercard, AMEX, JCB, Diners (powered by Eximbay) - International","All Credit Cards / Visa, Mastercard, AMEX, JCB, Diners (powered by Eximbay) - International"
|
2 |
+
"Merchant ID","Merchant ID"
|
3 |
+
"Enabled","Enabled"
|
4 |
+
"Loading secure payment page (SSL)","Loading secure payment page (SSL)"
|
5 |
+
"Eximbay","Eximbay"
|
6 |
+
"Eximbay Settings","Eximbay Settings"
|
7 |
+
"Eximbay Transaction ID: %s","Eximbay Transaction ID: %s"
|
8 |
+
"More information about Eximbay","More information about Eximbay"
|
9 |
+
"Order ID","Order ID"
|
10 |
+
"Payment failed.","Payment failed."
|
11 |
+
"Payment from Applicable Countries","Payment from Applicable Countries"
|
12 |
+
"Payment from Specific Countries","Payment from Specific Countries"
|
13 |
+
"Payment has not been processed yet.","Payment has not been processed yet."
|
14 |
+
"Payment was canceled.","Payment was canceled."
|
15 |
+
"Please pay your order now","Please pay your order now"
|
16 |
+
"Powered by Eximbay","Powered by Eximbay"
|
17 |
+
"Sort Order","Sort Order"
|
18 |
+
"The amount has been authorized and captured by Eximbay.","The amount has been authorized and captured by Eximbay."
|
19 |
+
"The customer was redirected to Eximbay.","The customer was redirected to Eximbay."
|
20 |
+
"The order has been canceled.","The order has been canceled."
|
21 |
+
"Title","Title"
|
22 |
+
"You will be redirected to our secure payment page when you place an order.","You will be redirected to our secure payment page when you place an order."
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Eximbay</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>alpha</stability>
|
6 |
+
<license>GNU General Public License (GPL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Eximbay payment method</summary>
|
10 |
+
<description>Eximbay payment method</description>
|
11 |
+
<notes>version 1.0.0</notes>
|
12 |
+
<authors><author><name>Uuganbayar Choijiljav</name><user>prokod1</user><email>prokod@kr.net</email></author></authors>
|
13 |
+
<date>2013-10-24</date>
|
14 |
+
<time>08:55:29</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Mage_Eximbay.xml" hash="78ce59927bffa7163be76a212b7a8a05"/></dir></target><target name="magecore"><dir name="Mage"><dir name="Eximbay"><dir name="Block"><file name="Form.php" hash="c136c409bd2da338b3f7b8556d3fe4d5"/><file name="Info.php" hash="c939936fc479ce1a65c58c2e98e70fce"/><file name="Jsinit.php" hash="06148fcee5d942468dcee0fcc886270d"/><file name="Payment.php" hash="cbf3b8d0bfe95d03289869e3838d4f45"/><file name="Placeform.php" hash="999a5d5c9f4fdbd01dcbcb0591e90539"/><file name="Redirect.php" hash="e608839da14837552ef7ae3afaf3e98d"/></dir><dir name="Helper"><file name="Data.php" hash="6324208aca4be67ddb55a1e4480d34ac"/></dir><dir name="Model"><file name="Abstract.php" hash="d77ac7d2a9def4f230def803c61bf263"/><file name="Abstract.php.bak" hash="effb3df9f99b070500508f357563e33c"/><file name="Acc.php" hash="7befc287331bd799c52eb1fb4998ea1e"/><file name="Event.php" hash="b92cac57fec274aa193a77d0b0bf34b4"/></dir><dir name="controllers"><file name="EximbayController.php" hash="2bbe77335c2c88b3e5f9443d647311b5"/><file name="ProcessingController.php" hash="0a56a1ce97ddf2f1ddd03c6d2a22edd0"/></dir><dir name="etc"><file name="config.xml" hash="cf7402d7078eadbd12c606d131f14c2d"/><file name="system.xml" hash="0cb924ab86067eaf929d0b745331cf26"/><file name="system.xml.bak" hash="c2bd31c555982f275634b566685a23dd"/></dir><dir name="sql"><dir name="eximbay_setup"><file name="mysql4-install-0.1.0.php" hash="e5ac79ae72b8235c962bf48bc548b263"/><file name="mysql4-ugrade-0.1.0-0.2.0.php" hash="8318415b1af458fb86c449c502b8eda0"/></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Mage_Eximbay.csv" hash="dcea44085c5e6f5bd41b49eb9333863d"/></dir></dir></target><target name="magelocal"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="eximbay.xml" hash=""/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="eximbay.xml" hash=""/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0.0</min><max>1.8</max></package><extension><name>Core</name><min>1.5.0.0</min><max>1.8</max></extension></required></dependencies>
|
18 |
+
</package>
|