Version Notes
First stable release
Download this release
Release Info
Developer | J2T DESIGN |
Extension | J2t_Payplug |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/J2t/All/Helper/Data.php +5 -0
- app/code/community/J2t/All/Model/Feed.php +104 -0
- app/code/community/J2t/All/Model/Observer.php +14 -0
- app/code/community/J2t/All/etc/config.xml +76 -0
- app/code/community/J2t/All/etc/system.xml +59 -0
- app/code/community/J2t/Payplug/Block/Adminhtml/System/Config/Accountdetails.php +37 -0
- app/code/community/J2t/Payplug/Block/Form.php +46 -0
- app/code/community/J2t/Payplug/Block/Info.php +42 -0
- app/code/community/J2t/Payplug/Helper/Data.php +23 -0
- app/code/community/J2t/Payplug/Model/Observer.php +96 -0
- app/code/community/J2t/Payplug/Model/PaymentMethod.php +179 -0
- app/code/community/J2t/Payplug/controllers/PaymentController.php +159 -0
- app/code/community/J2t/Payplug/etc/config.xml +122 -0
- app/code/community/J2t/Payplug/etc/system.xml +200 -0
- app/code/community/J2t/Payplug/sql/j2tpayplug_setup/install-1.0.0.php +45 -0
- app/design/adminhtml/default/default/layout/j2t_all.xml +10 -0
- app/design/frontend/base/default/template/j2tpayplug/form.phtml +33 -0
- app/design/frontend/base/default/template/j2tpayplug/info.phtml +28 -0
- app/etc/modules/J2t_All.xml +9 -0
- app/etc/modules/J2t_Payplug.xml +11 -0
- package.xml +18 -0
- skin/adminhtml/default/default/images/j2t/ajax_cart.png +0 -0
- skin/adminhtml/default/default/images/j2t/ajax_cart_2.png +0 -0
- skin/adminhtml/default/default/images/j2t/auto_add.png +0 -0
- skin/adminhtml/default/default/images/j2t/color_swatch.png +0 -0
- skin/adminhtml/default/default/images/j2t/discountlabel.png +0 -0
- skin/adminhtml/default/default/images/j2t/gift_voucher.png +0 -0
- skin/adminhtml/default/default/images/j2t/gift_wrap.png +0 -0
- skin/adminhtml/default/default/images/j2t/one_checkout.png +0 -0
- skin/adminhtml/default/default/images/j2t/product_hold.png +0 -0
- skin/adminhtml/default/default/images/j2t/productpreview.png +0 -0
- skin/adminhtml/default/default/images/j2t/reward_points.png +0 -0
- skin/adminhtml/default/default/images/j2t/sandbox.png +0 -0
- skin/adminhtml/default/default/images/j2t/social_connect.png +0 -0
- skin/adminhtml/default/default/images/j2t/support.png +0 -0
- skin/adminhtml/default/default/images/j2t_all.png +0 -0
- skin/adminhtml/default/default/j2t_all_admin.css +78 -0
app/code/community/J2t/All/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class J2t_All_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
}
|
app/code/community/J2t/All/Model/Feed.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
Class J2t_All_Model_Feed extends Mage_AdminNotification_Model_Feed {
|
3 |
+
|
4 |
+
const XML_FEED_URL_PATH_J2T = 'system/j2t_all/feed_url_j2t';
|
5 |
+
|
6 |
+
protected $_feedUrlJ2t;
|
7 |
+
|
8 |
+
public function checkUpdate()
|
9 |
+
{
|
10 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
$feedData = array();
|
15 |
+
|
16 |
+
$feedXml = $this->getFeedData();
|
17 |
+
|
18 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
19 |
+
foreach ($feedXml->channel->item as $item) {
|
20 |
+
$feedData[] = array(
|
21 |
+
'severity' => (int)$item->severity,
|
22 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
23 |
+
'title' => (string)$item->title,
|
24 |
+
'description' => (string)$item->description,
|
25 |
+
'url' => (string)$item->link,
|
26 |
+
);
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
+
if ($feedData) {
|
31 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
$this->setLastUpdate();
|
37 |
+
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Retrieve Last update time
|
44 |
+
*
|
45 |
+
* @return int
|
46 |
+
*/
|
47 |
+
public function getLastUpdate()
|
48 |
+
{
|
49 |
+
return Mage::app()->loadCache('j2t_notifications_lastcheck');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Set last update time (now)
|
54 |
+
*
|
55 |
+
* @return Mage_AdminNotification_Model_Feed
|
56 |
+
*/
|
57 |
+
public function setLastUpdate()
|
58 |
+
{
|
59 |
+
Mage::app()->saveCache(time(), 'j2t_notifications_lastcheck');
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
public function getFeedUrl()
|
66 |
+
{
|
67 |
+
if (is_null($this->_feedUrlJ2t)) {
|
68 |
+
$this->_feedUrlJ2t = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://')
|
69 |
+
. Mage::getStoreConfig(self::XML_FEED_URL_PATH_J2T);
|
70 |
+
}
|
71 |
+
return $this->_feedUrlJ2t;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
public function getFeedData()
|
76 |
+
{
|
77 |
+
$curl = new Varien_Http_Adapter_Curl();
|
78 |
+
$curl->setConfig(array(
|
79 |
+
'timeout' => 3
|
80 |
+
));
|
81 |
+
|
82 |
+
$curl->write(Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
|
83 |
+
$data = $curl->read();
|
84 |
+
if ($data === false) {
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
88 |
+
$data = trim($data[1]);
|
89 |
+
$curl->close();
|
90 |
+
|
91 |
+
try {
|
92 |
+
$xml = new SimpleXMLElement($data);
|
93 |
+
}
|
94 |
+
catch (Exception $e) {
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
|
98 |
+
return $xml;
|
99 |
+
}
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
?>
|
app/code/community/J2t/All/Model/Observer.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class J2t_All_Model_Observer
|
3 |
+
{
|
4 |
+
public function preDispatch(Varien_Event_Observer $observer)
|
5 |
+
{
|
6 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
7 |
+
$feedModel = Mage::getModel('j2t_all/feed');
|
8 |
+
/* @var $feedModel Mage_AdminNotification_Model_Feed */
|
9 |
+
|
10 |
+
$feedModel->checkUpdate();
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
14 |
+
}
|
app/code/community/J2t/All/etc/config.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<J2t_All>
|
6 |
+
<version>1.0.0</version>
|
7 |
+
</J2t_All>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<global>
|
11 |
+
<models>
|
12 |
+
<j2t_all>
|
13 |
+
<class>J2t_All_Model</class>
|
14 |
+
</j2t_all>
|
15 |
+
</models>
|
16 |
+
<helpers>
|
17 |
+
<j2t_all>
|
18 |
+
<class>J2t_All_Helper</class>
|
19 |
+
</j2t_all>
|
20 |
+
</helpers>
|
21 |
+
<!--<blocks>
|
22 |
+
<productalert>
|
23 |
+
<class>Mage_AdminNotification_Block</class>
|
24 |
+
</productalert>
|
25 |
+
</blocks>-->
|
26 |
+
</global>
|
27 |
+
|
28 |
+
<adminhtml>
|
29 |
+
<layout>
|
30 |
+
<updates>
|
31 |
+
<j2t_all module="j2t_all">
|
32 |
+
<file>j2t_all.xml</file>
|
33 |
+
</j2t_all>
|
34 |
+
</updates>
|
35 |
+
</layout>
|
36 |
+
<events>
|
37 |
+
<controller_action_predispatch>
|
38 |
+
<observers>
|
39 |
+
<j2t_all>
|
40 |
+
<class>j2t_all/observer</class>
|
41 |
+
<method>preDispatch</method>
|
42 |
+
</j2t_all>
|
43 |
+
</observers>
|
44 |
+
</controller_action_predispatch>
|
45 |
+
</events>
|
46 |
+
|
47 |
+
<acl>
|
48 |
+
<resources>
|
49 |
+
<admin>
|
50 |
+
<children>
|
51 |
+
<system>
|
52 |
+
<children>
|
53 |
+
<config>
|
54 |
+
<children>
|
55 |
+
<j2t_all>
|
56 |
+
<title>J2T All</title>
|
57 |
+
</j2t_all>
|
58 |
+
</children>
|
59 |
+
</config>
|
60 |
+
</children>
|
61 |
+
</system>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
|
67 |
+
</adminhtml>
|
68 |
+
|
69 |
+
<default>
|
70 |
+
<system>
|
71 |
+
<j2t_all>
|
72 |
+
<feed_url_j2t>j2t-design.net/notifications.rss</feed_url_j2t>
|
73 |
+
</j2t_all>
|
74 |
+
</system>
|
75 |
+
</default>
|
76 |
+
</config>
|
app/code/community/J2t/All/etc/system.xml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<tabs>
|
3 |
+
<j2t_all>
|
4 |
+
<label>J2T Modules</label>
|
5 |
+
<class>j2t-all-area</class>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</j2t_all>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<j2t_all translate="label comment" module="j2t_all">
|
11 |
+
<tab>j2t_all</tab>
|
12 |
+
<class>j2t-all-tab</class>
|
13 |
+
<label>Our Products...</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1000</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 |
+
<groups>
|
20 |
+
<default translate="label comment" module="j2t_all">
|
21 |
+
<label>J2T DESIGN</label>
|
22 |
+
|
23 |
+
<comment><![CDATA[
|
24 |
+
<script type="text/javascript">
|
25 |
+
document.observe("dom:loaded", function() {
|
26 |
+
$$('.content-header .form-buttons').invoke('hide');
|
27 |
+
$$('.middle .main-col-inner')[0].style.height = '1400px';
|
28 |
+
var url_j2t = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.j2t-design.net/index.php/j2t-products?limit=25';
|
29 |
+
$$('.middle .entry-edit')[0].replace('<iframe src="'+url_j2t+'" style="width:100%; height:1400px; border:none;"></iframe>');
|
30 |
+
});
|
31 |
+
</script>
|
32 |
+
]]>
|
33 |
+
</comment>
|
34 |
+
|
35 |
+
|
36 |
+
<frontend_type>text</frontend_type>
|
37 |
+
<sort_order>10</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
|
42 |
+
<fields>
|
43 |
+
<j2t_all translate="label">
|
44 |
+
<label>All Modules</label>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
47 |
+
<sort_order>10</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
<comment><![CDATA[Activate/deactivate all modules.]]></comment>
|
52 |
+
</j2t_all>
|
53 |
+
</fields>
|
54 |
+
</default>
|
55 |
+
|
56 |
+
</groups>
|
57 |
+
</j2t_all>
|
58 |
+
</sections>
|
59 |
+
</config>
|
app/code/community/J2t/Payplug/Block/Adminhtml/System/Config/Accountdetails.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class J2t_Payplug_Block_Adminhtml_System_Config_Accountdetails extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) // store level
|
8 |
+
{
|
9 |
+
$store_id = Mage::getModel('core/store')->load($code)->getId();
|
10 |
+
}
|
11 |
+
elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) // website level
|
12 |
+
{
|
13 |
+
$website_id = Mage::getModel('core/website')->load($code)->getId();
|
14 |
+
$store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
|
15 |
+
}
|
16 |
+
else // default level
|
17 |
+
{
|
18 |
+
$store_id = 0;
|
19 |
+
}
|
20 |
+
|
21 |
+
$currency = Mage::getStoreConfig('payment/j2tpayplug/currencies', $store_id);
|
22 |
+
$return_val = array();
|
23 |
+
|
24 |
+
if (Mage::getStoreConfig('payment/j2tpayplug/user', $store_id) && Mage::getStoreConfig('payment/j2tpayplug/min_amount', $store_id)
|
25 |
+
&& Mage::getStoreConfig('payment/j2tpayplug/max_amount', $store_id) && $currency){
|
26 |
+
$return_val[] = Mage::helper('j2tpayplug')->__('User: %s', Mage::getStoreConfig('payment/j2tpayplug/user', $store_id));
|
27 |
+
$return_val[] = Mage::helper('j2tpayplug')->__('Min allowed amount: %s %s', Mage::getStoreConfig('payment/j2tpayplug/min_amount', $store_id), $currency);
|
28 |
+
$return_val[] = Mage::helper('j2tpayplug')->__('Max allowed amount: %s %s', Mage::getStoreConfig('payment/j2tpayplug/max_amount', $store_id), $currency);
|
29 |
+
$return_val[] = Mage::helper('j2tpayplug')->__('Currency: %s', $currency);
|
30 |
+
} else {
|
31 |
+
$return_val[] = Mage::helper('j2tpayplug')->__('Not configured yet');
|
32 |
+
}
|
33 |
+
|
34 |
+
return implode("<br />", $return_val);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
app/code/community/J2t/Payplug/Block/Form.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 J2T Design
|
16 |
+
* @package J2t_Payplug
|
17 |
+
* @copyright Copyright (c) 2014 J2T Design (http://www.j2t-design.net)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class J2t_Payplug_Block_Form extends Mage_Payment_Block_Form
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Available locales for content URL generation
|
24 |
+
*
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
protected $_supportedInfoLocales = array('fr');
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Default locale for content URL generation
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
protected $_defaultInfoLocale = 'en';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Constructor. Set template.
|
38 |
+
*/
|
39 |
+
protected function _construct()
|
40 |
+
{
|
41 |
+
parent::_construct();
|
42 |
+
$this->setTemplate('j2tpayplug/form.phtml');
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
}
|
app/code/community/J2t/Payplug/Block/Info.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 J2T Design
|
16 |
+
* @package J2t_Payplug
|
17 |
+
* @copyright Copyright (c) 2014 J2T Design (http://www.j2t-design.net)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class J2t_Payplug_Block_Info extends Mage_Payment_Block_Info
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Constructor. Set template.
|
24 |
+
*/
|
25 |
+
protected function _construct()
|
26 |
+
{
|
27 |
+
parent::_construct();
|
28 |
+
$this->setTemplate('j2tpayplug/info.phtml');
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns code of payment method
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getMethodCode()
|
37 |
+
{
|
38 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
}
|
app/code/community/J2t/Payplug/Helper/Data.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* J2T PayPlug
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@j2t-design.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* @category Magento extension
|
15 |
+
* @package J2t_Payplug
|
16 |
+
* @copyright Copyright (c) 2014 J2T DESIGN. (http://www.j2t-design.com)
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
|
21 |
+
class J2t_Payplug_Helper_Data extends Mage_Core_Helper_Abstract {
|
22 |
+
|
23 |
+
}
|
app/code/community/J2t/Payplug/Model/Observer.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class J2t_Payplug_Model_Observer extends Mage_Core_Model_Session_Abstract
|
4 |
+
{
|
5 |
+
const URL_AUTOCONFIG = 'https://www.payplug.fr/portal/ecommerce/autoconfig';
|
6 |
+
protected function createCertFile($user, $pass){
|
7 |
+
$process = curl_init(self::URL_AUTOCONFIG);
|
8 |
+
|
9 |
+
curl_setopt($process, CURLOPT_USERPWD, $user.':'.$pass);
|
10 |
+
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
|
11 |
+
curl_setopt($process, CURLOPT_SSLVERSION, 3);
|
12 |
+
$answer = curl_exec($process);
|
13 |
+
|
14 |
+
$errorCurl = curl_errno($process);
|
15 |
+
|
16 |
+
|
17 |
+
curl_close($process);
|
18 |
+
if($errorCurl == 0) {
|
19 |
+
$jsonAnswer = json_decode($answer);
|
20 |
+
$authorizationSuccess = false;
|
21 |
+
if ($jsonAnswer->status == 200) {
|
22 |
+
$authorizationSuccess = true;
|
23 |
+
//$payplug_install = new InstallPayplug();
|
24 |
+
if (!is_array($jsonAnswer->currencies)){
|
25 |
+
$currencies = implode(json_decode($jsonAnswer->currencies), ';');
|
26 |
+
}
|
27 |
+
else {
|
28 |
+
$currencies = $jsonAnswer->currencies[0];
|
29 |
+
}
|
30 |
+
if (($groups = Mage::app()->getRequest()->getPost('groups')) && isset($groups['j2tpayplug']) && isset($groups['j2tpayplug']['fields'])){
|
31 |
+
$groups['j2tpayplug']['fields']['private_key'] = array('value' => $jsonAnswer->yourPrivateKey);
|
32 |
+
$groups['j2tpayplug']['fields']['public_key'] = array('value' => $jsonAnswer->payplugPublicKey);
|
33 |
+
$groups['j2tpayplug']['fields']['module_url'] = array('value' => $jsonAnswer->url);
|
34 |
+
$groups['j2tpayplug']['fields']['min_amount'] = array('value' => $jsonAnswer->amount_min);
|
35 |
+
$groups['j2tpayplug']['fields']['max_amount'] = array('value' => $jsonAnswer->amount_max);
|
36 |
+
$groups['j2tpayplug']['fields']['currencies'] = array('value' => $currencies);
|
37 |
+
Mage::app()->getRequest()->setPost('groups', $groups);
|
38 |
+
|
39 |
+
}
|
40 |
+
} else {
|
41 |
+
if (($groups = Mage::app()->getRequest()->getPost('groups')) && isset($groups['j2tpayplug']) && isset($groups['j2tpayplug']['fields'])){
|
42 |
+
$groups['j2tpayplug']['fields']['private_key'] = array('value' => "");
|
43 |
+
$groups['j2tpayplug']['fields']['public_key'] = array('value' => "");
|
44 |
+
$groups['j2tpayplug']['fields']['module_url'] = array('value' => "");
|
45 |
+
$groups['j2tpayplug']['fields']['min_amount'] = array('value' => "");
|
46 |
+
$groups['j2tpayplug']['fields']['max_amount'] = array('value' => "");
|
47 |
+
$groups['j2tpayplug']['fields']['currencies'] = array('value' => "");
|
48 |
+
Mage::app()->getRequest()->setPost('groups', $groups);
|
49 |
+
}
|
50 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('j2tpayplug')->__("Unable to retrieve account details."));
|
51 |
+
}
|
52 |
+
//$this->assign_context_for_PS_VERSION ('authorizationSuccess', $authorizationSuccess);
|
53 |
+
} else {
|
54 |
+
if (($groups = Mage::app()->getRequest()->getPost('groups')) && isset($groups['j2tpayplug']) && isset($groups['j2tpayplug']['fields'])){
|
55 |
+
$groups['j2tpayplug']['fields']['private_key'] = array('value' => "");
|
56 |
+
$groups['j2tpayplug']['fields']['public_key'] = array('value' => "");
|
57 |
+
$groups['j2tpayplug']['fields']['module_url'] = array('value' => "");
|
58 |
+
$groups['j2tpayplug']['fields']['min_amount'] = array('value' => "");
|
59 |
+
$groups['j2tpayplug']['fields']['max_amount'] = array('value' => "");
|
60 |
+
$groups['j2tpayplug']['fields']['currencies'] = array('value' => "");
|
61 |
+
Mage::app()->getRequest()->setPost('groups', $groups);
|
62 |
+
}
|
63 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('j2tpayplug')->__("CURL error %s", $errorCurl));
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
public function saveConfigPayPlug(Varien_Event_Observer $observer)
|
68 |
+
{
|
69 |
+
|
70 |
+
if (($groups = Mage::app()->getRequest()->getPost('groups')) && isset($groups['j2tpayplug'])
|
71 |
+
&& isset($groups['j2tpayplug']['fields']) && isset($groups['j2tpayplug']['fields']['user'])
|
72 |
+
&& isset($groups['j2tpayplug']['fields']['pwd']) && isset($groups['j2tpayplug']['fields']['user']['inherit'])
|
73 |
+
&& isset($groups['j2tpayplug']['fields']['pwd']['inherit'])){
|
74 |
+
$groups['j2tpayplug']['fields']['private_key'] = array('inherit' => '1');
|
75 |
+
$groups['j2tpayplug']['fields']['public_key'] = array('inherit' => '1');
|
76 |
+
$groups['j2tpayplug']['fields']['module_url'] = array('inherit' => '1');
|
77 |
+
$groups['j2tpayplug']['fields']['min_amount'] = array('inherit' => '1');
|
78 |
+
$groups['j2tpayplug']['fields']['max_amount'] = array('inherit' => '1');
|
79 |
+
$groups['j2tpayplug']['fields']['currencies'] = array('inherit' => '1');
|
80 |
+
Mage::app()->getRequest()->setPost('groups', $groups);
|
81 |
+
} if (($groups = Mage::app()->getRequest()->getPost('groups')) && isset($groups['j2tpayplug'])
|
82 |
+
&& isset($groups['j2tpayplug']['fields']) && isset($groups['j2tpayplug']['fields']['user'])
|
83 |
+
&& isset($groups['j2tpayplug']['fields']['pwd']) && (isset($groups['j2tpayplug']['fields']['user']['inherit'])
|
84 |
+
|| isset($groups['j2tpayplug']['fields']['pwd']['inherit']))){
|
85 |
+
throw new Exception( Mage::helper('j2tpayplug')->__("Both username and password must be defined.") );
|
86 |
+
} else if (($groups = Mage::app()->getRequest()->getPost('groups')) && isset($groups['j2tpayplug'])
|
87 |
+
&& isset($groups['j2tpayplug']['fields']) && isset($groups['j2tpayplug']['fields']['user'])
|
88 |
+
&& isset($groups['j2tpayplug']['fields']['pwd']) && isset($groups['j2tpayplug']['fields']['user']['value'])
|
89 |
+
&& isset($groups['j2tpayplug']['fields']['pwd']['value'])
|
90 |
+
&& ($user = $groups['j2tpayplug']['fields']['user']['value']) && ($pwd = $groups['j2tpayplug']['fields']['pwd']['value'])
|
91 |
+
&& $pwd != "******"){
|
92 |
+
$this->createCertFile($user, $pwd);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
app/code/community/J2t/Payplug/Model/PaymentMethod.php
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Our test CC module adapter
|
5 |
+
*/
|
6 |
+
class J2t_Payplug_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* unique internal payment method identifier
|
10 |
+
*
|
11 |
+
* @var string [a-z0-9_]
|
12 |
+
*/
|
13 |
+
protected $_code = 'j2tpayplug';
|
14 |
+
protected $_isInitializeNeeded = true;
|
15 |
+
protected $_formBlockType = 'j2tpayplug/form';
|
16 |
+
protected $_infoBlockType = 'j2tpayplug/info';
|
17 |
+
/**
|
18 |
+
* Is this payment method a gateway (online auth/charge) ?
|
19 |
+
*/
|
20 |
+
protected $_isGateway = true;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Can authorize online?
|
24 |
+
*/
|
25 |
+
protected $_canAuthorize = false;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Can capture funds online?
|
29 |
+
*/
|
30 |
+
protected $_canCapture = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Can capture partial amounts online?
|
34 |
+
*/
|
35 |
+
protected $_canCapturePartial = false;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Can refund online?
|
39 |
+
*/
|
40 |
+
protected $_canRefund = false;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Can void transactions online?
|
44 |
+
*/
|
45 |
+
protected $_canVoid = false;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Can use this payment method in administration panel?
|
49 |
+
*/
|
50 |
+
protected $_canUseInternal = false;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Can show this payment method as an option on checkout payment page?
|
54 |
+
*/
|
55 |
+
protected $_canUseCheckout = true;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Is this payment method suitable for multi-shipping checkout?
|
59 |
+
*/
|
60 |
+
protected $_canUseForMultishipping = false;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Can save credit card information for future processing?
|
64 |
+
*/
|
65 |
+
protected $_canSaveCc = false;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Here you will need to implement authorize, capture and void public methods
|
69 |
+
*
|
70 |
+
* @see examples of transaction specific public methods such as
|
71 |
+
* authorize, capture and void in Mage_Paygate_Model_Authorizenet
|
72 |
+
*/
|
73 |
+
|
74 |
+
public function canUseForCurrency($currencyCode)
|
75 |
+
{
|
76 |
+
return Mage::getStoreConfig('payment/j2tpayplug/currencies', $this->getQuote()->getStoreId()) == $currencyCode;
|
77 |
+
//return $this->getConfig()->isCurrencyCodeSupported($currencyCode);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getSession()
|
81 |
+
{
|
82 |
+
return Mage::getSingleton('paypal/session');
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get checkout session namespace
|
87 |
+
*
|
88 |
+
* @return Mage_Checkout_Model_Session
|
89 |
+
*/
|
90 |
+
public function getCheckout()
|
91 |
+
{
|
92 |
+
return Mage::getSingleton('checkout/session');
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Get current quote
|
97 |
+
*
|
98 |
+
* @return Mage_Sales_Model_Quote
|
99 |
+
*/
|
100 |
+
public function getQuote()
|
101 |
+
{
|
102 |
+
return $this->getCheckout()->getQuote();
|
103 |
+
}
|
104 |
+
|
105 |
+
protected function _getOrder()
|
106 |
+
{
|
107 |
+
return $this->_order;
|
108 |
+
}
|
109 |
+
|
110 |
+
public function initialize($paymentAction, $stateObject)
|
111 |
+
{
|
112 |
+
$payment = $this->getInfoInstance();
|
113 |
+
$order = $payment->getOrder();
|
114 |
+
|
115 |
+
$state = Mage::getStoreConfig('payment/j2tpayplug/new_order_status', $order->getStoreId());
|
116 |
+
|
117 |
+
//$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
118 |
+
$stateObject->setState($state);
|
119 |
+
$stateObject->setStatus('pending_payment');
|
120 |
+
$stateObject->setIsNotified(false);
|
121 |
+
}
|
122 |
+
|
123 |
+
public function getPayplugCheckoutRedirection()
|
124 |
+
{
|
125 |
+
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
|
126 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
127 |
+
|
128 |
+
$url_payment= Mage::getStoreConfig('payment/j2tpayplug/module_url', $this->getQuote()->getStoreId());
|
129 |
+
|
130 |
+
$params = array(
|
131 |
+
'amount' => ($order->getGrandTotal()*100),
|
132 |
+
'custom_data' => $order->getStoreId(),
|
133 |
+
'origin' => 'Magento '.Mage::getVersion().' module '.Mage::getConfig()->getModuleConfig("J2t_Payplug")->version,
|
134 |
+
'currency' => $order->getOrderCurrencyCode(),
|
135 |
+
'ipn_url' => Mage::getUrl('j2tpayplug/payment/ipn'),
|
136 |
+
'cancel_url' => Mage::getUrl('j2tpayplug/payment/cancel'),
|
137 |
+
'return_url' => Mage::getUrl('checkout/onepage/success'),
|
138 |
+
'email' => $order->getCustomerEmail(),
|
139 |
+
'firstname' => $order->getCustomerFirstname(),
|
140 |
+
'lastname' => $order->getCustomerLastname(),
|
141 |
+
//'order' => $this->getQuote()->getId(),
|
142 |
+
'order' => $orderIncrementId,
|
143 |
+
'customer' => $order->getCustomerId()
|
144 |
+
);
|
145 |
+
|
146 |
+
|
147 |
+
$url_params = http_build_query($params);
|
148 |
+
$privatekey = Mage::getStoreConfig('payment/j2tpayplug/private_key', $this->getQuote()->getStoreId());
|
149 |
+
openssl_sign($url_params, $signature, $privatekey, $signature_alg = OPENSSL_ALGO_SHA1);
|
150 |
+
$url_param_base_encode = base64_encode($url_params);
|
151 |
+
$signature = base64_encode($signature);
|
152 |
+
$redirect_url = $url_payment."?data=".urlencode($url_param_base_encode)."&sign=".urlencode($signature);
|
153 |
+
|
154 |
+
return $redirect_url;
|
155 |
+
}
|
156 |
+
|
157 |
+
public function isAvailable($quote = null)
|
158 |
+
{
|
159 |
+
$min = Mage::getStoreConfig('payment/j2tpayplug/min_amount', $quote->getStoreId());
|
160 |
+
$max = Mage::getStoreConfig('payment/j2tpayplug/max_amount', $quote->getStoreId());
|
161 |
+
if (parent::isAvailable($quote) && $quote->getGrandTotal() >= $min && $quote->getGrandTotal() <= $max
|
162 |
+
&& Mage::getStoreConfig('payment/j2tpayplug/private_key', $quote->getStoreId())
|
163 |
+
&& Mage::getStoreConfig('payment/j2tpayplug/public_key', $quote->getStoreId())
|
164 |
+
&& Mage::getStoreConfig('payment/j2tpayplug/module_url', $quote->getStoreId())
|
165 |
+
&& Mage::getStoreConfig('payment/j2tpayplug/currencies', $quote->getStoreId())
|
166 |
+
) {
|
167 |
+
return true;
|
168 |
+
}
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
public function getOrderPlaceRedirectUrl()
|
175 |
+
{
|
176 |
+
return Mage::getUrl('j2tpayplug/payment/redirect', array('_secure' => true));
|
177 |
+
}
|
178 |
+
|
179 |
+
}
|
app/code/community/J2t/Payplug/controllers/PaymentController.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* J2t_Payplug
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@j2t-design.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* @category Magento extension
|
15 |
+
* @package J2t_Payplug
|
16 |
+
* @copyright Copyright (c) 2011 J2T DESIGN. (http://www.j2t-design.net)
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
class J2t_Payplug_PaymentController extends Mage_Core_Controller_Front_Action
|
21 |
+
{
|
22 |
+
const PAYMENT_STATUS_PAID = 0;
|
23 |
+
const PAYMENT_STATUS_REFUND = 4;
|
24 |
+
const PAYMENT_STATUS_CANCEL = 2;
|
25 |
+
|
26 |
+
public function redirectAction()
|
27 |
+
{
|
28 |
+
$payplug = Mage::getModel('j2tpayplug/paymentMethod');
|
29 |
+
$url = $payplug->getPayplugCheckoutRedirection();
|
30 |
+
$this->_redirectUrl($url);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function ipnAction()
|
34 |
+
{
|
35 |
+
$headers = array();
|
36 |
+
foreach ($_SERVER as $name => $value){
|
37 |
+
if(substr($name, 0, 5) == 'HTTP_'){
|
38 |
+
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
|
39 |
+
$headers[$name] = $value;
|
40 |
+
} else if($name == "CONTENT_TYPE") {
|
41 |
+
$headers["Content-Type"] = $value;
|
42 |
+
} else if($name == "CONTENT_LENGTH") {
|
43 |
+
$headers["Content-Length"] = $value;
|
44 |
+
} else{
|
45 |
+
$headers[$name]=$value;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
$headers = array_change_key_case($headers, CASE_UPPER);
|
49 |
+
if(!isset($headers['PAYPLUG-SIGNATURE'])){
|
50 |
+
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Signature not provided', true, 403);
|
51 |
+
die;
|
52 |
+
}
|
53 |
+
|
54 |
+
$signature = base64_decode($headers['PAYPLUG-SIGNATURE']);
|
55 |
+
$body = file_get_contents('php://input');
|
56 |
+
$data = json_decode($body, true);
|
57 |
+
|
58 |
+
$status = $data['status'];
|
59 |
+
if($status == self::PAYMENT_STATUS_PAID || $status == self::PAYMENT_STATUS_REFUND || $status == self::PAYMENT_STATUS_CANCEL){
|
60 |
+
// Check signature
|
61 |
+
$publicKey = Mage::getStoreConfig('payment/j2tpayplug/public_key', $data['custom_data']);
|
62 |
+
$checkSignature = openssl_verify($body , $signature, $publicKey, OPENSSL_ALGO_SHA1);
|
63 |
+
if($checkSignature == 1){
|
64 |
+
$bool_sign = true;
|
65 |
+
} else if($checkSignature == 0){
|
66 |
+
echo Mage::helper('j2tpayplug')->__('Invalid signature');
|
67 |
+
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Invalid signature', true, 403);
|
68 |
+
die;
|
69 |
+
} else{
|
70 |
+
echo Mage::helper('j2tpayplug')->__('Error while checking signature');
|
71 |
+
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Error while checking signature', true, 500);
|
72 |
+
die;
|
73 |
+
}
|
74 |
+
|
75 |
+
if($data && $bool_sign){
|
76 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($data['order']);
|
77 |
+
if($orderId = $order->getId()){
|
78 |
+
// If status paid
|
79 |
+
if($status == self::PAYMENT_STATUS_PAID) {
|
80 |
+
// If order state is already paid by payplug
|
81 |
+
if($order->getState() == Mage::getStoreConfig('payment/j2tpayplug/complete_order_status', $data['custom_data'])){
|
82 |
+
// Order is already marked as paid - return http 200 OK
|
83 |
+
}
|
84 |
+
// If order state is payment in progress by payplug
|
85 |
+
elseif($order->getState() == Mage::getStoreConfig('payment/j2tpayplug/new_order_status', $data['custom_data'])){
|
86 |
+
$order->setState(Mage::getStoreConfig('payment/j2tpayplug/complete_order_status', $data['custom_data']));
|
87 |
+
$order->setStatus(Mage::getStoreConfig('payment/j2tpayplug/complete_order_status', $data['custom_data']));
|
88 |
+
$order->addStatusHistoryComment(Mage::helper('j2tpayplug')->__('Payment has been captured by Payment Gateway. Transaction id: %s', $data['id_transaction']));
|
89 |
+
$order->save();
|
90 |
+
|
91 |
+
if (Mage::getStoreConfig('payment/j2tpayplug/invoice', $data['custom_data'])){
|
92 |
+
//generate invoice
|
93 |
+
try {
|
94 |
+
if(!$order->canInvoice())
|
95 |
+
{
|
96 |
+
Mage::throwException(Mage::helper('j2tpayplug')->__('Cannot create an invoice.'));
|
97 |
+
}
|
98 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
99 |
+
if (!$invoice->getTotalQty()) {
|
100 |
+
Mage::throwException(Mage::helper('j2tpayplug')->__('Cannot create an invoice without products.'));
|
101 |
+
}
|
102 |
+
|
103 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
104 |
+
$invoice->register();
|
105 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
106 |
+
->addObject($invoice)
|
107 |
+
->addObject($invoice->getOrder());
|
108 |
+
|
109 |
+
$transactionSave->save();
|
110 |
+
}
|
111 |
+
catch (Mage_Core_Exception $e) {
|
112 |
+
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
117 |
+
} // If status refund
|
118 |
+
else if($status == self::PAYMENT_STATUS_REFUND || $status == self::PAYMENT_STATUS_CANCEL){
|
119 |
+
$invoices = array();
|
120 |
+
foreach ($order->getInvoiceCollection() as $invoice) {
|
121 |
+
if ($invoice->canRefund()) {
|
122 |
+
$invoices[] = $invoice;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
$service = Mage::getModel('sales/service_order', $order);
|
126 |
+
foreach ($invoices as $invoice) {
|
127 |
+
$creditmemo = $service->prepareInvoiceCreditmemo($invoice);
|
128 |
+
$creditmemo->refund();
|
129 |
+
}
|
130 |
+
//if (!sizeof($invoices)){
|
131 |
+
$order->setState(Mage::getStoreConfig('payment/j2tpayplug/cancel_order_status', $data['custom_data']));
|
132 |
+
$order->setStatus(Mage::getStoreConfig('payment/j2tpayplug/cancel_order_status', $data['custom_data']));
|
133 |
+
$order->addStatusHistoryComment(Mage::helper('j2tpayplug')->__('Payment canceled/refunded by Payment Gateway. Transaction id: %s', $data['id_transaction']));
|
134 |
+
$order->save();
|
135 |
+
//}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
} else{
|
139 |
+
echo Mage::helper('j2tpayplug')->__('Error: missing or wrong parameters.');
|
140 |
+
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Missing or wrong parameters', true, 400);
|
141 |
+
die;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
protected function _getSession()
|
148 |
+
{
|
149 |
+
return Mage::getSingleton('checkout/session');
|
150 |
+
}
|
151 |
+
|
152 |
+
public function cancelAction()
|
153 |
+
{
|
154 |
+
//redirect to cart and error message payment has been declined
|
155 |
+
$this->_getSession()->addError(Mage::helper('j2tpayplug')->escapeHtml(Mage::helper('j2tpayplug')->__('There has been a problem during the payment.')));
|
156 |
+
$this->_redirect('checkout/cart');
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
app/code/community/J2t/Payplug/etc/config.xml
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<J2t_Payplug>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</J2t_Payplug>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<blocks>
|
11 |
+
<j2tpayplug>
|
12 |
+
<class>J2t_Payplug_Block</class>
|
13 |
+
</j2tpayplug>
|
14 |
+
</blocks>
|
15 |
+
|
16 |
+
<helpers>
|
17 |
+
<j2tpayplug>
|
18 |
+
<class>J2t_Payplug_Helper</class>
|
19 |
+
</j2tpayplug>
|
20 |
+
</helpers>
|
21 |
+
|
22 |
+
<models>
|
23 |
+
<j2tpayplug>
|
24 |
+
<class>J2t_Payplug_Model</class>
|
25 |
+
<resourceModel>j2tpayplug_resource</resourceModel>
|
26 |
+
</j2tpayplug>
|
27 |
+
<j2tpayplug_resource>
|
28 |
+
<class>J2t_Payplug_Model_Resource</class>
|
29 |
+
<deprecatedNode>j2tpayplug_mysql4</deprecatedNode>
|
30 |
+
<entities>
|
31 |
+
<cert>
|
32 |
+
<table>payplug_cert</table>
|
33 |
+
</cert>
|
34 |
+
</entities>
|
35 |
+
</j2tpayplug_resource>
|
36 |
+
</models>
|
37 |
+
<resources>
|
38 |
+
<j2tpayplug_setup>
|
39 |
+
<setup>
|
40 |
+
<module>J2t_Payplug</module>
|
41 |
+
<class>Mage_Paypal_Model_Resource_Setup</class>
|
42 |
+
</setup>
|
43 |
+
<connection>
|
44 |
+
<use>core_setup</use>
|
45 |
+
</connection>
|
46 |
+
</j2tpayplug_setup>
|
47 |
+
<j2tpayplug_write>
|
48 |
+
<connection>
|
49 |
+
<use>core_write</use>
|
50 |
+
</connection>
|
51 |
+
</j2tpayplug_write>
|
52 |
+
<j2tpayplug_read>
|
53 |
+
<connection>
|
54 |
+
<use>core_read</use>
|
55 |
+
</connection>
|
56 |
+
</j2tpayplug_read>
|
57 |
+
|
58 |
+
</resources>
|
59 |
+
|
60 |
+
<events>
|
61 |
+
<controller_action_predispatch_adminhtml_system_config_save>
|
62 |
+
<observers>
|
63 |
+
<j2tpayplug_saveadmin>
|
64 |
+
<type>singleton</type>
|
65 |
+
<class>J2t_Payplug_Model_Observer</class>
|
66 |
+
<method>saveConfigPayPlug</method>
|
67 |
+
</j2tpayplug_saveadmin>
|
68 |
+
</observers>
|
69 |
+
</controller_action_predispatch_adminhtml_system_config_save>
|
70 |
+
</events>
|
71 |
+
|
72 |
+
</global>
|
73 |
+
|
74 |
+
<frontend>
|
75 |
+
<routers>
|
76 |
+
<j2tpayplug>
|
77 |
+
<use>standard</use>
|
78 |
+
<args>
|
79 |
+
<module>J2t_Payplug</module>
|
80 |
+
<frontName>j2tpayplug</frontName>
|
81 |
+
</args>
|
82 |
+
</j2tpayplug>
|
83 |
+
</routers>
|
84 |
+
|
85 |
+
<translate>
|
86 |
+
<modules>
|
87 |
+
<j2tpayplug>
|
88 |
+
<files>
|
89 |
+
<default>j2t_payplug.csv</default>
|
90 |
+
</files>
|
91 |
+
</j2tpayplug>
|
92 |
+
</modules>
|
93 |
+
</translate>
|
94 |
+
</frontend>
|
95 |
+
<adminhtml>
|
96 |
+
<translate>
|
97 |
+
<modules>
|
98 |
+
<j2tpayplug>
|
99 |
+
<files>
|
100 |
+
<default>j2t_payplug.csv</default>
|
101 |
+
</files>
|
102 |
+
</j2tpayplug>
|
103 |
+
</modules>
|
104 |
+
</translate>
|
105 |
+
</adminhtml>
|
106 |
+
|
107 |
+
<default>
|
108 |
+
<payment>
|
109 |
+
<j2tpayplug>
|
110 |
+
<active>0</active>
|
111 |
+
<model>j2tpayplug/paymentMethod</model>
|
112 |
+
<new_order_status>pending</new_order_status>
|
113 |
+
<complete_order_status>processing</complete_order_status>
|
114 |
+
<cancel_order_status>canceled</cancel_order_status>
|
115 |
+
<invoice>0</invoice>
|
116 |
+
<title>PayPlug - Payment by Visa or Mastercard</title>
|
117 |
+
<payment_action>authorize</payment_action>
|
118 |
+
<allowspecific>0</allowspecific>
|
119 |
+
</j2tpayplug>
|
120 |
+
</payment>
|
121 |
+
</default>
|
122 |
+
</config>
|
app/code/community/J2t/Payplug/etc/system.xml
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<j2tpayplug translate="label" module="paygate">
|
7 |
+
<label>Pay Plug</label>
|
8 |
+
<sort_order>670</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>0</show_in_store>
|
12 |
+
|
13 |
+
<comment><![CDATA[
|
14 |
+
<script type="text/javascript">
|
15 |
+
|
16 |
+
hideAll = function(){
|
17 |
+
$('payment_j2tpayplug_private_key').up(1).hide();
|
18 |
+
$('payment_j2tpayplug_public_key').up(1).hide();
|
19 |
+
$('payment_j2tpayplug_module_url').up(1).hide();
|
20 |
+
$('payment_j2tpayplug_min_amount').up(1).hide();
|
21 |
+
$('payment_j2tpayplug_max_amount').up(1).hide();
|
22 |
+
$('payment_j2tpayplug_currencies').up(1).hide();
|
23 |
+
};
|
24 |
+
|
25 |
+
Event.observe(window, 'load', function() {
|
26 |
+
hideAll();
|
27 |
+
});
|
28 |
+
</script>
|
29 |
+
]]>
|
30 |
+
</comment>
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
<fields>
|
35 |
+
<active translate="label">
|
36 |
+
<label>Enabled</label>
|
37 |
+
<frontend_type>select</frontend_type>
|
38 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
39 |
+
<sort_order>1</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>0</show_in_store>
|
43 |
+
</active>
|
44 |
+
<title translate="label">
|
45 |
+
<label>Title</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>2</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>0</show_in_store>
|
51 |
+
</title>
|
52 |
+
|
53 |
+
<account_details translate="label">
|
54 |
+
<label>Account details</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<frontend_model>j2tpayplug/adminhtml_system_config_accountdetails</frontend_model>
|
57 |
+
<sort_order>3</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 |
+
</account_details>
|
62 |
+
|
63 |
+
|
64 |
+
<private_key translate="label">
|
65 |
+
<label>Private Key</label>
|
66 |
+
<frontend_type>textarea</frontend_type>
|
67 |
+
<sort_order>3</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>0</show_in_store>
|
71 |
+
</private_key>
|
72 |
+
<public_key translate="label">
|
73 |
+
<label>Public Key</label>
|
74 |
+
<frontend_type>textarea</frontend_type>
|
75 |
+
<sort_order>4</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 |
+
</public_key>
|
80 |
+
<module_url translate="label">
|
81 |
+
<label>Module URL</label>
|
82 |
+
<frontend_type>text</frontend_type>
|
83 |
+
<sort_order>5</sort_order>
|
84 |
+
<show_in_default>1</show_in_default>
|
85 |
+
<show_in_website>1</show_in_website>
|
86 |
+
<show_in_store>0</show_in_store>
|
87 |
+
</module_url>
|
88 |
+
<min_amount translate="label">
|
89 |
+
<label>Min Amount</label>
|
90 |
+
<frontend_type>text</frontend_type>
|
91 |
+
<sort_order>6</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>0</show_in_store>
|
95 |
+
</min_amount>
|
96 |
+
<max_amount translate="label">
|
97 |
+
<label>Max Amount</label>
|
98 |
+
<frontend_type>text</frontend_type>
|
99 |
+
<sort_order>7</sort_order>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>1</show_in_website>
|
102 |
+
<show_in_store>0</show_in_store>
|
103 |
+
</max_amount>
|
104 |
+
<currencies translate="label">
|
105 |
+
<label>Currencies</label>
|
106 |
+
<frontend_type>text</frontend_type>
|
107 |
+
<sort_order>8</sort_order>
|
108 |
+
<show_in_default>1</show_in_default>
|
109 |
+
<show_in_website>1</show_in_website>
|
110 |
+
<show_in_store>0</show_in_store>
|
111 |
+
</currencies>
|
112 |
+
|
113 |
+
<user translate="label">
|
114 |
+
<label>User</label>
|
115 |
+
<frontend_type>text</frontend_type>
|
116 |
+
<sort_order>10</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
</user>
|
120 |
+
<pwd translate="label">
|
121 |
+
<label>Password</label>
|
122 |
+
<frontend_type>obscure</frontend_type>
|
123 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
124 |
+
<sort_order>20</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
</pwd>
|
128 |
+
|
129 |
+
<new_order_status translate="label">
|
130 |
+
<label>New order status</label>
|
131 |
+
<frontend_type>select</frontend_type>
|
132 |
+
<source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
|
133 |
+
<sort_order>30</sort_order>
|
134 |
+
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>1</show_in_website>
|
136 |
+
</new_order_status>
|
137 |
+
|
138 |
+
<complete_order_status translate="label">
|
139 |
+
<label>Approved order status</label>
|
140 |
+
<frontend_type>select</frontend_type>
|
141 |
+
<source_model>adminhtml/system_config_source_order_status_processing</source_model>
|
142 |
+
<sort_order>40</sort_order>
|
143 |
+
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>1</show_in_website>
|
145 |
+
</complete_order_status>
|
146 |
+
|
147 |
+
<cancel_order_status translate="label">
|
148 |
+
<label>Rejected order status</label>
|
149 |
+
<frontend_type>select</frontend_type>
|
150 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
151 |
+
<sort_order>50</sort_order>
|
152 |
+
<show_in_default>1</show_in_default>
|
153 |
+
<show_in_website>1</show_in_website>
|
154 |
+
</cancel_order_status>
|
155 |
+
|
156 |
+
<invoice translate="label">
|
157 |
+
<label>Invoice when complete</label>
|
158 |
+
<frontend_type>select</frontend_type>
|
159 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
160 |
+
<sort_order>60</sort_order>
|
161 |
+
<show_in_default>1</show_in_default>
|
162 |
+
<show_in_website>1</show_in_website>
|
163 |
+
</invoice>
|
164 |
+
|
165 |
+
<allowspecific translate="label">
|
166 |
+
<label>Payment from Applicable Countries</label>
|
167 |
+
<frontend_type>allowspecific</frontend_type>
|
168 |
+
<sort_order>70</sort_order>
|
169 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
170 |
+
<show_in_default>1</show_in_default>
|
171 |
+
<show_in_website>1</show_in_website>
|
172 |
+
<show_in_store>0</show_in_store>
|
173 |
+
</allowspecific>
|
174 |
+
<specificcountry translate="label">
|
175 |
+
<label>Payment from Specific Countries</label>
|
176 |
+
<frontend_type>multiselect</frontend_type>
|
177 |
+
<sort_order>71</sort_order>
|
178 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
179 |
+
<show_in_default>1</show_in_default>
|
180 |
+
<show_in_website>1</show_in_website>
|
181 |
+
<show_in_store>0</show_in_store>
|
182 |
+
<can_be_empty>1</can_be_empty>
|
183 |
+
</specificcountry>
|
184 |
+
|
185 |
+
<sort_order translate="label">
|
186 |
+
<label>Sort Order</label>
|
187 |
+
<frontend_type>text</frontend_type>
|
188 |
+
<sort_order>100</sort_order>
|
189 |
+
<show_in_default>1</show_in_default>
|
190 |
+
<show_in_website>1</show_in_website>
|
191 |
+
<show_in_store>0</show_in_store>
|
192 |
+
<frontend_class>validate-number</frontend_class>
|
193 |
+
</sort_order>
|
194 |
+
|
195 |
+
</fields>
|
196 |
+
</j2tpayplug>
|
197 |
+
</groups>
|
198 |
+
</payment>
|
199 |
+
</sections>
|
200 |
+
</config>
|
app/code/community/J2t/Payplug/sql/j2tpayplug_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $installer Mage_Paypal_Model_Resource_Setup */
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Prepare database for install
|
8 |
+
*/
|
9 |
+
$installer->startSetup();
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Create table 'paypal/cert'
|
14 |
+
*/
|
15 |
+
$table = $installer->getConnection()
|
16 |
+
->newTable($installer->getTable('j2tpayplug/cert'))
|
17 |
+
->addColumn('cert_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
18 |
+
'identity' => true,
|
19 |
+
'unsigned' => true,
|
20 |
+
'nullable' => false,
|
21 |
+
'primary' => true,
|
22 |
+
), 'Cert Id')
|
23 |
+
->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
24 |
+
'unsigned' => true,
|
25 |
+
'nullable' => false,
|
26 |
+
'default' => '0'
|
27 |
+
), 'Website Id')
|
28 |
+
->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '64K', array(
|
29 |
+
), 'Content')
|
30 |
+
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
31 |
+
), 'Updated At')
|
32 |
+
->addIndex($installer->getIdxName('j2tpayplug/cert', array('website_id')),
|
33 |
+
array('website_id'))
|
34 |
+
->addForeignKey($installer->getFkName('j2tpayplug/cert', 'website_id', 'core/website', 'website_id'),
|
35 |
+
'website_id', $installer->getTable('core/website'), 'website_id',
|
36 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
37 |
+
->setComment('Payplug Certificate Table');
|
38 |
+
$installer->getConnection()->createTable($table);
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Prepare database after install
|
43 |
+
*/
|
44 |
+
$installer->endSetup();
|
45 |
+
|
app/design/adminhtml/default/default/layout/j2t_all.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addCss">
|
6 |
+
<name>j2t_all_admin.css</name>
|
7 |
+
</action>
|
8 |
+
</reference>
|
9 |
+
</default>
|
10 |
+
</layout>
|
app/design/frontend/base/default/template/j2tpayplug/form.phtml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_code = $this->getMethodCode(); ?>
|
28 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none">
|
29 |
+
<li>
|
30 |
+
<?php echo $this->__('You will be redirected to our secure payment page when you place an order.') ?>
|
31 |
+
</li>
|
32 |
+
</ul>
|
33 |
+
|
app/design/frontend/base/default/template/j2tpayplug/info.phtml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?><br />
|
28 |
+
<em><?php echo $this->__('You will be redirected to our secure payment page when you place an order.') ?></em>
|
app/etc/modules/J2t_All.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<J2t_All>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</J2t_All>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/J2t_Payplug.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<J2t_Payplug>
|
4 |
+
<active>true</active>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
<depends>
|
7 |
+
<Mage_Payment />
|
8 |
+
</depends>
|
9 |
+
</J2t_Payplug>
|
10 |
+
</modules>
|
11 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>J2t_Payplug</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/OSL-3.0">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>PayPlug payment gateway</summary>
|
10 |
+
<description>It allows to pay with PayPlug</description>
|
11 |
+
<notes>First stable release</notes>
|
12 |
+
<authors><author><name>J2T Design</name><user>j2tdesign</user><email>j2tdesign.net@gmail.com</email></author></authors>
|
13 |
+
<date>2014-09-18</date>
|
14 |
+
<time>13:55:28</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="J2t"><dir name="Payplug"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Accountdetails.php" hash="c89acdccd51f392dac8dfd032013683f"/></dir></dir></dir><file name="Form.php" hash="0c89710b2d4e94d76e9cc4b37ae3e7a6"/><file name="Info.php" hash="6e5e03ae417efe6d538b6437d5c99f87"/></dir><dir name="Helper"><file name="Data.php" hash="123d5de46cd1577e867e8ab9b0236d09"/></dir><dir name="Model"><file name="Observer.php" hash="791b10367d4ab48516f8ade14ff40d28"/><file name="PaymentMethod.php" hash="ecdb9dddcaaac90b80e5df92690b8d4a"/></dir><dir name="controllers"><file name="PaymentController.php" hash="195a5069f5041ba5a5c528ccd9df5791"/></dir><dir name="etc"><file name="config.xml" hash="a2334cdfa9f89f4d1e63d03aeeaa05f7"/><file name="system.xml" hash="774d4d10a7ca1233433f479a055547a4"/></dir><dir name="sql"><dir name="j2tpayplug_setup"><file name="install-1.0.0.php" hash="38cd84e5305bf53bca042f3a325523e5"/></dir></dir></dir><dir name="All"><dir name="Helper"><file name="Data.php" hash="d2bfe4933ead5fff4cf7e53630a2334e"/></dir><dir name="Model"><file name="Feed.php" hash="7cfa1539718432ba29d5577324bb5198"/><file name="Observer.php" hash="d16d9695e40a1a32dfa226cccfd48acb"/></dir><dir name="etc"><file name="config.xml" hash="78c3e36e2d45ee41bdde7410719f5ef7"/><file name="system.xml" hash="bd1826f4925482a0f925c74e0fd2b214"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="j2tpayplug"><file name="form.phtml" hash="cacf102de2ad4d183c502ad85d309439"/><file name="info.phtml" hash="7270ac2591cb0ad18915d8f5e92bef69"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="j2t_all.xml" hash="c5f6935a0a162251d0c1f97e3eee6669"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="J2t_Payplug.xml" hash="dccffdae1d3e6bae6c2e01ed7ec0cff3"/><file name="J2t_All.xml" hash="3c85420d01af2023bcf8fa9df2f9144a"/></dir></target><target name="magelocale"><dir/></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="j2t_all_admin.css" hash="0c63600f49bab11eb3aafeea2ca56e7d"/><dir name="images"><file name="j2t_all.png" hash="19abc9040d74479f19eeb0c686f84766"/><dir name="j2t"><file name="ajax_cart.png" hash="e0c22079854b8136b9688b477c5f241a"/><file name="ajax_cart_2.png" hash="b14283c9f04c71af1e71342b3a745b4d"/><file name="auto_add.png" hash="bb1b750d8acd3c64e340fc5e0de036d8"/><file name="color_swatch.png" hash="d02daad32dc80679e462992748083ee8"/><file name="discountlabel.png" hash="f88b3d6c9ec76e3a2e6a2b0d8a3509b4"/><file name="gift_voucher.png" hash="6a62554c30594c35098535b862b447de"/><file name="gift_wrap.png" hash="9ace79eba94be172155e849e99a4e7f6"/><file name="one_checkout.png" hash="ba5594eea9cb7191079bb934eed9d10d"/><file name="product_hold.png" hash="3302cb665ec22ead4ef038da9ee07ac6"/><file name="productpreview.png" hash="d1117c9a889605bbaf0a5fddd92cd284"/><file name="reward_points.png" hash="8c2b307404c81cfdfc4e7669142d03b0"/><file name="sandbox.png" hash="8be94832209eb01689edc0d2b4cdee2a"/><file name="social_connect.png" hash="1492edf61ba7966d2069d7f4d3801300"/><file name="support.png" hash="ad077c49e123d2616ebd314425a7f646"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/images/j2t/ajax_cart.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/ajax_cart_2.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/auto_add.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/color_swatch.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/discountlabel.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/gift_voucher.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/gift_wrap.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/one_checkout.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/product_hold.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/productpreview.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/reward_points.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/sandbox.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/social_connect.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t/support.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/j2t_all.png
ADDED
Binary file
|
skin/adminhtml/default/default/j2t_all_admin.css
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ul.tabs a.j2t-all-tab span, ul.tabs a.j2t-all-tab:hover span {
|
2 |
+
background: url("./images/j2t_all.png") no-repeat scroll 0 0 transparent;
|
3 |
+
height: 0;
|
4 |
+
overflow: hidden;
|
5 |
+
padding: 21px 0 0;
|
6 |
+
width: 192px;
|
7 |
+
}
|
8 |
+
|
9 |
+
ul.tabs a.j2t-all-tab, ul.tabs a.j2t-all-tab:hover {
|
10 |
+
background: url("../../images/tabs_span_bg.gif") repeat-x scroll 0 100% transparent;
|
11 |
+
border-bottom: medium none;
|
12 |
+
padding: 0.5em 0.5em 0.28em 1.5em;
|
13 |
+
}
|
14 |
+
|
15 |
+
ul.tabs a.j2t-ajaxcart-module span, ul.tabs a.j2t-ajaxcart-module:hover span {
|
16 |
+
background: url("./images/j2t/ajax_cart.png") no-repeat scroll 0 0 transparent;
|
17 |
+
padding: 0 20px 0;
|
18 |
+
}
|
19 |
+
ul.tabs a.j2t-rewardpoints-module span, ul.tabs a.j2t-rewardpoints-module:hover span {
|
20 |
+
background: url("./images/j2t/reward_points.png") no-repeat scroll 0 0 transparent;
|
21 |
+
padding: 0 20px 0;
|
22 |
+
}
|
23 |
+
ul.tabs a.j2t-autoadd-module span, ul.tabs a.j2t-autoadd-module:hover span {
|
24 |
+
background: url("./images/j2t/auto_add.png") no-repeat scroll 0 0 transparent;
|
25 |
+
padding: 0 20px 0;
|
26 |
+
}
|
27 |
+
ul.tabs a.j2t-onecheckout-module span, ul.tabs a.j2t-onecheckout-module:hover span {
|
28 |
+
background: url("./images/j2t/one_checkout.png") no-repeat scroll 0 0 transparent;
|
29 |
+
padding: 0 20px 0;
|
30 |
+
}
|
31 |
+
|
32 |
+
ul.tabs a.j2t-socialconnect-module span, ul.tabs a.j2t-socialconnect-module:hover span {
|
33 |
+
background: url("./images/j2t/social_connect.png") no-repeat scroll 0 0 transparent;
|
34 |
+
padding: 0 20px 0;
|
35 |
+
}
|
36 |
+
|
37 |
+
ul.tabs a.j2t-producthold-module span, ul.tabs a.j2t-producthold-module:hover span {
|
38 |
+
background: url("./images/j2t/product_hold.png") no-repeat scroll 0 0 transparent;
|
39 |
+
padding: 0 20px 0;
|
40 |
+
}
|
41 |
+
|
42 |
+
ul.tabs a.j2t-giftwrap-module span, ul.tabs a.j2t-giftwrap-module:hover span {
|
43 |
+
background: url("./images/j2t/gift_wrap.png") no-repeat scroll 0 0 transparent;
|
44 |
+
padding: 0 20px 0;
|
45 |
+
}
|
46 |
+
|
47 |
+
ul.tabs a.j2t-giftvoucher-module span, ul.tabs a.j2t-giftvoucher-module:hover span {
|
48 |
+
background: url("./images/j2t/gift_voucher.png") no-repeat scroll 0 0 transparent;
|
49 |
+
padding: 0 20px 0;
|
50 |
+
}
|
51 |
+
|
52 |
+
ul.tabs a.j2t-ajaxcart-module, ul.tabs a.j2t-ajaxcart-module:hover,
|
53 |
+
ul.tabs a.j2t-rewardpoints-module, ul.tabs a.j2t-rewardpoints-module:hover,
|
54 |
+
ul.tabs a.j2t-autoadd-module, ul.tabs a.j2t-autoadd-module:hover,
|
55 |
+
ul.tabs a.j2t-onecheckout-module, ul.tabs a.j2t-onecheckout-module:hover,
|
56 |
+
ul.tabs a.j2t-socialconnect-module, ul.tabs a.j2t-socialconnect-module:hover,
|
57 |
+
ul.tabs a.j2t-producthold-module, ul.tabs a.j2t-producthold-module:hover,
|
58 |
+
ul.tabs a.j2t-giftwrap-module, ul.tabs a.j2t-giftwrap-module:hover,
|
59 |
+
ul.tabs a.j2t-giftvoucher-module, ul.tabs a.j2t-giftvoucher-module:hover
|
60 |
+
{
|
61 |
+
padding: 0.5em 0.5em 0.28em 1.5em;
|
62 |
+
border-bottom: dotted 1px #c0c0c0;
|
63 |
+
}
|
64 |
+
|
65 |
+
ul.tabs a.j2t-ajaxcart-module.active, ul.tabs a.j2t-ajaxcart-module.active:hover,
|
66 |
+
ul.tabs a.j2t-rewardpoints-module.active, ul.tabs a.j2t-rewardpoints-module.active:hover,
|
67 |
+
ul.tabs a.j2t-autoadd-module.active, ul.tabs a.j2t-autoadd-module.active:hover,
|
68 |
+
ul.tabs a.j2t-onecheckout-module.active, ul.tabs a.j2t-onecheckout-module.active:hover,
|
69 |
+
ul.tabs a.j2t-all-tab.active, ul.tabs a.j2t-all-tab.active:hover,
|
70 |
+
ul.tabs a.j2t-socialconnect-module.active, ul.tabs a.j2t-socialconnect-module.active:hover,
|
71 |
+
ul.tabs a.j2t-producthold-module.active, ul.tabs a.j2t-producthold-module.active:hover,
|
72 |
+
ul.tabs a.j2t-giftwrap-module.active, ul.tabs a.j2t-giftwrap-module.active:hover,
|
73 |
+
ul.tabs a.j2t-giftvoucher-module.active, ul.tabs a.j2t-giftvoucher-module.active:hover
|
74 |
+
{
|
75 |
+
background-color: #FFFFFF;
|
76 |
+
}
|
77 |
+
|
78 |
+
ul.tabs a.j2t-all-tab, ul.tabs a.j2t-all-tab {border:none;}
|