Version Notes
Package de la version 1.1.0
Download this release
Release Info
Developer | Afone |
Extension | Afone_Comnpay |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.1.0
- app/code/local/Afone/Comnpay/Block/Adminhtml/Order/View/Tab/Infostransactions.php +127 -0
- app/code/local/Afone/Comnpay/Block/Form.php +0 -10
- app/code/local/Afone/Comnpay/Block/FormDebit.php +10 -0
- app/code/local/Afone/Comnpay/Block/FormP3f.php +10 -0
- app/code/local/Afone/Comnpay/Block/Info.php +0 -11
- app/code/local/Afone/Comnpay/Block/InfoDebit.php +10 -0
- app/code/local/Afone/Comnpay/Block/InfoP3f.php +10 -0
- app/code/local/Afone/Comnpay/Helper/Data.php +22 -1
- app/code/local/Afone/Comnpay/Model/ComnpayDebit.php +22 -0
- app/code/local/Afone/Comnpay/Model/ComnpayP3f.php +22 -0
- app/code/local/Afone/Comnpay/Model/Config.php +175 -149
- app/code/local/Afone/Comnpay/Model/ModelAbstract.php +22 -0
- app/code/local/Afone/Comnpay/Model/Source/PnfConfig.php +21 -0
- app/code/local/Afone/Comnpay/Model/Validate.php +53 -0
- app/code/local/Afone/Comnpay/controllers/PaymentController.php +173 -126
- app/code/local/Afone/Comnpay/etc/config.xml +91 -74
- app/code/local/Afone/Comnpay/etc/system.xml +185 -123
- app/design/adminhtml/default/default/layout/transactions.xml +16 -0
- app/design/adminhtml/default/default/template/comnpay/infostransactions.phtml +36 -0
- app/design/frontend/base/default/template/comnpay/form.phtml +0 -1
- app/design/frontend/base/default/template/comnpay/formDebit.phtml +2 -0
- app/design/frontend/base/default/template/comnpay/formP3f.phtml +2 -0
- app/design/frontend/base/default/template/comnpay/{info.phtml → infoDebit.phtml} +0 -0
- app/design/frontend/base/default/template/comnpay/infoP3f.phtml +2 -0
- app/locale/fr_FR/Afone_Comnpay.csv +4 -1
- js/comnpay/validation.js +22 -0
- package.xml +5 -5
- skin/frontend/base/default/images/comnpay/comnpay_debit.png +0 -0
- skin/frontend/base/default/images/comnpay/comnpay_p3f.png +0 -0
- skin/frontend/{default → base/default/images}/comnpay/logo-comnpay.png +0 -0
app/code/local/Afone/Comnpay/Block/Adminhtml/Order/View/Tab/Infostransactions.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: bbilly
|
5 |
+
* Date: 11/05/2015
|
6 |
+
* Time: 10:56
|
7 |
+
*/
|
8 |
+
class Afone_Comnpay_Block_Adminhtml_Order_View_Tab_Infostransactions
|
9 |
+
extends Mage_Adminhtml_Block_Template
|
10 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
11 |
+
{
|
12 |
+
protected $_chat = null;
|
13 |
+
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
parent::_construct();
|
17 |
+
$this->setTemplate('comnpay/infostransactions.phtml');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getTabLabel() {
|
21 |
+
return $this->__('Transactions ComNpay');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getTabTitle() {
|
25 |
+
return $this->__('Transactions ComNpay');
|
26 |
+
}
|
27 |
+
|
28 |
+
public function canShowTab() {
|
29 |
+
return true;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* On v�rifie si le paiement a �t� pass" avec comnpay
|
34 |
+
* sinon on masque l'onglet d�tail des transactions comnpay
|
35 |
+
*/
|
36 |
+
public function isHidden() {
|
37 |
+
$type_payment = $this->getOrder()->getPayment()->getMethodInstance()->getCode();
|
38 |
+
if($type_payment == "comnpay_p3f" || $type_payment == "comnpay_debit")
|
39 |
+
return false;
|
40 |
+
else
|
41 |
+
return true;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getOrder(){
|
45 |
+
return Mage::registry('current_order');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* On recupere les transactions en fonction de la m�thode de paiement (debit ou pnf)
|
50 |
+
*/
|
51 |
+
public function getTransactions() {
|
52 |
+
|
53 |
+
$transaction_id = $this->getOrder()->getIncrementId();
|
54 |
+
$type_payment = $this->getOrder()->getPayment()->getMethodInstance()->getCode();
|
55 |
+
$config = Mage::getModel('comnpay/config');
|
56 |
+
|
57 |
+
|
58 |
+
if($type_payment == "comnpay_p3f")
|
59 |
+
return $this->getTransactionsPnf($transaction_id,$config);
|
60 |
+
else if($type_payment == "comnpay_debit")
|
61 |
+
return $this->getTransactionsDebit($transaction_id,$config);
|
62 |
+
else
|
63 |
+
return null;
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getTransactionsPnf($transaction_id,$config) {
|
68 |
+
$data="serialNumber=".$config->getTpeNo()."&key=".$config->getSecretKey()."&transactionRef=".$transaction_id;
|
69 |
+
$url= $config->getGatewayURL().":".$config->getPort().$config->getPathP3f();
|
70 |
+
$opts = array('http' =>
|
71 |
+
array(
|
72 |
+
'method' => 'POST',
|
73 |
+
'header' => "Content-Type: application/x-www-form-urlencoded",
|
74 |
+
'content' => $data
|
75 |
+
)
|
76 |
+
);
|
77 |
+
$context = stream_context_create($opts);
|
78 |
+
$result = file_get_contents($url, false, $context);
|
79 |
+
if($result != false) {
|
80 |
+
$json = json_decode($result);
|
81 |
+
$transac = array();
|
82 |
+
foreach($json->pnfFile[0]->pnfTransactions as $transaction) {
|
83 |
+
$transac[] = array(
|
84 |
+
'transacId' => $transaction->pnfTransactionId,
|
85 |
+
'transacDate' => $transaction->plannedDate,
|
86 |
+
'transacMontant' => $transaction->amount,
|
87 |
+
'transacOK' => $transaction->message
|
88 |
+
);
|
89 |
+
}
|
90 |
+
return $transac;
|
91 |
+
}
|
92 |
+
else {
|
93 |
+
Mage::log("comnpay module: �chec lors de l'appel au Web Service ! Commande :".$transaction_id, Zend_Log::DEBUG);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
public function getTransactionsDebit($transaction_id,$config) {
|
98 |
+
$data="serialNumber=".$config->getTpeNo()."&key=".$config->getSecretKey()."&transactionRef=".$transaction_id;
|
99 |
+
$url= $config->getGatewayURL().":".$config->getPort().$config->getPathD();
|
100 |
+
$opts = array('http' =>
|
101 |
+
array(
|
102 |
+
'method' => 'POST',
|
103 |
+
'header' => "Content-Type: application/x-www-form-urlencoded",
|
104 |
+
'content' => $data
|
105 |
+
)
|
106 |
+
);
|
107 |
+
$context = stream_context_create($opts);
|
108 |
+
$result = file_get_contents($url, false, $context);
|
109 |
+
if($result != false) {
|
110 |
+
$json = json_decode($result);
|
111 |
+
$transac = array();
|
112 |
+
foreach($json->transaction as $transaction) {
|
113 |
+
$transac[] = array(
|
114 |
+
'transacId' => $transaction->transactionId,
|
115 |
+
'transacDate' => $transaction->transactionDate,
|
116 |
+
'transacMontant' => $transaction->amount,
|
117 |
+
'transacOK' => $transaction->message
|
118 |
+
);
|
119 |
+
}
|
120 |
+
return $transac;
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
Mage::log("comnpay module: �chec lors de l'appel au Web Service ! Commande :".$transaction_id, Zend_Log::DEBUG);
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
?>
|
app/code/local/Afone/Comnpay/Block/Form.php
DELETED
@@ -1,10 +0,0 @@
|
|
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/FormDebit.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Afone_Comnpay_Block_FormDebit extends Mage_Payment_Block_Form {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('comnpay/formDebit.phtml');
|
7 |
+
$this->setBannerSrc($this->getSkinUrl('images/comnpay/comnpay_debit.png'));
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Afone/Comnpay/Block/FormP3f.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Afone_Comnpay_Block_FormP3f extends Mage_Payment_Block_Form {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('comnpay/formP3f.phtml');
|
7 |
+
$this->setBannerSrc($this->getSkinUrl('images/comnpay/comnpay_p3f.png'));
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Afone/Comnpay/Block/Info.php
DELETED
@@ -1,11 +0,0 @@
|
|
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/Block/InfoDebit.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Afone_Comnpay_Block_InfoDebit extends Mage_Payment_Block_Info {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('comnpay/infoDebit.phtml');
|
7 |
+
$this->setBannerSrc($this->getSkinUrl('images/comnpay/logo-comnpay.png'));
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Afone/Comnpay/Block/InfoP3f.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Afone_Comnpay_Block_InfoP3f extends Mage_Payment_Block_Info {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('comnpay/infoP3f.phtml');
|
7 |
+
$this->setBannerSrc($this->getSkinUrl('images/comnpay/logo-comnpay.png'));
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Afone/Comnpay/Helper/Data.php
CHANGED
@@ -1,3 +1,24 @@
|
|
1 |
<?php
|
2 |
class Afone_Comnpay_Helper_Data extends Mage_Core_Helper_Abstract{
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
class Afone_Comnpay_Helper_Data extends Mage_Core_Helper_Abstract{
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Validates the private key value by comparing it to an empty string
|
6 |
+
* @return boolean
|
7 |
+
*/
|
8 |
+
public function isTpeNoSet()
|
9 |
+
{
|
10 |
+
$config = Mage::getModel('comnpay/config');
|
11 |
+
return $config->getTpeNo();
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Validates the public key value by comparing it to an empty string
|
16 |
+
* @return boolean
|
17 |
+
*/
|
18 |
+
public function isSecretKeySet()
|
19 |
+
{
|
20 |
+
$config = Mage::getModel('comnpay/config');
|
21 |
+
return $config->getSecretKey() !== "";
|
22 |
+
}
|
23 |
+
}
|
24 |
+
?>
|
app/code/local/Afone/Comnpay/Model/ComnpayDebit.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_ComnpayDebit extends Afone_Comnpay_Model_ModelAbstract {
|
11 |
+
|
12 |
+
protected $_code = 'comnpay_debit';
|
13 |
+
protected $_formBlockType = 'comnpay/formDebit';
|
14 |
+
protected $_infoBlockType = 'comnpay/infoDebit';
|
15 |
+
|
16 |
+
public $typeTr = "d";
|
17 |
+
|
18 |
+
protected $_isInitializeNeeded = true;
|
19 |
+
protected $_canUseInternal = true;
|
20 |
+
protected $_canUseForMultishipping = false;
|
21 |
+
}
|
22 |
+
?>
|
app/code/local/Afone/Comnpay/Model/ComnpayP3f.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_ComnpayP3f extends Afone_Comnpay_Model_ModelAbstract {
|
11 |
+
|
12 |
+
protected $_code = 'comnpay_p3f';
|
13 |
+
protected $_formBlockType = 'comnpay/formP3f';
|
14 |
+
protected $_infoBlockType = 'comnpay/infoP3f';
|
15 |
+
|
16 |
+
public $typeTr = "p3f";
|
17 |
+
|
18 |
+
protected $_isInitializeNeeded = true;
|
19 |
+
protected $_canUseInternal = true;
|
20 |
+
protected $_canUseForMultishipping = false;
|
21 |
+
}
|
22 |
+
?>
|
app/code/local/Afone/Comnpay/Model/Config.php
CHANGED
@@ -1,150 +1,176 @@
|
|
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/
|
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 |
-
*
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_debit/';
|
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 |
+
* Return Gateway URL (depends Gateway URL Config : PRODUCTION or HOMOLOGATION)
|
129 |
+
*
|
130 |
+
*/
|
131 |
+
public function getGatewayURL($config=null)
|
132 |
+
{
|
133 |
+
if ($config==null)
|
134 |
+
{
|
135 |
+
$config=$this->getGatewayConfig();
|
136 |
+
}
|
137 |
+
|
138 |
+
if ($config=="HOMOLOGATION")
|
139 |
+
{
|
140 |
+
return $this->getHomologationGatewayURL();
|
141 |
+
}
|
142 |
+
else
|
143 |
+
{
|
144 |
+
return $this->getProductionGatewayURL();
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Return Port
|
150 |
+
*
|
151 |
+
*/
|
152 |
+
public function getPort()
|
153 |
+
{
|
154 |
+
return $this->getConfigData('port');
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Return API Path debit
|
159 |
+
*
|
160 |
+
*/
|
161 |
+
public function getPathD()
|
162 |
+
{
|
163 |
+
return $this->getConfigData('path_d');
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Return API Path PNF
|
168 |
+
*
|
169 |
+
*/
|
170 |
+
public function getPathP3f()
|
171 |
+
{
|
172 |
+
return $this->getConfigData('path_p3f');
|
173 |
+
}
|
174 |
+
|
175 |
+
}
|
176 |
?>
|
app/code/local/Afone/Comnpay/Model/ModelAbstract.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_ModelAbstract extends Mage_Payment_Model_Method_Abstract {
|
11 |
+
|
12 |
+
public function getOrderPlaceRedirectUrl() {
|
13 |
+
return Mage::getUrl('comnpay/payment/redirect', array('_secure' => true));
|
14 |
+
}
|
15 |
+
|
16 |
+
public function isAvailable($quote = null)
|
17 |
+
{
|
18 |
+
$keysAreSet = Mage::helper("comnpay")->isTpeNoSet() && Mage::helper("comnpay")->isSecretKeySet();
|
19 |
+
return parent::isAvailable($quote) && $keysAreSet;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
?>
|
app/code/local/Afone/Comnpay/Model/Source/PnfConfig.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Afone PnfConfig Action Dropdown source
|
5 |
+
*/
|
6 |
+
class Afone_Comnpay_Model_Source_PnfConfig
|
7 |
+
{
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array(
|
12 |
+
'value' => "OUI",
|
13 |
+
'label' => Mage::helper('comnpay')->__('Oui')
|
14 |
+
),
|
15 |
+
array(
|
16 |
+
'value' => "NON",
|
17 |
+
'label' => Mage::helper('comnpay')->__('Non')
|
18 |
+
),
|
19 |
+
);
|
20 |
+
}
|
21 |
+
}
|
app/code/local/Afone/Comnpay/Model/Validate.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: bbilly
|
5 |
+
* Date: 13/05/2015
|
6 |
+
* Time: 16:17
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Afone_Comnpay_Model_Validate extends Mage_Core_Model_Config_Data
|
10 |
+
{
|
11 |
+
|
12 |
+
public function save()
|
13 |
+
{
|
14 |
+
if($this->checkLogin()) {
|
15 |
+
Mage::getSingleton('core/session')->addSuccess('Merci d\'avoir choisi ComNpay !');
|
16 |
+
}
|
17 |
+
else {
|
18 |
+
Mage::getSingleton('core/session')->addError('Attention, votre numéro de TPE et/ou clé secrète sont incorrects.');
|
19 |
+
}
|
20 |
+
|
21 |
+
return parent::save(); //call original save method so whatever happened
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getFieldsetDataValue($key)
|
25 |
+
{
|
26 |
+
$data = $this->_getData('fieldset_data');
|
27 |
+
return (is_array($data) && isset($data[$key])) ? $data[$key] : null;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function checkLogin() {
|
31 |
+
$tpe_no = $this->getFieldsetDataValue("tpe_no");
|
32 |
+
$key = $this->getFieldsetDataValue("secret_key");
|
33 |
+
|
34 |
+
$config = Mage::getModel('comnpay/config');
|
35 |
+
$data ="serialNumber=".$tpe_no."&key=".$key;
|
36 |
+
$url = $config->getGatewayURL().":".$config->getPort().$config->getPathD();
|
37 |
+
$opts = array('http' =>
|
38 |
+
array(
|
39 |
+
'method' => 'POST',
|
40 |
+
'header' => "Content-Type: application/x-www-form-urlencoded",
|
41 |
+
'content' => $data
|
42 |
+
)
|
43 |
+
);
|
44 |
+
$context = stream_context_create($opts);
|
45 |
+
$result = file_get_contents($url, false, $context);
|
46 |
+
$json = json_decode($result);
|
47 |
+
if($json == null)
|
48 |
+
return false;
|
49 |
+
else
|
50 |
+
return true;
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
app/code/local/Afone/Comnpay/controllers/PaymentController.php
CHANGED
@@ -10,153 +10,200 @@
|
|
10 |
*/
|
11 |
class Afone_Comnpay_PaymentController extends Mage_Core_Controller_Front_Action {
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
foreach ($comnpay as $key => $value) {
|
59 |
-
|
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 |
-
|
|
|
71 |
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template','comnpay',array('template' => 'comnpay/redirect.phtml'));
|
72 |
-
|
73 |
$this->renderLayout();
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
|
138 |
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
|
139 |
if($order->getId()) {
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
}
|
144 |
-
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
if (isset($values['sec']) && $values['sec'] != "")
|
151 |
{
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
}
|
156 |
else
|
157 |
{
|
158 |
-
|
159 |
}
|
160 |
-
}
|
161 |
|
162 |
}
|
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 |
+
$payment = $order->getPayment()->getMethodInstance();
|
39 |
+
|
40 |
+
$country = Mage::getModel('directory/country');
|
41 |
+
|
42 |
+
$customer = $order->getBillingAddress()->getData();
|
43 |
+
|
44 |
+
$comnpay['montant'] = number_format( $order->base_grand_total, 2 , '.', '');
|
45 |
+
$comnpay['idTPE'] = $config->getTpeNo();
|
46 |
+
$comnpay['idTransaction'] = $order_id;
|
47 |
+
$comnpay['devise'] = $config->getDevise();
|
48 |
+
$comnpay['lang'] = $config->getLangue();
|
49 |
+
$comnpay['nom_produit'] = Mage::app()->getStore()->getName();
|
50 |
+
$comnpay['source'] = $_SERVER['SERVER_NAME'];
|
51 |
+
$comnpay['urlRetourOK'] = Mage::getUrl( 'comnpay/payment/success' , array('_secure' => true) );
|
52 |
+
$comnpay['urlRetourNOK'] = Mage::getUrl( 'comnpay/payment/error' , array('_secure' => true));
|
53 |
+
$comnpay['urlIPN'] = Mage::getUrl( 'comnpay/payment/ipn' , array('_secure' => true) );
|
54 |
+
$comnpay['extension'] = $config->getExtensionName();
|
55 |
+
$comnpay['typeTr'] = $payment->typeTr;
|
56 |
+
$comnpay['data'] = $payment->typeTr;
|
57 |
+
if( $payment->typeTr == "p3f" ) {
|
58 |
+
$comnpay["user_nom"] = $customer["lastname"];
|
59 |
+
$comnpay["user_prenom"] = $customer["firstname"];
|
60 |
+
$comnpay["user_email"] = $customer["email"];
|
61 |
+
$comnpay["user_telephone"] = $customer["telephone"];
|
62 |
+
$comnpay["user_adresse"] = $customer["street"];
|
63 |
+
$comnpay["user_codePostal"] = $customer["postcode"];
|
64 |
+
$comnpay["user_ville"] = $customer["city"];
|
65 |
+
$comnpay["user_pays"] = $country->loadByCode($customer["country_id"])->getName();
|
66 |
+
}
|
67 |
+
$comnpay['key'] = $config->getSecretKey();
|
68 |
+
|
69 |
+
// Encoding
|
70 |
+
$comnpayWithKey = base64_encode(implode("|", $comnpay));
|
71 |
+
unset($comnpay['key']);
|
72 |
+
$comnpay['sec'] = hash("sha512",$comnpayWithKey);
|
73 |
+
|
74 |
+
// Generate Form
|
75 |
+
$form = "";
|
76 |
foreach ($comnpay as $key => $value) {
|
77 |
+
$form .= '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
|
78 |
}
|
79 |
$comnpay_config['form'] = $form;
|
80 |
$comnpay_config['url-config'] = $config->getGatewayConfig();
|
81 |
$comnpay_config['form-action'] = $config->getGatewayURL($comnpay_config['url-config']);
|
82 |
+
|
83 |
+
|
84 |
// Save information
|
85 |
Mage::register( 'comnpay', $comnpay_config );
|
86 |
+
$order->setState(
|
87 |
+
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
|
88 |
+
);
|
89 |
+
$order->addStatusHistoryComment(Mage::helper('comnpay')->__('Customer was redirected to ComNpay'));
|
90 |
+
$order->save();
|
91 |
|
92 |
// Load and render the layout
|
93 |
+
|
94 |
+
$this->loadLayout();
|
95 |
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template','comnpay',array('template' => 'comnpay/redirect.phtml'));
|
96 |
+
$this->getLayout()->getBlock('content')->append($block);
|
97 |
$this->renderLayout();
|
98 |
+
}
|
99 |
+
|
100 |
+
/*
|
101 |
+
* The ipn action is triggered when your gateway sends back a response after processing the customer's payment
|
102 |
+
*/
|
103 |
+
public function ipnAction() {
|
104 |
+
Mage::log("Appel de l'ipn ...", Zend_Log::DEBUG);
|
105 |
+
Mage::log($_REQUEST, Zend_Log::DEBUG);
|
106 |
+
|
107 |
+
$config = Mage::getModel('comnpay/config');
|
108 |
+
|
109 |
+
if($this->getRequest()->isPost())
|
110 |
+
{
|
111 |
+
if (!$this->validSec($_REQUEST, $config->getSecretKey()))
|
112 |
+
{
|
113 |
+
Mage::log("Comnpay : Erreur lors de la validation des informations transmises !", Zend_Log::ERR);
|
114 |
+
$this->cancelAction();
|
115 |
+
header("Status: 400 Bad Request", false, 400);
|
116 |
+
exit();
|
117 |
+
}
|
118 |
+
|
119 |
+
$validated="";
|
120 |
+
if (isset($_REQUEST['result']))
|
121 |
+
$validated = $_REQUEST['result'];
|
122 |
+
|
123 |
+
|
124 |
+
if($validated == "OK") {
|
125 |
+
// Payment was successful, so update the order's state, send order email and move to the success page
|
126 |
+
$orderId="";
|
127 |
+
if (isset($_REQUEST['idTransaction']))
|
128 |
+
$orderId = $_REQUEST['idTransaction'];
|
129 |
+
|
130 |
+
$order = Mage::getModel('sales/order');
|
131 |
+
$order->loadByIncrementId($orderId);
|
132 |
+
if($_REQUEST["data"] == "p3f") {
|
133 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, Mage::helper('comnpay')->__("ComNpay has authorized the payment in 3 times."));
|
134 |
+
}
|
135 |
+
else
|
136 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, Mage::helper('comnpay')->__("ComNpay has authorized the payment."));
|
137 |
+
|
138 |
+
$order->sendNewOrderEmail();
|
139 |
+
$order->setEmailSent(true);
|
140 |
+
$order->save();
|
141 |
+
|
142 |
+
//Create an invoice for validate order
|
143 |
+
if(!$order->canInvoice())
|
144 |
+
{
|
145 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
|
146 |
+
}
|
147 |
+
|
148 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
149 |
+
|
150 |
+
if (!$invoice->getTotalQty()) {
|
151 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
|
152 |
+
}
|
153 |
+
|
154 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
155 |
+
$invoice->register();
|
156 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
157 |
+
->addObject($invoice)
|
158 |
+
->addObject($invoice->getOrder());
|
159 |
+
|
160 |
+
$transactionSave->save();
|
161 |
+
|
162 |
+
Mage::getSingleton('checkout/session')->unsQuoteId();
|
163 |
+
}
|
164 |
+
else
|
165 |
+
{
|
166 |
+
// There is a problem in the response we got
|
167 |
+
Mage::log("Comnpay : Paiement refusé !", Zend_Log::DEBUG);
|
168 |
+
$this->cancelAction();
|
169 |
+
}
|
170 |
+
}
|
171 |
+
else
|
172 |
+
{
|
173 |
+
Mage::log("Comnpay : Aucun paramètre POST reçu !", Zend_Log::ERR);
|
174 |
+
header("Status: 400 Bad Request", false, 400);
|
175 |
+
}
|
176 |
+
|
177 |
+
exit();
|
178 |
+
}
|
179 |
+
|
180 |
+
/*
|
181 |
+
* The cancel action is triggered when an order is to be cancelled
|
182 |
+
*/
|
183 |
+
public function cancelAction() {
|
184 |
if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
|
185 |
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
|
186 |
if($order->getId()) {
|
187 |
+
// Flag the order as 'cancelled' and save it
|
188 |
+
$order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Gateway has declined the payment.')->save();
|
189 |
+
}
|
190 |
}
|
191 |
+
}
|
192 |
|
193 |
+
/*
|
194 |
+
* Secret Validation
|
195 |
+
*/
|
196 |
+
private function validSec($values, $secret_key){
|
197 |
if (isset($values['sec']) && $values['sec'] != "")
|
198 |
{
|
199 |
+
$sec = $values['sec'];
|
200 |
+
unset($values['sec']);
|
201 |
+
return strtoupper(hash("sha512", base64_encode(implode("|",$values)."|".$secret_key))) == strtoupper($sec);
|
202 |
}
|
203 |
else
|
204 |
{
|
205 |
+
return false;
|
206 |
}
|
207 |
+
}
|
208 |
|
209 |
}
|
app/code/local/Afone/Comnpay/etc/config.xml
CHANGED
@@ -1,76 +1,93 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
<
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
+
<modules>
|
4 |
+
<Afone_Comnpay>
|
5 |
+
<version>1.1.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 |
+
<adminhtml>
|
26 |
+
<layout>
|
27 |
+
<updates>
|
28 |
+
<comnpay>
|
29 |
+
<file>transactions.xml</file>
|
30 |
+
</comnpay>
|
31 |
+
</updates>
|
32 |
+
</layout>
|
33 |
+
</adminhtml>
|
34 |
+
<default>
|
35 |
+
<payment>
|
36 |
+
<comnpay_debit>
|
37 |
+
<model>comnpay/comnpayDebit</model>
|
38 |
+
<active>1</active>
|
39 |
+
<order_status>pending</order_status>
|
40 |
+
<title>Paiement CB - Comnpay</title>
|
41 |
+
<payment_action>sale</payment_action>
|
42 |
+
<allowspecific>0</allowspecific>
|
43 |
+
<sort_order>1</sort_order>
|
44 |
+
<devise>EUR</devise>
|
45 |
+
<langue>fr</langue>
|
46 |
+
<port>60000</port>
|
47 |
+
<path_d>/rest/payment/find</path_d>
|
48 |
+
<path_p3f>/rest/pnfFile/find</path_p3f>
|
49 |
+
<url_gateway_config>HOMOLOGATION</url_gateway_config>
|
50 |
+
<url_gateway_homologation>https://secure-homologation.comnpay.com</url_gateway_homologation>
|
51 |
+
<url_gateway_production>https://secure.comnpay.com</url_gateway_production>
|
52 |
+
<tpe_no backend_model="adminhtml/system_config_backend_encrypted"/>
|
53 |
+
<secret_key backend_model="adminhtml/system_config_backend_encrypted"/>
|
54 |
+
</comnpay_debit>
|
55 |
+
<comnpay_p3f>
|
56 |
+
<model>comnpay/comnpayP3f</model>
|
57 |
+
<active>0</active>
|
58 |
+
<order_status>pending</order_status>
|
59 |
+
<title>Paiement CB en 3 fois - Comnpay</title>
|
60 |
+
<payment_action>sale</payment_action>
|
61 |
+
<allowspecific>0</allowspecific>
|
62 |
+
<sort_order>2</sort_order>
|
63 |
+
<devise>EUR</devise>
|
64 |
+
<langue>fr</langue>
|
65 |
+
<url_gateway_config>HOMOLOGATION</url_gateway_config>
|
66 |
+
<url_gateway_homologation>https://secure-homologation.comnpay.com</url_gateway_homologation>
|
67 |
+
<url_gateway_production>https://secure.comnpay.com</url_gateway_production>
|
68 |
+
<tpe_no backend_model="adminhtml/system_config_backend_encrypted"/>
|
69 |
+
<secret_key backend_model="adminhtml/system_config_backend_encrypted"/>
|
70 |
+
</comnpay_p3f>
|
71 |
+
</payment>
|
72 |
+
</default>
|
73 |
+
<frontend>
|
74 |
+
<routers>
|
75 |
+
<comnpay>
|
76 |
+
<use>standard</use>
|
77 |
+
<args>
|
78 |
+
<module>Afone_Comnpay</module>
|
79 |
+
<frontName>comnpay</frontName>
|
80 |
+
</args>
|
81 |
+
</comnpay>
|
82 |
+
</routers>
|
83 |
+
<translate>
|
84 |
+
<modules>
|
85 |
+
<Afone_Comnpay>
|
86 |
+
<files>
|
87 |
+
<default>Afone_Comnpay.csv</default>
|
88 |
+
</files>
|
89 |
+
</Afone_Comnpay>
|
90 |
+
</modules>
|
91 |
+
</translate>
|
92 |
+
</frontend>
|
93 |
+
</config>
|
app/code/local/Afone/Comnpay/etc/system.xml
CHANGED
@@ -1,125 +1,187 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<comnpay_debit translate="label comment">
|
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 |
+
<backend_model>comnpay/validate</backend_model>
|
19 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
20 |
+
<sort_order>10</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>0</show_in_store>
|
24 |
+
</active>
|
25 |
+
<title translate="label comment">
|
26 |
+
<label>Title</label>
|
27 |
+
<comment>
|
28 |
+
<![CDATA[Texte affiché au client lors du choix du mode paiement]]>
|
29 |
+
</comment>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>20</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</title>
|
36 |
+
<order_status translate="label">
|
37 |
+
<label>New Order Status</label>
|
38 |
+
<frontend_type>select</frontend_type>
|
39 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
40 |
+
<sort_order>50</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>0</show_in_store>
|
44 |
+
</order_status>
|
45 |
+
<sort_order translate="label">
|
46 |
+
<label>Sort Order</label>
|
47 |
+
<frontend_type>text</frontend_type>
|
48 |
+
<sort_order>100</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>0</show_in_store>
|
52 |
+
</sort_order>
|
53 |
+
<tpe_no translate="label comment">
|
54 |
+
<label>TPE number</label>
|
55 |
+
<validate>validate-no-tpe</validate>
|
56 |
+
<comment>
|
57 |
+
<![CDATA[Votre numéro de TPE vous sera communiqué par AfonePaiement]]>
|
58 |
+
</comment>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
61 |
+
<sort_order>80</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>0</show_in_store>
|
65 |
+
</tpe_no>
|
66 |
+
<secret_key translate="label comment">
|
67 |
+
<label>Secret Key</label>
|
68 |
+
<validate>validate-secret-key</validate>
|
69 |
+
<comment>
|
70 |
+
<![CDATA[Votre clé secrète vous sera communiquée par AfonePaiement (elle doit rester personnelle et ne jamais être communiquée)]]>
|
71 |
+
</comment>
|
72 |
+
<frontend_type>text</frontend_type>
|
73 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
74 |
+
<sort_order>81</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>0</show_in_store>
|
78 |
+
</secret_key>
|
79 |
+
<devise translate="label">
|
80 |
+
<label>Devise</label>
|
81 |
+
<frontend_type>text</frontend_type>
|
82 |
+
<sort_order>90</sort_order>
|
83 |
+
<show_in_default>1</show_in_default>
|
84 |
+
<show_in_website>1</show_in_website>
|
85 |
+
<show_in_store>0</show_in_store>
|
86 |
+
</devise>
|
87 |
+
<langue translate="label">
|
88 |
+
<label>Language</label>
|
89 |
+
<frontend_type>text</frontend_type>
|
90 |
+
<sort_order>100</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>0</show_in_store>
|
94 |
+
</langue>
|
95 |
+
<port>
|
96 |
+
<label>Port</label>
|
97 |
+
<frontend_type>text</frontend_type>
|
98 |
+
<sort_order>100</sort_order>
|
99 |
+
<show_in_default>0</show_in_default>
|
100 |
+
<show_in_website>0</show_in_website>
|
101 |
+
<show_in_store>0</show_in_store>
|
102 |
+
</port>
|
103 |
+
<path_d>
|
104 |
+
<label>API Debit</label>
|
105 |
+
<frontend_type>text</frontend_type>
|
106 |
+
<sort_order>100</sort_order>
|
107 |
+
<show_in_default>0</show_in_default>
|
108 |
+
<show_in_website>0</show_in_website>
|
109 |
+
<show_in_store>0</show_in_store>
|
110 |
+
</path_d>
|
111 |
+
<path_p3f>
|
112 |
+
<label>API PNF</label>
|
113 |
+
<frontend_type>text</frontend_type>
|
114 |
+
<sort_order>100</sort_order>
|
115 |
+
<show_in_default>0</show_in_default>
|
116 |
+
<show_in_website>0</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
</path_p3f>
|
119 |
+
<url_gateway_config translate="label comment">
|
120 |
+
<label>URL Gateway Configuration</label>
|
121 |
+
<comment>
|
122 |
+
<![CDATA[L'homologation vous permet de tester votre installation. La production est à activer une fois les tests validés.]]>
|
123 |
+
</comment>
|
124 |
+
<frontend_type>select</frontend_type>
|
125 |
+
<source_model>comnpay/source_gatewayConfig</source_model>
|
126 |
+
<sort_order>83</sort_order>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>0</show_in_store>
|
130 |
+
</url_gateway_config>
|
131 |
+
<url_gateway_homologation translate="label">
|
132 |
+
<label>Gateway URL for approval</label>
|
133 |
+
<frontend_type>text</frontend_type>
|
134 |
+
<sort_order>84</sort_order>
|
135 |
+
<show_in_default>1</show_in_default>
|
136 |
+
<show_in_website>1</show_in_website>
|
137 |
+
<show_in_store>0</show_in_store>
|
138 |
+
</url_gateway_homologation>
|
139 |
+
<url_gateway_production translate="label">
|
140 |
+
<label>Gateway URL for production</label>
|
141 |
+
<frontend_type>text</frontend_type>
|
142 |
+
<sort_order>85</sort_order>
|
143 |
+
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>1</show_in_website>
|
145 |
+
<show_in_store>0</show_in_store>
|
146 |
+
</url_gateway_production>
|
147 |
+
</fields>
|
148 |
+
</comnpay_debit>
|
149 |
+
|
150 |
+
<comnpay_p3f translate="label comment" module="comnpay">
|
151 |
+
<label>Comnpay - Paiement en 3X</label>
|
152 |
+
<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>
|
153 |
+
<frontend_type>text</frontend_type>
|
154 |
+
<sort_order>600</sort_order>
|
155 |
+
<show_in_default>1</show_in_default>
|
156 |
+
<show_in_website>1</show_in_website>
|
157 |
+
<show_in_store>1</show_in_store>
|
158 |
+
<fields>
|
159 |
+
<active translate="label">
|
160 |
+
<label>Enabled</label>
|
161 |
+
<comment>
|
162 |
+
<![CDATA[Cette option doit être activée sur votre compte Afone Paiement]]>
|
163 |
+
</comment>
|
164 |
+
<frontend_type>select</frontend_type>
|
165 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
166 |
+
<sort_order>10</sort_order>
|
167 |
+
<show_in_default>1</show_in_default>
|
168 |
+
<show_in_website>1</show_in_website>
|
169 |
+
<show_in_store>0</show_in_store>
|
170 |
+
</active>
|
171 |
+
<title translate="label comment">
|
172 |
+
<label>Title</label>
|
173 |
+
<comment>
|
174 |
+
<![CDATA[Texte affiché au client lors du choix du mode paiement]]>
|
175 |
+
</comment>
|
176 |
+
<frontend_type>text</frontend_type>
|
177 |
+
<sort_order>20</sort_order>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>1</show_in_store>
|
181 |
+
</title>
|
182 |
+
</fields>
|
183 |
+
</comnpay_p3f>
|
184 |
+
</groups>
|
185 |
+
</payment>
|
186 |
+
</sections>
|
187 |
+
</config>
|
app/design/adminhtml/default/default/layout/transactions.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="sales_order_tabs">
|
5 |
+
<action method="addTab">
|
6 |
+
<name>order_view_tab_infostransactions</name>
|
7 |
+
<block>comnpay/adminhtml_order_view_tab_infostransactions</block>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
</adminhtml_sales_order_view>
|
11 |
+
<adminhtml_system_config_edit>
|
12 |
+
<reference name="head">
|
13 |
+
<action method="addJs"><script>comnpay/validation.js</script></action>
|
14 |
+
</reference>
|
15 |
+
</adminhtml_system_config_edit>
|
16 |
+
</layout>
|
app/design/adminhtml/default/default/template/comnpay/infostransactions.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<div class="entry-edit-head">
|
3 |
+
<h4><?php echo $this->__('Liste des transactions ComNpay'); ?></h4>
|
4 |
+
</div>
|
5 |
+
<div class="fieldset fieldset-wide">
|
6 |
+
<?php $transactions = $this->getTransactions();?>
|
7 |
+
<div class="grid">
|
8 |
+
<div class="hor-scroll">
|
9 |
+
<table cellspacing="0" class="data">
|
10 |
+
<thead>
|
11 |
+
<tr class="headings">
|
12 |
+
<th>ID Transaction</th>
|
13 |
+
<th>Date</th>
|
14 |
+
<th>Montant</th>
|
15 |
+
<th>État du paiement</th>
|
16 |
+
</tr>
|
17 |
+
</thead>
|
18 |
+
<tbody>
|
19 |
+
<?php foreach($transactions as $t) { ?>
|
20 |
+
<tr>
|
21 |
+
<td><?php echo $t["transacId"];?></td>
|
22 |
+
<td><?php
|
23 |
+
if( $t["transacDate"] != null)
|
24 |
+
echo date_create($t["transacDate"])->format('d-m-Y');
|
25 |
+
?>
|
26 |
+
</td>
|
27 |
+
<td><?php echo ($t["transacMontant"]/100)." €";?></td>
|
28 |
+
<td><?php echo $t["transacOK"];?></td>
|
29 |
+
</tr>
|
30 |
+
<?php } ?>
|
31 |
+
</tbody>
|
32 |
+
</table>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
</div>
|
app/design/frontend/base/default/template/comnpay/form.phtml
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<!--<img src="<?php echo $this->getBannerSrc() ?>" alt="Comnpay" />-->
|
|
app/design/frontend/base/default/template/comnpay/formDebit.phtml
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<img src="<?php echo $this->getBannerSrc() ?>" alt="Comnpay" />
|
2 |
+
<br/>
|
app/design/frontend/base/default/template/comnpay/formP3f.phtml
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<img src="<?php echo $this->getBannerSrc() ?>" alt="Comnpay" />
|
2 |
+
<br/>
|
app/design/frontend/base/default/template/comnpay/{info.phtml → infoDebit.phtml}
RENAMED
File without changes
|
app/design/frontend/base/default/template/comnpay/infoP3f.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/locale/fr_FR/Afone_Comnpay.csv
CHANGED
@@ -10,4 +10,7 @@
|
|
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"
|
|
|
|
|
|
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"
|
14 |
+
"ComNpay has authorized the payment.","ComNpay a autorisé le paiement."
|
15 |
+
"ComNpay has authorized the payment in 3 times.","ComNpay a autorisé le paiement en 3 fois."
|
16 |
+
"Customer was redirected to ComNpay","Le client a été redirigé vers ComNpay"
|
js/comnpay/validation.js
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Validation.addAllThese([
|
2 |
+
['validate-no-tpe', "Veuillez saisir un numéro de TPE valide. Exemple : HOM-XXX-XXX ou VAD-XXX-XXX (en production)", function (v) {
|
3 |
+
if(document.getElementById("payment_comnpay_debit_url_gateway_config").value == "HOMOLOGATION")
|
4 |
+
return Validation.get('IsEmpty').test(v) || /^HOM-[a-z0-9]{3}-[a-z0-9]{3}|DEMO*$/i.test(v);
|
5 |
+
else if(document.getElementById("payment_comnpay_debit_url_gateway_config").value == "PRODUCTION")
|
6 |
+
return Validation.get('IsEmpty').test(v) || /^VAD-[a-z0-9]{3}-[a-z0-9]{3}$/i.test(v);
|
7 |
+
}],
|
8 |
+
['validate-secret-key',"Veuillez saisir une clé secrète valide", function (v) {
|
9 |
+
if(document.getElementById("payment_comnpay_debit_tpe_no").value == "DEMO") {
|
10 |
+
if (v == "DEMO")
|
11 |
+
return true;
|
12 |
+
else
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
else {
|
16 |
+
if(Validation.get('IsEmpty').test(v))
|
17 |
+
return false;
|
18 |
+
else
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
}]
|
22 |
+
]);
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Afone_Comnpay</name>
|
4 |
-
<version>1.0
|
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
|
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>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Afone"><dir name="Comnpay"><dir name="Block"><file name="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Afone_Comnpay</name>
|
4 |
+
<version>1.1.0</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.1.0</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>2015-05-22</date>
|
14 |
+
<time>10:35:16</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Afone"><dir name="Comnpay"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Infostransactions.php" hash="dcaddd81b61871709661d02c6a514627"/></dir></dir></dir></dir><file name="FormDebit.php" hash="f76f912f31f9211648a9413c4a661bbc"/><file name="FormP3f.php" hash="94b52f23ea3b8775552e9433494ab7fb"/><file name="InfoDebit.php" hash="03279c573dff15da9757ab584f02274c"/><file name="InfoP3f.php" hash="5bf66cace145ab38f55a58bc13e86160"/></dir><dir name="Helper"><file name="Data.php" hash="5cc88f137df4fd85f21237d45af92e5e"/></dir><dir name="Model"><file name="ComnpayDebit.php" hash="06951037bc537a7aa4bb5638cb13f24a"/><file name="ComnpayP3f.php" hash="4b30b855a0af36d8310f9ddcbe02a04e"/><file name="Config.php" hash="5bfc81c431c5278550495356506f1a20"/><file name="ModelAbstract.php" hash="27dd28189c39ef9ad1f6bbef89351f42"/><dir name="Source"><file name="GatewayConfig.php" hash="8a78c821784419c9d73db715da107c73"/><file name="PnfConfig.php" hash="b795212d4189409db3b14a133e75bac0"/></dir><file name="Standard.php" hash="d6dfda5d15b5e653ac6271ec3792220a"/><file name="Validate.php" hash="52d6e348a3c1edb92b0446a16c2ed438"/></dir><dir name="controllers"><file name="PaymentController.php" hash="d00cae0e58fbbe8b679d9b94a16dbfb8"/></dir><dir name="etc"><file name="config.xml" hash="cb757509749e7db6e739a1f53aba0de6"/><file name="system.xml" hash="0114c7cf94c09ea44850799f483dc248"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="comnpay"><file name="formDebit.phtml" hash="6b244a51dec101a11480185a91313a2c"/><file name="formP3f.phtml" hash="6b244a51dec101a11480185a91313a2c"/><file name="infoDebit.phtml" hash="1eb9b644b1ed16aceab214474c1dfba9"/><file name="infoP3f.phtml" hash="1eb9b644b1ed16aceab214474c1dfba9"/><file name="redirect.phtml" hash="027352527d68f8bd0c62baee7de58ec5"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="transactions.xml" hash="1ee505830bc33cfd2b8cdfdb795361ad"/></dir><dir name="template"><dir name="comnpay"><file name="infostransactions.phtml" hash="86bda0ec48bf5059c9ca4f965ccef703"/></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="cf1a239ce024c56d093c7ce644f5dbc6"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="comnpay"><file name="comnpay_debit.png" hash="2d4e7e78ecbcd99cd58684df0cf92161"/><file name="comnpay_p3f.png" hash="913418b3b6af5f0ad7c914020e83835e"/><file name="logo-comnpay.png" hash="d53116075ead203c5544b9bb901979b1"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="comnpay"><file name="validation.js" hash="69d615c32af1186b30ad7950f0059cf6"/></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/base/default/images/comnpay/comnpay_debit.png
ADDED
Binary file
|
skin/frontend/base/default/images/comnpay/comnpay_p3f.png
ADDED
Binary file
|
skin/frontend/{default → base/default/images}/comnpay/logo-comnpay.png
RENAMED
File without changes
|