Version Notes
Package de la version 1.0.2
Download this release
Release Info
Developer | Afone |
Extension | Afone_Comnpay |
Version | 1.0.2 |
Comparing to | |
See all releases |
Version 1.0.2
- app/code/local/Afone/Comnpay/Block/Form.php +10 -0
- app/code/local/Afone/Comnpay/Block/Info.php +11 -0
- app/code/local/Afone/Comnpay/Helper/Data.php +3 -0
- app/code/local/Afone/Comnpay/Model/Config.php +150 -0
- app/code/local/Afone/Comnpay/Model/Source/GatewayConfig.php +21 -0
- app/code/local/Afone/Comnpay/Model/Standard.php +24 -0
- app/code/local/Afone/Comnpay/controllers/PaymentController.php +162 -0
- app/code/local/Afone/Comnpay/etc/config.xml +76 -0
- app/code/local/Afone/Comnpay/etc/system.xml +125 -0
- app/design/frontend/base/default/template/comnpay/form.phtml +1 -0
- app/design/frontend/base/default/template/comnpay/info.phtml +2 -0
- app/design/frontend/base/default/template/comnpay/redirect.phtml +19 -0
- app/etc/modules/Afone_Comnpay.xml +9 -0
- app/locale/fr_FR/Afone_Comnpay.csv +13 -0
- package.xml +18 -0
- skin/frontend/default/comnpay/logo-comnpay.png +0 -0
app/code/local/Afone/Comnpay/Block/Form.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Afone_Comnpay_Block_Form extends Mage_Payment_Block_Form {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('comnpay/form.phtml');
|
7 |
+
$this->setBannerSrc($this->getSkinUrl('images/logo-comnpay.png'));
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Afone/Comnpay/Block/Info.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Afone_Comnpay_Block_Info extends Mage_Payment_Block_Info {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('comnpay/info.phtml');
|
7 |
+
$this->setBannerSrc($this->getSkinUrl('images/logo-comnpay.png'));
|
8 |
+
}
|
9 |
+
|
10 |
+
|
11 |
+
}
|
app/code/local/Afone/Comnpay/Helper/Data.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Afone_Comnpay_Helper_Data extends Mage_Core_Helper_Abstract{
|
3 |
+
}
|
app/code/local/Afone/Comnpay/Model/Config.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* 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 Model
|
22 |
+
* @package Afone_Comnpay
|
23 |
+
* @author Afone
|
24 |
+
* @license GPL http://opensource.org/licenses/gpl-license.php
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Config model
|
30 |
+
*/
|
31 |
+
class Afone_Comnpay_Model_Config extends Mage_Payment_Model_Config
|
32 |
+
{
|
33 |
+
const CONFIG_PATH = 'payment/comnpay/';
|
34 |
+
const VERSION = "1.0.0";
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Return comnpay extension name
|
39 |
+
*
|
40 |
+
*/
|
41 |
+
public function getExtensionName()
|
42 |
+
{
|
43 |
+
return "magento-comnpay-".self::VERSION;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Return comnpay config information
|
48 |
+
*
|
49 |
+
* @param string $path
|
50 |
+
* @param int $storeId
|
51 |
+
* @return Simple_Xml
|
52 |
+
*/
|
53 |
+
public function getConfigData($path, $storeId=null)
|
54 |
+
{
|
55 |
+
if (!empty($path)) {
|
56 |
+
return Mage::getStoreConfig(self::CONFIG_PATH . $path, $storeId);
|
57 |
+
}
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Return config value for TPE Number
|
64 |
+
*
|
65 |
+
*/
|
66 |
+
public function getTpeNo()
|
67 |
+
{
|
68 |
+
return $this->getConfigData('tpe_no');
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Return config value for Devise
|
73 |
+
*
|
74 |
+
*/
|
75 |
+
public function getDevise()
|
76 |
+
{
|
77 |
+
return $this->getConfigData('devise');
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Return config value for Langue
|
82 |
+
*
|
83 |
+
*/
|
84 |
+
public function getLangue()
|
85 |
+
{
|
86 |
+
return $this->getConfigData('langue');
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Return config value for Secret Key
|
92 |
+
*
|
93 |
+
*/
|
94 |
+
public function getSecretKey()
|
95 |
+
{
|
96 |
+
return $this->getConfigData('secret_key');
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Return Production Gateway URL
|
101 |
+
*
|
102 |
+
*/
|
103 |
+
public function getProductionGatewayURL()
|
104 |
+
{
|
105 |
+
return $this->getConfigData('url_gateway_production');
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Return Homologation Gateway URL
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
public function getHomologationGatewayURL()
|
113 |
+
{
|
114 |
+
return $this->getConfigData('url_gateway_homologation');
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Return Gateway Config
|
119 |
+
*
|
120 |
+
*/
|
121 |
+
public function getGatewayConfig()
|
122 |
+
{
|
123 |
+
return $this->getConfigData('url_gateway_config');
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Return Gateway URL (depends Gateway URL Config : PRODUCTION or HOMOLOGATION)
|
130 |
+
*
|
131 |
+
*/
|
132 |
+
public function getGatewayURL($config=null)
|
133 |
+
{
|
134 |
+
if ($config==null)
|
135 |
+
{
|
136 |
+
$config=$this->getGatewayConfig();
|
137 |
+
}
|
138 |
+
|
139 |
+
if ($config=="HOMOLOGATION")
|
140 |
+
{
|
141 |
+
return $this->getHomologationGatewayURL();
|
142 |
+
}
|
143 |
+
else
|
144 |
+
{
|
145 |
+
return $this->getProductionGatewayURL();
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
150 |
+
?>
|
app/code/local/Afone/Comnpay/Model/Source/GatewayConfig.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Afone GatewayConfig Action Dropdown source
|
5 |
+
*/
|
6 |
+
class Afone_Comnpay_Model_Source_GatewayConfig
|
7 |
+
{
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array(
|
12 |
+
'value' => "HOMOLOGATION",
|
13 |
+
'label' => Mage::helper('comnpay')->__('Homologation')
|
14 |
+
),
|
15 |
+
array(
|
16 |
+
'value' => "PRODUCTION",
|
17 |
+
'label' => Mage::helper('comnpay')->__('Production')
|
18 |
+
),
|
19 |
+
);
|
20 |
+
}
|
21 |
+
}
|
app/code/local/Afone/Comnpay/Model/Standard.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main payment model
|
4 |
+
*
|
5 |
+
* @category Model
|
6 |
+
* @package Afone_Comnpay
|
7 |
+
* @author Afone
|
8 |
+
* @license GPL http://opensource.org/licenses/gpl-license.php
|
9 |
+
*/
|
10 |
+
class Afone_Comnpay_Model_Standard extends Mage_Payment_Model_Method_Abstract {
|
11 |
+
|
12 |
+
protected $_code = 'comnpay';
|
13 |
+
protected $_formBlockType = 'comnpay/form';
|
14 |
+
protected $_infoBlockType = 'comnpay/info';
|
15 |
+
|
16 |
+
protected $_isInitializeNeeded = true;
|
17 |
+
protected $_canUseInternal = true;
|
18 |
+
protected $_canUseForMultishipping = false;
|
19 |
+
|
20 |
+
public function getOrderPlaceRedirectUrl() {
|
21 |
+
return Mage::getUrl('comnpay/payment/redirect', array('_secure' => true));
|
22 |
+
}
|
23 |
+
}
|
24 |
+
?>
|
app/code/local/Afone/Comnpay/controllers/PaymentController.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Comnpay payment controller
|
4 |
+
* Documentation : http://docs.comnpay.com/
|
5 |
+
*
|
6 |
+
* @category Controller
|
7 |
+
* @package Afone_Comnpay
|
8 |
+
* @author Afone
|
9 |
+
* @license GPL http://opensource.org/licenses/gpl-license.php
|
10 |
+
*/
|
11 |
+
class Afone_Comnpay_PaymentController extends Mage_Core_Controller_Front_Action {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Redirects the user to the success page
|
15 |
+
*/
|
16 |
+
public function successAction() {
|
17 |
+
$this->_redirect('checkout/onepage/success');
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Redirects the user to the error page
|
22 |
+
*/
|
23 |
+
public function errorAction() {
|
24 |
+
$this->_redirect('checkout/onepage/failure');
|
25 |
+
}
|
26 |
+
|
27 |
+
/*
|
28 |
+
* The redirect action is triggered when someone places an order
|
29 |
+
*/
|
30 |
+
public function redirectAction() {
|
31 |
+
|
32 |
+
$config = Mage::getModel('comnpay/config');
|
33 |
+
|
34 |
+
$order = new Mage_Sales_Model_Order();
|
35 |
+
$order_id = Mage::getSingleton( 'checkout/session' )->getLastRealOrderId();
|
36 |
+
$order->loadByIncrementId( $order_id );
|
37 |
+
|
38 |
+
$comnpay['montant'] = number_format( $order->base_grand_total, 2 , '.', '');
|
39 |
+
$comnpay['idTPE'] = $config->getTpeNo();
|
40 |
+
$comnpay['idTransaction'] = $order_id;
|
41 |
+
$comnpay['devise'] = $config->getDevise();
|
42 |
+
$comnpay['lang'] = $config->getLangue();
|
43 |
+
$comnpay['nom_produit'] = Mage::app()->getStore()->getName();
|
44 |
+
$comnpay['source'] = $_SERVER['SERVER_NAME'];
|
45 |
+
$comnpay['urlRetourOK'] = Mage::getUrl( 'comnpay/payment/success' , array('_secure' => true) );
|
46 |
+
$comnpay['urlRetourNOK'] = Mage::getUrl( 'comnpay/payment/error' , array('_secure' => true));
|
47 |
+
$comnpay['urlIPN'] = Mage::getUrl( 'comnpay/payment/ipn' , array('_secure' => true) );
|
48 |
+
$comnpay['extension'] = $config->getExtensionName();
|
49 |
+
$comnpay['key'] = $config->getSecretKey();
|
50 |
+
|
51 |
+
// Encoding
|
52 |
+
$comnpayWithKey = base64_encode(implode("|", $comnpay));
|
53 |
+
unset($comnpay['key']);
|
54 |
+
$comnpay['sec'] = hash("sha512",$comnpayWithKey);
|
55 |
+
|
56 |
+
// Generate Form
|
57 |
+
$form = "";
|
58 |
+
foreach ($comnpay as $key => $value) {
|
59 |
+
$form .= '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
|
60 |
+
}
|
61 |
+
$comnpay_config['form'] = $form;
|
62 |
+
$comnpay_config['url-config'] = $config->getGatewayConfig();
|
63 |
+
$comnpay_config['form-action'] = $config->getGatewayURL($comnpay_config['url-config']);
|
64 |
+
|
65 |
+
|
66 |
+
// Save information
|
67 |
+
Mage::register( 'comnpay', $comnpay_config );
|
68 |
+
|
69 |
+
// Load and render the layout
|
70 |
+
$this->loadLayout();
|
71 |
+
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template','comnpay',array('template' => 'comnpay/redirect.phtml'));
|
72 |
+
$this->getLayout()->getBlock('content')->append($block);
|
73 |
+
$this->renderLayout();
|
74 |
+
}
|
75 |
+
|
76 |
+
/*
|
77 |
+
* The ipn action is triggered when your gateway sends back a response after processing the customer's payment
|
78 |
+
*/
|
79 |
+
public function ipnAction() {
|
80 |
+
Mage::log("Appel de l'ipn ...", Zend_Log::DEBUG);
|
81 |
+
Mage::log($_REQUEST, Zend_Log::DEBUG);
|
82 |
+
|
83 |
+
$config = Mage::getModel('comnpay/config');
|
84 |
+
|
85 |
+
if($this->getRequest()->isPost())
|
86 |
+
{
|
87 |
+
if (!$this->validSec($_REQUEST, $config->getSecretKey()))
|
88 |
+
{
|
89 |
+
Mage::log("Comnpay : Erreur lors de la validation des informations transmises !", Zend_Log::ERR);
|
90 |
+
$this->cancelAction();
|
91 |
+
header("Status: 400 Bad Request", false, 400);
|
92 |
+
exit();
|
93 |
+
}
|
94 |
+
|
95 |
+
$validated="";
|
96 |
+
if (isset($_REQUEST['result']))
|
97 |
+
$validated = $_REQUEST['result'];
|
98 |
+
|
99 |
+
|
100 |
+
if($validated == "OK") {
|
101 |
+
// Payment was successful, so update the order's state, send order email and move to the success page
|
102 |
+
$orderId="";
|
103 |
+
if (isset($_REQUEST['idTransaction']))
|
104 |
+
$orderId = $_REQUEST['idTransaction'];
|
105 |
+
|
106 |
+
$order = Mage::getModel('sales/order');
|
107 |
+
$order->loadByIncrementId($orderId);
|
108 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
|
109 |
+
|
110 |
+
$order->sendNewOrderEmail();
|
111 |
+
$order->setEmailSent(true);
|
112 |
+
|
113 |
+
$order->save();
|
114 |
+
|
115 |
+
Mage::getSingleton('checkout/session')->unsQuoteId();
|
116 |
+
}
|
117 |
+
else
|
118 |
+
{
|
119 |
+
// There is a problem in the response we got
|
120 |
+
Mage::log("Comnpay : Paiement refusé !", Zend_Log::DEBUG);
|
121 |
+
$this->cancelAction();
|
122 |
+
}
|
123 |
+
}
|
124 |
+
else
|
125 |
+
{
|
126 |
+
Mage::log("Comnpay : Aucun paramètres POST reçu !", Zend_Log::ERR);
|
127 |
+
header("Status: 400 Bad Request", false, 400);
|
128 |
+
}
|
129 |
+
|
130 |
+
exit();
|
131 |
+
}
|
132 |
+
|
133 |
+
/*
|
134 |
+
* The cancel action is triggered when an order is to be cancelled
|
135 |
+
*/
|
136 |
+
public function cancelAction() {
|
137 |
+
if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
|
138 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
|
139 |
+
if($order->getId()) {
|
140 |
+
// Flag the order as 'cancelled' and save it
|
141 |
+
$order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Gateway has declined the payment.')->save();
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/*
|
147 |
+
* Secret Validation
|
148 |
+
*/
|
149 |
+
private function validSec($values, $secret_key){
|
150 |
+
if (isset($values['sec']) && $values['sec'] != "")
|
151 |
+
{
|
152 |
+
$sec = $values['sec'];
|
153 |
+
unset($values['sec']);
|
154 |
+
return strtoupper(hash("sha512", base64_encode(implode("|",$values)."|".$secret_key))) == strtoupper($sec);
|
155 |
+
}
|
156 |
+
else
|
157 |
+
{
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
}
|
app/code/local/Afone/Comnpay/etc/config.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Afone_Comnpay>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Afone_Comnpay>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<comnpay>
|
11 |
+
<class>Afone_Comnpay_Block</class>
|
12 |
+
</comnpay>
|
13 |
+
</blocks>
|
14 |
+
<models>
|
15 |
+
<comnpay>
|
16 |
+
<class>Afone_Comnpay_Model</class>
|
17 |
+
</comnpay>
|
18 |
+
</models>
|
19 |
+
<helpers>
|
20 |
+
<comnpay>
|
21 |
+
<class>Afone_Comnpay_Helper</class>
|
22 |
+
</comnpay>
|
23 |
+
</helpers>
|
24 |
+
</global>
|
25 |
+
<default>
|
26 |
+
<payment>
|
27 |
+
<comnpay>
|
28 |
+
<model>comnpay/standard</model>
|
29 |
+
<active>1</active>
|
30 |
+
<order_status>pending</order_status>
|
31 |
+
<title>Paiement CB - Comnpay</title>
|
32 |
+
<payment_action>sale</payment_action>
|
33 |
+
<allowspecific>0</allowspecific>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<devise>EUR</devise>
|
36 |
+
<langue>fr</langue>
|
37 |
+
<url_gateway_config>HOMOLOGATION</url_gateway_config>
|
38 |
+
<url_gateway_homologation>https://secure.homologation.comnpay.com</url_gateway_homologation>
|
39 |
+
<url_gateway_production>https://secure.comnpay.com</url_gateway_production>
|
40 |
+
<tpe_no backend_model="adminhtml/system_config_backend_encrypted"/>
|
41 |
+
<secret_key backend_model="adminhtml/system_config_backend_encrypted"/>
|
42 |
+
</comnpay>
|
43 |
+
</payment>
|
44 |
+
</default>
|
45 |
+
<frontend>
|
46 |
+
<routers>
|
47 |
+
<comnpay>
|
48 |
+
<use>standard</use>
|
49 |
+
<args>
|
50 |
+
<module>Afone_Comnpay</module>
|
51 |
+
<frontName>comnpay</frontName>
|
52 |
+
</args>
|
53 |
+
</comnpay>
|
54 |
+
</routers>
|
55 |
+
<translate>
|
56 |
+
<modules>
|
57 |
+
<Afone_Comnpay>
|
58 |
+
<files>
|
59 |
+
<default>Afone_Comnpay.csv</default>
|
60 |
+
</files>
|
61 |
+
</Afone_Comnpay>
|
62 |
+
</modules>
|
63 |
+
</translate>
|
64 |
+
</frontend>
|
65 |
+
<adminhtml>
|
66 |
+
<translate>
|
67 |
+
<modules>
|
68 |
+
<Afone_Comnpay>
|
69 |
+
<files>
|
70 |
+
<default>Afone_Comnpay.csv</default>
|
71 |
+
</files>
|
72 |
+
</Afone_Comnpay>
|
73 |
+
</modules>
|
74 |
+
</translate>
|
75 |
+
</adminhtml>
|
76 |
+
</config>
|
app/code/local/Afone/Comnpay/etc/system.xml
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<comnpay translate="label comment" module="comnpay">
|
7 |
+
<label>Comnpay</label>
|
8 |
+
<comment><![CDATA[Comnpay est une solution de paiement sécurisé sur Internet. Véritable TPE Virtuel, Comnpay permet d’encaisser les paiements réalisés sur Internet 24 heures sur 24 et 7 jours sur 7. <br/>Plus d'information sur <a href="http://docs.comnpay.com/">la documentation officielle</a>.]]></comment>
|
9 |
+
<frontend_type>text</frontend_type>
|
10 |
+
<sort_order>600</sort_order>
|
11 |
+
<show_in_default>1</show_in_default>
|
12 |
+
<show_in_website>1</show_in_website>
|
13 |
+
<show_in_store>1</show_in_store>
|
14 |
+
<fields>
|
15 |
+
<active translate="label">
|
16 |
+
<label>Enabled</label>
|
17 |
+
<frontend_type>select</frontend_type>
|
18 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
19 |
+
<sort_order>10</sort_order>
|
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 |
+
</active>
|
24 |
+
<title translate="label comment">
|
25 |
+
<label>Title</label>
|
26 |
+
<comment>
|
27 |
+
<![CDATA[Texte affiché au client lors du choix du mode paiement]]>
|
28 |
+
</comment>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>20</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</title>
|
35 |
+
<order_status translate="label">
|
36 |
+
<label>New Order Status</label>
|
37 |
+
<frontend_type>select</frontend_type>
|
38 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
39 |
+
<sort_order>50</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 |
+
</order_status>
|
44 |
+
<sort_order translate="label">
|
45 |
+
<label>Sort Order</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>100</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 |
+
</sort_order>
|
52 |
+
<tpe_no translate="label comment">
|
53 |
+
<label>TPE number</label>
|
54 |
+
<comment>
|
55 |
+
<![CDATA[Votre numéro de TPE vous sera communiqué par AfonePaiement]]>
|
56 |
+
</comment>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
59 |
+
<sort_order>80</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>0</show_in_store>
|
63 |
+
</tpe_no>
|
64 |
+
<secret_key translate="label comment">
|
65 |
+
<label>Secret Key</label>
|
66 |
+
<comment>
|
67 |
+
<![CDATA[Votre clé secrète vous sera communiquée par AfonePaiement (elle doit rester personnelle et ne jamais être communiquée)]]>
|
68 |
+
</comment>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
71 |
+
<sort_order>81</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>0</show_in_store>
|
75 |
+
</secret_key>
|
76 |
+
<devise translate="label">
|
77 |
+
<label>Devise</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>90</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>0</show_in_store>
|
83 |
+
</devise>
|
84 |
+
<langue translate="label">
|
85 |
+
<label>Language</label>
|
86 |
+
<frontend_type>text</frontend_type>
|
87 |
+
<sort_order>100</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>0</show_in_store>
|
91 |
+
</langue>
|
92 |
+
<url_gateway_config translate="label comment">
|
93 |
+
<label>URL Gateway Configuration</label>
|
94 |
+
<comment>
|
95 |
+
<![CDATA[L'homologation vous permet de tester votre installation. La production est à activer une fois les tests validés.]]>
|
96 |
+
</comment>
|
97 |
+
<frontend_type>select</frontend_type>
|
98 |
+
<source_model>comnpay/source_gatewayConfig</source_model>
|
99 |
+
<sort_order>83</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 |
+
</url_gateway_config>
|
104 |
+
<url_gateway_homologation translate="label">
|
105 |
+
<label>Gateway URL for approval</label>
|
106 |
+
<frontend_type>text</frontend_type>
|
107 |
+
<sort_order>84</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 |
+
</url_gateway_homologation>
|
112 |
+
<url_gateway_production translate="label">
|
113 |
+
<label>Gateway URL for production</label>
|
114 |
+
<frontend_type>text</frontend_type>
|
115 |
+
<sort_order>85</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>0</show_in_store>
|
119 |
+
</url_gateway_production>
|
120 |
+
</fields>
|
121 |
+
</comnpay>
|
122 |
+
</groups>
|
123 |
+
</payment>
|
124 |
+
</sections>
|
125 |
+
</config>
|
app/design/frontend/base/default/template/comnpay/form.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<!--<img src="<?php echo $this->getBannerSrc() ?>" alt="Comnpay" />-->
|
app/design/frontend/base/default/template/comnpay/info.phtml
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<p><strong><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></strong></p>
|
2 |
+
<!--<img src="<?php echo $this->getBannerSrc() ?>" alt="Comnpay" style="width:180px"/>-->
|
app/design/frontend/base/default/template/comnpay/redirect.phtml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Get data
|
3 |
+
$comnpay = Mage::registry( 'comnpay' );
|
4 |
+
|
5 |
+
if ($comnpay['url-config']=="HOMOLOGATION")
|
6 |
+
{
|
7 |
+
echo "<center><b><span style='color:red'>PAIEMENT DE TEST</span></b></center>";
|
8 |
+
}
|
9 |
+
?>
|
10 |
+
|
11 |
+
<p><?php echo $this->__('Please wait, you will be redirected to the payment form.');?> <a href="javascript:document.comnpay.submit();"><?php echo $this->__('Or click here.');?></a></p>
|
12 |
+
|
13 |
+
<form name="comnpay" method="post" action="<?php echo $comnpay['form-action']; ?>">
|
14 |
+
<?php echo $comnpay['form']; ?>
|
15 |
+
</form>
|
16 |
+
|
17 |
+
<script type="text/javascript">
|
18 |
+
document.comnpay.submit();
|
19 |
+
</script>
|
app/etc/modules/Afone_Comnpay.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Afone_Comnpay>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Afone_Comnpay>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/fr_FR/Afone_Comnpay.csv
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Enabled","Activé"
|
2 |
+
"Title","Titre"
|
3 |
+
"New Order Status","Statut d'une nouvelle commande"
|
4 |
+
"TPE number","Numéro de TPE"
|
5 |
+
"Secret Key","Clé secrète"
|
6 |
+
"URL Gateway Configuration","Type de passerelle à utiliser"
|
7 |
+
"Gateway URL for approval","URL pour l'homologation"
|
8 |
+
"Gateway URL for production","URL pour la production"
|
9 |
+
"Please wait, you will be redirected to the payment form.","Veuillez patienter, vous allez être redirigé vers le formulaire de paiement."
|
10 |
+
"Or click here.","Si ce n'est pas le cas, cliquez ici."
|
11 |
+
"Sort Order","Ordre de tri"
|
12 |
+
"Activate payment in one clic","Activer le paiement en un clic"
|
13 |
+
"Customer can choose to save his credit card","Le client peut choisir de sauvegarder sa CB"
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Afone_Comnpay</name>
|
4 |
+
<version>1.0.2</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The extension provides Comnpay payment integration. </summary>
|
10 |
+
<description>The extension provides Comnpay payment integration. </description>
|
11 |
+
<notes>Package de la version 1.0.2</notes>
|
12 |
+
<authors><author><name>Afone</name><user>SMA</user><email>smalinge@afone.com</email></author><author><name>Afone</name><user>comnpay-technique</user><email>technique@comnpay.com</email></author></authors>
|
13 |
+
<date>2014-03-17</date>
|
14 |
+
<time>13:40:25</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Afone"><dir name="Comnpay"><dir name="Block"><file name="Form.php" hash="ca26215d0ab55dc3f7aacd0251d50cff"/><file name="Info.php" hash="f5a8eb9455cb4aead41fc2b514476a4e"/></dir><dir name="Helper"><file name="Data.php" hash="466794a09ce357efd1fa8c3557632618"/></dir><dir name="Model"><file name="Config.php" hash="09d2de1330b91d44595978f4568f31f7"/><dir name="Source"><file name="GatewayConfig.php" hash="8a78c821784419c9d73db715da107c73"/></dir><file name="Standard.php" hash="d6dfda5d15b5e653ac6271ec3792220a"/></dir><dir name="controllers"><file name="PaymentController.php" hash="dadb6381a028c6d02e72d22877959673"/></dir><dir name="etc"><file name="config.xml" hash="5d9e3fe6631129147f18da370051ec77"/><file name="system.xml" hash="0b10066abf7a2e71884c3515da8ff1ce"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="comnpay"><file name="form.phtml" hash="dbf84bfa2f81aa259137b6df00e00cea"/><file name="info.phtml" hash="1eb9b644b1ed16aceab214474c1dfba9"/><file name="redirect.phtml" hash="027352527d68f8bd0c62baee7de58ec5"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Afone_Comnpay.xml" hash="df1877990fbda48789d0a047bdfa05ed"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Afone_Comnpay.csv" hash="4951a072f71981baf0b2e9d5bfeb9ff4"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="comnpay"><file name="logo-comnpay.png" hash="d53116075ead203c5544b9bb901979b1"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/default/comnpay/logo-comnpay.png
ADDED
Binary file
|