Version Notes
Magento CE 1.9.x.x compatibility only.
Download this release
Release Info
Developer | Quadra Informatique |
Extension | Be2bill |
Version | 5.0.7 |
Comparing to | |
See all releases |
Version 5.0.7
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Field/Version/Renderer.php +33 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount.php +48 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Edit.php +61 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Edit/Form.php +735 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Grid.php +180 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Grid/Renderer/Mode.php +37 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Sales/Order/View/Tab/Transactions.php +101 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Sales/Transactions/Grid.php +101 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Sales/Transactions/Renderer/Txnamount.php +35 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/System/Config/Fieldset/Hint.php +36 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Transfert/Edit.php +45 -0
- app/code/community/Quadra/Be2bill/Block/Adminhtml/Transfert/Edit/Form.php +77 -0
- app/code/community/Quadra/Be2bill/Block/Checkout/Oneclick/Info.php +142 -0
- app/code/community/Quadra/Be2bill/Block/Checkout/Oneclick/Product.php +308 -0
- app/code/community/Quadra/Be2bill/Block/Checkout/Review/Info.php +41 -0
- app/code/community/Quadra/Be2bill/Block/Form/PaymentMethods.php +225 -0
- app/code/community/Quadra/Be2bill/Block/Info/PaymentMethods.php +129 -0
- app/code/community/Quadra/Be2bill/Block/Method/Iframe.php +199 -0
- app/code/community/Quadra/Be2bill/Block/Method/Redirect.php +77 -0
- app/code/community/Quadra/Be2bill/Controller/Action.php +393 -0
- app/code/community/Quadra/Be2bill/Helper/Data.php +413 -0
- app/code/community/Quadra/Be2bill/Helper/Ip.php +275 -0
- app/code/community/Quadra/Be2bill/Helper/Mirakl.php +35 -0
- app/code/community/Quadra/Be2bill/Model/Alias.php +32 -0
- app/code/community/Quadra/Be2bill/Model/Api/Http/Client/Adapter/Curl.php +493 -0
- app/code/community/Quadra/Be2bill/Model/Api/Http/Client/Adapter/Stream.php +35 -0
- app/code/community/Quadra/Be2bill/Model/Api/Methods.php +446 -0
- app/code/community/Quadra/Be2bill/Model/Api/Response.php +182 -0
- app/code/community/Quadra/Be2bill/Model/Api/Service.php +246 -0
- app/code/community/Quadra/Be2bill/Model/Api/Xml.php +438 -0
- app/code/community/Quadra/Be2bill/Model/Customer.php +43 -0
- app/code/community/Quadra/Be2bill/Model/Log/Adapter.php +127 -0
- app/code/community/Quadra/Be2bill/Model/Merchandconfigurationaccount.php +643 -0
- app/code/community/Quadra/Be2bill/Model/Merchandconfigurationaccountcountries.php +32 -0
- app/code/community/Quadra/Be2bill/Model/Merchandconfigurationaccountoptions.php +109 -0
- app/code/community/Quadra/Be2bill/Model/Method/Abstract.php +1304 -0
- app/code/community/Quadra/Be2bill/Model/Method/PaymentMethods.php +115 -0
- app/code/community/Quadra/Be2bill/Model/Method/Session.php +28 -0
- app/code/community/Quadra/Be2bill/Model/Observer.php +417 -0
- app/code/community/Quadra/Be2bill/Model/Renderer/Defered.php +44 -0
- app/code/community/Quadra/Be2bill/Model/Renderer/Ntimes.php +37 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Alias.php +31 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Alias/Collection.php +31 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccount.php +259 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccount/Collection.php +31 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountcountries.php +31 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountcountries/Collection.php +31 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountoptions.php +31 -0
- app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountoptions/Collection.php +31 -0
- app/code/community/Quadra/Be2bill/controllers/Adminhtml/MerchandaccountController.php +547 -0
- app/code/community/Quadra/Be2bill/controllers/Adminhtml/TransfertController.php +924 -0
- app/code/community/Quadra/Be2bill/controllers/Checkout/OneclickController.php +528 -0
- app/code/community/Quadra/Be2bill/controllers/PaymentsController.php +33 -0
- app/code/community/Quadra/Be2bill/controllers/TemplateController.php +67 -0
- app/code/community/Quadra/Be2bill/etc/adminhtml.xml +68 -0
- app/code/community/Quadra/Be2bill/etc/config.xml +332 -0
- app/code/community/Quadra/Be2bill/etc/system.xml +410 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-install-4.0.0.php +23 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.0.0-4.1.0.php +273 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.0-4.1.1.php +53 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.2-4.1.3.php +28 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.3-4.1.4.php +143 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.4-4.1.5.php +28 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.7-4.1.8.php +28 -0
- app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.2.6-4.2.7.php +27 -0
- app/design/adminhtml/default/default/layout/be2bill.xml +34 -0
- app/design/adminhtml/default/default/template/be2bill/info/payment_methods.phtml +29 -0
- app/design/adminhtml/default/default/template/be2bill/system/config/fieldset/hint.phtml +63 -0
- app/design/frontend/rwd/default/layout/be2bill.xml +140 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/cart/item/default.phtml +151 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/cart/totals.phtml +56 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/iframe.phtml +43 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/oneclick/info.phtml +123 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/oneclick/info/review.phtml +33 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/oneclick/product.phtml +95 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/onepage/payment/additional.phtml +29 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/review/button.phtml +17 -0
- app/design/frontend/rwd/default/template/be2bill/checkout/review/info.phtml +25 -0
- app/design/frontend/rwd/default/template/be2bill/form/payment_methods.phtml +217 -0
- app/design/frontend/rwd/default/template/be2bill/info/payment_methods.phtml +17 -0
- app/design/frontend/rwd/default/template/be2bill/model/failure.phtml +20 -0
- app/design/frontend/rwd/default/template/be2bill/model/success.phtml +20 -0
- app/etc/modules/Quadra_Be2bill.xml +28 -0
- app/locale/en_US/Quadra_Be2bill.csv +263 -0
- app/locale/fr_FR/Quadra_Be2bill.csv +264 -0
- package.xml +27 -0
- skin/adminhtml/default/default/be2bill/js/be2bill.js +384 -0
- skin/frontend/rwd/default/css/be2bill/checkout-onepage-payment.css +37 -0
- skin/frontend/rwd/default/css/be2bill/checkout-success-crossell.css +33 -0
- skin/frontend/rwd/default/css/be2bill/product.css +96 -0
app/code/community/Quadra/Be2bill/Block/Adminhtml/Field/Version/Renderer.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Adminhtml_Field_Version_Renderer extends Mage_Adminhtml_Block_System_Config_Form_Field
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Readonly uniquement le champ version
|
25 |
+
* System > Configuration > Be2bill > Configuration gènérale > Information module > Version
|
26 |
+
*/
|
27 |
+
protected function _getElementHtml($element)
|
28 |
+
{
|
29 |
+
$element->setDisabled('disabled');
|
30 |
+
return parent::_getElementHtml($element);
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Adminhtml_Merchandaccount extends Mage_Adminhtml_Block_Widget_Grid_Container
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Ajoute un bouton pour importer l'xml des comptes
|
25 |
+
*/
|
26 |
+
public function __construct()
|
27 |
+
{
|
28 |
+
$this->_blockGroup = 'be2bill';
|
29 |
+
$this->_controller = 'adminhtml_merchandaccount';
|
30 |
+
$this->_headerText = Mage::helper('be2bill')->__('Gestion des comptes');
|
31 |
+
$this->_addButtonLabel = Mage::helper('be2bill')->__('Créer un nouveau compte');
|
32 |
+
|
33 |
+
$this->_addButton('add_new', array(
|
34 |
+
'label' => Mage::helper('be2bill')->__('Import des paiements dynamiques'),
|
35 |
+
'onclick' => "setLocation('{$this->getUrl('*/*/importXmltoDb')}')",
|
36 |
+
'class' => 'add'
|
37 |
+
));
|
38 |
+
|
39 |
+
$this->_addButton('transfert', array(
|
40 |
+
'label' => Mage::helper('be2bill')->__('Transfert commandes V1 vers V2'),
|
41 |
+
'onclick' => "setLocation('{$this->getUrl('*/transfert/edit')}')",
|
42 |
+
'class' => 'add'
|
43 |
+
));
|
44 |
+
|
45 |
+
parent::__construct();
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Edit.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Adminhtml_Merchandaccount_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
21 |
+
{
|
22 |
+
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->_objectId = 'id';
|
27 |
+
$this->_blockGroup = 'be2bill';
|
28 |
+
$this->_controller = 'adminhtml_merchandaccount';
|
29 |
+
$this->_mode = 'edit';
|
30 |
+
|
31 |
+
if (!Mage::registry('current_configuration_account')->getId() > 0) {
|
32 |
+
$this->_removeButton('remove');
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->_addButton('saveandcontinue', array(
|
36 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
37 |
+
'onclick' => 'saveAndContinueEdit()',
|
38 |
+
'class' => 'save',
|
39 |
+
), -100);
|
40 |
+
$this->_formScripts[] = " function saveAndContinueEdit(){
|
41 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
42 |
+
}";
|
43 |
+
|
44 |
+
$this->_removeButton('reset');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
*
|
49 |
+
* @see Mage_Adminhtml_Block_Widget_Container::getHeaderText()
|
50 |
+
* @return le titre de l'entete de la page
|
51 |
+
*/
|
52 |
+
public function getHeaderText()
|
53 |
+
{
|
54 |
+
if (Mage::registry('current_configuration_account') && Mage::registry('current_configuration_account')->getId()) {
|
55 |
+
return Mage::helper('be2bill')->__('Edition du compte');
|
56 |
+
} else {
|
57 |
+
return Mage::helper('be2bill')->__('Nouveau compte');
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Edit/Form.php
ADDED
@@ -0,0 +1,735 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Quadra-Informatique
|
20 |
+
* @category Quadra
|
21 |
+
* @package Quadra_Be2bill
|
22 |
+
*/
|
23 |
+
class Quadra_Be2bill_Block_Adminhtml_Merchandaccount_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Prepare form before rendering HTML
|
28 |
+
*
|
29 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
30 |
+
*/
|
31 |
+
protected function _prepareForm()
|
32 |
+
{
|
33 |
+
$form = new Varien_Data_Form(array(
|
34 |
+
'id' => 'edit_form',
|
35 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
36 |
+
'method' => 'post',
|
37 |
+
'enctype' => 'multipart/form-data'
|
38 |
+
));
|
39 |
+
|
40 |
+
$account = Mage::registry('current_configuration_account');
|
41 |
+
$accountId = (int)$account->getId();
|
42 |
+
$accounts = null;
|
43 |
+
$modes = null;
|
44 |
+
$options = array();
|
45 |
+
$tabCountries = array();
|
46 |
+
$allspecificcountries = Mage::getModel('adminhtml/system_config_source_payment_allspecificcountries')->toOptionArray();
|
47 |
+
$logoUrl = '';
|
48 |
+
$currency = null;
|
49 |
+
|
50 |
+
if ($accountId > 0) { //si modification
|
51 |
+
$currency = $account->getCurrencyIso();
|
52 |
+
$accounts = Mage::getModel('be2bill/api_methods')->getAvailableAcountTypeByCurrency($currency);
|
53 |
+
|
54 |
+
$accountTypeCode = $account->getB2bXmlAccountTypeCode();
|
55 |
+
if ($account->getLogoUrl() == null || $account->getLogoUrl() == '') {
|
56 |
+
$logoUrl = Mage::getModel('be2bill/api_methods')->getLogoUrl($accountTypeCode);
|
57 |
+
} else {
|
58 |
+
$logoUrl = $account->getLogoUrl();
|
59 |
+
}
|
60 |
+
|
61 |
+
$modes = Mage::getModel('be2bill/api_methods')->getAvailableModesByAccountType($accountTypeCode);
|
62 |
+
// si resultat sup a 1 on supprime directlink et direct submit
|
63 |
+
if (count($modes) > 1) {
|
64 |
+
$i = 0;
|
65 |
+
foreach ($modes as $tabVal) {
|
66 |
+
if ($tabVal['id'] == 'directlink' || $tabVal['id'] == 'direct-submit') {
|
67 |
+
unset($modes[$i]);
|
68 |
+
}
|
69 |
+
$i++;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
$options = Mage::getModel('be2bill/api_methods')->getAvailableOptionsByAccountType($accountTypeCode);
|
74 |
+
|
75 |
+
$hasDefered = Mage::getModel('be2bill/api_methods')->hasDefered($accountTypeCode);
|
76 |
+
$hasStandard = Mage::getModel('be2bill/api_methods')->hasStandard($accountTypeCode);
|
77 |
+
if ($hasDefered != false) {
|
78 |
+
array_push($options, array('option' => 'defered'));
|
79 |
+
array_push($options, array('option' => 'delivery'));
|
80 |
+
}
|
81 |
+
|
82 |
+
if ($hasStandard != false) {
|
83 |
+
array_push($options, array('option' => 'standard'));
|
84 |
+
}
|
85 |
+
|
86 |
+
foreach ($options as $tabOption) {
|
87 |
+
if ('oneclick' == $tabOption['option']) { //si oneclick present on ajoute le choix : profil récurrent
|
88 |
+
array_push($options, array('option' => 'recurring'));
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
$optionsValues = Mage::helper('be2bill')->getFormattedCollectionOptionsToArray($account->getOptionsCollection());
|
94 |
+
|
95 |
+
$colCountries = $account->getAccountCountriesCollection();
|
96 |
+
foreach ($colCountries as $countries) {
|
97 |
+
$tabCountries[] = strtoupper($countries->getData('country_iso'));
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
$_countries = Mage::getModel('adminhtml/system_config_source_country')->toOptionArray();
|
102 |
+
unset($_countries[0]);
|
103 |
+
|
104 |
+
$fieldset = $form->addFieldset('edit_form', array('legend' => Mage::helper('be2bill')->__('Configuration générale')));
|
105 |
+
|
106 |
+
$fieldset->addField('urlLoadAccountsType', 'hidden', array(
|
107 |
+
'name' => 'urlLoadAccountsType',
|
108 |
+
'value' => Mage::helper("adminhtml")->getUrl("adminhtml/merchandaccount/loadAccountsTypeByCurrency"),
|
109 |
+
));
|
110 |
+
|
111 |
+
$fieldset->addField('urlLoadModes', 'hidden', array(
|
112 |
+
'name' => 'urlLoadModes',
|
113 |
+
'value' => Mage::helper("adminhtml")->getUrl("adminhtml/merchandaccount/loadModesTypeByAccountType"),
|
114 |
+
));
|
115 |
+
|
116 |
+
$fieldset->addField('del_img', 'hidden', array(
|
117 |
+
'name' => 'del_img',
|
118 |
+
'value' => Mage::helper('be2bill')->__('Réinitialiser l’image par défaut (fournie par Be2Bill)'),
|
119 |
+
));
|
120 |
+
|
121 |
+
$fieldset->addField('urlLoadOptions', 'hidden', array(
|
122 |
+
'name' => 'urlLoadOptions',
|
123 |
+
'value' => Mage::helper("adminhtml")->getUrl("adminhtml/merchandaccount/loadOptionsByAccountType"),
|
124 |
+
));
|
125 |
+
|
126 |
+
$fieldset->addField('urlLoadCountries', 'hidden', array(
|
127 |
+
'name' => 'urlLoadCountries',
|
128 |
+
'value' => Mage::helper("adminhtml")->getUrl("adminhtml/merchandaccount/getCountriesRestriction"),
|
129 |
+
));
|
130 |
+
|
131 |
+
$fieldset->addField('urlLoadLogo', 'hidden', array(
|
132 |
+
'name' => 'urlLoadLogo',
|
133 |
+
'value' => Mage::helper("adminhtml")->getUrl("adminhtml/merchandaccount/getLogo"),
|
134 |
+
));
|
135 |
+
|
136 |
+
$fieldset->addField('id', 'hidden', array(
|
137 |
+
'name' => 'id',
|
138 |
+
'value' => $accountId,
|
139 |
+
));
|
140 |
+
|
141 |
+
$fieldset->addField('options', 'hidden', array(
|
142 |
+
'name' => 'options',
|
143 |
+
'value' => implode(',', array_column($options, 'option')), //since php v5.5.0
|
144 |
+
));
|
145 |
+
|
146 |
+
$fieldset->addField('is_active', 'select', array(
|
147 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
148 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
149 |
+
'name' => 'general[active]',
|
150 |
+
'required' => true,
|
151 |
+
'class' => 'required-entry select',
|
152 |
+
'value' => $account->getActive(),
|
153 |
+
'options' => array(
|
154 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
155 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
156 |
+
),
|
157 |
+
'tabindex' => 1,
|
158 |
+
));
|
159 |
+
|
160 |
+
/*
|
161 |
+
$values = Mage::getResourceModel('core/store_collection')->toOptionArray();
|
162 |
+
$fieldset->addField('store', 'select', array(
|
163 |
+
'label' => Mage::helper('be2bill')->__('Magasin'),
|
164 |
+
'class' => 'required-entry select input-text',
|
165 |
+
'required' => true,
|
166 |
+
'name' => 'general[core_store_id]',
|
167 |
+
'value' => $account->getCoreStoreId(),
|
168 |
+
'values' => $values,
|
169 |
+
'disabled' => false,
|
170 |
+
'readonly' => false,
|
171 |
+
'tabindex' => 2,
|
172 |
+
));
|
173 |
+
*/
|
174 |
+
|
175 |
+
$fieldset->addField('store_id', 'select', array(
|
176 |
+
'name' => 'general[core_store_id]',
|
177 |
+
'label' => Mage::helper('be2bill')->__('Magasin'),
|
178 |
+
'title' => Mage::helper('be2bill')->__('Magasin'),
|
179 |
+
'required' => true,
|
180 |
+
'value' => $account->getCoreStoreId(),
|
181 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(true, false),
|
182 |
+
'tabindex' => 2,
|
183 |
+
));
|
184 |
+
|
185 |
+
$fieldset->addField('login', 'text', array(
|
186 |
+
'label' => Mage::helper('be2bill')->__('Identifier'),
|
187 |
+
'title' => Mage::helper('be2bill')->__('Identifier'),
|
188 |
+
'class' => 'required-entry input-text',
|
189 |
+
'required' => true,
|
190 |
+
'name' => 'general[login]',
|
191 |
+
'value' => $account->getLogin(),
|
192 |
+
'tabindex' => 3,
|
193 |
+
));
|
194 |
+
|
195 |
+
$fieldset->addField('password', 'password', array(
|
196 |
+
'label' => Mage::helper('be2bill')->__('Mot de passe'),
|
197 |
+
'title' => Mage::helper('be2bill')->__('Mot de passe'),
|
198 |
+
'class' => 'required-entry input-text',
|
199 |
+
'required' => true,
|
200 |
+
'name' => 'general[password]',
|
201 |
+
'value' => $account->getPassword(),
|
202 |
+
'tabindex' => 4,
|
203 |
+
));
|
204 |
+
|
205 |
+
$fieldset->addField('logo', 'image', array(
|
206 |
+
'label' => Mage::helper('be2bill')->__('Logo'),
|
207 |
+
'name' => 'logo',
|
208 |
+
'value' => $logoUrl,
|
209 |
+
'tabindex' => 5,
|
210 |
+
));
|
211 |
+
$fieldset->addField('logo_url', 'hidden', array(
|
212 |
+
'name' => 'logo_url',
|
213 |
+
//'value' => $logoUrl,
|
214 |
+
));
|
215 |
+
|
216 |
+
|
217 |
+
$values = Mage::getModel('adminhtml/system_config_source_currency')->toOptionArray(false);
|
218 |
+
array_unshift($values, array('value' => 0, 'label' => Mage::helper('be2bill')->__('Sélectionner la devise')));
|
219 |
+
$fieldset->addField('currency', 'select', array(
|
220 |
+
'label' => Mage::helper('be2bill')->__('Devise'),
|
221 |
+
'title' => Mage::helper('be2bill')->__('Devise'),
|
222 |
+
'class' => 'required-entry select',
|
223 |
+
'required' => true,
|
224 |
+
'name' => 'general[currency_iso]',
|
225 |
+
'value' => $currency,
|
226 |
+
'values' => $values,
|
227 |
+
'tabindex' => 6,
|
228 |
+
));
|
229 |
+
|
230 |
+
$fieldset->addField('account_type', 'select', array(
|
231 |
+
'label' => Mage::helper('be2bill')->__('Type de compte'),
|
232 |
+
'title' => Mage::helper('be2bill')->__('Type de compte'),
|
233 |
+
'class' => 'required-entry select',
|
234 |
+
'required' => true,
|
235 |
+
'name' => 'general[b2b_xml_account_type_code]',
|
236 |
+
'value' => $account->getB2bXmlAccountTypeCode(),
|
237 |
+
'values' => $accounts,
|
238 |
+
'tabindex' => 7,
|
239 |
+
));
|
240 |
+
|
241 |
+
|
242 |
+
$fieldset->addField('mode', 'select', array(
|
243 |
+
'label' => Mage::helper('be2bill')->__('Mode'),
|
244 |
+
'title' => Mage::helper('be2bill')->__('Mode'),
|
245 |
+
'class' => 'required-entry select',
|
246 |
+
'required' => true,
|
247 |
+
'name' => 'general[b2b_xml_mode_code]',
|
248 |
+
'values' => $modes,
|
249 |
+
'value' => $account->getB2bXmlModeCode(),
|
250 |
+
'tabindex' => 8,
|
251 |
+
));
|
252 |
+
|
253 |
+
|
254 |
+
$fieldset->addField('name', 'text', array(
|
255 |
+
'label' => Mage::helper('be2bill')->__('Label visible sur le front office'),
|
256 |
+
'title' => Mage::helper('be2bill')->__('Label visible sur le front office'),
|
257 |
+
'class' => 'required-entry input-text',
|
258 |
+
'required' => true,
|
259 |
+
'name' => 'general[configuration_account_name]',
|
260 |
+
'value' => $account->getConfigurationAccountName(),
|
261 |
+
'tabindex' => 9,
|
262 |
+
));
|
263 |
+
|
264 |
+
/*
|
265 |
+
$fieldset->addField('cancel_capture_auto', 'select', array(
|
266 |
+
'label' => Mage::helper('be2bill')->__('Annuler les commandes automatiquement'),
|
267 |
+
'title' => Mage::helper('be2bill')->__('Annuler les commandes automatiquement'),
|
268 |
+
'class' => 'required-entry select',
|
269 |
+
'required' => true,
|
270 |
+
'name' => 'general[cancel_capture_auto]',
|
271 |
+
'value' => $account->getdata('cancel_capture_auto'),
|
272 |
+
'options' => array(
|
273 |
+
'1' => Mage::helper('be2bill')->__('Oui'),
|
274 |
+
'0' => Mage::helper('be2bill')->__('Non'),
|
275 |
+
),
|
276 |
+
'tabindex' => 9,
|
277 |
+
'after_element_html' => '<p class="note"><span>' . Mage::helper('be2bill')->__('Annule les commandes dont la durée du statut \'En attente de capture be2bill\' a atteint la limite.') . '</span></p>'
|
278 |
+
));
|
279 |
+
*/
|
280 |
+
|
281 |
+
$fieldset->addField('order_canceled_limited_time', 'text', array(
|
282 |
+
'label' => Mage::helper('be2bill')->__('Annule les commandes dont le statut est "en attende" depuis : '),
|
283 |
+
'title' => Mage::helper('be2bill')->__('Annule les commandes dont le statut est "en attende" depuis : '),
|
284 |
+
'class' => 'required-entry input-text',
|
285 |
+
'required' => true,
|
286 |
+
'name' => 'general[order_canceled_limited_time]',
|
287 |
+
'value' => $account->getdata('order_canceled_limited_time') != '' ? $account->getdata('order_canceled_limited_time') : 0,
|
288 |
+
'tabindex' => 10,
|
289 |
+
'after_element_html' => '<p class="note"><span>' . Mage::helper('be2bill')->__("Valeur en minutes. Mettre 0 pour désactiver l'option") . '</span></p>'
|
290 |
+
));
|
291 |
+
|
292 |
+
|
293 |
+
/* Standard Payment configuration */
|
294 |
+
$fieldset2 = $form->addFieldset('standard', array('legend' => Mage::helper('be2bill')->__('Paiement standard')));
|
295 |
+
$fieldset2->addField('standard_active', 'select', array(
|
296 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
297 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
298 |
+
'name' => 'option[standard][active]',
|
299 |
+
'required' => true,
|
300 |
+
'class' => 'required-entry select',
|
301 |
+
'value' => isset($optionsValues['standard']['active']) ? $optionsValues['standard']['active'] : 0,
|
302 |
+
'options' => array(
|
303 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
304 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
305 |
+
),
|
306 |
+
));
|
307 |
+
|
308 |
+
$fieldset2->addField('standard_front_label', 'text', array(
|
309 |
+
'label' => Mage::helper('be2bill')->__('Label front office'),
|
310 |
+
'title' => Mage::helper('be2bill')->__('Label front office'),
|
311 |
+
'class' => 'input-text',
|
312 |
+
'name' => 'option[standard][front_label]',
|
313 |
+
'value' => isset($optionsValues['standard']['front_label']) ? $optionsValues['standard']['front_label'] : null,
|
314 |
+
));
|
315 |
+
|
316 |
+
$fieldset2->addField('standard_min', 'text', array(
|
317 |
+
'label' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
318 |
+
'title' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
319 |
+
'class' => 'validate-zero-or-greater input-text',
|
320 |
+
'required' => false,
|
321 |
+
'name' => 'option[standard][min_amount]',
|
322 |
+
'value' => isset($optionsValues['standard']['min_amount']) ? $optionsValues['standard']['min_amount'] : null,
|
323 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant minimum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant minimum') . '</small>',
|
324 |
+
));
|
325 |
+
|
326 |
+
$fieldset2->addField('standard_max', 'text', array(
|
327 |
+
'label' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
328 |
+
'title' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
329 |
+
'class' => 'validate-zero-or-greater input-text',
|
330 |
+
'required' => false,
|
331 |
+
'name' => 'option[standard][max_amount]',
|
332 |
+
'value' => isset($optionsValues['standard']['max_amount']) ? $optionsValues['standard']['max_amount'] : null,
|
333 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant maximum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant maximum') . '</small>'
|
334 |
+
));
|
335 |
+
|
336 |
+
|
337 |
+
/* Defered Payment configuration */
|
338 |
+
$fieldset3 = $form->addFieldset('defered', array('legend' => Mage::helper('be2bill')->__('Paiement différé')));
|
339 |
+
|
340 |
+
$fieldset3->addField('defered_active', 'select', array(
|
341 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
342 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
343 |
+
'name' => 'option[defered][active]',
|
344 |
+
'required' => true,
|
345 |
+
'class' => 'required-entry select',
|
346 |
+
'value' => isset($optionsValues['defered']['active']) ? $optionsValues['defered']['active'] : 0,
|
347 |
+
'options' => array(
|
348 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
349 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
350 |
+
),
|
351 |
+
));
|
352 |
+
|
353 |
+
$fieldset3->addField('defered_front_label', 'text', array(
|
354 |
+
'label' => Mage::helper('be2bill')->__('Label front office'),
|
355 |
+
'title' => Mage::helper('be2bill')->__('Label front office'),
|
356 |
+
'class' => 'input-text',
|
357 |
+
'name' => 'option[defered][front_label]',
|
358 |
+
'value' => isset($optionsValues['defered']['front_label']) ? $optionsValues['defered']['front_label'] : null,
|
359 |
+
));
|
360 |
+
|
361 |
+
$fieldset3->addField('defered_min', 'text', array(
|
362 |
+
'label' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
363 |
+
'title' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
364 |
+
'class' => 'validate-zero-or-greater input-text',
|
365 |
+
'required' => false,
|
366 |
+
'name' => 'option[defered][min_amount]',
|
367 |
+
'value' => isset($optionsValues['defered']['min_amount']) ? $optionsValues['defered']['min_amount'] : null,
|
368 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant minimum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant minimum') . '</small>',
|
369 |
+
));
|
370 |
+
|
371 |
+
$fieldset3->addField('defered_max', 'text', array(
|
372 |
+
'label' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
373 |
+
'title' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
374 |
+
'class' => 'validate-zero-or-greater input-text',
|
375 |
+
'required' => false,
|
376 |
+
'name' => 'option[defered][max_amount]',
|
377 |
+
'value' => isset($optionsValues['defered']['max_amount']) ? $optionsValues['defered']['max_amount'] : null,
|
378 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant maximum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant maximum') . '</small>'
|
379 |
+
));
|
380 |
+
|
381 |
+
|
382 |
+
$values = Mage::getModel('be2bill/renderer_defered')->toOptionArray();
|
383 |
+
$fieldset3->addField('defered_values', 'select', array(
|
384 |
+
'label' => Mage::helper('be2bill')->__('Nombre de jours'),
|
385 |
+
'title' => Mage::helper('be2bill')->__('Nombre de jours'),
|
386 |
+
'name' => 'option[defered][b2b_xml_option_extra]',
|
387 |
+
'required' => true,
|
388 |
+
'class' => 'required-entry select',
|
389 |
+
'value' => isset($optionsValues['defered']['b2b_xml_option_extra']) ? $optionsValues['defered']['b2b_xml_option_extra'] : null,
|
390 |
+
'values' => $values,
|
391 |
+
));
|
392 |
+
|
393 |
+
|
394 |
+
/* At Delivery Payment configuration */
|
395 |
+
$fieldset4 = $form->addFieldset('delivery', array('legend' => Mage::helper('be2bill')->__('Paiement à la livraison')));
|
396 |
+
|
397 |
+
$fieldset4->addField('delivery_active', 'select', array(
|
398 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
399 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
400 |
+
'name' => 'option[delivery][active]',
|
401 |
+
'required' => true,
|
402 |
+
'class' => 'required-entry select',
|
403 |
+
'value' => isset($optionsValues['delivery']['active']) ? $optionsValues['delivery']['active'] : 0,
|
404 |
+
'options' => array(
|
405 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
406 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
407 |
+
),
|
408 |
+
));
|
409 |
+
|
410 |
+
$fieldset4->addField('delivery_front_label', 'text', array(
|
411 |
+
'label' => Mage::helper('be2bill')->__('Label front office'),
|
412 |
+
'title' => Mage::helper('be2bill')->__('Label front office'),
|
413 |
+
'class' => 'input-text',
|
414 |
+
'name' => 'option[delivery][front_label]',
|
415 |
+
'value' => isset($optionsValues['delivery']['front_label']) ? $optionsValues['delivery']['front_label'] : null,
|
416 |
+
));
|
417 |
+
|
418 |
+
$fieldset4->addField('delivery_min', 'text', array(
|
419 |
+
'label' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
420 |
+
'title' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
421 |
+
'class' => 'validate-zero-or-greater input-text',
|
422 |
+
'required' => false,
|
423 |
+
'name' => 'option[delivery][min_amount]',
|
424 |
+
'value' => isset($optionsValues['delivery']['min_amount']) ? $optionsValues['delivery']['min_amount'] : null,
|
425 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant minimum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant minimum') . '</small>',
|
426 |
+
));
|
427 |
+
|
428 |
+
$fieldset4->addField('delivery_max', 'text', array(
|
429 |
+
'label' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
430 |
+
'title' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
431 |
+
'class' => 'validate-zero-or-greater input-text',
|
432 |
+
'required' => false,
|
433 |
+
'name' => 'option[delivery][max_amount]',
|
434 |
+
'value' => isset($optionsValues['delivery']['max_amount']) ? $optionsValues['delivery']['max_amount'] : null,
|
435 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant maximum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant maximum') . '</small>'
|
436 |
+
));
|
437 |
+
|
438 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive()) {
|
439 |
+
$tabValue = isset($optionsValues['delivery']['b2b_xml_option_extra']) ? $optionsValues['delivery']['b2b_xml_option_extra'] : null;
|
440 |
+
|
441 |
+
$fieldset4->addField('mirakl_status', 'select', array(
|
442 |
+
'label' => Mage::helper('be2bill')->__('Statut Mirakl'),
|
443 |
+
'title' => Mage::helper('be2bill')->__('Statut Mirakl'),
|
444 |
+
'name' => 'option[delivery][mirakl_status]',
|
445 |
+
'required' => true,
|
446 |
+
//'class' => 'select',
|
447 |
+
'value' => isset($tabValue['mirakl_status']) ? $tabValue['mirakl_status'] : 'all',
|
448 |
+
'options' => array(
|
449 |
+
'op_only' => Mage::helper('be2bill')->__('Désactivé pour les commandes MARKETPLACE'),
|
450 |
+
'mkp_only' => Mage::helper('be2bill')->__('Activé pour les commandes MARKETPLACE uniquement'),
|
451 |
+
'all' => Mage::helper('be2bill')->__('Activé pour TOUTES les commandes'),
|
452 |
+
),
|
453 |
+
));
|
454 |
+
|
455 |
+
$fieldset4->addField('mkp_login', 'text', array(
|
456 |
+
'label' => Mage::helper('be2bill')->__('Identifier / Capture Marketplace'),
|
457 |
+
'title' => Mage::helper('be2bill')->__('Identifier / Capture Marketplace'),
|
458 |
+
//'class' => 'input-text required-entry',
|
459 |
+
'required' => true,
|
460 |
+
'name' => 'option[delivery][mkp_login]',
|
461 |
+
'value' => isset($tabValue['mkp_login']) ? $tabValue['mkp_login'] : null,
|
462 |
+
'after_element_html' => '<br />' . Mage::helper('be2bill')->__('Identifiant permettant de capturer les montants des commandes marketplaces.<br />Les montants des commandes opérateurs seront capturés sur le compte de la configuration générale.'),
|
463 |
+
));
|
464 |
+
|
465 |
+
$fieldset4->addField('mkp_password', 'password', array(
|
466 |
+
'label' => Mage::helper('be2bill')->__('Mot de passe / Capture Marketplace'),
|
467 |
+
'title' => Mage::helper('be2bill')->__('Mot de passe / Capture Marketplace'),
|
468 |
+
//'class' => 'input-text required-entry',
|
469 |
+
'required' => true,
|
470 |
+
'name' => 'option[delivery][mkp_password]',
|
471 |
+
'value' => isset($tabValue['mkp_password']) ? $tabValue['mkp_password'] : null,
|
472 |
+
'after_element_html' => '<br />' . Mage::helper('be2bill')->__('Mot de passe lié à l\'identifier précédent. Ne pas renseigner si l\'identifier est non renseigné.'),
|
473 |
+
));
|
474 |
+
|
475 |
+
}
|
476 |
+
|
477 |
+
// permet d'ajouter dans un champ cache la liste des codes compatibles avec Mirakl.
|
478 |
+
// ce champ doit toujours exister afin d'éviter les éventuelles erreurs JS lorsque Mirakl n'est pas disponible
|
479 |
+
$fieldset4->addField('mkp_code_list', 'hidden', array(
|
480 |
+
'class' => 'input-text',
|
481 |
+
'required' => false,
|
482 |
+
'value' => implode(',', Mage::helper('be2bill/mirakl')->getAllowedMPCode()),
|
483 |
+
));
|
484 |
+
|
485 |
+
/*
|
486 |
+
$values = Mage::getModel('adminhtml/system_config_source_order_status')->toOptionArray();
|
487 |
+
unset($values[0]);
|
488 |
+
$fieldset4->addField('delivery_status', 'multiselect', array(
|
489 |
+
'label' => Mage::helper('be2bill')->__('Statut de la commande lors de la capture'),
|
490 |
+
'title' => Mage::helper('be2bill')->__('Statut de la commande lors de la capture'),
|
491 |
+
'name' => 'option[delivery][b2b_xml_option_extra]',
|
492 |
+
'required' => true,
|
493 |
+
'class' => 'required-entry multiselect',
|
494 |
+
'value' => isset($optionsValues['delivery']['b2b_xml_option_extra']) ? $optionsValues['delivery']['b2b_xml_option_extra'] : null,
|
495 |
+
'values' => $values,
|
496 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Quand la commande est passée à un de ces statuts , la capture est exécutée automatiquement') . '</small>',
|
497 |
+
));
|
498 |
+
*/
|
499 |
+
|
500 |
+
/* N times Payment configuration */
|
501 |
+
$fieldset5 = $form->addFieldset('ntimes', array('legend' => Mage::helper('be2bill')->__('Paiement n fois')));
|
502 |
+
|
503 |
+
$fieldset5->addField('ntimes_active', 'select', array(
|
504 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
505 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
506 |
+
'name' => 'option[ntimes][active]',
|
507 |
+
'required' => true,
|
508 |
+
//'class' => 'required-entry select',
|
509 |
+
'value' => isset($optionsValues['ntimes']['active']) ? $optionsValues['ntimes']['active'] : 0,
|
510 |
+
'options' => array(
|
511 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
512 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
513 |
+
),
|
514 |
+
));
|
515 |
+
|
516 |
+
$fieldset5->addField('ntimes_front_label', 'text', array(
|
517 |
+
'label' => Mage::helper('be2bill')->__('Label front office'),
|
518 |
+
'title' => Mage::helper('be2bill')->__('Label front office'),
|
519 |
+
'class' => 'input-text',
|
520 |
+
'name' => 'option[ntimes][front_label]',
|
521 |
+
'value' => isset($optionsValues['ntimes']['front_label']) ? $optionsValues['ntimes']['front_label'] : null,
|
522 |
+
));
|
523 |
+
|
524 |
+
$fieldset5->addField('ntimes_min', 'text', array(
|
525 |
+
'label' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
526 |
+
'title' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
527 |
+
'class' => 'validate-zero-or-greater input-text',
|
528 |
+
'required' => false,
|
529 |
+
'name' => 'option[ntimes][min_amount]',
|
530 |
+
'value' => isset($optionsValues['ntimes']['min_amount']) ? $optionsValues['ntimes']['min_amount'] : null,
|
531 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant minimum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant minimum') . '</small>',
|
532 |
+
));
|
533 |
+
|
534 |
+
$fieldset5->addField('ntimes_max', 'text', array(
|
535 |
+
'label' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
536 |
+
'title' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
537 |
+
'class' => 'validate-zero-or-greater input-text',
|
538 |
+
'required' => false,
|
539 |
+
'name' => 'option[ntimes][max_amount]',
|
540 |
+
'value' => isset($optionsValues['ntimes']['max_amount']) ? $optionsValues['ntimes']['max_amount'] : null,
|
541 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant maximum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant maximum') . '</small>'
|
542 |
+
));
|
543 |
+
|
544 |
+
$values = Mage::getModel('be2bill/renderer_ntimes')->toOptionArray();
|
545 |
+
$fieldset5->addField('ntimes_values', 'select', array(
|
546 |
+
'label' => Mage::helper('be2bill')->__('Nombre de fois'),
|
547 |
+
'title' => Mage::helper('be2bill')->__('Nombre de fois'),
|
548 |
+
'name' => 'option[ntimes][b2b_xml_option_extra]',
|
549 |
+
'required' => true,
|
550 |
+
//'class' => 'required-entry select',
|
551 |
+
'value' => isset($optionsValues['ntimes']['b2b_xml_option_extra']) ? $optionsValues['ntimes']['b2b_xml_option_extra'] : null,
|
552 |
+
'values' => $values,
|
553 |
+
));
|
554 |
+
|
555 |
+
/* 3D Secure configuration */
|
556 |
+
$fieldset6 = $form->addFieldset('3dsecure', array('legend' => Mage::helper('be2bill')->__('3D Secure')));
|
557 |
+
$fieldset6->addField('secure_active', 'select', array(
|
558 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
559 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
560 |
+
'name' => 'option[3dsecure][active]',
|
561 |
+
'required' => true,
|
562 |
+
//'class' => 'required-entry select',
|
563 |
+
'value' => isset($optionsValues['3dsecure']['active']) ? $optionsValues['3dsecure']['active'] : 0,
|
564 |
+
'options' => array(
|
565 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
566 |
+
'1' => Mage::helper('be2bill')->__('Selective 3DS'),
|
567 |
+
'2' => Mage::helper('be2bill')->__('Full 3DS'),
|
568 |
+
),
|
569 |
+
));
|
570 |
+
|
571 |
+
$fieldset6->addField('secure_min', 'text', array(
|
572 |
+
'label' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
573 |
+
'title' => Mage::helper('be2bill')->__('Montant minimum de la commande'),
|
574 |
+
'class' => 'validate-zero-or-greater input-text',
|
575 |
+
'required' => false,
|
576 |
+
'name' => 'option[3dsecure][min_amount]',
|
577 |
+
'value' => isset($optionsValues['3dsecure']['min_amount']) ? $optionsValues['3dsecure']['min_amount'] : null,
|
578 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant minimum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant minimum') . '</small>',
|
579 |
+
));
|
580 |
+
|
581 |
+
$fieldset6->addField('secure_max', 'text', array(
|
582 |
+
'label' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
583 |
+
'title' => Mage::helper('be2bill')->__('Montant maximum de la commande'),
|
584 |
+
'class' => 'validate-zero-or-greater input-text',
|
585 |
+
'required' => false,
|
586 |
+
'name' => 'option[3dsecure][max_amount]',
|
587 |
+
'value' => isset($optionsValues['3dsecure']['max_amount']) ? $optionsValues['3dsecure']['max_amount'] : null,
|
588 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Montant maximum de la commande pour afficher la méthode de paiement') . '</small><br /><small>' . Mage::helper('be2bill')->__('Si vide, pas de montant maximum') . '</small>',
|
589 |
+
));
|
590 |
+
|
591 |
+
|
592 |
+
$tabValue = isset($optionsValues['3dsecure']['b2b_xml_option_extra']) ? $optionsValues['3dsecure']['b2b_xml_option_extra'] : null;
|
593 |
+
$val = 1;
|
594 |
+
if (isset($tabValue['country_iso']) && count($tabValue['country_iso']) <= 0) {
|
595 |
+
$val = 0;
|
596 |
+
}
|
597 |
+
$fieldset6->addField('secure_allowspecific', 'select', array(
|
598 |
+
'label' => Mage::helper('be2bill')->__('Mode de paiement autorisé pour'),
|
599 |
+
'title' => Mage::helper('be2bill')->__('Mode de paiement autorisé pour'),
|
600 |
+
'name' => 'option[3dsecure][allowspecific]',
|
601 |
+
'required' => false,
|
602 |
+
'class' => 'select',
|
603 |
+
'value' => $val,
|
604 |
+
'values' => $allspecificcountries,
|
605 |
+
));
|
606 |
+
|
607 |
+
$fieldset6->addField('secure_allowspecific_countries_code', 'multiselect', array(
|
608 |
+
'label' => Mage::helper('be2bill')->__('Activer le 3D secure uniquement pour les pays :'),
|
609 |
+
'title' => Mage::helper('be2bill')->__('Activer le 3D secure uniquement pour les pays :'),
|
610 |
+
'name' => 'option[3dsecure][country_iso]',
|
611 |
+
'required' => false,
|
612 |
+
'class' => 'multiselect allowed-countries',
|
613 |
+
'value' => isset($tabValue['country_iso']) ? $tabValue['country_iso'] : null,
|
614 |
+
'values' => $_countries,
|
615 |
+
));
|
616 |
+
|
617 |
+
$fieldset6->addField('secure_postcode', 'text', array(
|
618 |
+
'label' => Mage::helper('be2bill')->__('Codes Postaux autorisés'),
|
619 |
+
'title' => Mage::helper('be2bill')->__('Codes Postaux autorisés'),
|
620 |
+
'name' => 'option[3dsecure][postcode]',
|
621 |
+
'required' => false,
|
622 |
+
'class' => 'text',
|
623 |
+
'value' => isset($tabValue['postcode']) ? $tabValue['postcode'] : null,
|
624 |
+
'after_element_html' => '<small>' . Mage::helper('be2bill')->__('Séparer par une virgule / si vide pas de restriction') . '</small>',
|
625 |
+
));
|
626 |
+
|
627 |
+
$_shippingM = Mage::getModel('adminhtml/system_config_source_shipping_allmethods')->toOptionArray(true);
|
628 |
+
$fieldset6->addField('secure_shipping_method', 'multiselect', array(
|
629 |
+
'label' => Mage::helper('be2bill')->__('Méthodes de livraison autorisées'),
|
630 |
+
'title' => Mage::helper('be2bill')->__('Méthodes de livraison autorisées'),
|
631 |
+
'name' => 'option[3dsecure][shipping_method]',
|
632 |
+
'required' => false,
|
633 |
+
'class' => 'multiselect',
|
634 |
+
'value' => isset($tabValue['shipping_method']) ? $tabValue['shipping_method'] : null,
|
635 |
+
'values' => $_shippingM,
|
636 |
+
));
|
637 |
+
|
638 |
+
/* On Click configuration */
|
639 |
+
$fieldset7 = $form->addFieldset('oneclick', array('legend' => Mage::helper('be2bill')->__('Paiement en 1 clic')));
|
640 |
+
|
641 |
+
$fieldset7->addField('oneclick_active', 'select', array(
|
642 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
643 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
644 |
+
'name' => 'option[oneclick][active]',
|
645 |
+
'required' => true,
|
646 |
+
//'class' => 'required-entry select',
|
647 |
+
'value' => isset($optionsValues['oneclick']['active']) ? $optionsValues['oneclick']['active'] : 0,
|
648 |
+
'options' => array(
|
649 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
650 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
651 |
+
),
|
652 |
+
));
|
653 |
+
|
654 |
+
$fieldset7->addField('oneclickcvv_active', 'select', array(
|
655 |
+
'label' => Mage::helper('be2bill')->__('Saisie du cryptogramme'),
|
656 |
+
'title' => Mage::helper('be2bill')->__('Saisie du cryptogramme'),
|
657 |
+
'name' => 'option[oneclickcvv][active]',
|
658 |
+
'required' => true,
|
659 |
+
//'class' => 'required-entry select',
|
660 |
+
'value' => isset($optionsValues['oneclickcvv']['active']) ? $optionsValues['oneclickcvv']['active'] : null,
|
661 |
+
'options' => array(
|
662 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
663 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
664 |
+
),
|
665 |
+
));
|
666 |
+
|
667 |
+
|
668 |
+
/* Recurring profil */
|
669 |
+
$fieldset8 = $form->addFieldset('recurring', array('legend' => Mage::helper('be2bill')->__('Paiement récurrent')));
|
670 |
+
|
671 |
+
$fieldset8->addField('recurring_active', 'select', array(
|
672 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
673 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
674 |
+
'name' => 'option[recurring][active]',
|
675 |
+
'required' => true,
|
676 |
+
//'class' => 'required-entry select',
|
677 |
+
'value' => isset($optionsValues['recurring']['active']) ? $optionsValues['recurring']['active'] : 0,
|
678 |
+
'options' => array(
|
679 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
680 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
681 |
+
),
|
682 |
+
));
|
683 |
+
|
684 |
+
/* Age verification */
|
685 |
+
$fieldset10 = $form->addFieldset('ageverification', array('legend' => Mage::helper('be2bill')->__('Vérification de l\'age')));
|
686 |
+
|
687 |
+
$fieldset10->addField('ageverification_active', 'select', array(
|
688 |
+
'label' => Mage::helper('be2bill')->__('Statut'),
|
689 |
+
'title' => Mage::helper('be2bill')->__('Statut'),
|
690 |
+
'name' => 'option[ageverification][active]',
|
691 |
+
'required' => true,
|
692 |
+
//'class' => 'required-entry select',
|
693 |
+
'value' => isset($optionsValues['ageverification']['active']) ? $optionsValues['ageverification']['active'] : 1,
|
694 |
+
'options' => array(
|
695 |
+
'1' => Mage::helper('be2bill')->__('Activé'),
|
696 |
+
'0' => Mage::helper('be2bill')->__('Désactivé'),
|
697 |
+
),
|
698 |
+
));
|
699 |
+
|
700 |
+
|
701 |
+
/* Allowed Countries */
|
702 |
+
$fieldset11 = $form->addFieldset('allowed_countries', array('legend' => Mage::helper('be2bill')->__('Pays admis')));
|
703 |
+
|
704 |
+
$val = 1;
|
705 |
+
if (count($tabCountries) <= 0) {
|
706 |
+
$val = 0;
|
707 |
+
}
|
708 |
+
|
709 |
+
$fieldset11->addField('allowspecific', 'select', array(
|
710 |
+
'label' => Mage::helper('be2bill')->__('Mode de paiement autorisé pour'),
|
711 |
+
'title' => Mage::helper('be2bill')->__('Mode de paiement autorisé pour'),
|
712 |
+
'name' => 'countries[allowspecific]',
|
713 |
+
'required' => false,
|
714 |
+
'class' => 'select',
|
715 |
+
'value' => $val,
|
716 |
+
'values' => $allspecificcountries,
|
717 |
+
));
|
718 |
+
|
719 |
+
$fieldset11->addField('allowspecific_countries_code', 'multiselect', array(
|
720 |
+
'label' => Mage::helper('be2bill')->__('Mode de paiement autorisé pour les pays spécifiques'),
|
721 |
+
'title' => Mage::helper('be2bill')->__('Mode de paiement autorisé pour les pays spécifiques'),
|
722 |
+
'name' => 'countries[country_iso]',
|
723 |
+
'required' => true,
|
724 |
+
'class' => 'multiselect allowed-countries',
|
725 |
+
'value' => $tabCountries,
|
726 |
+
'values' => $_countries,
|
727 |
+
));
|
728 |
+
|
729 |
+
$form->setUseContainer(true);
|
730 |
+
$this->setForm($form);
|
731 |
+
return parent::_prepareForm();
|
732 |
+
}
|
733 |
+
|
734 |
+
}
|
735 |
+
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Grid.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Adminhtml_Merchandaccount_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
21 |
+
{
|
22 |
+
|
23 |
+
protected $_defaultCountry;
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
|
29 |
+
$this->_defaultCountry = substr(Mage::app()->getLocale()->getLocaleCode(), 3, 4);
|
30 |
+
|
31 |
+
$this->setId('merchandaccountGrid');
|
32 |
+
$this->setDefaultSort('id_b2b_merchand_configuration_account');
|
33 |
+
$this->setDefaultDir('ASC');
|
34 |
+
$this->setSaveParametersInSession(true);
|
35 |
+
$this->setUseAjax(true);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Prepare grid collection object
|
40 |
+
*
|
41 |
+
* @return Quadra_Be2bill_Block_Adminhtml_Merchandaccount_Grid
|
42 |
+
*/
|
43 |
+
protected function _prepareCollection()
|
44 |
+
{
|
45 |
+
|
46 |
+
$collection = Mage::getModel('be2bill/merchandconfigurationaccount')->getCollection();
|
47 |
+
|
48 |
+
$collection->getSelect()->joinLeft(
|
49 |
+
array('a' => Mage::getSingleton('core/resource')->getTableName('b2b_xml_modes_lang')),
|
50 |
+
'main_table.b2b_xml_mode_code = a.b2b_xml_mode_code AND ( a.lang_iso = "' . $this->_defaultCountry . '" ) ',
|
51 |
+
array('mode_lang_name')
|
52 |
+
);
|
53 |
+
|
54 |
+
/*
|
55 |
+
$collection->getSelect()->joinLeft(
|
56 |
+
array('b' => Mage::getSingleton('core/resource')->getTableName('b2b_xml_account_types')),
|
57 |
+
'b.b2b_xml_account_type_code = main_table.b2b_xml_account_type_code ',
|
58 |
+
null
|
59 |
+
);
|
60 |
+
|
61 |
+
$collection->getSelect()->joinLeft(
|
62 |
+
array('c' => Mage::getSingleton('core/resource')->getTableName('b2b_xml_account_type_lang')),
|
63 |
+
'b.b2b_xml_account_type_code = c.b2b_xml_account_type_code and ( c.lang_iso = "' . $this->_defaultCountry . '" ) ',
|
64 |
+
array('account_type_lang_name')
|
65 |
+
);
|
66 |
+
*/
|
67 |
+
|
68 |
+
$collection->getSelect()->joinLeft(
|
69 |
+
array('e' => Mage::getSingleton('core/resource')->getTableName('core_store')),
|
70 |
+
'main_table.core_store_id = e.store_id ',
|
71 |
+
array('*')
|
72 |
+
);
|
73 |
+
|
74 |
+
$this->setCollection($collection);
|
75 |
+
return parent::_prepareCollection();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Prepare grid Columns object
|
80 |
+
* @return $this
|
81 |
+
*/
|
82 |
+
protected function _prepareColumns()
|
83 |
+
{
|
84 |
+
$helper = Mage::helper('be2bill');
|
85 |
+
|
86 |
+
$this->addColumn('store_name', array(
|
87 |
+
'header' => Mage::helper('be2bill')->__('Magasin'),
|
88 |
+
'index' => 'core_store_id',
|
89 |
+
'type' => 'store',
|
90 |
+
'store_all' => true,
|
91 |
+
'store_view' => true,
|
92 |
+
'sortable' => true,
|
93 |
+
));
|
94 |
+
|
95 |
+
|
96 |
+
$this->addColumn('account_type', array(
|
97 |
+
'header' => $helper->__('Type de compte'),
|
98 |
+
'index' => 'b2b_xml_account_type_code'
|
99 |
+
));
|
100 |
+
|
101 |
+
|
102 |
+
$this->addColumn('account_name', array(
|
103 |
+
'header' => $helper->__('Libellé'),
|
104 |
+
'index' => 'configuration_account_name'
|
105 |
+
));
|
106 |
+
|
107 |
+
$this->addColumn('mode', array(
|
108 |
+
'header' => $helper->__('Mode'),
|
109 |
+
'index' => 'b2b_xml_mode_code',
|
110 |
+
'filter' => false,
|
111 |
+
'sortable' => false,
|
112 |
+
'renderer' => 'Quadra_Be2bill_Block_Adminhtml_Merchandaccount_Grid_Renderer_Mode'
|
113 |
+
));
|
114 |
+
|
115 |
+
$this->addColumn('currency_iso', array(
|
116 |
+
'header' => $helper->__('Devise'),
|
117 |
+
'index' => 'currency_iso'
|
118 |
+
));
|
119 |
+
|
120 |
+
$this->addColumn('active', array(
|
121 |
+
'header' => $helper->__('Statut'),
|
122 |
+
'align' => 'left',
|
123 |
+
'width' => '80px',
|
124 |
+
'index' => 'active',
|
125 |
+
'type' => 'options',
|
126 |
+
'options' => array(
|
127 |
+
1 => $helper->__('Activé'),
|
128 |
+
0 => $helper->__('Désactivé')
|
129 |
+
),
|
130 |
+
));
|
131 |
+
|
132 |
+
return parent::_prepareColumns();
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Ajoute dans la liste des actions de la grille
|
137 |
+
* les actions : activer / désactiver / supprimer
|
138 |
+
*/
|
139 |
+
protected function _prepareMassaction()
|
140 |
+
{
|
141 |
+
$this->setMassactionIdField('id_b2b_merchand_configuration_account');
|
142 |
+
$this->getMassactionBlock()->setFormFieldName('merchandaccount');
|
143 |
+
|
144 |
+
$this->getMassactionBlock()
|
145 |
+
->addItem('enabled', array(
|
146 |
+
'label' => Mage::helper('be2bill')->__('Activé'),
|
147 |
+
'url' => $this->getUrl('*/*/massEnable'),
|
148 |
+
'confirm' => Mage::helper('be2bill')->__('Êtes-vous sûr ?')
|
149 |
+
))
|
150 |
+
->addItem('disabled', array(
|
151 |
+
'label' => Mage::helper('be2bill')->__('Désactivé'),
|
152 |
+
'url' => $this->getUrl('*/*/massDisable'),
|
153 |
+
'confirm' => Mage::helper('be2bill')->__('Êtes-vous sûr ?')
|
154 |
+
))
|
155 |
+
->addItem('delete', array(
|
156 |
+
'label' => Mage::helper('be2bill')->__('Suppression'),
|
157 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
158 |
+
'confirm' => Mage::helper('be2bill')->__('Êtes-vous sûr ?')
|
159 |
+
));
|
160 |
+
|
161 |
+
return $this;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* @return Url de la grille
|
166 |
+
*/
|
167 |
+
public function getGridUrl()
|
168 |
+
{
|
169 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @return Url Edit
|
174 |
+
*/
|
175 |
+
public function getRowUrl($row)
|
176 |
+
{
|
177 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
178 |
+
}
|
179 |
+
|
180 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Merchandaccount/Grid/Renderer/Mode.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Adminhtml_Merchandaccount_Grid_Renderer_Mode extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renders grid column mode
|
25 |
+
* @param Varien_Object $row
|
26 |
+
* @return string (label tranduit du mode pour le paiement)
|
27 |
+
*/
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$code = $row->getData($this->getColumn()->getIndex());
|
31 |
+
$langIso = substr(Mage::app()->getLocale()->getLocaleCode(), 3, 4);
|
32 |
+
|
33 |
+
$result = Mage::getModel('be2bill/api_methods')->getModeLangByCodeIso($code, $langIso);
|
34 |
+
return $result[0]['mode_lang_name'];
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Sales/Order/View/Tab/Transactions.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2016 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*
|
16 |
+
* @category Quadra
|
17 |
+
* @package Quadra_Be2bill
|
18 |
+
*/
|
19 |
+
class Quadra_Be2bill_Block_Adminhtml_Sales_Order_View_Tab_Transactions extends Mage_Adminhtml_Block_Sales_Order_View_Tab_Transactions
|
20 |
+
{
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Add columns to grid
|
24 |
+
*
|
25 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
26 |
+
*/
|
27 |
+
protected function _prepareColumns()
|
28 |
+
{
|
29 |
+
$this->addColumn('transaction_id', array(
|
30 |
+
'header' => Mage::helper('sales')->__('ID #'),
|
31 |
+
'index' => 'transaction_id',
|
32 |
+
'type' => 'number'
|
33 |
+
));
|
34 |
+
|
35 |
+
$this->addColumn('increment_id', array(
|
36 |
+
'header' => Mage::helper('sales')->__('Order ID'),
|
37 |
+
'index' => 'increment_id',
|
38 |
+
'type' => 'text'
|
39 |
+
));
|
40 |
+
|
41 |
+
$this->addColumn('txn_id', array(
|
42 |
+
'header' => Mage::helper('sales')->__('Transaction ID'),
|
43 |
+
'index' => 'txn_id',
|
44 |
+
'type' => 'text'
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->addColumn('parent_txn_id', array(
|
48 |
+
'header' => Mage::helper('sales')->__('Parent Transaction ID'),
|
49 |
+
'index' => 'parent_txn_id',
|
50 |
+
'type' => 'text'
|
51 |
+
));
|
52 |
+
|
53 |
+
$this->addColumn('method', array(
|
54 |
+
'header' => Mage::helper('sales')->__('Payment Method Name'),
|
55 |
+
'index' => 'method',
|
56 |
+
'type' => 'options',
|
57 |
+
'options' => Mage::helper('payment')->getPaymentMethodList(true),
|
58 |
+
'option_groups' => Mage::helper('payment')->getPaymentMethodList(true, true, true),
|
59 |
+
));
|
60 |
+
|
61 |
+
$this->addColumn('txn_type', array(
|
62 |
+
'header' => Mage::helper('sales')->__('Transaction Type'),
|
63 |
+
'index' => 'txn_type',
|
64 |
+
'type' => 'options',
|
65 |
+
'options' => Mage::getSingleton('sales/order_payment_transaction')->getTransactionTypes()
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn('txn_amount', array(
|
69 |
+
'header' => Mage::helper('be2bill')->__('Transaction Amount'),
|
70 |
+
'index' => 'txn_amount',
|
71 |
+
'renderer' => 'Quadra_Be2bill_Block_Adminhtml_Sales_Transactions_Renderer_Txnamount',
|
72 |
+
'sortable' => false,
|
73 |
+
'filter'=> false,
|
74 |
+
'align' => 'right',
|
75 |
+
));
|
76 |
+
|
77 |
+
$this->addColumn('is_closed', array(
|
78 |
+
'header' => Mage::helper('sales')->__('Is Closed'),
|
79 |
+
'index' => 'is_closed',
|
80 |
+
'width' => 1,
|
81 |
+
'type' => 'options',
|
82 |
+
'align' => 'center',
|
83 |
+
'options' => array(
|
84 |
+
1 => Mage::helper('sales')->__('Yes'),
|
85 |
+
0 => Mage::helper('sales')->__('No'),
|
86 |
+
)
|
87 |
+
));
|
88 |
+
|
89 |
+
$this->addColumn('created_at', array(
|
90 |
+
'header' => Mage::helper('sales')->__('Created At'),
|
91 |
+
'index' => 'created_at',
|
92 |
+
'width' => 1,
|
93 |
+
'type' => 'datetime',
|
94 |
+
'align' => 'center',
|
95 |
+
'default' => $this->__('N/A'),
|
96 |
+
'html_decorators' => array('nobr')
|
97 |
+
));
|
98 |
+
|
99 |
+
return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
|
100 |
+
}
|
101 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Sales/Transactions/Grid.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2016 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*
|
16 |
+
* @category Quadra
|
17 |
+
* @package Quadra_Be2bill
|
18 |
+
*/
|
19 |
+
class Quadra_Be2bill_Block_Adminhtml_Sales_Transactions_Grid extends Mage_Adminhtml_Block_Sales_Transactions_Grid
|
20 |
+
{
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Add columns to grid
|
24 |
+
*
|
25 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
26 |
+
*/
|
27 |
+
protected function _prepareColumns()
|
28 |
+
{
|
29 |
+
$this->addColumn('transaction_id', array(
|
30 |
+
'header' => Mage::helper('sales')->__('ID #'),
|
31 |
+
'index' => 'transaction_id',
|
32 |
+
'type' => 'number'
|
33 |
+
));
|
34 |
+
|
35 |
+
$this->addColumn('increment_id', array(
|
36 |
+
'header' => Mage::helper('sales')->__('Order ID'),
|
37 |
+
'index' => 'increment_id',
|
38 |
+
'type' => 'text'
|
39 |
+
));
|
40 |
+
|
41 |
+
$this->addColumn('txn_id', array(
|
42 |
+
'header' => Mage::helper('sales')->__('Transaction ID'),
|
43 |
+
'index' => 'txn_id',
|
44 |
+
'type' => 'text'
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->addColumn('parent_txn_id', array(
|
48 |
+
'header' => Mage::helper('sales')->__('Parent Transaction ID'),
|
49 |
+
'index' => 'parent_txn_id',
|
50 |
+
'type' => 'text'
|
51 |
+
));
|
52 |
+
|
53 |
+
$this->addColumn('method', array(
|
54 |
+
'header' => Mage::helper('sales')->__('Payment Method Name'),
|
55 |
+
'index' => 'method',
|
56 |
+
'type' => 'options',
|
57 |
+
'options' => Mage::helper('payment')->getPaymentMethodList(true),
|
58 |
+
'option_groups' => Mage::helper('payment')->getPaymentMethodList(true, true, true),
|
59 |
+
));
|
60 |
+
|
61 |
+
$this->addColumn('txn_type', array(
|
62 |
+
'header' => Mage::helper('sales')->__('Transaction Type'),
|
63 |
+
'index' => 'txn_type',
|
64 |
+
'type' => 'options',
|
65 |
+
'options' => Mage::getSingleton('sales/order_payment_transaction')->getTransactionTypes()
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn('txn_amount', array(
|
69 |
+
'header' => Mage::helper('be2bill')->__('Transaction Amount'),
|
70 |
+
'index' => 'txn_amount',
|
71 |
+
'renderer' => 'Quadra_Be2bill_Block_Adminhtml_Sales_Transactions_Renderer_Txnamount',
|
72 |
+
'sortable' => false,
|
73 |
+
'filter' => false,
|
74 |
+
'align' => 'right',
|
75 |
+
));
|
76 |
+
|
77 |
+
$this->addColumn('is_closed', array(
|
78 |
+
'header' => Mage::helper('sales')->__('Is Closed'),
|
79 |
+
'index' => 'is_closed',
|
80 |
+
'width' => 1,
|
81 |
+
'type' => 'options',
|
82 |
+
'align' => 'center',
|
83 |
+
'options' => array(
|
84 |
+
1 => Mage::helper('sales')->__('Yes'),
|
85 |
+
0 => Mage::helper('sales')->__('No'),
|
86 |
+
)
|
87 |
+
));
|
88 |
+
|
89 |
+
$this->addColumn('created_at', array(
|
90 |
+
'header' => Mage::helper('sales')->__('Created At'),
|
91 |
+
'index' => 'created_at',
|
92 |
+
'width' => 1,
|
93 |
+
'type' => 'datetime',
|
94 |
+
'align' => 'center',
|
95 |
+
'default' => $this->__('N/A'),
|
96 |
+
'html_decorators' => array('nobr')
|
97 |
+
));
|
98 |
+
|
99 |
+
return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
|
100 |
+
}
|
101 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Sales/Transactions/Renderer/Txnamount.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2016 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*
|
16 |
+
* @category Quadra
|
17 |
+
* @package Quadra_Be2bill
|
18 |
+
*/
|
19 |
+
class Quadra_Be2bill_Block_Adminhtml_Sales_Transactions_Renderer_Txnamount extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
20 |
+
{
|
21 |
+
/*
|
22 |
+
* permet de retourner le montant de la transaction
|
23 |
+
* @param Varien_Object
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function render(Varien_Object $row){
|
27 |
+
$aAdditionnalInformation = $row->getData('additional_information');
|
28 |
+
|
29 |
+
if(isset($aAdditionnalInformation['raw_details_info']['amount']))
|
30 |
+
return $aAdditionnalInformation['raw_details_info']['amount'];
|
31 |
+
else
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/System/Config/Fieldset/Hint.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Adminhtml_System_Config_Fieldset_Hint extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
|
21 |
+
{
|
22 |
+
|
23 |
+
protected $_template = 'be2bill/system/config/fieldset/hint.phtml';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Render fieldset html
|
27 |
+
*
|
28 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
32 |
+
{
|
33 |
+
return $this->toHtml();
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Transfert/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Adminhtml_Transfert_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
21 |
+
{
|
22 |
+
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
|
27 |
+
$this->_objectId = 'id';
|
28 |
+
$this->_controller = 'adminhtml_transfert';
|
29 |
+
$this->_mode = 'edit';
|
30 |
+
$this->_blockGroup = 'be2bill';
|
31 |
+
$this->_removeButton('remove');
|
32 |
+
$this->_removeButton('reset');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
*
|
37 |
+
* @see Mage_Adminhtml_Block_Widget_Container::getHeaderText()
|
38 |
+
* @return le titre de l'entete de la page
|
39 |
+
*/
|
40 |
+
public function getHeaderText()
|
41 |
+
{
|
42 |
+
return Mage::helper('be2bill')->__('Transfert des commandes de l\'Api V1 vers V2');
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Adminhtml/Transfert/Edit/Form.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Quadra-Informatique
|
20 |
+
* @category Quadra
|
21 |
+
* @package Quadra_Be2bill
|
22 |
+
*/
|
23 |
+
class Quadra_Be2bill_Block_Adminhtml_Transfert_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Prepare form before rendering HTML
|
28 |
+
*
|
29 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
30 |
+
*/
|
31 |
+
protected function _prepareForm()
|
32 |
+
{
|
33 |
+
$form = new Varien_Data_Form(array(
|
34 |
+
'id' => 'edit_form',
|
35 |
+
'action' => $this->getUrl('*/*/save'),
|
36 |
+
'method' => 'post',
|
37 |
+
'enctype' => 'multipart/form-data'
|
38 |
+
));
|
39 |
+
$form->setUseContainer(true);
|
40 |
+
|
41 |
+
$fieldset = $form->addFieldset('edit_form', array('legend' => Mage::helper('be2bill')->__('Transfert')));
|
42 |
+
|
43 |
+
$fieldset->addField('cb_visa', 'text', array(
|
44 |
+
'label' => Mage::helper('be2bill')->__('CB Visa'),
|
45 |
+
'title' => Mage::helper('be2bill')->__('CB Visa'),
|
46 |
+
'class' => 'input-text',
|
47 |
+
'required' => false,
|
48 |
+
'name' => 'cb_visa',
|
49 |
+
'after_element_html' => '<br /><small>' . Mage::helper('be2bill')->__('Id du compte') . '</small>',
|
50 |
+
'tabindex' => 1,
|
51 |
+
));
|
52 |
+
|
53 |
+
$fieldset->addField('amex', 'text', array(
|
54 |
+
'label' => Mage::helper('be2bill')->__('Amex'),
|
55 |
+
'title' => Mage::helper('be2bill')->__('Amex'),
|
56 |
+
'class' => 'input-text',
|
57 |
+
'required' => false,
|
58 |
+
'name' => 'amex',
|
59 |
+
'after_element_html' => '<br /><small>' . Mage::helper('be2bill')->__('Id du compte') . '</small>',
|
60 |
+
'tabindex' => 1,
|
61 |
+
));
|
62 |
+
|
63 |
+
$fieldset->addField('paypal', 'text', array(
|
64 |
+
'label' => Mage::helper('be2bill')->__('Paypal'),
|
65 |
+
'title' => Mage::helper('be2bill')->__('Paypal'),
|
66 |
+
'class' => 'input-text',
|
67 |
+
'required' => false,
|
68 |
+
'name' => 'paypal',
|
69 |
+
'after_element_html' => '<br /><small>' . Mage::helper('be2bill')->__('Id du compte') . '</small>',
|
70 |
+
'tabindex' => 1,
|
71 |
+
));
|
72 |
+
|
73 |
+
$this->setForm($form);
|
74 |
+
return parent::_prepareForm();
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Checkout/Oneclick/Info.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_Block_Checkout_Oneclick_Info extends Mage_Checkout_Block_Cart_Abstract
|
18 |
+
{
|
19 |
+
|
20 |
+
protected $_instance = null;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Available Carriers Instances
|
24 |
+
* @var null|array
|
25 |
+
*/
|
26 |
+
protected $_carriers = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Estimate Rates
|
30 |
+
* @var array
|
31 |
+
*/
|
32 |
+
protected $_rates = array();
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Address Model
|
36 |
+
*
|
37 |
+
* @var array
|
38 |
+
*/
|
39 |
+
protected $_address = array();
|
40 |
+
|
41 |
+
public function getSubmitUrl()
|
42 |
+
{
|
43 |
+
return Mage::getUrl('be2bill/checkout_oneclick/infoPost', array('_secure' => true));
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @return Mage_Payment_Model_Method_Abstract
|
49 |
+
*/
|
50 |
+
public function getMethodInstance()
|
51 |
+
{
|
52 |
+
if (empty($this->_instance)) {
|
53 |
+
$this->_instance = $this->getQuote()->getPayment()->getMethodInstance();
|
54 |
+
}
|
55 |
+
return $this->_instance;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
*
|
60 |
+
* @return Mage_Payment_Model_Method_Abstract
|
61 |
+
*/
|
62 |
+
public function ntimes()
|
63 |
+
{
|
64 |
+
return $this->getQuote()->getPayment()->getData('additional_information')['options'] == 'ntimes';
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Utilisation de la vérifiaction des CVV ?
|
69 |
+
*
|
70 |
+
* @return boolean
|
71 |
+
*/
|
72 |
+
public function useCVV()
|
73 |
+
{
|
74 |
+
$id = $this->getQuote()->getPayment()->getAdditionalInformation('account_id');
|
75 |
+
$merchandAcc = Mage::getModel('be2bill/merchandconfigurationaccount')->load($id);
|
76 |
+
return $merchandAcc->useOneClickCVV();
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Retourne Base grand Total formaté pour Be2Bill
|
81 |
+
* @return int
|
82 |
+
*/
|
83 |
+
public function getFormatedAmount()
|
84 |
+
{
|
85 |
+
$amount = $this->getQuote()->getBaseGrandTotal();
|
86 |
+
return $this->getMethodInstance()->formatAmount($amount);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Retourne le prix formaté par Magento
|
91 |
+
*
|
92 |
+
* @param float $amount
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
public function priceFormat($amount)
|
96 |
+
{
|
97 |
+
return Mage::helper('core')->currency($amount, true, false);
|
98 |
+
//return Mage::app()->getStore()->getBaseCurrency()->format($amount, array(), true);
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get Estimate Rates
|
103 |
+
*
|
104 |
+
* @return array
|
105 |
+
*/
|
106 |
+
public function getEstimateRates()
|
107 |
+
{
|
108 |
+
if (empty($this->_rates)) {
|
109 |
+
$groups = $this->getAddress()->getGroupedAllShippingRates();
|
110 |
+
$this->_rates = $groups;
|
111 |
+
}
|
112 |
+
return $this->_rates;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Get Address Model
|
117 |
+
*
|
118 |
+
* @return Mage_Sales_Model_Quote_Address
|
119 |
+
*/
|
120 |
+
public function getAddress()
|
121 |
+
{
|
122 |
+
if (empty($this->_address)) {
|
123 |
+
$this->_address = $this->getQuote()->getShippingAddress();
|
124 |
+
}
|
125 |
+
return $this->_address;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Get Carrier Name
|
130 |
+
*
|
131 |
+
* @param string $carrierCode
|
132 |
+
* @return mixed
|
133 |
+
*/
|
134 |
+
public function getCarrierName($carrierCode)
|
135 |
+
{
|
136 |
+
if ($name = Mage::getStoreConfig('carriers/' . $carrierCode . '/title')) {
|
137 |
+
return $name;
|
138 |
+
}
|
139 |
+
return $carrierCode;
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Checkout/Oneclick/Product.php
ADDED
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_Block_Checkout_Oneclick_Product extends Mage_Catalog_Block_Product_View
|
18 |
+
{
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Retrieves url for form submitting:
|
22 |
+
* some objects can use setSubmitRouteData() to set route and params for form submitting,
|
23 |
+
* otherwise default url will be used
|
24 |
+
*
|
25 |
+
* @param Mage_Catalog_Model_Product $product
|
26 |
+
* @param array $additional
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
public function getSubmitUrl($product, $additional = array())
|
30 |
+
{
|
31 |
+
$submitRouteData = $this->getData('submit_route_data');
|
32 |
+
if ($submitRouteData) {
|
33 |
+
$route = $submitRouteData['route'];
|
34 |
+
$params = isset($submitRouteData['params']) ? $submitRouteData['params'] : array();
|
35 |
+
$submitUrl = $this->getUrl($route, array_merge($params, $additional));
|
36 |
+
} else {
|
37 |
+
$params['product'] = $product->getId();
|
38 |
+
$submitUrl = $this->getUrl('be2bill/checkout_oneclick/orderProduct', array_merge($params, $additional));
|
39 |
+
}
|
40 |
+
return $submitUrl;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* URL OneClick
|
45 |
+
*
|
46 |
+
* @return string
|
47 |
+
*/
|
48 |
+
public function getOneclickUrl()
|
49 |
+
{
|
50 |
+
return $this->getSubmitUrl($this->getProduct(), array('_secure' => true));
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Utilsation possible du oneClick
|
55 |
+
* @return boolean
|
56 |
+
*/
|
57 |
+
public function canOneclick()
|
58 |
+
{
|
59 |
+
$helper = Mage::helper('customer');
|
60 |
+
$customer = $helper->getCustomer();
|
61 |
+
/**
|
62 |
+
* oneClick non actif
|
63 |
+
* B2B standard non actif
|
64 |
+
* Client non connecté
|
65 |
+
* Client ne possede pas adresse
|
66 |
+
* Client ne possede pas alias
|
67 |
+
* Client ne possede pas N° CB
|
68 |
+
* Client ne possede pas CB avec date valide
|
69 |
+
*/
|
70 |
+
if ($helper->isLoggedIn() && $helper->customerHasAddresses()) {
|
71 |
+
$colAlias = $customer->getAliasCollection();
|
72 |
+
if ($colAlias != null) {
|
73 |
+
foreach ($colAlias as $alias) {
|
74 |
+
$account = Mage::getModel('be2bill/merchandconfigurationaccount')->load($alias->getData('id_merchand_account'));
|
75 |
+
if ($alias->getData('card_number') != '' &&
|
76 |
+
$account->getActive() &&
|
77 |
+
$account->getOneClick()->getId() != '' &&
|
78 |
+
Mage::helper('be2bill')->checkIfCcExpDateIsValid($alias)) {
|
79 |
+
return true;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Utilsation possible du paiement n fois via le oneClick
|
89 |
+
* @return boolean
|
90 |
+
*/
|
91 |
+
public function canSeveralOneclick()
|
92 |
+
{
|
93 |
+
/**
|
94 |
+
* canOneclick non valide
|
95 |
+
* B2B several non actif
|
96 |
+
* Produit non eligible à oneClick
|
97 |
+
*/
|
98 |
+
if (!$this->canOneclick() || !$this->getProduct()->getBe2billEnableOcSevPayment()) {
|
99 |
+
return false;
|
100 |
+
} else {
|
101 |
+
return true;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
*
|
107 |
+
* @return Mage_Customer_Model_Customer
|
108 |
+
*/
|
109 |
+
public function getCustomer()
|
110 |
+
{
|
111 |
+
return Mage::getSingleton('customer/session')->getCustomer();
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
*
|
116 |
+
* @return boolean
|
117 |
+
*/
|
118 |
+
public function isCustomerLoggedIn()
|
119 |
+
{
|
120 |
+
return Mage::getSingleton('customer/session')->isLoggedIn();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
*
|
125 |
+
* @return boolean
|
126 |
+
*/
|
127 |
+
public function customerHasAddresses()
|
128 |
+
{
|
129 |
+
return count($this->getCustomer()->getAddresses());
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
*
|
134 |
+
* @param string $type
|
135 |
+
* @return string Html
|
136 |
+
*/
|
137 |
+
public function getAddressesHtmlSelect($type)
|
138 |
+
{
|
139 |
+
if ($this->isCustomerLoggedIn()) {
|
140 |
+
$options = array();
|
141 |
+
foreach ($this->getCustomer()->getAddresses() as $address) {
|
142 |
+
$options[] = array(
|
143 |
+
'value' => $address->getId(),
|
144 |
+
'label' => $address->format('oneline')
|
145 |
+
);
|
146 |
+
}
|
147 |
+
|
148 |
+
if ($type == 'billing') {
|
149 |
+
$address = $this->getCustomer()->getPrimaryBillingAddress();
|
150 |
+
} else {
|
151 |
+
$address = $this->getCustomer()->getPrimaryShippingAddress();
|
152 |
+
}
|
153 |
+
|
154 |
+
if ($address) {
|
155 |
+
$addressId = $address->getId();
|
156 |
+
} else {
|
157 |
+
return $this->__('S\'il vous plait, <a href="%s">ajouter une adresse de %s </a>.', Mage::getUrl('customer/address/', array('_secure' => true)), $type);
|
158 |
+
}
|
159 |
+
|
160 |
+
$select = $this->getLayout()->createBlock('core/html_select')
|
161 |
+
->setName($type . '_address_id')
|
162 |
+
->setId($type . '-address-select')
|
163 |
+
->setClass('address-select')
|
164 |
+
->setValue($addressId)
|
165 |
+
->setOptions($options);
|
166 |
+
|
167 |
+
return $select->getHtml();
|
168 |
+
}
|
169 |
+
return $this->__('S\'il vous plait, <a href="%s">ajouter une adresse</a>', Mage::getUrl('customer/address/new/', array('_secure' => true)));
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Creation des valeurs du select : choix de l ' alias
|
174 |
+
* @return string
|
175 |
+
*/
|
176 |
+
public function getAliasSelect()
|
177 |
+
{
|
178 |
+
$helper = Mage::helper('customer');
|
179 |
+
$customer = $helper->getCustomer();
|
180 |
+
$colAlias = $customer->getAliasCollection();
|
181 |
+
$options = array();
|
182 |
+
|
183 |
+
// boucle sur les alias du client
|
184 |
+
foreach ($colAlias as $alias) {
|
185 |
+
if (!Mage::helper('be2bill')->checkIfCcExpDateIsValid($alias)) {
|
186 |
+
continue;
|
187 |
+
}
|
188 |
+
|
189 |
+
// recuperation des operations de paiement disponibles
|
190 |
+
$oPaymentMethod = Mage::getModel('be2bill/merchandconfigurationaccount')->load($alias->getIdMerchandAccount());
|
191 |
+
// verification si MP actif ?
|
192 |
+
if (!$oPaymentMethod->getData('active')) {
|
193 |
+
continue;
|
194 |
+
}
|
195 |
+
|
196 |
+
// si mirakl, il faut filtrer les operations selon Quadra_Be2bill_Helper_Mirakl
|
197 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive() && $this->getProduct()->getMiraklOfferId()){
|
198 |
+
// s'il s'agit d'un MP autorisé par Mirakl
|
199 |
+
if(in_array($oPaymentMethod->getdata('b2b_xml_account_type_code'), Mage::helper('be2bill/mirakl')->getAllowedMPCode())){
|
200 |
+
$oPaymentOptions = $oPaymentMethod->getOptionsCollectionForProductOck($this->getProduct()->getPrice(), true, $this->getProduct()->getBe2billEnableOcSevPayment());
|
201 |
+
|
202 |
+
// filtre sur le "Statut Mirakl" depuis la configuration de l'OPERATION "delivery"
|
203 |
+
$expr = new Zend_Db_Expr('
|
204 |
+
(main_table.b2b_xml_option_extra LIKE "%mkp_only%" AND main_table.b2b_xml_option_extra NOT LIKE "%all%")
|
205 |
+
OR
|
206 |
+
(main_table.b2b_xml_option_extra NOT LIKE "%mkp_only%" AND main_table.b2b_xml_option_extra LIKE "%all%")
|
207 |
+
');
|
208 |
+
$oPaymentOptions
|
209 |
+
->addFieldToFilter('b2b_xml_option', array('delivery'))
|
210 |
+
->getSelect()->where($expr);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
// si hors mirakl ou produit operateur
|
214 |
+
else{
|
215 |
+
$oPaymentOptions = $oPaymentMethod->getOptionsCollectionForProductOck($this->getProduct()->getPrice(), false, $this->getProduct()->getBe2billEnableOcSevPayment());
|
216 |
+
$oPaymentOptions
|
217 |
+
->getSelect()->where('b2b_xml_option_extra NOT LIKE ?', '%mkp_only%');
|
218 |
+
}
|
219 |
+
|
220 |
+
$aOperation = array();
|
221 |
+
if(isset($oPaymentOptions)){
|
222 |
+
foreach ($oPaymentOptions as $oPaymentOption){
|
223 |
+
// création du libellé
|
224 |
+
if($oPaymentOption->getdata('front_label') != null){
|
225 |
+
$_label = $oPaymentOption->getdata('front_label');
|
226 |
+
}
|
227 |
+
else{
|
228 |
+
if($oPaymentOption->getdata('b2b_xml_option') === 'ntimes'){
|
229 |
+
$_label = str_replace('ntimes', $this->__('%s times', unserialize($oPaymentOption->getData('b2b_xml_option_extra'))), $oPaymentMethod->getFrontendLabel($oPaymentOption->getdata('b2b_xml_option')));
|
230 |
+
}
|
231 |
+
else{
|
232 |
+
$_label = $oPaymentMethod->getFrontendLabel($oPaymentOption->getdata('b2b_xml_option'));
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
// création de la value de l'operation
|
237 |
+
$_code = $alias->getAlias() . '|' . $oPaymentMethod->getId() . '|' . $oPaymentOption->getdata('b2b_xml_option');
|
238 |
+
|
239 |
+
$aOperation[$_code] = $_label;
|
240 |
+
|
241 |
+
unset($oPaymentOption);
|
242 |
+
}
|
243 |
+
|
244 |
+
if($aOperation){
|
245 |
+
$options[] = array('label' => $oPaymentMethod->getConfigurationAccountName() . ' ' . $alias->getCardNumber(), 'value' => $aOperation);
|
246 |
+
}
|
247 |
+
|
248 |
+
unset($oPaymentOptions);
|
249 |
+
unset($oPaymentMethod);
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
if($options){
|
254 |
+
$select = $this->getLayout()->createBlock('core/html_select')
|
255 |
+
->setName('alias_code')
|
256 |
+
->setId('alias-card-select')
|
257 |
+
->setClass('select required')
|
258 |
+
->setValue()
|
259 |
+
->setOptions($options);
|
260 |
+
|
261 |
+
unset($options);
|
262 |
+
return $select->getHtml();
|
263 |
+
}
|
264 |
+
else{
|
265 |
+
return false;
|
266 |
+
}
|
267 |
+
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Creation des valeurs du select : choix de la méthode de livraison
|
272 |
+
* @return string
|
273 |
+
*/
|
274 |
+
public function getShippingMethodsSelect()
|
275 |
+
{
|
276 |
+
return Mage::helper('be2bill')->getShippingMethodsSelect(
|
277 |
+
$this->getProduct()->getId(),
|
278 |
+
Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping(),
|
279 |
+
$this->getProduct()->getStockItem()->getMinSaleQty());
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Utilisation du paiement n fois en one click sur la page produit
|
284 |
+
*
|
285 |
+
* @return string
|
286 |
+
*/
|
287 |
+
public function getArrayCanSeveralOneclick()
|
288 |
+
{
|
289 |
+
$result = array();
|
290 |
+
|
291 |
+
$helper = Mage::helper('customer');
|
292 |
+
$customer = $helper->getCustomer();
|
293 |
+
$colAlias = $customer->getAliasCollection();
|
294 |
+
|
295 |
+
|
296 |
+
foreach ($colAlias as $alias) {
|
297 |
+
if (!Mage::helper('be2bill')->checkIfCcExpDateIsValid($alias)) {
|
298 |
+
continue;
|
299 |
+
}
|
300 |
+
$merchand = Mage::getModel('be2bill/merchandconfigurationaccount')->load($alias->getData('id_merchand_account'));
|
301 |
+
if ($merchand->getActive() && $merchand->getSeveral()->getData('id_b2b_merchand_configuration_account_options') != '' && $this->getProduct()->getBe2billEnableOcSevPayment()) {
|
302 |
+
$result[$alias->getIdB2bAlias()] = unserialize($merchand->getSeveral()->getData('b2b_xml_option_extra'));
|
303 |
+
}
|
304 |
+
}
|
305 |
+
return '(' . json_encode($result) . ')';
|
306 |
+
}
|
307 |
+
|
308 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Checkout/Review/Info.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_Block_Checkout_Review_Info extends Mage_Checkout_Block_Cart_Abstract
|
18 |
+
{
|
19 |
+
|
20 |
+
protected $_instance = null;
|
21 |
+
|
22 |
+
public function getMethodInstance()
|
23 |
+
{
|
24 |
+
if (empty($this->_instance)) {
|
25 |
+
$this->_instance = $this->getQuote()->getPayment()->getMethodInstance();
|
26 |
+
}
|
27 |
+
return $this->_instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getFormatedAmount()
|
31 |
+
{
|
32 |
+
$amount = $this->getQuote()->getBaseGrandTotal();
|
33 |
+
return Mage::Helper('be2bill')->formatAmount($amount);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function priceFormat($amount)
|
37 |
+
{
|
38 |
+
return Mage::helper('core')->currency($amount, true, false);
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Form/PaymentMethods.php
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Form_PaymentMethods extends Mage_Payment_Block_Form
|
21 |
+
{
|
22 |
+
|
23 |
+
const OPERATION_TYPE_PAYMENT = 'payment';
|
24 |
+
const OPERATION_TYPE_AUTH = 'authorization';
|
25 |
+
const OPERATION_TYPE_CAPTURE = 'capture';
|
26 |
+
const OPERATION_TYPE_REFUND = 'refund';
|
27 |
+
const OPERATION_TYPE_ONECLICK = 'oneclick';
|
28 |
+
const OPERATION_TYPE_SUBSCRIPTION = 'subscription';
|
29 |
+
|
30 |
+
protected $_checkout;
|
31 |
+
protected $_quote;
|
32 |
+
protected $_notFrontOptions = array(
|
33 |
+
'displaycreatealias',
|
34 |
+
'oneclick',
|
35 |
+
'oneclickcvv',
|
36 |
+
'3dsecure'
|
37 |
+
);
|
38 |
+
|
39 |
+
/**
|
40 |
+
*
|
41 |
+
* @see Mage_Core_Block_Template::_construct()
|
42 |
+
*/
|
43 |
+
protected function _construct()
|
44 |
+
{
|
45 |
+
$this->setTemplate('be2bill/form/payment_methods.phtml')->setMethodTitle('');
|
46 |
+
parent::_construct();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
*
|
51 |
+
* @return Mage_Customer_Model_Customer
|
52 |
+
*/
|
53 |
+
public function getCustomer()
|
54 |
+
{
|
55 |
+
return Mage::getSingleton('customer/session')->getCustomer();
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Retrieve checkout session model
|
60 |
+
*
|
61 |
+
* @return Mage_Checkout_Model_Session
|
62 |
+
*/
|
63 |
+
public function getCheckout()
|
64 |
+
{
|
65 |
+
if (empty($this->_checkout)) {
|
66 |
+
$this->_checkout = Mage::getSingleton('checkout/session');
|
67 |
+
}
|
68 |
+
return $this->_checkout;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Retrieve sales quote model
|
73 |
+
*
|
74 |
+
* @return Mage_Sales_Model_Quote
|
75 |
+
*/
|
76 |
+
public function getQuote()
|
77 |
+
{
|
78 |
+
if (empty($this->_quote)) {
|
79 |
+
$this->_quote = $this->getCheckout()->getQuote();
|
80 |
+
}
|
81 |
+
return $this->_quote;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
*
|
86 |
+
* @param int accountId
|
87 |
+
* @return boolean
|
88 |
+
*/
|
89 |
+
public function ccExpDateIsValid($accountId)
|
90 |
+
{
|
91 |
+
return $this->helper('be2bill')->checkIfCcExpDateIsValid($this->getCustomerAlias($accountId));
|
92 |
+
}
|
93 |
+
|
94 |
+
public function getCcExpDate($date)
|
95 |
+
{
|
96 |
+
$_date = new Zend_date($date);
|
97 |
+
return $_date->getYear()->toString("MM") . ' - ' . $_date->getYear()->toString("YY");
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Retourne Base Grand Total de la quote
|
102 |
+
*
|
103 |
+
* @return float
|
104 |
+
*/
|
105 |
+
public function getQuoteBaseGrandTotal()
|
106 |
+
{
|
107 |
+
return (float)$this->getQuote()->getBaseGrandTotal();
|
108 |
+
}
|
109 |
+
|
110 |
+
public function getMethodLabelAfterHtml()
|
111 |
+
{
|
112 |
+
return $this->getTitle();
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Retourne le Titre du moyen de paiement be2bill
|
117 |
+
* Ce titre est caché pr le js spécifique Be2bill
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
public function getTitle()
|
121 |
+
{
|
122 |
+
return $this->__('Choisir parmi...');
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Retourne l'objet Alias Du client pour le id du compte en paramètre
|
127 |
+
*
|
128 |
+
* @param int id merchand
|
129 |
+
* @return Quadra_Be2bill_Model_Alias
|
130 |
+
*/
|
131 |
+
public function getCustomerAlias($accountId)
|
132 |
+
{
|
133 |
+
return $this->getCustomer()->getAliasByMerchandAccount($accountId);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
*
|
138 |
+
* @param int $accountId
|
139 |
+
* @return boolean
|
140 |
+
*/
|
141 |
+
public function getCustomerHasAlias($accountId)
|
142 |
+
{
|
143 |
+
if ($this->getCustomerAlias($accountId)->getId() != null) {
|
144 |
+
return true;
|
145 |
+
}
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
|
149 |
+
public function getOneClick($paymentMethod)
|
150 |
+
{
|
151 |
+
if ($this->getCustomerHasAlias($paymentMethod->getId()) && $paymentMethod->getOneClick() != null) {
|
152 |
+
return $paymentMethod->getOneClick();
|
153 |
+
} else {
|
154 |
+
return null;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Retourne les paiements génériques configurer par le client
|
160 |
+
* @return
|
161 |
+
*/
|
162 |
+
public function getAvailablePayments()
|
163 |
+
{
|
164 |
+
$quote = $this->getQuote();
|
165 |
+
|
166 |
+
$currency = $quote->getData('quote_currency_code');
|
167 |
+
$country = $quote->getBillingAddress()->getData('country_id');
|
168 |
+
$storeId = $quote->getData('store_id');
|
169 |
+
$recurring = $quote->isNominal();
|
170 |
+
$result = Mage::getModel('be2bill/merchandconfigurationaccount')->getAvailablePayments($currency, $country, $storeId, $recurring);
|
171 |
+
|
172 |
+
return $result;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Retourne les options affichage des paiements
|
177 |
+
* @return
|
178 |
+
*/
|
179 |
+
public function getAvailableFrontOptions($paymentMethod)
|
180 |
+
{
|
181 |
+
$amount = $this->getQuoteBaseGrandTotal();
|
182 |
+
$recurring = $this->getQuote()->isNominal();
|
183 |
+
$options = $paymentMethod->getAvailableFrontOptions($amount, $recurring);
|
184 |
+
return $options;
|
185 |
+
}
|
186 |
+
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Est ce que le compte possède le paramètre identificationdocid ? (Pour Klarna)
|
190 |
+
* @param $paymentMethod
|
191 |
+
*/
|
192 |
+
public function getHasIdenDocId($code , $option)
|
193 |
+
{
|
194 |
+
//echo $code . ' : '. $option;
|
195 |
+
switch ($option) {
|
196 |
+
case 'defered':
|
197 |
+
case 'delivery':
|
198 |
+
$operation = self::OPERATION_TYPE_AUTH;
|
199 |
+
break;
|
200 |
+
case 'capture':
|
201 |
+
$operation = self::OPERATION_TYPE_CAPTURE;
|
202 |
+
break;
|
203 |
+
case 'standard':
|
204 |
+
default :
|
205 |
+
$operation = self::OPERATION_TYPE_PAYMENT;
|
206 |
+
break;
|
207 |
+
}
|
208 |
+
|
209 |
+
$country = $this->getQuote()->getBillingAddress()->getCountryId();
|
210 |
+
$result = Mage::getModel('be2bill/api_methods')->hasIdenDocId($code, $operation, $country);
|
211 |
+
return $result != null ? true : false;
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Tableau des options non affichable sur le front
|
218 |
+
* @return array
|
219 |
+
*/
|
220 |
+
public function getNotFrontOptions()
|
221 |
+
{
|
222 |
+
return $this->_notFrontOptions;
|
223 |
+
}
|
224 |
+
|
225 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Info/PaymentMethods.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Info_PaymentMethods extends Mage_Payment_Block_Info
|
21 |
+
{
|
22 |
+
|
23 |
+
protected function _construct()
|
24 |
+
{
|
25 |
+
parent::_construct();
|
26 |
+
$this->setTemplate('be2bill/info/payment_methods.phtml');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Nom du moyen de paiement dans le récapitulatif de paiement du tunnel
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public function getBe2billMethod()
|
34 |
+
{
|
35 |
+
return Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getData('additional_information')['be2bill_method_label'];
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Retourne des informations de paiement sur la vue de la commande dans l'admin
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function getType()
|
43 |
+
{
|
44 |
+
$html = '';
|
45 |
+
if ($this->getInfo()->getAdditionalInformation('b2b_recurring') == 1) {
|
46 |
+
$html .= $this->__('Profil récurrent') . ' , ';
|
47 |
+
}
|
48 |
+
|
49 |
+
$html .= $this->getInfo()->getAdditionalInformation('account') . ' : ' .
|
50 |
+
$this->getInfo()->getAdditionalInformation('options') . ' -> ' .
|
51 |
+
$this->getInfo()->getAdditionalInformation('be2bill_method_label');
|
52 |
+
|
53 |
+
if ($this->getInfo()->getAdditionalInformation('ntimes') && $this->getInfo()->getAdditionalInformation('ntimes') != '') {
|
54 |
+
$html.= ' / ' . Mage::helper('be2bill')->__('Paiement en %s fois', $this->getInfo()->getAdditionalInformation('ntimes'));
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
return $html;
|
59 |
+
}
|
60 |
+
|
61 |
+
public function getNtimesPaiement()
|
62 |
+
{
|
63 |
+
if ($this->getInfo()->getAdditionalInformation('ntimes') && $this->getInfo()->getAdditionalInformation('ntimes') != '') {
|
64 |
+
$ntimes = (int)$this->getInfo()->getAdditionalInformation('ntimes');
|
65 |
+
$createdAt = explode('-', $this->getInfo()->getOrder()->getCreatedAt());
|
66 |
+
$amount = round($this->getInfo()->getOrder()->getBaseGrandTotal(), 2) * 100;
|
67 |
+
|
68 |
+
$startDate = new DateTime();
|
69 |
+
$startDate->setDate($createdAt[0], $createdAt[1], substr($createdAt[2], 0, 2));
|
70 |
+
|
71 |
+
$schedules = Mage::helper('be2bill')->getSchedule($amount, $ntimes, $startDate);
|
72 |
+
return $schedules;
|
73 |
+
}
|
74 |
+
return '';
|
75 |
+
}
|
76 |
+
|
77 |
+
public function toPdf()
|
78 |
+
{
|
79 |
+
$this->setTemplate('payment/info/pdf/ccsave.phtml');
|
80 |
+
return $this->toHtml();
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getTransactionId()
|
84 |
+
{
|
85 |
+
return $this->getInfo()->getLastTransId();
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Retrieve credit card type name
|
90 |
+
*
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
public function getCcTypeName()
|
94 |
+
{
|
95 |
+
$types = Mage::getSingleton('payment/config')->getCcTypes();
|
96 |
+
if (isset($types[$this->getInfo()->getCcType()])) {
|
97 |
+
return $types[$this->getInfo()->getCcType()];
|
98 |
+
}
|
99 |
+
return $this->getInfo()->getCcType();
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Retrieve CC expiration month
|
104 |
+
*
|
105 |
+
* @return string
|
106 |
+
*/
|
107 |
+
public function getCcExpMonth()
|
108 |
+
{
|
109 |
+
$month = $this->getInfo()->getCcExpMonth();
|
110 |
+
/*if ($month < 10) {
|
111 |
+
$month = '0' . $month;
|
112 |
+
}*/
|
113 |
+
return $month;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Retrieve CC expiration date
|
118 |
+
*
|
119 |
+
* @return Zend_Date
|
120 |
+
*/
|
121 |
+
public function getCcExpDate()
|
122 |
+
{
|
123 |
+
$date = Mage::app()->getLocale()->date(0);
|
124 |
+
$date->setYear($this->getInfo()->getCcExpYear());
|
125 |
+
$date->setMonth($this->getInfo()->getCcExpMonth());
|
126 |
+
return $date;
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Method/Iframe.php
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Method_Iframe extends Mage_Payment_Block_Form
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Whether the block should be eventually rendered
|
25 |
+
*
|
26 |
+
* @var bool
|
27 |
+
*/
|
28 |
+
protected $_shouldRender = false;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Order object
|
32 |
+
*
|
33 |
+
* @var Mage_Sales_Model_Order
|
34 |
+
*/
|
35 |
+
protected $_order;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Payment method code
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
protected $_paymentMethodCode;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Current iframe block instance
|
46 |
+
*
|
47 |
+
* @var Mage_Payment_Block_Form
|
48 |
+
*/
|
49 |
+
protected $_block;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Internal constructor
|
53 |
+
* Set info template for payment step
|
54 |
+
*
|
55 |
+
*/
|
56 |
+
protected function _construct()
|
57 |
+
{
|
58 |
+
parent::_construct();
|
59 |
+
$paymentCode = $this->_getCheckout()
|
60 |
+
->getQuote()
|
61 |
+
->getPayment()
|
62 |
+
->getMethod();
|
63 |
+
|
64 |
+
if ($paymentCode == $this->helper('be2bill')->getMethod()) {
|
65 |
+
$this->_paymentMethodCode = $paymentCode;
|
66 |
+
$this->setTemplate('be2bill/checkout/iframe.phtml');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get current block instance
|
72 |
+
*
|
73 |
+
* @return Mage_Paypal_Block_Iframe
|
74 |
+
*/
|
75 |
+
protected function _getBlock()
|
76 |
+
{
|
77 |
+
if (!$this->_block) {
|
78 |
+
$this->_block = $this->getAction()
|
79 |
+
->getLayout()
|
80 |
+
->createBlock('be2bill/checkout_iframe');
|
81 |
+
}
|
82 |
+
|
83 |
+
return $this->_block;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Get order object
|
88 |
+
*
|
89 |
+
* @return Mage_Sales_Model_Order
|
90 |
+
*/
|
91 |
+
protected function _getOrder()
|
92 |
+
{
|
93 |
+
if (!$this->_order) {
|
94 |
+
$incrementId = $this->_getCheckout()->getLastRealOrderId();
|
95 |
+
$this->_order = Mage::getModel('sales/order')
|
96 |
+
->loadByIncrementId($incrementId);
|
97 |
+
}
|
98 |
+
return $this->_order;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get frontend checkout session object
|
103 |
+
*
|
104 |
+
* @return Mage_Checkout_Model_Session
|
105 |
+
*/
|
106 |
+
protected function _getCheckout()
|
107 |
+
{
|
108 |
+
return Mage::getSingleton('checkout/session');
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Before rendering html, check if is block rendering needed
|
113 |
+
*
|
114 |
+
* @return Mage_Core_Block_Abstract
|
115 |
+
*/
|
116 |
+
protected function _beforeToHtml()
|
117 |
+
{
|
118 |
+
if ($this->_getOrder()->getId() &&
|
119 |
+
$this->_getOrder()->getQuoteId() == $this->_getCheckout()->getLastQuoteId() &&
|
120 |
+
$this->_paymentMethodCode) {
|
121 |
+
$this->_shouldRender = true;
|
122 |
+
}
|
123 |
+
|
124 |
+
if ($this->getGotoSection() || $this->getGotoSuccessPage()) {
|
125 |
+
$this->_shouldRender = true;
|
126 |
+
}
|
127 |
+
|
128 |
+
return parent::_beforeToHtml();
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Check whether block is rendering after save payment
|
133 |
+
*
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
+
protected function _isAfterPaymentSave()
|
137 |
+
{
|
138 |
+
$quote = $this->_getCheckout()->getQuote();
|
139 |
+
if ($quote->getPayment()->getMethod() == $this->_paymentMethodCode &&
|
140 |
+
$quote->getIsActive() &&
|
141 |
+
$this->getTemplate() &&
|
142 |
+
$this->getRequest()->getActionName() == 'savePayment') {
|
143 |
+
return true;
|
144 |
+
}
|
145 |
+
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get iframe action URL
|
151 |
+
*
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
public function getFrameActionUrl()
|
155 |
+
{
|
156 |
+
return Mage::getUrl('be2bill/payments/redirect', array('_secure' => true));
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get secure token
|
161 |
+
*
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
public function getSecureToken()
|
165 |
+
{
|
166 |
+
return $this->_getBlock()->getSecureToken();
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Get secure token ID
|
171 |
+
*
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
public function getSecureTokenId()
|
175 |
+
{
|
176 |
+
return $this->_getBlock()->getSecureTokenId();
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Get payflow transaction URL
|
181 |
+
*
|
182 |
+
* @return string
|
183 |
+
*/
|
184 |
+
public function getTransactionUrl()
|
185 |
+
{
|
186 |
+
return $this->_getBlock()->getTransactionUrl();
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Check sandbox mode
|
191 |
+
*
|
192 |
+
* @return bool
|
193 |
+
*/
|
194 |
+
public function isTestMode()
|
195 |
+
{
|
196 |
+
return $this->_getBlock()->isTestMode();
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
app/code/community/Quadra/Be2bill/Block/Method/Redirect.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Block_Method_Redirect extends Mage_Core_Block_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
protected $methodName = '';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Return l'html du formulaire avec tout les paramètres du moyen de paiement générique selectionné
|
27 |
+
* par le client (utile pour be2bill)
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
protected function _toHtml()
|
31 |
+
{
|
32 |
+
$method = Mage::getSingleton("be2bill/method_paymentMethods");
|
33 |
+
$action = $method->getRedirectUrl();
|
34 |
+
|
35 |
+
if($action == null) {
|
36 |
+
echo Mage::helper('be2bill')->__('Impossible de se connecter aux serveurs de Be2bill');
|
37 |
+
}
|
38 |
+
else {
|
39 |
+
$form = new Varien_Data_Form();
|
40 |
+
|
41 |
+
$form->setAction($action)
|
42 |
+
->setId('be2bill_checkout')
|
43 |
+
->setName('be2bill_checkout')->setMethod('POST')
|
44 |
+
->setUseContainer(true);
|
45 |
+
|
46 |
+
$method->getCheckoutFormFields();
|
47 |
+
$nb = 0;
|
48 |
+
foreach ($method->getCheckoutFormFields() as $field => $value) {
|
49 |
+
if (is_array($value)) {
|
50 |
+
foreach ($value as $key => $val) {
|
51 |
+
if(is_array($val)){
|
52 |
+
foreach ($val as $key2 => $val2) {
|
53 |
+
$form->addField($field . "[" . $key . "]" . "[" . $key2 . "]", 'hidden', array('name' => $field . "[" . $key . "]". "[" . $key2 . "]", 'value' => $val2));
|
54 |
+
}
|
55 |
+
}
|
56 |
+
else{
|
57 |
+
$form->addField($field . "[" . $key . "]", 'hidden', array('name' => $field . "[" . $key . "]", 'value' => $val));
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
} else {
|
62 |
+
$form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
$html = '<html><body>';
|
67 |
+
$html .= $this->__('Vous allez être redirigé vers le serveur de paiement dans quelques secondes...');
|
68 |
+
$html .= $form->toHtml();
|
69 |
+
$html .= '<script type="text/javascript">document.getElementById("be2bill_checkout").submit();</script>';
|
70 |
+
$html .= '</body></html>';
|
71 |
+
|
72 |
+
return $html;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
app/code/community/Quadra/Be2bill/Controller/Action.php
ADDED
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Controller_Action extends Mage_Core_Controller_Front_Action
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var Mage_Sales_Model_Quote
|
25 |
+
*/
|
26 |
+
protected $_quote = false;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get checkout session model instance
|
30 |
+
*
|
31 |
+
* @return Mage_Checkout_Model_Session
|
32 |
+
*/
|
33 |
+
protected function _getSession()
|
34 |
+
{
|
35 |
+
return Mage::getSingleton('checkout/session');
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Lancer avant les controllers
|
40 |
+
* @see Mage_Core_Controller_Front_Action::preDispatch()
|
41 |
+
*/
|
42 |
+
public function preDispatch()
|
43 |
+
{
|
44 |
+
$action = $this->getRequest()->getActionName();
|
45 |
+
$pattern = '/^(ipn)/i';
|
46 |
+
|
47 |
+
if (preg_match($pattern, $action)) {
|
48 |
+
if (!$this->_validateServer()) {
|
49 |
+
$this->getResponse()->setBody(Mage::helper('be2bill')->__('Mauvaise IP : ') . Mage::helper('core/http')->getRemoteAddr());
|
50 |
+
$this->setFlag('', 'no-dispatch', true);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
// Redirection vers le controller correspondant à la méhode de paiement utilisée
|
55 |
+
$realOrderId = $this->getRequest()->getParam('ORDERID', false);
|
56 |
+
if ($realOrderId) {
|
57 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($realOrderId);
|
58 |
+
if ($order->getId()) {
|
59 |
+
$method = $order->getPayment()->getMethod();
|
60 |
+
if ($method != $this->getMethodInstance()->getCode()) {
|
61 |
+
$this->setFlag('', 'no-dispatch', true);
|
62 |
+
$exMethod = explode('_', $method);
|
63 |
+
$this->_forward($action, $exMethod[1], $exMethod[0], $this->getRequest()->getParams());
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
return parent::preDispatch();
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Test l'ip du server
|
73 |
+
*
|
74 |
+
* @return boolean
|
75 |
+
*/
|
76 |
+
protected function _validateServer()
|
77 |
+
{
|
78 |
+
/* @var $_helper Quadra_Be2bill_Helper_Data */
|
79 |
+
$_helper = Mage::helper('be2bill');
|
80 |
+
if (!$_helper->isBe2billServer()) {
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
return true;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get singleton with be2bill method instance order transaction information
|
89 |
+
*
|
90 |
+
* @return Quadra_Be2bill_Model_Abstract
|
91 |
+
*/
|
92 |
+
public function getMethodInstance()
|
93 |
+
{
|
94 |
+
throw new Exception("GET Method instance must be implemented!");
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* When a customer cancel payment from be2bill.
|
99 |
+
*/
|
100 |
+
public function cancelAction()
|
101 |
+
{
|
102 |
+
$session = $this->_getCheckoutSession();
|
103 |
+
$session->setQuoteId($session->getBe2billStandardQuoteId(true));
|
104 |
+
// cancel order
|
105 |
+
if ($session->getLastRealOrderId()) {
|
106 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
107 |
+
if ($order->getId()) {
|
108 |
+
$order->addStatusToHistory(
|
109 |
+
$order->getStatus(),
|
110 |
+
// keep order status/state cancel
|
111 |
+
Mage::helper('be2bill')->__('Annuler par le client')
|
112 |
+
)
|
113 |
+
->cancel()
|
114 |
+
->save();
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
//need to save quote as active again if the user click on cancel payment from be2bill
|
119 |
+
$this->_getQuote()->setIsActive(true)->save();
|
120 |
+
//and then redirect to cart page
|
121 |
+
$this->_redirect('checkout/cart');
|
122 |
+
|
123 |
+
return $this;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* When a customer chooses Be2bill on Checkout/Payment page
|
128 |
+
*
|
129 |
+
*/
|
130 |
+
public function redirectAction()
|
131 |
+
{
|
132 |
+
$session = $this->_getCheckoutSession();
|
133 |
+
$session->setBe2billStandardQuoteId($session->getQuoteId());
|
134 |
+
|
135 |
+
/* @var $blockRedirect Quadra_Be2bill_Block_Method_Redirect */
|
136 |
+
$blockRedirect = $this->getLayout()->createBlock('be2bill/method_redirect');
|
137 |
+
|
138 |
+
//$blockRedirect->setMethodName('be2bill');
|
139 |
+
$this->getResponse()->setBody($blockRedirect->toHtml());
|
140 |
+
$session->unsQuoteId();
|
141 |
+
$session->unsRedirectUrl();
|
142 |
+
|
143 |
+
return $this;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @Deprecated
|
148 |
+
* Quand le client choisi le payment Paypal
|
149 |
+
*/
|
150 |
+
public function paypalAction()
|
151 |
+
{
|
152 |
+
$session = $this->_getCheckoutSession();
|
153 |
+
$session->setBe2billStandardQuoteId($session->getQuoteId());
|
154 |
+
|
155 |
+
$session->unsQuoteId();
|
156 |
+
$session->unsRedirectUrl();
|
157 |
+
|
158 |
+
/* @var $methodInstance Quadra_Be2bill_Model_Abstract */
|
159 |
+
$methodInstance = $this->getMethodInstance();
|
160 |
+
|
161 |
+
try {
|
162 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
163 |
+
|
164 |
+
if (!$order->getId()) {
|
165 |
+
Mage::throwException("Commande introuvable!");
|
166 |
+
}
|
167 |
+
|
168 |
+
//@var $response Quadra_Be2bill_Model_Api_Response
|
169 |
+
$response = $methodInstance->paypal($order->getPayment(), $order->getBaseTotalDue());
|
170 |
+
|
171 |
+
if ($response['execcode'] == '0002') {
|
172 |
+
$this->getResponse()->setBody(base64_decode($response['redirecthtml']));
|
173 |
+
} else {
|
174 |
+
$session->setErrorMessage($response->getMessage());
|
175 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
176 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
177 |
+
}
|
178 |
+
} catch (Exception $e) {
|
179 |
+
Mage::logException($e);
|
180 |
+
$session->setErrorMessage($e->getMessage());
|
181 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Quand le client choisi un payment en mode directLink
|
187 |
+
*/
|
188 |
+
public function directlinkAction()
|
189 |
+
{
|
190 |
+
$session = $this->_getCheckoutSession();
|
191 |
+
$session->setBe2billStandardQuoteId($session->getQuoteId());
|
192 |
+
|
193 |
+
$session->unsQuoteId();
|
194 |
+
$session->unsRedirectUrl();
|
195 |
+
|
196 |
+
/* @var $methodInstance Quadra_Be2bill_Model_Abstract */
|
197 |
+
$methodInstance = $this->getMethodInstance();
|
198 |
+
|
199 |
+
try {
|
200 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
201 |
+
|
202 |
+
if (!$order->getId()) {
|
203 |
+
Mage::throwException("Commande introuvable!");
|
204 |
+
}
|
205 |
+
|
206 |
+
//@var $response Quadra_Be2bill_Model_Api_Response
|
207 |
+
$response = $methodInstance->directlink($order->getPayment(), $order->getBaseTotalDue());
|
208 |
+
|
209 |
+
if ($response['execcode'] == '0002') {
|
210 |
+
$this->getResponse()->setBody(base64_decode($response['redirecthtml']));
|
211 |
+
} else {
|
212 |
+
$session->setErrorMessage($response->getMessage());
|
213 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
214 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
215 |
+
}
|
216 |
+
} catch (Exception $e) {
|
217 |
+
Mage::logException($e);
|
218 |
+
$session->setErrorMessage($e->getMessage());
|
219 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Si le client paye par Oneclick
|
225 |
+
*/
|
226 |
+
public function oneclickAction()
|
227 |
+
{
|
228 |
+
$session = $this->_getCheckoutSession();
|
229 |
+
$session->setBe2billStandardQuoteId($session->getQuoteId());
|
230 |
+
|
231 |
+
$session->unsQuoteId();
|
232 |
+
$session->unsRedirectUrl();
|
233 |
+
|
234 |
+
/* @var $methodInstance Quadra_Be2bill_Model_Abstract */
|
235 |
+
$methodInstance = $this->getMethodInstance();
|
236 |
+
|
237 |
+
try {
|
238 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
239 |
+
|
240 |
+
if (!$order->getId()) {
|
241 |
+
Mage::throwException("Commande introuvable!");
|
242 |
+
}
|
243 |
+
|
244 |
+
/* @var $response Quadra_Be2bill_Model_Api_Response */
|
245 |
+
$methodInstance->oneclick($order->getPayment(), $order->getBaseTotalDue());
|
246 |
+
|
247 |
+
$session->setQuoteId($session->getbe2billStandardQuoteId(true));
|
248 |
+
|
249 |
+
/**
|
250 |
+
* set the quote as inactive after back from be2bill
|
251 |
+
*/
|
252 |
+
$this->_getQuote()->setIsActive(false)->save();
|
253 |
+
$this->_getCheckoutSession()->unsQuoteId();
|
254 |
+
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
255 |
+
} catch (Exception $e) {
|
256 |
+
Mage::logException($e);
|
257 |
+
$session->setErrorMessage($e->getMessage());
|
258 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Return checkout session object
|
264 |
+
*
|
265 |
+
* @return Mage_Checkout_Model_Session
|
266 |
+
*/
|
267 |
+
protected function _getCheckoutSession()
|
268 |
+
{
|
269 |
+
return Mage::getSingleton('checkout/session');
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Return checkout quote object
|
274 |
+
*
|
275 |
+
* @return Mage_Sale_Model_Quote
|
276 |
+
*/
|
277 |
+
protected function _getQuote()
|
278 |
+
{
|
279 |
+
if (!$this->_quote) {
|
280 |
+
$this->_quote = $this->_getCheckoutSession()->getQuote();
|
281 |
+
}
|
282 |
+
return $this->_quote;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* when be2bill returns
|
287 |
+
* The order information at this point is in GET
|
288 |
+
* variables. However, you don't want to "process" the order until you
|
289 |
+
* get validation from the IPN.
|
290 |
+
*/
|
291 |
+
public function returnAction()
|
292 |
+
{
|
293 |
+
$session = $this->_getCheckoutSession();
|
294 |
+
$infos = $this->getRequest()->getParams();
|
295 |
+
//$infos = $this->getRequest()->getPost();
|
296 |
+
$infos['class_method'] = __METHOD__;
|
297 |
+
|
298 |
+
$this->getMethodInstance()->debugData($infos);
|
299 |
+
/* @var $response Quadra_Be2bill_Model_Api_Response */
|
300 |
+
$response = Mage::getModel('be2bill/api_response')->setData($infos);
|
301 |
+
|
302 |
+
if (!$response->hasExeccode()) {
|
303 |
+
$session->setErrorMessage($this->__('INTERDIT!'));
|
304 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
305 |
+
return $this;
|
306 |
+
}
|
307 |
+
|
308 |
+
if ($response->isSuccess()) {
|
309 |
+
if (($profileIds = Mage::getSingleton('checkout/session')->getLastRecurringProfileIds())) {
|
310 |
+
if (is_array($profileIds)) {
|
311 |
+
//print_r($profileIds);
|
312 |
+
|
313 |
+
$collection = Mage::getModel('sales/recurring_profile')->getCollection()
|
314 |
+
->addFieldToFilter('profile_id', array('in' => $profileIds));
|
315 |
+
|
316 |
+
foreach ($collection as $profile) {
|
317 |
+
$referenceId = $response->getAlias() . "-" . $profile->getId();
|
318 |
+
$profile->setAdditionalInfo(array('transaction_id' => $response->getTransactionId(), "alias" => $response->getAlias()));
|
319 |
+
$profile->setReferenceId($referenceId);
|
320 |
+
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
|
321 |
+
$profile->save();
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
$session->setQuoteId($session->getBe2billStandardQuoteId(true));
|
327 |
+
|
328 |
+
/**
|
329 |
+
* set the quote as inactive after back from be2bill
|
330 |
+
*/
|
331 |
+
$quote = Mage::getModel('sales/quote')->load($session->getQuoteId());
|
332 |
+
|
333 |
+
$addInfo = $quote->getPayment()->getAdditionalInformation();
|
334 |
+
|
335 |
+
$this->_getQuote()->setIsActive(false)->save();
|
336 |
+
$this->_getCheckoutSession()->unsQuoteId();
|
337 |
+
|
338 |
+
$account = $addInfo['account'];
|
339 |
+
$mode = $addInfo['mode'];
|
340 |
+
|
341 |
+
if ($mode == 'form-iframe' || $mode == 'directlink') {
|
342 |
+
$this->_redirect('be2bill/template/success', array('_secure' => true));
|
343 |
+
} else {
|
344 |
+
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
345 |
+
}
|
346 |
+
} else {
|
347 |
+
Mage::helper('be2bill')->reAddToCart($response->getIncrementId());
|
348 |
+
if ($response->getExecCode() == "1002") {
|
349 |
+
$session->addError($this->__("La date de validité de votre carte Bleue ne permet pas d’effectuer un paiement en plusieurs fois, nous vous invitons à changer de Carte Bleue ou bien à vous diriger vers le paiement en une fois."));
|
350 |
+
$session->addError($this->__("Merci de votre compréhension."));
|
351 |
+
} else {
|
352 |
+
$session->addError($this->__('(Code retour : %s) %s', $response->getExecCode(), $response->getMessage()));
|
353 |
+
}
|
354 |
+
Mage::logException(new Exception($response->getMessage(), $response->getExecCode()));
|
355 |
+
$session->setCanRedirect(false);
|
356 |
+
if ($this->_getQuote()->getPayment()->getAdditionalInformation('mode') == 'form-iframe') {
|
357 |
+
$this->_redirect('checkout/cart');
|
358 |
+
} else {
|
359 |
+
$this->_redirect('be2bill/template/failure', array('_secure' => true));
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
return $this;
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* when be2bill returns via ipn
|
368 |
+
* cannot have any output here
|
369 |
+
* validate IPN data
|
370 |
+
* if data is valid need to update the database that the user has
|
371 |
+
*/
|
372 |
+
public function ipnAction()
|
373 |
+
{
|
374 |
+
if (!$this->getRequest()->isPost()) {
|
375 |
+
$this->_redirect('');
|
376 |
+
return $this;
|
377 |
+
}
|
378 |
+
|
379 |
+
$methodInstance = $this->getMethodInstance();
|
380 |
+
$methodInstance->setResponse(Mage::getModel('be2bill/api_response')->setData($this->getRequest()->getPost()));
|
381 |
+
|
382 |
+
try {
|
383 |
+
$methodInstance->ipnPostSubmit();
|
384 |
+
} catch (Exception $e) {
|
385 |
+
$this->getResponse()->setBody($e->getMessage());
|
386 |
+
Mage::logException($e);
|
387 |
+
return $this;
|
388 |
+
}
|
389 |
+
$this->getResponse()->setBody("OK");
|
390 |
+
return $this;
|
391 |
+
}
|
392 |
+
|
393 |
+
}
|
app/code/community/Quadra/Be2bill/Helper/Data.php
ADDED
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Helper_Data extends Mage_Core_Helper_Data
|
21 |
+
{
|
22 |
+
|
23 |
+
protected $_method = 'be2bill';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retourne le code de la méthode de paiement (générique)
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
public function getMethod()
|
30 |
+
{
|
31 |
+
return $this->_method;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Formate la collection d'options dans un tableau
|
36 |
+
* @param $collection (merchand option)
|
37 |
+
* @return array
|
38 |
+
*/
|
39 |
+
public function getFormattedCollectionOptionsToArray($collection)
|
40 |
+
{
|
41 |
+
$result = array();
|
42 |
+
foreach ($collection as $option) {
|
43 |
+
$result[$option->getData('b2b_xml_option')] = array(
|
44 |
+
'min_amount' => $option->getData('min_amount'),
|
45 |
+
'max_amount' => $option->getData('max_amount'),
|
46 |
+
'option_name' => $option->getData('option_name'),
|
47 |
+
'b2b_xml_option_extra' => unserialize($option->getData('b2b_xml_option_extra')),
|
48 |
+
'active' => (int)$option->getData('active'),
|
49 |
+
'front_label' => $option->getData('front_label')
|
50 |
+
);
|
51 |
+
}
|
52 |
+
return $result;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Verifie que la date de la carte n'est pas périmée
|
57 |
+
* @param string $alias
|
58 |
+
* @return boolean
|
59 |
+
*/
|
60 |
+
public function checkIfCcExpDateIsValid($alias)
|
61 |
+
{
|
62 |
+
$expDate = new Zend_Date($alias->getData('date_end'));
|
63 |
+
|
64 |
+
$expYear = $expDate->getYear()->toString("YY");
|
65 |
+
$expMonth = $expDate->getMonth()->toString("MM");
|
66 |
+
|
67 |
+
$today = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
|
68 |
+
|
69 |
+
$currentYear = (int)$today->getYear()->toString("YY");
|
70 |
+
$currentMonth = (int)$today->getMonth()->toString("MM");
|
71 |
+
|
72 |
+
if ($currentYear > (int)$expYear) {
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
|
76 |
+
if ($currentYear == (int)$expYear && $currentMonth > (int)$expMonth) {
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
|
80 |
+
return true;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
*
|
85 |
+
* @return boolean
|
86 |
+
*/
|
87 |
+
public function isBe2billServer()
|
88 |
+
{
|
89 |
+
$allowedRangeIps = explode(",", Mage::getStoreConfig('payment/be2bill/allow_range_ips'));
|
90 |
+
/* @var $_helperIp Quadra_Be2bill_Helper_Ip */
|
91 |
+
$_helperIp = Mage::helper('be2bill/ip');
|
92 |
+
foreach ($allowedRangeIps as $range) {
|
93 |
+
list($ip, $mask) = explode("/", $range);
|
94 |
+
if ($_helperIp->checkIfRemoteIpIsInRange($ip, $mask) === true) {
|
95 |
+
return true;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Formate le montant pour be2bill (centimes)
|
104 |
+
*
|
105 |
+
* @param float $amount
|
106 |
+
* @return number
|
107 |
+
*/
|
108 |
+
public function formatAmount($amount)
|
109 |
+
{
|
110 |
+
return round($amount, 2) * 100;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Get template for button in order review page if be2bill method was selected
|
115 |
+
*
|
116 |
+
* @param string $name template name
|
117 |
+
* @param string $block buttons block name
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
public function getReviewButtonTemplate($name, $block)
|
121 |
+
{
|
122 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
123 |
+
|
124 |
+
if ($quote) {
|
125 |
+
$payment = $quote->getPayment();
|
126 |
+
if ($payment && $payment->getAdditionalInformation('mode') == 'form-iframe' && $payment->getAdditionalInformation('use_oneclick') == 'no') {
|
127 |
+
return $name;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
if ($blockObject = Mage::getSingleton('core/layout')->getBlock($block)) {
|
132 |
+
return $blockObject->getTemplate();
|
133 |
+
}
|
134 |
+
|
135 |
+
return '';
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Réaffecte la commande non valide à un nouveau panier
|
140 |
+
* @param int $incrementId (id order)
|
141 |
+
*/
|
142 |
+
public function reAddToCart($incrementId)
|
143 |
+
{
|
144 |
+
$cart = Mage::getSingleton('checkout/cart');
|
145 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
|
146 |
+
|
147 |
+
if ($order->getId()) {
|
148 |
+
$items = $order->getItemsCollection();
|
149 |
+
foreach ($items as $item) {
|
150 |
+
try {
|
151 |
+
$cart->addOrderItem($item);
|
152 |
+
} catch (Mage_Core_Exception $e) {
|
153 |
+
if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
|
154 |
+
Mage::getSingleton('checkout/session')->addNotice($e->getMessage());
|
155 |
+
} else {
|
156 |
+
Mage::getSingleton('checkout/session')->addError($e->getMessage());
|
157 |
+
}
|
158 |
+
} catch (Exception $e) {
|
159 |
+
Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Cannot add the item to shopping cart.'));
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
$cart->save();
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @desc methode permettant de calculer la liste des echeances de paiement, ainsi que le montant de chacune des echeances
|
169 |
+
* @param float $fAmount montant de la commande en centime de devise
|
170 |
+
* @param integer $iNTimes nombre d'echeance totale
|
171 |
+
* @param Date $startDate Date de dévut de l'échéancier
|
172 |
+
* @return array liste des echeances
|
173 |
+
*/
|
174 |
+
public function getSchedule($fAmount /* en centime de devise */, $iNTimes, $startDate = null)
|
175 |
+
{
|
176 |
+
|
177 |
+
$oToday = new DateTime();
|
178 |
+
if ($startDate != null) {
|
179 |
+
$oToday = $startDate;
|
180 |
+
}
|
181 |
+
|
182 |
+
/*
|
183 |
+
* CALCUL DU MONTANT DES ECHEANCES
|
184 |
+
*/
|
185 |
+
// division du montant total par le nombre d'echeance
|
186 |
+
$fSplitedAmount = $fAmount / $iNTimes;
|
187 |
+
|
188 |
+
// si montant non entier
|
189 |
+
if (!is_int($fSplitedAmount)) {
|
190 |
+
// 1ere echeance
|
191 |
+
$fFirstAmount = (int)$fSplitedAmount + $iNTimes * ($fSplitedAmount - (int)$fSplitedAmount);
|
192 |
+
// toutes les autres echeances
|
193 |
+
$iNextAmounts = (int)$fSplitedAmount;
|
194 |
+
} else {
|
195 |
+
$fFirstAmount = $iNextAmounts = $fSplitedAmount;
|
196 |
+
}
|
197 |
+
|
198 |
+
/*
|
199 |
+
* CALCUL DES DATES DES ECHEANCES
|
200 |
+
*/
|
201 |
+
for ($i = 0; $i < $iNTimes; $i++) {
|
202 |
+
switch ($i) {
|
203 |
+
case 0:
|
204 |
+
// date du jour
|
205 |
+
$aSchedule[$oToday->format('Y-m-d')] = $fFirstAmount;
|
206 |
+
break;
|
207 |
+
case 1:
|
208 |
+
case 2:
|
209 |
+
// date du jour
|
210 |
+
$sYear = $oToday->format('Y');
|
211 |
+
$sMonth = $oToday->format('n');
|
212 |
+
$sDay = $oToday->format('d');
|
213 |
+
|
214 |
+
// calcul
|
215 |
+
$sYear += floor($i / 12);
|
216 |
+
$i = $i % 12;
|
217 |
+
$sMonth += $i;
|
218 |
+
if ($sMonth > 12) {
|
219 |
+
$sYear ++;
|
220 |
+
$sMonth = $sMonth % 12;
|
221 |
+
if ($sMonth === 0) {
|
222 |
+
$sMonth = 12;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
if (!checkdate($sMonth, $sDay, $sYear)) {
|
227 |
+
$oNewDate = DateTime::createFromFormat('Y-n-j', $sYear . '-' . $sMonth . '-1');
|
228 |
+
$oNewDate->modify('last day of');
|
229 |
+
} else {
|
230 |
+
$oNewDate = DateTime::createFromFormat('Y-n-d', $sYear . '-' . $sMonth . '-' . $sDay);
|
231 |
+
}
|
232 |
+
$oNewDate->setTime($oToday->format('H'), $oToday->format('i'), $oToday->format('s'));
|
233 |
+
|
234 |
+
$aSchedule[$oNewDate->format('Y-m-d')] = $iNextAmounts;
|
235 |
+
break;
|
236 |
+
case 3:
|
237 |
+
// date du jour
|
238 |
+
$aSchedule[$oToday->modify('+89 day')->format('Y-m-d')] = $iNextAmounts;
|
239 |
+
break;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
return $aSchedule;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Verifie si la soumission du P R est possible
|
248 |
+
* @param Mage_Sales_Model_Recurring_Profile $profile
|
249 |
+
* @return boolean
|
250 |
+
*/
|
251 |
+
public function isRecurringTosubmit(Mage_Sales_Model_Recurring_Profile $profile)
|
252 |
+
{
|
253 |
+
$orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('entity_id', array('in' => $profile->getChildOrderIds()));
|
254 |
+
$startDate = new Zend_Date($profile->getStartDatetime());
|
255 |
+
$todayDate = new Zend_Date();
|
256 |
+
|
257 |
+
if ($startDate->compare($todayDate) <= 0 && $orders->count() < 1) {
|
258 |
+
return true;
|
259 |
+
}
|
260 |
+
|
261 |
+
if ($orders->count() > 0) {
|
262 |
+
$currentNbCycle = (int)$orders->count();
|
263 |
+
$maxCycles = (int)$profile->getPeriodMaxCycles();
|
264 |
+
$periodFrequency = (int)$profile->getPeriodFrequency();
|
265 |
+
|
266 |
+
if (!empty($maxCycles) && $currentNbCycle == ($periodFrequency * $maxCycles)) {
|
267 |
+
return false;
|
268 |
+
}
|
269 |
+
|
270 |
+
$lastOrder = $orders->getLastItem();
|
271 |
+
$lastDate = new Zend_Date($lastOrder->getCreatedAt());
|
272 |
+
|
273 |
+
switch ($profile->getPeriodUnit()) {
|
274 |
+
case Mage_Sales_Model_Recurring_Profile::PERIOD_UNIT_MONTH:
|
275 |
+
if ($lastDate->addMonth($periodFrequency)->getDate()->compare($todayDate->getDate()) <= 0) {
|
276 |
+
return true;
|
277 |
+
}
|
278 |
+
break;
|
279 |
+
case Mage_Sales_Model_Recurring_Profile::PERIOD_UNIT_DAY:
|
280 |
+
if ($lastDate->addDay($periodFrequency)->getDate()->compare($todayDate->getDate()) <= 0) {
|
281 |
+
return true;
|
282 |
+
}
|
283 |
+
break;
|
284 |
+
case Mage_Sales_Model_Recurring_Profile::PERIOD_UNIT_SEMI_MONTH:
|
285 |
+
if ($lastDate->addMonth(0.5 * $periodFrequency)->getDate()->compare($todayDate->getDate()) <= 0) {
|
286 |
+
return true;
|
287 |
+
}
|
288 |
+
break;
|
289 |
+
case Mage_Sales_Model_Recurring_Profile::PERIOD_UNIT_WEEK:
|
290 |
+
if ($lastDate->addWeek($periodFrequency)->getDate()->compare($todayDate->getDate()) <= 0) {
|
291 |
+
return true;
|
292 |
+
}
|
293 |
+
break;
|
294 |
+
case Mage_Sales_Model_Recurring_Profile::PERIOD_UNIT_YEAR:
|
295 |
+
if ($lastDate->addYear($periodFrequency)->getDate()->compare($todayDate->getDate()) <= 0) {
|
296 |
+
return true;
|
297 |
+
}
|
298 |
+
break;
|
299 |
+
default:
|
300 |
+
break;
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
return false;
|
305 |
+
}
|
306 |
+
|
307 |
+
public function isMiraklInstalledAndActive()
|
308 |
+
{
|
309 |
+
return Mage::helper('core')->isModuleEnabled('Mirakl_Core');
|
310 |
+
}
|
311 |
+
|
312 |
+
public function getShippingMethodsSelect($iProductId, $iAddressId, $iQty){
|
313 |
+
|
314 |
+
$oProduct = Mage::getModel('catalog/product')->load($iProductId);
|
315 |
+
$oShippingAddress = Mage::getModel('customer/address')->load($iAddressId);
|
316 |
+
|
317 |
+
// si mirakl actif et produit marketplace ?
|
318 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive() && $oProduct->getMiraklOfferId()){
|
319 |
+
|
320 |
+
// charger les datas
|
321 |
+
$aOffersWithQty = array($oProduct->getMiraklOfferId() => $iQty);
|
322 |
+
$aShopsWithShippingType = array($oProduct->getMiraklShopId() => 'STD');
|
323 |
+
|
324 |
+
$oShippingFees = Mage::helper('mirakl_api/shipping')->getShippingFees(
|
325 |
+
Mage::getModel('customer/address')->load(Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping())->getData('country_id'),
|
326 |
+
$aOffersWithQty,
|
327 |
+
$aShopsWithShippingType
|
328 |
+
);
|
329 |
+
|
330 |
+
// si produit simple
|
331 |
+
// pas d'one click pour les produits groupés
|
332 |
+
if(!$oShippingFees[0]){
|
333 |
+
return false;
|
334 |
+
}
|
335 |
+
|
336 |
+
if($oShippingFees[0]->getData('error_code'))
|
337 |
+
return false;
|
338 |
+
|
339 |
+
$_shippingTypes = $oShippingFees[0]->getData('offers')[0]->getData('shipping_types');
|
340 |
+
|
341 |
+
$options = array();
|
342 |
+
foreach ($_shippingTypes as $_shippingType){
|
343 |
+
$options[] = array('value' => $_shippingType['code'].'|'.$_shippingType['line_only_shipping_price'].'|'.$_shippingType['label'], 'label' => $_shippingType['label'] . ' - ' . Mage::helper('core')->currency($_shippingType['line_only_shipping_price'], true, false));
|
344 |
+
}
|
345 |
+
}
|
346 |
+
// si produit operateur
|
347 |
+
else{
|
348 |
+
// creation d'une NOUVELLE QUOTE
|
349 |
+
$oTmpQuote = Mage::getModel('sales/quote');
|
350 |
+
|
351 |
+
// assignation du client et du store
|
352 |
+
$oTmpQuote
|
353 |
+
->assignCustomer(Mage::getSingleton('customer/session')->getCustomer())
|
354 |
+
->setStoreId(Mage::app()->getStore()->getId());
|
355 |
+
|
356 |
+
$oTmpQuote->save();
|
357 |
+
|
358 |
+
// creation de la quote item
|
359 |
+
$quoteItem = Mage::getModel('sales/quote_item')
|
360 |
+
->setProduct($oProduct)
|
361 |
+
->setQty($iQty);
|
362 |
+
|
363 |
+
// ajout du produit à la quote
|
364 |
+
$oTmpQuote->addItem($quoteItem);
|
365 |
+
|
366 |
+
// ajout de l'adresse par defaut de livraison
|
367 |
+
// affectation des donnée pour création de la quote
|
368 |
+
$aShippingAddress = array(
|
369 |
+
'firstname' => $oShippingAddress->getData('firstname'),
|
370 |
+
'lastname' => $oShippingAddress->getData('lastname'),
|
371 |
+
'street' => $oShippingAddress->getData('street'),
|
372 |
+
'city' => $oShippingAddress->getData('city'),
|
373 |
+
'postcode'=> $oShippingAddress->getData('postcode'),
|
374 |
+
'telephone' => $oShippingAddress->getData('telephone'),
|
375 |
+
'country_id' => $oShippingAddress->getData('country_id'),
|
376 |
+
'region_id' => $oShippingAddress->getData('region_id')
|
377 |
+
);
|
378 |
+
|
379 |
+
$shippingAddress = $oTmpQuote->getShippingAddress()->addData($aShippingAddress)->save();
|
380 |
+
$shippingAddress->setCollectShippingRates(true)->collectShippingRates();
|
381 |
+
$groupedRates = $shippingAddress->getShippingRatesCollection();
|
382 |
+
|
383 |
+
$options = array();
|
384 |
+
// boucle sur les methodes de livraison
|
385 |
+
foreach ($groupedRates as $carrierCode => $rates ) {
|
386 |
+
|
387 |
+
$carrierName = $carrierCode;
|
388 |
+
if (!is_null(Mage::getStoreConfig('carriers/'.$carrierCode.'/title'))) {
|
389 |
+
$carrierName = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
|
390 |
+
}
|
391 |
+
|
392 |
+
// affectation de la methode de livraison à la liste d'option
|
393 |
+
$options[] = array('value' => $rates->getData('code'), 'label' => $rates->getData('carrier_title') . ' - ' . Mage::helper('core')->currency($rates->getData('price'), true, false));
|
394 |
+
}
|
395 |
+
|
396 |
+
// suppression de la quote
|
397 |
+
$oTmpQuote->delete();
|
398 |
+
unset($oTmpQuote);
|
399 |
+
}
|
400 |
+
|
401 |
+
// création du select
|
402 |
+
$select = Mage::app()->getLayout()->createBlock('core/html_select')
|
403 |
+
->setName('shipping_method_code')
|
404 |
+
->setId('shipping-method-select')
|
405 |
+
->setClass('select required')
|
406 |
+
->setValue()
|
407 |
+
->setOptions($options);
|
408 |
+
|
409 |
+
unset($options);
|
410 |
+
return $select->getHtml();
|
411 |
+
}
|
412 |
+
|
413 |
+
}
|
app/code/community/Quadra/Be2bill/Helper/Ip.php
ADDED
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_Helper_Ip extends Mage_Core_Helper_Http
|
18 |
+
{
|
19 |
+
|
20 |
+
const XML_NODE_BE2BILL_REMOTE_ADDR_HEADERS = 'global/be2bill/remote_addr_headers';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Retrieve Remote Addresses Additional check Headers
|
24 |
+
*
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function getBe2billRemoteAddrHeaders()
|
28 |
+
{
|
29 |
+
$headers = array();
|
30 |
+
$element = Mage::getConfig()->getNode(self::XML_NODE_BE2BILL_REMOTE_ADDR_HEADERS);
|
31 |
+
if ($element instanceof Mage_Core_Model_Config_Element) {
|
32 |
+
foreach ($element->children() as $node) {
|
33 |
+
$headers[] = (string)$node;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
return $headers;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Verifie l'ip si Ok
|
42 |
+
* @param string $ip
|
43 |
+
* @param string $mask
|
44 |
+
* @return boolean
|
45 |
+
*/
|
46 |
+
public function checkIfRemoteIpIsInRange($ip, $mask)
|
47 |
+
{
|
48 |
+
$this->checkMask($mask);
|
49 |
+
//TODO check if IP format is valid
|
50 |
+
|
51 |
+
$allow = false;
|
52 |
+
|
53 |
+
$headers = $this->getBe2billRemoteAddrHeaders();
|
54 |
+
|
55 |
+
$firstIp2Long = $this->getFirtAddress($ip, $mask, true);
|
56 |
+
$lastIp2Long = $this->getLastAddress($ip, $mask, true);
|
57 |
+
|
58 |
+
foreach ($headers as $var) {
|
59 |
+
if ($this->_getRequest()->getServer($var, false)) {
|
60 |
+
$remoteAdr2Long = ip2long($_SERVER[$var]);
|
61 |
+
if (($remoteAdr2Long >= $firstIp2Long) && ($remoteAdr2Long <= $lastIp2Long)) {
|
62 |
+
$allow = true;
|
63 |
+
break;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
return $allow;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
*
|
73 |
+
* @param string $mask
|
74 |
+
*/
|
75 |
+
protected function checkMask($mask)
|
76 |
+
{
|
77 |
+
if (($mask < 1) || ($mask > 32)) {
|
78 |
+
Mage::throwException("Mask {$mask} is not valid!");
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
*
|
84 |
+
* @param string $ip
|
85 |
+
* @param string $mask
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
protected function getRoute($ip, $mask)
|
89 |
+
{
|
90 |
+
$route = ip2long($ip) & ip2long($this->_getMaskString($mask)); // Ajoute l'IP et le masque en binaire
|
91 |
+
return long2ip($route); // Convertit l'adresse inetaddr en IP
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
*
|
96 |
+
* @param string $ip
|
97 |
+
* @param string $mask
|
98 |
+
* @param string $returnIpToLong
|
99 |
+
* @return string
|
100 |
+
*/
|
101 |
+
protected function getFirtAddress($ip, $mask, $returnIpToLong = false)
|
102 |
+
{
|
103 |
+
$offset = 0;
|
104 |
+
$firstIp = "N/A";
|
105 |
+
if ($mask != 32) {
|
106 |
+
$offset = 1;
|
107 |
+
}
|
108 |
+
|
109 |
+
if ($mask == 31) {
|
110 |
+
return $firstIp;
|
111 |
+
}
|
112 |
+
|
113 |
+
$firstIp = ip2long($this->getRoute($ip, $mask)) + $offset;
|
114 |
+
$firstIp = long2ip($firstIp);
|
115 |
+
|
116 |
+
return $returnIpToLong ? ip2long($firstIp) : $firstIp;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
*
|
121 |
+
* @param string $ip
|
122 |
+
* @param string $mask
|
123 |
+
* @param string $returnIpToLong
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
protected function getLastAddress($ip, $mask, $returnIpToLong = false)
|
127 |
+
{
|
128 |
+
$offset = -1;
|
129 |
+
$lastIp = "N/A";
|
130 |
+
|
131 |
+
if ($mask != 32) {
|
132 |
+
$offset = 0;
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($mask == 31) {
|
136 |
+
return $lastIp;
|
137 |
+
}
|
138 |
+
|
139 |
+
$lastIp = ip2long($this->getRoute($ip, $mask)) + $this->getCountHost($mask) + $offset;
|
140 |
+
$lastIp = long2ip($lastIp);
|
141 |
+
|
142 |
+
return $returnIpToLong ? ip2long($lastIp) : $lastIp;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
*
|
147 |
+
* @param string $mask
|
148 |
+
* @return number
|
149 |
+
*/
|
150 |
+
protected function getCountHost($mask)
|
151 |
+
{
|
152 |
+
if ($mask == 32) {
|
153 |
+
$cntHost = 1;
|
154 |
+
} else {
|
155 |
+
$cntHost = pow(2, 32 - $mask) - 2;
|
156 |
+
}
|
157 |
+
|
158 |
+
return $cntHost;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
*
|
163 |
+
* @param string $mask
|
164 |
+
* @return string
|
165 |
+
*/
|
166 |
+
protected function _getMaskString($mask)
|
167 |
+
{
|
168 |
+
$maskString = "255.255.255.255";
|
169 |
+
|
170 |
+
switch ($mask) {
|
171 |
+
case 1:
|
172 |
+
$maskString = "128.0.0.0";
|
173 |
+
break;
|
174 |
+
case 2:
|
175 |
+
$maskString = "192.0.0.0";
|
176 |
+
break;
|
177 |
+
case 3:
|
178 |
+
$maskString = "224.0.0.0";
|
179 |
+
break;
|
180 |
+
case 4:
|
181 |
+
$maskString = "240.0.0.0";
|
182 |
+
break;
|
183 |
+
case 5:
|
184 |
+
$maskString = "248.0.0.0";
|
185 |
+
break;
|
186 |
+
case 6:
|
187 |
+
$maskString = "252.0.0.0";
|
188 |
+
break;
|
189 |
+
case 7:
|
190 |
+
$maskString = "254.0.0.0";
|
191 |
+
break;
|
192 |
+
case 8:
|
193 |
+
$maskString = "255.0.0.0";
|
194 |
+
break;
|
195 |
+
case 9:
|
196 |
+
$maskString = "255.128.0.0";
|
197 |
+
break;
|
198 |
+
case 10:
|
199 |
+
$maskString = "255.192.0.0";
|
200 |
+
break;
|
201 |
+
case 11:
|
202 |
+
$maskString = "255.224.0.0";
|
203 |
+
break;
|
204 |
+
case 12:
|
205 |
+
$maskString = "255.240.0.0";
|
206 |
+
break;
|
207 |
+
case 13:
|
208 |
+
$maskString = "255.248.0.0";
|
209 |
+
break;
|
210 |
+
case 14:
|
211 |
+
$maskString = "255.252.0.0";
|
212 |
+
break;
|
213 |
+
case 15:
|
214 |
+
$maskString = "255.254.0.0";
|
215 |
+
break;
|
216 |
+
case 16:
|
217 |
+
$maskString = "255.255.0.0";
|
218 |
+
break;
|
219 |
+
case 17:
|
220 |
+
$maskString = "255.255.128.0";
|
221 |
+
break;
|
222 |
+
case 18:
|
223 |
+
$maskString = "255.255.192.0";
|
224 |
+
break;
|
225 |
+
case 19:
|
226 |
+
$maskString = "255.255.224.0";
|
227 |
+
break;
|
228 |
+
case 20:
|
229 |
+
$maskString = "255.255.240.0";
|
230 |
+
break;
|
231 |
+
case 21:
|
232 |
+
$maskString = "255.255.248.0";
|
233 |
+
break;
|
234 |
+
case 22:
|
235 |
+
$maskString = "255.255.252.0";
|
236 |
+
break;
|
237 |
+
case 23:
|
238 |
+
$maskString = "255.255.254.0";
|
239 |
+
break;
|
240 |
+
case 24:
|
241 |
+
$maskString = "255.255.255.0";
|
242 |
+
break;
|
243 |
+
case 25:
|
244 |
+
$maskString = "255.255.255.128";
|
245 |
+
break;
|
246 |
+
case 26:
|
247 |
+
$maskString = "255.255.255.192";
|
248 |
+
break;
|
249 |
+
case 27:
|
250 |
+
$maskString = "255.255.255.224";
|
251 |
+
break;
|
252 |
+
case 28:
|
253 |
+
$maskString = "255.255.255.240";
|
254 |
+
break;
|
255 |
+
case 29:
|
256 |
+
$maskString = "255.255.255.248";
|
257 |
+
break;
|
258 |
+
case 30:
|
259 |
+
$maskString = "255.255.255.252";
|
260 |
+
break;
|
261 |
+
case 31:
|
262 |
+
$maskString = "255.255.255.254";
|
263 |
+
break;
|
264 |
+
case 32:
|
265 |
+
$maskString = "255.255.255.255";
|
266 |
+
break;
|
267 |
+
default :
|
268 |
+
$maskString = "255.255.255.255";
|
269 |
+
break;
|
270 |
+
}
|
271 |
+
|
272 |
+
return $maskString;
|
273 |
+
}
|
274 |
+
|
275 |
+
}
|
app/code/community/Quadra/Be2bill/Helper/Mirakl.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Helper_Mirakl extends Mage_Core_Helper_Data
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Retourne la liste des MP eligibles à Mirakl
|
25 |
+
* @param void
|
26 |
+
* @return array
|
27 |
+
*/
|
28 |
+
public function getAllowedMPCode()
|
29 |
+
{
|
30 |
+
return array('CB/Visa/MasterCard');
|
31 |
+
//return array('CB/Visa/MasterCard', 'Visa/MasterCard');
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Alias.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Alias extends Mage_Core_Model_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialize
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
parent::_construct();
|
29 |
+
$this->_init('be2bill/alias');
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Api/Http/Client/Adapter/Curl.php
ADDED
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* @see Zend_Uri_Http
|
19 |
+
*/
|
20 |
+
#require_once 'Zend/Uri/Http.php';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @see Zend_Http_Client_Adapter_Interface
|
24 |
+
*/
|
25 |
+
#require_once 'Zend/Http/Client/Adapter/Interface.php';
|
26 |
+
/**
|
27 |
+
* @see Zend_Http_Client_Adapter_Stream
|
28 |
+
*/
|
29 |
+
#require_once 'Zend/Http/Client/Adapter/Stream.php';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* An adapter class for Zend_Http_Client based on the curl extension.
|
33 |
+
* Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl
|
34 |
+
*
|
35 |
+
*/
|
36 |
+
class Quadra_Be2bill_Model_Api_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interface, Quadra_Be2bill_Model_Api_Http_Client_Adapter_Stream
|
37 |
+
{
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Parameters array
|
41 |
+
*
|
42 |
+
* @var array
|
43 |
+
*/
|
44 |
+
protected $_config = array();
|
45 |
+
|
46 |
+
/**
|
47 |
+
* What host/port are we connected to?
|
48 |
+
*
|
49 |
+
* @var array
|
50 |
+
*/
|
51 |
+
protected $_connected_to = array(null, null);
|
52 |
+
|
53 |
+
/**
|
54 |
+
* The curl session handle
|
55 |
+
*
|
56 |
+
* @var resource|null
|
57 |
+
*/
|
58 |
+
protected $_curl = null;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* List of cURL options that should never be overwritten
|
62 |
+
*
|
63 |
+
* @var array
|
64 |
+
*/
|
65 |
+
protected $_invalidOverwritableCurlOptions;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Response gotten from server
|
69 |
+
*
|
70 |
+
* @var string
|
71 |
+
*/
|
72 |
+
protected $_response = null;
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Stream for storing output
|
76 |
+
*
|
77 |
+
* @var resource
|
78 |
+
*/
|
79 |
+
protected $out_stream;
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Adapter constructor
|
83 |
+
*
|
84 |
+
* Config is set using setConfig()
|
85 |
+
*
|
86 |
+
* @return void
|
87 |
+
* @throws Zend_Http_Client_Adapter_Exception
|
88 |
+
*/
|
89 |
+
public function __construct()
|
90 |
+
{
|
91 |
+
if (!extension_loaded('curl')) {
|
92 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
93 |
+
throw new Zend_Http_Client_Adapter_Exception('cURL extension has to be loaded to use this Zend_Http_Client adapter.');
|
94 |
+
}
|
95 |
+
$this->_invalidOverwritableCurlOptions = array(
|
96 |
+
CURLOPT_HTTPGET,
|
97 |
+
CURLOPT_POST,
|
98 |
+
CURLOPT_PUT,
|
99 |
+
CURLOPT_CUSTOMREQUEST,
|
100 |
+
CURLOPT_HEADER,
|
101 |
+
CURLOPT_RETURNTRANSFER,
|
102 |
+
CURLOPT_HTTPHEADER,
|
103 |
+
CURLOPT_POSTFIELDS,
|
104 |
+
CURLOPT_INFILE,
|
105 |
+
CURLOPT_INFILESIZE,
|
106 |
+
CURLOPT_PORT,
|
107 |
+
CURLOPT_MAXREDIRS,
|
108 |
+
CURLOPT_CONNECTTIMEOUT,
|
109 |
+
CURL_HTTP_VERSION_1_1,
|
110 |
+
CURL_HTTP_VERSION_1_0,
|
111 |
+
);
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Set the configuration array for the adapter
|
116 |
+
*
|
117 |
+
* @throws Zend_Http_Client_Adapter_Exception
|
118 |
+
* @param Zend_Config | array $config
|
119 |
+
* @return Zend_Http_Client_Adapter_Curl
|
120 |
+
*/
|
121 |
+
public function setConfig($config = array())
|
122 |
+
{
|
123 |
+
if ($config instanceof Zend_Config) {
|
124 |
+
$config = $config->toArray();
|
125 |
+
} elseif (!is_array($config)) {
|
126 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
127 |
+
throw new Zend_Http_Client_Adapter_Exception(
|
128 |
+
'Array or Zend_Config object expected, got ' . gettype($config)
|
129 |
+
);
|
130 |
+
}
|
131 |
+
|
132 |
+
if (isset($config['proxy_user']) && isset($config['proxy_pass'])) {
|
133 |
+
$this->setCurlOption(CURLOPT_PROXYUSERPWD, $config['proxy_user'] . ":" . $config['proxy_pass']);
|
134 |
+
unset($config['proxy_user'], $config['proxy_pass']);
|
135 |
+
}
|
136 |
+
|
137 |
+
foreach ($config as $k => $v) {
|
138 |
+
$option = strtolower($k);
|
139 |
+
switch ($option) {
|
140 |
+
case 'proxy_host':
|
141 |
+
$this->setCurlOption(CURLOPT_PROXY, $v);
|
142 |
+
break;
|
143 |
+
case 'proxy_port':
|
144 |
+
$this->setCurlOption(CURLOPT_PROXYPORT, $v);
|
145 |
+
break;
|
146 |
+
default:
|
147 |
+
$this->_config[$option] = $v;
|
148 |
+
break;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
return $this;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Retrieve the array of all configuration options
|
157 |
+
*
|
158 |
+
* @return array
|
159 |
+
*/
|
160 |
+
public function getConfig()
|
161 |
+
{
|
162 |
+
return $this->_config;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Direct setter for cURL adapter related options.
|
167 |
+
*
|
168 |
+
* @param string|int $option
|
169 |
+
* @param mixed $value
|
170 |
+
* @return Zend_Http_Adapter_Curl
|
171 |
+
*/
|
172 |
+
public function setCurlOption($option, $value)
|
173 |
+
{
|
174 |
+
if (!isset($this->_config['curloptions'])) {
|
175 |
+
$this->_config['curloptions'] = array();
|
176 |
+
}
|
177 |
+
$this->_config['curloptions'][$option] = $value;
|
178 |
+
return $this;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Initialize curl
|
183 |
+
*
|
184 |
+
* @param string $host
|
185 |
+
* @param int $port
|
186 |
+
* @param boolean $secure
|
187 |
+
* @return void
|
188 |
+
* @throws Zend_Http_Client_Adapter_Exception if unable to connect
|
189 |
+
*/
|
190 |
+
public function connect($host, $port = 80, $secure = false)
|
191 |
+
{
|
192 |
+
// If we're already connected, disconnect first
|
193 |
+
if ($this->_curl) {
|
194 |
+
$this->close();
|
195 |
+
}
|
196 |
+
|
197 |
+
// If we are connected to a different server or port, disconnect first
|
198 |
+
if ($this->_curl && is_array($this->_connected_to) && ($this->_connected_to[0] != $host || $this->_connected_to[1] != $port)
|
199 |
+
) {
|
200 |
+
$this->close();
|
201 |
+
}
|
202 |
+
|
203 |
+
// Do the actual connection
|
204 |
+
$this->_curl = curl_init();
|
205 |
+
if ($port != 80) {
|
206 |
+
curl_setopt($this->_curl, CURLOPT_PORT, intval($port));
|
207 |
+
}
|
208 |
+
|
209 |
+
// Set timeout
|
210 |
+
curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);
|
211 |
+
|
212 |
+
// Set Max redirects
|
213 |
+
curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']);
|
214 |
+
|
215 |
+
if (!$this->_curl) {
|
216 |
+
$this->close();
|
217 |
+
|
218 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
219 |
+
throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port);
|
220 |
+
}
|
221 |
+
|
222 |
+
if ($secure !== false) {
|
223 |
+
// Behave the same like Zend_Http_Adapter_Socket on SSL options.
|
224 |
+
if (isset($this->_config['sslcert'])) {
|
225 |
+
curl_setopt($this->_curl, CURLOPT_SSLCERT, $this->_config['sslcert']);
|
226 |
+
}
|
227 |
+
if (isset($this->_config['sslpassphrase'])) {
|
228 |
+
curl_setopt($this->_curl, CURLOPT_SSLCERTPASSWD, $this->_config['sslpassphrase']);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
// Update connected_to
|
233 |
+
$this->_connected_to = array($host, $port);
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Send request to the remote server
|
238 |
+
*
|
239 |
+
* @param string $method
|
240 |
+
* @param Zend_Uri_Http $uri
|
241 |
+
* @param float $httpVersion
|
242 |
+
* @param array $headers
|
243 |
+
* @param string $body
|
244 |
+
* @return string $request
|
245 |
+
* @throws Zend_Http_Client_Adapter_Exception If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option
|
246 |
+
*/
|
247 |
+
public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $body = '')
|
248 |
+
{
|
249 |
+
// Make sure we're properly connected
|
250 |
+
if (!$this->_curl) {
|
251 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
252 |
+
throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are not connected");
|
253 |
+
}
|
254 |
+
|
255 |
+
if ($this->_connected_to[0] != $uri->getHost() || $this->_connected_to[1] != $uri->getPort()) {
|
256 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
257 |
+
throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are connected to the wrong host");
|
258 |
+
}
|
259 |
+
|
260 |
+
// set URL
|
261 |
+
curl_setopt($this->_curl, CURLOPT_URL, $uri->__toString());
|
262 |
+
|
263 |
+
// ensure correct curl call
|
264 |
+
$curlValue = true;
|
265 |
+
switch ($method) {
|
266 |
+
case Zend_Http_Client::GET:
|
267 |
+
$curlMethod = CURLOPT_HTTPGET;
|
268 |
+
break;
|
269 |
+
|
270 |
+
case Zend_Http_Client::POST:
|
271 |
+
$curlMethod = CURLOPT_POST;
|
272 |
+
break;
|
273 |
+
|
274 |
+
case Zend_Http_Client::PUT:
|
275 |
+
// There are two different types of PUT request, either a Raw Data string has been set
|
276 |
+
// or CURLOPT_INFILE and CURLOPT_INFILESIZE are used.
|
277 |
+
if (is_resource($body)) {
|
278 |
+
$this->_config['curloptions'][CURLOPT_INFILE] = $body;
|
279 |
+
}
|
280 |
+
if (isset($this->_config['curloptions'][CURLOPT_INFILE])) {
|
281 |
+
// Now we will probably already have Content-Length set, so that we have to delete it
|
282 |
+
// from $headers at this point:
|
283 |
+
foreach ($headers AS $k => $header) {
|
284 |
+
if (preg_match('/Content-Length:\s*(\d+)/i', $header, $m)) {
|
285 |
+
if (is_resource($body)) {
|
286 |
+
$this->_config['curloptions'][CURLOPT_INFILESIZE] = (int)$m[1];
|
287 |
+
}
|
288 |
+
unset($headers[$k]);
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
if (!isset($this->_config['curloptions'][CURLOPT_INFILESIZE])) {
|
293 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
294 |
+
throw new Zend_Http_Client_Adapter_Exception("Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.");
|
295 |
+
}
|
296 |
+
|
297 |
+
if (is_resource($body)) {
|
298 |
+
$body = '';
|
299 |
+
}
|
300 |
+
|
301 |
+
$curlMethod = CURLOPT_PUT;
|
302 |
+
} else {
|
303 |
+
$curlMethod = CURLOPT_CUSTOMREQUEST;
|
304 |
+
$curlValue = "PUT";
|
305 |
+
}
|
306 |
+
break;
|
307 |
+
|
308 |
+
case Zend_Http_Client::DELETE:
|
309 |
+
$curlMethod = CURLOPT_CUSTOMREQUEST;
|
310 |
+
$curlValue = "DELETE";
|
311 |
+
break;
|
312 |
+
|
313 |
+
case Zend_Http_Client::OPTIONS:
|
314 |
+
$curlMethod = CURLOPT_CUSTOMREQUEST;
|
315 |
+
$curlValue = "OPTIONS";
|
316 |
+
break;
|
317 |
+
|
318 |
+
case Zend_Http_Client::TRACE:
|
319 |
+
$curlMethod = CURLOPT_CUSTOMREQUEST;
|
320 |
+
$curlValue = "TRACE";
|
321 |
+
break;
|
322 |
+
|
323 |
+
case Zend_Http_Client::HEAD:
|
324 |
+
$curlMethod = CURLOPT_CUSTOMREQUEST;
|
325 |
+
$curlValue = "HEAD";
|
326 |
+
break;
|
327 |
+
|
328 |
+
default:
|
329 |
+
// For now, through an exception for unsupported request methods
|
330 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
331 |
+
throw new Zend_Http_Client_Adapter_Exception("Method currently not supported");
|
332 |
+
}
|
333 |
+
|
334 |
+
if (is_resource($body) && $curlMethod != CURLOPT_PUT) {
|
335 |
+
#require_once 'Zend/Http/Client/Adapter/Exception.php';
|
336 |
+
throw new Zend_Http_Client_Adapter_Exception("Streaming requests are allowed only with PUT");
|
337 |
+
}
|
338 |
+
|
339 |
+
// get http version to use
|
340 |
+
$curlHttp = ($httpVersion == 1.1) ? CURL_HTTP_VERSION_1_1 : CURL_HTTP_VERSION_1_0;
|
341 |
+
|
342 |
+
// mark as HTTP request and set HTTP method
|
343 |
+
curl_setopt($this->_curl, $curlHttp, true);
|
344 |
+
curl_setopt($this->_curl, $curlMethod, $curlValue);
|
345 |
+
|
346 |
+
if ($this->out_stream) {
|
347 |
+
// headers will be read into the response
|
348 |
+
curl_setopt($this->_curl, CURLOPT_HEADER, false);
|
349 |
+
curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, array($this, "readHeader"));
|
350 |
+
// and data will be written into the file
|
351 |
+
curl_setopt($this->_curl, CURLOPT_FILE, $this->out_stream);
|
352 |
+
} else {
|
353 |
+
// ensure headers are also returned
|
354 |
+
curl_setopt($this->_curl, CURLOPT_HEADER, true);
|
355 |
+
|
356 |
+
// ensure actual response is returned
|
357 |
+
curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true);
|
358 |
+
}
|
359 |
+
|
360 |
+
// set additional headers
|
361 |
+
$headers['Accept'] = '';
|
362 |
+
curl_setopt($this->_curl, CURLOPT_HTTPHEADER, $headers);
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Make sure POSTFIELDS is set after $curlMethod is set:
|
366 |
+
* @link http://de2.php.net/manual/en/function.curl-setopt.php#81161
|
367 |
+
*/
|
368 |
+
if ($method == Zend_Http_Client::POST) {
|
369 |
+
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body);
|
370 |
+
} elseif ($curlMethod == CURLOPT_PUT) {
|
371 |
+
// this covers a PUT by file-handle:
|
372 |
+
// Make the setting of this options explicit (rather than setting it through the loop following a bit lower)
|
373 |
+
// to group common functionality together.
|
374 |
+
curl_setopt($this->_curl, CURLOPT_INFILE, $this->_config['curloptions'][CURLOPT_INFILE]);
|
375 |
+
curl_setopt($this->_curl, CURLOPT_INFILESIZE, $this->_config['curloptions'][CURLOPT_INFILESIZE]);
|
376 |
+
unset($this->_config['curloptions'][CURLOPT_INFILE]);
|
377 |
+
unset($this->_config['curloptions'][CURLOPT_INFILESIZE]);
|
378 |
+
} elseif ($method == Zend_Http_Client::PUT) {
|
379 |
+
// This is a PUT by a setRawData string, not by file-handle
|
380 |
+
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body);
|
381 |
+
}
|
382 |
+
|
383 |
+
// set additional curl options
|
384 |
+
if (isset($this->_config['curloptions'])) {
|
385 |
+
foreach ((array)$this->_config['curloptions'] as $k => $v) {
|
386 |
+
if (!in_array($k, $this->_invalidOverwritableCurlOptions)) {
|
387 |
+
if (curl_setopt($this->_curl, $k, $v) == false) {
|
388 |
+
#require_once 'Zend/Http/Client/Exception.php';
|
389 |
+
throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k));
|
390 |
+
}
|
391 |
+
}
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
// send the request
|
396 |
+
$response = curl_exec($this->_curl);
|
397 |
+
|
398 |
+
// if we used streaming, headers are already there
|
399 |
+
if (!is_resource($this->out_stream)) {
|
400 |
+
$this->_response = $response;
|
401 |
+
}
|
402 |
+
|
403 |
+
$request = curl_getinfo($this->_curl, CURLINFO_HEADER_OUT);
|
404 |
+
$request .= $body;
|
405 |
+
|
406 |
+
if (empty($this->_response)) {
|
407 |
+
#require_once 'Zend/Http/Client/Exception.php';
|
408 |
+
throw new Zend_Http_Client_Exception("Error in cURL request: " . curl_error($this->_curl));
|
409 |
+
}
|
410 |
+
|
411 |
+
// cURL automatically decodes chunked-messages, this means we have to disallow the Zend_Http_Response to do it again
|
412 |
+
if (stripos($this->_response, "Transfer-Encoding: chunked\r\n")) {
|
413 |
+
$this->_response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $this->_response);
|
414 |
+
}
|
415 |
+
|
416 |
+
// Eliminate multiple HTTP responses.
|
417 |
+
do {
|
418 |
+
$parts = preg_split('|(?:\r?\n){2}|m', $this->_response, 2);
|
419 |
+
$again = false;
|
420 |
+
|
421 |
+
if (isset($parts[1]) && preg_match("|^HTTP/1\.[01](.*?)\r\n|mi", $parts[1])) {
|
422 |
+
$this->_response = $parts[1];
|
423 |
+
$again = true;
|
424 |
+
}
|
425 |
+
} while ($again);
|
426 |
+
|
427 |
+
// cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string:
|
428 |
+
if (stripos($this->_response, "HTTP/1.0 200 Connection established\r\n\r\n") !== false) {
|
429 |
+
$this->_response = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $this->_response);
|
430 |
+
}
|
431 |
+
|
432 |
+
return $request;
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Return read response from server
|
437 |
+
*
|
438 |
+
* @return string
|
439 |
+
*/
|
440 |
+
public function read()
|
441 |
+
{
|
442 |
+
return $this->_response;
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Close the connection to the server
|
447 |
+
*
|
448 |
+
*/
|
449 |
+
public function close()
|
450 |
+
{
|
451 |
+
if (is_resource($this->_curl)) {
|
452 |
+
curl_close($this->_curl);
|
453 |
+
}
|
454 |
+
$this->_curl = null;
|
455 |
+
$this->_connected_to = array(null, null);
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Get cUrl Handle
|
460 |
+
*
|
461 |
+
* @return resource
|
462 |
+
*/
|
463 |
+
public function getHandle()
|
464 |
+
{
|
465 |
+
return $this->_curl;
|
466 |
+
}
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Set output stream for the response
|
470 |
+
*
|
471 |
+
* @param resource $stream
|
472 |
+
* @return Zend_Http_Client_Adapter_Socket
|
473 |
+
*/
|
474 |
+
public function setOutputStream($stream)
|
475 |
+
{
|
476 |
+
$this->out_stream = $stream;
|
477 |
+
return $this;
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Header reader function for CURL
|
482 |
+
*
|
483 |
+
* @param resource $curl
|
484 |
+
* @param string $header
|
485 |
+
* @return int
|
486 |
+
*/
|
487 |
+
public function readHeader($curl, $header)
|
488 |
+
{
|
489 |
+
$this->_response .= $header;
|
490 |
+
return strlen($header);
|
491 |
+
}
|
492 |
+
|
493 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Api/Http/Client/Adapter/Stream.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* An interface description for Zend_Http_Client_Adapter_Stream classes.
|
20 |
+
*
|
21 |
+
* This interface decribes Zend_Http_Client_Adapter which supports streaming.
|
22 |
+
*/
|
23 |
+
interface Quadra_Be2bill_Model_Api_Http_Client_Adapter_Stream
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Set output stream
|
28 |
+
*
|
29 |
+
* This function sets output stream where the result will be stored.
|
30 |
+
*
|
31 |
+
* @param resource $stream Stream to write the output to
|
32 |
+
*
|
33 |
+
*/
|
34 |
+
function setOutputStream($stream);
|
35 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Api/Methods.php
ADDED
@@ -0,0 +1,446 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Api_Methods extends Mage_Core_Model_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
const TYPE_DEFERED = 'defered';
|
24 |
+
const TYPE_DELIVERY = 'delivery';
|
25 |
+
const TYPE_ONECLICK = 'oneclick';
|
26 |
+
const TYPE_ONECLICKCVV = 'oneclickcvv';
|
27 |
+
const TYPE_NTIMES = 'ntimes';
|
28 |
+
const TYPE_AGEVERIFICATION = 'ageverification';
|
29 |
+
const TYPE_DISPLAYCREATEALIAS = 'displaycreatealias';
|
30 |
+
const TYPE_3DSECURE = '3dsecure';
|
31 |
+
const TYPE_REFUND = 'refund';
|
32 |
+
const TYPE_REFUND_PARTIAL = 'partial_refund';
|
33 |
+
|
34 |
+
protected $_b2bXmlModesLang;
|
35 |
+
protected $_b2bXmlOperationLang;
|
36 |
+
protected $_b2bXmlOptions;
|
37 |
+
protected $_b2bXmlOptionsLang;
|
38 |
+
protected $_b2bXmlAccountTypes;
|
39 |
+
protected $_b2bXmlAccountTypeLang;
|
40 |
+
protected $_b2bXmlAccountTypeCurrency;
|
41 |
+
protected $_b2bXmlAccountTypeParameterSet;
|
42 |
+
protected $_b2bXmlAccountTypeParameterSetCountries;
|
43 |
+
protected $_b2bXmlAccountTypeParameterSetMode;
|
44 |
+
protected $_b2bXmlAccountTypeParameterSetOperation;
|
45 |
+
protected $_b2bXmlAccountTypeParameterSetParameters;
|
46 |
+
protected $_b2bXmlAccountTypeParameterSetOptions;
|
47 |
+
protected $_b2bMerchandConfigurationAccount;
|
48 |
+
protected $_b2bMerchandConfigurationAccountOptions;
|
49 |
+
protected $_b2bMerchandConfigurationAccountCountries;
|
50 |
+
protected $_resource;
|
51 |
+
protected $_readConnection;
|
52 |
+
|
53 |
+
protected function _construct()
|
54 |
+
{
|
55 |
+
parent::_construct();
|
56 |
+
$this->_init('be2bill/api_methods');
|
57 |
+
|
58 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
59 |
+
$this->_readConnection = $this->_resource->getConnection('core_read');
|
60 |
+
|
61 |
+
$this->_b2bXmlModesLang = $this->_resource->getTableName('b2b_xml_modes_lang');
|
62 |
+
$this->_b2bXmlOperationLang = $this->_resource->getTableName('b2b_xml_operation_lang');
|
63 |
+
$this->_b2bXmlOptions = $this->_resource->getTableName('b2b_xml_options');
|
64 |
+
$this->_b2bXmlOptionsLang = $this->_resource->getTableName('b2b_xml_options_lang');
|
65 |
+
$this->_b2bXmlAccountTypes = $this->_resource->getTableName('b2b_xml_account_types');
|
66 |
+
$this->_b2bXmlAccountTypeLang = $this->_resource->getTableName('b2b_xml_account_type_lang');
|
67 |
+
$this->_b2bXmlAccountTypeCurrency = $this->_resource->getTableName('b2b_xml_account_type_currency');
|
68 |
+
$this->_b2bXmlAccountTypeParameterSet = $this->_resource->getTableName('b2b_xml_account_type_parameter_set');
|
69 |
+
$this->_b2bXmlAccountTypeParameterSetCountries = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_countries');
|
70 |
+
$this->_b2bXmlAccountTypeParameterSetMode = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_mode');
|
71 |
+
$this->_b2bXmlAccountTypeParameterSetOperation = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_operation');
|
72 |
+
$this->_b2bXmlAccountTypeParameterSetParameters = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_parameters');
|
73 |
+
$this->_b2bXmlAccountTypeParameterSetOptions = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_options');
|
74 |
+
$this->_b2bMerchandConfigurationAccount = $this->_resource->getTableName('b2b_merchand_configuration_account');
|
75 |
+
$this->_b2bMerchandConfigurationAccountOptions = $this->_resource->getTableName('b2b_merchand_configuration_account_options');
|
76 |
+
$this->_b2bMerchandConfigurationAccountCountries = $this->_resource->getTableName('b2b_merchand_configuration_account_countries');
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Check if account type can do refund operation
|
81 |
+
*
|
82 |
+
* @return array if true
|
83 |
+
*/
|
84 |
+
public function hasRefund($accountTypeCode)
|
85 |
+
{
|
86 |
+
if ($accountTypeCode) {
|
87 |
+
$sql = '
|
88 |
+
SELECT b2b_xml_operation_code
|
89 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
90 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetOperation . '` ao
|
91 |
+
ON ao.`id_b2b_xml_account_type_parameter_set` = ap.`id_b2b_xml_account_type_parameter_set`
|
92 |
+
WHERE b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
93 |
+
AND ao.b2b_xml_operation_code = "' . self::TYPE_REFUND . '"';
|
94 |
+
|
95 |
+
return $this->_readConnection->fetchAll($sql);
|
96 |
+
}
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Check if account type can do refund operation
|
102 |
+
*
|
103 |
+
* @return array if true
|
104 |
+
*/
|
105 |
+
public function hasRefundPartial($accountTypeCode)
|
106 |
+
{
|
107 |
+
if ($accountTypeCode) {
|
108 |
+
$sql = '
|
109 |
+
SELECT b2b_xml_operation_code
|
110 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
111 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetOperation . '` ao
|
112 |
+
ON ao.`id_b2b_xml_account_type_parameter_set` = ap.`id_b2b_xml_account_type_parameter_set`
|
113 |
+
WHERE b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
114 |
+
AND ao.b2b_xml_operation_code = "' . self::TYPE_REFUND_PARTIAL . '"';
|
115 |
+
|
116 |
+
return $this->_readConnection->fetchAll($sql);
|
117 |
+
}
|
118 |
+
return false;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Get all available account type for a currency
|
123 |
+
*
|
124 |
+
* @param string $currencyIso Currency iso
|
125 |
+
* @return array Account type list
|
126 |
+
*/
|
127 |
+
public function getAvailableAcountTypeByCurrency($currencyIso)
|
128 |
+
{
|
129 |
+
if ($currencyIso) {
|
130 |
+
|
131 |
+
$langIso = substr(Mage::app()->getLocale()->getLocaleCode(), 3, 4);
|
132 |
+
|
133 |
+
$sql = '
|
134 |
+
SELECT ac.b2b_xml_account_type_code as value , acl.account_type_lang_name as label
|
135 |
+
FROM `' . $this->_b2bXmlAccountTypeCurrency . '` ac
|
136 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeLang . '` acl ON acl.b2b_xml_account_type_code = ac.b2b_xml_account_type_code
|
137 |
+
WHERE ac.currency_iso IN ("' . $currencyIso . '", "all")
|
138 |
+
AND (acl.lang_iso = "' . strtolower($langIso) . '" OR acl.lang_iso = "en")
|
139 |
+
GROUP BY ac.b2b_xml_account_type_code';
|
140 |
+
|
141 |
+
return $this->_readConnection->fetchAll($sql);
|
142 |
+
}
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Get all available Modes type for a account Type Code
|
148 |
+
*
|
149 |
+
* @param string $accountTypeCode
|
150 |
+
* @return array Modes type list
|
151 |
+
*/
|
152 |
+
public function getAvailableModesByAccountType($accountTypeCode)
|
153 |
+
{
|
154 |
+
if ($accountTypeCode) {
|
155 |
+
|
156 |
+
$langIso = substr(Mage::app()->getLocale()->getLocaleCode(), 3, 4);
|
157 |
+
|
158 |
+
$sql = '
|
159 |
+
SELECT apm.b2b_xml_mode_code as id , apm.b2b_xml_mode_code as value, aml.mode_lang_name as label
|
160 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
161 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetMode . '` apm
|
162 |
+
ON apm.id_b2b_xml_account_type_parameter_set = ap.id_b2b_xml_account_type_parameter_set
|
163 |
+
LEFT JOIN `' . $this->_b2bXmlModesLang . '` aml
|
164 |
+
ON aml.b2b_xml_mode_code = apm.b2b_xml_mode_code
|
165 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetOperation . '` apo
|
166 |
+
ON apo.id_b2b_xml_account_type_parameter_set = ap.id_b2b_xml_account_type_parameter_set
|
167 |
+
WHERE ap.b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
168 |
+
AND (aml.lang_iso = "' . $langIso . '" OR aml.lang_iso = "en")
|
169 |
+
AND apo.b2b_xml_operation_code IN ("payment" , "authorization")
|
170 |
+
GROUP BY apm.b2b_xml_mode_code
|
171 |
+
ORDER BY aml.mode_lang_name';
|
172 |
+
|
173 |
+
return $this->_readConnection->fetchAll($sql);
|
174 |
+
}
|
175 |
+
return false;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Get all available Options type for a account Type Code
|
180 |
+
*
|
181 |
+
* @param string $accountTypeCode
|
182 |
+
* @return array Options type list
|
183 |
+
*/
|
184 |
+
public function getAvailableOptionsByAccountType($accountTypeCode)
|
185 |
+
{
|
186 |
+
if ($accountTypeCode) {
|
187 |
+
$sql = '
|
188 |
+
SELECT apo.b2b_xml_option as `option`
|
189 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
190 |
+
INNER JOIN `' . $this->_b2bXmlAccountTypeParameterSetOptions . '` apo
|
191 |
+
ON apo.id_b2b_xml_account_type_parameter_set = ap.id_b2b_xml_account_type_parameter_set
|
192 |
+
WHERE ap.b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
193 |
+
GROUP BY apo.b2b_xml_option';
|
194 |
+
|
195 |
+
return $this->_readConnection->fetchAll($sql);
|
196 |
+
}
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Paiement différé possible ?
|
202 |
+
*
|
203 |
+
* @param string $accountTypeCode
|
204 |
+
* @return array sql result
|
205 |
+
*/
|
206 |
+
public function hasDefered($accountTypeCode)
|
207 |
+
{
|
208 |
+
if ($accountTypeCode) {
|
209 |
+
$sql = '
|
210 |
+
SELECT b2b_xml_operation_code
|
211 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
212 |
+
INNER JOIN `' . $this->_b2bXmlAccountTypeParameterSetOperation . '` ao
|
213 |
+
ON ao.`id_b2b_xml_account_type_parameter_set` = ap.`id_b2b_xml_account_type_parameter_set`
|
214 |
+
AND ao.b2b_xml_operation_code = "authorization"
|
215 |
+
WHERE b2b_xml_account_type_code = "' . $accountTypeCode . '"';
|
216 |
+
|
217 |
+
return $this->_readConnection->fetchAll($sql);
|
218 |
+
}
|
219 |
+
return false;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Paiement standard possible ?
|
224 |
+
*
|
225 |
+
* @param string $accountTypeCode
|
226 |
+
* @return array sql result
|
227 |
+
*/
|
228 |
+
public function hasStandard($accountTypeCode)
|
229 |
+
{
|
230 |
+
if ($accountTypeCode) {
|
231 |
+
$sql = '
|
232 |
+
SELECT b2b_xml_operation_code
|
233 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
234 |
+
INNER JOIN `' . $this->_b2bXmlAccountTypeParameterSetOperation . '` ao
|
235 |
+
ON ao.`id_b2b_xml_account_type_parameter_set` = ap.`id_b2b_xml_account_type_parameter_set`
|
236 |
+
AND ao.b2b_xml_operation_code = "payment"
|
237 |
+
WHERE b2b_xml_account_type_code = "' . $accountTypeCode . '"';
|
238 |
+
|
239 |
+
return $this->_readConnection->fetchAll($sql);
|
240 |
+
}
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* A t-il aucune restriction sur les pays de facturation ?
|
246 |
+
*
|
247 |
+
* @param string $accountTypeCode
|
248 |
+
* @return array list country iso
|
249 |
+
*/
|
250 |
+
public function hasNotCountriesRestriction($accountTypeCode)
|
251 |
+
{
|
252 |
+
if ($accountTypeCode) {
|
253 |
+
$sql = '
|
254 |
+
SELECT country_iso
|
255 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
256 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetCountries . '` ac
|
257 |
+
ON ac.`id_b2b_xml_account_type_parameter_set` = ap.`id_b2b_xml_account_type_parameter_set`
|
258 |
+
WHERE b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
259 |
+
AND ac.country_iso = "al"
|
260 |
+
GROUP BY country_iso';
|
261 |
+
|
262 |
+
return $this->_readConnection->fetchAll($sql);
|
263 |
+
}
|
264 |
+
return false;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Retourne une liste de pays en fonction du code du type de compte
|
269 |
+
*
|
270 |
+
* @param string $accountTypeCode
|
271 |
+
* @return array list country iso
|
272 |
+
*/
|
273 |
+
public function getCountriesRestriction($accountTypeCode)
|
274 |
+
{
|
275 |
+
if ($accountTypeCode) {
|
276 |
+
$sql = '
|
277 |
+
SELECT ac.country_iso as label
|
278 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ap
|
279 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetCountries . '` ac
|
280 |
+
ON ac.`id_b2b_xml_account_type_parameter_set` = ap.`id_b2b_xml_account_type_parameter_set`
|
281 |
+
WHERE ap.b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
282 |
+
AND ac.country_iso <> "al"
|
283 |
+
GROUP BY ac.country_iso';
|
284 |
+
|
285 |
+
return $this->_readConnection->fetchAll($sql);
|
286 |
+
}
|
287 |
+
return false;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Retourne l'url du logo par défaut du xml
|
292 |
+
*
|
293 |
+
* @param string $accountTypeCode
|
294 |
+
* @return array result sql
|
295 |
+
*/
|
296 |
+
public function getLogoUrl($accountTypeCode)
|
297 |
+
{
|
298 |
+
if ($accountTypeCode) {
|
299 |
+
$sql = '
|
300 |
+
SELECT b2b_xml_account_type_logo
|
301 |
+
FROM `' . $this->_b2bXmlAccountTypes . '`
|
302 |
+
WHERE b2b_xml_account_type_code = "' . $accountTypeCode . '"';
|
303 |
+
|
304 |
+
return $this->_readConnection->fetchOne($sql);
|
305 |
+
}
|
306 |
+
return false;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Retourne les paramètres du compte et du type d'operation
|
311 |
+
*
|
312 |
+
* @param string $accountTypeCode
|
313 |
+
* @return array result sql
|
314 |
+
*/
|
315 |
+
public function getAccountTypeParameters($accountTypeCode, $operation = 'payment' , $countryId)
|
316 |
+
{
|
317 |
+
if ($accountTypeCode) {
|
318 |
+
$sql = '
|
319 |
+
SELECT psp.*,ps.b2b_xml_account_type_parameter_set_version
|
320 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ps
|
321 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetOperation . '` pso
|
322 |
+
ON ps.id_b2b_xml_account_type_parameter_set = pso.id_b2b_xml_account_type_parameter_set
|
323 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetParameters . '` psp
|
324 |
+
ON psp.id_b2b_xml_account_type_parameter_set = ps.id_b2b_xml_account_type_parameter_set
|
325 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetCountries . '` psc
|
326 |
+
ON psc.id_b2b_xml_account_type_parameter_set = ps.id_b2b_xml_account_type_parameter_set
|
327 |
+
WHERE ps.b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
328 |
+
AND pso.b2b_xml_operation_code = "' . $operation . '"
|
329 |
+
AND ( psc.country_iso = "'.$countryId.'" OR psc.country_iso = "al" )
|
330 |
+
';
|
331 |
+
|
332 |
+
return $this->_readConnection->fetchAll($sql);
|
333 |
+
}
|
334 |
+
return false;
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Est ce que le compte possède le parametre identificationdocid ?
|
339 |
+
*
|
340 |
+
* @param string $accountTypeCode
|
341 |
+
* @param string $operation
|
342 |
+
* @param string $countryId
|
343 |
+
* @return boolean
|
344 |
+
*/
|
345 |
+
public function hasIdenDocId($accountTypeCode, $operation, $countryId)
|
346 |
+
{
|
347 |
+
$name = 'IDENTIFICATIONDOCID';
|
348 |
+
$sql = '
|
349 |
+
SELECT psp.id_b2b_xml_account_type_parameter_set
|
350 |
+
FROM `' . $this->_b2bXmlAccountTypeParameterSet . '` ps
|
351 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetOperation . '` pso
|
352 |
+
ON ps.id_b2b_xml_account_type_parameter_set = pso.id_b2b_xml_account_type_parameter_set
|
353 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetParameters . '` psp
|
354 |
+
ON psp.id_b2b_xml_account_type_parameter_set = ps.id_b2b_xml_account_type_parameter_set
|
355 |
+
LEFT JOIN `' . $this->_b2bXmlAccountTypeParameterSetCountries . '` psc
|
356 |
+
ON psc.id_b2b_xml_account_type_parameter_set = ps.id_b2b_xml_account_type_parameter_set
|
357 |
+
WHERE ps.b2b_xml_account_type_code = "' . $accountTypeCode . '"
|
358 |
+
AND pso.b2b_xml_operation_code = "' . $operation . '"
|
359 |
+
AND ( psc.country_iso = "'.$countryId.'" OR psc.country_iso = "al" )
|
360 |
+
AND psp.b2b_xml_parameter_name = "'.$name.'"
|
361 |
+
';
|
362 |
+
|
363 |
+
return $this->_readConnection->fetchOne($sql);
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Retourne les paramètres de l'option
|
368 |
+
*
|
369 |
+
* @param string $codeOption
|
370 |
+
* @return array result sql
|
371 |
+
*/
|
372 |
+
public function getOptionParameters($codeOption)
|
373 |
+
{
|
374 |
+
if ($codeOption) {
|
375 |
+
$sql = '
|
376 |
+
SELECT *
|
377 |
+
FROM `' . $this->_b2bXmlOptions . '`
|
378 |
+
WHERE b2b_xml_option_code = "' . $codeOption . '"';
|
379 |
+
|
380 |
+
return $this->_readConnection->fetchAll($sql);
|
381 |
+
}
|
382 |
+
return false;
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Get Extra Option by Account id
|
387 |
+
*
|
388 |
+
* @param int $idAccount
|
389 |
+
* @return array result sql
|
390 |
+
*/
|
391 |
+
public function getExtraOptions($idAccount)
|
392 |
+
{
|
393 |
+
if ($idAccount) {
|
394 |
+
$sql = '
|
395 |
+
SELECT *
|
396 |
+
FROM `' . $this->_b2bMerchandConfigurationAccountOptions . '`
|
397 |
+
WHERE active in (1,2) AND b2b_xml_option IN("' . self::TYPE_3DSECURE . '","' . self::TYPE_AGEVERIFICATION . '","' . self::TYPE_DISPLAYCREATEALIAS . '")
|
398 |
+
AND id_b2b_merchand_configuration_account = ' . (int)$idAccount;
|
399 |
+
|
400 |
+
return $this->_readConnection->fetchAll($sql);
|
401 |
+
}
|
402 |
+
return false;
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Get Extra Option for Mirakl by Account id
|
407 |
+
*
|
408 |
+
* @param int $idAccount
|
409 |
+
* @return array result sql
|
410 |
+
*/
|
411 |
+
public function getMiraklExtraOptions($idAccount)
|
412 |
+
{
|
413 |
+
if ($idAccount) {
|
414 |
+
$sql = '
|
415 |
+
SELECT *
|
416 |
+
FROM `' . $this->_b2bMerchandConfigurationAccountOptions . '`
|
417 |
+
WHERE active in (1,2) AND b2b_xml_option IN("' . self::TYPE_DELIVERY . '")
|
418 |
+
AND id_b2b_merchand_configuration_account = ' . (int)$idAccount;
|
419 |
+
|
420 |
+
return $this->_readConnection->fetchAll($sql);
|
421 |
+
}
|
422 |
+
return false;
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Get Label Mode by Code and lang iso
|
427 |
+
*
|
428 |
+
* @param string $code
|
429 |
+
* @param string $langIso
|
430 |
+
* @return boolean false || array result sql
|
431 |
+
*/
|
432 |
+
public function getModeLangByCodeIso($code, $langIso)
|
433 |
+
{
|
434 |
+
if ($code) {
|
435 |
+
$sql = '
|
436 |
+
SELECT `mode_lang_name`, `lang_iso`
|
437 |
+
FROM `' . $this->_b2bXmlModesLang . '`
|
438 |
+
WHERE ( lang_iso = "' . $langIso . '" OR lang_iso = "en" )
|
439 |
+
AND b2b_xml_mode_code = "' . $code . '"';
|
440 |
+
|
441 |
+
return $this->_readConnection->fetchAll($sql);
|
442 |
+
}
|
443 |
+
return false;
|
444 |
+
}
|
445 |
+
|
446 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Api/Response.php
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_Model_Api_Response extends Varien_Object
|
18 |
+
{
|
19 |
+
|
20 |
+
protected $_codeToMessages = array();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Overwrite data in the object.
|
24 |
+
*
|
25 |
+
* $key can be string or array.
|
26 |
+
* If $key is string, the attribute value will be overwritten by $value
|
27 |
+
*
|
28 |
+
* If $key is an array, it will overwrite all the data in the object.
|
29 |
+
*
|
30 |
+
* @param string|array $key
|
31 |
+
* @param mixed $value
|
32 |
+
* @return Varien_Object
|
33 |
+
*/
|
34 |
+
public function setData($key, $value = null)
|
35 |
+
{
|
36 |
+
$data = $key;
|
37 |
+
if (is_array($key)) {
|
38 |
+
$data = array();
|
39 |
+
foreach ($key as $oldKey => $value) {
|
40 |
+
$newKey = strtolower($oldKey);
|
41 |
+
$data[$newKey] = $value;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
return parent::setData($data, $value);
|
46 |
+
}
|
47 |
+
|
48 |
+
public function isSuccess()
|
49 |
+
{
|
50 |
+
return $this->getExecCode() == "0000";
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getExecCode()
|
54 |
+
{
|
55 |
+
return $this->getData('execcode');
|
56 |
+
}
|
57 |
+
|
58 |
+
public function getCodeToMessage($execode)
|
59 |
+
{
|
60 |
+
if (!count($this->_codeToMessages)) {
|
61 |
+
$this->_codeToMessages = array(
|
62 |
+
4001 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
63 |
+
4002 => Mage::helper('be2bill')->__("Fonds insuffisants ou plafond de paiement atteint"),
|
64 |
+
4003 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
65 |
+
4004 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
66 |
+
4005 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
67 |
+
4006 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
68 |
+
4007 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
69 |
+
4008 => Mage::helper('be2bill')->__("Authentification 3DSecure échouée"),
|
70 |
+
4009 => Mage::helper('be2bill')->__("Authentification 3DSecure expirée"),
|
71 |
+
4010 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
72 |
+
4011 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
73 |
+
4012 => Mage::helper('be2bill')->__("Données de carte invalides"),
|
74 |
+
4013 => Mage::helper('be2bill')->__("Transaction refusée par votre banque"),
|
75 |
+
5001 => Mage::helper('be2bill')->__("Paiement échoué"),
|
76 |
+
5002 => Mage::helper('be2bill')->__("Paiement échoué"),
|
77 |
+
5003 => Mage::helper('be2bill')->__("Paiement échoué"),
|
78 |
+
5004 => Mage::helper('be2bill')->__("Paiement échoué"),
|
79 |
+
5005 => Mage::helper('be2bill')->__("Paiement échoué"),
|
80 |
+
6001 => Mage::helper('be2bill')->__("Transaction refusée par le marchand"),
|
81 |
+
6002 => Mage::helper('be2bill')->__("Transaction refusée par le marchand"),
|
82 |
+
6003 => Mage::helper('be2bill')->__("Transaction refusée par le marchand"),
|
83 |
+
6004 => Mage::helper('be2bill')->__("Transaction refusée par le marchand")
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
$message = trim(Mage::getStoreConfig('be2bill/be2bill_errors/error_' . $execode));
|
88 |
+
if (strlen($message)) {
|
89 |
+
return $message;
|
90 |
+
} elseif (isset($this->_codeToMessages[$execode])) {
|
91 |
+
return $this->_codeToMessages[$execode];
|
92 |
+
} else {
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
public function getMessage()
|
98 |
+
{
|
99 |
+
$execode = (int)$this->getExecCode();
|
100 |
+
if (!$message = $this->getCodeToMessage($execode)) {
|
101 |
+
$message = $this->getData('message');
|
102 |
+
}
|
103 |
+
|
104 |
+
return Mage::helper('be2bill')->__($message);
|
105 |
+
}
|
106 |
+
|
107 |
+
public function getIncrementId()
|
108 |
+
{
|
109 |
+
return $this->getData('orderid');
|
110 |
+
}
|
111 |
+
|
112 |
+
public function getTransactionId()
|
113 |
+
{
|
114 |
+
return $this->getData('transactionid');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function getCcLast4()
|
118 |
+
{
|
119 |
+
return substr($this->getData('cardcode'), strlen($this->getData('cardcode')) - 4);
|
120 |
+
}
|
121 |
+
|
122 |
+
public function getCcType()
|
123 |
+
{
|
124 |
+
return $this->getData('cardtype');
|
125 |
+
}
|
126 |
+
|
127 |
+
public function getCcValidityDate()
|
128 |
+
{
|
129 |
+
return $this->getData('cardvaliditydate');
|
130 |
+
}
|
131 |
+
|
132 |
+
public function getCcExpMonth()
|
133 |
+
{
|
134 |
+
if ($this->getCcValidityDate() == "") {
|
135 |
+
return "";
|
136 |
+
}
|
137 |
+
|
138 |
+
list($ccExpMonth, $ccExpYear) = explode("-", $this->getCcValidityDate());
|
139 |
+
return $ccExpMonth;
|
140 |
+
}
|
141 |
+
|
142 |
+
public function getCcExpYear()
|
143 |
+
{
|
144 |
+
if ($this->getCcValidityDate() == "") {
|
145 |
+
return "";
|
146 |
+
}
|
147 |
+
|
148 |
+
list($ccExpMonth, $ccExpYear) = explode("-", $this->getCcValidityDate());
|
149 |
+
return $ccExpYear;
|
150 |
+
}
|
151 |
+
|
152 |
+
public function getCcOwner()
|
153 |
+
{
|
154 |
+
return $this->getData('cardfullname');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function getCcStatusDescription()
|
158 |
+
{
|
159 |
+
return $this->getData('descriptor');
|
160 |
+
}
|
161 |
+
|
162 |
+
public function getCcNumberEnc()
|
163 |
+
{
|
164 |
+
return $this->getData('cardcode');
|
165 |
+
}
|
166 |
+
|
167 |
+
public function getOperationType()
|
168 |
+
{
|
169 |
+
return $this->getData('operationtype');
|
170 |
+
}
|
171 |
+
|
172 |
+
public function getAlias()
|
173 |
+
{
|
174 |
+
return $this->getData('alias');
|
175 |
+
}
|
176 |
+
|
177 |
+
public function getExtradata()
|
178 |
+
{
|
179 |
+
return $this->getData('extradata');
|
180 |
+
}
|
181 |
+
|
182 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Api/Service.php
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Api_Service
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var Quadra_Be2bill_Model_Abstract
|
25 |
+
*/
|
26 |
+
protected $_methodInstance = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* @var Zend_Http_Client
|
31 |
+
*/
|
32 |
+
protected $_client = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
protected $_codeErrorToRetry = array();
|
39 |
+
|
40 |
+
public function __construct($args)
|
41 |
+
{
|
42 |
+
$this->_methodInstance = $args['methodInstance'];
|
43 |
+
$this->_codeErrorToRetry = array('5001', '5003');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return Quadra_Be2bill_Model_Abstract
|
48 |
+
*/
|
49 |
+
public function isTestMode()
|
50 |
+
{
|
51 |
+
return $this->getConfigData('test');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get client HTTP
|
56 |
+
* @return Zend_Http_Client
|
57 |
+
*/
|
58 |
+
public function getClient()
|
59 |
+
{
|
60 |
+
if (is_null($this->_client)) {
|
61 |
+
//adapter options
|
62 |
+
$config = array('curloptions' => array(
|
63 |
+
CURLOPT_SSL_VERIFYHOST => 0,
|
64 |
+
CURLOPT_SSL_VERIFYPEER => 0,
|
65 |
+
CURLOPT_HEADER => false,
|
66 |
+
CURLOPT_RETURNTRANSFER => true),
|
67 |
+
);
|
68 |
+
try {
|
69 |
+
//innitialize http client and adapter curl
|
70 |
+
$adapter = Mage::getSingleton('be2bill/api_http_client_adapter_curl');
|
71 |
+
;
|
72 |
+
$this->_client = new Zend_Http_Client();
|
73 |
+
$this->_client->setAdapter($adapter);
|
74 |
+
$adapter->setConfig($config);
|
75 |
+
} catch (Exception $e) {
|
76 |
+
Mage::throwException($e);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
return $this->_client;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Send a request to Be2bill
|
85 |
+
* @param string $methodToCall
|
86 |
+
* @param array $params
|
87 |
+
* @param string|null $uri
|
88 |
+
*
|
89 |
+
* @return Quadra_Be2bill_Model_Api_Response
|
90 |
+
*/
|
91 |
+
public function send($methodToCall, $params, $uri = null)
|
92 |
+
{
|
93 |
+
if (is_null($uri)) {
|
94 |
+
$uri[] = $this->getRestUrl();
|
95 |
+
$uri[] = $this->getRestUrlHighDispo();
|
96 |
+
} elseif (!is_array($uri)) {
|
97 |
+
$uri = array($uri);
|
98 |
+
}
|
99 |
+
$this->getClient()->setParameterPost('method', $methodToCall);
|
100 |
+
$this->getClient()->setParameterPost('params', $params);
|
101 |
+
foreach ($uri as $restUrl) {
|
102 |
+
$this->getClient()->setUri($restUrl);
|
103 |
+
$response = $this->getClient()->request(Zend_Http_Client::POST);
|
104 |
+
if ($response->getStatus() == 200) {
|
105 |
+
$data = json_decode($response->getBody(), true);
|
106 |
+
$response = Mage::getModel('be2bill/api_response')->setData($data);
|
107 |
+
if (!in_array($response->getExecCode(), $this->_codeErrorToRetry)) {
|
108 |
+
return $response;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
Mage::throwException(Mage::helper('be2bill')->__('Impossible de se connecter aux serveurs de Be2bill'));
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Genération du Hash de vérification Be2bill
|
118 |
+
*
|
119 |
+
* @param array $params
|
120 |
+
* @param string $password
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
public function generateHASH($params, $password, $paramsNoHash = null)
|
124 |
+
{
|
125 |
+
if ($paramsNoHash == null){
|
126 |
+
$paramsNoHash = array();
|
127 |
+
}
|
128 |
+
|
129 |
+
$pass = $password;
|
130 |
+
$finalString = $pass;
|
131 |
+
ksort($params);
|
132 |
+
foreach ($params as $key => $value) {
|
133 |
+
|
134 |
+
//si dans le tableau alors, on ne calcule pas le hash
|
135 |
+
if (in_array($key, $paramsNoHash)){
|
136 |
+
continue;
|
137 |
+
}
|
138 |
+
if (is_array($value)) {
|
139 |
+
ksort($value);
|
140 |
+
foreach ($value as $index => $val) {
|
141 |
+
if (is_array($val)){
|
142 |
+
ksort($val);
|
143 |
+
foreach ($val as $index2 => $val2) {
|
144 |
+
$finalString .= $key.'['.$index.']['.$index2.']='.$val2.$pass;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
else {
|
148 |
+
$finalString .= $key . '[' . $index . ']=' . $val . $pass;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
} else {
|
152 |
+
$finalString .= $key . "=" . $value . $pass;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
return hash('sha256', $finalString);
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Retourne L'url vers l'api Be2bill
|
161 |
+
* @param string $mode
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
public function getRedirectUrl($mode = null)
|
165 |
+
{
|
166 |
+
if ($mode == 'direct-submit') {
|
167 |
+
if ($this->isTestMode()) {
|
168 |
+
$url = $this->getConfigData('direct_submit_test');
|
169 |
+
} else {
|
170 |
+
$urls = array( 'main' => $this->getConfigData('direct_submit'), 'slave' => $this->getConfigData('direct_submit_high_dispo') );
|
171 |
+
}
|
172 |
+
} else {
|
173 |
+
if ($this->isTestMode()) {
|
174 |
+
$url = $this->getConfigData('uri_form_test');
|
175 |
+
} else {
|
176 |
+
$urls = array( 'main' => $this->getConfigData('uri_form'), 'slave' => $this->getConfigData('uri_form_high_dispo') );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
//test de disponibilité des urls
|
181 |
+
if (!$this->isTestMode()) {
|
182 |
+
$url = $this->_checkUrls($urls);
|
183 |
+
}
|
184 |
+
|
185 |
+
return $url;
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
protected function _checkUrls($urls)
|
190 |
+
{
|
191 |
+
$i = 0;
|
192 |
+
$rUrls = array();
|
193 |
+
foreach($urls as $type => $url) {
|
194 |
+
if($url == null || trim($url) == '')
|
195 |
+
continue;
|
196 |
+
|
197 |
+
$result = file_get_contents($url);
|
198 |
+
|
199 |
+
if ($result) {
|
200 |
+
$rUrls[$i] = $url;
|
201 |
+
$i++;
|
202 |
+
}
|
203 |
+
|
204 |
+
}
|
205 |
+
|
206 |
+
if(count($rUrls) == 0) {
|
207 |
+
return null;
|
208 |
+
}
|
209 |
+
else {
|
210 |
+
return $rUrls[0];
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
|
215 |
+
/**
|
216 |
+
*
|
217 |
+
* @return string
|
218 |
+
*/
|
219 |
+
public function getRestUrl()
|
220 |
+
{
|
221 |
+
if ($this->isTestMode()) {
|
222 |
+
return $this->getConfigData('uri_rest_test');
|
223 |
+
}
|
224 |
+
|
225 |
+
return $this->getConfigData('uri_rest');
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
*
|
230 |
+
* @return string
|
231 |
+
*/
|
232 |
+
public function getRestUrlHighDispo()
|
233 |
+
{
|
234 |
+
if ($this->isTestMode()) {
|
235 |
+
return $this->getConfigData('uri_rest_high_dispo_test');
|
236 |
+
}
|
237 |
+
|
238 |
+
return $this->getConfigData('uri_rest_high_dispo');
|
239 |
+
}
|
240 |
+
|
241 |
+
public function getConfigData($path, $storeId = null)
|
242 |
+
{
|
243 |
+
return Mage::getStoreConfig('be2bill/be2bill_api/' . $path, $storeId);
|
244 |
+
}
|
245 |
+
|
246 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Api/Xml.php
ADDED
@@ -0,0 +1,438 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Api_Xml extends Mage_Core_Model_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
const XML_B2B_DIR = 'be2bill';
|
24 |
+
const XML_FILE_NAME = 'dynamicPayments.xml';
|
25 |
+
const XML_PATH_ADMIN_BE2BILL_VERSION = 'be2bill/be2bill_api/version';
|
26 |
+
const XML_PATH_ADMIN_BE2BILL_URL_XML = 'be2bill/be2bill_api/url_xml';
|
27 |
+
|
28 |
+
protected $_b2bXmlModesLang;
|
29 |
+
protected $_b2bXmlOperationLang;
|
30 |
+
protected $_b2bXmlOptions;
|
31 |
+
protected $_b2bXmlOptionsLang;
|
32 |
+
protected $_b2bXmlAccountTypes;
|
33 |
+
protected $_b2bXmlAccountTypeLang;
|
34 |
+
protected $_b2bXmlAccountTypeCurrency;
|
35 |
+
protected $_b2bXmlAccountTypeParameterSet;
|
36 |
+
protected $_b2bXmlAccountTypeParameterSetCountries;
|
37 |
+
protected $_b2bXmlAccountTypeParameterSetMode;
|
38 |
+
protected $_b2bXmlAccountTypeParameterSetOperation;
|
39 |
+
protected $_b2bXmlAccountTypeParameterSetParameters;
|
40 |
+
protected $_b2bXmlAccountTypeParameterSetOptions;
|
41 |
+
protected $_b2bMerchandConfigurationAccount;
|
42 |
+
protected $_b2bMerchandConfigurationAccountOptions;
|
43 |
+
protected $_b2bMerchandConfigurationAccountCountries;
|
44 |
+
protected $_filePath;
|
45 |
+
protected $_resource;
|
46 |
+
protected $_writeConnection;
|
47 |
+
|
48 |
+
protected function _construct()
|
49 |
+
{
|
50 |
+
parent::_construct();
|
51 |
+
$this->_init('be2bill/api_xml');
|
52 |
+
|
53 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
54 |
+
$this->_writeConnection = $this->_resource->getConnection('core_write');
|
55 |
+
|
56 |
+
//$this->_filePath = Mage::getBaseDir('media') . DS . self::XML_B2B_DIR . DS . 'xml' . DS . self::XML_FILE_NAME ;
|
57 |
+
$this->_filePath = Mage::getStoreConfig(self::XML_PATH_ADMIN_BE2BILL_URL_XML);
|
58 |
+
|
59 |
+
$this->_b2bXmlModesLang = $this->_resource->getTableName('b2b_xml_modes_lang');
|
60 |
+
$this->_b2bXmlOperationLang = $this->_resource->getTableName('b2b_xml_operation_lang');
|
61 |
+
$this->_b2bXmlOptions = $this->_resource->getTableName('b2b_xml_options');
|
62 |
+
$this->_b2bXmlOptionsLang = $this->_resource->getTableName('b2b_xml_options_lang');
|
63 |
+
$this->_b2bXmlAccountTypes = $this->_resource->getTableName('b2b_xml_account_types');
|
64 |
+
$this->_b2bXmlAccountTypeLang = $this->_resource->getTableName('b2b_xml_account_type_lang');
|
65 |
+
$this->_b2bXmlAccountTypeCurrency = $this->_resource->getTableName('b2b_xml_account_type_currency');
|
66 |
+
$this->_b2bXmlAccountTypeParameterSet = $this->_resource->getTableName('b2b_xml_account_type_parameter_set');
|
67 |
+
$this->_b2bXmlAccountTypeParameterSetCountries = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_countries');
|
68 |
+
$this->_b2bXmlAccountTypeParameterSetMode = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_mode');
|
69 |
+
$this->_b2bXmlAccountTypeParameterSetOperation = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_operation');
|
70 |
+
$this->_b2bXmlAccountTypeParameterSetParameters = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_parameters');
|
71 |
+
$this->_b2bXmlAccountTypeParameterSetOptions = $this->_resource->getTableName('b2b_xml_account_type_parameter_set_options');
|
72 |
+
$this->_b2bMerchandConfigurationAccount = $this->_resource->getTableName('b2b_merchand_configuration_account');
|
73 |
+
$this->_b2bMerchandConfigurationAccountOptions = $this->_resource->getTableName('b2b_merchand_configuration_account_options');
|
74 |
+
$this->_b2bMerchandConfigurationAccountCountries = $this->_resource->getTableName('b2b_merchand_configuration_account_countries');
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Lecture et insertion du fichier XMl dans les tables Be2Bill de la BDD
|
79 |
+
* @return boolean
|
80 |
+
*/
|
81 |
+
public function insertXmlToDb()
|
82 |
+
{
|
83 |
+
$xml_payments = simplexml_load_file($this->_filePath);
|
84 |
+
if ($xml_payments != null) {
|
85 |
+
|
86 |
+
//Test Si l'Xml a déjà été traité
|
87 |
+
if (!$this->paymentsNeedUpgrade($xml_payments->version)) {
|
88 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('be2bill')->__("Xml déjà importé en version " . $xml_payments->version));
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
|
92 |
+
$this->resetBe2billXmlTables();
|
93 |
+
|
94 |
+
//Maj de la version du XML dans l'admin System > Configuration > Be2bill > Configuration gènérale > Information module > Version
|
95 |
+
Mage::getModel('core/config')->saveConfig(self::XML_PATH_ADMIN_BE2BILL_VERSION, $xml_payments->version);
|
96 |
+
|
97 |
+
$sql = 'SET FOREIGN_KEY_CHECKS=0;';
|
98 |
+
$this->_writeConnection->query($sql);
|
99 |
+
|
100 |
+
// installing modes
|
101 |
+
$modes = $xml_payments->modes;
|
102 |
+
foreach ($modes->mode as $mode) {
|
103 |
+
$code = $mode->code;
|
104 |
+
foreach ($mode->labels->children() as $label) {
|
105 |
+
$name = (string)$label;
|
106 |
+
$lang_iso = (string)$label['language'];
|
107 |
+
|
108 |
+
// insert in db for each language
|
109 |
+
$sql = '
|
110 |
+
INSERT INTO `' . $this->_b2bXmlModesLang . '`
|
111 |
+
(`b2b_xml_mode_code`,`lang_iso`,`mode_lang_name`)
|
112 |
+
VALUES ("' . $code . '","' . $lang_iso . '","' . $name . '")';
|
113 |
+
|
114 |
+
$this->_writeConnection->query($sql);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
// installing operations
|
119 |
+
$operations = $xml_payments->operations;
|
120 |
+
foreach ($operations->operation as $operation) {
|
121 |
+
$code = $operation->code;
|
122 |
+
foreach ($operation->labels->children() as $label) {
|
123 |
+
$name = (string)$label;
|
124 |
+
$lang_iso = (string)$label['language'];
|
125 |
+
|
126 |
+
// insert in db for each language
|
127 |
+
$sql = '
|
128 |
+
INSERT INTO `' . $this->_b2bXmlOperationLang . '`
|
129 |
+
(`b2b_xml_operation_code`,`lang_iso`,`operation_lang_name`)
|
130 |
+
VALUES ("' . $code . '","' . $lang_iso . '","' . $name . '")';
|
131 |
+
|
132 |
+
$this->_writeConnection->query($sql);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
// installing options
|
137 |
+
$options = $xml_payments->options;
|
138 |
+
foreach ($options->option as $option) {
|
139 |
+
$code = $option->code;
|
140 |
+
foreach ($option->labels->children() as $label) {
|
141 |
+
$name = (string)$label;
|
142 |
+
$lang_iso = (string)$label['language'];
|
143 |
+
|
144 |
+
// insert in db for each language
|
145 |
+
$sql = '
|
146 |
+
INSERT INTO `' . $this->_b2bXmlOptionsLang . '`
|
147 |
+
(`b2b_xml_option_code`,`lang_iso`,`option_lang_name`)
|
148 |
+
VALUES ("' . $code . '","' . $lang_iso . '","' . $name . '")';
|
149 |
+
|
150 |
+
$this->_writeConnection->query($sql);
|
151 |
+
}
|
152 |
+
|
153 |
+
// setting options parameters
|
154 |
+
$parameters = $option->parameters;
|
155 |
+
foreach ($parameters->parameter as $param) {
|
156 |
+
foreach ($param->children() as $parameter) {
|
157 |
+
$parameter_name = $parameter->getname();
|
158 |
+
if ($parameter_name != 'code') {
|
159 |
+
$type = strtoupper((string)$parameter_name);
|
160 |
+
$value = strtoupper((string)$parameter);
|
161 |
+
} else {
|
162 |
+
$code_parameter = (string)$parameter;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
$sql = '
|
166 |
+
INSERT INTO `' . $this->_b2bXmlOptions . '`
|
167 |
+
(`b2b_xml_option_code`,`b2b_xml_parameter_name`, `b2b_xml_parameter_type`,`b2b_xml_parameter_value`)
|
168 |
+
VALUES ("' . $code . '","' . $code_parameter . '","' . $type . '","' . $value . '")';
|
169 |
+
|
170 |
+
$this->_writeConnection->query($sql);
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
// installing account_types
|
175 |
+
$account_types = $xml_payments->account_types;
|
176 |
+
foreach ($account_types->account_type as $account_type) {
|
177 |
+
$code = $account_type->code;
|
178 |
+
$logo_url = $account_type->logo_url;
|
179 |
+
|
180 |
+
// insert base struture
|
181 |
+
$sql = '
|
182 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypes . '`
|
183 |
+
(`b2b_xml_account_type_code`,`b2b_xml_account_type_logo`)
|
184 |
+
VALUES ("' . $code . '","' . $logo_url . '")';
|
185 |
+
|
186 |
+
$this->_writeConnection->query($sql);
|
187 |
+
|
188 |
+
// insert language
|
189 |
+
foreach ($account_type->labels->children() as $label) {
|
190 |
+
$name = (string)$label;
|
191 |
+
$lang_iso = (string)$label['language'];
|
192 |
+
|
193 |
+
// insert in db for each language
|
194 |
+
$sql = '
|
195 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeLang . '`
|
196 |
+
(`b2b_xml_account_type_code`,`lang_iso`,`account_type_lang_name`)
|
197 |
+
VALUES ("' . $code . '","' . $lang_iso . '","' . $name . '")';
|
198 |
+
|
199 |
+
$this->_writeConnection->query($sql);
|
200 |
+
}
|
201 |
+
|
202 |
+
// insert currencies allowed
|
203 |
+
foreach ($account_type->currencies->children() as $currencie) {
|
204 |
+
$currency_iso = (string)$currencie;
|
205 |
+
// insert in db for each currency
|
206 |
+
$sql = '
|
207 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeCurrency . '`
|
208 |
+
(`b2b_xml_account_type_code`,`currency_iso`)
|
209 |
+
VALUES ("' . $code . '","' . $currency_iso . '")';
|
210 |
+
|
211 |
+
$this->_writeConnection->query($sql);
|
212 |
+
}
|
213 |
+
|
214 |
+
// setting options parameters
|
215 |
+
$parameter_sets = $account_type->parameter_sets;
|
216 |
+
foreach ($parameter_sets->parameter_set as $parameter_set) {
|
217 |
+
$api_version = $parameter_set->be2bill_api_version;
|
218 |
+
$logo_url = $parameter_set->logo_url;
|
219 |
+
$sql = '
|
220 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeParameterSet . '`
|
221 |
+
(`b2b_xml_account_type_parameter_set_version`,`b2b_xml_account_type_parameter_set_logo`,`b2b_xml_account_type_code`)
|
222 |
+
VALUES ("' . $api_version . '","' . $logo_url . '","' . $code . '")';
|
223 |
+
|
224 |
+
$this->_writeConnection->query($sql);
|
225 |
+
// get parameter_set id
|
226 |
+
$id_parameter_set = $this->_writeConnection->lastInsertId();
|
227 |
+
|
228 |
+
// setting parameter set options
|
229 |
+
$options = $parameter_set->options;
|
230 |
+
foreach ($options->children() as $option) {
|
231 |
+
$parameter_option = (string)$option;
|
232 |
+
$sql = '
|
233 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeParameterSetOptions . '`
|
234 |
+
(`id_b2b_xml_account_type_parameter_set`, `b2b_xml_option`)
|
235 |
+
VALUES (' . (int)$id_parameter_set . ',"' . $parameter_option . '")';
|
236 |
+
|
237 |
+
$this->_writeConnection->query($sql);
|
238 |
+
}
|
239 |
+
|
240 |
+
// setting parameter set operations
|
241 |
+
$operations = $parameter_set->operations;
|
242 |
+
foreach ($operations->children() as $operation) {
|
243 |
+
$parameter_operation = (string)$operation;
|
244 |
+
$sql = '
|
245 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeParameterSetOperation . '`
|
246 |
+
(`id_b2b_xml_account_type_parameter_set`,`b2b_xml_operation_code`)
|
247 |
+
VALUES (' . (int)$id_parameter_set . ',"' . $parameter_operation . '")';
|
248 |
+
|
249 |
+
$this->_writeConnection->query($sql);
|
250 |
+
}
|
251 |
+
|
252 |
+
// insert mode allowed
|
253 |
+
$modes = $parameter_set->modes;
|
254 |
+
foreach ($modes->children() as $mode) {
|
255 |
+
$mode = (string)$mode;
|
256 |
+
// insert in db for each mode
|
257 |
+
$sql = '
|
258 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeParameterSetMode . '`
|
259 |
+
(`id_b2b_xml_account_type_parameter_set`,`b2b_xml_mode_code`)
|
260 |
+
VALUES (' . (int)$id_parameter_set . ',"' . $mode . '")';
|
261 |
+
|
262 |
+
$this->_writeConnection->query($sql);
|
263 |
+
}
|
264 |
+
|
265 |
+
// setting allowed countries for parameter set
|
266 |
+
$allowed_countries = $parameter_set->countries;
|
267 |
+
foreach ($allowed_countries->children() as $allowed_country) {
|
268 |
+
$country = (string)$allowed_country;
|
269 |
+
$sql = '
|
270 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeParameterSetCountries . '`
|
271 |
+
(`id_b2b_xml_account_type_parameter_set`, `country_iso`)
|
272 |
+
VALUES (' . (int)$id_parameter_set . ',"' . $country . '")';
|
273 |
+
|
274 |
+
$this->_writeConnection->query($sql);
|
275 |
+
}
|
276 |
+
|
277 |
+
// setting options parameters
|
278 |
+
$parameters = $parameter_set->parameters;
|
279 |
+
foreach ($parameters->parameter as $param) {
|
280 |
+
foreach ($param->children() as $parameter) {
|
281 |
+
$merchantHash = 'YES';
|
282 |
+
$parameter_name = $parameter->getname();
|
283 |
+
if ($parameter_name == 'merchant_hash') {
|
284 |
+
$merchantHash = strtoupper((string)$parameter);
|
285 |
+
}
|
286 |
+
else if ($parameter_name != 'code') {
|
287 |
+
$type = strtoupper((string)$parameter_name);
|
288 |
+
$value = strtoupper((string)$parameter);
|
289 |
+
} else {
|
290 |
+
$code_parameter = (string)$parameter;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
$sql = '
|
294 |
+
INSERT INTO `' . $this->_b2bXmlAccountTypeParameterSetParameters . '`
|
295 |
+
(`id_b2b_xml_account_type_parameter_set`, `b2b_xml_parameter_name`,`b2b_xml_parameter_type`,`b2b_xml_parameter_value`,`b2b_xml_parameter_merchant_hash`)
|
296 |
+
VALUES (' . (int)$id_parameter_set . ',"' . $code_parameter . '","' . $type . '","' . $value . '","' . $merchantHash. '")';
|
297 |
+
|
298 |
+
$this->_writeConnection->query($sql);
|
299 |
+
}
|
300 |
+
}
|
301 |
+
}
|
302 |
+
return true;
|
303 |
+
}
|
304 |
+
return false;
|
305 |
+
}
|
306 |
+
|
307 |
+
public function uninstallBe2billXmlTables()
|
308 |
+
{
|
309 |
+
$sql = '
|
310 |
+
SET FOREIGN_KEY_CHECKS=0;
|
311 |
+
|
312 |
+
DROP TABLE IF EXISTS `' . $this->_b2bXmlModesLang . '`,
|
313 |
+
`' . $this->_b2bXmlOperationLang . '`,
|
314 |
+
`' . $this->_b2bXmlOptions . '`,
|
315 |
+
`' . $this->_b2bXmlOptionsLang . '`,
|
316 |
+
`' . $this->_b2bXmlAccountTypes . '`,
|
317 |
+
`' . $this->_b2bXmlAccountTypeLang . '`,
|
318 |
+
`' . $this->_b2bXmlAccountTypeCurrency . '`,
|
319 |
+
`' . $this->_b2bXmlAccountTypeParameterSet . '`,
|
320 |
+
`' . $this->_b2bXmlAccountTypeParameterSetCountries . '`,
|
321 |
+
`' . $this->_b2bXmlAccountTypeParameterSetMode . '`,
|
322 |
+
`' . $this->_b2bXmlAccountTypeParameterSetOperation . '`,
|
323 |
+
`' . $this->_b2bXmlAccountTypeParameterSetParameters . '`,
|
324 |
+
`' . $this->_b2bXmlAccountTypeParameterSetOptions . '`,
|
325 |
+
`' . $this->_b2bMerchandConfigurationAccount . '`,
|
326 |
+
`' . $this->_b2bMerchandConfigurationAccountOptions . '`,
|
327 |
+
`' . $this->_b2bMerchandConfigurationAccountCountries . '`;
|
328 |
+
|
329 |
+
SET FOREIGN_KEY_CHECKS=1;';
|
330 |
+
|
331 |
+
return $this->_writeConnection->query($sql);
|
332 |
+
}
|
333 |
+
|
334 |
+
public function resetBe2billXmlTables()
|
335 |
+
{
|
336 |
+
$sql = '
|
337 |
+
SET FOREIGN_KEY_CHECKS=0;
|
338 |
+
|
339 |
+
TRUNCATE `' . $this->_b2bXmlModesLang . '`;
|
340 |
+
TRUNCATE `' . $this->_b2bXmlOperationLang . '`;
|
341 |
+
TRUNCATE `' . $this->_b2bXmlOptions . '`;
|
342 |
+
TRUNCATE `' . $this->_b2bXmlOptionsLang . '`;
|
343 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypes . '`;
|
344 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeLang . '`;
|
345 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeCurrency . '`;
|
346 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeParameterSet . '`;
|
347 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeParameterSetCountries . '`;
|
348 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeParameterSetMode . '`;
|
349 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeParameterSetOperation . '`;
|
350 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeParameterSetParameters . '`;
|
351 |
+
TRUNCATE `' . $this->_b2bXmlAccountTypeParameterSetOptions . '`;
|
352 |
+
|
353 |
+
|
354 |
+
SET FOREIGN_KEY_CHECKS=1;';
|
355 |
+
|
356 |
+
return $this->_writeConnection->query($sql);
|
357 |
+
}
|
358 |
+
|
359 |
+
/*
|
360 |
+
TRUNCATE `'.$this->_b2bMerchandConfigurationAccount.'`;
|
361 |
+
TRUNCATE `'.$this->_b2bMerchandConfigurationAccountOptions.'`;
|
362 |
+
TRUNCATE `'.$this->_b2bMerchandConfigurationAccountCountries.'`;
|
363 |
+
*/
|
364 |
+
|
365 |
+
/**
|
366 |
+
* methode permettant de valider ou non l'import d'un nouveau XML
|
367 |
+
* @param string version du XML en attente d'import
|
368 |
+
* @return boolean
|
369 |
+
*/
|
370 |
+
public function paymentsNeedUpgrade($version)
|
371 |
+
{
|
372 |
+
// recuperation de la version XML en cours
|
373 |
+
$currentVersion = Mage::getStoreConfig(self::XML_PATH_ADMIN_BE2BILL_VERSION);
|
374 |
+
|
375 |
+
// est-ce le premier import ?
|
376 |
+
if ($currentVersion == '') {
|
377 |
+
return true;
|
378 |
+
}
|
379 |
+
|
380 |
+
// verification pas de changement de version
|
381 |
+
// return true pour relancer tout de meme l'import
|
382 |
+
if ($currentVersion === (string)$version) {
|
383 |
+
return true;
|
384 |
+
}
|
385 |
+
|
386 |
+
$aCurrentVersion = explode('.', $currentVersion);
|
387 |
+
$aVersion = explode('.', $version);
|
388 |
+
|
389 |
+
// X1 = X2
|
390 |
+
if ($aCurrentVersion[0] === $aVersion[0]) {
|
391 |
+
// Y1 < Y2
|
392 |
+
if ($aCurrentVersion[1] < $aVersion[1]) {
|
393 |
+
return true;
|
394 |
+
}
|
395 |
+
// Y1 = Y2
|
396 |
+
else if ($aCurrentVersion[1] === $aVersion[1]) {
|
397 |
+
// Z1 < Z2
|
398 |
+
if ($aCurrentVersion[2] < $aVersion[2]) {
|
399 |
+
return true;
|
400 |
+
}
|
401 |
+
// Z1 = Z2 || Z1 > Z2
|
402 |
+
else {
|
403 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
404 |
+
Mage::helper('be2bill')->__('La modification de version ' . $currentVersion . ' vers ' . $version . ' ne peut être effectuée')
|
405 |
+
);
|
406 |
+
return false;
|
407 |
+
}
|
408 |
+
}
|
409 |
+
// Y1 > Y2
|
410 |
+
else {
|
411 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
412 |
+
Mage::helper('be2bill')->__('La modification de version ' . $currentVersion . ' vers ' . $version . ' ne peut être effectuée')
|
413 |
+
);
|
414 |
+
return false;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
// si numero de version X differente
|
418 |
+
else {
|
419 |
+
// version X courante < version X nouveau XML
|
420 |
+
if ($aCurrentVersion[0] < $aVersion[0]) {
|
421 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
422 |
+
Mage::helper('be2bill')->__('La mise à jour du XML de la version ' . $aCurrentVersion[0] . '.Y.Z vers ' . $aVersion[0] . '.Y.Z nécessite une mise à jour applicative du module Be2Bill')
|
423 |
+
);
|
424 |
+
} else {
|
425 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
426 |
+
Mage::helper('be2bill')->__('Le XML de version ' . $aVersion[0] . '.Y.Z est antérieure à celle que vous utilisez actuellement ' . $aCurrentVersion[0] . '.Y.Z')
|
427 |
+
);
|
428 |
+
}
|
429 |
+
return false;
|
430 |
+
}
|
431 |
+
|
432 |
+
if ($version == $currentVersion) {
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
return true;
|
436 |
+
}
|
437 |
+
|
438 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Customer.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Customer extends Mage_Customer_Model_Customer
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Retourne la collection d'alias du client
|
25 |
+
*
|
26 |
+
* @return Mage_Customer_Model_Customer
|
27 |
+
*/
|
28 |
+
public function getAliasCollection()
|
29 |
+
{
|
30 |
+
return Mage::getModel('be2bill/alias')->getCollection()->addFieldToFilter('id_customer', $this->getId());
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retourne la collection d'alias du client en fonction du compte de paiement
|
35 |
+
*
|
36 |
+
* @return Mage_Customer_Model_Customer
|
37 |
+
*/
|
38 |
+
public function getAliasByMerchandAccount($merchandId)
|
39 |
+
{
|
40 |
+
return $this->getAliasCollection()->addFieldToFilter('id_merchand_account', $merchandId)->getFirstItem();
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Log/Adapter.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_Model_Log_Adapter
|
18 |
+
{
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Store log file name
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
protected $_logFileName = '';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Data to log
|
29 |
+
*
|
30 |
+
* @var array
|
31 |
+
*/
|
32 |
+
protected $_data = array();
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Fields that should be replaced in debug data with '***'
|
36 |
+
*
|
37 |
+
* @var array
|
38 |
+
*/
|
39 |
+
protected $_debugReplacePrivateDataKeys = array();
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Set log file name
|
43 |
+
*
|
44 |
+
* @param string $fileName
|
45 |
+
*/
|
46 |
+
public function __construct($fileName)
|
47 |
+
{
|
48 |
+
$this->_logFileName = $fileName;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Perform forced log data to file
|
53 |
+
*
|
54 |
+
* @param mixed $data
|
55 |
+
* @return Mage_Core_Model_Log_Adapter
|
56 |
+
*/
|
57 |
+
public function log($data = null)
|
58 |
+
{
|
59 |
+
if ($data === null) {
|
60 |
+
$data = $this->_data;
|
61 |
+
} else {
|
62 |
+
if (!is_array($data)) {
|
63 |
+
$data = array($data);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
$data = $this->_filterDebugData($data);
|
67 |
+
$data['__pid'] = getmypid();
|
68 |
+
Mage::log($data, null, $this->_logFileName, true);
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Log data setter
|
74 |
+
*
|
75 |
+
* @param string|array $key
|
76 |
+
* @param mixed $value
|
77 |
+
* @return Mage_Core_Model_Log_Adapter
|
78 |
+
* @todo replace whole data
|
79 |
+
*/
|
80 |
+
public function setData($key, $value = null)
|
81 |
+
{
|
82 |
+
if (is_array($key)) {
|
83 |
+
$this->_data = $key;
|
84 |
+
} else {
|
85 |
+
$this->_data[$key] = $value;
|
86 |
+
}
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Setter for private data keys, that should be replaced in debug data with '***'
|
92 |
+
*
|
93 |
+
* @param array $keys
|
94 |
+
* @return Mage_Core_Model_Log_Adapter
|
95 |
+
*/
|
96 |
+
public function setFilterDataKeys($keys)
|
97 |
+
{
|
98 |
+
if (!is_array($keys)) {
|
99 |
+
$keys = array($keys);
|
100 |
+
}
|
101 |
+
$this->_debugReplacePrivateDataKeys = $keys;
|
102 |
+
return $this;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Recursive filter data by private conventions
|
107 |
+
*
|
108 |
+
* @param mixed $debugData
|
109 |
+
* @return mixed
|
110 |
+
*/
|
111 |
+
protected function _filterDebugData($debugData)
|
112 |
+
{
|
113 |
+
if (is_array($debugData) && is_array($this->_debugReplacePrivateDataKeys)) {
|
114 |
+
foreach ($debugData as $key => $value) {
|
115 |
+
if (in_array($key, $this->_debugReplacePrivateDataKeys)) {
|
116 |
+
$debugData[$key] = '****';
|
117 |
+
} else {
|
118 |
+
if (is_array($debugData[$key])) {
|
119 |
+
$debugData[$key] = $this->_filterDebugData($debugData[$key]);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
return $debugData;
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Merchandconfigurationaccount.php
ADDED
@@ -0,0 +1,643 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Merchandconfigurationaccount extends Mage_Core_Model_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
protected $_availablePayments;
|
24 |
+
protected $_availablePaymentOptions;
|
25 |
+
protected $_hasAlias;
|
26 |
+
protected $_helperData;
|
27 |
+
protected $_oneClick;
|
28 |
+
protected $_oneClickCVV;
|
29 |
+
protected $_several;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Initialize
|
33 |
+
*/
|
34 |
+
protected function _construct()
|
35 |
+
{
|
36 |
+
parent::_construct();
|
37 |
+
$this->_init('be2bill/merchandconfigurationaccount');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Load borne by Identifiant
|
42 |
+
*
|
43 |
+
* @param string $identifier
|
44 |
+
* @return Quadra_Be2bill_Model_Merchandconfigurationaccount
|
45 |
+
*/
|
46 |
+
public function loadByIdentifier($identifier, $store = null)
|
47 |
+
{
|
48 |
+
$this->_getResource()->loadByIdentifier($this, $identifier, $store);
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get Helper Be2bill Data
|
54 |
+
* @return Quadra_Be2bill_Helper_Data
|
55 |
+
*/
|
56 |
+
public function getHelperData()
|
57 |
+
{
|
58 |
+
if ($this->_helperData === null) {
|
59 |
+
$this->_helperData = Mage::helper('be2bill');
|
60 |
+
}
|
61 |
+
return $this->_helperData;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get Collection of Contries
|
66 |
+
*/
|
67 |
+
public function getAccountCountriesCollection()
|
68 |
+
{
|
69 |
+
return Mage::getModel('be2bill/merchandconfigurationaccountcountries')
|
70 |
+
->getCollection()
|
71 |
+
->addFieldToFilter('id_b2b_merchand_configuration_account', $this->getId());
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Delete Collection of Contries
|
76 |
+
*/
|
77 |
+
public function deleteAccountCountriesCollection()
|
78 |
+
{
|
79 |
+
$collection = $this->getAccountCountriesCollection();
|
80 |
+
foreach ($collection as $obj) {
|
81 |
+
$obj->delete();
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get Collection of Options
|
87 |
+
*/
|
88 |
+
public function getOptionsCollection()
|
89 |
+
{
|
90 |
+
return Mage::getModel('be2bill/merchandconfigurationaccountoptions')
|
91 |
+
->getCollection()
|
92 |
+
->addFieldToFilter('id_b2b_merchand_configuration_account', $this->getId());
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Get Collection of Options for oneClick from product page
|
97 |
+
*/
|
98 |
+
public function getOptionsCollectionForProductOck($fAmount, $bIsMkpProduct, $bCanOckSeveral)
|
99 |
+
{
|
100 |
+
|
101 |
+
// liste des code options a exclure car pas operation utilisable sur le front
|
102 |
+
$aExcludedOptions = array(
|
103 |
+
'oneclick',
|
104 |
+
'oneclickcvv',
|
105 |
+
'displaycreatealias',
|
106 |
+
'3dsecure',
|
107 |
+
'ageverification',
|
108 |
+
'recurring');
|
109 |
+
|
110 |
+
// si ock est désactivé sur la fiche produit
|
111 |
+
if(!$bCanOckSeveral){
|
112 |
+
$aExcludedOptions[] = 'ntimes';
|
113 |
+
}
|
114 |
+
|
115 |
+
$oCollection = Mage::getModel('be2bill/merchandconfigurationaccountoptions')
|
116 |
+
->getCollection()
|
117 |
+
->addFieldToFilter('id_b2b_merchand_configuration_account', $this->getId())
|
118 |
+
->addFieldToFilter('active', 1)
|
119 |
+
->addFieldToFilter('min_amount', array(array('null' => true), array('lt' => $fAmount)))
|
120 |
+
->addFieldToFilter('max_amount', array(array('null' => true), array('gt' => $fAmount)))
|
121 |
+
->addFieldToFilter('b2b_xml_option', array(
|
122 |
+
'nin' => $aExcludedOptions));
|
123 |
+
|
124 |
+
// si mirakl, il faut filtrer les operations selon
|
125 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive() && $bIsMkpProduct){
|
126 |
+
// uniquement les paiements standards sont autorisés
|
127 |
+
$oCollection->addFieldToFilter('b2b_xml_option', 'delivery');
|
128 |
+
}
|
129 |
+
|
130 |
+
return $oCollection;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Delete Collection of Options
|
135 |
+
*/
|
136 |
+
public function deleteOptionsCollection()
|
137 |
+
{
|
138 |
+
$collection = $this->getOptionsCollection();
|
139 |
+
foreach ($collection as $obj) {
|
140 |
+
$obj->delete();
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Retourne une liste de payments configurer dans l'admin
|
146 |
+
* en fonction de :
|
147 |
+
*
|
148 |
+
* @param string $currency
|
149 |
+
* @param string $country
|
150 |
+
* @param int $storeId
|
151 |
+
* @param boolean $recurring
|
152 |
+
*/
|
153 |
+
public function getAvailablePayments($currency, $country, $storeId, $recurring = null)
|
154 |
+
{
|
155 |
+
if ($this->_availablePayments === null) {
|
156 |
+
$this->_availablePayments = $this->_getResource()->getAvailablePayments($this, $currency, $country, $storeId, $recurring);
|
157 |
+
}
|
158 |
+
return $this->_availablePayments;
|
159 |
+
}
|
160 |
+
|
161 |
+
public function checkAvailablePaymentOption($currency, $country, $storeId, $recurring, $accountId, $account, $option)
|
162 |
+
{
|
163 |
+
return $this->_getResource()->checkAvailablePaymentOption($this, $currency, $country, $storeId, $recurring, $accountId, $account, $option);
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Retourne le nombre de jours pour le paiement différé
|
168 |
+
* @return int $days
|
169 |
+
*/
|
170 |
+
public function getDeferedDays()
|
171 |
+
{
|
172 |
+
$days = null;
|
173 |
+
$col = Mage::getModel('be2bill/merchandconfigurationaccountoptions')
|
174 |
+
->getCollection()
|
175 |
+
->addFieldToFilter('id_b2b_merchand_configuration_account', $this->getId())
|
176 |
+
->addFieldToFilter('b2b_xml_option', 'defered')
|
177 |
+
->addFieldToFilter('active', '1');
|
178 |
+
|
179 |
+
if ($col != null) {
|
180 |
+
$days = unserialize($col->getFirstItem()->getData('b2b_xml_option_extra'));
|
181 |
+
}
|
182 |
+
return $days;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Retourne un tableau de status pour la capture du paiement
|
187 |
+
* @return array $status
|
188 |
+
*/
|
189 |
+
public function getDeliveryStatus()
|
190 |
+
{
|
191 |
+
$status = null;
|
192 |
+
$col = Mage::getModel('be2bill/merchandconfigurationaccountoptions')
|
193 |
+
->getCollection()
|
194 |
+
->addFieldToFilter('id_b2b_merchand_configuration_account', $this->getId())
|
195 |
+
->addFieldToFilter('b2b_xml_option', 'delivery')
|
196 |
+
->addFieldToFilter('active', '1');
|
197 |
+
|
198 |
+
if ($col != null) {
|
199 |
+
$status = unserialize($col->getFirstItem()->getData('b2b_xml_option_extra'));
|
200 |
+
}
|
201 |
+
|
202 |
+
return $status;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Retourne les Options affichables sur le front
|
207 |
+
*
|
208 |
+
* @param float $amount
|
209 |
+
* @param boolean $recurring
|
210 |
+
*/
|
211 |
+
public function getAvailableFrontOptions($amount, $recurring)
|
212 |
+
{
|
213 |
+
if ($this->_availablePaymentOptions === null) {
|
214 |
+
$this->_availablePaymentOptions = $this->_getResource()->getAvailableFrontOptions($this, $amount, $recurring);
|
215 |
+
}
|
216 |
+
return $this->_availablePaymentOptions;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Retourne toutes les options en fonction de :
|
221 |
+
*
|
222 |
+
* @param float $amount
|
223 |
+
* @param boolean $hasAlias
|
224 |
+
*/
|
225 |
+
public function getAvailableOptions($amount, $hasAlias)
|
226 |
+
{
|
227 |
+
if ($this->_availablePaymentOptions === null) {
|
228 |
+
$this->_availablePaymentOptions = $this->_getResource()->getAvailableOptions($this, $amount, $hasAlias);
|
229 |
+
}
|
230 |
+
return $this->_availablePaymentOptions;
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Utilisation de l'option OneClick possible ?
|
235 |
+
*/
|
236 |
+
public function getOneClick()
|
237 |
+
{
|
238 |
+
if ($this->_oneClick === null) {
|
239 |
+
$this->_oneClick = $this->_getResource()->getOneClick($this);
|
240 |
+
}
|
241 |
+
return $this->_oneClick;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Utilisation de l'option OneClick CVV obligatoire ?
|
246 |
+
*/
|
247 |
+
public function useOneClickCVV()
|
248 |
+
{
|
249 |
+
if ($this->_oneClickCVV === null) {
|
250 |
+
$oneclick = $this->_getResource()->useOneClickCVV($this);
|
251 |
+
if ($oneclick) {
|
252 |
+
$this->_oneClickCVV = $oneclick->getActive();
|
253 |
+
}
|
254 |
+
}
|
255 |
+
return $this->_oneClickCVV;
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Utilisation de l'option paiement en N fois ?
|
260 |
+
*/
|
261 |
+
public function getSeveral()
|
262 |
+
{
|
263 |
+
if ($this->_several === null) {
|
264 |
+
$this->_several = $this->_getResource()->getSeveral($this);
|
265 |
+
}
|
266 |
+
return $this->_several;
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Retourne l'url du Logo
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
public function getLogo()
|
274 |
+
{
|
275 |
+
if (file_exists(Mage::getBaseDir('media') . DS . $this->getLogoUrl())) {
|
276 |
+
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $this->getLogoUrl();
|
277 |
+
} else {
|
278 |
+
return $this->getLogoUrl();
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Retourne le label pour le front du moyen de paiement Be2bill sélectionné
|
284 |
+
*
|
285 |
+
* @return string
|
286 |
+
*/
|
287 |
+
public function getFrontendLabel($option = null)
|
288 |
+
{
|
289 |
+
$label = $this->getData('configuration_account_name');
|
290 |
+
|
291 |
+
if ($option != null) {
|
292 |
+
$label .= ' : ' . $option;
|
293 |
+
}
|
294 |
+
|
295 |
+
return $label;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Utilisation de l'option de paiement 3 fois possible ?
|
300 |
+
* @return array
|
301 |
+
*/
|
302 |
+
public function getNtimes()
|
303 |
+
{
|
304 |
+
$result = $this->getOptionsCollection()
|
305 |
+
->addFieldToFilter('b2b_xml_option', 'ntimes');
|
306 |
+
return unserialize($result->getFirstItem()->getData('b2b_xml_option_extra'));
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* si refundAmount = remboursement
|
311 |
+
*
|
312 |
+
* @param array $paramsNoHash passe en reference
|
313 |
+
* @return boolean|string
|
314 |
+
*/
|
315 |
+
public function getDefaultParameters($order, $info, $refundAmount = null, $miraklOrderId = null , &$paramsNoHash)
|
316 |
+
{
|
317 |
+
$billingAddress = $order->getBillingAddress();
|
318 |
+
|
319 |
+
$parameters = Mage::getModel('be2bill/api_methods')->getAccountTypeParameters($info['account'], $info['operation'], $billingAddress->getCountryId());
|
320 |
+
|
321 |
+
if (!$parameters) {
|
322 |
+
return false;
|
323 |
+
}
|
324 |
+
|
325 |
+
$shippingAddress = $order->getShippingAddress();
|
326 |
+
$customerId = $order->getCustomerId();
|
327 |
+
if ($refundAmount != null) {
|
328 |
+
$amount = $refundAmount;
|
329 |
+
} else {
|
330 |
+
$amount = $order->getBaseGrandTotal();
|
331 |
+
}
|
332 |
+
|
333 |
+
$customerEmail = ($billingAddress->getEmail()) ? $billingAddress->getEmail() : $order->getCustomerEmail();
|
334 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
335 |
+
|
336 |
+
$default_params = array();
|
337 |
+
foreach ($parameters as $param) {
|
338 |
+
$version = $param['b2b_xml_account_type_parameter_set_version'];
|
339 |
+
$type = strtoupper($param['b2b_xml_parameter_type']);
|
340 |
+
$value = strtoupper($param['b2b_xml_parameter_value']);
|
341 |
+
$merchantHash = strtoupper($param['b2b_xml_parameter_merchant_hash']);
|
342 |
+
|
343 |
+
//Update du tableau des paramètres a ne pas prendre en compte pour le calcul du hash
|
344 |
+
if($merchantHash == 'NO'){
|
345 |
+
$paramsNoHash[] = $param['b2b_xml_parameter_name'];
|
346 |
+
}
|
347 |
+
|
348 |
+
if ($type == 'REQUIRED' && $value = 'YES') {
|
349 |
+
switch ($param['b2b_xml_parameter_name']) {
|
350 |
+
case 'AMOUNT':
|
351 |
+
$defaultParams['AMOUNT'] = $this->getHelperData()->formatAmount($amount);
|
352 |
+
break;
|
353 |
+
case 'ASKIBAN':
|
354 |
+
$defaultParams['ASKIBAN'] = 'NO';
|
355 |
+
break;
|
356 |
+
case 'BILLINGADDRESS':
|
357 |
+
$defaultParams['BILLINGADDRESS'] = substr(preg_replace("/\r|\n/", " ", $billingAddress->getStreetFull()), 0, 49);
|
358 |
+
break;
|
359 |
+
case 'BILLINGCITY':
|
360 |
+
$defaultParams['BILLINGCITY'] = substr($billingAddress->getCity(), 0, 254);
|
361 |
+
break;
|
362 |
+
case 'BILLINGCOUNTRY':
|
363 |
+
$defaultParams['BILLINGCOUNTRY'] = substr($billingAddress->getCountryId(), 0, 2);
|
364 |
+
break;
|
365 |
+
case 'BILLINGFIRSTNAME':
|
366 |
+
$defaultParams['BILLINGFIRSTNAME'] = substr($billingAddress->getFirstname(), 0, 14);
|
367 |
+
break;
|
368 |
+
case 'BILLINGLASTNAME':
|
369 |
+
$defaultParams['BILLINGLASTNAME'] = substr($billingAddress->getLastname(), 0, 29);
|
370 |
+
break;
|
371 |
+
case 'BILLINGMOBILEPHONE':
|
372 |
+
$defaultParams['BILLINGMOBILEPHONE'] = '0000000000';
|
373 |
+
if($billingAddress->getTelephone() != ''){
|
374 |
+
$defaultParams['BILLINGMOBILEPHONE'] = $billingAddress->getTelephone();
|
375 |
+
}
|
376 |
+
break;
|
377 |
+
case 'BILLINGPHONE':
|
378 |
+
$defaultParams['BILLINGPHONE'] = substr(preg_replace('/[-\.\/\s]/', '', $billingAddress->getTelephone()), 0, 31);
|
379 |
+
break;
|
380 |
+
case 'BILLINGPOSTALCODE':
|
381 |
+
$defaultParams['BILLINGPOSTALCODE'] = substr($billingAddress->getPostcode(), 0, 8);
|
382 |
+
break;
|
383 |
+
case 'CART[N][NAME]':
|
384 |
+
$items = $order->getAllVisibleItems();
|
385 |
+
$i = 0;
|
386 |
+
foreach ($items as $item) {
|
387 |
+
$defaultParams['CART'][$i]['NAME'] = $item->getData('name');
|
388 |
+
$i++;
|
389 |
+
}
|
390 |
+
break;
|
391 |
+
case 'CART[N][TAX]':
|
392 |
+
$items = $order->getAllVisibleItems();
|
393 |
+
$i = 0;
|
394 |
+
foreach ($items as $item) {
|
395 |
+
$defaultParams['CART'][$i]['TAX'] = $this->getHelperData()->formatAmount($item->getData('tax_percent'));
|
396 |
+
$i++;
|
397 |
+
}
|
398 |
+
break;
|
399 |
+
case 'CART[N][QUANTITY]':
|
400 |
+
$items = $order->getAllVisibleItems();
|
401 |
+
$i = 0;
|
402 |
+
foreach ($items as $item) {
|
403 |
+
$defaultParams['CART'][$i]['QUANTITY'] = round($item->getData('qty_ordered'));
|
404 |
+
$i++;
|
405 |
+
}
|
406 |
+
break;
|
407 |
+
case 'CART[N][PRICE]':
|
408 |
+
$items = $order->getAllVisibleItems();
|
409 |
+
$i = 0;
|
410 |
+
foreach ($items as $item) {
|
411 |
+
$defaultParams['CART'][$i]['PRICE'] = $this->getHelperData()->formatAmount($item->getData('base_row_total'));
|
412 |
+
$i++;
|
413 |
+
}
|
414 |
+
break;
|
415 |
+
case 'CART[N][MERCHANTITEMID]':
|
416 |
+
$items = $order->getAllVisibleItems();
|
417 |
+
$i = 0;
|
418 |
+
foreach ($items as $item) {
|
419 |
+
$defaultParams['CART'][$i]['MERCHANTITEMID'] = $item->getData('product_id');
|
420 |
+
$i++;
|
421 |
+
}
|
422 |
+
break;
|
423 |
+
case 'CART[N][DISCOUNT]':
|
424 |
+
$items = $order->getAllVisibleItems();
|
425 |
+
$i = 0;
|
426 |
+
foreach ($items as $item) {
|
427 |
+
$defaultParams['CART'][$i]['DISCOUNT'] = '0';
|
428 |
+
$i++;
|
429 |
+
}
|
430 |
+
break;
|
431 |
+
case 'CLIENTADDRESS':
|
432 |
+
$defaultParams['CLIENTADDRESS'] = substr($billingAddress->format("oneline"), 0, 509);
|
433 |
+
break;
|
434 |
+
case 'CLIENTDOB':
|
435 |
+
$defaultParams['CLIENTDOB'] = '1970-01-01';
|
436 |
+
if ($customer->getDob() != "") {
|
437 |
+
$dateTimePart = explode(" ", $customer->getDob());
|
438 |
+
if (isset($dateTimePart[0])) {
|
439 |
+
$defaultParams['CLIENTDOB'] = $dateTimePart[0];
|
440 |
+
}
|
441 |
+
}
|
442 |
+
break;
|
443 |
+
case 'CLIENTEMAIL':
|
444 |
+
$defaultParams['CLIENTEMAIL'] = substr($customerEmail, 0, 254);
|
445 |
+
break;
|
446 |
+
case 'CLIENTGENDER':
|
447 |
+
if ($customer->getGender() == '1') {
|
448 |
+
$defaultParams['CLIENTGENDER'] = 'M';
|
449 |
+
} elseif ($customer->getGender() == '2') {
|
450 |
+
$defaultParams['CLIENTGENDER'] = 'F';
|
451 |
+
}
|
452 |
+
else {
|
453 |
+
$defaultParams['CLIENTGENDER'] = 'M';
|
454 |
+
}
|
455 |
+
break;
|
456 |
+
case 'CLIENTIDENT':
|
457 |
+
$defaultParams['CLIENTIDENT'] = is_numeric($customerId) ? $customerId : substr($customerEmail, 0, 254);
|
458 |
+
break;
|
459 |
+
case 'CREATEALIAS':
|
460 |
+
$defaultParams['CREATEALIAS'] = 'yes';
|
461 |
+
break;
|
462 |
+
case 'DESCRIPTION':
|
463 |
+
$defaultParams['DESCRIPTION'] = ucfirst($info['operation']);
|
464 |
+
break;
|
465 |
+
case 'EXTRADATA':
|
466 |
+
$extradata = array(
|
467 |
+
'be2bill-' . $info['account_id'] . '-' . $info['operation']
|
468 |
+
);
|
469 |
+
|
470 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive()) {
|
471 |
+
if (Mage::helper('mirakl_connector/order')->isFullRemoteOrder($order)) {
|
472 |
+
$priceInclTax = array();
|
473 |
+
foreach ($order->getAllItems() as $item) {
|
474 |
+
$key = $item->getMiraklShopId();
|
475 |
+
if (!array_key_exists($key, $priceInclTax)) {
|
476 |
+
$priceInclTax[$key] = 0;
|
477 |
+
}
|
478 |
+
$priceInclTax[$key] += $item->getRowTotalInclTax();
|
479 |
+
}
|
480 |
+
foreach ($priceInclTax as $shopId => $price) {
|
481 |
+
$extradata[] = 'm[' . $shopId . ']=' . $this->getHelperData()->formatAmount($price);
|
482 |
+
}
|
483 |
+
} elseif (Mage::helper('mirakl_connector/order')->isRemoteOrder($order)) {
|
484 |
+
$oPriceInclTax = 0;
|
485 |
+
$mkpPriceInclTax = array();
|
486 |
+
foreach ($order->getAllItems() as $item) {
|
487 |
+
$key = $item->getMiraklShopId();
|
488 |
+
if (!empty($key)) {
|
489 |
+
if (!array_key_exists($key, $mkpPriceInclTax)) {
|
490 |
+
$mkpPriceInclTax[$key] = 0;
|
491 |
+
}
|
492 |
+
$mkpPriceInclTax[$key] += $item->getRowTotalInclTax();
|
493 |
+
} else {
|
494 |
+
$oPriceInclTax += $item->getRowTotalInclTax();
|
495 |
+
}
|
496 |
+
}
|
497 |
+
$extradata[] = 'o=' . $this->getHelperData()->formatAmount($oPriceInclTax);
|
498 |
+
foreach ($mkpPriceInclTax as $shopId => $price) {
|
499 |
+
$extradata[] = 'm[' . $shopId . ']=' . $this->getHelperData()->formatAmount($price);
|
500 |
+
}
|
501 |
+
} else {
|
502 |
+
$priceInclTax = 0;
|
503 |
+
foreach ($order->getAllItems() as $item) {
|
504 |
+
$priceInclTax += $item->getRowTotalInclTax();
|
505 |
+
}
|
506 |
+
$extradata[] = 'o=' . $this->getHelperData()->formatAmount($priceInclTax);
|
507 |
+
}
|
508 |
+
} else {
|
509 |
+
$priceInclTax = 0;
|
510 |
+
foreach ($order->getAllItems() as $item) {
|
511 |
+
$priceInclTax += $item->getRowTotalInclTax();
|
512 |
+
}
|
513 |
+
$extradata[] = 'o=' . $this->getHelperData()->formatAmount($priceInclTax);
|
514 |
+
}
|
515 |
+
|
516 |
+
$defaultParams['EXTRADATA'] = implode('&', $extradata);
|
517 |
+
break;
|
518 |
+
case 'HIDECARDFULLNAME':
|
519 |
+
$defaultParams['HIDECARDFULLNAME'] = 'NO';
|
520 |
+
break;
|
521 |
+
case 'HIDECLIENTEMAIL':
|
522 |
+
$defaultParams['HIDECLIENTEMAIL'] = 'YES';
|
523 |
+
break;
|
524 |
+
case 'IDENTIFICATIONDOCID':
|
525 |
+
$defaultParams['IDENTIFICATIONDOCID'] = $info['identificationdocid'];
|
526 |
+
break;
|
527 |
+
case 'IDENTIFICATIONDOCTYPE':
|
528 |
+
$defaultParams['IDENTIFICATIONDOCTYPE'] = Mage::getStoreConfig('be2bill/be2bill_api/klarna_doc');
|
529 |
+
break;
|
530 |
+
case 'IDENTIFIER':
|
531 |
+
$defaultParams['IDENTIFIER'] = $this->getLogin();
|
532 |
+
break;
|
533 |
+
case 'LANGUAGE':
|
534 |
+
$defaultParams['LANGUAGE'] = strtolower(substr(Mage::app()->getLocale()->getLocaleCode(), 3, 4));
|
535 |
+
break;
|
536 |
+
case 'METADATA':
|
537 |
+
$metadata = array(
|
538 |
+
'BC=' . substr($billingAddress->getCountryId(), 0, 2),
|
539 |
+
'BZ=' . substr($billingAddress->getPostcode(), 0, 8),
|
540 |
+
'SC=' . substr($shippingAddress->getCountryId(), 0, 2),
|
541 |
+
'SZ=' . substr($shippingAddress->getPostcode(), 0, 8)
|
542 |
+
);
|
543 |
+
$defaultParams['METADATA'] = implode('&', $metadata);
|
544 |
+
break;
|
545 |
+
case 'OPERATIONTYPE':
|
546 |
+
$defaultParams['OPERATIONTYPE'] = $info['operation'];
|
547 |
+
break;
|
548 |
+
case 'ORDERID':
|
549 |
+
$defaultParams['ORDERID'] = $order->getIncrementId();
|
550 |
+
break;
|
551 |
+
case 'SHIPTOADDRESS':
|
552 |
+
if ($shippingAddress) {
|
553 |
+
$defaultParams['SHIPTOADDRESS'] = substr(preg_replace("/\r|\n/", " ", $shippingAddress->getStreetFull()), 0, 49);
|
554 |
+
}
|
555 |
+
break;
|
556 |
+
case 'SHIPTOCITY':
|
557 |
+
if ($shippingAddress) {
|
558 |
+
$defaultParams['SHIPTOCITY'] = substr($shippingAddress->getCity(), 0, 254);
|
559 |
+
}
|
560 |
+
break;
|
561 |
+
case 'SHIPTOCOUNTRY':
|
562 |
+
if ($shippingAddress) {
|
563 |
+
$defaultParams['SHIPTOCOUNTRY'] = substr($shippingAddress->getCountryId(), 0, 2);
|
564 |
+
}
|
565 |
+
break;
|
566 |
+
case 'SHIPTOFIRSTNAME':
|
567 |
+
if ($shippingAddress) {
|
568 |
+
$defaultParams['SHIPTOFIRSTNAME'] = substr($shippingAddress->getFirstname(), 0, 14);
|
569 |
+
}
|
570 |
+
break;
|
571 |
+
case 'SHIPTOLASTNAME':
|
572 |
+
if ($shippingAddress) {
|
573 |
+
$defaultParams['SHIPTOLASTNAME'] = substr($shippingAddress->getLastname(), 0, 29);
|
574 |
+
}
|
575 |
+
break;
|
576 |
+
case 'SHIPTOPHONE':
|
577 |
+
if ($shippingAddress) {
|
578 |
+
$defaultParams['SHIPTOPHONE'] = substr(preg_replace('/[-\.\/\s]/', '', $shippingAddress->getTelephone()), 0, 31);
|
579 |
+
}
|
580 |
+
break;
|
581 |
+
case 'SHIPTOPOSTALCODE':
|
582 |
+
if ($shippingAddress) {
|
583 |
+
$defaultParams['SHIPTOPOSTALCODE'] = substr($shippingAddress->getPostcode(), 0, 8);
|
584 |
+
}
|
585 |
+
break;
|
586 |
+
case 'TRANSACTIONID':
|
587 |
+
$defaultParams['TRANSACTIONID'] = $order->getPayment()->getParentTransactionId() != null ? $order->getPayment()->getParentTransactionId() : $order->getPayment()->getLastTransId();
|
588 |
+
|
589 |
+
// si capture, nous recuperons l'id de l'authorization
|
590 |
+
if($defaultParams['OPERATIONTYPE'] === 'capture'){
|
591 |
+
$defaultParams['TRANSACTIONID'] = Mage::getModel('sales/order_payment_transaction')
|
592 |
+
->getCollection()
|
593 |
+
->addAttributeToFilter('order_id', array('eq' => $order->getEntityId()))
|
594 |
+
->addAttributeToFilter('txn_type', array('eq' => 'authorization'))
|
595 |
+
->getFirstItem()
|
596 |
+
->getTxnId();
|
597 |
+
}
|
598 |
+
// si refund, nous recuperons l'id de la capture
|
599 |
+
elseif($defaultParams['OPERATIONTYPE'] === 'refund'){
|
600 |
+
$oTransactionCollection = Mage::getModel('sales/order_payment_transaction')
|
601 |
+
->getCollection()
|
602 |
+
->addAttributeToFilter('order_id', array('eq' => $order->getEntityId()))
|
603 |
+
->addAttributeToFilter('txn_type', array('eq' => 'capture'));
|
604 |
+
|
605 |
+
// si remboursement d'une commande Mirakl
|
606 |
+
if($miraklOrderId){
|
607 |
+
// boucle sur toutes les transactions pour recuperer celle correspondante à l'order mirakl
|
608 |
+
foreach($oTransactionCollection as $oTransaction){
|
609 |
+
$aAdditionalInformation = $oTransaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
610 |
+
if(array_key_exists('miraklorderid', $aAdditionalInformation) && $aAdditionalInformation['miraklorderid'] === $miraklOrderId){
|
611 |
+
$defaultParams['TRANSACTIONID'] = $oTransaction->getTxnId();
|
612 |
+
}
|
613 |
+
}
|
614 |
+
}
|
615 |
+
// si remboursement hors Mirakl
|
616 |
+
else{
|
617 |
+
|
618 |
+
}
|
619 |
+
}
|
620 |
+
break;
|
621 |
+
case 'VERSION':
|
622 |
+
$defaultParams['VERSION'] = $version;
|
623 |
+
break;
|
624 |
+
case 'CLIENTIP':
|
625 |
+
$defaultParams['CLIENTIP'] = $_SERVER['REMOTE_ADDR'];
|
626 |
+
break;
|
627 |
+
case 'CLIENTREFERRER':
|
628 |
+
$defaultParams['CLIENTREFERRER'] = Mage::helper('core/http')->getRequestUri() != '' ? Mage::helper('core/http')->getRequestUri() : 'Unknow';
|
629 |
+
break;
|
630 |
+
case 'CLIENTUSERAGENT':
|
631 |
+
$defaultParams['CLIENTUSERAGENT'] = Mage::helper('core/http')->getHttpUserAgent() != '' ? Mage::helper('core/http')->getHttpUserAgent() : 'Server';
|
632 |
+
break;
|
633 |
+
case 'CARDFULLNAME':
|
634 |
+
$defaultParams['CARDFULLNAME'] = $billingAddress->getFirstname() . " " . $billingAddress->getLastname();
|
635 |
+
break;
|
636 |
+
}
|
637 |
+
}
|
638 |
+
}
|
639 |
+
|
640 |
+
return $defaultParams;
|
641 |
+
}
|
642 |
+
|
643 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Merchandconfigurationaccountcountries.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Merchandconfigurationaccountcountries extends Mage_Core_Model_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialize
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
parent::_construct();
|
29 |
+
$this->_init('be2bill/merchandconfigurationaccountcountries');
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Merchandconfigurationaccountoptions.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Merchandconfigurationaccountoptions extends Mage_Core_Model_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialize
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
parent::_construct();
|
29 |
+
$this->_init('be2bill/merchandconfigurationaccountoptions');
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Complète le tableau de paramètres à envoyer à Be2bill
|
34 |
+
*
|
35 |
+
* @param string $codeOption
|
36 |
+
* @param array $globalParams
|
37 |
+
* @param array $addInfo
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public function setOptionsParameters($codeOption, $globalParams, $addInfo)
|
41 |
+
{
|
42 |
+
//$id_account = $addInfo['account'];
|
43 |
+
$cardCvv = (isset($addInfo['cvv_oneclick'])) ? $addInfo['cvv_oneclick'] : null;
|
44 |
+
|
45 |
+
$option_params = Mage::getModel('be2bill/api_methods')->getOptionParameters($codeOption);
|
46 |
+
foreach ($option_params as $params) {
|
47 |
+
if ($params['b2b_xml_parameter_type'] == 'REQUIRED') {
|
48 |
+
|
49 |
+
// todo all set all value possible
|
50 |
+
switch ($params['b2b_xml_parameter_name']) {
|
51 |
+
case '3DSECURE' :
|
52 |
+
$globalParams['3DSECURE'] = 'YES';
|
53 |
+
break;
|
54 |
+
case '3DSECUREDISPLAYMODE':
|
55 |
+
$globalParams['3DSECUREDISPLAYMODE'] = 'MAIN';
|
56 |
+
break;
|
57 |
+
case 'AMOUNTS':
|
58 |
+
$globalParams['AMOUNTS'] = array();
|
59 |
+
$datesOfPayment = Mage::helper('be2bill')->getSchedule($globalParams['AMOUNT'], $addInfo['ntimes']);
|
60 |
+
foreach ($datesOfPayment as $date => $amount) {
|
61 |
+
$globalParams['AMOUNTS'][$date] = $amount;
|
62 |
+
}
|
63 |
+
case 'ALIAS':
|
64 |
+
if ($addInfo['alias'] != null) {
|
65 |
+
$globalParams['ALIAS'] = $addInfo['alias'];
|
66 |
+
}
|
67 |
+
break;
|
68 |
+
case 'ALIASMODE':
|
69 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
70 |
+
$globalParams['ALIASMODE'] = 'oneclick';
|
71 |
+
}
|
72 |
+
break;
|
73 |
+
case 'CLIENTIP':
|
74 |
+
$globalParams['CLIENTIP'] = $_SERVER['REMOTE_ADDR'];
|
75 |
+
break;
|
76 |
+
case 'CLIENTREFERRER':
|
77 |
+
$globalParams['CLIENTREFERRER'] = Mage::helper('core/http')->getRequestUri() != '' ? Mage::helper('core/http')->getRequestUri() : 'Unknow';
|
78 |
+
break;
|
79 |
+
case 'CLIENTUSERAGENT':
|
80 |
+
$globalParams['CLIENTUSERAGENT'] = Mage::helper('core/http')->getHttpUserAgent() != '' ? Mage::helper('core/http')->getHttpUserAgent() : 'Server';
|
81 |
+
break;
|
82 |
+
case 'CARDCVV':
|
83 |
+
if ($cardCvv != null) {
|
84 |
+
$globalParams['CARDCVV'] = $cardCvv;
|
85 |
+
}
|
86 |
+
break;
|
87 |
+
case 'CREATEALIAS':
|
88 |
+
$globalParams['CREATEALIAS'] = 'YES';
|
89 |
+
case 'DISPLAYCREATEALIAS':
|
90 |
+
$globalParams['DISPLAYCREATEALIAS'] = 'YES';
|
91 |
+
break;
|
92 |
+
case 'AGEVERIFICATION':
|
93 |
+
$globalParams['AGEVERIFICATION'] = 'YES';
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
// reloop for unset specific params
|
100 |
+
foreach ($option_params as $params) {
|
101 |
+
if ($params['b2b_xml_parameter_type'] == 'ABSENT') {
|
102 |
+
unset($globalParams[$params['b2b_xml_parameter_name']]);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return $globalParams;
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Method/Abstract.php
ADDED
@@ -0,0 +1,1304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License(OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License(OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
abstract class Quadra_Be2bill_Model_Method_Abstract extends Mage_Payment_Model_Method_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
const OPERATION_TYPE_PAYMENT = 'payment';
|
24 |
+
const OPERATION_TYPE_AUTH = 'authorization';
|
25 |
+
const OPERATION_TYPE_CAPTURE = 'capture';
|
26 |
+
const OPERATION_TYPE_REFUND = 'refund';
|
27 |
+
const OPERATION_TYPE_ONECLICK = 'oneclick';
|
28 |
+
const OPERATION_TYPE_SUBSCRIPTION = 'subscription';
|
29 |
+
|
30 |
+
protected $_currentOperationType = "";
|
31 |
+
protected $_isGateway = true;
|
32 |
+
protected $_canAuthorize = true;
|
33 |
+
protected $_canManageRecurringProfiles = true;
|
34 |
+
protected $_canRefund = true;
|
35 |
+
protected $_canRefundInvoicePartial = true;
|
36 |
+
protected $_canCapture = true;
|
37 |
+
protected $_canCapturePartial = true;
|
38 |
+
protected $_canUseInternal = false;
|
39 |
+
protected $_formBlockType = 'be2bill/form_paymentMethods';
|
40 |
+
protected $_infoBlockType = 'be2bill/info_paymentMethods';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Check refund availability
|
44 |
+
*
|
45 |
+
* @return bool
|
46 |
+
*/
|
47 |
+
public function canRefund()
|
48 |
+
{
|
49 |
+
$payment = $this->getInfoInstance();
|
50 |
+
$merchandAccount = $payment->getAdditionalInformation('account');
|
51 |
+
$result = Mage::getModel('be2bill/api_methods')->hasRefund($merchandAccount);
|
52 |
+
|
53 |
+
return count($result) > 0;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Check partial refund availability for invoice
|
58 |
+
*
|
59 |
+
* @return bool
|
60 |
+
*/
|
61 |
+
public function canRefundPartialPerInvoice()
|
62 |
+
{
|
63 |
+
$payment = $this->getInfoInstance();
|
64 |
+
$merchandAccount = $payment->getAdditionalInformation('account');
|
65 |
+
$result = Mage::getModel('be2bill/api_methods')->hasRefundPartial($merchandAccount);
|
66 |
+
|
67 |
+
return count($result) > 0;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @param string $paymentAction
|
72 |
+
* @param Varien_Object $stateObject
|
73 |
+
* @return Mage_Payment_Model_Method_Abstract
|
74 |
+
*/
|
75 |
+
public function initialize($paymentAction, $stateObject)
|
76 |
+
{
|
77 |
+
return $this;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @return boolean
|
82 |
+
*/
|
83 |
+
public function isInitializeNeeded()
|
84 |
+
{
|
85 |
+
if ($this->getConfigPaymentAction() == self::ACTION_AUTHORIZE)
|
86 |
+
return false;
|
87 |
+
return true;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function authorize(Varien_Object $payment, $amount)
|
91 |
+
{
|
92 |
+
parent::authorize($payment, $amount);
|
93 |
+
if ($this->getConfigPaymentAction() == self::ACTION_AUTHORIZE) {
|
94 |
+
$payment->setIsTransactionPending(1);
|
95 |
+
}
|
96 |
+
return $this;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Assign data to info model instance
|
101 |
+
*
|
102 |
+
* @param mixed $data
|
103 |
+
* @return Mage_Payment_Model_Method_Purchaseorder
|
104 |
+
*/
|
105 |
+
public function assignData($data)
|
106 |
+
{
|
107 |
+
parent::assignData($data);
|
108 |
+
|
109 |
+
if (!($data instanceof Varien_Object)) {
|
110 |
+
$data = new Varien_Object($data);
|
111 |
+
}
|
112 |
+
|
113 |
+
//Sécurité est ce que le client à bien selectionné une methode de paiement Be2bill générique
|
114 |
+
if (!isset($data['be2bill_method'])) {
|
115 |
+
Mage::log('Erreur 1 de securite : Le client n a pas selectionne un methode de paiement generique be2bill', null, 'be2bill_erreur_securite.log', true);
|
116 |
+
Mage::log($data, null, 'be2bill_erreur_securite.log', true);
|
117 |
+
Mage::log('Fin Erreur 1', null, 'be2bill_erreur_securite.log', true);
|
118 |
+
|
119 |
+
Mage::throwException(Mage::helper('be2bill')->__('Veuillez vérifier le choix de votre moyen de paiement'));
|
120 |
+
return;
|
121 |
+
}
|
122 |
+
|
123 |
+
$infos = explode('.', $data['be2bill_method']);
|
124 |
+
$accountId = $infos[0];
|
125 |
+
$account = $infos[1];
|
126 |
+
$option = $infos[2];
|
127 |
+
|
128 |
+
if (count($infos) != 3) { //Sécurité
|
129 |
+
Mage::log('Erreur 2 de securite : il manque un parametre pour le choix de la methode de paiement be2bill', null, 'be2bill_erreur_securite.log', true);
|
130 |
+
Mage::log($data, null, 'be2bill_erreur_securite.log', true);
|
131 |
+
Mage::log('Fin Erreur 2', null, 'be2bill_erreur_securite.log', true);
|
132 |
+
|
133 |
+
Mage::throwException(Mage::helper('be2bill')->__('Veuillez vérifier le choix de votre moyen de paiement'));
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
+
$currency = $this->getQuote()->getData('quote_currency_code');
|
138 |
+
$country = $this->getQuote()->getBillingAddress()->getData('country_id');
|
139 |
+
$storeId = $this->getQuote()->getData('store_id');
|
140 |
+
$recurring = $this->getQuote()->isNominal();
|
141 |
+
//Sécurité
|
142 |
+
$checkCol = Mage::getModel('be2bill/merchandconfigurationaccount')->checkAvailablePaymentOption($currency, $country, $storeId, $recurring, $accountId, $account, $option);
|
143 |
+
if (count($checkCol) < 1) { //Sécurité
|
144 |
+
Mage::log('Erreur 3 de securite : Le moyen de paiement selectionne ne semble pas etre active', null, 'be2bill_erreur_securite.log', true);
|
145 |
+
Mage::log($data, null, 'be2bill_erreur_securite.log', true);
|
146 |
+
Mage::log('Fin Erreur 3', null, 'be2bill_erreur_securite.log', true);
|
147 |
+
|
148 |
+
Mage::throwException(Mage::helper('be2bill')->__('Veuillez vérifier le choix de votre moyen de paiement'));
|
149 |
+
return;
|
150 |
+
}
|
151 |
+
|
152 |
+
$merchand = Mage::getModel('be2bill/merchandconfigurationaccount')->load($accountId);
|
153 |
+
|
154 |
+
$this->getInfoInstance()->setAdditionalInformation('account_id', $accountId);
|
155 |
+
$this->getInfoInstance()->setAdditionalInformation('account', $account);
|
156 |
+
$this->getInfoInstance()->setAdditionalInformation('options', $option);
|
157 |
+
|
158 |
+
$info = $data[$data['be2bill_method']];
|
159 |
+
|
160 |
+
$this->getInfoInstance()->setAdditionalInformation('create_oneclick', isset($info['oneclick']) && $info['oneclick'] == "create_oneclick" ? "yes" : "no");
|
161 |
+
$this->getInfoInstance()->setAdditionalInformation('use_oneclick', isset($info['oneclick']) && $info['oneclick'] == "use_oneclick" ? "yes" : "no");
|
162 |
+
$this->getInfoInstance()->setAdditionalInformation('cvv_oneclick', isset($info['cvv_oneclick']) ? trim($info['cvv_oneclick']) : '');
|
163 |
+
|
164 |
+
|
165 |
+
if(array_key_exists('label', $info)){
|
166 |
+
$this->getInfoInstance()->setAdditionalInformation('be2bill_method_label', $info['label']);
|
167 |
+
}
|
168 |
+
|
169 |
+
if(array_key_exists('identificationdocid', $info)){
|
170 |
+
$identDocId = $info['identificationdocid'];
|
171 |
+
//test sécurité : longueur > 8 & < 65
|
172 |
+
if (strlen($identDocId) < 8 || strlen($identDocId) > 64){
|
173 |
+
Mage::log('Erreur 4 de securite : le nbre de caracteres "identificationdocid" n est pas correcte (entre 8 et 64)', null, 'be2bill_erreur_securite.log', true);
|
174 |
+
Mage::log($data, null, 'be2bill_erreur_securite.log', true);
|
175 |
+
Mage::log('Fin Erreur 4', null, 'be2bill_erreur_securite.log', true);
|
176 |
+
|
177 |
+
Mage::throwException(Mage::helper('be2bill')->__('Veuillez vérifier le choix de votre moyen de paiement'));
|
178 |
+
}
|
179 |
+
|
180 |
+
$this->getInfoInstance()->setAdditionalInformation('identificationdocid', $info['identificationdocid']);
|
181 |
+
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
if(isset($data['be2bill_method_label'])){
|
186 |
+
$this->getInfoInstance()->setAdditionalInformation('be2bill_method_label', $data['be2bill_method_label']);
|
187 |
+
}
|
188 |
+
|
189 |
+
switch ($option) {
|
190 |
+
case 'defered':
|
191 |
+
case 'delivery':
|
192 |
+
$operation = self::OPERATION_TYPE_AUTH;
|
193 |
+
$action = self::ACTION_AUTHORIZE;
|
194 |
+
break;
|
195 |
+
|
196 |
+
case 'capture':
|
197 |
+
$operation = self::OPERATION_TYPE_CAPTURE;
|
198 |
+
$action = self::ACTION_AUTHORIZE_CAPTURE;
|
199 |
+
break;
|
200 |
+
|
201 |
+
case 'standard':
|
202 |
+
default :
|
203 |
+
$operation = self::OPERATION_TYPE_PAYMENT;
|
204 |
+
$action = self::ACTION_AUTHORIZE_CAPTURE;
|
205 |
+
break;
|
206 |
+
}
|
207 |
+
|
208 |
+
if ($option == 'ntimes') {
|
209 |
+
$this->getInfoInstance()->setAdditionalInformation('ntimes', $merchand->getNtimes());
|
210 |
+
} else if ($option == 'defered') { //si paiement différé alors on stock le nombre de jour différé
|
211 |
+
$this->getInfoInstance()->setAdditionalInformation('defered-days', true);
|
212 |
+
} else if ($option == 'delivery') { //si paiement à la livraison
|
213 |
+
$this->getInfoInstance()->setAdditionalInformation('delivery', true);
|
214 |
+
}
|
215 |
+
|
216 |
+
$this->getInfoInstance()->setAdditionalInformation('operation', $operation);
|
217 |
+
$this->getInfoInstance()->setAdditionalInformation('action', $action);
|
218 |
+
$this->getInfoInstance()->setAdditionalInformation('mode', $merchand->getData('b2b_xml_mode_code'));
|
219 |
+
|
220 |
+
if ((isset($info['oneclick']) && $info['oneclick'] == "use_oneclick") && $colAlias = $this->getQuote()->getCustomer()->getAliasByMerchandAccount($accountId)) {
|
221 |
+
$this->getInfoInstance()->setAdditionalInformation('alias', $colAlias->getData('alias'));
|
222 |
+
} else {
|
223 |
+
$this->getInfoInstance()->setAdditionalInformation('alias', null);
|
224 |
+
}
|
225 |
+
|
226 |
+
return $this;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Test si OneClick
|
231 |
+
*
|
232 |
+
* @return boolean
|
233 |
+
*/
|
234 |
+
public function isOneClickMode()
|
235 |
+
{
|
236 |
+
if ($this->getInfoInstance()->getAdditionalInformation('use_oneclick') == 'yes') {
|
237 |
+
return true;
|
238 |
+
}
|
239 |
+
|
240 |
+
return false;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* @deprecated
|
245 |
+
*/
|
246 |
+
public function isPaypalMode()
|
247 |
+
{
|
248 |
+
if ($this->getInfoInstance()->getAdditionalInformation('account') == 'paypal') {
|
249 |
+
return true;
|
250 |
+
}
|
251 |
+
|
252 |
+
return false;
|
253 |
+
}
|
254 |
+
|
255 |
+
public function getConfigPaymentAction()
|
256 |
+
{
|
257 |
+
return $this->getInfoInstance()->getAdditionalInformation('action');
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Get be2bill session namespace
|
262 |
+
*
|
263 |
+
* @return Quadra_Be2bill_Model_Session
|
264 |
+
*/
|
265 |
+
public function getSession()
|
266 |
+
{
|
267 |
+
return Mage::getSingleton('be2bill/session');
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Get checkout session namespace
|
272 |
+
*
|
273 |
+
* @return Mage_Checkout_Model_Session
|
274 |
+
*/
|
275 |
+
public function getCheckout()
|
276 |
+
{
|
277 |
+
return Mage::getSingleton('checkout/session');
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
*
|
282 |
+
* @param float $amount
|
283 |
+
*/
|
284 |
+
public function unFormatAmount($amount)
|
285 |
+
{
|
286 |
+
return $amount / 100;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
*
|
291 |
+
* @param float $amount
|
292 |
+
*/
|
293 |
+
public function formatAmount($amount)
|
294 |
+
{
|
295 |
+
return round($amount, 2) * 100;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Get current quote
|
300 |
+
*
|
301 |
+
* @return Mage_Sales_Model_Quote
|
302 |
+
*/
|
303 |
+
public function getQuote()
|
304 |
+
{
|
305 |
+
return $this->getCheckout()->getQuote();
|
306 |
+
}
|
307 |
+
|
308 |
+
public function getOrderPlaceRedirectUrl()
|
309 |
+
{
|
310 |
+
$mode = $this->getInfoInstance()->getAdditionalInformation('mode');
|
311 |
+
|
312 |
+
if ($this->isOneClickMode() && $this->getQuote()->isNominal()) {
|
313 |
+
return false;
|
314 |
+
}
|
315 |
+
|
316 |
+
if ($this->isOneClickMode()) {
|
317 |
+
return Mage::getUrl('be2bill/payments/oneclick', array('_secure' => true));
|
318 |
+
}
|
319 |
+
|
320 |
+
if ($mode == 'directlink') {
|
321 |
+
return Mage::getUrl('be2bill/payments/directlink', array('_secure' => true));
|
322 |
+
}
|
323 |
+
|
324 |
+
if ($mode == 'form' || $mode == 'direct-submit') {
|
325 |
+
return Mage::getUrl('be2bill/payments/redirect', array('_secure' => true));
|
326 |
+
} else if ($mode == 'form-iframe') {
|
327 |
+
return 'javascript:void(0)';
|
328 |
+
}
|
329 |
+
|
330 |
+
return false;
|
331 |
+
}
|
332 |
+
|
333 |
+
public function generateHASH($params, $password , $paramsNoHash = null)
|
334 |
+
{
|
335 |
+
return $this->getApi()->generateHASH($params, $password, $paramsNoHash);
|
336 |
+
}
|
337 |
+
|
338 |
+
public function getRedirectUrl()
|
339 |
+
{
|
340 |
+
$mode = null;
|
341 |
+
if ($this->getOrder()) {
|
342 |
+
$mode = $this->getOrder()->getPayment()->getAdditionalInformation('mode');
|
343 |
+
}
|
344 |
+
return $this->getApi()->getRedirectUrl($mode);
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Retourne la liste des parametres pour l'envoi à be2bill
|
349 |
+
*/
|
350 |
+
public function getCheckoutFormFields()
|
351 |
+
{
|
352 |
+
$params = $this->getParameters();
|
353 |
+
$this->_debug($params);
|
354 |
+
return $params;
|
355 |
+
}
|
356 |
+
|
357 |
+
/**
|
358 |
+
*
|
359 |
+
* Lors de la facturation de la commande dans l'admin
|
360 |
+
* @see Mage_Payment_Model_Method_Abstract::capture()
|
361 |
+
* @param Varien_Object $payment
|
362 |
+
* @param float $amount
|
363 |
+
*
|
364 |
+
* @return Mage_Payment_Model_Abstract
|
365 |
+
*/
|
366 |
+
public function capture($payment, $amount)
|
367 |
+
{
|
368 |
+
parent::capture($payment, $amount);
|
369 |
+
if ($this->isOneClickMode() && $this->getConfigPaymentAction() == self::ACTION_AUTHORIZE_CAPTURE) {
|
370 |
+
//$this->oneclick($payment, $amount);
|
371 |
+
} elseif ($this->getConfigPaymentAction() == self::ACTION_AUTHORIZE) {
|
372 |
+
$this->_currentOperationType = self::OPERATION_TYPE_CAPTURE;
|
373 |
+
$params = $this->getParameters($payment->getOrder(), $this->_currentOperationType, $amount);
|
374 |
+
$this->_debug($params);
|
375 |
+
$service = $this->getApi();
|
376 |
+
// @var $response Quadra_Be2bill_Model_Api_Response
|
377 |
+
$response = $service->send($this->_currentOperationType, $params);
|
378 |
+
$this->_debug($response);
|
379 |
+
if (!$response->isSuccess()) {
|
380 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
381 |
+
Mage::throwException("Error code: " . $response->getExecCode() . " " . $response->getMessage());
|
382 |
+
} else {
|
383 |
+
$payment->setIsPaid(1);
|
384 |
+
$payment->setTransactionId($response->getTransactionId());
|
385 |
+
$payment->setIsTransactionClosed(0);
|
386 |
+
|
387 |
+
//ajout du detail de la transaction pour les remboursement
|
388 |
+
$aResponse = $response->getData();
|
389 |
+
if(isset($aResponse['amount'])){
|
390 |
+
$aResponse['amount'] = Mage::helper('core')->currency($aResponse['amount']/100, true, false);
|
391 |
+
}
|
392 |
+
else{
|
393 |
+
$aResponse['amount'] = Mage::helper('core')->currency($amount, true, false);
|
394 |
+
}
|
395 |
+
$payment->setTransactionAdditionalInfo(
|
396 |
+
array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $aResponse), $payment->getParentTransactionId()
|
397 |
+
);
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
return $this;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* Checkout redirect URL getter for onepage checkout (hardcode)
|
406 |
+
*
|
407 |
+
* @see Mage_Checkout_OnepageController::savePaymentAction()
|
408 |
+
* @see Mage_Sales_Model_Quote_Payment::getCheckoutRedirectUrl()
|
409 |
+
* @return string
|
410 |
+
*/
|
411 |
+
public function getCheckoutRedirectUrl()
|
412 |
+
{
|
413 |
+
return '';
|
414 |
+
}
|
415 |
+
|
416 |
+
public function getOrder()
|
417 |
+
{
|
418 |
+
/* @var $order Mage_Sales_Model_Order */
|
419 |
+
$orderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
420 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
421 |
+
|
422 |
+
|
423 |
+
if (!$order->getId()) {
|
424 |
+
return false;
|
425 |
+
}
|
426 |
+
|
427 |
+
return $order;
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Retourne un tableau de paramètres pour l'api Be2bill
|
432 |
+
*
|
433 |
+
* Les paramètres servent pour le remboursement
|
434 |
+
*
|
435 |
+
* @param Mage_Sales_Model_Order $order
|
436 |
+
* @param string $operation
|
437 |
+
* @param float $amount
|
438 |
+
* @return array $params
|
439 |
+
*/
|
440 |
+
public function getParameters($order = null, $operation = null, $amount = null, $miraklOrderId = null, &$paramsNoHash = null)
|
441 |
+
{
|
442 |
+
//Profil recurrent (nominal)
|
443 |
+
//Si la personne passe comme d'un profil R sans alias : il faut lui en créer un
|
444 |
+
if (($profileIds = $this->getCheckout()->getLastRecurringProfileIds())) {
|
445 |
+
if (is_array($profileIds)) {
|
446 |
+
return $this->getParametersForCreateAliasWithoutOrder($profileIds, " - (Alias creation for recurring payment)");
|
447 |
+
}
|
448 |
+
Mage::throwException("An error occured. Profile Ids not present!");
|
449 |
+
}
|
450 |
+
if ($order == null) {
|
451 |
+
$order = $this->getOrder();
|
452 |
+
//$order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true);
|
453 |
+
//$order->save();
|
454 |
+
}
|
455 |
+
|
456 |
+
$payment = $order->getPayment();
|
457 |
+
$addInfo = $payment->getAdditionalInformation();
|
458 |
+
|
459 |
+
$merchand = Mage::getModel('be2bill/merchandconfigurationaccount')->load($addInfo['account_id']);
|
460 |
+
if ($operation != null) {
|
461 |
+
$addInfo['operation'] = $operation;
|
462 |
+
}
|
463 |
+
|
464 |
+
//tableau des parametre à ne pas prendre en compte pour le calcul du hash
|
465 |
+
if($paramsNoHash == null)
|
466 |
+
$paramsNoHash = array();
|
467 |
+
|
468 |
+
$params = $merchand->getDefaultParameters($order, $addInfo, $amount, $miraklOrderId, $paramsNoHash);
|
469 |
+
$params = Mage::getModel('be2bill/merchandconfigurationaccountoptions')->setOptionsParameters($addInfo['operation'], $params, $addInfo['account']);
|
470 |
+
|
471 |
+
|
472 |
+
if ($operation != self::OPERATION_TYPE_REFUND && $operation != self::OPERATION_TYPE_CAPTURE) {
|
473 |
+
$amount = $order->getBaseGrandTotal();
|
474 |
+
$extra_options = Mage::getModel('be2bill/api_methods')->getExtraOptions($addInfo['account_id']);
|
475 |
+
if ($extra_options && is_array($extra_options)) {
|
476 |
+
foreach ($extra_options as $extra) {
|
477 |
+
$available = true;
|
478 |
+
if ($extra['b2b_xml_option'] == '3dsecure') {
|
479 |
+
$available = $this->_available3dSecure($extra, $order, $amount);
|
480 |
+
}
|
481 |
+
if ($available) {
|
482 |
+
$params = Mage::getModel('be2bill/merchandconfigurationaccountoptions')->setOptionsParameters($extra['b2b_xml_option'], $params, $addInfo);
|
483 |
+
}
|
484 |
+
}
|
485 |
+
}
|
486 |
+
|
487 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
488 |
+
if ($addInfo['cvv_oneclick'] != null) {
|
489 |
+
$params = Mage::getModel('be2bill/merchandconfigurationaccountoptions')->setOptionsParameters('oneclickcvv', $params, $addInfo);
|
490 |
+
} else {
|
491 |
+
$params = Mage::getModel('be2bill/merchandconfigurationaccountoptions')->setOptionsParameters('oneclick', $params, $addInfo);
|
492 |
+
}
|
493 |
+
unset($params['DISPLAYCREATEALIAS']);
|
494 |
+
unset($params['CREATEALIAS']);
|
495 |
+
unset($params['HIDECLIENTEMAIL']);
|
496 |
+
unset($params['HIDECARDFULLNAME']);
|
497 |
+
}
|
498 |
+
|
499 |
+
|
500 |
+
if ($addInfo['options'] == 'ntimes') {
|
501 |
+
$params = Mage::getModel('be2bill/merchandconfigurationaccountoptions')->setOptionsParameters('ntimes', $params, $addInfo);
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
$params['HASH'] = $this->generateHASH($params, $merchand->getData('password'), $paramsNoHash);
|
506 |
+
|
507 |
+
ksort($params);
|
508 |
+
return $params;
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Verifie si L'option 3D secure peux etre utilisée.
|
513 |
+
*
|
514 |
+
* @param array $extra
|
515 |
+
* @param Mage_Sales_Model_Order $order
|
516 |
+
* @param float $amount
|
517 |
+
* @return boolean $available
|
518 |
+
*/
|
519 |
+
protected function _available3dSecure($extra, $order, $amount)
|
520 |
+
{
|
521 |
+
$shippingAdd = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
|
522 |
+
|
523 |
+
$available = true;
|
524 |
+
//test montant minimum & maximum
|
525 |
+
if ((float) $extra['min_amount'] && $amount < (float) $extra['min_amount']) {
|
526 |
+
$available = false;
|
527 |
+
}
|
528 |
+
if ((float) $extra['max_amount'] && $amount > (float) $extra['max_amount']) {
|
529 |
+
$available = false;
|
530 |
+
}
|
531 |
+
|
532 |
+
if ($extra['active'] == 1) { //Pour 3d secure il deux types d'activation : le full 3d secure active=2 et le selective active=1
|
533 |
+
$tabValues = unserialize($extra['b2b_xml_option_extra']);
|
534 |
+
|
535 |
+
if ($shippingAdd->getCountry() == 'FR') {
|
536 |
+
//Verification du code Postale
|
537 |
+
$allowedPostcode = array_filter(explode(',', $tabValues['postcode']));
|
538 |
+
|
539 |
+
if (!empty($allowedPostcode)) {
|
540 |
+
$postcode = $shippingAdd->getPostcode();
|
541 |
+
$find = false;
|
542 |
+
foreach ($allowedPostcode as $pc) {
|
543 |
+
if (strlen($pc) == 5) {
|
544 |
+
if ($pc == $postcode) {
|
545 |
+
$find = $pc;
|
546 |
+
break;
|
547 |
+
}
|
548 |
+
} else {
|
549 |
+
if (preg_match("/^{$pc}/", $postcode)) {
|
550 |
+
$find = $pc;
|
551 |
+
break;
|
552 |
+
}
|
553 |
+
}
|
554 |
+
}
|
555 |
+
if (!$find) {
|
556 |
+
$available = false;
|
557 |
+
}
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
//Verification du pays
|
562 |
+
$tabValues['country_iso'] = array_filter($tabValues['country_iso']);
|
563 |
+
if (!empty($tabValues['country_iso']) && $tabValues['country_iso'] != '') {
|
564 |
+
if (!in_array($shippingAdd->getCountryId(), $tabValues['country_iso'])) {
|
565 |
+
$available = false;
|
566 |
+
}
|
567 |
+
}
|
568 |
+
|
569 |
+
//Verification de la method de livraison
|
570 |
+
$tabValues['shipping_method'] = array_filter($tabValues['shipping_method']);
|
571 |
+
if (!empty($tabValues['shipping_method']) && $tabValues['shipping_method'] != '') {
|
572 |
+
if (!in_array($order->getData('shipping_method'), $tabValues['shipping_method'])) {
|
573 |
+
$available = false;
|
574 |
+
}
|
575 |
+
}
|
576 |
+
}
|
577 |
+
return $available;
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Send directlink
|
582 |
+
*
|
583 |
+
* @param Varien_Object $invoicePayment
|
584 |
+
* @return Mage_Payment_Model_Abstract
|
585 |
+
*/
|
586 |
+
public function directlink(Varien_Object $payment, $amount)
|
587 |
+
{
|
588 |
+
$params = $this->getParameters();
|
589 |
+
$service = $this->getApi();
|
590 |
+
$debugData = array_merge($params, array("method" => __METHOD__));
|
591 |
+
$this->_debug($debugData);
|
592 |
+
$response = $service->send($payment->getAdditionalInformation('operation'), $params);
|
593 |
+
|
594 |
+
$this->_debug($response);
|
595 |
+
return $response;
|
596 |
+
}
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Send Oneclick
|
600 |
+
*
|
601 |
+
* @param Varien_Object $invoicePayment
|
602 |
+
* @return Mage_Payment_Model_Abstract
|
603 |
+
*/
|
604 |
+
public function oneclick(Varien_Object $payment, $amount)
|
605 |
+
{
|
606 |
+
$params = $this->getParameters();
|
607 |
+
$service = $this->getApi();
|
608 |
+
$debugData = array_merge($params, array("method" => __METHOD__));
|
609 |
+
$this->_debug($debugData);
|
610 |
+
$response = $service->send($payment->getAdditionalInformation('operation'), $params);
|
611 |
+
$this->setData('response', $response);
|
612 |
+
|
613 |
+
$this->_debug($response);
|
614 |
+
|
615 |
+
if (!$response->isSuccess()) {
|
616 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
617 |
+
Mage::throwException("Error code: " . $response->getExeccode() . " " . $response->getMessage());
|
618 |
+
} else {
|
619 |
+
$this->responseToPayment($payment, $response);
|
620 |
+
}
|
621 |
+
|
622 |
+
return $this;
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Get be2bill api service
|
627 |
+
*
|
628 |
+
* @return Quadra_Be2bill_Model_Api_Service
|
629 |
+
*/
|
630 |
+
public function getApi()
|
631 |
+
{
|
632 |
+
return Mage::getSingleton('be2bill/api_service', array('methodInstance' => $this));
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Define if debugging is enabled
|
637 |
+
*
|
638 |
+
* @return bool
|
639 |
+
*/
|
640 |
+
public function getDebugFlag()
|
641 |
+
{
|
642 |
+
return Mage::getStoreConfig('be2bill/be2bill_api/debug');
|
643 |
+
}
|
644 |
+
|
645 |
+
/**
|
646 |
+
* Used to call debug method from not Payment Method context
|
647 |
+
*
|
648 |
+
* @param mixed $debugData
|
649 |
+
*/
|
650 |
+
public function debugData($debugData)
|
651 |
+
{
|
652 |
+
$this->_debug($debugData);
|
653 |
+
}
|
654 |
+
|
655 |
+
/**
|
656 |
+
* Log debug data to file
|
657 |
+
*
|
658 |
+
* @param mixed $debugData
|
659 |
+
*/
|
660 |
+
protected function _debug($debugData)
|
661 |
+
{
|
662 |
+
if ($this->getDebugFlag()) {
|
663 |
+
Mage::getModel('be2bill/log_adapter', 'payment_' . $this->getCode() . '.log')
|
664 |
+
->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
|
665 |
+
->log($debugData);
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
public function ipnPostSubmit()
|
670 |
+
{
|
671 |
+
if (!$this->hasResponse()) {
|
672 |
+
Mage::throwException("NO Response in IPN");
|
673 |
+
}
|
674 |
+
|
675 |
+
$this->_debug($this->getResponse()->setData("method", __METHOD__));
|
676 |
+
|
677 |
+
$order = Mage::getModel('sales/order');
|
678 |
+
$order->loadByIncrementId($this->getResponse()->getIncrementId());
|
679 |
+
if (!$order->getId() && strpos($this->getResponse()->getIncrementId(), 'recurring') === false) {
|
680 |
+
Mage::throwException("NO Order Found!");
|
681 |
+
}
|
682 |
+
if (strpos($this->getResponse()->getIncrementId(), 'recurring') !== false) {
|
683 |
+
list( $action, $type, $profileId ) = explode("-", $this->getResponse()->getIncrementId());
|
684 |
+
|
685 |
+
if ($profileId) {
|
686 |
+
/* @var $profile Mage_Sales_Model_Recurring_Profile */
|
687 |
+
$profile = Mage::getModel('sales/recurring_profile')->load($profileId);
|
688 |
+
if ($profile->getId()) {
|
689 |
+
$customer = Mage::getModel('customer/customer')->load($profile->getCustomerId());
|
690 |
+
if ($customer->getId()) {
|
691 |
+
$orderInfo = $profile->getOrderInfo();
|
692 |
+
$quote = Mage::getModel('sales/quote')->load($orderInfo['entity_id']);
|
693 |
+
$addInfoPayment = $quote->getPayment()->getAdditionalInformation();
|
694 |
+
$this->responseToCustomerAlias($customer, $addInfoPayment['account_id']);
|
695 |
+
if ($action == 'create' || $action == "payment") {
|
696 |
+
$this->createProfileOrder($profile, $this->getResponse());
|
697 |
+
}
|
698 |
+
return $this;
|
699 |
+
}
|
700 |
+
Mage::throwException(Mage::helper('be2bill')->__("Client % D introuvable (récurrent)", $profile->getCustomerId()));
|
701 |
+
}
|
702 |
+
Mage::throwException(Mage::helper('be2bill')->__("Profil ID: %d introuvable (récurrent)", $profileId));
|
703 |
+
}
|
704 |
+
Mage::throwException(Mage::helper('be2bill')->__("Commmande introuvable (récurrent)"));
|
705 |
+
}
|
706 |
+
|
707 |
+
$sendOrderEmail = false;
|
708 |
+
$lastTxnId = $order->getPayment()->getLastTransId();
|
709 |
+
/* @var $payment Mage_Sales_Model_Order_Payment */
|
710 |
+
$payment = $order->getPayment();
|
711 |
+
// need to save transaction id
|
712 |
+
$this->responseToPayment($payment);
|
713 |
+
if ($this->getResponse()->isSuccess() && $this->getResponse()->getTransactionId() != $lastTxnId) {
|
714 |
+
if ($this->getResponse()->hasAlias() && trim($this->getResponse()->getAlias()) != "") {
|
715 |
+
|
716 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
717 |
+
|
718 |
+
if ($customer->getId()) {
|
719 |
+
$this->responseToCustomerAlias($customer, $payment->getAdditionalInformation('account_id'));
|
720 |
+
}
|
721 |
+
}
|
722 |
+
|
723 |
+
switch ($this->getResponse()->getOperationType()) {
|
724 |
+
case self::OPERATION_TYPE_PAYMENT :
|
725 |
+
if ($payment->getAdditionalInformation('options') == 'ntimes' && $order->hasInvoices()) {
|
726 |
+
$order->addStatusToHistory($order->getStatus(), Mage::helper('be2bill')->__('Nouveau débit avec le code % s et le message: % s .', $this->getResponse()->getExecCode(), $this->getResponse()->getMessage()));
|
727 |
+
$order->save();
|
728 |
+
} else {
|
729 |
+
if ($order->isCanceled()) {
|
730 |
+
foreach ($order->getAllItems() as $item) {
|
731 |
+
$item->setQtyCanceled(0);
|
732 |
+
}
|
733 |
+
}
|
734 |
+
$newOrderStatus = "processing";
|
735 |
+
// need to convert from order into invoice
|
736 |
+
$invoice = $order->prepareInvoice();
|
737 |
+
$invoice->register()->capture();
|
738 |
+
Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
|
739 |
+
|
740 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $newOrderStatus, Mage::helper('be2bill')->__('Facture #%s créée', $invoice->getIncrementId()), $notified = true);
|
741 |
+
|
742 |
+
// for compatibility
|
743 |
+
// if(method_exists($payment, 'addTransaction')) {
|
744 |
+
// $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $order);
|
745 |
+
// }
|
746 |
+
$sendOrderEmail = true;
|
747 |
+
}
|
748 |
+
break;
|
749 |
+
case self::OPERATION_TYPE_AUTH :
|
750 |
+
if ($order->isCanceled()) {
|
751 |
+
foreach ($order->getAllItems() as $item) {
|
752 |
+
$item->setQtyCanceled(0);
|
753 |
+
}
|
754 |
+
}
|
755 |
+
$payment->setIsTransactionClosed(0);
|
756 |
+
$payment->authorize(false, $this->unFormatAmount($this->getResponse()->getAmount()));
|
757 |
+
$newOrderStatus = 'pending_be2bill';
|
758 |
+
|
759 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $newOrderStatus, Mage::helper('be2bill')->__("En attende de la capture de la transaction '%s' et de montant %s", $this->getResponse()->getTransactionId(), $order->getBaseCurrency()->formatTxt($order->getBaseTotalDue())), $notified = true);
|
760 |
+
// for compatibility
|
761 |
+
// if(method_exists($payment, 'addTransaction')) {
|
762 |
+
// $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, $order);
|
763 |
+
// }
|
764 |
+
$sendOrderEmail = true;
|
765 |
+
break;
|
766 |
+
default :
|
767 |
+
$order->addStatusToHistory($order->getStatus(), Mage::helper('be2bill')->__('Notification de Be2bill . Type d\'opération : "% s" , la transaction ID: % s , execcode : "% s" , un message: "% s" .', $this->getResponse()->getOperationType(), $this->getResponse()->getTransactionId(), $this->getResponse()->getExecCode(), $this->getResponse()->getMessage()));
|
768 |
+
}
|
769 |
+
$order->save();
|
770 |
+
if ($sendOrderEmail && !$order->getEmailSent() && $order->getCanSendNewEmailFlag()) {
|
771 |
+
try {
|
772 |
+
if (method_exists($order, 'queueNewOrderEmail')) {
|
773 |
+
$order->queueNewOrderEmail();
|
774 |
+
} else {
|
775 |
+
$order->sendNewOrderEmail();
|
776 |
+
}
|
777 |
+
} catch (Exception $e) {
|
778 |
+
Mage::log('ipnPostSubmit 18');
|
779 |
+
Mage::logException($e);
|
780 |
+
}
|
781 |
+
}
|
782 |
+
} elseif ($this->getResponse()->getTransactionId() == "" || $this->getResponse()->getTransactionId() != $lastTxnId) {
|
783 |
+
$order->cancel();
|
784 |
+
$order->addStatusToHistory($order->getStatus(), Mage::helper('be2bill')->__('Erreur lors du traitement du paiement. Code %s ==> %s.', $this->getResponse()->getExecCode(), $this->getResponse()->getMessage()));
|
785 |
+
$order->save();
|
786 |
+
}
|
787 |
+
return $this;
|
788 |
+
}
|
789 |
+
|
790 |
+
/**
|
791 |
+
*
|
792 |
+
* @param Mage_Sales_Model_Recurring_Profile $profile
|
793 |
+
* @param Quadra_Be2bill_Model_Api_Response $response
|
794 |
+
* @return Mage_Sales_Model_Order
|
795 |
+
*/
|
796 |
+
protected function createProfileOrder(Mage_Sales_Model_Recurring_Profile $profile, Quadra_Be2bill_Model_Api_Response $response)
|
797 |
+
{
|
798 |
+
$amount = $this->getAmountFromProfile($profile);
|
799 |
+
$productItemInfo = new Varien_Object;
|
800 |
+
$type = "Regular";
|
801 |
+
|
802 |
+
if ($type == 'Trial') {
|
803 |
+
$productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL);
|
804 |
+
} elseif ($type == 'Regular') {
|
805 |
+
$productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR);
|
806 |
+
}
|
807 |
+
|
808 |
+
if ($this->isInitialProfileOrder($profile)) { // because is not additonned in prodile obj
|
809 |
+
$productItemInfo->setPrice($profile->getBillingAmount() + $profile->getInitAmount());
|
810 |
+
}
|
811 |
+
|
812 |
+
$order = $profile->createOrder($productItemInfo);
|
813 |
+
|
814 |
+
$this->responseToPayment($order->getPayment(), $response);
|
815 |
+
|
816 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($response->getIdentifier(), $order->getStoreId());
|
817 |
+
$order->getPayment()->setAdditionalInformation('b2b_recurring', 1);
|
818 |
+
$order->getPayment()->setAdditionalInformation('account_id', $merchandAccount->getId());
|
819 |
+
$order->getPayment()->setAdditionalInformation('account', $merchandAccount->getData('b2b_xml_account_type_code'));
|
820 |
+
$order->getPayment()->setAdditionalInformation('options', 'standard');
|
821 |
+
$order->getPayment()->setAdditionalInformation('be2bill_method_label', $merchandAccount->getData('configuration_account_name'));
|
822 |
+
|
823 |
+
$order->save();
|
824 |
+
|
825 |
+
$profile->addOrderRelation($order->getId());
|
826 |
+
$order->getPayment()->registerCaptureNotification($amount);
|
827 |
+
$order->save();
|
828 |
+
|
829 |
+
// notify customer
|
830 |
+
if ($invoice = $order->getPayment()->getCreatedInvoice()) {
|
831 |
+
if (!$order->getEmailSent() && $order->getCanSendNewEmailFlag()) {
|
832 |
+
try {
|
833 |
+
if (method_exists($order, 'queueNewOrderEmail')) {
|
834 |
+
$order->queueNewOrderEmail();
|
835 |
+
} else {
|
836 |
+
$order->sendNewOrderEmail();
|
837 |
+
}
|
838 |
+
} catch (Exception $e) {
|
839 |
+
Mage::logException($e);
|
840 |
+
}
|
841 |
+
}
|
842 |
+
$message = Mage::helper('be2bill')->__('Le client à été notifié de la facture #%s.', $invoice->getIncrementId());
|
843 |
+
$comment = $order->addStatusHistoryComment($message)
|
844 |
+
->setIsCustomerNotified(true)
|
845 |
+
->save();
|
846 |
+
|
847 |
+
/* Add this to send invoice to customer */
|
848 |
+
$invoice->setEmailSent(true);
|
849 |
+
$invoice->save();
|
850 |
+
$invoice->sendEmail();
|
851 |
+
}
|
852 |
+
|
853 |
+
return $order;
|
854 |
+
}
|
855 |
+
|
856 |
+
protected function responseToPayment($payment, $response = null)
|
857 |
+
{
|
858 |
+
if (is_null($response)) {
|
859 |
+
$response = $this->getResponse();
|
860 |
+
}
|
861 |
+
|
862 |
+
$payment->setTransactionId($response->getTransactionId());
|
863 |
+
$payment->setCcExpMonth($response->getCcExpMonth());
|
864 |
+
$payment->setCcExpYear($response->getCcExpYear());
|
865 |
+
$payment->setCcOwner($response->getCcOwner());
|
866 |
+
$payment->setCcType($response->getCcType());
|
867 |
+
$payment->setCcStatusDescription($response->getCcStatusDescription());
|
868 |
+
$payment->setCcLast4($response->getCcLast4());
|
869 |
+
$payment->setCcNumberEnc($response->getCcNumberEnc());
|
870 |
+
/**
|
871 |
+
* ajout du detail de la transaction
|
872 |
+
*/
|
873 |
+
|
874 |
+
$aResponse = $response->getData();
|
875 |
+
if(isset($aResponse['amount'])){
|
876 |
+
$aResponse['amount'] = Mage::helper('core')->currency($aResponse['amount']/100, true, false);
|
877 |
+
}
|
878 |
+
$payment->setTransactionAdditionalInfo(
|
879 |
+
array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $aResponse), $response->getTransactionId()
|
880 |
+
);
|
881 |
+
|
882 |
+
return $this;
|
883 |
+
}
|
884 |
+
|
885 |
+
/**
|
886 |
+
* Add method to calculate amount from recurring profile
|
887 |
+
* @param Mage_Sales_Model_Recurring_Profile $profile
|
888 |
+
* @return int $amount
|
889 |
+
* */
|
890 |
+
public function getAmountFromProfile(Mage_Sales_Model_Recurring_Profile $profile)
|
891 |
+
{
|
892 |
+
$amount = $profile->getBillingAmount() + $profile->getTaxAmount() + $profile->getShippingAmount();
|
893 |
+
|
894 |
+
if ($this->isInitialProfileOrder($profile)) {
|
895 |
+
$amount += $profile->getInitAmount();
|
896 |
+
}
|
897 |
+
|
898 |
+
return $amount;
|
899 |
+
}
|
900 |
+
|
901 |
+
protected function isInitialProfileOrder(Mage_Sales_Model_Recurring_Profile $profile)
|
902 |
+
{
|
903 |
+
if (count($profile->getChildOrderIds()) && current($profile->getChildOrderIds()) == "-1") {
|
904 |
+
return true;
|
905 |
+
}
|
906 |
+
|
907 |
+
return false;
|
908 |
+
}
|
909 |
+
|
910 |
+
/**
|
911 |
+
* Si le client a selectionné un produit récurrent et si le client n'a pas d'alias déjà existant.
|
912 |
+
* Retourne un tableau de paramètre pour la création de l'alias
|
913 |
+
*
|
914 |
+
* A Revoir (refacto)
|
915 |
+
* @param array $profileIds
|
916 |
+
* @param string $desc
|
917 |
+
* @return array $params
|
918 |
+
*/
|
919 |
+
public function getParametersForCreateAliasWithoutOrder(array $profileIds, $desc = ' - (Alias creation)')
|
920 |
+
{
|
921 |
+
$this->_currentOperationType = self::OPERATION_TYPE_PAYMENT;
|
922 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
923 |
+
$params['CLIENTIDENT'] = $customer->getId();
|
924 |
+
|
925 |
+
$orderId = 'create-recurring';
|
926 |
+
$amount = 0;
|
927 |
+
|
928 |
+
foreach ($profileIds as $profileId) {
|
929 |
+
/* @var $profile Mage_Sales_Model_Recurring_Profile */
|
930 |
+
$profile = Mage::getModel('sales/recurring_profile')->load($profileId);
|
931 |
+
$orderInfo = $profile->getOrderInfo();
|
932 |
+
$quote = Mage::getModel('sales/quote')->load($orderInfo['entity_id']);
|
933 |
+
$addInfoPayment = $quote->getPayment()->getAdditionalInformation();
|
934 |
+
$merchand = Mage::getModel('be2bill/merchandconfigurationaccount')->load($addInfoPayment['account_id']);
|
935 |
+
$parameters = Mage::getModel('be2bill/api_methods')->getAccountTypeParameters($addInfoPayment['account']);
|
936 |
+
|
937 |
+
foreach ($parameters as $param) {
|
938 |
+
$version = $param['b2b_xml_account_type_parameter_set_version'];
|
939 |
+
break;
|
940 |
+
}
|
941 |
+
|
942 |
+
$orderId .= "-" . $profileId;
|
943 |
+
$amount += $this->getAmountFromProfile($profile);
|
944 |
+
|
945 |
+
$params['IDENTIFIER'] = $merchand->getLogin();
|
946 |
+
$params['DESCRIPTION'] = $addInfoPayment['operation'];
|
947 |
+
$params['VERSION'] = $version;
|
948 |
+
|
949 |
+
break; //because only one nominal item in cart is authorized and be2bill not manage many profiles
|
950 |
+
}
|
951 |
+
|
952 |
+
$params['OPERATIONTYPE'] = $this->_currentOperationType;
|
953 |
+
$params['ORDERID'] = $orderId;
|
954 |
+
$params['AMOUNT'] = $this->formatAmount($amount);
|
955 |
+
$params['CLIENTEMAIL'] = $customer->getEmail();
|
956 |
+
$params['FIRSTNAME'] = $customer->getFirstname();
|
957 |
+
$params['LASTNAME'] = $customer->getLastname();
|
958 |
+
$params['3DSECURE'] = $this->getConfigData('use_3dsecure') ? "yes" : "no";
|
959 |
+
$params['CREATEALIAS'] = "yes";
|
960 |
+
$params['DESCRIPTION'] = $parameters['DESCRIPTION'] . $desc;
|
961 |
+
$params['HIDECLIENTEMAIL'] = $this->getConfigData('hide_client_email') ? 'yes' : 'no';
|
962 |
+
$params['HIDECARDFULLNAME'] = $this->getConfigData('hide_card_fullname') ? 'yes' : 'no';
|
963 |
+
$params['HASH'] = $this->generateHASH($params, $merchand->getData('password'));
|
964 |
+
|
965 |
+
return $params;
|
966 |
+
}
|
967 |
+
|
968 |
+
/**
|
969 |
+
* A Revoir (refacto)
|
970 |
+
* Appeler par l'observer pour les paiements reccurents
|
971 |
+
* @param Mage_Sales_Model_Recurring_Profile $profile
|
972 |
+
* @return Quadra_Be2bill_Model_Method_Abstract
|
973 |
+
*/
|
974 |
+
public function subscription(Mage_Sales_Model_Recurring_Profile $profile)
|
975 |
+
{
|
976 |
+
$this->_currentOperationType = self::OPERATION_TYPE_PAYMENT;
|
977 |
+
$orderInfo = unserialize($profile->getOrderInfo());
|
978 |
+
$additionalInfo = unserialize($profile->getAdditionalInfo());
|
979 |
+
$quote = Mage::getModel('sales/quote')->load($orderInfo['entity_id']);
|
980 |
+
$addInfoPayment = $quote->getPayment()->getAdditionalInformation();
|
981 |
+
$merchand = Mage::getModel('be2bill/merchandconfigurationaccount')->load($addInfoPayment['account_id']);
|
982 |
+
|
983 |
+
$parameters = Mage::getModel('be2bill/api_methods')->getAccountTypeParameters($addInfoPayment['account']);
|
984 |
+
|
985 |
+
foreach ($parameters as $param) {
|
986 |
+
$version = $param['b2b_xml_account_type_parameter_set_version'];
|
987 |
+
break;
|
988 |
+
}
|
989 |
+
|
990 |
+
$amount = $this->getAmountFromProfile($profile);
|
991 |
+
if (!count($profile->getChildOrderIds())) {
|
992 |
+
$amount += $profile->getInitAmount();
|
993 |
+
}
|
994 |
+
|
995 |
+
$params['IDENTIFIER'] = $merchand->getLogin();
|
996 |
+
$params['DESCRIPTION'] = $addInfoPayment['operation'];
|
997 |
+
$params['VERSION'] = $version;
|
998 |
+
$params['CLIENTIP'] = $orderInfo['remote_ip'];
|
999 |
+
$params['CLIENTREFERRER'] = Mage::helper('core/http')->getRequestUri() != '' ? Mage::helper('core/http')->getRequestUri() : 'Unknow';
|
1000 |
+
$params['CLIENTUSERAGENT'] = Mage::helper('core/http')->getHttpUserAgent() != '' ? Mage::helper('core/http')->getHttpUserAgent() : 'Server';
|
1001 |
+
$params['CLIENTIDENT'] = $orderInfo['customer_id'];
|
1002 |
+
$params['CLIENTEMAIL'] = $orderInfo['customer_email'];
|
1003 |
+
$params['ORDERID'] = "payment-recurring-" . $profile->getId();
|
1004 |
+
$params['AMOUNT'] = $this->formatAmount($amount);
|
1005 |
+
$params['DESCRIPTION'] = $params['DESCRIPTION'] . " (Recurring)";
|
1006 |
+
$params['OPERATIONTYPE'] = self::OPERATION_TYPE_PAYMENT;
|
1007 |
+
$params['ALIAS'] = $addInfoPayment['alias'];
|
1008 |
+
$params['ALIASMODE'] = self::OPERATION_TYPE_SUBSCRIPTION;
|
1009 |
+
$params['HASH'] = $this->generateHASH($params, $merchand->getData('password'));
|
1010 |
+
|
1011 |
+
|
1012 |
+
$service = $this->getApi();
|
1013 |
+
$debugData = array_merge($params, array("method" => __METHOD__));
|
1014 |
+
$this->_debug($debugData);
|
1015 |
+
$response = $service->send($this->_currentOperationType, $params);
|
1016 |
+
$this->setData('response', $response);
|
1017 |
+
$this->_debug($response);
|
1018 |
+
|
1019 |
+
if (!$response->isSuccess()) {
|
1020 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
1021 |
+
}
|
1022 |
+
return $this;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
/**
|
1026 |
+
* @return Quadra_Be2bill_Model_Api_Response
|
1027 |
+
*/
|
1028 |
+
public function getResponse()
|
1029 |
+
{
|
1030 |
+
return $this->getData('response');
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
/**
|
1034 |
+
* Creer / MAJ d'un alias pour le client (lier a un moyen de paiement générique be2bill ex : amex)
|
1035 |
+
*
|
1036 |
+
* @param Mage_Customer_Model_Customer $customer
|
1037 |
+
* @param int $merchandAccountId
|
1038 |
+
* @param Object $response
|
1039 |
+
* @return $this
|
1040 |
+
*/
|
1041 |
+
protected function responseToCustomerAlias($customer, $merchandAccountId, $response = null)
|
1042 |
+
{
|
1043 |
+
if (is_null($response)) {
|
1044 |
+
$response = $this->getResponse();
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
$alias = $customer->getAliasByMerchandAccount($merchandAccountId);
|
1048 |
+
if (!$alias->getId()) {
|
1049 |
+
$alias = Mage::getModel('be2bill/alias');
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
$dateEnd = new Zend_Date($response->getCcValidityDate(), 'MM-yy');
|
1053 |
+
$dateEnd->set(1, Zend_Date::DAY)->set(0, Zend_Date::HOUR_SHORT)->set(0, Zend_Date::MINUTE_SHORT);
|
1054 |
+
|
1055 |
+
$alias->setIdCustomer($customer->getId());
|
1056 |
+
$alias->setIdMerchandAccount($merchandAccountId);
|
1057 |
+
$alias->setAlias($response->getAlias());
|
1058 |
+
$alias->setCardType(strtolower($response->getCardtype()));
|
1059 |
+
$alias->setDateEnd($dateEnd);
|
1060 |
+
$alias->setDateAdd(now());
|
1061 |
+
$alias->setCardNumber($response->getCcNumberEnc());
|
1062 |
+
|
1063 |
+
$alias->save();
|
1064 |
+
return $this;
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
/**
|
1068 |
+
* Refund money
|
1069 |
+
*
|
1070 |
+
* @param Varien_Object $payment
|
1071 |
+
* @param float $amount
|
1072 |
+
* @return Mage_Payment_Model_Abstract
|
1073 |
+
*/
|
1074 |
+
public function refund(Varien_Object $payment, $amount)
|
1075 |
+
{
|
1076 |
+
$this->_currentOperationType = self::OPERATION_TYPE_REFUND;
|
1077 |
+
$params = $this->getParameters($payment->getOrder(), $this->_currentOperationType, $amount);
|
1078 |
+
|
1079 |
+
parent::refund($payment, $amount);
|
1080 |
+
|
1081 |
+
$service = $this->getApi();
|
1082 |
+
$this->_debug($params);
|
1083 |
+
|
1084 |
+
$response = $service->send($this->_currentOperationType, $params);
|
1085 |
+
$this->_debug($response);
|
1086 |
+
|
1087 |
+
if (!$response->isSuccess()) {
|
1088 |
+
if ($response->getData('execcode') == '2008') {
|
1089 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('be2bill')->__('Commande réglée en 3x. Veuillez effectuer le remboursement des échéances via l\'Extranet Be2bill'));
|
1090 |
+
} else {
|
1091 |
+
Mage::throwException("Error code: " . $response->getExeccode() . " " . $response->getMessage());
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
1095 |
+
} else {
|
1096 |
+
$payment->setTransactionId($response->getTransactionId());
|
1097 |
+
$payment->setIsTransactionClosed(1);
|
1098 |
+
|
1099 |
+
//Ajout du detail de la transaction pour les rembrousement
|
1100 |
+
$aResponse = $response->getData();
|
1101 |
+
if(isset($aResponse['amount'])){
|
1102 |
+
$aResponse['amount'] = Mage::helper('core')->currency($aResponse['amount']/100, true, false);
|
1103 |
+
}
|
1104 |
+
$payment->setTransactionAdditionalInfo(
|
1105 |
+
array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $aResponse), $payment->getParentTransactionId()
|
1106 |
+
);
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
return $this;
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
/**
|
1113 |
+
* Mirakl
|
1114 |
+
* Capture marketplace products
|
1115 |
+
*
|
1116 |
+
* @param Varien_Object $payment
|
1117 |
+
* @param float $amount
|
1118 |
+
* @return Mage_Payment_Model_Abstract
|
1119 |
+
*/
|
1120 |
+
public function captureMkpProducts($payment, $amount, $miraklOrderId)
|
1121 |
+
{
|
1122 |
+
parent::capture($payment, $amount);
|
1123 |
+
|
1124 |
+
if ($this->isOneClickMode() && $this->getConfigPaymentAction() == self::ACTION_AUTHORIZE_CAPTURE) {
|
1125 |
+
//$this->oneclick($payment, $amount);
|
1126 |
+
} elseif ($this->getConfigPaymentAction() == self::ACTION_AUTHORIZE) {
|
1127 |
+
$order = $payment->getOrder();
|
1128 |
+
$shippingAmount = 0;
|
1129 |
+
|
1130 |
+
if (Mage::helper('mirakl_connector/order')->isFullRemoteOrder($order) && ($amount == ($order->getTotalDue() - $order->getBaseShippingAmount()))) { // Capture also shipping amount
|
1131 |
+
$shippingAmount = $order->getBaseShippingAmount();
|
1132 |
+
$amount += $shippingAmount;
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
$this->_currentOperationType = self::OPERATION_TYPE_CAPTURE;
|
1136 |
+
$paramsNoHash = array();
|
1137 |
+
$params = $this->getParameters($payment->getOrder(), $this->_currentOperationType, $amount , null ,$paramsNoHash);
|
1138 |
+
|
1139 |
+
$addInfo = $payment->getAdditionalInformation();
|
1140 |
+
$extra_options = Mage::getModel('be2bill/api_methods')->getMiraklExtraOptions($addInfo['account_id']);
|
1141 |
+
|
1142 |
+
if ($extra_options && is_array($extra_options)) {
|
1143 |
+
foreach ($extra_options as $extra) {
|
1144 |
+
$optionExtra = unserialize($extra['b2b_xml_option_extra']);
|
1145 |
+
|
1146 |
+
if (array_key_exists('mkp_login', $optionExtra) && !empty($optionExtra['mkp_login'])) {
|
1147 |
+
$params['IDENTIFIER'] = $optionExtra['mkp_login'];
|
1148 |
+
unset($params['HASH']);
|
1149 |
+
$params['HASH'] = $this->generateHASH($params, $optionExtra['mkp_password'],$paramsNoHash);
|
1150 |
+
ksort($params);
|
1151 |
+
break;
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
$this->_debug($params);
|
1157 |
+
|
1158 |
+
$service = $this->getApi();
|
1159 |
+
// @var $response Quadra_Be2bill_Model_Api_Response
|
1160 |
+
$response = $service->send($this->_currentOperationType, $params);
|
1161 |
+
$this->_debug($response);
|
1162 |
+
|
1163 |
+
$this->setResponseIsSuccess($response->isSuccess());
|
1164 |
+
|
1165 |
+
if (!$response->isSuccess()) {
|
1166 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
1167 |
+
} else {
|
1168 |
+
$payment->setIsPaid(1);
|
1169 |
+
$payment->setTransactionId($response->getTransactionId());
|
1170 |
+
$payment->setIsTransactionClosed(0);
|
1171 |
+
|
1172 |
+
//ajout du detail de la transaction pour les remboursement
|
1173 |
+
$aResponseData = $response->getData();
|
1174 |
+
$aResponseData['miraklorderid'] = $miraklOrderId;
|
1175 |
+
$aResponseData['amount'] = Mage::helper('core')->currency($amount, true, false);
|
1176 |
+
$payment->setTransactionAdditionalInfo(
|
1177 |
+
array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $aResponseData),
|
1178 |
+
$payment->getParentTransactionId()
|
1179 |
+
);
|
1180 |
+
$payment->setParentTransactionId($params['TRANSACTIONID']);
|
1181 |
+
$payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $order);
|
1182 |
+
|
1183 |
+
// Update totals
|
1184 |
+
$updateTotals = array(
|
1185 |
+
'amount_paid' => $order->getStore()->convertPrice($amount),
|
1186 |
+
'base_amount_paid' => $amount,
|
1187 |
+
'shipping_captured' => $order->getStore()->convertPrice($shippingAmount),
|
1188 |
+
'base_shipping_captured' => $shippingAmount,
|
1189 |
+
);
|
1190 |
+
|
1191 |
+
foreach ($updateTotals as $key => $newAmount) {
|
1192 |
+
if (null !== $newAmount) {
|
1193 |
+
$was = $payment->getDataUsingMethod($key);
|
1194 |
+
$payment->setDataUsingMethod($key, $was + $newAmount);
|
1195 |
+
}
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
$order->setTotalPaid(
|
1199 |
+
$order->getTotalPaid() + $order->getStore()->convertPrice($amount)
|
1200 |
+
);
|
1201 |
+
$order->setBaseTotalPaid(
|
1202 |
+
$order->getBaseTotalPaid() + $amount
|
1203 |
+
);
|
1204 |
+
|
1205 |
+
$order->save();
|
1206 |
+
}
|
1207 |
+
}
|
1208 |
+
|
1209 |
+
return $this;
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
/**
|
1213 |
+
* Mirakl
|
1214 |
+
* Refund marketplace products
|
1215 |
+
*
|
1216 |
+
* @param Varien_Object $payment
|
1217 |
+
* @param float $amount
|
1218 |
+
* @return Mage_Payment_Model_Abstract
|
1219 |
+
*/
|
1220 |
+
public function refundMkpProducts($payment, $amount, $miraklOrderId)
|
1221 |
+
{
|
1222 |
+
parent::refund($payment, $amount);
|
1223 |
+
|
1224 |
+
$this->_currentOperationType = self::OPERATION_TYPE_REFUND;
|
1225 |
+
|
1226 |
+
$paramsNoHash = array();
|
1227 |
+
$params = $this->getParameters($payment->getOrder(), $this->_currentOperationType, $amount, $miraklOrderId , $paramsNoHash);
|
1228 |
+
|
1229 |
+
$addInfo = $payment->getAdditionalInformation();
|
1230 |
+
$extra_options = Mage::getModel('be2bill/api_methods')->getMiraklExtraOptions($addInfo['account_id']);
|
1231 |
+
|
1232 |
+
if ($extra_options && is_array($extra_options)) {
|
1233 |
+
foreach ($extra_options as $extra) {
|
1234 |
+
$optionExtra = unserialize($extra['b2b_xml_option_extra']);
|
1235 |
+
|
1236 |
+
if (array_key_exists('mkp_login', $optionExtra) && !empty($optionExtra['mkp_login'])) {
|
1237 |
+
$params['IDENTIFIER'] = $optionExtra['mkp_login'];
|
1238 |
+
unset($params['HASH']);
|
1239 |
+
$params['HASH'] = $this->generateHASH($params, $optionExtra['mkp_password'],$paramsNoHash);
|
1240 |
+
ksort($params);
|
1241 |
+
break;
|
1242 |
+
}
|
1243 |
+
}
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
$this->_debug($params);
|
1247 |
+
|
1248 |
+
$service = $this->getApi();
|
1249 |
+
$response = $service->send($this->_currentOperationType, $params);
|
1250 |
+
$this->_debug($response);
|
1251 |
+
|
1252 |
+
$this->setResponseIsSuccess($response->isSuccess());
|
1253 |
+
|
1254 |
+
if (!$response->isSuccess()) {
|
1255 |
+
if ($response->getData('execcode') == '2008') {
|
1256 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('be2bill')->__('Commande réglée en 3x. Veuillez effectuer le remboursement des échéances via l\'Extranet Be2bill'));
|
1257 |
+
}
|
1258 |
+
|
1259 |
+
Mage::logException(new Exception("Response: " . print_r($response->getData(), 1)));
|
1260 |
+
} else {
|
1261 |
+
$order = $payment->getOrder();
|
1262 |
+
|
1263 |
+
$payment->setTransactionId($response->getTransactionId());
|
1264 |
+
$payment->setIsTransactionClosed(1);
|
1265 |
+
|
1266 |
+
//Ajout du detail de la transaction pour les rembrousement
|
1267 |
+
$aResponseData = $response->getData();
|
1268 |
+
$aResponseData['miraklorderid'] = $miraklOrderId;
|
1269 |
+
$aResponseData['amount'] = Mage::helper('core')->currency($amount, true, false);
|
1270 |
+
$payment->setTransactionAdditionalInfo(
|
1271 |
+
array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $aResponseData), $payment->getParentTransactionId()
|
1272 |
+
);
|
1273 |
+
|
1274 |
+
$payment->setParentTransactionId($params['TRANSACTIONID']);
|
1275 |
+
$payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND, $order);
|
1276 |
+
|
1277 |
+
// Update totals
|
1278 |
+
$updateTotals = array(
|
1279 |
+
'amount_refunded' => $order->getStore()->convertPrice($amount),
|
1280 |
+
'base_amount_refunded' => $amount,
|
1281 |
+
'shipping_refunded' => 0,
|
1282 |
+
'base_shipping_refunded' => 0,
|
1283 |
+
);
|
1284 |
+
|
1285 |
+
foreach ($updateTotals as $key => $newAmount) {
|
1286 |
+
if (null !== $newAmount) {
|
1287 |
+
$was = $payment->getDataUsingMethod($key);
|
1288 |
+
$payment->setDataUsingMethod($key, $was + $newAmount);
|
1289 |
+
}
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
$order->setBaseTotalRefunded(
|
1293 |
+
$order->getBaseTotalRefunded() + $amount
|
1294 |
+
);
|
1295 |
+
$order->setTotalRefunded(
|
1296 |
+
$order->getTotalRefunded() + $order->getStore()->convertPrice($amount)
|
1297 |
+
);
|
1298 |
+
$order->save();
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
return $this;
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Method/PaymentMethods.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Method_PaymentMethods extends Quadra_Be2bill_Model_Method_Abstract implements Mage_Payment_Model_Recurring_Profile_MethodInterface
|
21 |
+
{
|
22 |
+
|
23 |
+
protected $_code = 'be2bill';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Checkout redirect URL getter for onepage checkout (hardcode)
|
27 |
+
*
|
28 |
+
* @see Mage_Checkout_OnepageController::savePaymentAction()
|
29 |
+
* @see Mage_Sales_Model_Quote_Payment::getCheckoutRedirectUrl()
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getCheckoutRedirectUrl()
|
33 |
+
{
|
34 |
+
return '';
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Whether can manage recurring profiles
|
39 |
+
*
|
40 |
+
* @return bool
|
41 |
+
*/
|
42 |
+
public function canManageRecurringProfiles()
|
43 |
+
{
|
44 |
+
return parent::canManageRecurringProfiles() && Mage::getSingleton('customer/session')->isLoggedIn();
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Check method for processing with base currency
|
49 |
+
*
|
50 |
+
* @param string $currencyCode
|
51 |
+
* @return boolean
|
52 |
+
*/
|
53 |
+
public function canUseForCurrency($currencyCode)
|
54 |
+
{
|
55 |
+
//if (!in_array($currencyCode, $this->_allowCurrencyCode))
|
56 |
+
// return false;
|
57 |
+
return true;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
|
61 |
+
{
|
62 |
+
if ($this->isOneClickMode()) {
|
63 |
+
$customer = Mage::getSingleton('customer/customer')->load($profile->getCustomerId());
|
64 |
+
if ($customer->getId()) {
|
65 |
+
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
|
66 |
+
$referenceId = $paymentInfo->getAdditionalInformation('alias') . "-" . $profile->getId();
|
67 |
+
$profile->setAdditionalInfo(array("alias" => $customer->getBe2billAlias()));
|
68 |
+
$profile->setReferenceId($referenceId);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
76 |
+
*/
|
77 |
+
public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
78 |
+
{
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @param unknown_type $referenceId
|
84 |
+
* @param Varien_Object $result
|
85 |
+
*/
|
86 |
+
public function getRecurringProfileDetails($referenceId, Varien_Object $result)
|
87 |
+
{
|
88 |
+
return $this;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
*
|
93 |
+
*/
|
94 |
+
public function canGetRecurringProfileDetails()
|
95 |
+
{
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
101 |
+
*/
|
102 |
+
public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
103 |
+
{
|
104 |
+
// TODO: Auto-generated method stub
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
109 |
+
*/
|
110 |
+
public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
|
111 |
+
{
|
112 |
+
return $this;
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Method/Session.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Method_Session extends Mage_Core_Model_Session_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
$this->init('be2bill');
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Observer.php
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_Model_Observer
|
18 |
+
{
|
19 |
+
|
20 |
+
/**
|
21 |
+
*
|
22 |
+
* @param Varien_Event_Observer $observer
|
23 |
+
* @return Mage_Payment_Model_Observer
|
24 |
+
*/
|
25 |
+
public function checkPaymentMethod($observer)
|
26 |
+
{
|
27 |
+
$quote = $observer->getEvent()->getQuote();
|
28 |
+
if ($quote) {
|
29 |
+
$result = $observer->getEvent()->getResult();
|
30 |
+
$methodInstance = $observer->getEvent()->getMethodInstance();
|
31 |
+
if ($methodInstance->getCode() == 'be2bill') {
|
32 |
+
$currency = $quote->getData('quote_currency_code');
|
33 |
+
$country = $quote->getBillingAddress()->getData('country_id');
|
34 |
+
$storeId = $quote->getData('store_id');
|
35 |
+
$res = Mage::getModel('be2bill/merchandconfigurationaccount')->getAvailablePayments($currency, $country, $storeId);
|
36 |
+
if ($res->getSize() > 0) {
|
37 |
+
$result->isAvailable = true;
|
38 |
+
} else {
|
39 |
+
$result->isAvailable = false;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
return $this;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @param int $fromDay
|
49 |
+
* @param int $toDay
|
50 |
+
* @return Mage_Sales_Model_Mysql4_Order_Collection
|
51 |
+
*/
|
52 |
+
protected function getOrdersBySubDay($fromDay, $toDay)
|
53 |
+
{
|
54 |
+
$from = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
|
55 |
+
$from->subDay($fromDay);
|
56 |
+
|
57 |
+
$to = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
|
58 |
+
$to->subDay($toDay);
|
59 |
+
|
60 |
+
$statues = explode(",", Mage::getStoreConfig('payment/be2bill/statues_order_to_clean'));
|
61 |
+
//print_r($statues);
|
62 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
63 |
+
->addFieldToFilter('status', array("in" => $statues))
|
64 |
+
->addFieldTofilter('created_at', array("gteq" => $from->toString(Zend_Date::YEAR . "-" . Zend_Date::MONTH . "-" . Zend_Date::DAY . " " . Zend_Date::TIMES)))
|
65 |
+
->addFieldTofilter('created_at', array("lteq" => $to->toString(Zend_Date::YEAR . "-" . Zend_Date::MONTH . "-" . Zend_Date::DAY . " " . Zend_Date::TIMES)));
|
66 |
+
|
67 |
+
return $orders;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @deprecated deprecated since version 1.0.0
|
72 |
+
* @return Quadra_Be2bill_Model_Observer
|
73 |
+
*/
|
74 |
+
public function addAdminNotification()
|
75 |
+
{
|
76 |
+
$limit_day = (int)Mage::getStoreConfig('be2bill/be2bill_api/auth_validity_day');
|
77 |
+
|
78 |
+
if (!$limit_day) {
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
$orders = $this->getOrdersBySubDay(5, 2);
|
83 |
+
if ($orders->count()) {
|
84 |
+
$inbox = Mage::getModel('adminnotification/inbox');
|
85 |
+
$today = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
|
86 |
+
$formatDate = Zend_Date::YEAR . "-" . Zend_Date::MONTH . "-" . Zend_Date::DAY . " " . Zend_Date::TIMES;
|
87 |
+
$ordersData[] = array(
|
88 |
+
'severity' => 2,
|
89 |
+
'date_added' => $today->toString($formatDate),
|
90 |
+
'title' => Mage::helper('be2bill')->__("Vous avec %s commande(s) à capturer", $orders->count()),
|
91 |
+
'description' => Mage::helper('be2bill')->__("Il y a des commandes en 'attende de capture be2bill' depuis %s jours", 5),
|
92 |
+
'url' => Mage::getUrl('adminhtml/sales_order/'),
|
93 |
+
'internal' => 1,
|
94 |
+
);
|
95 |
+
$inbox->parse(array_reverse($ordersData));
|
96 |
+
}
|
97 |
+
|
98 |
+
$orders = $this->getOrdersBySubDay(2, 1);
|
99 |
+
if ($orders->count()) {
|
100 |
+
$inbox = Mage::getModel('adminnotification/inbox');
|
101 |
+
$today = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
|
102 |
+
$formatDate = Zend_Date::YEAR . "-" . Zend_Date::MONTH . "-" . Zend_Date::DAY . " " . Zend_Date::TIMES;
|
103 |
+
$ordersData[] = array(
|
104 |
+
'severity' => 1,
|
105 |
+
'date_added' => $today->toString($formatDate),
|
106 |
+
'title' => Mage::helper('be2bill')->__("Vous avec %s commande(s) à capturer", $orders->count()),
|
107 |
+
'description' => Mage::helper('be2bill')->__("Il y a des commandes en 'attende de capture be2bill' depuis %s jours", 6),
|
108 |
+
'url' => Mage::getUrl('adminhtml/sales_order/'),
|
109 |
+
'internal' => 1,
|
110 |
+
);
|
111 |
+
$inbox->parse(array_reverse($ordersData));
|
112 |
+
}
|
113 |
+
return $this;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Cancel orders in pending Be2bill because capture is limited to 10 days
|
118 |
+
* @return Quadra_Be2bill_Model_Observer
|
119 |
+
*/
|
120 |
+
public function cleanOrdersInPendingBe2bill()
|
121 |
+
{
|
122 |
+
$limit_day = Mage::getStoreConfig('payment/be2bill/auth_validity_day');
|
123 |
+
|
124 |
+
if (!$limit_day) {
|
125 |
+
return $this;
|
126 |
+
}
|
127 |
+
|
128 |
+
$orders = $this->getOrdersBySubDay(20, 10);
|
129 |
+
|
130 |
+
foreach ($orders as $order) {
|
131 |
+
try {
|
132 |
+
//@var $order Mage_Sales_Model_Order
|
133 |
+
if ($order->canCancel()) {
|
134 |
+
$order->cancel();
|
135 |
+
$order->addStatusToHistory(
|
136 |
+
$order->getStatus(),
|
137 |
+
// keep order status/state
|
138 |
+
Mage::helper('be2bill')->__("Commande annulée par le cron be2bill")
|
139 |
+
);
|
140 |
+
} else {
|
141 |
+
$order->addStatusToHistory(
|
142 |
+
$order->getStatus(),
|
143 |
+
// keep order status/state
|
144 |
+
Mage::helper('be2bill')->__("L'annulation de la commande par le cron Be2bill a échoué")
|
145 |
+
);
|
146 |
+
}
|
147 |
+
$order->save();
|
148 |
+
} catch (Exception $e) {
|
149 |
+
Mage::log($e->getMessage(), null, "be2bill_error_cron.log");
|
150 |
+
Mage::throwException($e->getMessage());
|
151 |
+
}
|
152 |
+
}
|
153 |
+
return $this;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Cancel orders stayed in pending because customer not validated be2bill form
|
158 |
+
*
|
159 |
+
*/
|
160 |
+
public function cancelOrdersInPending()
|
161 |
+
{
|
162 |
+
//Etape 1 : on recupere pour chaque comptes le nombre de jours pour l'annulation
|
163 |
+
$col = Mage::getModel('be2bill/merchandconfigurationaccount')->getCollection();
|
164 |
+
$tabLimitedTime = array();
|
165 |
+
foreach ($col as $obj) {
|
166 |
+
$tabLimitedTime[$obj->getData('id_b2b_merchand_configuration_account')] = $obj->getData('order_canceled_limited_time') != null ? $obj->getData('order_canceled_limited_time') : 0;
|
167 |
+
}
|
168 |
+
|
169 |
+
//Etape 2
|
170 |
+
$collection = Mage::getResourceModel('sales/order_collection')
|
171 |
+
->addFieldToFilter('main_table.state', Mage_Sales_Model_Order::STATE_NEW)
|
172 |
+
->addFieldToFilter('op.method', 'be2bill');
|
173 |
+
$select = $collection->getSelect();
|
174 |
+
$select->joinLeft(array(
|
175 |
+
'op' => Mage::getModel('sales/order_payment')->getResource()->getTable('sales/order_payment')), 'op.parent_id = main_table.entity_id', array('method', 'additional_information')
|
176 |
+
);
|
177 |
+
|
178 |
+
Mage::log((string)$collection->getSelect(), Zend_Log::DEBUG, "debug_clean_pending.log");
|
179 |
+
|
180 |
+
// @var $order Mage_Sales_Model_Order
|
181 |
+
foreach ($collection as $order) {
|
182 |
+
$addInfo = unserialize($order->getData('additional_information'));
|
183 |
+
$accountId = $addInfo['account_id'];
|
184 |
+
$limitedTime = (int)$tabLimitedTime[$accountId];
|
185 |
+
|
186 |
+
if ($limitedTime <= 0) {
|
187 |
+
continue;
|
188 |
+
}
|
189 |
+
|
190 |
+
$store = Mage::app()->getStore($order->getStoreId());
|
191 |
+
$currentStoreDate = Mage::app()->getLocale()->storeDate($store, null, true);
|
192 |
+
$createdAtStoreDate = Mage::app()->getLocale()->storeDate($store, strtotime($order->getCreatedAt()), true);
|
193 |
+
|
194 |
+
$difference = $currentStoreDate->sub($createdAtStoreDate);
|
195 |
+
|
196 |
+
$measure = new Zend_Measure_Time($difference->toValue(), Zend_Measure_Time::SECOND);
|
197 |
+
$measure->convertTo(Zend_Measure_Time::MINUTE);
|
198 |
+
|
199 |
+
if ($limitedTime < $measure->getValue() && $order->canCancel()) {
|
200 |
+
try {
|
201 |
+
$order->cancel();
|
202 |
+
$order->addStatusToHistory($order->getStatus(),
|
203 |
+
// keep order status/state
|
204 |
+
Mage::helper('be2bill')->__("Commande annulée automatique par le cron car la commande est en 'attente' depuis %d minutes", $limitedTime));
|
205 |
+
$order->save();
|
206 |
+
} catch (Exception $e) {
|
207 |
+
Mage::logException($e);
|
208 |
+
}
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
return $this;
|
213 |
+
}
|
214 |
+
|
215 |
+
public function setRedirectUrl($observer)
|
216 |
+
{
|
217 |
+
$quote = $observer->getQuote();
|
218 |
+
$redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl();
|
219 |
+
Mage::getSingleton('checkout/type_onepage')->getCheckout()->setRedirectUrl($redirectUrl);
|
220 |
+
return $this;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Appelé lors de la soumission d'un paiement reccurent
|
225 |
+
* @return Quadra_Be2bill_Model_Observer
|
226 |
+
*/
|
227 |
+
public function submitRecurringProfiles()
|
228 |
+
{
|
229 |
+
$profiles = Mage::getModel('sales/recurring_profile')->getCollection()
|
230 |
+
->addFieldToFilter("state", Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE)
|
231 |
+
->addFieldToFilter("method_code", $this->getBe2bill()->getCode());
|
232 |
+
|
233 |
+
$helper = Mage::helper('be2bill');
|
234 |
+
foreach ($profiles as $profile) {
|
235 |
+
$toSubmit = $helper->isRecurringTosubmit($profile);
|
236 |
+
if ($toSubmit) {
|
237 |
+
$this->getBe2bill()->subscription($profile);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
return $this;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* CRON : Réalise la capture du paiement lorsque la date de création de la commande dépasse le nombre de jour
|
245 |
+
* défini par le Marchand sur le compte de paiement
|
246 |
+
*
|
247 |
+
*/
|
248 |
+
public function submitDeferedOrders()
|
249 |
+
{
|
250 |
+
//Etape 1 : on recupere pour chaque compte le nombre de jour pour la capture
|
251 |
+
$col = Mage::getModel('be2bill/merchandconfigurationaccountoptions')
|
252 |
+
->getCollection()
|
253 |
+
->addFieldToFilter('b2b_xml_option', 'defered')
|
254 |
+
->addFieldToFilter('active', '1');
|
255 |
+
|
256 |
+
$tabAccountDays = array();
|
257 |
+
foreach ($col as $obj) {
|
258 |
+
$tabAccountDays[$obj->getData('id_b2b_merchand_configuration_account')] = unserialize($obj->getData('b2b_xml_option_extra'));
|
259 |
+
}
|
260 |
+
//print_r($tabAccountDays);
|
261 |
+
//Etape 2 : on recupère la collection de commandes
|
262 |
+
$colOrders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', array("in" => 'pending_be2bill'));
|
263 |
+
$colOrders->getSelect()->join(
|
264 |
+
'sales_flat_order_payment', 'main_table.entity_id = sales_flat_order_payment.parent_id', array('additional_information')
|
265 |
+
)
|
266 |
+
->where('additional_information LIKE "%defered-days%"');
|
267 |
+
//echo $colOrders->getSelect();
|
268 |
+
|
269 |
+
foreach ($colOrders as $_order) {
|
270 |
+
$addInfo = unserialize($_order->getData('additional_information'));
|
271 |
+
$days = $tabAccountDays[$addInfo['account_id']];
|
272 |
+
|
273 |
+
$from = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
|
274 |
+
$from->subDay($days);
|
275 |
+
//echo $from->toString(Zend_Date::YEAR . "-" . Zend_Date::MONTH . "-" . Zend_Date::DAY . " " . Zend_Date::TIMES);
|
276 |
+
//echo $orderDate->toString(Zend_Date::YEAR . "-" . Zend_Date::MONTH . "-" . Zend_Date::DAY . " " . Zend_Date::TIMES);
|
277 |
+
$orderDate = new Zend_Date($_order->getData('created_at'));
|
278 |
+
if ($orderDate <= $from) {
|
279 |
+
$order = Mage::getModel('sales/order')->load($_order->getData('entity_id'));
|
280 |
+
$order->getPayment()->capture(null); // Capturing the payment
|
281 |
+
$order->save();
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* @return Quadra_Be2bill_Model_Standard
|
288 |
+
*/
|
289 |
+
public function getBe2bill()
|
290 |
+
{
|
291 |
+
return Mage::getSingleton('be2bill/method_paymentMethods');
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Mirakl
|
296 |
+
* Capture marketplace products
|
297 |
+
*
|
298 |
+
* @param Varien_Event_Observer $observer
|
299 |
+
* @return Quadra_Be2bill_Model_Observer
|
300 |
+
*/
|
301 |
+
public function captureMkpProducts($observer)
|
302 |
+
{
|
303 |
+
$debug = debug_backtrace(false);
|
304 |
+
foreach ($debug as &$data) {
|
305 |
+
unset($data['object']);
|
306 |
+
unset($data['args']);
|
307 |
+
}
|
308 |
+
|
309 |
+
$body = $observer->getEvent()->getBody();
|
310 |
+
$data = json_decode($body, true);
|
311 |
+
|
312 |
+
if (json_last_error() != JSON_ERROR_NONE) {
|
313 |
+
// Data sent in XML
|
314 |
+
$xml = new SimpleXMLElement($body, LIBXML_NOCDATA);
|
315 |
+
$json = json_encode($xml);
|
316 |
+
$data = json_decode($json, true);
|
317 |
+
}
|
318 |
+
|
319 |
+
foreach ($data as $orders) {
|
320 |
+
if (array_key_exists('amount', $orders)) {
|
321 |
+
// Miss a level when data sent in XML
|
322 |
+
$orders = array($orders);
|
323 |
+
}
|
324 |
+
|
325 |
+
foreach ($orders as $orderData) {
|
326 |
+
$order = Mage::getModel('sales/order')->load($orderData['order_commercial_id'], 'increment_id');
|
327 |
+
if ($order->getId()) {
|
328 |
+
try {
|
329 |
+
$payment = $order->getPayment();
|
330 |
+
$methodInstance = $payment->getMethodInstance();
|
331 |
+
$res = $methodInstance->captureMkpProducts($payment, $orderData['amount'], $orderData['order_id']);
|
332 |
+
} catch (Exception $e) {
|
333 |
+
Mage::logException($e);
|
334 |
+
}
|
335 |
+
|
336 |
+
$status = (isset($res) && $res->getResponseIsSuccess()) ? 'OK' : 'REFUSED';
|
337 |
+
|
338 |
+
Mage::dispatchEvent('mirakl_trigger_order_debit', array(
|
339 |
+
'order_id' => $order->getId(),
|
340 |
+
'remote_id' => $orderData['order_id'],
|
341 |
+
'status' => $status
|
342 |
+
));
|
343 |
+
}
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
return $this;
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Mirakl
|
352 |
+
* Refund marketplace products
|
353 |
+
*
|
354 |
+
* @param Varien_Event_Observer $observer
|
355 |
+
* @return Quadra_Be2bill_Model_Observer
|
356 |
+
*/
|
357 |
+
public function refundMkpProducts($observer)
|
358 |
+
{
|
359 |
+
$debug = debug_backtrace(false);
|
360 |
+
foreach ($debug as &$data) {
|
361 |
+
unset($data['object']);
|
362 |
+
unset($data['args']);
|
363 |
+
}
|
364 |
+
|
365 |
+
$body = $observer->getEvent()->getBody();
|
366 |
+
$data = json_decode($body, true);
|
367 |
+
|
368 |
+
if (json_last_error() != JSON_ERROR_NONE) {
|
369 |
+
// Data sent in XML
|
370 |
+
$xml = new SimpleXMLElement($body, LIBXML_NOCDATA);
|
371 |
+
$json = json_encode($xml);
|
372 |
+
$data = json_decode($json, true);
|
373 |
+
}
|
374 |
+
|
375 |
+
foreach ($data as $orders) {
|
376 |
+
if (array_key_exists('amount', $orders)) {
|
377 |
+
// Miss a level when data sent in XML
|
378 |
+
$orders = array($orders);
|
379 |
+
}
|
380 |
+
|
381 |
+
foreach ($orders as $orderData) {
|
382 |
+
$order = Mage::getModel('sales/order')->load($orderData['order_commercial_id'], 'increment_id');
|
383 |
+
if ($order->getId()) {
|
384 |
+
$amount = 0;
|
385 |
+
foreach ($orderData['order_lines'] as $orderLines) {
|
386 |
+
foreach ($orderLines as $line) {
|
387 |
+
foreach ($line['refunds'] as $refunds) {
|
388 |
+
foreach ($refunds as $refund) {
|
389 |
+
$amount += $refund['amount'];
|
390 |
+
}
|
391 |
+
}
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
try {
|
396 |
+
$payment = $order->getPayment();
|
397 |
+
$methodInstance = $payment->getMethodInstance();
|
398 |
+
$res = $methodInstance->refundMkpProducts($payment, $amount, $orderData['order_id']);
|
399 |
+
} catch (Exception $e) {
|
400 |
+
Mage::logException($e);
|
401 |
+
}
|
402 |
+
|
403 |
+
$status = (isset($res) && $res->getResponseIsSuccess()) ? 'OK' : 'REFUSED';
|
404 |
+
|
405 |
+
Mage::dispatchEvent('mirakl_trigger_order_refund', array(
|
406 |
+
'order_id' => $order->getId(),
|
407 |
+
'remote_id' => $orderData['order_id'],
|
408 |
+
'status' => $status
|
409 |
+
));
|
410 |
+
}
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
return $this;
|
415 |
+
}
|
416 |
+
|
417 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Renderer/Defered.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Renderer_Defered
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renderer for the select input defered (create / edit merchand account)
|
25 |
+
*
|
26 |
+
* @return multitype:multitype:number string
|
27 |
+
*/
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
return array(
|
31 |
+
array('value' => 1, 'label' => Mage::helper('be2bill')->__('1 jour')),
|
32 |
+
array('value' => 2, 'label' => Mage::helper('be2bill')->__('2 jours')),
|
33 |
+
array('value' => 3, 'label' => Mage::helper('be2bill')->__('3 jours')),
|
34 |
+
array('value' => 4, 'label' => Mage::helper('be2bill')->__('4 jours')),
|
35 |
+
array('value' => 5, 'label' => Mage::helper('be2bill')->__('5 jours')),
|
36 |
+
array('value' => 6, 'label' => Mage::helper('be2bill')->__('6 jours')),
|
37 |
+
array('value' => 7, 'label' => Mage::helper('be2bill')->__('7 jours')),
|
38 |
+
array('value' => 8, 'label' => Mage::helper('be2bill')->__('8 jours')),
|
39 |
+
array('value' => 9, 'label' => Mage::helper('be2bill')->__('9 jours')),
|
40 |
+
array('value' => 10, 'label' => Mage::helper('be2bill')->__('10 jours')),
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Renderer/Ntimes.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Renderer_Ntimes
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renderer for the select input ntimes (create / edit merchand account)
|
25 |
+
*
|
26 |
+
* @return multitype:multitype:number string
|
27 |
+
*/
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
return array(
|
31 |
+
array('value' => 2, 'label' => '2'),
|
32 |
+
array('value' => 3, 'label' => '3'),
|
33 |
+
array('value' => 4, 'label' => '4'),
|
34 |
+
);
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Alias.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Alias extends Mage_Core_Model_Resource_Db_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialize
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/alias', 'id_b2b_alias');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Alias/Collection.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Alias_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Init collection and determine table names
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/alias');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccount.php
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Merchandconfigurationaccount extends Mage_Core_Model_Resource_Db_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialize
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/merchandconfigurationaccount', 'id_b2b_merchand_configuration_account');
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Load Account Merchand by identifier and store id
|
33 |
+
* @param Quadra_Be2bill_Model_Merchandconfigurationaccount $account
|
34 |
+
* @param string $identifier
|
35 |
+
* @param int $store
|
36 |
+
* @return Quadra_Be2bill_Model_Resource_Merchandconfigurationaccount
|
37 |
+
*/
|
38 |
+
public function loadByIdentifier(Quadra_Be2bill_Model_Merchandconfigurationaccount $account, $identifier, $store = null)
|
39 |
+
{
|
40 |
+
$adapter = $this->_getReadAdapter();
|
41 |
+
$bind = array('login' => $identifier);
|
42 |
+
$select = $adapter->select()
|
43 |
+
->from($this->getMainTable())
|
44 |
+
->where('login = "' . $identifier . '"');
|
45 |
+
|
46 |
+
if ($store != null) {
|
47 |
+
$select->where('core_store_id = ' . $store);
|
48 |
+
}
|
49 |
+
|
50 |
+
$accoundId = $adapter->fetchOne($select);
|
51 |
+
|
52 |
+
if ($accoundId) {
|
53 |
+
$this->load($account, $accoundId);
|
54 |
+
} else {
|
55 |
+
$account->setData(array());
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retourne les Options affichables sur le front
|
63 |
+
*
|
64 |
+
* @param Quadra_Be2bill_Model_Merchandconfigurationaccount $account
|
65 |
+
* @param float $amount
|
66 |
+
* @param boolean $recurring
|
67 |
+
*/
|
68 |
+
public function getAvailableFrontOptions(Quadra_Be2bill_Model_Merchandconfigurationaccount $account, $amount, $recurring)
|
69 |
+
{
|
70 |
+
$collection = $account->getOptionsCollection()
|
71 |
+
->addFieldToFilter('active', 1)
|
72 |
+
->addFieldToFilter('min_amount', array(array('null' => true), array('lt' => $amount)))
|
73 |
+
->addFieldToFilter('max_amount', array(array('null' => true), array('gt' => $amount)));
|
74 |
+
|
75 |
+
// Si profil recurrent alors on autorise uniquement le paiement standard
|
76 |
+
if ($recurring) {
|
77 |
+
$collection->addFieldToFilter('b2b_xml_option', array('standard'));
|
78 |
+
} else {
|
79 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive()) {
|
80 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
81 |
+
|
82 |
+
if (Mage::helper('mirakl_frontend/quote')->isFullMiraklQuote($quote)) {
|
83 |
+
// Commandes marketplace uniquement
|
84 |
+
$collection->addFieldToFilter('b2b_xml_option', array('delivery'));
|
85 |
+
|
86 |
+
$expr = new Zend_Db_Expr('
|
87 |
+
(main_table.b2b_xml_option_extra LIKE "%mkp_only%" AND main_table.b2b_xml_option_extra NOT LIKE "%all%")
|
88 |
+
OR
|
89 |
+
(main_table.b2b_xml_option_extra NOT LIKE "%mkp_only%" AND main_table.b2b_xml_option_extra LIKE "%all%")
|
90 |
+
');
|
91 |
+
$collection->getSelect()->where($expr);
|
92 |
+
} elseif (Mage::helper('mirakl_frontend/quote')->isMiraklQuote($quote)) {
|
93 |
+
// Commandes mixtes
|
94 |
+
$collection->addFieldToFilter('b2b_xml_option', array('delivery'));
|
95 |
+
$collection->addFieldToFilter('b2b_xml_option_extra', array('like' => '%all%'));
|
96 |
+
} else {
|
97 |
+
// Commandes opérateur uniquement
|
98 |
+
$collection->addFieldToFilter('b2b_xml_option', array('nin' => array('oneclick', 'oneclickcvv', 'displaycreatealias', '3dsecure', 'ageverification', 'recurring')));
|
99 |
+
|
100 |
+
$resource = Mage::getSingleton('core/resource');
|
101 |
+
$readConnection = $resource->getConnection('core_read');
|
102 |
+
|
103 |
+
$collection->getSelect()
|
104 |
+
->where('b2b_xml_option_extra NOT LIKE ?', '%mkp_only%');
|
105 |
+
}
|
106 |
+
} else {
|
107 |
+
$collection->addFieldToFilter('b2b_xml_option', array('nin' => array('oneclick', 'oneclickcvv', 'displaycreatealias', '3dsecure', 'ageverification', 'recurring')));
|
108 |
+
}
|
109 |
+
}
|
110 |
+
//Mage::log($collection->getSelect()->__toString(), Zend_Log::DEBUG, 'be2bill.log', true);
|
111 |
+
return $collection;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Utilisation de l'option OneClick possible ?
|
116 |
+
*/
|
117 |
+
public function getOneClick(Quadra_Be2bill_Model_Merchandconfigurationaccount $account)
|
118 |
+
{
|
119 |
+
$collection = $account->getOptionsCollection()
|
120 |
+
->addFieldToFilter('active', 1)
|
121 |
+
->addFieldToFilter('b2b_xml_option', array('in' => array('oneclick')));
|
122 |
+
|
123 |
+
return $collection->getFirstItem();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Utilisation de l'option payment n fois possible ?
|
128 |
+
*/
|
129 |
+
public function getSeveral(Quadra_Be2bill_Model_Merchandconfigurationaccount $account)
|
130 |
+
{
|
131 |
+
$collection = $account->getOptionsCollection()
|
132 |
+
->addFieldToFilter('active', 1)
|
133 |
+
->addFieldToFilter('b2b_xml_option', array('in' => array('ntimes')));
|
134 |
+
|
135 |
+
return $collection->getFirstItem();
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Utilisation de l'option OneClick CVV obligatoire ?
|
140 |
+
*/
|
141 |
+
public function useOneClickCVV(Quadra_Be2bill_Model_Merchandconfigurationaccount $account)
|
142 |
+
{
|
143 |
+
$collection = $account->getOptionsCollection()
|
144 |
+
->addFieldToFilter('active', 1)
|
145 |
+
->addFieldToFilter('b2b_xml_option', array('in' => array('oneclickcvv')));
|
146 |
+
|
147 |
+
return $collection->getFirstItem();
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Retourne une liste de payments configurer dans l'admin
|
152 |
+
* en fonction de :
|
153 |
+
*
|
154 |
+
* @param Quadra_Be2bill_Model_Merchandconfigurationaccount $account
|
155 |
+
* @param string $isoCurrency
|
156 |
+
* @param string $isoCountry
|
157 |
+
* @param int $storeId
|
158 |
+
* @param boolean $recurring
|
159 |
+
*/
|
160 |
+
public function getAvailablePayments(Quadra_Be2bill_Model_Merchandconfigurationaccount $account, $isoCurrency, $isoCountry, $storeId, $recurring)
|
161 |
+
{
|
162 |
+
$collection = $account->getCollection()
|
163 |
+
->addFieldToFilter('currency_iso', strtolower($isoCurrency))
|
164 |
+
->addFieldToFilter('active', 1)
|
165 |
+
->addFieldToFilter('core_store_id', array('in' => array(0, $storeId)));
|
166 |
+
|
167 |
+
$collection->getSelect()
|
168 |
+
->joinLeft(
|
169 |
+
array('account_countries' => $this->getTable('be2bill/merchandconfigurationaccountcountries')),
|
170 |
+
'main_table.id_b2b_merchand_configuration_account=account_countries.id_b2b_merchand_configuration_account',
|
171 |
+
null
|
172 |
+
)
|
173 |
+
->where('account_countries.country_iso = "' . strtolower($isoCountry) . '"');
|
174 |
+
|
175 |
+
if ($recurring) {
|
176 |
+
$resource = Mage::getSingleton('core/resource');
|
177 |
+
$readConnection = $resource->getConnection('core_read');
|
178 |
+
$subQuery = $readConnection->select()
|
179 |
+
->from(
|
180 |
+
array('account_options' => $this->getTable('be2bill/merchandconfigurationaccountoptions')),
|
181 |
+
array("account_options.id_b2b_merchand_configuration_account")
|
182 |
+
)
|
183 |
+
->where('active = 1')
|
184 |
+
->where('b2b_xml_option = "recurring"')
|
185 |
+
->where('account_options.id_b2b_merchand_configuration_account = main_table.id_b2b_merchand_configuration_account')
|
186 |
+
;
|
187 |
+
|
188 |
+
$collection->getSelect()->where('main_table.id_b2b_merchand_configuration_account IN (' . $subQuery . ')');
|
189 |
+
}
|
190 |
+
|
191 |
+
// si le module mirakl est installe et actif
|
192 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive()) {
|
193 |
+
// recuperation de la quote
|
194 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
195 |
+
|
196 |
+
// Commandes marketplace uniquement OU Commandes mixtes
|
197 |
+
if (Mage::helper('mirakl_frontend/quote')->isFullMiraklQuote($quote) || Mage::helper('mirakl_frontend/quote')->isMiraklQuote($quote)) {
|
198 |
+
// ajouter filtre sur les MP eligibles a Mirakl 'CB/Visa/MasterCard' et 'Visa/MasterCard'
|
199 |
+
$collection->getSelect()->where('main_table.b2b_xml_account_type_code IN ("'. implode('","',Mage::helper('be2bill/mirakl')->getAllowedMPCode()) .'")');
|
200 |
+
}
|
201 |
+
// Commandes opérateur uniquement
|
202 |
+
else {
|
203 |
+
// pas de filtre supplementaire
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
return $collection;
|
208 |
+
}
|
209 |
+
|
210 |
+
public function checkAvailablePaymentOption(Quadra_Be2bill_Model_Merchandconfigurationaccount $accountM, $currency, $country, $storeId, $recurring, $accountId, $account, $option)
|
211 |
+
{
|
212 |
+
$resource = Mage::getSingleton('core/resource');
|
213 |
+
$readConnection = $resource->getConnection('core_read');
|
214 |
+
|
215 |
+
$collection = $accountM->getCollection()
|
216 |
+
->addFieldToFilter('currency_iso', strtolower($currency))
|
217 |
+
->addFieldToFilter('active', 1)
|
218 |
+
->addFieldToFilter('main_table.id_b2b_merchand_configuration_account', $accountId)
|
219 |
+
->addFieldToFilter('b2b_xml_account_type_code', $account)
|
220 |
+
->addFieldToFilter('core_store_id', array('in' => array(0, $storeId)));
|
221 |
+
|
222 |
+
$collection->getSelect()
|
223 |
+
->joinLeft(
|
224 |
+
array('account_countries' => $this->getTable('be2bill/merchandconfigurationaccountcountries')),
|
225 |
+
'main_table.id_b2b_merchand_configuration_account=account_countries.id_b2b_merchand_configuration_account',
|
226 |
+
null
|
227 |
+
)
|
228 |
+
->where('account_countries.country_iso = "' . strtolower($country) . '"');
|
229 |
+
|
230 |
+
$subQuery1 = $readConnection->select()
|
231 |
+
->from(
|
232 |
+
array('account_options' => $this->getTable('be2bill/merchandconfigurationaccountoptions')),
|
233 |
+
array("account_options.id_b2b_merchand_configuration_account")
|
234 |
+
)
|
235 |
+
->where('active = 1')
|
236 |
+
->where('b2b_xml_option = "' . $option . '"')
|
237 |
+
->where('account_options.id_b2b_merchand_configuration_account = main_table.id_b2b_merchand_configuration_account');
|
238 |
+
|
239 |
+
$collection->getSelect()->where('main_table.id_b2b_merchand_configuration_account IN (' . $subQuery1 . ')');
|
240 |
+
|
241 |
+
if ($recurring) {
|
242 |
+
$resource = Mage::getSingleton('core/resource');
|
243 |
+
$readConnection = $resource->getConnection('core_read');
|
244 |
+
$subQuery = $readConnection->select()
|
245 |
+
->from(
|
246 |
+
array('account_options' => $this->getTable('be2bill/merchandconfigurationaccountoptions')),
|
247 |
+
array("account_options.id_b2b_merchand_configuration_account")
|
248 |
+
)
|
249 |
+
->where('active = 1')
|
250 |
+
->where('b2b_xml_option = "recurring"')
|
251 |
+
->where('account_options.id_b2b_merchand_configuration_account = main_table.id_b2b_merchand_configuration_account')
|
252 |
+
;
|
253 |
+
$collection->getSelect()->where('main_table.id_b2b_merchand_configuration_account IN (' . $subQuery . ')');
|
254 |
+
}
|
255 |
+
|
256 |
+
return $collection;
|
257 |
+
}
|
258 |
+
|
259 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccount/Collection.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Merchandconfigurationaccount_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Init collection and determine table names
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/merchandconfigurationaccount');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountcountries.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Merchandconfigurationaccountcountries extends Mage_Core_Model_Resource_Db_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialize
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/merchandconfigurationaccountcountries', 'id_b2b_merchand_configuration_account_countries');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountcountries/Collection.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Merchandconfigurationaccountcountries_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Init collection and determine table names
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/merchandconfigurationaccountcountries');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountoptions.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Merchandconfigurationaccountoptions extends Mage_Core_Model_Resource_Db_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialize
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/merchandconfigurationaccountoptions', 'id_b2b_merchand_configuration_account_options');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Quadra/Be2bill/Model/Resource/Merchandconfigurationaccountoptions/Collection.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Model_Resource_Merchandconfigurationaccountoptions_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Init collection and determine table names
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
$this->_init('be2bill/merchandconfigurationaccountoptions');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Quadra/Be2bill/controllers/Adminhtml/MerchandaccountController.php
ADDED
@@ -0,0 +1,547 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Adminhtml_MerchandaccountController extends Mage_Adminhtml_Controller_Action
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initialisation
|
25 |
+
* @param string $idFieldName
|
26 |
+
* @return Quadra_Be2bill_Adminhtml_MerchandaccountController
|
27 |
+
*/
|
28 |
+
protected function _initAccount($idFieldName = 'id')
|
29 |
+
{
|
30 |
+
$this->_title($this->__('Configuration du compte'))->_title($this->__('Configuration du compte'));
|
31 |
+
|
32 |
+
$accountId = (int)$this->getRequest()->getParam($idFieldName);
|
33 |
+
$model = Mage::getModel('be2bill/merchandconfigurationaccount');
|
34 |
+
|
35 |
+
if ($accountId) {
|
36 |
+
$model->load($accountId);
|
37 |
+
}
|
38 |
+
|
39 |
+
Mage::register('current_configuration_account', $model);
|
40 |
+
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* View manage accounts list
|
46 |
+
*/
|
47 |
+
public function indexAction()
|
48 |
+
{
|
49 |
+
$this->_title($this->__('Gestion des comptes'))->_title($this->__('Be2bill : Configuration des comptes'));
|
50 |
+
|
51 |
+
if ($this->getRequest()->getQuery('ajax')) {
|
52 |
+
$this->_forward('grid');
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
$this->loadLayout();
|
56 |
+
|
57 |
+
//Add breadcrumb item
|
58 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Gestion des comptes'), Mage::helper('adminhtml')->__('Gestion des comptes'));
|
59 |
+
|
60 |
+
//Set active menu item
|
61 |
+
$this->_setActiveMenu('be2bill');
|
62 |
+
|
63 |
+
//Append block to content
|
64 |
+
$this->_addContent(
|
65 |
+
$this->getLayout()->createBlock('be2bill/adminhtml_merchandaccount', 'account')
|
66 |
+
);
|
67 |
+
|
68 |
+
$this->renderLayout();
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* JSON Grid Action
|
73 |
+
*/
|
74 |
+
public function gridAction()
|
75 |
+
{
|
76 |
+
$this->loadLayout();
|
77 |
+
$this->getResponse()->setBody(
|
78 |
+
$this->getLayout()->createBlock('be2bill/adminhtml_merchandaccount_grid')->toHtml()
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Import Xml dynamicPayments into the Database
|
84 |
+
*/
|
85 |
+
public function importXmltoDbAction()
|
86 |
+
{
|
87 |
+
try {
|
88 |
+
if (Mage::getModel('be2bill/api_xml')->insertXmlToDb()) {
|
89 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('be2bill')->__('Import réalisé avec succès'));
|
90 |
+
} else {
|
91 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('be2bill')->__("Echec de l'import"));
|
92 |
+
}
|
93 |
+
} catch (Exception $e) {
|
94 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
95 |
+
}
|
96 |
+
$this->_redirect('*/*/index');
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Configuration Account edit action
|
101 |
+
*/
|
102 |
+
public function editAction()
|
103 |
+
{
|
104 |
+
$this->loadLayout();
|
105 |
+
$this->_initAccount('id');
|
106 |
+
$confAccount = Mage::registry('current_configuration_account');
|
107 |
+
|
108 |
+
$this->_setActiveMenu('be2bill/manage_payment');
|
109 |
+
$this->_addBreadcrumb(Mage::helper('be2bill')->__('Configuration du compte'), Mage::helper('be2bill')->__('Configuration du compte'), $this->getUrl('*/*'));
|
110 |
+
|
111 |
+
if ($this->getRequest()->getParam('id')) {
|
112 |
+
$this->_addBreadcrumb(Mage::helper('be2bill')->__('Edition du compte'), Mage::helper('be2bill')->__('Edition du compte'));
|
113 |
+
} else {
|
114 |
+
$this->_addBreadcrumb(Mage::helper('be2bill')->__('Nouveau compte'), Mage::helper('be2bill')->__('Nouveau compte'));
|
115 |
+
}
|
116 |
+
|
117 |
+
$this->_title($confAccount->getId() ? $confAccount->getId() : $this->__('Nouveau compte'));
|
118 |
+
|
119 |
+
$this->_addContent($this->getLayout()->createBlock('be2bill/adminhtml_merchandaccount_edit', 'merchandaccount_edit')
|
120 |
+
->setEditMode((bool)$this->getRequest()->getParam('id')));
|
121 |
+
|
122 |
+
$this->renderLayout();
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Create new paymnt account action
|
127 |
+
*/
|
128 |
+
public function newAction()
|
129 |
+
{
|
130 |
+
$this->_forward('edit');
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Save la configuration du compte marchant
|
135 |
+
*/
|
136 |
+
public function saveAction()
|
137 |
+
{
|
138 |
+
$data = $this->getRequest()->getPost();
|
139 |
+
if ($data) {
|
140 |
+
$this->_initAccount('id');
|
141 |
+
$account = Mage::registry('current_configuration_account');
|
142 |
+
|
143 |
+
try {
|
144 |
+
/*
|
145 |
+
* Gestion des donnée générales
|
146 |
+
*/
|
147 |
+
|
148 |
+
//gestion du label
|
149 |
+
if ($data['general']['configuration_account_name'] == '') {
|
150 |
+
$data['general']['configuration_account_name'] = $data['b2b_xml_account_type_value'];
|
151 |
+
}
|
152 |
+
|
153 |
+
$account->addData($data['general']);
|
154 |
+
|
155 |
+
/*
|
156 |
+
* Gestion du Logo
|
157 |
+
*/
|
158 |
+
if (isset($data['logo']['delete']) && $data['logo']['delete'] == 1) {
|
159 |
+
$pathMag = $this->_uploadImage2(Mage::getModel('be2bill/api_methods')->getLogoUrl($account['b2b_xml_account_type_code']));
|
160 |
+
$account->setData('logo_url', $pathMag);
|
161 |
+
} else if (isset($_FILES['logo']['name']) and ( file_exists($_FILES['logo']['tmp_name']))) {
|
162 |
+
$logo_path = $this->_uploadImage('logo');
|
163 |
+
$account->setData('logo_url', $logo_path);
|
164 |
+
} else if ($data['logo_url'] != '') {
|
165 |
+
$pathMag = $this->_uploadImage2($data['logo_url']);
|
166 |
+
$account->setData('logo_url', $pathMag);
|
167 |
+
}
|
168 |
+
$account->save();
|
169 |
+
|
170 |
+
/*
|
171 |
+
* Gestion des pays autorisés
|
172 |
+
*/
|
173 |
+
// etape 1 : on supprime tout les pays associés au compte (reset)
|
174 |
+
$account->deleteAccountCountriesCollection();
|
175 |
+
|
176 |
+
// etape 2 : ajout des pays
|
177 |
+
//si tout les pays
|
178 |
+
if ($data['countries']['allowspecific'] == 0) {
|
179 |
+
$result = $this->getCountriesRestrictionAction($data['general']['b2b_xml_account_type_code']);
|
180 |
+
if ($result['found'] == 'no-restriction') {
|
181 |
+
$data['countries']['country_iso'] = array_column(Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(), 'value');
|
182 |
+
unset($data['countries']['country_iso'][0]);
|
183 |
+
} else if ($result['found'] == 'restriction') {
|
184 |
+
$data['countries']['country_iso'] = array_column($result['countries'], 'label');
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
foreach ($data['countries']['country_iso'] as $country) {
|
189 |
+
$countries = Mage::getModel('be2bill/merchandconfigurationaccountcountries');
|
190 |
+
$countries->setData('id_b2b_merchand_configuration_account', $account->getId());
|
191 |
+
$countries->setData('country_iso', strtolower($country));
|
192 |
+
$countries->save();
|
193 |
+
}
|
194 |
+
|
195 |
+
/*
|
196 |
+
* Gestion des options
|
197 |
+
*/
|
198 |
+
// etape 1 : on supprime tout les options associés au compte (reset)
|
199 |
+
$account->deleteOptionsCollection();
|
200 |
+
// etape 2 : ajout des options
|
201 |
+
foreach ($data['option'] as $code => $tab) {
|
202 |
+
if (!array_key_exists('b2b_xml_option_extra', $tab)) {
|
203 |
+
$tab['b2b_xml_option_extra'] = null;
|
204 |
+
}
|
205 |
+
if (!array_key_exists('front_label', $tab)) {
|
206 |
+
$tab['front_label'] = null;
|
207 |
+
}
|
208 |
+
|
209 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
210 |
+
$option->setData('b2b_xml_option', $code)
|
211 |
+
->setData('id_b2b_merchand_configuration_account', $account->getId())
|
212 |
+
->setData('min_amount', isset($tab['min_amount']) && $tab['min_amount'] != null ? $tab['min_amount'] : null )
|
213 |
+
->setData('max_amount', isset($tab['max_amount']) && $tab['max_amount'] != null ? $tab['max_amount'] : null)
|
214 |
+
->setData('b2b_xml_option_extra', serialize($tab['b2b_xml_option_extra']))
|
215 |
+
->setData('active', $tab['active'])
|
216 |
+
->setData('front_label', $tab['front_label']);
|
217 |
+
|
218 |
+
if ($code == 'delivery' && Mage::helper('be2bill')->isMiraklInstalledAndActive()) {
|
219 |
+
$optionExtra = array(
|
220 |
+
'mirakl_status' => $tab['mirakl_status'],
|
221 |
+
'mkp_login' => $tab['mkp_login'],
|
222 |
+
'mkp_password' => $tab['mkp_password'],
|
223 |
+
);
|
224 |
+
$option->setData('b2b_xml_option_extra', serialize($optionExtra));
|
225 |
+
} elseif ($code == '3dsecure') {
|
226 |
+
//pays admis
|
227 |
+
if ($tab['allowspecific'] == 0) {
|
228 |
+
$tab['country_iso'] = array_column(Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(), 'value');
|
229 |
+
unset($tab['country_iso'][0]);
|
230 |
+
}
|
231 |
+
if (!array_key_exists('country_iso', $tab)) {
|
232 |
+
$tab['country_iso'] = null;
|
233 |
+
}
|
234 |
+
|
235 |
+
$optionExtra = array('country_iso' => $tab['country_iso'], 'postcode' => $tab['postcode'], 'shipping_method' => $tab['shipping_method']);
|
236 |
+
$option->setData('b2b_xml_option_extra', serialize($optionExtra));
|
237 |
+
}
|
238 |
+
$option->save();
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
// verifier l'existence de l'option displaycreatealias dans b2b_xml_account_type_parameter_set_options
|
243 |
+
if(in_array('displaycreatealias', explode(',', $data['options']))){
|
244 |
+
$option1 = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
245 |
+
$option1->setData('b2b_xml_option', 'displaycreatealias')
|
246 |
+
->setData('id_b2b_merchand_configuration_account', $account->getId())
|
247 |
+
->setData('active', 1)
|
248 |
+
->save();
|
249 |
+
}
|
250 |
+
|
251 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('be2bill')->__('Compte sauvegardé'));
|
252 |
+
} catch (Mage_Core_Exception $e) {
|
253 |
+
echo $this->_getSession()->addError($e->getMessage());
|
254 |
+
//$this->_getSession()->setConfigurationAccountData($data);
|
255 |
+
$this->getResponse()->setRedirect($this->getUrl('*/merchandaccount/edit', array('id' => $account->getId())));
|
256 |
+
} catch (Exception $e) {
|
257 |
+
$this->_getSession()->addException($e, Mage::helper('be2bill')->__('Une erreur est survenue durant l\'enregistrement du compte'));
|
258 |
+
//$this->_getSession()->setConfigurationAccountData($data);
|
259 |
+
$this->getResponse()->setRedirect($this->getUrl('*/merchandaccount/edit', array('id' => $account->getId())));
|
260 |
+
return;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
if ($this->getRequest()->getParam('back')) {
|
265 |
+
$this->_redirect('*/*/edit', array('id' => $account->getId()));
|
266 |
+
} else {
|
267 |
+
$this->_redirect('*/*/');
|
268 |
+
//$this->getResponse()->setRedirect($this->getUrl('*/merchandaccount'));
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Upload l'image passé en paramètre
|
274 |
+
* @param string $name
|
275 |
+
* @return string|NULL
|
276 |
+
*/
|
277 |
+
protected function _uploadImage($name)
|
278 |
+
{
|
279 |
+
try {
|
280 |
+
$uploader = new Varien_File_Uploader($name);
|
281 |
+
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png', 'svg')); // or pdf or anything
|
282 |
+
$uploader->setAllowRenameFiles(false);
|
283 |
+
|
284 |
+
$uploader->setFilesDispersion(false);
|
285 |
+
$path = Mage::getBaseDir('media') . DS . 'be2bill' . DS . 'images';
|
286 |
+
$uploader->save($path, $_FILES[$name]['name']);
|
287 |
+
|
288 |
+
return 'be2bill' . DS . 'images' . DS . $_FILES[$name]['name'];
|
289 |
+
} catch (Exception $e) {
|
290 |
+
Mage::logException($e);
|
291 |
+
return null;
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Upload l'image passé en paramètre via l'url de l'image
|
297 |
+
* @param string $url
|
298 |
+
* @return string|NULL
|
299 |
+
*/
|
300 |
+
protected function _uploadImage2($url)
|
301 |
+
{
|
302 |
+
try {
|
303 |
+
$tab = explode('/', $url) ;
|
304 |
+
$path = Mage::getBaseDir('media') . DS . 'be2bill' . DS . 'images'. DS .$tab[count($tab)-1];
|
305 |
+
|
306 |
+
if (file_exists($path) && is_file($path)){
|
307 |
+
@chmod($path, 0777); // NT ?
|
308 |
+
unlink($path);
|
309 |
+
}
|
310 |
+
|
311 |
+
$img = file_get_contents($url);
|
312 |
+
$result = file_put_contents($path, $img);
|
313 |
+
if ($result === false || $result == 0){
|
314 |
+
$this->_getSession()->addNotice( Mage::helper('be2bill')->__('Une erreur est survenue durant le téléchargement du logo. Veuillez réessayer ultérieurement'));
|
315 |
+
return null;
|
316 |
+
}
|
317 |
+
@chmod($path, 0777);
|
318 |
+
return 'be2bill' . DS . 'images'. DS .$tab[count($tab)-1];
|
319 |
+
} catch (Exception $e) {
|
320 |
+
Mage::logException($e);
|
321 |
+
return null;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Delete Account action
|
327 |
+
*/
|
328 |
+
public function deleteAction()
|
329 |
+
{
|
330 |
+
$this->_initAccount();
|
331 |
+
$account = Mage::registry('current_configuration_account');
|
332 |
+
if ($account->getId()) {
|
333 |
+
try {
|
334 |
+
$account->load($account->getId());
|
335 |
+
$account->deleteAccountCountriesCollection();
|
336 |
+
$account->deleteOptionsCollection();
|
337 |
+
$account->delete();
|
338 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('be2bill')->__('Le compte a bien été supprimé'));
|
339 |
+
} catch (Exception $e) {
|
340 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
341 |
+
}
|
342 |
+
}
|
343 |
+
$this->_redirect('*/merchandaccount');
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Retourne une collection de type du compte en fonction de la devise
|
348 |
+
* @param ajax string devise
|
349 |
+
* @param ajax int id
|
350 |
+
* @return ajax response
|
351 |
+
*/
|
352 |
+
public function loadAccountsTypeByCurrencyAction()
|
353 |
+
{
|
354 |
+
$currency = $this->getRequest()->getParam('value', false);
|
355 |
+
$id = $this->getRequest()->getParam('id', false);
|
356 |
+
|
357 |
+
$result = Mage::getModel('be2bill/api_methods')->getAvailableAcountTypeByCurrency($currency);
|
358 |
+
$return = array('id' => $id, 'result' => $result);
|
359 |
+
|
360 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($return));
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Retourne une collection de mode disponible en fonction du type du compte
|
365 |
+
* @param ajax string value
|
366 |
+
* @param ajax int id
|
367 |
+
* @return ajax response
|
368 |
+
*/
|
369 |
+
public function loadModesTypeByAccountTypeAction()
|
370 |
+
{
|
371 |
+
$accountType = $this->getRequest()->getParam('value', false);
|
372 |
+
$id = $this->getRequest()->getParam('id', false);
|
373 |
+
|
374 |
+
$result = Mage::getModel('be2bill/api_methods')->getAvailableModesByAccountType($accountType);
|
375 |
+
|
376 |
+
// si resultat sup a 1 on supprime directlink et direct submit
|
377 |
+
if (count($result) > 1) {
|
378 |
+
$i = 0;
|
379 |
+
foreach ($result as $tabVal) {
|
380 |
+
if ($tabVal['id'] == 'directlink' || $tabVal['id'] == 'direct-submit') {
|
381 |
+
unset($result[$i]);
|
382 |
+
}
|
383 |
+
$i++;
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
$return = array('id' => $id, 'result' => array_values($result));
|
388 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($return));
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Retourne une collection d'options disponible en fonction du type du compte
|
393 |
+
* @param ajax string value
|
394 |
+
* @return ajax response
|
395 |
+
*/
|
396 |
+
public function loadOptionsByAccountTypeAction()
|
397 |
+
{
|
398 |
+
$accountType = $this->getRequest()->getParam('value', false);
|
399 |
+
|
400 |
+
$options = Mage::getModel('be2bill/api_methods')->getAvailableOptionsByAccountType($accountType);
|
401 |
+
$hasDefered = Mage::getModel('be2bill/api_methods')->hasDefered($accountType);
|
402 |
+
$hasStandard = Mage::getModel('be2bill/api_methods')->hasStandard($accountType);
|
403 |
+
|
404 |
+
if ($hasDefered != false) { // si authorization alors on ajoute les options (paiements à la livraison et paiement différé)
|
405 |
+
array_push($options, array('option' => 'defered'));
|
406 |
+
array_push($options, array('option' => 'delivery'));
|
407 |
+
}
|
408 |
+
|
409 |
+
if ($hasStandard != false) {
|
410 |
+
array_push($options, array('option' => 'standard'));
|
411 |
+
}
|
412 |
+
|
413 |
+
foreach ($options as $tabOption) {
|
414 |
+
if ('oneclick' == $tabOption['option']) { //si oneclick present on ajoute le choix : profil récurrent
|
415 |
+
array_push($options, array('option' => 'recurring'));
|
416 |
+
break;
|
417 |
+
}
|
418 |
+
}
|
419 |
+
|
420 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($options));
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* Retourne un array avec une liste de pays
|
425 |
+
* ou no restiction si le compte n'a pas de restriction pays
|
426 |
+
* @return array
|
427 |
+
*/
|
428 |
+
public function getCountriesRestrictionAction($accountType = null)
|
429 |
+
{
|
430 |
+
$_ajax = false;
|
431 |
+
if ($accountType == null) {
|
432 |
+
$_ajax = true;
|
433 |
+
$accountType = $this->getRequest()->getParam('value', false);
|
434 |
+
}
|
435 |
+
$result = array();
|
436 |
+
if (Mage::getModel('be2bill/api_methods')->hasNotCountriesRestriction($accountType)) {
|
437 |
+
$result['found'] = 'no-restriction';
|
438 |
+
} elseif ($countries = Mage::getModel('be2bill/api_methods')->getCountriesRestriction($accountType)) {
|
439 |
+
$result['found'] = 'restriction';
|
440 |
+
$result['countries'] = $countries;
|
441 |
+
} else {
|
442 |
+
$result['found'] = false;
|
443 |
+
}
|
444 |
+
if ($_ajax) {
|
445 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
446 |
+
} else {
|
447 |
+
return $result;
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
*
|
453 |
+
* AJAX retourne un tableau avec les informations sur les logo du compte selectionné
|
454 |
+
* @return array
|
455 |
+
*/
|
456 |
+
public function getLogoAction()
|
457 |
+
{
|
458 |
+
$accountType = $this->getRequest()->getParam('value', false);
|
459 |
+
|
460 |
+
$result = null;
|
461 |
+
$result = Mage::getModel('be2bill/api_methods')->getLogoUrl($accountType);
|
462 |
+
|
463 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* MASS ACTION : Suppression de compte(s)
|
468 |
+
*/
|
469 |
+
public function massDeleteAction()
|
470 |
+
{
|
471 |
+
$accountIds = $this->getRequest()->getParam('merchandaccount');
|
472 |
+
|
473 |
+
if (!is_array($accountIds)) {
|
474 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('be2bill')->__('Aucun compte sélectionné'));
|
475 |
+
} else {
|
476 |
+
try {
|
477 |
+
$account = Mage::getModel('be2bill/merchandconfigurationaccount');
|
478 |
+
foreach ($accountIds as $id) {
|
479 |
+
$account->load($id);
|
480 |
+
$account->deleteAccountCountriesCollection();
|
481 |
+
$account->deleteOptionsCollection();
|
482 |
+
$account->delete();
|
483 |
+
}
|
484 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
485 |
+
Mage::helper('be2bill')->__('%d enregistrement(s) supprimé(s)', count($accountIds))
|
486 |
+
);
|
487 |
+
} catch (Exception $e) {
|
488 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
489 |
+
}
|
490 |
+
}
|
491 |
+
|
492 |
+
$this->_redirect('*/*/index');
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* MASS ACTION : Active le(s) compte(s)
|
497 |
+
*/
|
498 |
+
public function massEnableAction()
|
499 |
+
{
|
500 |
+
$accountIds = $this->getRequest()->getParam('merchandaccount');
|
501 |
+
|
502 |
+
if (!is_array($accountIds)) {
|
503 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('be2bill')->__('Aucun compte sélectionné'));
|
504 |
+
} else {
|
505 |
+
try {
|
506 |
+
$account = Mage::getModel('be2bill/merchandconfigurationaccount');
|
507 |
+
foreach ($accountIds as $id) {
|
508 |
+
$account->load($id)->setActive(1)->save();
|
509 |
+
}
|
510 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
511 |
+
Mage::helper('be2bill')->__('%d compte(s) activé(s)', count($accountIds))
|
512 |
+
);
|
513 |
+
} catch (Exception $e) {
|
514 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
518 |
+
$this->_redirect('*/*/index');
|
519 |
+
}
|
520 |
+
|
521 |
+
/**
|
522 |
+
* MASS ACTION : Désactive le(s) compte(s)
|
523 |
+
*/
|
524 |
+
public function massDisableAction()
|
525 |
+
{
|
526 |
+
$accountIds = $this->getRequest()->getParam('merchandaccount');
|
527 |
+
|
528 |
+
if (!is_array($accountIds)) {
|
529 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('be2bill')->__('Aucun compte sélectionné'));
|
530 |
+
} else {
|
531 |
+
try {
|
532 |
+
$account = Mage::getModel('be2bill/merchandconfigurationaccount');
|
533 |
+
foreach ($accountIds as $id) {
|
534 |
+
$account->load($id)->setActive(0)->save();
|
535 |
+
}
|
536 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
537 |
+
Mage::helper('be2bill')->__('%d compte(s) désactivé(s)', count($accountIds))
|
538 |
+
);
|
539 |
+
} catch (Exception $e) {
|
540 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
541 |
+
}
|
542 |
+
}
|
543 |
+
|
544 |
+
$this->_redirect('*/*/index');
|
545 |
+
}
|
546 |
+
|
547 |
+
}
|
app/code/community/Quadra/Be2bill/controllers/Adminhtml/TransfertController.php
ADDED
@@ -0,0 +1,924 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_Adminhtml_TransfertController extends Mage_Adminhtml_Controller_Action
|
21 |
+
{
|
22 |
+
|
23 |
+
const OPERATION_TYPE_PAYMENT = 'payment';
|
24 |
+
const OPERATION_TYPE_AUTH = 'authorization';
|
25 |
+
const OPERATION_TYPE_CAPTURE = 'capture';
|
26 |
+
const OPERATION_TYPE_REFUND = 'refund';
|
27 |
+
const OPERATION_TYPE_ONECLICK = 'oneclick';
|
28 |
+
const OPERATION_TYPE_SUBSCRIPTION = 'subscription';
|
29 |
+
const ACTION_ORDER = 'order';
|
30 |
+
const ACTION_AUTHORIZE = 'authorize';
|
31 |
+
const ACTION_AUTHORIZE_CAPTURE = 'authorize_capture';
|
32 |
+
const CB_VISA_MASTERCARD = 'CB/Visa/MasterCard';
|
33 |
+
const AMERICAN_EXPRESS = 'American Express';
|
34 |
+
const PAYPAL = 'PayPal';
|
35 |
+
|
36 |
+
protected $_resource;
|
37 |
+
protected $_sales_flat_order;
|
38 |
+
protected $_sales_flat_order_payment;
|
39 |
+
protected $_sales_flat_quote;
|
40 |
+
protected $_sales_flat_quote_payment;
|
41 |
+
|
42 |
+
protected function _construct()
|
43 |
+
{
|
44 |
+
parent::_construct();
|
45 |
+
$this->_resource = Mage::getSingleton('core/resource');
|
46 |
+
$this->_sales_flat_order = $this->_resource->getTableName('sales_flat_order');
|
47 |
+
$this->_sales_flat_order_payment = $this->_resource->getTableName('sales_flat_order_payment');
|
48 |
+
$this->_sales_flat_quote = $this->_resource->getTableName('sales_flat_quote');
|
49 |
+
$this->_sales_flat_quote_payment = $this->_resource->getTableName('sales_flat_quote_payment');
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Configuration Account edit action
|
55 |
+
*/
|
56 |
+
public function editAction()
|
57 |
+
{
|
58 |
+
$this->loadLayout();
|
59 |
+
|
60 |
+
$this->_setActiveMenu('be2bill/manage_payment');
|
61 |
+
$this->_addBreadcrumb(Mage::helper('be2bill')->__('Transfert des commandes de l\'Api V1 vers V2'), Mage::helper('be2bill')->__('Transfert des commandes de l\'Api V1 vers V2'), $this->getUrl('*/*'));
|
62 |
+
$this->_title($this->__('Transfert des commandes de l\'Api V1 vers V2'));
|
63 |
+
|
64 |
+
$block = $this->getLayout()->createBlock('be2bill/adminhtml_transfert_edit', 'transfert_edit');
|
65 |
+
$this->_addContent($block);
|
66 |
+
$this->renderLayout();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Save la configuration du compte marchant
|
71 |
+
*/
|
72 |
+
public function saveAction()
|
73 |
+
{
|
74 |
+
$data = $this->getRequest()->getPost();
|
75 |
+
$stores = Mage::app()->getStores();
|
76 |
+
$tabIdentifierCBVisa = $tabIdentifierAmex = $tabIdentifierPaypal = $tabActiveIframe = array();
|
77 |
+
$resource = Mage::getSingleton('core/resource');
|
78 |
+
$readConnection = $resource->getConnection('core_read');
|
79 |
+
$writeConnection = $resource->getConnection('core_write');
|
80 |
+
|
81 |
+
//Etape 1 : on recupere un tableau des stores / identifier be2Bill
|
82 |
+
foreach ($stores as $store) {
|
83 |
+
$tabIdentifierCBVisa[$store->getId()] = Mage::getStoreConfig('be2bill/be2bill_api/identifier', $store->getId());
|
84 |
+
$tabIdentifierAmex[$store->getId()] = Mage::getStoreConfig('be2bill/be2bill_amex_api/identifier', $store->getId());
|
85 |
+
$tabIdentifierPaypal[$store->getId()] = Mage::getStoreConfig('be2bill/be2bill_paypal_api/identifier', $store->getId());
|
86 |
+
//iframe activé?
|
87 |
+
$tabActiveIframe[$store->getId()] = Mage::getStoreConfig('be2bill/be2bill_checkout_config/active_iframe', $store->getId());
|
88 |
+
}
|
89 |
+
|
90 |
+
$tabIdentifierCBVisa = array_filter($tabIdentifierCBVisa);
|
91 |
+
$tabIdentifierAmex = array_filter($tabIdentifierAmex);
|
92 |
+
$tabIdentifierPaypal = array_filter($tabIdentifierPaypal);
|
93 |
+
|
94 |
+
//Donnée saisie par le marchand ?
|
95 |
+
if ($data['cb_visa'] == '' && $data['amex'] == '' && $data['paypal'] == '') {
|
96 |
+
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('be2bill')->__('Aucun compte saisie'));
|
97 |
+
$this->getResponse()->setRedirect($this->getUrl('*/transfert/edit/'));
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
try {
|
102 |
+
/*
|
103 |
+
* CB VISA MS
|
104 |
+
*/
|
105 |
+
foreach ($tabIdentifierCBVisa as $storeId => $identifier) {
|
106 |
+
|
107 |
+
if ($data['cb_visa'] != null && $data['cb_visa'] == $identifier) {
|
108 |
+
|
109 |
+
$account = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($data['cb_visa'], $storeId);
|
110 |
+
if ($account->getId() != null) {
|
111 |
+
continue; //echo 'Compte existant';
|
112 |
+
}
|
113 |
+
|
114 |
+
$passwordCBVisa = Mage::getStoreConfig('be2bill/be2bill_api/password', $storeId);
|
115 |
+
$activeCBVisa = Mage::getStoreConfig('payment/be2bill_standard/active', $storeId);
|
116 |
+
$titleCBVisa = Mage::getStoreConfig('payment/be2bill_standard/title', $storeId);
|
117 |
+
$paymentActionCBVisa = Mage::getStoreConfig('payment/be2bill_standard/payment_action', $storeId);
|
118 |
+
$cancelCaptureAutoCBVisa = Mage::getStoreConfig('payment/be2bill_standard/cancel_capture_auto', $storeId);
|
119 |
+
$orderCanceledLimitedTimeCBVisa = Mage::getStoreConfig('payment/be2bill_standard/order_canceled_limited_time', $storeId);
|
120 |
+
$useOneClickCBVisa = Mage::getStoreConfig('payment/be2bill_standard/allow_use_oneclick', $storeId);
|
121 |
+
$useCvvCBVisa = Mage::getStoreConfig('payment/be2bill_standard/use_cvv_oneclick', $storeId);
|
122 |
+
$allowRecurringProfileCBVisa = Mage::getStoreConfig('payment/be2bill_standard/allow_recurring_profile', $storeId);
|
123 |
+
$minOrderTotalCBVisa = Mage::getStoreConfig('payment/be2bill_standard/min_order_total', $storeId);
|
124 |
+
$maxOrderTotalCBVisa = Mage::getStoreConfig('payment/be2bill_standard/max_order_total', $storeId);
|
125 |
+
//$allowspecificCBVisa = Mage::getStoreConfig('payment/be2bill_standard/allowspecific', $storeId);
|
126 |
+
//$specificcountryCBVisa = Mage::getStoreConfig('payment/be2bill_standard/specificcountry', $storeId);
|
127 |
+
$use3dSecureCBVisa = Mage::getStoreConfig('payment/be2bill_standard/use_3dsecure', $storeId);
|
128 |
+
|
129 |
+
//SEVERAL
|
130 |
+
$activeSeveral = Mage::getStoreConfig('payment/be2bill_several/active', $storeId);
|
131 |
+
$titleSeveral = Mage::getStoreConfig('payment/be2bill_several/title', $storeId);
|
132 |
+
$nTimesSeveral = Mage::getStoreConfig('payment/be2bill_several/n_times', $storeId);
|
133 |
+
$minOrderTotalSeveral = Mage::getStoreConfig('payment/be2bill_several/min_order_total', $storeId);
|
134 |
+
$maxOrderTotalSeveral = Mage::getStoreConfig('payment/be2bill_several/max_order_total', $storeId);
|
135 |
+
|
136 |
+
|
137 |
+
//Création du compte
|
138 |
+
$account->setB2bXmlAccountTypeCode(self::CB_VISA_MASTERCARD);
|
139 |
+
if ($tabActiveIframe[$storeId] == 1) {
|
140 |
+
$account->setB2bXmlModeCode('form-iframe');
|
141 |
+
} else {
|
142 |
+
$account->setB2bXmlModeCode('form');
|
143 |
+
}
|
144 |
+
$account->setCurrencyIso('EUR');
|
145 |
+
$account->setLogin($data['cb_visa']);
|
146 |
+
$account->setPassword($passwordCBVisa);
|
147 |
+
$account->setConfigurationAccountName($titleCBVisa);
|
148 |
+
$account->setActive($activeCBVisa);
|
149 |
+
$account->setCoreStoreId($storeId);
|
150 |
+
$account->setCancelCaptureAuto($cancelCaptureAutoCBVisa);
|
151 |
+
$account->setOrderCanceledLimitedTime($orderCanceledLimitedTimeCBVisa);
|
152 |
+
|
153 |
+
$account->save();
|
154 |
+
|
155 |
+
//Activation de l'option paiement standard
|
156 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
157 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
158 |
+
->setData('b2b_xml_option', 'standard')
|
159 |
+
->setData('min_amount', $minOrderTotalCBVisa)
|
160 |
+
->setData('max_amount', $maxOrderTotalCBVisa)
|
161 |
+
->setData('active', 1)
|
162 |
+
->setData('front_label', null)
|
163 |
+
->save();
|
164 |
+
|
165 |
+
//Activation de l'option paiement différé
|
166 |
+
if ($paymentActionCBVisa == 'authorize') {
|
167 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
168 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
169 |
+
->setData('b2b_xml_option', 'defered')
|
170 |
+
->setData('min_amount', $minOrderTotalCBVisa)
|
171 |
+
->setData('max_amount', $maxOrderTotalCBVisa)
|
172 |
+
->setData('b2b_xml_option_extra', serialize(5))
|
173 |
+
->setData('active', 1)
|
174 |
+
->save();
|
175 |
+
}
|
176 |
+
|
177 |
+
//one Click
|
178 |
+
if ($useOneClickCBVisa == 1) {
|
179 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
180 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
181 |
+
->setData('b2b_xml_option', 'oneclick')
|
182 |
+
->setData('active', 1)
|
183 |
+
->save();
|
184 |
+
}
|
185 |
+
|
186 |
+
//OneClick CVV
|
187 |
+
if ($useCvvCBVisa == 1) {
|
188 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
189 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
190 |
+
->setData('b2b_xml_option', 'oneclickcvv')
|
191 |
+
->setData('active', 1)
|
192 |
+
->save();
|
193 |
+
}
|
194 |
+
|
195 |
+
//recurring
|
196 |
+
if ($allowRecurringProfileCBVisa == 1) {
|
197 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
198 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
199 |
+
->setData('b2b_xml_option', 'recurring')
|
200 |
+
->setData('active', 1)
|
201 |
+
->save();
|
202 |
+
}
|
203 |
+
|
204 |
+
//3d secure
|
205 |
+
if ($use3dSecureCBVisa == 1) {
|
206 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
207 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
208 |
+
->setData('b2b_xml_option', '3dsecure')
|
209 |
+
->setData('active', 1)
|
210 |
+
->save();
|
211 |
+
}
|
212 |
+
|
213 |
+
//n times
|
214 |
+
if ($activeSeveral == 1) {
|
215 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
216 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
217 |
+
->setData('b2b_xml_option', 'ntimes')
|
218 |
+
->setData('active', 1)
|
219 |
+
->setData('front_label', $titleSeveral)
|
220 |
+
->setData('b2b_xml_option_extra', serialize($nTimesSeveral))
|
221 |
+
->setData('min_amount', $minOrderTotalSeveral != '' ? $minOrderTotalSeveral : null)
|
222 |
+
->setData('max_amount', $maxOrderTotalSeveral != '' ? $maxOrderTotalSeveral : null)
|
223 |
+
->save();
|
224 |
+
}
|
225 |
+
|
226 |
+
//tout les pays pas défaut
|
227 |
+
$data['countries']['country_iso'] = array_column(Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(), 'value');
|
228 |
+
unset($data['countries']['country_iso'][0]);
|
229 |
+
foreach ($data['countries']['country_iso'] as $country) {
|
230 |
+
$countries = Mage::getModel('be2bill/merchandconfigurationaccountcountries');
|
231 |
+
$countries->setData('id_b2b_merchand_configuration_account', $account->getId());
|
232 |
+
$countries->setData('country_iso', strtolower($country));
|
233 |
+
$countries->save();
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
|
239 |
+
/*
|
240 |
+
* AMEX
|
241 |
+
*/
|
242 |
+
foreach ($tabIdentifierAmex as $storeId => $identifier) {
|
243 |
+
if ($data['amex'] != null && $data['amex'] == $identifier) {
|
244 |
+
$account = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($data['amex'], $storeId);
|
245 |
+
if ($account->getId() != null) {
|
246 |
+
continue; //echo 'Compte existant';
|
247 |
+
}
|
248 |
+
|
249 |
+
$passwordAmex = Mage::getStoreConfig('be2bill/be2bill_amex_api/password', $storeId);
|
250 |
+
$activeAmex = Mage::getStoreConfig('payment/be2bill_amex/active', $storeId);
|
251 |
+
$titleAmex = Mage::getStoreConfig('payment/be2bill_amex/title', $storeId);
|
252 |
+
$paymentActionAmex = Mage::getStoreConfig('payment/be2bill_amex/payment_action', $storeId);
|
253 |
+
$cancelCaptureAutoAmex = Mage::getStoreConfig('payment/be2bill_amex/cancel_capture_auto', $storeId);
|
254 |
+
$orderCanceledLimitedTimeAmex = Mage::getStoreConfig('payment/be2bill_amex/order_canceled_limited_time', $storeId);
|
255 |
+
$minOrderTotalAmex = Mage::getStoreConfig('payment/be2bill_amex/min_order_total', $storeId);
|
256 |
+
$maxOrderTotalAmex = Mage::getStoreConfig('payment/be2bill_amex/max_order_total', $storeId);
|
257 |
+
$allowspecificAmex = Mage::getStoreConfig('payment/be2bill_amex/allowspecific', $storeId);
|
258 |
+
$specificcountryAmex = Mage::getStoreConfig('payment/be2bill_amex/specificcountry', $storeId);
|
259 |
+
|
260 |
+
//Création du compte
|
261 |
+
$account->setB2bXmlAccountTypeCode(self::AMERICAN_EXPRESS);
|
262 |
+
if ($tabActiveIframe[$storeId] == 1) {
|
263 |
+
$account->setB2bXmlModeCode('form-iframe');
|
264 |
+
} else {
|
265 |
+
$account->setB2bXmlModeCode('form');
|
266 |
+
}
|
267 |
+
$account->setCurrencyIso('EUR');
|
268 |
+
$account->setLogin($data['amex']);
|
269 |
+
$account->setPassword($passwordAmex);
|
270 |
+
$account->setConfigurationAccountName($titleAmex);
|
271 |
+
$account->setActive($activeAmex);
|
272 |
+
$account->setCoreStoreId($storeId);
|
273 |
+
$account->setCancelCaptureAuto($cancelCaptureAutoAmex);
|
274 |
+
$account->setOrderCanceledLimitedTime($orderCanceledLimitedTimeAmex);
|
275 |
+
$account->save();
|
276 |
+
|
277 |
+
//Activation de l'option paiement standard
|
278 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
279 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
280 |
+
->setData('b2b_xml_option', 'standard')
|
281 |
+
->setData('min_amount', $minOrderTotalAmex)
|
282 |
+
->setData('max_amount', $maxOrderTotalAmex)
|
283 |
+
->setData('active', 1)
|
284 |
+
->setData('front_label', null)
|
285 |
+
->save();
|
286 |
+
|
287 |
+
//Activation de l'option paiement différé
|
288 |
+
if ($paymentActionAmex == 'authorize') {
|
289 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
290 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
291 |
+
->setData('b2b_xml_option', 'defered')
|
292 |
+
->setData('min_amount', $minOrderTotalCBVisa)
|
293 |
+
->setData('max_amount', $maxOrderTotalCBVisa)
|
294 |
+
->setData('b2b_xml_option_extra', serialize(5))
|
295 |
+
->setData('active', 1)
|
296 |
+
->save();
|
297 |
+
}
|
298 |
+
|
299 |
+
//tout les pays pas défaut
|
300 |
+
$data['countries']['country_iso'] = array_column(Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(), 'value');
|
301 |
+
unset($data['countries']['country_iso'][0]);
|
302 |
+
foreach ($data['countries']['country_iso'] as $country) {
|
303 |
+
$countries = Mage::getModel('be2bill/merchandconfigurationaccountcountries');
|
304 |
+
$countries->setData('id_b2b_merchand_configuration_account', $account->getId());
|
305 |
+
$countries->setData('country_iso', strtolower($country));
|
306 |
+
$countries->save();
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
/*
|
311 |
+
* Paypal
|
312 |
+
*/
|
313 |
+
foreach ($tabIdentifierPaypal as $storeId => $identifier) {
|
314 |
+
if ($data['paypal'] != null && $data['paypal'] == $identifier) {
|
315 |
+
$account = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($data['paypal'], $storeId);
|
316 |
+
if ($account->getId() != null) {
|
317 |
+
continue; //echo 'Compte existant';
|
318 |
+
}
|
319 |
+
|
320 |
+
$passwordPaypal = Mage::getStoreConfig('be2bill/be2bill_paypal_api/password');
|
321 |
+
$activePaypal = Mage::getStoreConfig('payment/be2bill_paypal/active');
|
322 |
+
$titlePaypal = Mage::getStoreConfig('payment/be2bill_paypal/title');
|
323 |
+
$paymentActionPaypal = Mage::getStoreConfig('payment/be2bill_paypal/payment_action');
|
324 |
+
$cancelCaptureAutoPaypal = Mage::getStoreConfig('payment/be2bill_paypal/cancel_capture_auto');
|
325 |
+
$orderCanceledLimitedTimePaypal = Mage::getStoreConfig('payment/be2bill_paypal/order_canceled_limited_time');
|
326 |
+
$minOrderTotalPaypal = Mage::getStoreConfig('payment/be2bill_paypal/min_order_total');
|
327 |
+
$maxOrderTotalPaypal = Mage::getStoreConfig('payment/be2bill_paypal/max_order_total');
|
328 |
+
$allowspecificPaypal = Mage::getStoreConfig('payment/be2bill_paypal/allowspecific');
|
329 |
+
$specificcountryPaypal = Mage::getStoreConfig('payment/be2bill_paypal/specificcountry');
|
330 |
+
|
331 |
+
//Création du compte
|
332 |
+
$account->setB2bXmlAccountTypeCode(self::PAYPAL);
|
333 |
+
$account->setB2bXmlModeCode('directlink');
|
334 |
+
$account->setCurrencyIso('EUR');
|
335 |
+
$account->setLogin($data['paypal']);
|
336 |
+
$account->setPassword($passwordPaypal);
|
337 |
+
$account->setConfigurationAccountName($titlePaypal);
|
338 |
+
$account->setActive($activePaypal);
|
339 |
+
$account->setCoreStoreId($storeId);
|
340 |
+
$account->setCancelCaptureAuto($cancelCaptureAutoPaypal);
|
341 |
+
$account->setOrderCanceledLimitedTime($orderCanceledLimitedTimePaypal);
|
342 |
+
$account->save();
|
343 |
+
|
344 |
+
//Activation de l'option paiement standard
|
345 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
346 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
347 |
+
->setData('b2b_xml_option', 'standard')
|
348 |
+
->setData('min_amount', $minOrderTotalPaypal)
|
349 |
+
->setData('max_amount', $maxOrderTotalPaypal)
|
350 |
+
->setData('active', 1)
|
351 |
+
->setData('front_label', null)
|
352 |
+
->save();
|
353 |
+
|
354 |
+
//Activation de l'option paiement différé
|
355 |
+
if ($paymentActionPaypal == 'authorize') {
|
356 |
+
$option = Mage::getModel('be2bill/merchandconfigurationaccountoptions');
|
357 |
+
$option->setData('id_b2b_merchand_configuration_account', $account->getId())
|
358 |
+
->setData('b2b_xml_option', 'defered')
|
359 |
+
->setData('min_amount', $minOrderTotalPaypal)
|
360 |
+
->setData('max_amount', $maxOrderTotalPaypal)
|
361 |
+
->setData('b2b_xml_option_extra', serialize(5))
|
362 |
+
->setData('active', 1)
|
363 |
+
->save();
|
364 |
+
}
|
365 |
+
|
366 |
+
//tout les pays pas défaut
|
367 |
+
$data['countries']['country_iso'] = array_column(Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(), 'value');
|
368 |
+
unset($data['countries']['country_iso'][0]);
|
369 |
+
foreach ($data['countries']['country_iso'] as $country) {
|
370 |
+
$countries = Mage::getModel('be2bill/merchandconfigurationaccountcountries');
|
371 |
+
$countries->setData('id_b2b_merchand_configuration_account', $account->getId());
|
372 |
+
$countries->setData('country_iso', strtolower($country));
|
373 |
+
$countries->save();
|
374 |
+
}
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
|
379 |
+
/*
|
380 |
+
* Etape 2-1 Migration des anciennes commandes Cb visa action = Paiment
|
381 |
+
*/
|
382 |
+
|
383 |
+
//A) on récupére les commandes (order) cb visa
|
384 |
+
$sql = '
|
385 |
+
SELECT `sfo`.`entity_id`, `sfo`.`quote_id` , `sfo`.`store_id`, `sfo`.`customer_id`, `sfop`.`additional_information`
|
386 |
+
FROM `'.$this->_sales_flat_order.'` sfo , `'.$this->_sales_flat_order_payment.'` sfop
|
387 |
+
WHERE `sfo`.`entity_id` = `sfop`.`parent_id`
|
388 |
+
AND `method` = "be2bill_standard"
|
389 |
+
AND `amount_authorized` is NULL ';
|
390 |
+
|
391 |
+
$result = $readConnection->fetchAll($sql);
|
392 |
+
$tabOrderCbPai = array();
|
393 |
+
foreach ($result as $data) {
|
394 |
+
$tabOrderCbPai[$data['store_id']][] = array('id' => $data['entity_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id'], 'quote' => $data['quote_id']);
|
395 |
+
}
|
396 |
+
|
397 |
+
|
398 |
+
//Pour chaque store
|
399 |
+
foreach ($tabOrderCbPai as $storeId => $tabInfos) {
|
400 |
+
//on recupere le marchandAccount
|
401 |
+
$identifier = $tabIdentifierCBVisa[$storeId];
|
402 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
403 |
+
|
404 |
+
//On met a jour les tables de paiement
|
405 |
+
foreach ($tabInfos as $tabInfo) {
|
406 |
+
$addInfo = unserialize($tabInfo['add']);
|
407 |
+
|
408 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
409 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
410 |
+
$addInfo['options'] = 'standard';
|
411 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
412 |
+
$addInfo['operation'] = self::OPERATION_TYPE_PAYMENT;
|
413 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE_CAPTURE;
|
414 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
415 |
+
$addInfo['alias'] = null;
|
416 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
417 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfos['customer']);
|
418 |
+
if ($customer->getId() != '') {
|
419 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
420 |
+
}
|
421 |
+
}
|
422 |
+
$seriaAddInfo = serialize($addInfo);
|
423 |
+
|
424 |
+
$writeConnection->update($resource->getTableName('sales_flat_order_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'parent_id =' . $tabInfo['id']);
|
425 |
+
|
426 |
+
if ($tabInfo['quote'] != null && $tabInfo['quote'] != '') { // quote_id == null == commande récurrente
|
427 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'quote_id = ' . $tabInfo['quote']);
|
428 |
+
}
|
429 |
+
}
|
430 |
+
}
|
431 |
+
|
432 |
+
/*
|
433 |
+
* Etape 2-2 Migration des anciennes commandes Cb visa action = AUT
|
434 |
+
*/
|
435 |
+
|
436 |
+
//A) on récupère les quotes cb visa
|
437 |
+
$sql = '
|
438 |
+
SELECT `sfo`.`entity_id`, `sfo`.`quote_id` , `sfo`.`store_id`, `sfo`.`customer_id`, `sfop`.`additional_information`
|
439 |
+
FROM `'.$this->_sales_flat_order.'` sfo , `'.$this->_sales_flat_order_payment.'` sfop
|
440 |
+
WHERE `sfo`.`entity_id` = `sfop`.`parent_id`
|
441 |
+
AND `method` = "be2bill_standard"
|
442 |
+
AND `amount_authorized` is not NULL ';
|
443 |
+
|
444 |
+
$result = $readConnection->fetchAll($sql);
|
445 |
+
$tabOrderCbAut = array();
|
446 |
+
foreach ($result as $data) {
|
447 |
+
$tabOrderCbAut[$data['store_id']][] = array('id' => $data['entity_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id'], 'quote' => $data['quote_id']);
|
448 |
+
}
|
449 |
+
|
450 |
+
//Pour chaque store
|
451 |
+
foreach ($tabOrderCbAut as $storeId => $tabInfos) {
|
452 |
+
//on recupere le marchandAccount
|
453 |
+
$identifier = $tabIdentifierCBVisa[$storeId];
|
454 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
455 |
+
|
456 |
+
//On met a jour la table de paiement
|
457 |
+
foreach ($tabInfos as $tabInfo) {
|
458 |
+
$addInfo = unserialize($tabInfo['add']);
|
459 |
+
|
460 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
461 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
462 |
+
$addInfo['options'] = 'standard';
|
463 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
464 |
+
$addInfo['operation'] = self::OPERATION_TYPE_AUTH;
|
465 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE;
|
466 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
467 |
+
$addInfo['alias'] = null;
|
468 |
+
$addInfo['delivery'] = true;
|
469 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
470 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfo['customer']);
|
471 |
+
if ($customer->getId() != '') {
|
472 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
473 |
+
}
|
474 |
+
}
|
475 |
+
$seriaAddInfo = serialize($addInfo);
|
476 |
+
|
477 |
+
$writeConnection->update($resource->getTableName('sales_flat_order_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'parent_id =' . $tabInfo['id']);
|
478 |
+
|
479 |
+
if ($tabInfo['quote'] != null && $tabInfo['quote'] != '') { // quote_id == null == commande récurrente
|
480 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'quote_id = ' . $tabInfo['quote']);
|
481 |
+
}
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
+
/*
|
486 |
+
* Etape 2-3 Migration des quotes cb visa non traité ... (paiement récurrent)
|
487 |
+
*/
|
488 |
+
|
489 |
+
$sql = '
|
490 |
+
SELECT `sfqp`.`payment_id`, `sfq`.`store_id`, `sfq`.`customer_id`, `sfqp`.`additional_information`
|
491 |
+
FROM `'.$this->_sales_flat_quote.'` sfq , `'.$this->_sales_flat_quote_payment.'` sfqp
|
492 |
+
WHERE `sfq`.`entity_id` = `sfqp`.`quote_id`
|
493 |
+
AND `method` = "be2bill_standard"
|
494 |
+
AND `sfqp`.`additional_information` not like "%be2bill_method_label%" ';
|
495 |
+
|
496 |
+
$result = $readConnection->fetchAll($sql);
|
497 |
+
$tabQuoteCb = array();
|
498 |
+
foreach ($result as $data) {
|
499 |
+
$tabQuoteCb[$data['store_id']][] = array('id' => $data['payment_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id']);
|
500 |
+
}
|
501 |
+
|
502 |
+
//Pour chaque store
|
503 |
+
foreach ($tabQuoteCb as $storeId => $tabInfos) {
|
504 |
+
//on recupere le marchandAccount
|
505 |
+
$identifier = $tabIdentifierCBVisa[$storeId];
|
506 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
507 |
+
|
508 |
+
//On met a jour la table de paiement
|
509 |
+
foreach ($tabInfos as $tabInfo) {
|
510 |
+
$addInfo = unserialize($tabInfo['add']);
|
511 |
+
|
512 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
513 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
514 |
+
$addInfo['options'] = 'standard';
|
515 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
516 |
+
$addInfo['operation'] = self::OPERATION_TYPE_PAYMENT;
|
517 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE_CAPTURE;
|
518 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
519 |
+
$addInfo['alias'] = null;
|
520 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
521 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfo['customer']);
|
522 |
+
if ($customer->getId() != '') {
|
523 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
524 |
+
}
|
525 |
+
}
|
526 |
+
$seriaAddInfo = serialize($addInfo);
|
527 |
+
|
528 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'payment_id = ' . $tabInfo['id']);
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
/*
|
533 |
+
* Fin Etape 2
|
534 |
+
*/
|
535 |
+
|
536 |
+
/*
|
537 |
+
* Etape 3-1 AMEX
|
538 |
+
*/
|
539 |
+
|
540 |
+
//A) on récupére les commandes (order) cb visa
|
541 |
+
$sql = '
|
542 |
+
SELECT `sfo`.`entity_id`, `sfo`.`quote_id` , `sfo`.`store_id`, `sfo`.`customer_id`, `sfop`.`additional_information`
|
543 |
+
FROM `'.$this->_sales_flat_order.'` sfo , `'.$this->_sales_flat_order_payment.'` sfop
|
544 |
+
WHERE `sfo`.`entity_id` = `sfop`.`parent_id`
|
545 |
+
and `method` = "be2bill_amex"
|
546 |
+
and `amount_authorized` is NULL ';
|
547 |
+
|
548 |
+
$result = $readConnection->fetchAll($sql);
|
549 |
+
$tabOrderCbPai = array();
|
550 |
+
foreach ($result as $data) {
|
551 |
+
$tabOrderCbPai[$data['store_id']][] = array('id' => $data['entity_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id'], 'quote' => $data['quote_id']);
|
552 |
+
}
|
553 |
+
|
554 |
+
//Pour chaque store
|
555 |
+
foreach ($tabOrderCbPai as $storeId => $tabInfos) {
|
556 |
+
//on recupere le marchandAccount
|
557 |
+
$identifier = $tabIdentifierAmex[$storeId];
|
558 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
559 |
+
|
560 |
+
//On met a jour les tables de paiement
|
561 |
+
foreach ($tabInfos as $tabInfo) {
|
562 |
+
$addInfo = unserialize($tabInfo['add']);
|
563 |
+
|
564 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
565 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
566 |
+
$addInfo['options'] = 'standard';
|
567 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
568 |
+
$addInfo['operation'] = self::OPERATION_TYPE_PAYMENT;
|
569 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE_CAPTURE;
|
570 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
571 |
+
$addInfo['alias'] = null;
|
572 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
573 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfos['customer']);
|
574 |
+
if ($customer->getId() != '') {
|
575 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
576 |
+
}
|
577 |
+
}
|
578 |
+
$seriaAddInfo = serialize($addInfo);
|
579 |
+
|
580 |
+
$writeConnection->update($resource->getTableName('sales_flat_order_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'parent_id =' . $tabInfo['id']);
|
581 |
+
|
582 |
+
|
583 |
+
if ($tabInfo['quote'] != null && $tabInfo['quote'] != '') { // quote_id == null == commande récurrente
|
584 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'quote_id = ' . $tabInfo['quote']);
|
585 |
+
}
|
586 |
+
}
|
587 |
+
}
|
588 |
+
|
589 |
+
/*
|
590 |
+
* Etape 3-2 Migration des anciennes commandes Cb visa action = AUT
|
591 |
+
*/
|
592 |
+
|
593 |
+
//A) on récupère les quotes cb visa
|
594 |
+
$sql = '
|
595 |
+
SELECT `sfo`.`entity_id`, `sfo`.`quote_id` , `sfo`.`store_id`, `sfo`.`customer_id`, `sfop`.`additional_information`
|
596 |
+
FROM `'.$this->_sales_flat_order.'` sfo , `'.$this->_sales_flat_order_payment.'` sfop
|
597 |
+
WHERE `sfo`.`entity_id` = `sfop`.`parent_id`
|
598 |
+
and `method` = "be2bill_amex"
|
599 |
+
and `amount_authorized` is not NULL ';
|
600 |
+
|
601 |
+
$result = $readConnection->fetchAll($sql);
|
602 |
+
$tabOrderCbAut = array();
|
603 |
+
foreach ($result as $data) {
|
604 |
+
$tabOrderCbAut[$data['store_id']][] = array('id' => $data['entity_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id'], 'quote' => $data['quote_id']);
|
605 |
+
}
|
606 |
+
|
607 |
+
//Pour chaque store
|
608 |
+
foreach ($tabOrderCbAut as $storeId => $tabInfos) {
|
609 |
+
//on recupere le marchandAccount
|
610 |
+
$identifier = $tabIdentifierAmex[$storeId];
|
611 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
612 |
+
echo 'id : ' . $merchandAccount->getId();
|
613 |
+
|
614 |
+
//On met a jour la table de paiement
|
615 |
+
foreach ($tabInfos as $tabInfo) {
|
616 |
+
$addInfo = unserialize($tabInfo['add']);
|
617 |
+
|
618 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
619 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
620 |
+
$addInfo['options'] = 'standard';
|
621 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
622 |
+
$addInfo['operation'] = self::OPERATION_TYPE_AUTH;
|
623 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE;
|
624 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
625 |
+
$addInfo['alias'] = null;
|
626 |
+
$addInfo['delivery'] = true;
|
627 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
628 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfo['customer']);
|
629 |
+
if ($customer->getId() != '') {
|
630 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
631 |
+
}
|
632 |
+
}
|
633 |
+
$seriaAddInfo = serialize($addInfo);
|
634 |
+
|
635 |
+
$writeConnection->update($resource->getTableName('sales_flat_order_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'parent_id =' . $tabInfo['id']);
|
636 |
+
|
637 |
+
if ($tabInfo['quote'] != null && $tabInfo['quote'] != '') { // quote_id == null == commande récurrente
|
638 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'quote_id = ' . $tabInfo['quote']);
|
639 |
+
}
|
640 |
+
}
|
641 |
+
}
|
642 |
+
|
643 |
+
/*
|
644 |
+
* Etape 3-3 Migration des quotes cb visa non traité ... (paiement récurrent)
|
645 |
+
*/
|
646 |
+
|
647 |
+
$sql = '
|
648 |
+
SELECT `sfqp`.`payment_id`, `sfq`.`store_id`, `sfq`.`customer_id`, `sfqp`.`additional_information`
|
649 |
+
FROM `'.$this->_sales_flat_quote.'` sfq , `'.$this->_sales_flat_quote_payment.'` sfqp
|
650 |
+
WHERE `sfq`.`entity_id` = `sfqp`.`quote_id`
|
651 |
+
and `method` = "be2bill_amex"
|
652 |
+
and `sfqp`.`additional_information` not like "%be2bill_method_label%" ';
|
653 |
+
|
654 |
+
$result = $readConnection->fetchAll($sql);
|
655 |
+
$tabQuoteCb = array();
|
656 |
+
foreach ($result as $data) {
|
657 |
+
$tabQuoteCb[$data['store_id']][] = array('id' => $data['payment_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id']);
|
658 |
+
}
|
659 |
+
|
660 |
+
//Pour chaque store
|
661 |
+
foreach ($tabQuoteCb as $storeId => $tabInfos) {
|
662 |
+
//on recupere le marchandAccount
|
663 |
+
$identifier = $tabIdentifierAmex[$storeId];
|
664 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
665 |
+
|
666 |
+
//On met a jour la table de paiement
|
667 |
+
foreach ($tabInfos as $tabInfo) {
|
668 |
+
$addInfo = unserialize($tabInfo['add']);
|
669 |
+
|
670 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
671 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
672 |
+
$addInfo['options'] = 'standard';
|
673 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
674 |
+
$addInfo['operation'] = self::OPERATION_TYPE_PAYMENT;
|
675 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE_CAPTURE;
|
676 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
677 |
+
$addInfo['alias'] = null;
|
678 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
679 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfo['customer']);
|
680 |
+
if ($customer->getId() != '') {
|
681 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
682 |
+
}
|
683 |
+
}
|
684 |
+
$seriaAddInfo = serialize($addInfo);
|
685 |
+
|
686 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'payment_id = ' . $tabInfo['id']);
|
687 |
+
}
|
688 |
+
}
|
689 |
+
|
690 |
+
|
691 |
+
/*
|
692 |
+
* Fin Etape 3
|
693 |
+
*/
|
694 |
+
|
695 |
+
/*
|
696 |
+
* Etape 4-1 PAYPAL
|
697 |
+
*/
|
698 |
+
|
699 |
+
//A)on récupére les commandes (order) cb visa
|
700 |
+
$sql = '
|
701 |
+
SELECT `sfo`.`entity_id`, `sfo`.`quote_id` , `sfo`.`store_id`, `sfo`.`customer_id`, `sfop`.`additional_information`
|
702 |
+
FROM `'.$this->_sales_flat_order.'` sfo , `'.$this->_sales_flat_order_payment.'` sfop
|
703 |
+
WHERE `sfo`.`entity_id` = `sfop`.`parent_id`
|
704 |
+
and `method` = "be2bill_paypal"
|
705 |
+
and `amount_authorized` is NULL ';
|
706 |
+
|
707 |
+
$result = $readConnection->fetchAll($sql);
|
708 |
+
$tabOrderCbPai = array();
|
709 |
+
foreach ($result as $data) {
|
710 |
+
$tabOrderCbPai[$data['store_id']][] = array('id' => $data['entity_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id'], 'quote' => $data['quote_id']);
|
711 |
+
}
|
712 |
+
|
713 |
+
//Pour chaque store
|
714 |
+
foreach ($tabOrderCbPai as $storeId => $tabInfos) {
|
715 |
+
//on recupere le marchandAccount
|
716 |
+
$identifier = $tabIdentifierPaypal[$storeId];
|
717 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
718 |
+
echo 'id : ' . $merchandAccount->getId();
|
719 |
+
|
720 |
+
//On met a jour les tables de paiement
|
721 |
+
foreach ($tabInfos as $tabInfo) {
|
722 |
+
$addInfo = unserialize($tabInfo['add']);
|
723 |
+
|
724 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
725 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
726 |
+
$addInfo['options'] = 'standard';
|
727 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
728 |
+
$addInfo['operation'] = self::OPERATION_TYPE_PAYMENT;
|
729 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE_CAPTURE;
|
730 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
731 |
+
$addInfo['alias'] = null;
|
732 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
733 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfos['customer']);
|
734 |
+
if ($customer->getId() != '') {
|
735 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
736 |
+
}
|
737 |
+
}
|
738 |
+
$seriaAddInfo = serialize($addInfo);
|
739 |
+
|
740 |
+
$writeConnection->update($resource->getTableName('sales_flat_order_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'parent_id =' . $tabInfo['id']);
|
741 |
+
|
742 |
+
if ($tabInfo['quote'] != null && $tabInfo['quote'] != '') { // quote_id == null == commande récurrente
|
743 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'quote_id = ' . $tabInfo['quote']);
|
744 |
+
}
|
745 |
+
}
|
746 |
+
}
|
747 |
+
|
748 |
+
/*
|
749 |
+
* Etape 4-2 Migration des anciennes commandes Cb visa action = AUT
|
750 |
+
*/
|
751 |
+
|
752 |
+
//A)on récupère les quotes cb visa
|
753 |
+
$sql = '
|
754 |
+
SELECT `sfo`.`entity_id`, `sfo`.`quote_id` , `sfo`.`store_id`, `sfo`.`customer_id`, `sfop`.`additional_information`
|
755 |
+
FROM `'.$this->_sales_flat_order.'` sfo , `'.$this->_sales_flat_order_payment.'` sfop
|
756 |
+
WHERE `sfo`.`entity_id` = `sfop`.`parent_id`
|
757 |
+
and `method` = "be2bill_paypal"
|
758 |
+
and `amount_authorized` is not NULL ';
|
759 |
+
|
760 |
+
$result = $readConnection->fetchAll($sql);
|
761 |
+
$tabOrderCbAut = array();
|
762 |
+
foreach ($result as $data) {
|
763 |
+
$tabOrderCbAut[$data['store_id']][] = array('id' => $data['entity_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id'], 'quote' => $data['quote_id']);
|
764 |
+
}
|
765 |
+
|
766 |
+
//Pour chaque store
|
767 |
+
foreach ($tabOrderCbAut as $storeId => $tabInfos) {
|
768 |
+
//on recupere le marchandAccount
|
769 |
+
$identifier = $tabIdentifierPaypal[$storeId];
|
770 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
771 |
+
echo 'id : ' . $merchandAccount->getId();
|
772 |
+
|
773 |
+
//On met a jour la table de paiement
|
774 |
+
foreach ($tabInfos as $tabInfo) {
|
775 |
+
$addInfo = unserialize($tabInfo['add']);
|
776 |
+
|
777 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
778 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
779 |
+
$addInfo['options'] = 'standard';
|
780 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
781 |
+
$addInfo['operation'] = self::OPERATION_TYPE_AUTH;
|
782 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE;
|
783 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
784 |
+
$addInfo['alias'] = null;
|
785 |
+
$addInfo['delivery'] = true;
|
786 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
787 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfo['customer']);
|
788 |
+
if ($customer->getId() != '') {
|
789 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
790 |
+
}
|
791 |
+
}
|
792 |
+
$seriaAddInfo = serialize($addInfo);
|
793 |
+
|
794 |
+
$writeConnection->update($resource->getTableName('sales_flat_order_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'parent_id =' . $tabInfo['id']);
|
795 |
+
|
796 |
+
|
797 |
+
if ($tabInfo['quote'] != null && $tabInfo['quote'] != '') { // quote_id == null == commande récurrente
|
798 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'quote_id = ' . $tabInfo['quote']);
|
799 |
+
}
|
800 |
+
}
|
801 |
+
}
|
802 |
+
|
803 |
+
/*
|
804 |
+
* Etape 4-3 Migration des quotes cb visa non traité ... (paiement récurrent)
|
805 |
+
*/
|
806 |
+
|
807 |
+
$sql = '
|
808 |
+
SELECT `sfqp`.`payment_id`, `sfq`.`store_id`, `sfq`.`customer_id`, `sfqp`.`additional_information`
|
809 |
+
FROM `'.$this->_sales_flat_quote.'` sfq , `'.$this->_sales_flat_quote_payment.'` sfqp
|
810 |
+
WHERE `sfq`.`entity_id` = `sfqp`.`quote_id`
|
811 |
+
and `method` = "be2bill_paypal"
|
812 |
+
and `sfqp`.`additional_information` not like "%be2bill_method_label%" ';
|
813 |
+
|
814 |
+
$result = $readConnection->fetchAll($sql);
|
815 |
+
$tabQuoteCb = array();
|
816 |
+
foreach ($result as $data) {
|
817 |
+
$tabQuoteCb[$data['store_id']][] = array('id' => $data['payment_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id']);
|
818 |
+
}
|
819 |
+
|
820 |
+
//Pour chaque store
|
821 |
+
foreach ($tabQuoteCb as $storeId => $tabInfos) {
|
822 |
+
//on recupere le marchandAccount
|
823 |
+
$identifier = $tabIdentifierPaypal[$storeId];
|
824 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
825 |
+
echo 'id : ' . $merchandAccount->getId();
|
826 |
+
|
827 |
+
//On met a jour la table de paiement
|
828 |
+
foreach ($tabInfos as $tabInfo) {
|
829 |
+
$addInfo = unserialize($tabInfo['add']);
|
830 |
+
|
831 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
832 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
833 |
+
$addInfo['options'] = 'standard';
|
834 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
835 |
+
$addInfo['operation'] = self::OPERATION_TYPE_PAYMENT;
|
836 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE_CAPTURE;
|
837 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
838 |
+
$addInfo['alias'] = null;
|
839 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
840 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfo['customer']);
|
841 |
+
if ($customer->getId() != '') {
|
842 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
843 |
+
}
|
844 |
+
}
|
845 |
+
$seriaAddInfo = serialize($addInfo);
|
846 |
+
|
847 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'payment_id = ' . $tabInfo['id']);
|
848 |
+
}
|
849 |
+
}
|
850 |
+
/*
|
851 |
+
* Fin Etape 4
|
852 |
+
*/
|
853 |
+
|
854 |
+
/*
|
855 |
+
* Etape 5 N fois
|
856 |
+
*/
|
857 |
+
|
858 |
+
//A) on récupére les commandes (order) cb visa
|
859 |
+
$sql = '
|
860 |
+
SELECT `sfo`.`entity_id`, `sfo`.`quote_id` , `sfo`.`store_id`, `sfo`.`customer_id`, `sfop`.`additional_information`
|
861 |
+
FROM `'.$this->_sales_flat_order.'` sfo , `'.$this->_sales_flat_order_payment.'` sfop
|
862 |
+
WHERE `sfo`.`entity_id` = `sfop`.`parent_id`
|
863 |
+
and `method` = "be2bill_several"';
|
864 |
+
|
865 |
+
|
866 |
+
$result = $readConnection->fetchAll($sql);
|
867 |
+
$tabOrderCbPai = array();
|
868 |
+
foreach ($result as $data) {
|
869 |
+
$tabOrderCbPai[$data['store_id']][] = array('id' => $data['entity_id'], 'add' => $data['additional_information'], 'customer' => $data['customer_id'], 'quote' => $data['quote_id']);
|
870 |
+
}
|
871 |
+
|
872 |
+
//Pour chaque store
|
873 |
+
foreach ($tabOrderCbPai as $storeId => $tabInfos) {
|
874 |
+
//on recupere le marchandAccount
|
875 |
+
$identifier = $tabIdentifierCBVisa[$storeId];
|
876 |
+
$merchandAccount = Mage::getModel('be2bill/merchandconfigurationaccount')->loadByIdentifier($identifier, $storeId);
|
877 |
+
echo 'id : ' . $merchandAccount->getId();
|
878 |
+
|
879 |
+
//On met a jour les tables de paiement
|
880 |
+
foreach ($tabInfos as $tabInfo) {
|
881 |
+
$addInfo = unserialize($tabInfo['add']);
|
882 |
+
|
883 |
+
$addInfo['account_id'] = $merchandAccount->getId();
|
884 |
+
$addInfo['account'] = $merchandAccount->getData('b2b_xml_account_type_code');
|
885 |
+
$addInfo['options'] = 'standard';
|
886 |
+
$addInfo['be2bill_method_label'] = $merchandAccount->getData('configuration_account_name');
|
887 |
+
$addInfo['operation'] = self::OPERATION_TYPE_PAYMENT;
|
888 |
+
$addInfo['action'] = self::ACTION_AUTHORIZE_CAPTURE;
|
889 |
+
$addInfo['ntimes'] = $merchandAccount->getNtimes();
|
890 |
+
$addInfo['mode'] = $merchandAccount->getData('b2b_xml_mode_code');
|
891 |
+
$addInfo['alias'] = null;
|
892 |
+
if ($addInfo['use_oneclick'] == 'yes') {
|
893 |
+
$customer = Mage::getModel('customer/customer')->load($tabInfos['customer']);
|
894 |
+
if ($customer->getId() != '') {
|
895 |
+
$addInfo['alias'] = $customer->getData('be2bill_alias');
|
896 |
+
}
|
897 |
+
}
|
898 |
+
$seriaAddInfo = serialize($addInfo);
|
899 |
+
|
900 |
+
$writeConnection->update($resource->getTableName('sales_flat_order_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'parent_id =' . $tabInfo['id']);
|
901 |
+
|
902 |
+
if ($tabInfo['quote'] != null && $tabInfo['quote'] != '') { // quote_id == null == commande récurrente
|
903 |
+
$writeConnection->update($resource->getTableName('sales_flat_quote_payment'), array('method' => 'be2bill', 'additional_information' => $seriaAddInfo), 'quote_id = ' . $tabInfo['quote']);
|
904 |
+
}
|
905 |
+
}
|
906 |
+
}
|
907 |
+
|
908 |
+
/*
|
909 |
+
* Fin Etape 5
|
910 |
+
*/
|
911 |
+
} catch (Mage_Core_Exception $e) {
|
912 |
+
echo $this->_getSession()->addError($e->getMessage());
|
913 |
+
$this->getResponse()->setRedirect($this->getUrl('*/merchandaccount/'));
|
914 |
+
} catch (Exception $e) {
|
915 |
+
$this->_getSession()->addException($e, Mage::helper('be2bill')->__('Une erreur est survenue'));
|
916 |
+
$this->getResponse()->setRedirect($this->getUrl('*/merchandaccount/'));
|
917 |
+
return;
|
918 |
+
}
|
919 |
+
|
920 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('be2bill')->__('Transfert réalisé'));
|
921 |
+
$this->getResponse()->setRedirect($this->getUrl('*/merchandaccount/'));
|
922 |
+
}
|
923 |
+
|
924 |
+
}
|
app/code/community/Quadra/Be2bill/controllers/Checkout/OneclickController.php
ADDED
@@ -0,0 +1,528 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class Quadra_Be2bill_Checkout_OneclickController extends Mage_Core_Controller_Front_Action
|
17 |
+
{
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Action list where need check enabled cookie
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
protected $_cookieCheckActions = array('add');
|
25 |
+
protected $_merchandAccountId;
|
26 |
+
protected $_paymentMethod;
|
27 |
+
protected $_alias;
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Retrieve shopping cart model object
|
32 |
+
*
|
33 |
+
* @return Mage_Checkout_Model_Cart
|
34 |
+
*/
|
35 |
+
protected function _getCart()
|
36 |
+
{
|
37 |
+
return Mage::getSingleton('checkout/cart');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get checkout session model instance
|
42 |
+
*
|
43 |
+
* @return Mage_Checkout_Model_Session
|
44 |
+
*/
|
45 |
+
protected function _getSession()
|
46 |
+
{
|
47 |
+
return Mage::getSingleton('checkout/session');
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get current active quote instance
|
52 |
+
*
|
53 |
+
* @return Mage_Sales_Model_Quote
|
54 |
+
*/
|
55 |
+
protected function _getQuote()
|
56 |
+
{
|
57 |
+
return $this->_getCart()->getQuote();
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Set back redirect url to response
|
62 |
+
*
|
63 |
+
* @return Mage_Checkout_CartController
|
64 |
+
*/
|
65 |
+
protected function _goBack()
|
66 |
+
{
|
67 |
+
$redirectUrl = $this->getRequest()->getServer('HTTP_REFERER');
|
68 |
+
$this->getResponse()->setRedirect($redirectUrl);
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Initialize product instance from request data
|
74 |
+
*
|
75 |
+
* @return Mage_Catalog_Model_Product || false
|
76 |
+
*/
|
77 |
+
protected function _initProduct()
|
78 |
+
{
|
79 |
+
$productId = (int)$this->getRequest()->getParam('product');
|
80 |
+
if ($productId) {
|
81 |
+
$product = Mage::getModel('catalog/product')
|
82 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
83 |
+
->load($productId);
|
84 |
+
if ($product->getId()) {
|
85 |
+
return $product;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Initialise la commande
|
93 |
+
* @param string $alias
|
94 |
+
* @param int $merchandAcc
|
95 |
+
* @return Mage_Core_Model_Abstract
|
96 |
+
*/
|
97 |
+
protected function _initOrder($alias, $merchandAcc, $shippingMethodCode)
|
98 |
+
{
|
99 |
+
|
100 |
+
$cart = $this->_getCart();
|
101 |
+
if ($cart->getQuote()->getItemsCount()) {
|
102 |
+
$cart->init();
|
103 |
+
$cart->save();
|
104 |
+
}
|
105 |
+
|
106 |
+
$checkout = Mage::getSingleton('checkout/type_onepage');
|
107 |
+
$checkout->initCheckout();
|
108 |
+
$checkout->getQuote()->collectTotals()->save();
|
109 |
+
|
110 |
+
// set addresses
|
111 |
+
$addressId = $this->getRequest()->getParam('shipping_address_id', 0);
|
112 |
+
|
113 |
+
if ($addressId > 0) {
|
114 |
+
$checkout->saveBilling(array(), $addressId);
|
115 |
+
$checkout->saveShipping(array(), $addressId);
|
116 |
+
}
|
117 |
+
|
118 |
+
// get shipping address
|
119 |
+
$shippingAddress = $checkout->getQuote()->getShippingAddress();
|
120 |
+
|
121 |
+
$checkout->saveShippingMethod($shippingMethodCode);
|
122 |
+
$checkout->getQuote()
|
123 |
+
->setTotalsCollectedFlag(false)
|
124 |
+
->collectTotals()
|
125 |
+
->save();
|
126 |
+
|
127 |
+
$info = $merchandAcc->getData('id_b2b_merchand_configuration_account') . '.' . $merchandAcc->getB2bXmlAccountTypeCode() . '.' . $this->_paymentMethod;
|
128 |
+
|
129 |
+
$addInfo = array('oneclick' => 'use_oneclick');
|
130 |
+
|
131 |
+
$paymentData = array(
|
132 |
+
'method' => 'be2bill',
|
133 |
+
'be2bill_method' => $info,
|
134 |
+
$info => $addInfo,
|
135 |
+
'be2bill_method_label' => 'Paiement OneClick'
|
136 |
+
);
|
137 |
+
|
138 |
+
$checkout->savePayment($paymentData);
|
139 |
+
|
140 |
+
return $checkout;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Create order
|
145 |
+
* @param string $alias
|
146 |
+
* @param int $merchandAcc
|
147 |
+
* @return mixed
|
148 |
+
*/
|
149 |
+
protected function _createOrder($alias, $merchandAcc, $shippingMethodCode)
|
150 |
+
{
|
151 |
+
$checkout = $this->_initOrder($alias, $merchandAcc, $shippingMethodCode);
|
152 |
+
if ($checkout != null) {
|
153 |
+
try {
|
154 |
+
$checkout->saveOrder();
|
155 |
+
$redirectUrl = Mage::getUrl('be2bill/payments/oneclick', array('_secure' => true));
|
156 |
+
} catch (Exception $e) {
|
157 |
+
Mage::logException($e);
|
158 |
+
Mage::helper('checkout')->sendPaymentFailedEmail($checkout->getQuote(), $e->getMessage());
|
159 |
+
Mage::getSingleton('catalog/session')->addError($e->getMessage());
|
160 |
+
$redirectUrl = $this->getRequest()->getServer('HTTP_REFERER');
|
161 |
+
}
|
162 |
+
return $redirectUrl;
|
163 |
+
}
|
164 |
+
return $this->getRequest()->getServer('HTTP_REFERER');
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* retourne l'alias, l'id du compte et le code operation
|
169 |
+
* @param sting $aAliasParam
|
170 |
+
* @return void
|
171 |
+
*/
|
172 |
+
protected function splitAliasDatas($sAliasParam){
|
173 |
+
|
174 |
+
$aAliasParam = explode('|', $sAliasParam);
|
175 |
+
|
176 |
+
$this->_alias = $aAliasParam[0];
|
177 |
+
$this->_merchandAccountId = $aAliasParam[1];
|
178 |
+
$this->_paymentMethod = $aAliasParam[2];
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* retourne la méthode et montant de livraison Mirakl
|
184 |
+
* @param sting $aAliasParam
|
185 |
+
* @return array
|
186 |
+
*/
|
187 |
+
protected function splitShippingDatas($sShippingParam){
|
188 |
+
|
189 |
+
$aShippingParam = explode('|', $sShippingParam);
|
190 |
+
|
191 |
+
$aTmp['shipping_method_code'] = $aShippingParam[0];
|
192 |
+
$aTmp['shipping_method_amount'] = $aShippingParam[1];
|
193 |
+
$aTmp['shipping_method_label'] = $aShippingParam[2];
|
194 |
+
|
195 |
+
return $aTmp;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Order a product in one click
|
200 |
+
* @return redirection
|
201 |
+
*/
|
202 |
+
public function orderProductAction()
|
203 |
+
{
|
204 |
+
$this->_getSession()->clear();
|
205 |
+
$cart = $this->_getCart();
|
206 |
+
$params = $this->getRequest()->getParams();
|
207 |
+
|
208 |
+
// creation de la quote
|
209 |
+
$quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getStore()->getId())->save();
|
210 |
+
|
211 |
+
// split alias
|
212 |
+
$this->splitAliasDatas($params['alias_code']);
|
213 |
+
|
214 |
+
if ($this->_alias == null) {
|
215 |
+
Mage::getSingleton('catalog/session')->addError(Mage::helper('be2bill')->__('Veuillez réessayer ultérieurement.'));
|
216 |
+
$this->_goBack();
|
217 |
+
return;
|
218 |
+
}
|
219 |
+
|
220 |
+
// recuperer moyen de paiement
|
221 |
+
$merchandAcc = Mage::getModel('be2bill/merchandconfigurationaccount')->load($this->_merchandAccountId);
|
222 |
+
|
223 |
+
try {
|
224 |
+
if (isset($params['qty'])) {
|
225 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
226 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
227 |
+
);
|
228 |
+
$params['qty'] = $filter->filter($params['qty']);
|
229 |
+
}
|
230 |
+
|
231 |
+
$product = $this->_initProduct();
|
232 |
+
$related = $this->getRequest()->getParam('related_product');
|
233 |
+
|
234 |
+
// si mirakl actif et produit mkp ?
|
235 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive() && $product->getMiraklOfferId()) {
|
236 |
+
|
237 |
+
/*
|
238 |
+
* Vérifier le stock
|
239 |
+
*/
|
240 |
+
$aOffersWithQty = array($product->getMiraklOfferId() => $params['qty']);
|
241 |
+
$oShippingFees = Mage::helper('mirakl_api/shipping')->getShippingFees(
|
242 |
+
Mage::getModel('customer/address')->load(Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping())->getData('country_id'),
|
243 |
+
$aOffersWithQty
|
244 |
+
);
|
245 |
+
|
246 |
+
if($params['qty'] > $oShippingFees[0]->getData('offers')[0]->getData('quantity')){
|
247 |
+
Mage::throwException(Mage::helper('cataloginventory')->__('Not all products are available in the requested quantity'));
|
248 |
+
$this->_goBack();
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
|
252 |
+
// creation de la quote item
|
253 |
+
$quoteItem = Mage::getModel('sales/quote_item')
|
254 |
+
->setProduct($product)
|
255 |
+
->setQty($params['qty']);
|
256 |
+
|
257 |
+
// ajout du produit à la quote
|
258 |
+
$quote->addItem($quoteItem);
|
259 |
+
|
260 |
+
// mise à jour des frais de livraison
|
261 |
+
$aMiraklShipping = $this->splitShippingDatas($params['shipping_method_code']);
|
262 |
+
|
263 |
+
$quote
|
264 |
+
->setData('mirakl_base_shipping_fee', $aMiraklShipping['shipping_method_amount'])
|
265 |
+
->setData('mirakl_shipping_fee', $aMiraklShipping['shipping_method_amount'])
|
266 |
+
->setBaseShippingAmount($aMiraklShipping['shipping_method_amount'])
|
267 |
+
->setShippingAmount($aMiraklShipping['shipping_method_amount'])
|
268 |
+
->save();
|
269 |
+
|
270 |
+
// recuperation de l'objet adresse pour definir la livraison magento
|
271 |
+
$address = $quote->getShippingAddress();
|
272 |
+
|
273 |
+
$address
|
274 |
+
->setShippingAmount($aMiraklShipping['shipping_method_amount'])
|
275 |
+
->setBaseShippingAmount($aMiraklShipping['shipping_method_amount'])
|
276 |
+
->setShippingMethod('freeshipping_freeshipping')
|
277 |
+
->setShippingCode('freeshipping')
|
278 |
+
->setCollectShippingRates(true)
|
279 |
+
->save();
|
280 |
+
|
281 |
+
$rate = Mage::getModel('sales/quote_address_rate')
|
282 |
+
->setAddressId($address->getId())
|
283 |
+
->setCarrier('freeshipping')
|
284 |
+
->setCarrierTitle('Mirakl')
|
285 |
+
->setCode('freeshipping_freeshipping')
|
286 |
+
->setMethod('freeshipping')
|
287 |
+
->setPrice($aMiraklShipping['shipping_method_amount'])
|
288 |
+
->setMethodTitle('Mirakl')
|
289 |
+
->save();
|
290 |
+
|
291 |
+
$shippingMethodCode = 'freeshipping_freeshipping';
|
292 |
+
|
293 |
+
$quote->setBaseShippingAmount($aMiraklShipping['shipping_method_amount']);
|
294 |
+
$quote->setShippingAmount($aMiraklShipping['shipping_method_amount']);
|
295 |
+
|
296 |
+
// recuperation de l'objet adresse pour definir la livraison magento par defaut
|
297 |
+
$address = $quote->getShippingAddress();
|
298 |
+
$address
|
299 |
+
->setShippingMethod('freeshipping_freeshipping')
|
300 |
+
->setCollectShippingRates(true)
|
301 |
+
->save();
|
302 |
+
|
303 |
+
$quote->collectTotals();
|
304 |
+
$quote->save();
|
305 |
+
}
|
306 |
+
else{
|
307 |
+
// verification de la disponibilité du produit
|
308 |
+
if (!$product) {
|
309 |
+
$this->_goBack();
|
310 |
+
return;
|
311 |
+
}
|
312 |
+
|
313 |
+
$shippingMethodCode = $params['shipping_method_code'];
|
314 |
+
|
315 |
+
// creation de la quote item
|
316 |
+
$quoteItem = Mage::getModel('sales/quote_item')
|
317 |
+
->setProduct($product)
|
318 |
+
->setQty($params['qty']);
|
319 |
+
|
320 |
+
// ajout du produit à la quote
|
321 |
+
$quote->addItem($quoteItem);
|
322 |
+
|
323 |
+
$quote->collectTotals();
|
324 |
+
$quote->save();
|
325 |
+
}
|
326 |
+
|
327 |
+
$cart->setQuote($quote);
|
328 |
+
|
329 |
+
if (!empty($related)) {
|
330 |
+
$cart->addProductsByIds(explode(',', $related));
|
331 |
+
}
|
332 |
+
|
333 |
+
$cart->save();
|
334 |
+
$this->_getSession()->setCartWasUpdated(true);
|
335 |
+
|
336 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive() && $product->getMiraklOfferId()) {
|
337 |
+
// recuperation du last quote item pour mettre à jour livraison
|
338 |
+
$items = $quote->getAllItems();
|
339 |
+
$lastItem = null;
|
340 |
+
$max = 0;
|
341 |
+
foreach ($items as $item){
|
342 |
+
if ($item->getId() > $max) {
|
343 |
+
$max = $item->getId();
|
344 |
+
$lastItem = $item;
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
if($lastItem){
|
349 |
+
// mise à jour specifique a mirakl
|
350 |
+
$product = $lastItem->getProduct();
|
351 |
+
|
352 |
+
$lastItem->setData('mirakl_offer_id', $product->getData('mirakl_offer_id'));
|
353 |
+
$lastItem->setData('mirakl_shop_id', $product->getData('mirakl_shop_id'));
|
354 |
+
$lastItem->setData('mirakl_shop_name', $product->getData('mirakl_shop_id'));
|
355 |
+
$lastItem->setData('mirakl_shipping_type', $aMiraklShipping['shipping_method_code']);
|
356 |
+
$lastItem->setData('mirakl_shipping_type_label', $aMiraklShipping['shipping_method_label']);
|
357 |
+
$lastItem->setData('mirakl_base_shipping_fee', $aMiraklShipping['shipping_method_amount']);
|
358 |
+
$lastItem->setData('mirakl_shipping_fee', $aMiraklShipping['shipping_method_amount']);
|
359 |
+
$lastItem->save();
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
/*
|
364 |
+
* @todo remove wishlist observer processAddToCart
|
365 |
+
*/
|
366 |
+
Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()));
|
367 |
+
|
368 |
+
// conditions pour affichage de la page intermediaire (échancier + CVV)
|
369 |
+
if ($this->_paymentMethod == 'ntimes' || $merchandAcc->useOneClickCVV()) {
|
370 |
+
$checkout = $this->_initOrder($this->_alias, $merchandAcc, $shippingMethodCode);
|
371 |
+
$this->getResponse()->setRedirect(Mage::getUrl('be2bill/checkout_oneclick/info', array('s_m' => $params['shipping_method_code'], 'quote_id' => $checkout->getQuote()->getId(), '_secure' => true)));
|
372 |
+
}
|
373 |
+
else {
|
374 |
+
$redirectUrl = $this->_createOrder($this->_alias, $merchandAcc, $shippingMethodCode);
|
375 |
+
$this->getResponse()->setRedirect($redirectUrl);
|
376 |
+
}
|
377 |
+
|
378 |
+
} catch (Mage_Core_Exception $e) {
|
379 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
380 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
381 |
+
}
|
382 |
+
else {
|
383 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
384 |
+
foreach ($messages as $message) {
|
385 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
386 |
+
}
|
387 |
+
}
|
388 |
+
|
389 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
390 |
+
if ($url) {
|
391 |
+
$this->getResponse()->setRedirect($url);
|
392 |
+
} else {
|
393 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
394 |
+
}
|
395 |
+
} catch (Exception $e) {
|
396 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
397 |
+
Mage::logException($e);
|
398 |
+
$this->_goBack();
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
public function infoAction()
|
403 |
+
{
|
404 |
+
$this->loadLayout();
|
405 |
+
$this->_initLayoutMessages('catalog/session');
|
406 |
+
$this->_initLayoutMessages('checkout/session');
|
407 |
+
$this->renderLayout();
|
408 |
+
}
|
409 |
+
|
410 |
+
public function infoPostAction()
|
411 |
+
{
|
412 |
+
$checkout = Mage::getSingleton('checkout/type_onepage');
|
413 |
+
$params = $this->getRequest()->getParams();
|
414 |
+
|
415 |
+
if(isset($params['payment']['cvv_oneclick']) && $params['payment']['cvv_oneclick'] != ''){
|
416 |
+
$checkout->getQuote()->getPayment()->setAdditionalInformation('cvv_oneclick',trim($params['payment']['cvv_oneclick']) );
|
417 |
+
}
|
418 |
+
else{
|
419 |
+
$checkout->getQuote()->getPayment()->setAdditionalInformation('cvv_oneclick',null );
|
420 |
+
}
|
421 |
+
|
422 |
+
$checkout->getQuote()
|
423 |
+
->setTotalsCollectedFlag(false)
|
424 |
+
->collectTotals()
|
425 |
+
->save();
|
426 |
+
|
427 |
+
try {
|
428 |
+
$checkout->saveOrder();
|
429 |
+
$paymentMethod = explode('_', $checkout->getQuote()->getPayment()->getMethod());
|
430 |
+
$redirectUrl = Mage::getUrl('be2bill/payments/oneclick', array('_secure' => true));
|
431 |
+
} catch (Exception $e) {
|
432 |
+
Mage::logException($e);
|
433 |
+
Mage::helper('checkout')->sendPaymentFailedEmail($checkout->getQuote(), $e->getMessage());
|
434 |
+
Mage::getSingleton('catalog/session')->addError($e->getMessage());
|
435 |
+
$redirectUrl = $this->getRequest()->getServer('HTTP_REFERER');
|
436 |
+
}
|
437 |
+
|
438 |
+
$this->getResponse()->setRedirect($redirectUrl);
|
439 |
+
}
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Sauvegarde la méthode de livraison
|
443 |
+
*/
|
444 |
+
public function saveShippingMethodAction()
|
445 |
+
{
|
446 |
+
$shippingMethodCode = $this->getRequest()->getParam('estimate_method');
|
447 |
+
|
448 |
+
$checkout = Mage::getSingleton('checkout/type_onepage');
|
449 |
+
|
450 |
+
$quote = $checkout->getQuote();
|
451 |
+
|
452 |
+
if (Mage::helper('be2bill')->isMiraklInstalledAndActive() && $quote->getAllItems()[0]->getMiraklOfferId()){
|
453 |
+
// mise à jour des frais de livraison
|
454 |
+
$aMiraklShipping = $this->splitShippingDatas($shippingMethodCode);
|
455 |
+
$shippingMethodCode = 'freeshipping_freeshipping';
|
456 |
+
|
457 |
+
// QUOTE
|
458 |
+
$quote
|
459 |
+
->setData('mirakl_base_shipping_fee', $aMiraklShipping['shipping_method_amount'])
|
460 |
+
->setData('mirakl_shipping_fee', $aMiraklShipping['shipping_method_amount'])
|
461 |
+
->setBaseShippingAmount($aMiraklShipping['shipping_method_amount'])
|
462 |
+
->setShippingAmount($aMiraklShipping['shipping_method_amount'])
|
463 |
+
->save();
|
464 |
+
|
465 |
+
// ADDRESS
|
466 |
+
// recuperation de l'objet adresse pour definir la livraison magento
|
467 |
+
$address = $quote->getShippingAddress();
|
468 |
+
$address
|
469 |
+
->setShippingAmount($aMiraklShipping['shipping_method_amount'])
|
470 |
+
->setBaseShippingAmount($aMiraklShipping['shipping_method_amount'])
|
471 |
+
->setShippingMethod('freeshipping_freeshipping')
|
472 |
+
->setShippingCode('freeshipping')
|
473 |
+
->setCollectShippingRates(true)
|
474 |
+
->save();
|
475 |
+
|
476 |
+
// RATE
|
477 |
+
$rate = Mage::getModel('sales/quote_address_rate')
|
478 |
+
->setAddressId($address->getId())
|
479 |
+
->setCarrier('freeshipping')
|
480 |
+
->setCarrierTitle('Mirakl')
|
481 |
+
->setCode('freeshipping_freeshipping')
|
482 |
+
->setMethod('freeshipping')
|
483 |
+
->setPrice($aMiraklShipping['shipping_method_amount'])
|
484 |
+
->setMethodTitle('Mirakl')
|
485 |
+
->save();
|
486 |
+
|
487 |
+
// recuperation de l'objet adresse pour definir la livraison magento par defaut
|
488 |
+
$quote->collectTotals();
|
489 |
+
$quote->save();
|
490 |
+
}
|
491 |
+
|
492 |
+
$checkout->saveShippingMethod($shippingMethodCode);
|
493 |
+
$checkout->setQuote($quote)
|
494 |
+
->getQuote()
|
495 |
+
->setTotalsCollectedFlag(false)
|
496 |
+
->collectTotals()
|
497 |
+
->save();
|
498 |
+
|
499 |
+
$block = $this->getLayout()->createBlock('be2bill/checkout_oneclick_info', 'be2bill.checkout.oneclick.info.review')
|
500 |
+
->setTemplate('be2bill/checkout/oneclick/info/review.phtml');
|
501 |
+
$block->addItemRender('simple', 'checkout/cart_item_renderer', 'be2bill/checkout/cart/item/default.phtml');
|
502 |
+
$block->addItemRender('grouped', 'checkout/cart_item_renderer_grouped', 'be2bill/checkout/cart/item/default.phtml');
|
503 |
+
$block->addItemRender('configurable', 'checkout/cart_item_renderer_configurable', 'be2bill/checkout/cart/item/default.phtml');
|
504 |
+
|
505 |
+
$totals = $this->getLayout()->createBlock('checkout/cart_totals', 'checkout.cart.totals')
|
506 |
+
->setTemplate('be2bill/checkout/cart/totals.phtml');
|
507 |
+
|
508 |
+
$block->append($totals, 'totals');
|
509 |
+
|
510 |
+
return $this->getResponse()->setBody($block->toHtml());
|
511 |
+
}
|
512 |
+
|
513 |
+
/**
|
514 |
+
* methode ajax permettant de retourner la mise à jour des frais de livraison
|
515 |
+
* /be2bill/checkout_oneclick/updateShippingFee
|
516 |
+
*/
|
517 |
+
public function updateShippingFeeAction(){
|
518 |
+
|
519 |
+
$result['html'] = Mage::helper('be2bill/data')->getShippingMethodsSelect(
|
520 |
+
$this->getRequest()->getParam('productId'),
|
521 |
+
$this->getRequest()->getParam('addressId'),
|
522 |
+
$this->getRequest()->getParam('qty')
|
523 |
+
);
|
524 |
+
|
525 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
526 |
+
}
|
527 |
+
|
528 |
+
}
|
app/code/community/Quadra/Be2bill/controllers/PaymentsController.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
class Quadra_Be2bill_PaymentsController extends Quadra_Be2bill_Controller_Action
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get singleton with be2bill order transaction information
|
25 |
+
*
|
26 |
+
* @return Quadra_Be2bill_Model_Method_PaymentMethods
|
27 |
+
*/
|
28 |
+
public function getMethodInstance()
|
29 |
+
{
|
30 |
+
return Mage::getSingleton('be2bill/method_paymentMethods');
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Quadra/Be2bill/controllers/TemplateController.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
class Quadra_Be2bill_TemplateController extends Mage_Core_Controller_Front_Action
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* @deprecated
|
21 |
+
* load layout
|
22 |
+
*/
|
23 |
+
/* public function nosslAction()
|
24 |
+
{
|
25 |
+
$this->loadLayout();
|
26 |
+
$this->renderLayout();
|
27 |
+
} */
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @deprecated
|
31 |
+
* load layout
|
32 |
+
*/
|
33 |
+
/* public function sslAction()
|
34 |
+
{
|
35 |
+
$this->loadLayout();
|
36 |
+
$this->renderLayout();
|
37 |
+
} */
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @deprecated
|
41 |
+
* load layout
|
42 |
+
*/
|
43 |
+
/* public function iframeAction()
|
44 |
+
{
|
45 |
+
$this->loadLayout();
|
46 |
+
$this->renderLayout();
|
47 |
+
} */
|
48 |
+
|
49 |
+
/**
|
50 |
+
* load layout
|
51 |
+
*/
|
52 |
+
public function successAction()
|
53 |
+
{
|
54 |
+
$this->loadLayout();
|
55 |
+
$this->renderLayout();
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* load layout
|
60 |
+
*/
|
61 |
+
public function failureAction()
|
62 |
+
{
|
63 |
+
$this->loadLayout();
|
64 |
+
$this->renderLayout();
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
app/code/community/Quadra/Be2bill/etc/adminhtml.xml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<menu>
|
20 |
+
<be2bill translate="title" module="be2bill">
|
21 |
+
<title>Be2Bill</title>
|
22 |
+
<sort_order>90</sort_order>
|
23 |
+
<children>
|
24 |
+
<manage_payment translate="title" module="be2bill">
|
25 |
+
<title>Configuration des comptes</title>
|
26 |
+
<action>adminhtml/merchandaccount/</action>
|
27 |
+
<sort_order>10</sort_order>
|
28 |
+
</manage_payment>
|
29 |
+
<manage_api translate="title" module="be2bill">
|
30 |
+
<title>Configuration de l'API</title>
|
31 |
+
<action>adminhtml/system_config/edit/section/be2bill/</action>
|
32 |
+
<sort_order>20</sort_order>
|
33 |
+
</manage_api>
|
34 |
+
</children>
|
35 |
+
</be2bill>
|
36 |
+
</menu>
|
37 |
+
<acl>
|
38 |
+
<resources>
|
39 |
+
<admin>
|
40 |
+
<children>
|
41 |
+
<be2bill>
|
42 |
+
<children>
|
43 |
+
<manage_payment translate="title" module="be2bill">
|
44 |
+
<title>Configuration des comptes</title>
|
45 |
+
<sort_order>10</sort_order>
|
46 |
+
</manage_payment>
|
47 |
+
<manage_api translate="title" module="be2bill">
|
48 |
+
<title>Configuration de l'API</title>
|
49 |
+
<sort_order>20</sort_order>
|
50 |
+
</manage_api>
|
51 |
+
</children>
|
52 |
+
</be2bill>
|
53 |
+
<system>
|
54 |
+
<children>
|
55 |
+
<config>
|
56 |
+
<children>
|
57 |
+
<be2bill translate="title" module="be2bill">
|
58 |
+
<title>Be2bill</title>
|
59 |
+
</be2bill>
|
60 |
+
</children>
|
61 |
+
</config>
|
62 |
+
</children>
|
63 |
+
</system>
|
64 |
+
</children>
|
65 |
+
</admin>
|
66 |
+
</resources>
|
67 |
+
</acl>
|
68 |
+
</config>
|
app/code/community/Quadra/Be2bill/etc/config.xml
ADDED
@@ -0,0 +1,332 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<modules>
|
20 |
+
<Quadra_Be2bill>
|
21 |
+
<version>5.0.7</version>
|
22 |
+
</Quadra_Be2bill>
|
23 |
+
</modules>
|
24 |
+
<global>
|
25 |
+
<be2bill>
|
26 |
+
<remote_addr_headers>
|
27 |
+
<http_x_forwarded_for>HTTP_X_FORWARDED_FOR</http_x_forwarded_for>
|
28 |
+
<remote_addr>REMOTE_ADDR</remote_addr>
|
29 |
+
</remote_addr_headers>
|
30 |
+
</be2bill>
|
31 |
+
<blocks>
|
32 |
+
<be2bill>
|
33 |
+
<class>Quadra_Be2bill_Block</class>
|
34 |
+
</be2bill>
|
35 |
+
<adminhtml>
|
36 |
+
<rewrite>
|
37 |
+
<sales_order_view_tab_transactions>Quadra_Be2bill_Block_Adminhtml_Sales_Order_View_Tab_Transactions</sales_order_view_tab_transactions>
|
38 |
+
<sales_transactions_grid>Quadra_Be2bill_Block_Adminhtml_Sales_Transactions_Grid</sales_transactions_grid>
|
39 |
+
</rewrite>
|
40 |
+
</adminhtml>
|
41 |
+
</blocks>
|
42 |
+
<helpers>
|
43 |
+
<be2bill>
|
44 |
+
<class>Quadra_Be2bill_Helper</class>
|
45 |
+
</be2bill>
|
46 |
+
</helpers>
|
47 |
+
<models>
|
48 |
+
<be2bill>
|
49 |
+
<class>Quadra_Be2bill_Model</class>
|
50 |
+
<resourceModel>be2bill_resource</resourceModel>
|
51 |
+
</be2bill>
|
52 |
+
<customer>
|
53 |
+
<rewrite>
|
54 |
+
<customer>Quadra_Be2bill_Model_Customer</customer>
|
55 |
+
</rewrite>
|
56 |
+
</customer>
|
57 |
+
<be2bill_resource>
|
58 |
+
<class>Quadra_Be2bill_Model_Resource</class>
|
59 |
+
<deprecatedNode>be2bill_mysql4</deprecatedNode>
|
60 |
+
<entities>
|
61 |
+
<xmlmodeslang>
|
62 |
+
<table>b2b_xml_modes_lang</table>
|
63 |
+
</xmlmodeslang>
|
64 |
+
|
65 |
+
<xmloperationlang>
|
66 |
+
<table>b2b_xml_operation_lang</table>
|
67 |
+
</xmloperationlang>
|
68 |
+
|
69 |
+
<xmloptions>
|
70 |
+
<table>b2b_xml_options</table>
|
71 |
+
</xmloptions>
|
72 |
+
|
73 |
+
<xmloptionslang>
|
74 |
+
<table>b2b_xml_options_lang</table>
|
75 |
+
</xmloptionslang>
|
76 |
+
|
77 |
+
<xmlaccounttypes>
|
78 |
+
<table>b2b_xml_account_types</table>
|
79 |
+
</xmlaccounttypes>
|
80 |
+
|
81 |
+
<xmlaccounttypelang>
|
82 |
+
<table>b2b_xml_account_type_lang</table>
|
83 |
+
</xmlaccounttypelang>
|
84 |
+
|
85 |
+
<xmlaccounttypecurrency>
|
86 |
+
<table>b2b_xml_account_type_currency</table>
|
87 |
+
</xmlaccounttypecurrency>
|
88 |
+
|
89 |
+
<xmlaccounttypeparameterset>
|
90 |
+
<table>b2b_xml_account_type_parameter_set</table>
|
91 |
+
</xmlaccounttypeparameterset>
|
92 |
+
|
93 |
+
<xmlaccounttypeparametersetcountries>
|
94 |
+
<table>b2b_xml_account_type_parameter_set_countries</table>
|
95 |
+
</xmlaccounttypeparametersetcountries>
|
96 |
+
|
97 |
+
<xmlaccounttypeparametersetmode>
|
98 |
+
<table>b2b_xml_account_type_parameter_set_mode</table>
|
99 |
+
</xmlaccounttypeparametersetmode>
|
100 |
+
|
101 |
+
<xmlaccounttypeparametersetoperation>
|
102 |
+
<table>b2b_xml_account_type_parameter_set_operation</table>
|
103 |
+
</xmlaccounttypeparametersetoperation>
|
104 |
+
|
105 |
+
<xmlaccounttypeparametersetparameters>
|
106 |
+
<table>b2b_xml_account_type_parameter_set_parameters</table>
|
107 |
+
</xmlaccounttypeparametersetparameters>
|
108 |
+
|
109 |
+
<xmlaccounttypeparametersetoptions>
|
110 |
+
<table>b2b_xml_account_type_parameter_set_options</table>
|
111 |
+
</xmlaccounttypeparametersetoptions>
|
112 |
+
|
113 |
+
<merchandconfigurationaccount>
|
114 |
+
<table>b2b_merchand_configuration_account</table>
|
115 |
+
</merchandconfigurationaccount>
|
116 |
+
|
117 |
+
<merchandconfigurationaccountoptions>
|
118 |
+
<table>b2b_merchand_configuration_account_options</table>
|
119 |
+
</merchandconfigurationaccountoptions>
|
120 |
+
|
121 |
+
<merchandconfigurationaccountcountries>
|
122 |
+
<table>b2b_merchand_configuration_account_countries</table>
|
123 |
+
</merchandconfigurationaccountcountries>
|
124 |
+
|
125 |
+
<alias>
|
126 |
+
<table>b2b_alias</table>
|
127 |
+
</alias>
|
128 |
+
</entities>
|
129 |
+
</be2bill_resource>
|
130 |
+
</models>
|
131 |
+
<resources>
|
132 |
+
<be2bill_setup>
|
133 |
+
<setup>
|
134 |
+
<module>Quadra_Be2bill</module>
|
135 |
+
</setup>
|
136 |
+
</be2bill_setup>
|
137 |
+
<!-- connection pour ecrire -->
|
138 |
+
<be2bill_write>
|
139 |
+
<connection>
|
140 |
+
<use>core_write</use>
|
141 |
+
</connection>
|
142 |
+
</be2bill_write>
|
143 |
+
<!-- connection pour lire-->
|
144 |
+
<be2bill_read>
|
145 |
+
<connection>
|
146 |
+
<use>core_read</use>
|
147 |
+
</connection>
|
148 |
+
</be2bill_read>
|
149 |
+
</resources>
|
150 |
+
<sales>
|
151 |
+
<order>
|
152 |
+
<statuses>
|
153 |
+
<!-- retained for backwards compatibility, not used after version 1.4.2 -->
|
154 |
+
<pending_be2bill translate="label">
|
155 |
+
<label>Pending Capture Be2bill</label>
|
156 |
+
</pending_be2bill>
|
157 |
+
</statuses>
|
158 |
+
</order>
|
159 |
+
</sales>
|
160 |
+
<events>
|
161 |
+
<!-- <sales_order_save_after>
|
162 |
+
<observers>
|
163 |
+
<auto_invoice_order>
|
164 |
+
<class>be2bill/observer</class>
|
165 |
+
<method>capture</method>
|
166 |
+
</auto_invoice_order>
|
167 |
+
</observers>
|
168 |
+
</sales_order_save_after>-->
|
169 |
+
<mirakl_customer_debit>
|
170 |
+
<observers>
|
171 |
+
<captureMkpProducts>
|
172 |
+
<class>be2bill/observer</class>
|
173 |
+
<method>captureMkpProducts</method>
|
174 |
+
</captureMkpProducts>
|
175 |
+
</observers>
|
176 |
+
</mirakl_customer_debit>
|
177 |
+
<mirakl_customer_refund>
|
178 |
+
<observers>
|
179 |
+
<captureMkpProducts>
|
180 |
+
<class>be2bill/observer</class>
|
181 |
+
<method>refundMkpProducts</method>
|
182 |
+
</captureMkpProducts>
|
183 |
+
</observers>
|
184 |
+
</mirakl_customer_refund>
|
185 |
+
</events>
|
186 |
+
</global>
|
187 |
+
<frontend>
|
188 |
+
<secure_url>
|
189 |
+
<be2bill>/be2bill/payments</be2bill>
|
190 |
+
<be2bill_template>/be2bill/template</be2bill_template>
|
191 |
+
<be2bill_checkout_oneclick>/be2bill/checkout_oneclick</be2bill_checkout_oneclick>
|
192 |
+
</secure_url>
|
193 |
+
<routers>
|
194 |
+
<be2bill>
|
195 |
+
<use>standard</use>
|
196 |
+
<args>
|
197 |
+
<module>Quadra_Be2bill</module>
|
198 |
+
<frontName>be2bill</frontName>
|
199 |
+
</args>
|
200 |
+
</be2bill>
|
201 |
+
</routers>
|
202 |
+
<translate>
|
203 |
+
<modules>
|
204 |
+
<Quadra_Be2bill>
|
205 |
+
<files>
|
206 |
+
<default>Quadra_Be2bill.csv</default>
|
207 |
+
</files>
|
208 |
+
</Quadra_Be2bill>
|
209 |
+
</modules>
|
210 |
+
</translate>
|
211 |
+
<layout>
|
212 |
+
<updates>
|
213 |
+
<be2bill>
|
214 |
+
<file>be2bill.xml</file>
|
215 |
+
</be2bill>
|
216 |
+
</updates>
|
217 |
+
</layout>
|
218 |
+
<events>
|
219 |
+
<payment_method_is_active>
|
220 |
+
<observers>
|
221 |
+
<be2bill_alert_on_cart>
|
222 |
+
<type>singleton</type>
|
223 |
+
<class>be2bill/observer</class>
|
224 |
+
<method>checkPaymentMethod</method>
|
225 |
+
</be2bill_alert_on_cart>
|
226 |
+
</observers>
|
227 |
+
</payment_method_is_active>
|
228 |
+
<checkout_submit_all_after>
|
229 |
+
<observers>
|
230 |
+
<be2bill_recurring_redirect_url>
|
231 |
+
<type>singleton</type>
|
232 |
+
<class>be2bill/observer</class>
|
233 |
+
<method>setRedirectUrl</method>
|
234 |
+
</be2bill_recurring_redirect_url>
|
235 |
+
</observers>
|
236 |
+
</checkout_submit_all_after>
|
237 |
+
</events>
|
238 |
+
</frontend>
|
239 |
+
<admin>
|
240 |
+
<routers>
|
241 |
+
<adminhtml>
|
242 |
+
<args>
|
243 |
+
<modules>
|
244 |
+
<Quadra_Be2bill before="Mage_Adminhtml">Quadra_Be2bill_Adminhtml</Quadra_Be2bill>
|
245 |
+
</modules>
|
246 |
+
</args>
|
247 |
+
</adminhtml>
|
248 |
+
</routers>
|
249 |
+
</admin>
|
250 |
+
<adminhtml>
|
251 |
+
<translate>
|
252 |
+
<modules>
|
253 |
+
<Quadra_Be2bill>
|
254 |
+
<files>
|
255 |
+
<default>Quadra_Be2bill.csv</default>
|
256 |
+
</files>
|
257 |
+
</Quadra_Be2bill>
|
258 |
+
</modules>
|
259 |
+
</translate>
|
260 |
+
<layout>
|
261 |
+
<updates>
|
262 |
+
<be2bill>
|
263 |
+
<file>be2bill.xml</file>
|
264 |
+
</be2bill>
|
265 |
+
</updates>
|
266 |
+
</layout>
|
267 |
+
</adminhtml>
|
268 |
+
<default>
|
269 |
+
<be2bill>
|
270 |
+
<be2bill_api>
|
271 |
+
<url_xml>https://template.be2bill.com/cms/xml/v1/configuration.xml</url_xml>
|
272 |
+
<uri_rest>https://secure-magenta1.be2bill.com/front/service/rest/process.php</uri_rest>
|
273 |
+
<uri_rest_high_dispo>https://secure-magenta2.be2bill.comfront/service/rest/process.php</uri_rest_high_dispo>
|
274 |
+
<uri_rest_test>https://secure-test.be2bill.com/front/service/rest/process.php</uri_rest_test>
|
275 |
+
<uri_form></uri_form>
|
276 |
+
<uri_form_test>https://secure-test.be2bill.com/front/form/process</uri_form_test>
|
277 |
+
<direct_submit_test>https://secure-test.be2bill.com/front/direct-submit/process</direct_submit_test>
|
278 |
+
<debug>0</debug>
|
279 |
+
<test>0</test>
|
280 |
+
<klarna_doc>TAXSTATEMENT</klarna_doc>
|
281 |
+
</be2bill_api>
|
282 |
+
</be2bill>
|
283 |
+
<payment>
|
284 |
+
<be2bill>
|
285 |
+
<active>1</active>
|
286 |
+
<model>be2bill/method_paymentMethods</model>
|
287 |
+
<title>Be2Bill</title>
|
288 |
+
<allowspecific>0</allowspecific>
|
289 |
+
<auth_validity_day>10</auth_validity_day>
|
290 |
+
<hide_card_fullname>1</hide_card_fullname>
|
291 |
+
<allow_range_ips>80.70.213.64/27,80.70.210.64/27,80.70.210.32/27,78.24.33.228</allow_range_ips>
|
292 |
+
<statues_order_to_clean>pending_be2bill</statues_order_to_clean><!-- if you had some one, separe them by comma -->
|
293 |
+
</be2bill>
|
294 |
+
</payment>
|
295 |
+
</default>
|
296 |
+
<crontab>
|
297 |
+
<jobs>
|
298 |
+
<submit_recurring_profiles>
|
299 |
+
<schedule>
|
300 |
+
<cron_expr>0 5,8,12,16,19,21 * * *</cron_expr>
|
301 |
+
</schedule>
|
302 |
+
<run>
|
303 |
+
<model>be2bill/observer::submitRecurringProfiles</model>
|
304 |
+
</run>
|
305 |
+
</submit_recurring_profiles>
|
306 |
+
<clean_orders_be2bill>
|
307 |
+
<schedule>
|
308 |
+
<cron_expr>0 4 * * *</cron_expr>
|
309 |
+
</schedule>
|
310 |
+
<run>
|
311 |
+
<model>be2bill/observer::cleanOrdersInPendingBe2bill</model>
|
312 |
+
</run>
|
313 |
+
</clean_orders_be2bill>
|
314 |
+
<clean_orders_be2bill_in_pending>
|
315 |
+
<schedule>
|
316 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
317 |
+
</schedule>
|
318 |
+
<run>
|
319 |
+
<model>be2bill/observer::cancelOrdersInPending</model>
|
320 |
+
</run>
|
321 |
+
</clean_orders_be2bill_in_pending>
|
322 |
+
<submit_defered_orders>
|
323 |
+
<schedule>
|
324 |
+
<cron_expr>0 3 * * *</cron_expr>
|
325 |
+
</schedule>
|
326 |
+
<run>
|
327 |
+
<model>be2bill/observer::submitDeferedOrders</model>
|
328 |
+
</run>
|
329 |
+
</submit_defered_orders>
|
330 |
+
</jobs>
|
331 |
+
</crontab>
|
332 |
+
</config>
|
app/code/community/Quadra/Be2bill/etc/system.xml
ADDED
@@ -0,0 +1,410 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<tabs>
|
20 |
+
<be2bill translate="label" module="be2bill">
|
21 |
+
<label>Be2bill</label>
|
22 |
+
<sort_order>100000</sort_order>
|
23 |
+
</be2bill>
|
24 |
+
</tabs>
|
25 |
+
<sections>
|
26 |
+
<be2bill translate="label" module="be2bill">
|
27 |
+
<label>API Be2bill</label>
|
28 |
+
<tab>be2bill</tab>
|
29 |
+
<sort_order>10</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
<groups>
|
34 |
+
<be2bill_notice translate="label" module="be2bill">
|
35 |
+
<frontend_model>be2bill/adminhtml_system_config_fieldset_hint</frontend_model>
|
36 |
+
<sort_order>0</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
</be2bill_notice>
|
41 |
+
<be2bill_api translate="label">
|
42 |
+
<label>Configuration de l'API Be2Bill</label>
|
43 |
+
<frontend_type>text</frontend_type>
|
44 |
+
<sort_order>10</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<fields>
|
49 |
+
<version translate="label">
|
50 |
+
<label>Version de l'XML</label>
|
51 |
+
<comment><![CDATA[Version de l'XML d'import des données]]></comment>
|
52 |
+
<frontend_model>Quadra_Be2bill_Block_Adminhtml_Field_Version_Renderer</frontend_model>
|
53 |
+
<frontend_type>text</frontend_type>
|
54 |
+
<sort_order>10</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>0</show_in_website>
|
57 |
+
<show_in_store>0</show_in_store>
|
58 |
+
</version>
|
59 |
+
<url_xml translate="label comment">
|
60 |
+
<label>URL -> XML (comptes dynamiques)</label>
|
61 |
+
<comment><![CDATA[Url vers l'xml d'import des données]]></comment>
|
62 |
+
<frontend_type>text</frontend_type>
|
63 |
+
<sort_order>20</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>0</show_in_website>
|
66 |
+
<show_in_store>0</show_in_store>
|
67 |
+
</url_xml>
|
68 |
+
<uri_rest translate="label comment">
|
69 |
+
<label>URL PRINCIPALE du service 'serveur à serveur'</label>
|
70 |
+
<frontend_type>text</frontend_type>
|
71 |
+
<sort_order>30</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</uri_rest>
|
76 |
+
<uri_rest_high_dispo translate="label comment">
|
77 |
+
<label>URL SECONDAIRE du service 'serveur à serveur'</label>
|
78 |
+
<comment><![CDATA[Url de haute disponibilité]]></comment>
|
79 |
+
<frontend_type>text</frontend_type>
|
80 |
+
<sort_order>40</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
</uri_rest_high_dispo>
|
85 |
+
<uri_rest_test translate="label comment">
|
86 |
+
<label>URL de TEST du service 'serveur à serveur'</label>
|
87 |
+
<comment><![CDATA[/!\ Test /!\]]></comment>
|
88 |
+
<frontend_type>text</frontend_type>
|
89 |
+
<sort_order>50</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
</uri_rest_test>
|
94 |
+
<uri_form translate="label comment">
|
95 |
+
<label>URL PRINCIPALE du formulaire de paiement</label>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<sort_order>70</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
</uri_form>
|
102 |
+
<uri_form_high_dispo translate="label comment">
|
103 |
+
<label>URL SECONDAIRE du formulaire de paiement</label>
|
104 |
+
<comment><![CDATA[Url de haute disponibilité]]></comment>
|
105 |
+
<frontend_type>text</frontend_type>
|
106 |
+
<sort_order>72</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
</uri_form_high_dispo>
|
111 |
+
<uri_form_test translate="label comment">
|
112 |
+
<label>Url de test du formulaire de paiement </label>
|
113 |
+
<comment><![CDATA[/!\ Test /!\]]></comment>
|
114 |
+
<frontend_type>text</frontend_type>
|
115 |
+
<sort_order>80</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>1</show_in_store>
|
119 |
+
</uri_form_test>
|
120 |
+
<direct_submit translate="label comment">
|
121 |
+
<label>URL PRINCIPALE du paiement direct</label>
|
122 |
+
<frontend_type>text</frontend_type>
|
123 |
+
<sort_order>90</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>1</show_in_store>
|
127 |
+
</direct_submit>
|
128 |
+
<direct_submit_high_dispo translate="label comment">
|
129 |
+
<label>URL SECONDAIRE du paiement direct</label>
|
130 |
+
<comment><![CDATA[Url de haute disponibilité]]></comment>
|
131 |
+
<frontend_type>text</frontend_type>
|
132 |
+
<sort_order>91</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>1</show_in_website>
|
135 |
+
<show_in_store>1</show_in_store>
|
136 |
+
</direct_submit_high_dispo>
|
137 |
+
<direct_submit_test translate="label comment">
|
138 |
+
<label>Url de TEST du paiement direct</label>
|
139 |
+
<comment><![CDATA[/!\ Test /!\]]></comment>
|
140 |
+
<frontend_type>text</frontend_type>
|
141 |
+
<sort_order>100</sort_order>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<show_in_website>1</show_in_website>
|
144 |
+
<show_in_store>1</show_in_store>
|
145 |
+
</direct_submit_test>
|
146 |
+
<debug translate="label comment">
|
147 |
+
<label>Mode Debug</label>
|
148 |
+
<comment><![CDATA[Activer le mode debug]]></comment>
|
149 |
+
<frontend_type>select</frontend_type>
|
150 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
151 |
+
<sort_order>110</sort_order>
|
152 |
+
<show_in_default>1</show_in_default>
|
153 |
+
<show_in_website>1</show_in_website>
|
154 |
+
<show_in_store>1</show_in_store>
|
155 |
+
</debug>
|
156 |
+
<test translate="label comment">
|
157 |
+
<label>Mode Test</label>
|
158 |
+
<comment><![CDATA[Activer le mode test]]></comment>
|
159 |
+
<frontend_type>select</frontend_type>
|
160 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
161 |
+
<sort_order>120</sort_order>
|
162 |
+
<show_in_default>1</show_in_default>
|
163 |
+
<show_in_website>1</show_in_website>
|
164 |
+
<show_in_store>1</show_in_store>
|
165 |
+
</test>
|
166 |
+
<klarna_doc translate="label comment">
|
167 |
+
<label>Document Klarna</label>
|
168 |
+
<frontend_type>text</frontend_type>
|
169 |
+
<sort_order>130</sort_order>
|
170 |
+
<show_in_default>1</show_in_default>
|
171 |
+
<show_in_website>1</show_in_website>
|
172 |
+
<show_in_store>1</show_in_store>
|
173 |
+
</klarna_doc>
|
174 |
+
</fields>
|
175 |
+
</be2bill_api>
|
176 |
+
<be2bill_errors>
|
177 |
+
<label>Be2bill Messages d erreur</label>
|
178 |
+
<frontend_type>text</frontend_type>
|
179 |
+
<sort_order>40</sort_order>
|
180 |
+
<show_in_default>1</show_in_default>
|
181 |
+
<show_in_website>1</show_in_website>
|
182 |
+
<show_in_store>1</show_in_store>
|
183 |
+
<fields>
|
184 |
+
<error_4001 translate="label">
|
185 |
+
<label>Erreur 4001</label>
|
186 |
+
<frontend_type>text</frontend_type>
|
187 |
+
<comment><![CDATA[The bank refused the transaction.]]></comment>
|
188 |
+
<sort_order>10</sort_order>
|
189 |
+
<show_in_default>1</show_in_default>
|
190 |
+
<show_in_website>1</show_in_website>
|
191 |
+
<show_in_store>1</show_in_store>
|
192 |
+
</error_4001>
|
193 |
+
<error_4002 translate="label">
|
194 |
+
<label>Erreur 4002</label>
|
195 |
+
<frontend_type>text</frontend_type>
|
196 |
+
<comment><![CDATA[Insufficient funds.]]></comment>
|
197 |
+
<sort_order>20</sort_order>
|
198 |
+
<show_in_default>1</show_in_default>
|
199 |
+
<show_in_website>1</show_in_website>
|
200 |
+
<show_in_store>1</show_in_store>
|
201 |
+
</error_4002>
|
202 |
+
<error_4003 translate="label">
|
203 |
+
<label>Erreur 4003</label>
|
204 |
+
<frontend_type>text</frontend_type>
|
205 |
+
<comment><![CDATA[Card refused by the bank networks.]]></comment>
|
206 |
+
<sort_order>30</sort_order>
|
207 |
+
<show_in_default>1</show_in_default>
|
208 |
+
<show_in_website>1</show_in_website>
|
209 |
+
<show_in_store>1</show_in_store>
|
210 |
+
</error_4003>
|
211 |
+
<error_4004 translate="label">
|
212 |
+
<label>Erreur 4004</label>
|
213 |
+
<frontend_type>text</frontend_type>
|
214 |
+
<comment><![CDATA[The transaction has been abandoned.]]></comment>
|
215 |
+
<sort_order>40</sort_order>
|
216 |
+
<show_in_default>1</show_in_default>
|
217 |
+
<show_in_website>1</show_in_website>
|
218 |
+
<show_in_store>1</show_in_store>
|
219 |
+
</error_4004>
|
220 |
+
<error_4005 translate="label">
|
221 |
+
<label>Erreur 4005</label>
|
222 |
+
<frontend_type>text</frontend_type>
|
223 |
+
<comment><![CDATA[Fraud suspicion.]]></comment>
|
224 |
+
<sort_order>50</sort_order>
|
225 |
+
<show_in_default>1</show_in_default>
|
226 |
+
<show_in_website>1</show_in_website>
|
227 |
+
<show_in_store>1</show_in_store>
|
228 |
+
</error_4005>
|
229 |
+
<error_4006 translate="label">
|
230 |
+
<label>Erreur 4006</label>
|
231 |
+
<frontend_type>text</frontend_type>
|
232 |
+
<comment><![CDATA[The card has been declared as lost.]]></comment>
|
233 |
+
<sort_order>60</sort_order>
|
234 |
+
<show_in_default>1</show_in_default>
|
235 |
+
<show_in_website>1</show_in_website>
|
236 |
+
<show_in_store>1</show_in_store>
|
237 |
+
</error_4006>
|
238 |
+
<error_4007 translate="label">
|
239 |
+
<label>Erreur 4007</label>
|
240 |
+
<frontend_type>text</frontend_type>
|
241 |
+
<comment><![CDATA[The card has been declared as stolen.]]></comment>
|
242 |
+
<sort_order>70</sort_order>
|
243 |
+
<show_in_default>1</show_in_default>
|
244 |
+
<show_in_website>1</show_in_website>
|
245 |
+
<show_in_store>1</show_in_store>
|
246 |
+
</error_4007>
|
247 |
+
<error_4008 translate="label">
|
248 |
+
<label>Erreur 4008</label>
|
249 |
+
<frontend_type>text</frontend_type>
|
250 |
+
<comment><![CDATA[The 3D secure authentication failed.]]></comment>
|
251 |
+
<sort_order>80</sort_order>
|
252 |
+
<show_in_default>1</show_in_default>
|
253 |
+
<show_in_website>1</show_in_website>
|
254 |
+
<show_in_store>1</show_in_store>
|
255 |
+
</error_4008>
|
256 |
+
<error_4009 translate="label">
|
257 |
+
<label>Erreur 4009</label>
|
258 |
+
<frontend_type>text</frontend_type>
|
259 |
+
<comment><![CDATA[The 3D secure authentication request has expired.]]></comment>
|
260 |
+
<sort_order>90</sort_order>
|
261 |
+
<show_in_default>1</show_in_default>
|
262 |
+
<show_in_website>1</show_in_website>
|
263 |
+
<show_in_store>1</show_in_store>
|
264 |
+
</error_4009>
|
265 |
+
<error_4010 translate="label">
|
266 |
+
<label>Erreur 4010</label>
|
267 |
+
<frontend_type>text</frontend_type>
|
268 |
+
<comment><![CDATA[Invalid transaction.]]></comment>
|
269 |
+
<sort_order>100</sort_order>
|
270 |
+
<show_in_default>1</show_in_default>
|
271 |
+
<show_in_website>1</show_in_website>
|
272 |
+
<show_in_store>1</show_in_store>
|
273 |
+
</error_4010>
|
274 |
+
<error_4011 translate="label">
|
275 |
+
<label>Erreur 4011</label>
|
276 |
+
<frontend_type>text</frontend_type>
|
277 |
+
<comment><![CDATA[Duplicate request.]]></comment>
|
278 |
+
<sort_order>110</sort_order>
|
279 |
+
<show_in_default>1</show_in_default>
|
280 |
+
<show_in_website>1</show_in_website>
|
281 |
+
<show_in_store>1</show_in_store>
|
282 |
+
</error_4011>
|
283 |
+
<error_4012 translate="label">
|
284 |
+
<label>Erreur 4012</label>
|
285 |
+
<frontend_type>text</frontend_type>
|
286 |
+
<comment><![CDATA[Invalid card data.]]></comment>
|
287 |
+
<sort_order>120</sort_order>
|
288 |
+
<show_in_default>1</show_in_default>
|
289 |
+
<show_in_website>1</show_in_website>
|
290 |
+
<show_in_store>1</show_in_store>
|
291 |
+
</error_4012>
|
292 |
+
<error_4013 translate="label">
|
293 |
+
<label>Erreur 4013</label>
|
294 |
+
<frontend_type>text</frontend_type>
|
295 |
+
<comment><![CDATA[Transaction not allowed by bank networks to the card holder.]]></comment>
|
296 |
+
<sort_order>130</sort_order>
|
297 |
+
<show_in_default>1</show_in_default>
|
298 |
+
<show_in_website>1</show_in_website>
|
299 |
+
<show_in_store>1</show_in_store>
|
300 |
+
</error_4013>
|
301 |
+
<error_5001 translate="label">
|
302 |
+
<label>Erreur 5001</label>
|
303 |
+
<frontend_type>text</frontend_type>
|
304 |
+
<comment><![CDATA[Exchange protocol failure.]]></comment>
|
305 |
+
<sort_order>140</sort_order>
|
306 |
+
<show_in_default>1</show_in_default>
|
307 |
+
<show_in_website>1</show_in_website>
|
308 |
+
<show_in_store>1</show_in_store>
|
309 |
+
</error_5001>
|
310 |
+
<error_5002 translate="label">
|
311 |
+
<label>Erreur 5002</label>
|
312 |
+
<frontend_type>text</frontend_type>
|
313 |
+
<comment><![CDATA[Bank networks failure.]]></comment>
|
314 |
+
<sort_order>150</sort_order>
|
315 |
+
<show_in_default>1</show_in_default>
|
316 |
+
<show_in_website>1</show_in_website>
|
317 |
+
<show_in_store>1</show_in_store>
|
318 |
+
</error_5002>
|
319 |
+
<error_5003 translate="label">
|
320 |
+
<label>Erreur 5003</label>
|
321 |
+
<frontend_type>text</frontend_type>
|
322 |
+
<comment><![CDATA[System under maintenance, please try again later.]]></comment>
|
323 |
+
<sort_order>160</sort_order>
|
324 |
+
<show_in_default>1</show_in_default>
|
325 |
+
<show_in_website>1</show_in_website>
|
326 |
+
<show_in_store>1</show_in_store>
|
327 |
+
</error_5003>
|
328 |
+
<error_5004 translate="label">
|
329 |
+
<label>Erreur 5004</label>
|
330 |
+
<frontend_type>text</frontend_type>
|
331 |
+
<comment><![CDATA[Timeout. The result will be sent to notification url.]]></comment>
|
332 |
+
<sort_order>170</sort_order>
|
333 |
+
<show_in_default>1</show_in_default>
|
334 |
+
<show_in_website>1</show_in_website>
|
335 |
+
<show_in_store>1</show_in_store>
|
336 |
+
</error_5004>
|
337 |
+
<error_5005 translate="label">
|
338 |
+
<label>Erreur 5005</label>
|
339 |
+
<frontend_type>text</frontend_type>
|
340 |
+
<comment><![CDATA[3D secure authentification error.]]></comment>
|
341 |
+
<sort_order>180</sort_order>
|
342 |
+
<show_in_default>1</show_in_default>
|
343 |
+
<show_in_website>1</show_in_website>
|
344 |
+
<show_in_store>1</show_in_store>
|
345 |
+
</error_5005>
|
346 |
+
<error_6001 translate="label">
|
347 |
+
<label>Erreur 6001</label>
|
348 |
+
<frontend_type>text</frontend_type>
|
349 |
+
<comment><![CDATA[Transaction declined by merchant.]]></comment>
|
350 |
+
<sort_order>190</sort_order>
|
351 |
+
<show_in_default>1</show_in_default>
|
352 |
+
<show_in_website>1</show_in_website>
|
353 |
+
<show_in_store>1</show_in_store>
|
354 |
+
</error_6001>
|
355 |
+
<error_6002 translate="label">
|
356 |
+
<label>Erreur 6002</label>
|
357 |
+
<frontend_type>text</frontend_type>
|
358 |
+
<comment><![CDATA[Transaction declined.]]></comment>
|
359 |
+
<sort_order>200</sort_order>
|
360 |
+
<show_in_default>1</show_in_default>
|
361 |
+
<show_in_website>1</show_in_website>
|
362 |
+
<show_in_store>1</show_in_store>
|
363 |
+
</error_6002>
|
364 |
+
<error_6003 translate="label">
|
365 |
+
<label>Erreur 6003</label>
|
366 |
+
<frontend_type>text</frontend_type>
|
367 |
+
<comment><![CDATA[Cardholder has already disputed a transaction.]]></comment>
|
368 |
+
<sort_order>210</sort_order>
|
369 |
+
<show_in_default>1</show_in_default>
|
370 |
+
<show_in_website>1</show_in_website>
|
371 |
+
<show_in_store>1</show_in_store>
|
372 |
+
</error_6003>
|
373 |
+
<error_6004 translate="label">
|
374 |
+
<label>Erreur 6004</label>
|
375 |
+
<frontend_type>text</frontend_type>
|
376 |
+
<comment><![CDATA[Transaction declined by merchant's rules.]]></comment>
|
377 |
+
<sort_order>220</sort_order>
|
378 |
+
<show_in_default>1</show_in_default>
|
379 |
+
<show_in_website>1</show_in_website>
|
380 |
+
<show_in_store>1</show_in_store>
|
381 |
+
</error_6004>
|
382 |
+
</fields>
|
383 |
+
</be2bill_errors>
|
384 |
+
</groups>
|
385 |
+
</be2bill>
|
386 |
+
<payment>
|
387 |
+
<groups>
|
388 |
+
<be2bill translate="label" module="be2bill">
|
389 |
+
<label>Be2bill</label>
|
390 |
+
<frontend_type>text</frontend_type>
|
391 |
+
<sort_order>100</sort_order>
|
392 |
+
<show_in_default>1</show_in_default>
|
393 |
+
<show_in_website>1</show_in_website>
|
394 |
+
<show_in_store>1</show_in_store>
|
395 |
+
<fields>
|
396 |
+
<active translate="label">
|
397 |
+
<label>Activer</label>
|
398 |
+
<frontend_type>select</frontend_type>
|
399 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
400 |
+
<sort_order>10</sort_order>
|
401 |
+
<show_in_default>1</show_in_default>
|
402 |
+
<show_in_website>1</show_in_website>
|
403 |
+
<show_in_store>1</show_in_store>
|
404 |
+
</active>
|
405 |
+
</fields>
|
406 |
+
</be2bill>
|
407 |
+
</groups>
|
408 |
+
</payment>
|
409 |
+
</sections>
|
410 |
+
</config>
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-install-4.0.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
$installer = $this;
|
21 |
+
$installer->startSetup();
|
22 |
+
$installer->endSetup();
|
23 |
+
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.0.0-4.1.0.php
ADDED
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
$installer = $this;
|
21 |
+
$installer->startSetup();
|
22 |
+
$installer->run("
|
23 |
+
SET FOREIGN_KEY_CHECKS=0;
|
24 |
+
|
25 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_modes_lang')}`;
|
26 |
+
CREATE TABLE `{$this->getTable('b2b_xml_modes_lang')}` (
|
27 |
+
`b2b_xml_mode_code` VARCHAR(255) NOT NULL,
|
28 |
+
`lang_iso` VARCHAR(2) NULL,
|
29 |
+
`mode_lang_name` VARCHAR(255) NULL,
|
30 |
+
INDEX `idx_b2b_xml_modes_lang` (`b2b_xml_mode_code` ASC))
|
31 |
+
ENGINE = InnoDB;
|
32 |
+
|
33 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_operation_lang')}`;
|
34 |
+
CREATE TABLE `{$this->getTable('b2b_xml_operation_lang')}` (
|
35 |
+
`b2b_xml_operation_code` VARCHAR(255) NOT NULL,
|
36 |
+
`lang_iso` VARCHAR(2) NULL,
|
37 |
+
`operation_lang_name` VARCHAR(255) NULL,
|
38 |
+
INDEX `idx_b2b_xml_operation_lang` (`b2b_xml_operation_code` ASC))
|
39 |
+
ENGINE = InnoDB;
|
40 |
+
|
41 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_options')}`;
|
42 |
+
CREATE TABLE `{$this->getTable('b2b_xml_options')}` (
|
43 |
+
`b2b_xml_option_code` VARCHAR(255) NOT NULL,
|
44 |
+
`b2b_xml_parameter_name` VARCHAR(255) NOT NULL,
|
45 |
+
`b2b_xml_parameter_type` ENUM('REQUIRED', 'ABSENT') NULL,
|
46 |
+
`b2b_xml_parameter_value` ENUM('YES', 'NO', 'REQUIRED') NULL,
|
47 |
+
INDEX `idx_b2b_xml_options` (`b2b_xml_option_code` ASC))
|
48 |
+
ENGINE = InnoDB;
|
49 |
+
|
50 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_options_lang')}`;
|
51 |
+
CREATE TABLE `{$this->getTable('b2b_xml_options_lang')}` (
|
52 |
+
`b2b_xml_option_code` VARCHAR(255) NOT NULL,
|
53 |
+
`lang_iso` VARCHAR(2) NULL,
|
54 |
+
`option_lang_name` VARCHAR(255) NULL,
|
55 |
+
INDEX `idx_b2b_xml_options_lang` (`b2b_xml_option_code` ASC),
|
56 |
+
CONSTRAINT `fk_options_lang_options`
|
57 |
+
FOREIGN KEY (`b2b_xml_option_code`)
|
58 |
+
REFERENCES `{$this->getTable('b2b_xml_options')}` (`b2b_xml_option_code`)
|
59 |
+
ON DELETE NO ACTION
|
60 |
+
ON UPDATE NO ACTION)
|
61 |
+
ENGINE = InnoDB;
|
62 |
+
|
63 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_types')}`;
|
64 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_types')}` (
|
65 |
+
`b2b_xml_account_type_code` VARCHAR(255) NULL,
|
66 |
+
`b2b_xml_account_type_logo` VARCHAR(255) NULL,
|
67 |
+
PRIMARY KEY (`b2b_xml_account_type_code`))
|
68 |
+
ENGINE = InnoDB;
|
69 |
+
|
70 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_lang')}`;
|
71 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_type_lang')}` (
|
72 |
+
`b2b_xml_account_type_code` VARCHAR(255) NOT NULL,
|
73 |
+
`lang_iso` VARCHAR(2) NULL,
|
74 |
+
`account_type_lang_name` VARCHAR(255) NULL,
|
75 |
+
INDEX `idx_b2b_xml_account_type_lang` (`b2b_xml_account_type_code` ASC),
|
76 |
+
CONSTRAINT `fk_account_type_lang_account_type_code`
|
77 |
+
FOREIGN KEY (`b2b_xml_account_type_code`)
|
78 |
+
REFERENCES `{$this->getTable('b2b_xml_account_types')}` (`b2b_xml_account_type_code`)
|
79 |
+
ON DELETE NO ACTION
|
80 |
+
ON UPDATE NO ACTION)
|
81 |
+
ENGINE = InnoDB;
|
82 |
+
|
83 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_currency')}`;
|
84 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_type_currency')}` (
|
85 |
+
`b2b_xml_account_type_code` VARCHAR(255) NOT NULL,
|
86 |
+
`currency_iso` VARCHAR(3) NOT NULL,
|
87 |
+
INDEX `idx_b2b_xml_account_type_currency` (`b2b_xml_account_type_code` ASC),
|
88 |
+
CONSTRAINT `fk_account_type_currency_account_types`
|
89 |
+
FOREIGN KEY (`b2b_xml_account_type_code`)
|
90 |
+
REFERENCES `{$this->getTable('b2b_xml_account_types')}` (`b2b_xml_account_type_code`)
|
91 |
+
ON DELETE NO ACTION
|
92 |
+
ON UPDATE NO ACTION)
|
93 |
+
ENGINE = InnoDB;
|
94 |
+
|
95 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_parameter_set')}`;
|
96 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_type_parameter_set')}` (
|
97 |
+
`id_b2b_xml_account_type_parameter_set` INT NOT NULL AUTO_INCREMENT,
|
98 |
+
`b2b_xml_account_type_parameter_set_version` VARCHAR(255) NULL,
|
99 |
+
`b2b_xml_account_type_parameter_set_logo` VARCHAR(255) NULL,
|
100 |
+
`b2b_xml_account_type_code` VARCHAR(255) NOT NULL,
|
101 |
+
PRIMARY KEY (`id_b2b_xml_account_type_parameter_set`),
|
102 |
+
CONSTRAINT `fk_account_type_parameter_set_account_types`
|
103 |
+
FOREIGN KEY (`b2b_xml_account_type_code`)
|
104 |
+
REFERENCES `{$this->getTable('b2b_xml_account_types')}` (`b2b_xml_account_type_code`)
|
105 |
+
ON DELETE NO ACTION
|
106 |
+
ON UPDATE NO ACTION)
|
107 |
+
ENGINE = InnoDB;
|
108 |
+
|
109 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_parameter_set_countries')}`;
|
110 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_type_parameter_set_countries')}` (
|
111 |
+
`id_b2b_xml_account_type_parameter_set` INT NOT NULL,
|
112 |
+
`country_iso` VARCHAR(2) NOT NULL,
|
113 |
+
INDEX `idx_b2b_xml_account_type_countries` (`id_b2b_xml_account_type_parameter_set` ASC),
|
114 |
+
CONSTRAINT `fk_account_type_parameter_set_countries_acnt_type_parameter_set`
|
115 |
+
FOREIGN KEY (`id_b2b_xml_account_type_parameter_set`)
|
116 |
+
REFERENCES `{$this->getTable('b2b_xml_account_type_parameter_set')}` (`id_b2b_xml_account_type_parameter_set`)
|
117 |
+
ON DELETE NO ACTION
|
118 |
+
ON UPDATE NO ACTION)
|
119 |
+
ENGINE = InnoDB;
|
120 |
+
|
121 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_parameter_set_mode')}`;
|
122 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_type_parameter_set_mode')}` (
|
123 |
+
`id_b2b_xml_account_type_parameter_set` INT NOT NULL,
|
124 |
+
`b2b_xml_mode_code` VARCHAR(255) NOT NULL,
|
125 |
+
INDEX `idx_b2b_xml_account_type_parameter_set_mode` (`id_b2b_xml_account_type_parameter_set` ASC),
|
126 |
+
CONSTRAINT `fk_account_type_parameter_set_mode_modes_lang`
|
127 |
+
FOREIGN KEY (`b2b_xml_mode_code`)
|
128 |
+
REFERENCES `{$this->getTable('b2b_xml_modes_lang')}` (`b2b_xml_mode_code`)
|
129 |
+
ON DELETE NO ACTION
|
130 |
+
ON UPDATE NO ACTION,
|
131 |
+
CONSTRAINT `fk_account_type_parameter_set_mode_account_type_parameter_set`
|
132 |
+
FOREIGN KEY (`id_b2b_xml_account_type_parameter_set`)
|
133 |
+
REFERENCES `{$this->getTable('b2b_xml_account_type_parameter_set')}` (`id_b2b_xml_account_type_parameter_set`)
|
134 |
+
ON DELETE NO ACTION
|
135 |
+
ON UPDATE NO ACTION)
|
136 |
+
ENGINE = InnoDB;
|
137 |
+
|
138 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_parameter_set_operation')}`;
|
139 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_type_parameter_set_operation')}` (
|
140 |
+
`id_b2b_xml_account_type_parameter_set` INT NOT NULL,
|
141 |
+
`b2b_xml_operation_code` VARCHAR(255) NOT NULL,
|
142 |
+
INDEX `fk_b2b_xml_account_type_parameter_set_operation_b2b_xml_acc_idx` (`id_b2b_xml_account_type_parameter_set` ASC),
|
143 |
+
CONSTRAINT `fk_account_type_parameter_set_operation_accnt_tpe_param_set`
|
144 |
+
FOREIGN KEY (`id_b2b_xml_account_type_parameter_set`)
|
145 |
+
REFERENCES `{$this->getTable('b2b_xml_account_type_parameter_set')}` (`id_b2b_xml_account_type_parameter_set`)
|
146 |
+
ON DELETE NO ACTION
|
147 |
+
ON UPDATE NO ACTION,
|
148 |
+
CONSTRAINT `fk_account_type_parameter_set_operation_operation_lang`
|
149 |
+
FOREIGN KEY (`b2b_xml_operation_code`)
|
150 |
+
REFERENCES `{$this->getTable('b2b_xml_operation_lang')}` (`b2b_xml_operation_code`)
|
151 |
+
ON DELETE NO ACTION
|
152 |
+
ON UPDATE NO ACTION)
|
153 |
+
ENGINE = InnoDB;
|
154 |
+
|
155 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_parameter_set_parameters')}`;
|
156 |
+
CREATE TABLE `{$this->getTable('b2b_xml_account_type_parameter_set_parameters')}` (
|
157 |
+
`id_b2b_xml_account_type_parameter_set` INT NOT NULL,
|
158 |
+
`b2b_xml_parameter_name` VARCHAR(255) NOT NULL,
|
159 |
+
`b2b_xml_parameter_type` ENUM('REQUIRED', 'ABSENT') NULL,
|
160 |
+
`b2b_xml_parameter_value` ENUM('YES', 'NO', 'REQUIRED') NULL,
|
161 |
+
INDEX `idx_b2b_xml_account_type_parameter_set_parameters` (`id_b2b_xml_account_type_parameter_set` ASC),
|
162 |
+
CONSTRAINT `fk_account_type_parameter_set_parameters_accnt_tpe_param_set`
|
163 |
+
FOREIGN KEY (`id_b2b_xml_account_type_parameter_set`)
|
164 |
+
REFERENCES `{$this->getTable('b2b_xml_account_type_parameter_set')}` (`id_b2b_xml_account_type_parameter_set`)
|
165 |
+
ON DELETE NO ACTION
|
166 |
+
ON UPDATE NO ACTION)
|
167 |
+
ENGINE = InnoDB;
|
168 |
+
|
169 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_xml_account_type_parameter_set_options')}`;
|
170 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('b2b_xml_account_type_parameter_set_options')}` (
|
171 |
+
`id_b2b_xml_account_type_parameter_set` INT NOT NULL,
|
172 |
+
`b2b_xml_option` VARCHAR(255) NOT NULL,
|
173 |
+
INDEX `idx_b2b_xml_account_type_parameter_set_options` (`id_b2b_xml_account_type_parameter_set` ASC),
|
174 |
+
CONSTRAINT `fk_account_type_parameter_set_options_account_type_parameter_set`
|
175 |
+
FOREIGN KEY (`id_b2b_xml_account_type_parameter_set`)
|
176 |
+
REFERENCES `{$this->getTable('b2b_xml_account_type_parameter_set')}` (`id_b2b_xml_account_type_parameter_set`)
|
177 |
+
ON DELETE NO ACTION
|
178 |
+
ON UPDATE NO ACTION,
|
179 |
+
CONSTRAINT `fk_account_type_parameter_set_options_options`
|
180 |
+
FOREIGN KEY (`b2b_xml_option`)
|
181 |
+
REFERENCES `{$this->getTable('b2b_xml_options')}` (`b2b_xml_option_code`)
|
182 |
+
ON DELETE NO ACTION
|
183 |
+
ON UPDATE NO ACTION)
|
184 |
+
ENGINE = InnoDB;
|
185 |
+
|
186 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_merchand_configuration_account')}`;
|
187 |
+
CREATE TABLE `{$this->getTable('b2b_merchand_configuration_account')}` (
|
188 |
+
`id_b2b_merchand_configuration_account` INT NOT NULL AUTO_INCREMENT,
|
189 |
+
`b2b_xml_account_type_code` VARCHAR(255) NOT NULL,
|
190 |
+
`b2b_xml_mode_code` VARCHAR(255) NOT NULL,
|
191 |
+
`currency_iso` VARCHAR(3) NOT NULL,
|
192 |
+
`login` VARCHAR(255) NULL,
|
193 |
+
`password` VARCHAR(255) NULL,
|
194 |
+
`logo_url` VARCHAR(255) NULL,
|
195 |
+
`configuration_account_name` VARCHAR(255) NULL DEFAULT NULL,
|
196 |
+
`active` TINYINT(1) NULL,
|
197 |
+
`core_store_id` SMALLINT(5) unsigned NOT NULL,
|
198 |
+
PRIMARY KEY (`id_b2b_merchand_configuration_account`),
|
199 |
+
CONSTRAINT `fk_merchand_configuration_account_account_type_code`
|
200 |
+
FOREIGN KEY (`b2b_xml_account_type_code`)
|
201 |
+
REFERENCES `{$this->getTable('b2b_xml_account_types')}` (`b2b_xml_account_type_code`)
|
202 |
+
ON DELETE NO ACTION
|
203 |
+
ON UPDATE NO ACTION,
|
204 |
+
CONSTRAINT `fk_merchand_configuration_account_modes_lang`
|
205 |
+
FOREIGN KEY (`b2b_xml_mode_code`)
|
206 |
+
REFERENCES `{$this->getTable('b2b_xml_modes_lang')}` (`b2b_xml_mode_code`)
|
207 |
+
ON DELETE NO ACTION
|
208 |
+
ON UPDATE NO ACTION,
|
209 |
+
CONSTRAINT `fk_merchand_configuration_account_core_store`
|
210 |
+
FOREIGN KEY (`core_store_id`)
|
211 |
+
REFERENCES `{$this->getTable('core_store')}` (`store_id`)
|
212 |
+
ON DELETE NO ACTION
|
213 |
+
ON UPDATE NO ACTION)
|
214 |
+
ENGINE = InnoDB;
|
215 |
+
|
216 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_merchand_configuration_account_options')}`;
|
217 |
+
CREATE TABLE `{$this->getTable('b2b_merchand_configuration_account_options')}` (
|
218 |
+
`id_b2b_merchand_configuration_account_options` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
219 |
+
`id_b2b_merchand_configuration_account` INT NOT NULL,
|
220 |
+
`b2b_xml_option` VARCHAR(255) NOT NULL,
|
221 |
+
`min_amount` decimal(13,6) NULL DEFAULT NULL,
|
222 |
+
`max_amount` decimal(13,6) NULL DEFAULT NULL,
|
223 |
+
`b2b_xml_option_extra` VARCHAR(255) NOT NULL,
|
224 |
+
`active` TINYINT(1) NOT NULL,
|
225 |
+
PRIMARY KEY (`id_b2b_merchand_configuration_account_options`),
|
226 |
+
CONSTRAINT `fk_merchand_configuration_account_options_merchand_conf_accnt`
|
227 |
+
FOREIGN KEY (`id_b2b_merchand_configuration_account`)
|
228 |
+
REFERENCES `{$this->getTable('b2b_merchand_configuration_account')}` (`id_b2b_merchand_configuration_account`)
|
229 |
+
ON DELETE NO ACTION
|
230 |
+
ON UPDATE NO ACTION)
|
231 |
+
ENGINE = InnoDB;
|
232 |
+
|
233 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_merchand_configuration_account_countries')}`;
|
234 |
+
CREATE TABLE `{$this->getTable('b2b_merchand_configuration_account_countries')}` (
|
235 |
+
`id_b2b_merchand_configuration_account_countries` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
236 |
+
`id_b2b_merchand_configuration_account` INT NOT NULL,
|
237 |
+
`country_iso` VARCHAR(2) NULL,
|
238 |
+
PRIMARY KEY (`id_b2b_merchand_configuration_account_countries`),
|
239 |
+
CONSTRAINT `fk_merchand_configuration_account_countries_merchand_conf_accnt`
|
240 |
+
FOREIGN KEY (`id_b2b_merchand_configuration_account`)
|
241 |
+
REFERENCES `{$this->getTable('b2b_merchand_configuration_account')}` (`id_b2b_merchand_configuration_account`)
|
242 |
+
ON DELETE NO ACTION
|
243 |
+
ON UPDATE NO ACTION)
|
244 |
+
ENGINE = InnoDB;
|
245 |
+
|
246 |
+
DROP TABLE IF EXISTS `{$this->getTable('b2b_alias')}`;
|
247 |
+
CREATE TABLE `{$this->getTable('b2b_alias')}` (
|
248 |
+
`id_b2b_alias` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
249 |
+
`id_customer` INT(10) UNSIGNED NOT NULL,
|
250 |
+
`id_merchand_account` INT(10) NOT NULL,
|
251 |
+
`alias` VARCHAR(255) NOT NULL,
|
252 |
+
`card_type` VARCHAR(255) NOT NULL,
|
253 |
+
`card_number` VARCHAR(255) NOT NULL,
|
254 |
+
`date_add` DATETIME NOT NULL,
|
255 |
+
`date_end` DATETIME NOT NULL,
|
256 |
+
PRIMARY KEY (`id_b2b_alias`),
|
257 |
+
CONSTRAINT `fk_alias_customer_entity`
|
258 |
+
FOREIGN KEY (`id_customer`)
|
259 |
+
REFERENCES `{$this->getTable('customer_entity')}` (`entity_id`)
|
260 |
+
ON DELETE CASCADE
|
261 |
+
ON UPDATE CASCADE,
|
262 |
+
CONSTRAINT `fk_alias_merchand_configuration_account`
|
263 |
+
FOREIGN KEY (`id_merchand_account`)
|
264 |
+
REFERENCES `{$this->getTable('b2b_merchand_configuration_account')}` (`id_b2b_merchand_configuration_account`)
|
265 |
+
ON DELETE CASCADE
|
266 |
+
ON UPDATE CASCADE)
|
267 |
+
ENGINE = InnoDB;
|
268 |
+
|
269 |
+
SET FOREIGN_KEY_CHECKS=1;
|
270 |
+
");
|
271 |
+
|
272 |
+
$installer->endSetup();
|
273 |
+
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.0-4.1.1.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
$installer = $this;
|
18 |
+
|
19 |
+
|
20 |
+
$statusTable = $installer->getTable('sales/order_status');
|
21 |
+
$statusStateTable = $installer->getTable('sales/order_status_state');
|
22 |
+
$statusLabelTable = $installer->getTable('sales/order_status_label');
|
23 |
+
|
24 |
+
$installer->startSetup();
|
25 |
+
|
26 |
+
$currentVersion = Mage::getVersion();
|
27 |
+
$exist = Mage::getModel('sales/order_status')->getCollection()->addFieldToFilter('status', 'pending_be2bill')->getSize();
|
28 |
+
|
29 |
+
if (version_compare($currentVersion, '1.4.2') == 1 && $exist < 1) {
|
30 |
+
$status = 'pending_be2bill';
|
31 |
+
$label = 'Pending Capture Be2bill';
|
32 |
+
$code = "pending_payment";
|
33 |
+
|
34 |
+
//Insert new Status in DB
|
35 |
+
$data[0] = array(
|
36 |
+
'status' => $status,
|
37 |
+
'label' => $label,
|
38 |
+
);
|
39 |
+
|
40 |
+
$installer->getConnection()->insertArray($statusTable, array('status', 'label'), $data);
|
41 |
+
//Insert relation between state and status
|
42 |
+
$data[0] = array(
|
43 |
+
'status' => $status,
|
44 |
+
'state' => $code,
|
45 |
+
'is_default' => 0,
|
46 |
+
);
|
47 |
+
|
48 |
+
$installer->getConnection()->insertArray(
|
49 |
+
$statusStateTable, array('status', 'state', 'is_default'), $data
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
$installer->endSetup();
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.2-4.1.3.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
$installer = $this;
|
21 |
+
$installer->startSetup();
|
22 |
+
|
23 |
+
$installer->run("
|
24 |
+
ALTER TABLE `{$this->getTable('b2b_merchand_configuration_account')}` ADD `cancel_capture_auto` TINYINT NULL DEFAULT NULL ;
|
25 |
+
ALTER TABLE `{$this->getTable('b2b_merchand_configuration_account')}` ADD `order_canceled_limited_time` INT NULL DEFAULT '0';
|
26 |
+
");
|
27 |
+
|
28 |
+
$installer->endSetup();
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.3-4.1.4.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
$eavInstaller = new Mage_Eav_Model_Entity_Setup('be2bill_setup');
|
21 |
+
|
22 |
+
$eavInstaller->startSetup();
|
23 |
+
|
24 |
+
$entityTypeId = $eavInstaller->getEntityTypeId('catalog_product');
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Add 'be2bill_enable_oc_sev_payment' attribute to the 'eav/attribute' table
|
28 |
+
*/
|
29 |
+
$attribute = $eavInstaller->getAttribute($entityTypeId, 'be2bill_enable_oc_sev_payment');
|
30 |
+
|
31 |
+
if (!$attribute) {
|
32 |
+
$eavInstaller->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'be2bill_enable_oc_sev_payment', array(
|
33 |
+
'type' => 'int',
|
34 |
+
'backend' => '',
|
35 |
+
'frontend' => '',
|
36 |
+
'label' => 'Is Product Available for Oneclick Several Payment with Be2bill',
|
37 |
+
'input' => 'select',
|
38 |
+
'class' => '',
|
39 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
40 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
41 |
+
'visible' => true,
|
42 |
+
'required' => false,
|
43 |
+
'user_defined' => true,
|
44 |
+
'default' => '0',
|
45 |
+
'searchable' => false,
|
46 |
+
'filterable' => false,
|
47 |
+
'comparable' => false,
|
48 |
+
'visible_on_front' => false,
|
49 |
+
'unique' => false,
|
50 |
+
'apply_to' => '',
|
51 |
+
'is_configurable' => false
|
52 |
+
));
|
53 |
+
}
|
54 |
+
|
55 |
+
$attributeSets = $eavInstaller->getConnection()->fetchAll('select attribute_set_id from ' . $this->getTable('eav/attribute_set') . ' where entity_type_id=?', $entityTypeId);
|
56 |
+
$attributeId = $eavInstaller->getAttributeId('catalog_product', 'be2bill_enable_oc_sev_payment');
|
57 |
+
|
58 |
+
foreach ($attributeSets as $attributeSet) {
|
59 |
+
/*
|
60 |
+
* Create new attribute group
|
61 |
+
*/
|
62 |
+
$setId = $attributeSet['attribute_set_id'];
|
63 |
+
$eavInstaller->addAttributeGroup($entityTypeId, $setId, 'Be2bill Payment Options');
|
64 |
+
|
65 |
+
/*
|
66 |
+
* Add attribute to Be2bill Payment Options attribute group
|
67 |
+
*/
|
68 |
+
$groupId = $eavInstaller->getAttributeGroupId($entityTypeId, $setId, 'Be2bill Payment Options');
|
69 |
+
$eavInstaller->addAttributeToGroup($entityTypeId, $setId, $groupId, $attributeId, 1);
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Add 'be2bill_3dsecure' attribute to the 'eav/attribute' table
|
74 |
+
*/
|
75 |
+
/* $attribute = $eavInstaller->getAttribute($entityTypeId, 'be2bill_3dsecure');
|
76 |
+
|
77 |
+
if (!$attribute) {
|
78 |
+
$eavInstaller->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'be2bill_3dsecure', array(
|
79 |
+
'type' => 'int',
|
80 |
+
'backend' => '',
|
81 |
+
'frontend' => '',
|
82 |
+
'label' => 'Is Product Available for 3D Secure Payment',
|
83 |
+
'input' => 'select',
|
84 |
+
'class' => '',
|
85 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
86 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
87 |
+
'visible' => true,
|
88 |
+
'required' => false,
|
89 |
+
'user_defined' => true,
|
90 |
+
'default' => '0',
|
91 |
+
'searchable' => false,
|
92 |
+
'filterable' => false,
|
93 |
+
'comparable' => false,
|
94 |
+
'visible_on_front' => false,
|
95 |
+
'unique' => false,
|
96 |
+
'apply_to' => '',
|
97 |
+
'is_configurable' => false
|
98 |
+
));
|
99 |
+
}
|
100 |
+
|
101 |
+
$attributeSets = $eavInstaller->getConnection()->fetchAll('select attribute_set_id from '.$this->getTable('eav/attribute_set').' where entity_type_id=?', $entityTypeId);
|
102 |
+
$attributeId = $eavInstaller->getAttributeId('catalog_product', 'be2bill_3dsecure');
|
103 |
+
|
104 |
+
foreach ($attributeSets as $attributeSet) {
|
105 |
+
|
106 |
+
//Add attribute to Be2bill Payment Options attribute group
|
107 |
+
|
108 |
+
$setId = $attributeSet['attribute_set_id'];
|
109 |
+
$groupId = $eavInstaller->getAttributeGroupId($entityTypeId, $setId, 'Be2bill Payment Options');
|
110 |
+
$eavInstaller->addAttributeToGroup($entityTypeId, $setId, $groupId, $attributeId, 2);
|
111 |
+
}
|
112 |
+
|
113 |
+
$entityTypeId = $eavInstaller->getEntityTypeId('catalog_category');
|
114 |
+
$attribute = $eavInstaller->getAttribute($entityTypeId, 'be2bill_3dsecure');
|
115 |
+
|
116 |
+
if (!$attribute) {
|
117 |
+
$eavInstaller->addAttribute(
|
118 |
+
Mage_Catalog_Model_Category::ENTITY, 'be2bill_3dsecure', array(
|
119 |
+
'type' => 'int',
|
120 |
+
'backend' => '',
|
121 |
+
'frontend' => '',
|
122 |
+
'label' => 'Are Category\'s Products Available for 3D Secure Payment',
|
123 |
+
'input' => 'select',
|
124 |
+
'class' => '',
|
125 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
126 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
127 |
+
'visible' => true,
|
128 |
+
'required' => false,
|
129 |
+
'user_defined' => true,
|
130 |
+
'default' => '0',
|
131 |
+
'searchable' => false,
|
132 |
+
'filterable' => false,
|
133 |
+
'comparable' => false,
|
134 |
+
'visible_on_front' => false,
|
135 |
+
'unique' => false,
|
136 |
+
'apply_to' => '',
|
137 |
+
'is_configurable' => false,
|
138 |
+
'group' => 'Be2bill Options'
|
139 |
+
));
|
140 |
+
}
|
141 |
+
*/
|
142 |
+
$eavInstaller->endSetup();
|
143 |
+
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.4-4.1.5.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
$installer = $this;
|
21 |
+
$installer->startSetup();
|
22 |
+
|
23 |
+
$installer->run("
|
24 |
+
ALTER TABLE `{$this->getTable('b2b_merchand_configuration_account_options')}` ADD `front_label` VARCHAR(255) NULL DEFAULT NULL ;
|
25 |
+
");
|
26 |
+
|
27 |
+
$installer->endSetup();
|
28 |
+
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.1.7-4.1.8.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
$installer = $this;
|
21 |
+
$installer->startSetup();
|
22 |
+
|
23 |
+
$installer->run("
|
24 |
+
ALTER TABLE `{$this->getTable('b2b_merchand_configuration_account_options')}` CHANGE `b2b_xml_option_extra` `b2b_xml_option_extra` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
25 |
+
");
|
26 |
+
|
27 |
+
$installer->endSetup();
|
28 |
+
|
app/code/community/Quadra/Be2bill/sql/be2bill_setup/mysql4-upgrade-4.2.6-4.2.7.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2016 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*
|
17 |
+
* @category Quadra
|
18 |
+
* @package Quadra_Be2bill
|
19 |
+
*/
|
20 |
+
$installer = $this;
|
21 |
+
$installer->startSetup();
|
22 |
+
|
23 |
+
$installer->run("
|
24 |
+
ALTER TABLE `{$this->getTable('b2b_xml_account_type_parameter_set_parameters')}` ADD `b2b_xml_parameter_merchant_hash` varchar(255) NOT NULL DEFAULT 'YES';
|
25 |
+
");
|
26 |
+
$installer->endSetup();
|
27 |
+
|
app/design/adminhtml/default/default/layout/be2bill.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magento.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magento.com for more information.
|
21 |
+
*
|
22 |
+
* @category design
|
23 |
+
* @package default_default
|
24 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<layout>
|
29 |
+
<adminhtml_merchandaccount_edit>
|
30 |
+
<reference name="head">
|
31 |
+
<action method="addItem"><type>skin_js</type><name>be2bill/js/be2bill.js</name><params/><if/></action>
|
32 |
+
</reference>
|
33 |
+
</adminhtml_merchandaccount_edit>
|
34 |
+
</layout>
|
app/design/adminhtml/default/default/template/be2bill/info/payment_methods.phtml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2015 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<p><?php echo $this->htmlEscape($this->getType()) ?></p>
|
18 |
+
<?php if ($this->getNtimesPaiement() != null): ?>
|
19 |
+
<?php foreach ($this->getNtimesPaiement() as $date => $amount) : ?>
|
20 |
+
<p><?php echo $this->__('%s prélevés le %s', Mage::helper('core')->currency($amount / 100, true, false), Mage::helper('core')->formatDate($date, 'short')) ?></p>
|
21 |
+
<?php endforeach; ?>
|
22 |
+
<?php endif; ?>
|
23 |
+
<p>
|
24 |
+
<?php echo Mage::helper('payment')->__('Transaction ID: %s', $this->htmlEscape($this->getTransactionId())) ?><br/>
|
25 |
+
<?php echo Mage::helper('payment')->__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?><br/>
|
26 |
+
<?php echo Mage::helper('payment')->__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?><br/>
|
27 |
+
<?php echo Mage::helper('payment')->__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?><br/>
|
28 |
+
<?php echo Mage::helper('payment')->__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
|
29 |
+
</p>
|
app/design/adminhtml/default/default/template/be2bill/system/config/fieldset/hint.phtml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2015 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<style type="text/css">
|
18 |
+
.be2bill-api-notice .url-list {
|
19 |
+
padding-top: 15px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.be2bill-api-notice .url-list dl.store, .be2bill-api-notice .url-list dl.store ul {
|
23 |
+
padding: 5px 10px;
|
24 |
+
}
|
25 |
+
</style>
|
26 |
+
<?php $params = array('_secure' => true, '_store_to_url' => false) ?>
|
27 |
+
<div class="be2bill-api-notice">
|
28 |
+
<div class="box">
|
29 |
+
<ul>
|
30 |
+
<li><?php echo $this->__('Magento Connector Version: v%s', (string)Mage::getConfig()->getNode()->modules->Quadra_Be2bill->version) ?></li>
|
31 |
+
</ul>
|
32 |
+
</div>
|
33 |
+
<div class="info">
|
34 |
+
<?php echo $this->__('Afin de vous faciliter la saisie des paramètres dans <a href="%s" target="_blank">l\'extranet de Be2bill</a>, vous trouverez ci-dessous la liste des toutes les URLs de votre site.', 'https://extranet.be2bill.com/') ?>
|
35 |
+
<br />
|
36 |
+
<?php echo $this->__('Ces URLs sont formatées selon la configuration actuelle de Magento.') ?>
|
37 |
+
</div>
|
38 |
+
<div class="url-list">
|
39 |
+
<dl class="website">
|
40 |
+
<?php foreach (Mage::app()->getWebsites() as $website): ?>
|
41 |
+
<dt><h4><?php echo $this->__('Store Name: %s', $website->getName()) ?></h4></dt>
|
42 |
+
<dd>
|
43 |
+
<?php foreach ($website->getStores() as $store): ?>
|
44 |
+
<?php $url = Mage::getModel('core/url')->setStore($store); ?>
|
45 |
+
<dl class="store">
|
46 |
+
<dt><h5><?php echo $this->__('Store View Name: %s', $store->getName()) ?></h5></dt>
|
47 |
+
<dd>
|
48 |
+
<ul>
|
49 |
+
<li><?php echo $this->__('<strong>URL de notification de transactions : </strong> %s', $url->getUrl('be2bill/payments/ipn', $params)) ?></li>
|
50 |
+
<li><?php echo $this->__('<strong>URL de notification d’impayés : </strong> %s', $url->getUrl('be2bill/payments/ipn', $params)) ?></li>
|
51 |
+
<?php //echo $this->__('<strong>URL du modèle de formulaire :</strong> %s ou bien une page CMS contenant la variable %s', $url->getUrl('be2bill/template/ssl', $params), '%PLACEHOLDER%') ?>
|
52 |
+
<?php //echo $this->__('<strong>URL du modèle de formulaire avec utilisation d\'une iframe :</strong> %s ou bien une page CMS contenant la variable %s', $url->getUrl('be2bill/template/iframe', $params), '%PLACEHOLDER%') ?>
|
53 |
+
<li><?php echo $this->__('<strong>URL de redirection après un traitement formulaire ou 3DSECURE :</strong> %s', $url->getUrl('be2bill/payments/return', $params)) ?></li>
|
54 |
+
<li><?php echo $this->__('<strong>URL de redirection lors de l\'annulation d\'un traitement formulaire :</strong> %s', $url->getUrl('be2bill/payments/cancel', $params)) ?></li>
|
55 |
+
</ul>
|
56 |
+
</dd>
|
57 |
+
</dl>
|
58 |
+
<?php endforeach; ?>
|
59 |
+
</dd>
|
60 |
+
<?php endforeach; ?>
|
61 |
+
</dl>
|
62 |
+
</div>
|
63 |
+
</div>
|
app/design/frontend/rwd/default/layout/be2bill.xml
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<!--
|
5 |
+
<be2bill_template_nossl>
|
6 |
+
<reference name="root">
|
7 |
+
<action method="setTemplate"><template>page/empty.phtml</template></action>
|
8 |
+
</reference>
|
9 |
+
<reference name="content">
|
10 |
+
<block type="core/template" name="be2bill.nossl" template="be2bill/model/no_ssl.phtml" />
|
11 |
+
</reference>
|
12 |
+
</be2bill_template_nossl>
|
13 |
+
-->
|
14 |
+
|
15 |
+
<!--
|
16 |
+
<be2bill_template_ssl>
|
17 |
+
<remove name="store_language" />
|
18 |
+
<remove name="store_switcher" />
|
19 |
+
<reference name="root">
|
20 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
21 |
+
</reference>
|
22 |
+
<reference name="content">
|
23 |
+
<block type="core/template" name="be2bill.ssl" template="be2bill/model/ssl.phtml" />
|
24 |
+
</reference>
|
25 |
+
</be2bill_template_ssl>
|
26 |
+
-->
|
27 |
+
|
28 |
+
<!--
|
29 |
+
<be2bill_template_iframe>
|
30 |
+
<reference name="root">
|
31 |
+
<action method="setTemplate"><template>page/empty.phtml</template></action>
|
32 |
+
</reference>
|
33 |
+
<reference name="content">
|
34 |
+
<block type="core/template" name="be2bill.iframe" template="be2bill/model/iframe.phtml" />
|
35 |
+
</reference>
|
36 |
+
</be2bill_template_iframe>
|
37 |
+
-->
|
38 |
+
|
39 |
+
<be2bill_template_success>
|
40 |
+
<reference name="root">
|
41 |
+
<action method="setTemplate">
|
42 |
+
<template>page/empty.phtml</template>
|
43 |
+
</action>
|
44 |
+
</reference>
|
45 |
+
<reference name="content">
|
46 |
+
<block type="core/template" name="be2bill.iframe.success" template="be2bill/model/success.phtml" />
|
47 |
+
</reference>
|
48 |
+
</be2bill_template_success>
|
49 |
+
|
50 |
+
<be2bill_template_failure>
|
51 |
+
<reference name="root">
|
52 |
+
<action method="setTemplate">
|
53 |
+
<template>page/empty.phtml</template>
|
54 |
+
</action>
|
55 |
+
</reference>
|
56 |
+
<reference name="content">
|
57 |
+
<block type="core/template" name="be2bill.iframe.failure" template="be2bill/model/failure.phtml" />
|
58 |
+
</reference>
|
59 |
+
</be2bill_template_failure>
|
60 |
+
|
61 |
+
<be2bill_checkout_oneclick_info translate="label">
|
62 |
+
<label>Pay with Be2bill</label>
|
63 |
+
<reference name="root">
|
64 |
+
<action method="setTemplate">
|
65 |
+
<template>page/1column.phtml</template>
|
66 |
+
</action>
|
67 |
+
</reference>
|
68 |
+
<reference name="content">
|
69 |
+
<block type="be2bill/checkout_oneclick_info" name="be2bill.checkout.oneclick.info" template="be2bill/checkout/oneclick/info.phtml">
|
70 |
+
<block type="be2bill/checkout_oneclick_info" name="be2bill.checkout.oneclick.info.review" template="be2bill/checkout/oneclick/info/review.phtml">
|
71 |
+
<action method="addItemRender">
|
72 |
+
<type>simple</type>
|
73 |
+
<block>checkout/cart_item_renderer</block>
|
74 |
+
<template>be2bill/checkout/cart/item/default.phtml</template>
|
75 |
+
</action>
|
76 |
+
<action method="addItemRender">
|
77 |
+
<type>grouped</type>
|
78 |
+
<block>checkout/cart_item_renderer_grouped</block>
|
79 |
+
<template>be2bill/checkout/cart/item/default.phtml</template>
|
80 |
+
</action>
|
81 |
+
<action method="addItemRender">
|
82 |
+
<type>configurable</type>
|
83 |
+
<block>checkout/cart_item_renderer_configurable</block>
|
84 |
+
<template>be2bill/checkout/cart/item/default.phtml</template>
|
85 |
+
</action>
|
86 |
+
<block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="be2bill/checkout/cart/totals.phtml"/>
|
87 |
+
</block>
|
88 |
+
</block>
|
89 |
+
</reference>
|
90 |
+
</be2bill_checkout_oneclick_info>
|
91 |
+
|
92 |
+
<catalog_product_view>
|
93 |
+
<reference name="head">
|
94 |
+
<action method="addItem">
|
95 |
+
<type>skin_css</type>
|
96 |
+
<name>css/be2bill/product.css</name>
|
97 |
+
</action>
|
98 |
+
</reference>
|
99 |
+
<reference name="product.info.addtocart">
|
100 |
+
<block type="be2bill/checkout_oneclick_product" name="be2bill.checkout.oneclick.product" before="catalog.product.related" template="be2bill/checkout/oneclick/product.phtml" />
|
101 |
+
</reference>
|
102 |
+
</catalog_product_view>
|
103 |
+
|
104 |
+
|
105 |
+
<checkout_onepage_index>
|
106 |
+
<reference name="head">
|
107 |
+
<action method="addItem">
|
108 |
+
<type>skin_css</type>
|
109 |
+
<name>css/be2bill/checkout-onepage-payment.css</name>
|
110 |
+
</action>
|
111 |
+
</reference>
|
112 |
+
</checkout_onepage_index>
|
113 |
+
|
114 |
+
<checkout_onepage_review>
|
115 |
+
<reference name="checkout.onepage.review.info.items.after">
|
116 |
+
<block type="be2bill/checkout_review_info" name="be2bill.checkout.review.info" template="be2bill/checkout/review/info.phtml" />
|
117 |
+
<block type="be2bill/method_iframe" name="be2bill.iframe" />
|
118 |
+
</reference>
|
119 |
+
<reference name="checkout.onepage.review.button">
|
120 |
+
<action method="setTemplate">
|
121 |
+
<template helper="be2bill/data/getReviewButtonTemplate">
|
122 |
+
<name>be2bill/checkout/review/button.phtml</name>
|
123 |
+
<block>checkout.onepage.review.button</block>
|
124 |
+
</template>
|
125 |
+
</action>
|
126 |
+
</reference>
|
127 |
+
</checkout_onepage_review>
|
128 |
+
|
129 |
+
<!--
|
130 |
+
<checkout_onepage_success>
|
131 |
+
<reference name="head">
|
132 |
+
<action method="addItem"><type>skin_css</type><name>css/be2bill/checkout-success-crossell.css</name></action>
|
133 |
+
</reference>
|
134 |
+
<reference name="content">
|
135 |
+
<block type="be2bill/checkout_success_crosssell" name="be2bill.checkout.success.crosssell" as="crosssell" template="be2bill/checkout/success/crosssell.phtml"/>
|
136 |
+
</reference>
|
137 |
+
</checkout_onepage_success>
|
138 |
+
-->
|
139 |
+
|
140 |
+
</layout>
|
app/design/frontend/rwd/default/template/be2bill/checkout/cart/item/default.phtml
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<?php
|
18 |
+
$_item = $this->getItem();
|
19 |
+
$versionInfo = Mage::getVersionInfo();
|
20 |
+
if ($versionInfo['major'] == 1 && $versionInfo['minor'] > 5) {
|
21 |
+
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
|
22 |
+
} else {
|
23 |
+
$canApplyMsrp = false;
|
24 |
+
}
|
25 |
+
?>
|
26 |
+
<tr>
|
27 |
+
<th class="a-right" style="border: 0 none; padding: 0;">
|
28 |
+
<h2 class="product-name">
|
29 |
+
<?php echo $this->htmlEscape($this->getProductName()) ?>
|
30 |
+
</h2>
|
31 |
+
<?php if ($_options = $this->getOptionList()): ?>
|
32 |
+
<dl class="item-options">
|
33 |
+
<?php foreach ($_options as $_option) : ?>
|
34 |
+
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
35 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
36 |
+
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
37 |
+
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
38 |
+
<div class="truncated_full_value">
|
39 |
+
<dl class="item-options">
|
40 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
41 |
+
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
42 |
+
</dl>
|
43 |
+
</div>
|
44 |
+
<?php endif; ?>
|
45 |
+
</dd>
|
46 |
+
<?php endforeach; ?>
|
47 |
+
</dl>
|
48 |
+
<?php endif; ?>
|
49 |
+
<?php if ($messages = $this->getMessages()): ?>
|
50 |
+
<?php foreach ($messages as $message): ?>
|
51 |
+
<p class="item-msg <?php echo $message['type'] ?>">* <?php echo $this->escapeHtml($message['text']) ?></p>
|
52 |
+
<?php endforeach; ?>
|
53 |
+
<?php endif; ?>
|
54 |
+
<?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
|
55 |
+
<?php if ($addInfoBlock): ?>
|
56 |
+
<?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
|
57 |
+
<?php endif; ?>
|
58 |
+
</th>
|
59 |
+
|
60 |
+
<?php if (($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
|
61 |
+
<td class="a-right" style="border: 0 none; padding: 0;">
|
62 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
63 |
+
<span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
64 |
+
<?php else: ?>
|
65 |
+
<span class="cart-price">
|
66 |
+
<?php endif; ?>
|
67 |
+
|
68 |
+
<?php if ($canApplyMsrp): ?>
|
69 |
+
<span class="cart-msrp-subtotal">--</span>
|
70 |
+
<?php else: ?>
|
71 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
72 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()); ?>
|
73 |
+
<?php else: ?>
|
74 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
|
75 |
+
<?php endif; ?>
|
76 |
+
<?php endif; ?>
|
77 |
+
|
78 |
+
</span>
|
79 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
80 |
+
|
81 |
+
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
82 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
83 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
84 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'], true, true); ?></span>
|
85 |
+
<?php endforeach; ?>
|
86 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
87 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
88 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span>
|
89 |
+
<?php endforeach; ?>
|
90 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
91 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
92 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span>
|
93 |
+
<?php endforeach; ?>
|
94 |
+
<?php endif; ?>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
98 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
99 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()); ?></span>
|
100 |
+
</div>
|
101 |
+
<?php endif; ?>
|
102 |
+
<?php endif; ?>
|
103 |
+
</td>
|
104 |
+
<?php endif; ?>
|
105 |
+
<?php if (($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
|
106 |
+
<td>
|
107 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
108 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
109 |
+
<span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
110 |
+
<?php else: ?>
|
111 |
+
<span class="cart-price">
|
112 |
+
<?php endif; ?>
|
113 |
+
|
114 |
+
<?php if ($canApplyMsrp): ?>
|
115 |
+
<span class="cart-msrp-subtotal">--</span>
|
116 |
+
<?php else: ?>
|
117 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
118 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl + $_item->getWeeeTaxAppliedRowAmount()); ?>
|
119 |
+
<?php else: ?>
|
120 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl - $_item->getWeeeTaxRowDisposition()) ?>
|
121 |
+
<?php endif; ?>
|
122 |
+
<?php endif; ?>
|
123 |
+
</span>
|
124 |
+
|
125 |
+
|
126 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
127 |
+
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
128 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
129 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
130 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'], true, true); ?></span>
|
131 |
+
<?php endforeach; ?>
|
132 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
133 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
134 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span>
|
135 |
+
<?php endforeach; ?>
|
136 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
137 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
138 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span>
|
139 |
+
<?php endforeach; ?>
|
140 |
+
<?php endif; ?>
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
144 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
145 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + $_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
146 |
+
</div>
|
147 |
+
<?php endif; ?>
|
148 |
+
<?php endif; ?>
|
149 |
+
</td>
|
150 |
+
<?php endif; ?>
|
151 |
+
</tr>
|
app/design/frontend/rwd/default/template/be2bill/checkout/cart/totals.phtml
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<?php
|
18 |
+
$versionInfo = Mage::getVersionInfo();
|
19 |
+
if ($versionInfo['major'] == 1 && $versionInfo['minor'] > 5) {
|
20 |
+
$canApplyMsrp = $this->canApplyMsrp();
|
21 |
+
} else {
|
22 |
+
$canApplyMsrp = false;
|
23 |
+
}
|
24 |
+
?>
|
25 |
+
<?php if ($canApplyMsrp): ?>
|
26 |
+
<div class="cart-msrp-totals"><?php echo $this->__('Le montant total sera affiché avant que vous envoyer la commande'); ?></div>
|
27 |
+
<?php elseif (Mage::helper('be2bill')->isMiraklInstalledAndActive() && $this->getQuote()->getAllItems()[0]->getMiraklOfferId()): ?>
|
28 |
+
<?php foreach ($this->getTotals() as $total): ?>
|
29 |
+
<tr>
|
30 |
+
<th class="a-right" style="border: 0 none; padding: 0;">
|
31 |
+
<?php echo $this->escapeHtml($total->getTitle()); ?>
|
32 |
+
</th>
|
33 |
+
<td class="a-right" style="border: 0 none; padding: 0;">
|
34 |
+
<?php
|
35 |
+
if($total->getCode() === 'shipping'){
|
36 |
+
echo $this->helper('checkout')->formatPrice($this->getQuote()->getMiraklShippingFee());
|
37 |
+
}
|
38 |
+
else{
|
39 |
+
echo $this->helper('checkout')->formatPrice($total->getValue());
|
40 |
+
}
|
41 |
+
?>
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
<?php else: ?>
|
46 |
+
<?php foreach ($this->getTotals() as $total): ?>
|
47 |
+
<tr>
|
48 |
+
<th class="a-right" style="border: 0 none; padding: 0;">
|
49 |
+
<?php echo $this->escapeHtml($total->getTitle()); ?>
|
50 |
+
</th>
|
51 |
+
<td class="a-right" style="border: 0 none; padding: 0;">
|
52 |
+
<?php echo $this->helper('checkout')->formatPrice($total->getValue()) ?>
|
53 |
+
</td>
|
54 |
+
</tr>
|
55 |
+
<?php endforeach; ?>
|
56 |
+
<?php endif; ?>
|
app/design/frontend/rwd/default/template/be2bill/checkout/iframe.phtml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<iframe id="be2bill_iframe" class="be2bill-payment-iframe" src="" width="681px" height="450px" scrolling="yes" frameborder="0" style="display: none;"></iframe>
|
18 |
+
<script type="text/javascript">
|
19 |
+
//<![CDATA[
|
20 |
+
var headers = $$('#' + checkout.accordion.container.readAttribute('id') + ' .section');
|
21 |
+
if ($('btn-checkout-review')) {
|
22 |
+
$('btn-checkout-review').observe('click', function () {
|
23 |
+
|
24 |
+
review.save();
|
25 |
+
var myVar = setInterval(function () {
|
26 |
+
if (this.response.success) {
|
27 |
+
window.clearInterval(myVar);
|
28 |
+
headers.each(function (header) {
|
29 |
+
header.removeClassName('allow');
|
30 |
+
});
|
31 |
+
$('be2bill_iframe').src = '<?php echo $this->getFrameActionUrl() ?>';
|
32 |
+
$('be2bill_iframe').show();
|
33 |
+
checkout.loadWaiting = 'review';
|
34 |
+
checkout.setLoadWaiting(false);
|
35 |
+
if (checkout.accordion.currentSection == 'opc-review') {
|
36 |
+
$('checkout-review-submit').hide();
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}, 1000);
|
40 |
+
});
|
41 |
+
}
|
42 |
+
//]]>
|
43 |
+
</script>
|
app/design/frontend/rwd/default/template/be2bill/checkout/oneclick/info.phtml
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<?php $_code = $this->getRequest()->getParam('method'); ?>
|
18 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
19 |
+
<div class="be2bill-oneclick">
|
20 |
+
<div class="page-title">
|
21 |
+
<h1><?php echo $this->__('Payer avec Be2bill') ?></h1>
|
22 |
+
</div>
|
23 |
+
<form action="<?php echo $this->getSubmitUrl() ?>" method="post" id="be2bill-oneclick-validate">
|
24 |
+
<div class="col2-set">
|
25 |
+
<div class="col-1">
|
26 |
+
|
27 |
+
<?php // si paiement nFois, échéancier ?>
|
28 |
+
<?php if (($this->ntimes())) : ?>
|
29 |
+
<?php $aAdditionnalInformation = $this->getQuote()->getPayment()->getData('additional_information') ?>
|
30 |
+
<h2 class="sub-title"><?php echo $this->__('Votre paiement en %s fois :', $aAdditionnalInformation['ntimes']) ?><?php echo $this->priceFormat($this->getQuote()->getBaseGrandTotal()) ?> </h2>
|
31 |
+
<p><?php echo $this->__('Votre paiement en %s fois :', $aAdditionnalInformation['ntimes']) ?></p>
|
32 |
+
<ul class="disc">
|
33 |
+
<?php $datesOfPayment = Mage::helper('be2bill')->getSchedule($this->getFormatedAmount(), $aAdditionnalInformation['ntimes']) ?>
|
34 |
+
<?php foreach ($datesOfPayment as $date => $amount): ?>
|
35 |
+
<li><?php echo $this->__('%s prélevés le %s', $this->priceFormat($amount / 100), Mage::helper('core')->formatDate($date, 'short')) ?></li>
|
36 |
+
<?php endforeach; ?>
|
37 |
+
</ul>
|
38 |
+
<?php endif ?>
|
39 |
+
|
40 |
+
<?php // si utilisation CVV ?>
|
41 |
+
<?php if ($this->useCVV()): ?>
|
42 |
+
<div style="padding-top: 25px;">
|
43 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
44 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
45 |
+
<ul class="form-list">
|
46 |
+
<li>
|
47 |
+
<label id="<?php echo $_code ?>_label_cvv_oneclick" for="<?php echo $_code ?>_oneclick" class="required" ><em>*</em><?php echo $this->__('Pour confirmer votre paiement, veuillez saisir le CVV de votre carte') ?></label>
|
48 |
+
<div class="input-box">
|
49 |
+
<input id="<?php echo $_code ?>_cc_cid" required="required" class="input-text cvv required-entry validate-cc-cvn" type="text" name="payment[cvv_oneclick]" style="width:3em !important;" autocomplete="off" />
|
50 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__("Qu'est-ce que c'est?") ?></a>
|
51 |
+
</div>
|
52 |
+
</li>
|
53 |
+
</ul>
|
54 |
+
</div>
|
55 |
+
<?php endif; ?>
|
56 |
+
|
57 |
+
<div class="tool-tip" id="payment-tool-tip" style="display:none;">
|
58 |
+
<div class="btn-close"><a href="#" id="payment-tool-tip-close" title="<?php echo $this->__('Fermé') ?>"><?php echo $this->__('fermé') ?></a></div>
|
59 |
+
<div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Numéro de carte de vérification visuelle de référence') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
<div id="quote-review" class="col-2">
|
63 |
+
<?php echo $this->getChildHtml('be2bill.checkout.oneclick.info.review'); ?>
|
64 |
+
</div>
|
65 |
+
<div class="buttons-set">
|
66 |
+
<?php if ($this->useCVV()): ?>
|
67 |
+
<p class="required"><?php echo $this->__('* Champs requis') ?></p>
|
68 |
+
<?php endif; ?>
|
69 |
+
<p class="info"><?php echo Mage::helper('be2bill')->__('Cliquez sur "Commander" validera automatiquement votre commande.') ?></p>
|
70 |
+
<button id="order-place" type="submit" title="<?php echo $this->__('Commander') ?>" class="button"><span><span><?php echo $this->__('Commander') ?></span></span></button>
|
71 |
+
<span class="please-wait" id="please-wait" style="display:none;">
|
72 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__("S'il vous plaît, attendez...") ?>" title="<?php echo $this->__("S'il vous plaît, attendez...") ?>" class="v-middle" /> <?php echo $this->__("S'il vous plaît, attendez...") ?>
|
73 |
+
</span>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
</form>
|
77 |
+
<script type="text/javascript">
|
78 |
+
//<![CDATA[
|
79 |
+
var be2billOneclickValidateForm = new VarienForm('be2bill-oneclick-validate');
|
80 |
+
|
81 |
+
function toggleToolTip(event) {
|
82 |
+
if ($('payment-tool-tip')) {
|
83 |
+
$('payment-tool-tip').setStyle({
|
84 |
+
top: (Event.pointerY(event) - 160) + 'px',
|
85 |
+
left: (Event.pointerX(event) + 100) + 'px'
|
86 |
+
});
|
87 |
+
$('payment-tool-tip').toggle();
|
88 |
+
}
|
89 |
+
Event.stop(event);
|
90 |
+
}
|
91 |
+
|
92 |
+
if ($('payment-tool-tip-close')) {
|
93 |
+
Event.observe($('payment-tool-tip-close'), 'click', toggleToolTip);
|
94 |
+
}
|
95 |
+
|
96 |
+
if ($('shipping-method')) {
|
97 |
+
$$('input.radio').each(function (element) {
|
98 |
+
Event.observe(element, 'click', function () {
|
99 |
+
new Ajax.Updater(
|
100 |
+
'quote-review',
|
101 |
+
'<?php echo Mage::getUrl('be2bill/checkout_oneclick/saveShippingMethod') ?>',
|
102 |
+
{
|
103 |
+
parameters: {_secure: true, estimate_method: this.value},
|
104 |
+
onCreate: function () {
|
105 |
+
$('order-place').hide();
|
106 |
+
$('please-wait').show();
|
107 |
+
},
|
108 |
+
onComplete: function () {
|
109 |
+
$('order-place').show();
|
110 |
+
$('please-wait').hide();
|
111 |
+
}
|
112 |
+
}
|
113 |
+
);
|
114 |
+
});
|
115 |
+
});
|
116 |
+
}
|
117 |
+
|
118 |
+
$$('.cvv-what-is-this').each(function (element) {
|
119 |
+
Event.observe(element, 'click', toggleToolTip);
|
120 |
+
});
|
121 |
+
//]]>
|
122 |
+
</script>
|
123 |
+
</div>
|
app/design/frontend/rwd/default/template/be2bill/checkout/oneclick/info/review.phtml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
|
18 |
+
<table class="data-table cart-table" style="border: 0 none;">
|
19 |
+
<tbody>
|
20 |
+
<?php foreach ($this->getQuote()->getAllItems() as $_item): ?>
|
21 |
+
<?php echo $this->getItemHtml($_item) ?>
|
22 |
+
<?php endforeach; ?>
|
23 |
+
<?php echo $this->getChildHtml('totals'); ?>
|
24 |
+
<tr>
|
25 |
+
<th class="a-right" style="border: 0 none; padding: 20px 0px 0px;">
|
26 |
+
<?php echo Mage::helper('checkout')->__('Shipping Address') ?>
|
27 |
+
</th>
|
28 |
+
<td class="a-right" style="border: 0 none; padding: 20px 0px 0px;">
|
29 |
+
<?php echo $this->getQuote()->getShippingAddress()->format('html') ?>
|
30 |
+
</td>
|
31 |
+
</tr>
|
32 |
+
</tbody>
|
33 |
+
</table>
|
app/design/frontend/rwd/default/template/be2bill/checkout/oneclick/product.phtml
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<?php if ($this->canOneclick() && ($sAliasSelect = $this->getAliasSelect()) && ($sShippingMethodsSelect = $this->getShippingMethodsSelect())) : ?>
|
18 |
+
<div class="be2bill-<?php echo $this->getProduct()->getTypeId() ?>-product-oneclick">
|
19 |
+
<div class="be2bill-product-oneclick-content">
|
20 |
+
<span class="or"><?php echo $this->__('OU') ?> <?php echo $this->__('Commander en un clic avec Be2bill') ?></span>
|
21 |
+
<?php if ($this->customerHasAddresses()): ?>
|
22 |
+
<div class="field">
|
23 |
+
<label for="alias-card-select"><?php echo $this->__('Sélectionnez une carte enregistrée') ?></label>
|
24 |
+
<div class="input-box">
|
25 |
+
<?php echo $sAliasSelect; ?>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
<div class="field">
|
29 |
+
<label for="shipping-address-select"><?php echo $this->__('Sélectionnez une addresse :') ?></label>
|
30 |
+
<div class="input-box">
|
31 |
+
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
<div class="field">
|
35 |
+
<label for="shipping-method-select"><?php echo $this->__('Sélectionnez une méthode de livraison :') ?></label>
|
36 |
+
<div class="input-box">
|
37 |
+
<div class="input-box" id="div-shipping-method-select">
|
38 |
+
<?php echo $sShippingMethodsSelect; ?>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
<?php endif; ?>
|
43 |
+
<span class="please-wait" id="please-wait" style="display:none;">
|
44 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__("S'il vous plaît, attendez...") ?>" title="<?php echo $this->__("S'il vous plaît, attendez...") ?>" class="v-middle" /> <?php echo $this->__("S'il vous plaît, attendez...") ?>
|
45 |
+
</span>
|
46 |
+
<div class="actions">
|
47 |
+
<span title="<?php echo $this->__('Pay') ?>" id="ock_button" class="button btn-cart" onclick="productAddToCartForm.submit(this, '<?php echo $this->getOneclickUrl() ?>');"><span><span><?php echo $this->__('Payer') ?></span></span></span>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
<?php endif; ?>
|
52 |
+
|
53 |
+
<script type="text/javascript" >
|
54 |
+
// mise à jour de la quantité
|
55 |
+
$('qty').observe('change', updateShippingFees);
|
56 |
+
|
57 |
+
// mise à jour de l'adresse de livraison
|
58 |
+
$('shipping-address-select').observe('change', updateShippingFees);
|
59 |
+
|
60 |
+
// fonction ajax pour mise a jour de la methode de livraison
|
61 |
+
function updateShippingFees(){
|
62 |
+
var productId = '<?php echo $this->getProduct()->getId() ?>';
|
63 |
+
var url = '<?php echo Mage::getUrl('be2bill/checkout_oneclick/updateShippingFee'); ?>';
|
64 |
+
|
65 |
+
$('shipping-method-select').hide();
|
66 |
+
$('ock_button').hide();
|
67 |
+
$('please-wait').show();
|
68 |
+
|
69 |
+
new Ajax.Request(url, {
|
70 |
+
method: 'get',
|
71 |
+
parameters: {productId: productId , qty : $('qty').value , addressId : $('shipping-address-select').value},
|
72 |
+
onSuccess: function(transport) {
|
73 |
+
|
74 |
+
var elementValues = {};
|
75 |
+
if (transport && transport.responseText){
|
76 |
+
try{
|
77 |
+
elementValues = eval('(' + transport.responseText + ')');
|
78 |
+
}
|
79 |
+
catch (e) {
|
80 |
+
elementValues = {};
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
$('div-shipping-method-select').innerHTML = elementValues.html;
|
85 |
+
$('ock_button').show();
|
86 |
+
$('please-wait').hide();
|
87 |
+
},
|
88 |
+
onFailure: function(transport) {
|
89 |
+
location.reload;
|
90 |
+
}
|
91 |
+
});
|
92 |
+
}
|
93 |
+
|
94 |
+
updateShippingFees();
|
95 |
+
</script>
|
app/design/frontend/rwd/default/template/be2bill/checkout/onepage/payment/additional.phtml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<dl class="sp_methods" id="checkout-payments-be2bill-method-load">
|
18 |
+
<?php $paymentsMethod = $this->getAvailablePayments() ?>
|
19 |
+
<?php foreach ($paymentsMethod as $paymentsMethod) : ?>
|
20 |
+
<?php $options = $paymentsMethod->getAvailableOptions(10); ?>
|
21 |
+
<?php foreach ($options as $option) : ?>
|
22 |
+
<dt id="dt_method_be2bill_<?php echo $paymentsMethod->getdata('b2b_xml_account_type_code') ?>_<?php echo $option->getdata('b2b_xml_option') ?>">
|
23 |
+
<input id="p_method_be2bill_<?php echo $paymentsMethod->getdata('b2b_xml_account_type_code') ?>_<?php echo $option->getdata('b2b_xml_option') ?>" value="be2bill" type="radio" name="payment[method]" title="<?php echo $paymentsMethod->getdata('b2b_xml_account_type_code') . ' : ' . $option->getData('b2b_xml_option') ?>" onclick="payment.switchMethod('be2bill_<?php echo $paymentsMethod->getdata('b2b_xml_account_type_code') ?>_<?php echo $option->getdata('b2b_xml_option') ?>')" class="radio" autocomplete="off">
|
24 |
+
<label for="p_method_be2bill_<?php echo $paymentsMethod->getdata('b2b_xml_account_type_code') ?>_<?php echo $option->getdata('b2b_xml_option') ?>"><?php echo $paymentsMethod->getdata('b2b_xml_account_type_code') . ' : ' . $option->getData('b2b_xml_option') ?></label>
|
25 |
+
</dt>
|
26 |
+
<dd id="dd_method_be2bill_<?php echo $paymentsMethod->getdata('b2b_xml_account_type_code') ?>_<?php echo $option->getdata('b2b_xml_option') ?>"></dd>
|
27 |
+
<?php endforeach; ?>
|
28 |
+
<?php endforeach; ?>
|
29 |
+
</dl>
|
app/design/frontend/rwd/default/template/be2bill/checkout/review/button.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<button type="submit" id="btn-checkout-review" title="<?php echo $this->__('Payer votre commande') ?>" class="button btn-checkout"><span><span><?php echo $this->__('Payer votre commande') ?></span></span></button>
|
app/design/frontend/rwd/default/template/be2bill/checkout/review/info.phtml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<?php if ($this->getQuote()->getPayment()->getData('additional_information')['options'] == 'ntimes'): ?>
|
18 |
+
<div class="checkout-review-be2bill checkout-agreements">
|
19 |
+
<p><?php echo $this->__('Votre paiement en %s fois :', $this->getQuote()->getPayment()->getData('additional_information')['ntimes']) ?></p>
|
20 |
+
<?php $datesOfPayment = Mage::helper('be2bill')->getSchedule($this->getFormatedAmount(), $this->getQuote()->getPayment()->getData('additional_information')['ntimes']) ?>
|
21 |
+
<?php foreach ($datesOfPayment as $date => $amount): ?>
|
22 |
+
<p class="ul"><?php echo $this->__('%s prélevés le %s', $this->priceFormat($amount / 100), Mage::helper('core')->formatDate($date, 'short')) ?></p>
|
23 |
+
<?php endforeach; ?>
|
24 |
+
</div>
|
25 |
+
<?php endif; ?>
|
app/design/frontend/rwd/default/template/be2bill/form/payment_methods.phtml
ADDED
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<dl class="form-list be2bill-list" id="payment_<?php echo $this->getMethodCode() ?>" >
|
18 |
+
<?php $paymentsMethod = $this->getAvailablePayments(); ?>
|
19 |
+
<?php $i = 0; ?>
|
20 |
+
<?php
|
21 |
+
// boucle sur les methodes de paiement
|
22 |
+
foreach ($paymentsMethod as $paymentMethod) :
|
23 |
+
|
24 |
+
// recuperation de l'objet permettant de verifier l'activation du oneClick sur la methode de paiement
|
25 |
+
$aGetOneClick = $this->getOneClick($paymentMethod);
|
26 |
+
|
27 |
+
// recuperation des options de paiement liee a la methode de paiement
|
28 |
+
$options = $this->getAvailableFrontOptions($paymentMethod);
|
29 |
+
|
30 |
+
// boucle sur les options de paiement
|
31 |
+
foreach ($options as $option) : $i++;
|
32 |
+
|
33 |
+
if($option->getdata('front_label') != null){
|
34 |
+
$_label = $option->getdata('front_label');
|
35 |
+
}
|
36 |
+
else{
|
37 |
+
if($option->getdata('b2b_xml_option') === 'ntimes'){
|
38 |
+
$_label = str_replace('ntimes', $this->__('%s times', unserialize($option->getData('b2b_xml_option_extra'))), $paymentMethod->getFrontendLabel($option->getdata('b2b_xml_option')));
|
39 |
+
}
|
40 |
+
else{
|
41 |
+
$_label = $paymentMethod->getFrontendLabel($option->getdata('b2b_xml_option'));
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$_code = $paymentMethod->getId() . '.' . $paymentMethod->getdata('b2b_xml_account_type_code') . '.' . $option->getdata('b2b_xml_option');
|
46 |
+
|
47 |
+
//A ton besoin d'afficher le champ identificationDocIc
|
48 |
+
$hasIdenDocId = $this->getHasIdenDocId($paymentMethod->getdata('b2b_xml_account_type_code') , $option->getdata('b2b_xml_option'));
|
49 |
+
|
50 |
+
$_logo = $paymentMethod->getLogo();
|
51 |
+
?>
|
52 |
+
<dt id="dt_method_<?php echo $_code ?>" >
|
53 |
+
<input id="bb_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[be2bill_method]" title="<?php echo $_label ?>" class="radio" <?php //echo $i == 1 ? 'checked' : '' ?> autocomplete="off" >
|
54 |
+
<input value="<?php echo $_label ?>" type="hidden" name="payment[<?php echo $_code ?>][label]" />
|
55 |
+
<label for="bb_method_<?php echo $_code ?>">
|
56 |
+
<img class="be2bill-logo v-middle" alt="" src="<?php echo $_logo ?>" height="35" />
|
57 |
+
<span class="be2bill-label"><?php echo $_label ?></span>
|
58 |
+
</label>
|
59 |
+
</dt>
|
60 |
+
|
61 |
+
<dd id="dd_method_<?php echo $_code ?>" style="display:none" class="be2bill-extra-options" >
|
62 |
+
<ul>
|
63 |
+
<?php
|
64 |
+
if (in_array($option->getdata('b2b_xml_option'), array('standard', 'ntimes', 'defered', 'delivery'))):
|
65 |
+
// si oneclick actif
|
66 |
+
if($aGetOneClick['active']){
|
67 |
+
// si carte existe et toujours valide
|
68 |
+
if ($this->ccExpDateIsValid($paymentMethod->getId())){
|
69 |
+
?>
|
70 |
+
<?php // radio "carte pre-enregistree" ?>
|
71 |
+
<li class="form-alt">
|
72 |
+
<?php $_card = $this->getCustomerAlias($paymentMethod->getId()) ?>
|
73 |
+
<?php if ($paymentMethod->useOneClickCVV()) : ?>
|
74 |
+
<p class="required"><?php echo $this->__('* Champs requis') ?></p>
|
75 |
+
<?php endif; ?>
|
76 |
+
<label for="<?php echo $_code ?>_use_alias_oneclick">
|
77 |
+
<input id="<?php echo $_code ?>_use_alias_oneclick" value="use_oneclick" required="required" class="validate-one-required-by-name" type="radio" name="payment[<?php echo $_code ?>][oneclick]" onclick="$('<?php echo $_code ?>_card_fields').show()" />
|
78 |
+
<?php echo $this->__('Utiliser ma carte pré-enregistrée.') ?>
|
79 |
+
</label>
|
80 |
+
<ul id="<?php echo $_code ?>_card_fields" class="form-list" style="display:none">
|
81 |
+
<li class="info"><?php echo $this->__('Carte actuelle : %s', $_card->getCardNumber()) ?></li>
|
82 |
+
<li class="info"><?php echo $this->__("Date d'expiration : %s", $this->getCcExpDate($_card->getDateEnd())) ?></li>
|
83 |
+
<?php if ($paymentMethod->useOneClickCVV()) : ?>
|
84 |
+
<li class="cvv">
|
85 |
+
<label id="<?php echo $_code ?>_label_cvv_oneclick" for="<?php echo $_code ?>_oneclick" class="required" >
|
86 |
+
<input id="<?php echo $_code ?>_cc_type" value="VI" type="hidden" name="payment[<?php echo $_code ?>][cc_type]" />
|
87 |
+
<em>*</em><?php echo $this->__('Entrez votre cryptogramme') ?>
|
88 |
+
</label>
|
89 |
+
<div class="input-box">
|
90 |
+
<div class="v-fix">
|
91 |
+
<input id="<?php echo $_code ?>_cc_cid" required="required" class="input-text cvv required-entry validate-cc-cvn" type="text" name="payment[<?php echo $_code ?>][cvv_oneclick]" autocomplete="off" />
|
92 |
+
</div>
|
93 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__("Qu'est-ce que c'est?") ?></a>
|
94 |
+
</div>
|
95 |
+
</li>
|
96 |
+
<?php endif; ?>
|
97 |
+
</ul>
|
98 |
+
</li>
|
99 |
+
<?php // radio "changement de CB" ?>
|
100 |
+
<li class="form-alt">
|
101 |
+
<label for="<?php echo $_code ?>_create_alias_oneclick">
|
102 |
+
<input id="<?php echo $_code ?>_create_alias_oneclick" required="required" class="" type="radio" name="payment[<?php echo $_code ?>][oneclick]" value="create_oneclick" <?php if ($paymentMethod->useOneClickCVV()) : ?> onclick="$('<?php echo $_code ?>_card_fields').hide()" <?php endif; ?> />
|
103 |
+
<?php echo $this->__('Remplacer vos données de Carte Bancaire.') ?>
|
104 |
+
</label>
|
105 |
+
</li>
|
106 |
+
<?php // radio "payer avec autre carte" ?>
|
107 |
+
<?php if (!$this->getQuote()->isNominal()) : ?>
|
108 |
+
<li class="form-alt">
|
109 |
+
<label for="<?php echo $_code ?>_not_oneclick">
|
110 |
+
<input id="<?php echo $_code ?>_not_oneclick" type="radio" name="payment[<?php echo $_code ?>][oneclick]" class="" value="not_oneclick" <?php if ($paymentMethod->useOneClickCVV()) : ?> onclick="$('<?php echo $_code ?>_card_fields').hide()" <?php endif; ?> />
|
111 |
+
<?php echo $this->__('Payer directement avec une autre Carte Bancaire.') ?>
|
112 |
+
</label>
|
113 |
+
</li>
|
114 |
+
<?php endif; ?>
|
115 |
+
<?php
|
116 |
+
}
|
117 |
+
// carte non existante ou invalide
|
118 |
+
else {
|
119 |
+
?>
|
120 |
+
<li class="form-alt">
|
121 |
+
<label for="<?php echo $_code ?>_create_alias_oneclick">
|
122 |
+
<input id="<?php echo $_code ?>_create_alias_oneclick"<?php echo $this->getQuote()->isNominal() ? ' required="required" class="required-entry"' : "" ?> value="create_oneclick" type="checkbox" name="payment[<?php echo $_code ?>][oneclick]" />
|
123 |
+
<?php echo $this->__('Enregistrez vos données de carte bancaire pour un prochain achat.') ?>
|
124 |
+
</label>
|
125 |
+
</li>
|
126 |
+
<?php
|
127 |
+
}
|
128 |
+
}
|
129 |
+
?>
|
130 |
+
|
131 |
+
<?php endif; ?>
|
132 |
+
|
133 |
+
<?php if($hasIdenDocId): ?>
|
134 |
+
<li class="form-alt">
|
135 |
+
<label for="<?php echo $_code ?>_identificationdocid">
|
136 |
+
<?php echo $this->__("Numéro d'identification") ?>
|
137 |
+
<input id="<?php echo $_code ?>_identificationdocid" type="text" name="payment[<?php echo $_code ?>][identificationdocid]" class="required-entry validate-length maximum-length-64 minimum-length-8" value="" />
|
138 |
+
</label>
|
139 |
+
</li>
|
140 |
+
<?php endif; ?>
|
141 |
+
</ul>
|
142 |
+
</dd>
|
143 |
+
|
144 |
+
<script type="text/javascript">
|
145 |
+
$('bb_method_<?php echo $_code ?>').observe('click', function (event) {
|
146 |
+
$$('.be2bill-extra-options').invoke('hide');
|
147 |
+
$('dd_method_<?php echo $_code ?>').show();
|
148 |
+
$('p_method_be2bill').checked = true;
|
149 |
+
|
150 |
+
//rendre le potentiel option (oneclik etc) obligatoire
|
151 |
+
if ($('<?php echo $_code ?>_use_alias_oneclick'))
|
152 |
+
$('<?php echo $_code ?>_use_alias_oneclick').addClassName('validate-one-required-by-name');
|
153 |
+
|
154 |
+
payment.switchMethod('be2bill');
|
155 |
+
});
|
156 |
+
</script>
|
157 |
+
<?php endforeach; ?>
|
158 |
+
|
159 |
+
<?php
|
160 |
+
unset($aGetOneClick);
|
161 |
+
?>
|
162 |
+
|
163 |
+
<?php endforeach; ?>
|
164 |
+
</dl>
|
165 |
+
<script type="text/javascript">
|
166 |
+
$$('input[name="payment[method]"]').each(function (elemt) {
|
167 |
+
elemt.observe('change', function (event) {
|
168 |
+
if (elemt.value != 'be2bill') {
|
169 |
+
$$('.be2bill-extra-options').invoke('hide');
|
170 |
+
$$('#payment_be2bill input[type="radio"]').each(function (elmt) {
|
171 |
+
elmt.checked = false;
|
172 |
+
elmt.removeClassName('validate-one-required-by-name');
|
173 |
+
});
|
174 |
+
}
|
175 |
+
});
|
176 |
+
});
|
177 |
+
//cacher : choisir parmi..
|
178 |
+
$('dt_method_be2bill').setStyle({visibility: 'hidden'});
|
179 |
+
if ($('p_method_be2bill').checked == true && $('dt_method_be2bill')) { //si la seul méthode de paiement affiché est : be2bill
|
180 |
+
//alors on coche la première method be2bill générique
|
181 |
+
$$('.be2bill-list input[type="radio"]')[0].checked = true;
|
182 |
+
}
|
183 |
+
|
184 |
+
Payment.prototype.init = function () {
|
185 |
+
this.beforeInit();
|
186 |
+
var elements = Form.getElements(this.form);
|
187 |
+
if ($(this.form)) {
|
188 |
+
$(this.form).observe('submit', function (event) {
|
189 |
+
this.save();
|
190 |
+
Event.stop(event);
|
191 |
+
}.bind(this));
|
192 |
+
}
|
193 |
+
var method = null;
|
194 |
+
for (var i = 0; i < elements.length; i++) {
|
195 |
+
if (elements[i].name == 'payment[method]') {
|
196 |
+
if (elements[i].checked) {
|
197 |
+
method = elements[i].value;
|
198 |
+
}
|
199 |
+
} else {
|
200 |
+
elements[i].disabled = true;
|
201 |
+
}
|
202 |
+
elements[i].setAttribute('autocomplete', 'off');
|
203 |
+
}
|
204 |
+
if (method)
|
205 |
+
this.switchMethod(method);
|
206 |
+
this.afterInit();
|
207 |
+
|
208 |
+
//add be2bill
|
209 |
+
var descendants = $('payment_be2bill').descendants();
|
210 |
+
for (var k in descendants) {
|
211 |
+
descendants[k].disabled = false;
|
212 |
+
}
|
213 |
+
$('payment_be2bill').disabled = false;
|
214 |
+
|
215 |
+
};
|
216 |
+
</script>
|
217 |
+
|
app/design/frontend/rwd/default/template/be2bill/info/payment_methods.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2016 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<p><?php echo $this->htmlEscape($this->getBe2billMethod()) ?></p>
|
app/design/frontend/rwd/default/template/be2bill/model/failure.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2015 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
|
18 |
+
<script type="text/javascript">
|
19 |
+
window.top.location.href = '<?php echo Mage::getUrl('checkout/cart') ?>';
|
20 |
+
</script>
|
app/design/frontend/rwd/default/template/be2bill/model/success.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 1997-2015 Quadra Informatique
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
8 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
9 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
10 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
13 |
+
* @copyright 1997-2015 Quadra Informatique
|
14 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
|
18 |
+
<script type="text/javascript">
|
19 |
+
window.top.location.href = '<?php echo Mage::getUrl('checkout/onepage/success', array('_secure' => true)) ?>';
|
20 |
+
</script>
|
app/etc/modules/Quadra_Be2bill.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* 1997-2016 Quadra Informatique
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
9 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
10 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
11 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
14 |
+
* @copyright 1997-2015 Quadra Informatique
|
15 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<modules>
|
20 |
+
<Quadra_Be2bill>
|
21 |
+
<active>true</active>
|
22 |
+
<codePool>community</codePool>
|
23 |
+
<depends>
|
24 |
+
<Mage_Payment/>
|
25 |
+
</depends>
|
26 |
+
</Quadra_Be2bill>
|
27 |
+
</modules>
|
28 |
+
</config>
|
app/locale/en_US/Quadra_Be2bill.csv
ADDED
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"(Code Erreur %s) %s","(Response Code %s) %s"
|
2 |
+
"(Code retour : %s) %s","(Return code : %s) %s"
|
3 |
+
"* Champs requis","* Required fields"
|
4 |
+
"/!\ Test /!\","/!\ Test /!\"
|
5 |
+
"/!\ Test /!\ Transactions de serveur à serveur","/!\ Test /!\ Server to Server Transactions"
|
6 |
+
"/!\ Test /!\ Url de haute disponibilité","/!\ Test /!\ Url high availability"
|
7 |
+
"%d compte(s) activé(s)","%d account(s) active(s)"
|
8 |
+
"%d compte(s) désactivé(s)","%d account(s) deactivated(s)"
|
9 |
+
"%d enregistrement(s) supprimé(s)","%d record(s) deleted(s)"
|
10 |
+
"%s payé le %s","%s paid %s"
|
11 |
+
"%s prélevés le %s","%s taken on %s"
|
12 |
+
"1 jour","1 day"
|
13 |
+
"10 jours","10 days"
|
14 |
+
"2 jours","10 days"
|
15 |
+
"3 jours","3 days"
|
16 |
+
"3D Secure","3D Secure"
|
17 |
+
"4 jours","4 days"
|
18 |
+
"5 jours","5 days"
|
19 |
+
"6 jours","6 days"
|
20 |
+
"7 jours","7 days"
|
21 |
+
"8 jours","8 days"
|
22 |
+
"9 jours","9 days"
|
23 |
+
"Action de paiement","Payment Action"
|
24 |
+
"Activé","Enabled"
|
25 |
+
"Activer","Enabled"
|
26 |
+
"Activer 3D secure","Use 3D secure"
|
27 |
+
"Activer le debug","Enable debug"
|
28 |
+
"Activer le mode debug","Enabled debug mode"
|
29 |
+
"Activer le mode test","Enabled test mode"
|
30 |
+
"Activer le paiement récurrent","Allow recurring profile"
|
31 |
+
"Activer oneclick","Allow oneclick"
|
32 |
+
"Amex","Amex"
|
33 |
+
"Annule les commandes dont la durée du statut 'En attente de capture be2bill' a atteint la limite.","Cancel orders in status pending capture be2bill for limited days"
|
34 |
+
"Annule les commandes dont le statut est ""en attende"" depuis : ","Cancel orders whose status is ""in pending "" since:"
|
35 |
+
"Annuler les commandes automatiquement","Automatic cancel orders"
|
36 |
+
"Annuler par le client","Canceled by user."
|
37 |
+
"API Be2bill","Be2bill API "
|
38 |
+
"Aucun compte sélectionné","No account selected"
|
39 |
+
"Authentification 3DSecure échouée","The 3D secure authentication failed."
|
40 |
+
"Authentification 3DSecure expirée","The 3D secure authentication request has expired."
|
41 |
+
"Autorisation","Authorization"
|
42 |
+
"Be2bill","Be2bill"
|
43 |
+
"Be2bill : Configuration des comptes","Be2bill : Account Setup"
|
44 |
+
"Configuration des comptes","Accounts Setup"
|
45 |
+
"Configuration de l'API","API setup"
|
46 |
+
"Be2bill Messages d erreur","Be2bill Error Messages"
|
47 |
+
"Carte actuelle : %s","Actual card: %s"
|
48 |
+
"CB Visa","CB Visa"
|
49 |
+
"Certains pays","Specific Countries"
|
50 |
+
"Choisir parmi...","Choose from ..."
|
51 |
+
"Choisir un autre mode de livraison","Choose another shipping method"
|
52 |
+
"Client %d introuvable (récurrent) ","Customer %d not found (Recurring)."
|
53 |
+
"Cliquer sur ""Commander"" validera automatiquement votre commande.","Click on ""Checkout"" will validate automatically your order."
|
54 |
+
"Commande annulée automatique par le cron car la commande est en 'attente' depuis %d minutes","Order canceled automatically by cron because order is pending since %d minutes"
|
55 |
+
"Commande annulée par la tâche de fond be2bill.","Order canceled by be2bill cron tab."
|
56 |
+
"Commande annulée par le cron be2bill","Order canceled by be2bill cron tab."
|
57 |
+
"Commande impossible à annuler par be2bill.","Order tried to cancel by cron tab but not successful."
|
58 |
+
"Commande introuvable (récurrent)","Command not found ! (recurring)"
|
59 |
+
"Commande introuvable!","Command not found !"
|
60 |
+
"Commande réglée en 3x. Veuillez effectuer le remboursement des échéances via l'Extranet Be2bill","Order paid in 3 times. Please refund the order in the Be2bill Extranet"
|
61 |
+
"Commander","Order"
|
62 |
+
"Commander en un clic avec Be2bill","Order in a click with Be2bill"
|
63 |
+
"Commmande introuvable (récurrent)","Order not found (recurring)"
|
64 |
+
"Configuration de l'API Be2Bill","Setup Be2bill API"
|
65 |
+
"Configuration du compte","Account Setup"
|
66 |
+
"Configuration générale","General Setup"
|
67 |
+
"Créer un nouveau compte","Create a new account"
|
68 |
+
"D'après votre commande, les articles suivants pourraient vous intéresser :","Based on your order, you may be interested in the following items:"
|
69 |
+
"Date d'expiration : %s","Expiration date: %s"
|
70 |
+
"Défini l'ordre d'appartion de la méthode dans le tunnel de commande.","Define sort order of this method in onepage checkout"
|
71 |
+
"Demande en double","Duplicate request."
|
72 |
+
"Demander le cryptogramme lors d'un oneclick","Use CVV for one click"
|
73 |
+
"Désactivé","Disabled"
|
74 |
+
"Devise","Currency"
|
75 |
+
"Données de carte invalides","Invalid card data."
|
76 |
+
"Erreur Be2bill %s","Be2Bill Error %s"
|
77 |
+
"Echec de l'import"," Import failed "
|
78 |
+
"Edition du compte","Edit account"
|
79 |
+
"En attende de la capture de la transaction '%s' et de montant %s","Waiting for capture transaction ID '%s'of amount %s"
|
80 |
+
"En attente de capture Be2bill","Pending Capture Be2bill"
|
81 |
+
"En attente de la capture. Transaction '%s de %s","Waiting for capture transaction ID '%s' of amount %s"
|
82 |
+
"Enregistrez vos données de carte bancaire pour un prochain achat.","Record your card data for a next buy."
|
83 |
+
"Entrez votre cryptogramme","Enter your CVV code"
|
84 |
+
"Erreur 4001","Error 4001"
|
85 |
+
"Erreur 4002","Error 4002"
|
86 |
+
"Erreur 4003","Error 4003"
|
87 |
+
"Erreur 4004","Error 4004"
|
88 |
+
"Erreur 4005","Error 4005"
|
89 |
+
"Erreur 4006","Error 4006"
|
90 |
+
"Erreur 4007","Error 4007"
|
91 |
+
"Erreur 4008","Error 4008"
|
92 |
+
"Erreur 4009","Error 4009"
|
93 |
+
"Erreur 4010","Error 4010"
|
94 |
+
"Erreur 4011","Error 4011"
|
95 |
+
"Erreur 4012","Error 4012"
|
96 |
+
"Erreur 4013","Error 4013"
|
97 |
+
"Erreur 5001","Error 5001"
|
98 |
+
"Erreur 5002","Error 5002"
|
99 |
+
"Erreur 5003","Error 5003"
|
100 |
+
"Erreur 5004","Error 5004"
|
101 |
+
"Erreur 5005","Error 5005"
|
102 |
+
"Erreur 6001","Error 6001"
|
103 |
+
"Erreur 6002","Error 6002"
|
104 |
+
"Erreur 6003","Error 6003"
|
105 |
+
"Erreur 6004","Error 6004"
|
106 |
+
"Erreur lors du traitement du paiement. Code %s ==> %s.","Error in processing payment with code %s and message: %s."
|
107 |
+
"Êtes-vous sûr ?","Are you sure ?"
|
108 |
+
"Facture #%s créée","Invoice #%s created"
|
109 |
+
"Fonds insuffisants ou plafond de paiement atteint","Insufficient funds."
|
110 |
+
"Gestion des comptes","Account Management"
|
111 |
+
"Id du compte","Account Id"
|
112 |
+
"Identifiant","Identifier"
|
113 |
+
"Identifier","Identifier"
|
114 |
+
"Identifiant du compte","Account identifier"
|
115 |
+
"Il y a des commandes en attente de capture be2bill depuis au moins %s jour(s)","They are orders in pending capture be2bill for at leat %s days"
|
116 |
+
"Import des paiements dynamiques","Import dynamic payments"
|
117 |
+
"Import réalisé avec succès","Import successful"
|
118 |
+
"Impossible de se connecter aux serveurs be2bill","Unable to connect at be2bill servers"
|
119 |
+
"Impossible de se connecter aux serveurs de Be2bill","Unable to connect at be2bill servers"
|
120 |
+
"Impossible de se connecter aux serveurs de Be2bill","Unable to connect at be2bill servers"
|
121 |
+
"INTERDIT!","NOT ALLOWED!"
|
122 |
+
"L'annulation de la commande par le cron Be2bill a échoué","Order tried to cancel by cron tab but not successful."
|
123 |
+
"Label front office","Label front office"
|
124 |
+
"La date de validité de votre carte Bleue ne permet pas d’effectuer un paiement en plusieurs fois, nous vous invitons à changer de Carte Bleue ou bien à vous diriger vers le paiement en une fois.","The validity date of your card does not allow to make payment in installments , please change Carte Bleue or to direct you to the payment at once."
|
125 |
+
"La methode Be2bill paiement doit être activée pour utiliser la méthode de paiement en plusieurs fois.","The method Be2bill payment must enabled to use this method."
|
126 |
+
"Label visible sur le front office","Label visible on the front office"
|
127 |
+
"Le client à été notifié de la facture #%s.","Notified customer about invoice #%s."
|
128 |
+
"Le client doit saisir son cryptogramme à chaque paiement.","Customer must insert his CVV again"
|
129 |
+
"Le compte a bien été supprimé","The account has been deleted"
|
130 |
+
"Le montant total sera affiché avant que vous envoyer la commande","The total amount will be displayed before you send the command"
|
131 |
+
"Le produit n'a pas pu être trouvé","Product not found"
|
132 |
+
"Le produit n'existe pas","Product not found"
|
133 |
+
"Livraison standard","Standard shipping method"
|
134 |
+
"Libellé","Label"
|
135 |
+
"Log les requêtes et les réponses du serveur dans le fichier 'var/log/payment_be2bill_standard.log'","Log request and response (var/log/payment_be2bill_standard.log)"
|
136 |
+
"Logo","Logo"
|
137 |
+
"Magasin","Store"
|
138 |
+
"Mauvaise IP : ","Wrong Ip : "
|
139 |
+
"Maximum de commande","Maximum Order Total"
|
140 |
+
"Merci de votre compréhension.","Thank you for your understanding."
|
141 |
+
"Minimum de commande","Minimum Order Total"
|
142 |
+
"Mode","Mode"
|
143 |
+
"Mode de paiement autorisé pour","Payment from applicable countries"
|
144 |
+
"Mode de paiement autorisé pour les pays spécifiques","Payment from Specific countries"
|
145 |
+
"Mode Debug","Debug mode"
|
146 |
+
"Mode Test","Test mode"
|
147 |
+
"Montant maximum de la commande","Maximum amount"
|
148 |
+
"Montant maximum de la commande pour afficher la méthode de paiement","Maximum amount of the order to display the payment method"
|
149 |
+
"Montant minimum de la commande","Minimum order"
|
150 |
+
"Montant minimum de la commande pour afficher la méthode de paiement","Minimum order to display the payment method"
|
151 |
+
"Mot de passe","Password"
|
152 |
+
"Mot de passe du compte","Account password"
|
153 |
+
"Nombre de jours","Number of days"
|
154 |
+
"Notification de Be2bill . Type d\'opération : ""%s"" , la transaction ID: %s , execcode : ""%s"" , un message: ""%s"" .",
|
155 |
+
"Nouveau compte","New account"
|
156 |
+
"Nouveau débit avec le code %s et le message: %s .","Nex debit with code %s and message :%s"
|
157 |
+
"Numéro de carte de vérification visuelle de référence","Reference visual check card number"
|
158 |
+
"Options de paiement Be2bill","Be2bill Payment Options"
|
159 |
+
"Order in a click with Be2bill","Order in a click with Be2bill"
|
160 |
+
"Ordre de tri","Sort order"
|
161 |
+
"Paiement","Sale"
|
162 |
+
"Paiement à la livraison","Cash on delivery"
|
163 |
+
"Paiement Be2bill","Be2bill payment"
|
164 |
+
"Paiement différé","Deferred payment"
|
165 |
+
"Paiement échoué","3D secure authentification error."
|
166 |
+
"Paiement échoué","Bank networks failure."
|
167 |
+
"Paiement échoué","Exchange protocol failure."
|
168 |
+
"Paiement échoué","Exchange protocol failure."
|
169 |
+
"Paiement échoué","System under maintenance, please try again later."
|
170 |
+
"Paiement échoué","System under maintenance, please try again later."
|
171 |
+
"Paiement échoué","Timeout. The result will be sent to notification url."
|
172 |
+
"Paiement échoué","Timeout. The result will be sent to notification url."
|
173 |
+
"Paiement en 1 clic","1-click payment"
|
174 |
+
"Paiement n fois","Payment N times"
|
175 |
+
"Paiement récurrent","Reccuring payment"
|
176 |
+
"Paiement standard","Payment standard"
|
177 |
+
"Payer","Pay"
|
178 |
+
"Payer avec Be2bill","Pay with Be2bill"
|
179 |
+
"Payer directement avec une autre Carte Bancaire.","Not use record card data"
|
180 |
+
"Payer en %s fois votre commande d'un montant de %s","Pay in %s times your order with a total amount of %s"
|
181 |
+
"Payer en 3x","Pay in 3 times"
|
182 |
+
"Payer en X fois","Paying X times"
|
183 |
+
"Payer en un clic avec Be2bill","Order in a click with Be2bill"
|
184 |
+
"Payer par carte bancaire","Card Payment"
|
185 |
+
"Payer votre commande","Pay your order"
|
186 |
+
"Paypal","Paypal"
|
187 |
+
"Pays admis","Allowed countries"
|
188 |
+
"Pour confirmer votre paiement, veuillez saisir le CVV de votre carte","To confirm your payment, please enter the cvv of your card"
|
189 |
+
"Proposer le paiement en plusieurs fois en un clic pour le produit avec Be2bill","Is Product Available for Oneclick Several Payment with Be2bill"
|
190 |
+
"Qu'est-ce que c'est?","What is it?"
|
191 |
+
"Remplacer vos données de Carte Bancaire.","Record new card data"
|
192 |
+
"S'il vous plaît, attendez...","Please wait..."
|
193 |
+
"S\'il vous plait, <a href=""%s"">ajouter une adresse de %s </a>.","Please, <a href=""%s"">add an addresse %s </a>."
|
194 |
+
"S\'il vous plait, <a href=""%s"">ajouter une adresse</a>","Please, <a href=""%s"">add an addresse</a>."
|
195 |
+
"Saisie du cryptogramme","Entering the cryptogram"
|
196 |
+
"Sélectionner la devise","Select the currency"
|
197 |
+
"Sélectionnez une adresse :","Select an address from your address book:"
|
198 |
+
"Sélectionnez une méthode de livraison :","Select a shipping method:"
|
199 |
+
"Sélectionnez une méthode de livraison :","Select a shipping method:"
|
200 |
+
"Sélectionnez votre méthode d'expédition","Select your shipping method"
|
201 |
+
"Si vide, le label sera le texte de ""Type de compte"" sélectionné","If empty , the label will be the text ""Account type"" selected"
|
202 |
+
"Statut","Status"
|
203 |
+
"Suppression","Deleted"
|
204 |
+
"Taxes inclues","included taxes"
|
205 |
+
"Titre","Title"
|
206 |
+
"Tous les pays autorisés","All Allowed Countries"
|
207 |
+
"Toutes les transactions sont factices en mode test","Request are fake in mode test"
|
208 |
+
"Transaction annulée par le client.","Canceled by user."
|
209 |
+
"Transaction invalide","Invalid transaction."
|
210 |
+
"Transaction invalide","Invalid transaction."
|
211 |
+
"Transaction refusée par le marchand","Cardholder has already disputed a transaction."
|
212 |
+
"Transaction refusée par le marchand","Transaction declined by merchant."
|
213 |
+
"Transaction refusée par le marchand","Transaction declined by merchant's rules."
|
214 |
+
"Transaction refusée par le marchand","Transaction declined."
|
215 |
+
"Transaction refusée par votre banque","Card refused by the bank networks."
|
216 |
+
"Transaction refusée par votre banque","Duplicate request."
|
217 |
+
"Transaction refusée par votre banque","Fraud suspicion."
|
218 |
+
"Transaction refusée par votre banque","Invalid transaction."
|
219 |
+
"Transaction refusée par votre banque","The bank refused the transaction."
|
220 |
+
"Transaction refusée par votre banque","The card has been declared as lost."
|
221 |
+
"Transaction refusée par votre banque","The card has been declared as stolen."
|
222 |
+
"Transaction refusée par votre banque","The transaction has been abandoned."
|
223 |
+
"Transaction refusée par votre banque","Transaction not allowed by bank networks to the card holder."
|
224 |
+
"Transactions de serveur à serveur","Server to server transactions"
|
225 |
+
"Transfert commandes V1 vers V2","Transfert commandes V1 vers V2"
|
226 |
+
"Transfert des commandes de l\'Api V1 vers V2","Transfert des commandes de l\'Api V1 vers V2"
|
227 |
+
"Transfert réalisé","Transfert réalisé"
|
228 |
+
"Transfert","Transfert"
|
229 |
+
"Type de compte","Account type"
|
230 |
+
"Une erreur est survenue","An error has occurred"
|
231 |
+
"URL -> Xml (comptes dynamiques)","URL -> XML (dynamic accounts)"
|
232 |
+
"Url de haute disponibilité","Url for high disponibility"
|
233 |
+
"Url de test du formulaire de paiement ","Test Url payment form"
|
234 |
+
"Url de test du paiement direct","Direct Payment Test Url"
|
235 |
+
"URL de test du service 'serveur à serveur'","Main test URL of the service 'server to server'"
|
236 |
+
"URL de test secondaire du service 'serveur à serveur'","Secondary test URL of the service 'server to server'"
|
237 |
+
"Url du formulaire de paiement","Form transaction url"
|
238 |
+
"Url du paiement direct","Url direct payment"
|
239 |
+
"URL PRINCIPALE du service 'serveur à serveur'","Rest service url"
|
240 |
+
"URL SECONDAIRE du service 'serveur à serveur'","2nd Rest service url"
|
241 |
+
"Url vers l'xml d'import des données","Url to import the XML data"
|
242 |
+
"Utiliser ma carte pré-enregistrée.","Use my recorded card"
|
243 |
+
"Valeur en minutes. Mettre 0 pour désactiver l'option","Value in minutes. Set 0 to disable the option"
|
244 |
+
"Vérification de l\'age","Checking age"
|
245 |
+
"Version de l'XMl","Version of XMl"
|
246 |
+
"Version de l'Xml d'import des données","XML version of the import data"
|
247 |
+
"Veuillez réessayer ultérieurement.","Please retry later."
|
248 |
+
"Vos données bancaires sont expirées!","Your One click profil is expired!"
|
249 |
+
"Votre paiement en %s fois :","Your payment in %s times :"
|
250 |
+
"Vous allez être redirigé vers le serveur de paiement dans quelques secondes...","You will be redirected to Be2bill in a few seconds."
|
251 |
+
"Vous avec %s commande(s) à capturer","You have %s order(s) to capture"
|
252 |
+
"Si vide, pas de montant minimum","If empty , no minimum"
|
253 |
+
"Si vide, pas de montant maximum","If empty , no maximum"
|
254 |
+
"Xml déjà traité","Xml already imported"
|
255 |
+
"Séparer par une virgule / si vide pas de restriction","Separated by commas / if empty : no restriction"
|
256 |
+
"Codes Postaux autorisés","Codes Postaux autorisés"
|
257 |
+
"Activer le 3D secure uniquement pour les pays :","Enable 3D secure only for countries :"
|
258 |
+
"Réinitialiser l’image par défaut (fournie par Be2Bill)","Reset the default image (provided by Be2Bill)"
|
259 |
+
"Veuillez vérifier le choix de votre moyen de paiement","Please check your choice of payment method"
|
260 |
+
"Document Klarna","Klarna Document"
|
261 |
+
"Numéro fiscal de référence","Tax number"
|
262 |
+
"Numéro d'identification","Personal id number"
|
263 |
+
"Une erreur est survenue durant le téléchargement du logo. Veuillez réessayer ultérieurement","An error occurred while downloading the logo. Please retry later"
|
app/locale/fr_FR/Quadra_Be2bill.csv
ADDED
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"(Code Erreur %s) %s","(Code Erreur %s) %s"
|
2 |
+
"(Code retour : %s) %s","(Code retour : %s) %s"
|
3 |
+
"* Champs requis","* Champs requis"
|
4 |
+
"/!\ Test /!\","/!\ Test /!\"
|
5 |
+
"/!\ Test /!\ Transactions de serveur à serveur","/!\ Test /!\ Transactions de serveur à serveur"
|
6 |
+
"/!\ Test /!\ Url de haute disponibilité","/!\ Test /!\ Url de haute disponibilité"
|
7 |
+
"%d compte(s) activé(s)","%d compte(s) activé(s)"
|
8 |
+
"%d compte(s) désactivé(s)","%d compte(s) désactivé(s)"
|
9 |
+
"%d enregistrement(s) supprimé(s)","%d enregistrement(s) supprimé(s)"
|
10 |
+
"%s payé le %s","%s payé le %s"
|
11 |
+
"%s prélevés le %s","%s prélevés le %s"
|
12 |
+
"1 jour","1 jour"
|
13 |
+
"10 jours","10 jours"
|
14 |
+
"2 jours","2 jours"
|
15 |
+
"3 jours","3 jours"
|
16 |
+
"3D Secure","3D Secure"
|
17 |
+
"4 jours","4 jours"
|
18 |
+
"5 jours","5 jours"
|
19 |
+
"6 jours","6 jours"
|
20 |
+
"7 jours","7 jours"
|
21 |
+
"8 jours","8 jours"
|
22 |
+
"9 jours","9 jours"
|
23 |
+
"Action de paiement","Action de paiement"
|
24 |
+
"Activé","Activé"
|
25 |
+
"Activer","Activer"
|
26 |
+
"Activer 3D secure","Activer 3D secure"
|
27 |
+
"Activer le debug","Activer le debug"
|
28 |
+
"Activer le mode debug","Activer le mode debug"
|
29 |
+
"Activer le mode test","Activer le mode test"
|
30 |
+
"Activer le paiement récurrent","Activer le paiement récurrent"
|
31 |
+
"Activer oneclick","Activer oneclick"
|
32 |
+
"Amex","Amex"
|
33 |
+
"Annule les commandes dont la durée du statut 'En attente de capture be2bill' a atteint la limite.","Annule les commandes dont la durée du statut 'En attente de capture be2bill' a atteint la limite."
|
34 |
+
"Annule les commandes dont le statut est ""en attende"" depuis : ","Annule les commandes dont le statut est ""en attende"" depuis : "
|
35 |
+
"Annuler les commandes automatiquement","Annuler les commandes automatiquement"
|
36 |
+
"Annuler par le client","Annuler par le client"
|
37 |
+
"API Be2bill","API Be2bill"
|
38 |
+
"Aucun compte sélectionné","Aucun compte sélectionné"
|
39 |
+
"Authentification 3DSecure échouée","Authentification 3DSecure échouée"
|
40 |
+
"Authentification 3DSecure expirée","Authentification 3DSecure expirée"
|
41 |
+
"Autorisation","Autorisation"
|
42 |
+
"Be2bill","Be2bill"
|
43 |
+
"Be2bill : Configuration des comptes","Be2bill : Configuration des comptes"
|
44 |
+
"Configuration des comptes","Configuration des comptes"
|
45 |
+
"Configuration de l'API","Configuration de l'API"
|
46 |
+
"Be2bill Messages d erreur","Be2bill Messages d erreur"
|
47 |
+
"Carte actuelle : %s","Carte actuelle : %s"
|
48 |
+
"CB Visa","CB Visa"
|
49 |
+
"Certains pays","Certains pays"
|
50 |
+
"Choisir parmi...","Choisir parmi..."
|
51 |
+
"Choisir un autre mode de livraison","Choisir un autre mode de livraison"
|
52 |
+
"Client %d introuvable (récurrent) ","Client %d introuvable (récurrent) "
|
53 |
+
"Cliquer sur ""Commander"" validera automatiquement votre commande.","Cliquer sur ""Commander"" validera automatiquement votre commande."
|
54 |
+
"Commande annulée automatique par le cron car la commande est en 'attente' depuis %d minutes","Commande annulée automatique par le cron car la commande est en 'attente' depuis %d minutes"
|
55 |
+
"Commande annulée par la tâche de fond be2bill.","Commande annulée par la tâche de fond be2bill."
|
56 |
+
"Commande annulée par le cron be2bill","Commande annulée par le cron be2bill"
|
57 |
+
"Commande impossible à annuler par be2bill.","Commande impossible à annuler par be2bill."
|
58 |
+
"Commande introuvable (récurrent)","Commande introuvable (récurrent)"
|
59 |
+
"Commande introuvable!","Commande introuvable!"
|
60 |
+
"Commande réglée en 3x. Veuillez effectuer le remboursement des échéances via l'Extranet Be2bill","Commande réglée en 3x. Veuillez effectuer le remboursement des échéances via l'Extranet Be2bill"
|
61 |
+
"Commander","Commander"
|
62 |
+
"Commander en un clic avec Be2bill","Commander en un clic avec Be2bill"
|
63 |
+
"Commmande introuvable (récurrent)","Commmande introuvable (récurrent)"
|
64 |
+
"Configuration de l'API Be2Bill","Configuration de l'API Be2Bill"
|
65 |
+
"Configuration du compte","Configuration du compte"
|
66 |
+
"Configuration générale","Configuration générale"
|
67 |
+
"Créer un nouveau compte","Créer un nouveau compte"
|
68 |
+
"D'après votre commande, les articles suivants pourraient vous intéresser :","D'après votre commande, les articles suivants pourraient vous intéresser :"
|
69 |
+
"Date d'expiration : %s","Date d'expiration : %s"
|
70 |
+
"Défini l'ordre d'appartion de la méthode dans le tunnel de commande.","Défini l'ordre d'appartion de la méthode dans le tunnel de commande."
|
71 |
+
"Demande en double","Demande en double"
|
72 |
+
"Demander le cryptogramme lors d'un oneclick","Demander le cryptogramme lors d'un oneclick"
|
73 |
+
"Désactivé","Désactivé"
|
74 |
+
"Devise","Devise"
|
75 |
+
"Données de carte invalides","Données de carte invalides"
|
76 |
+
"Erreur Be2bill %s","Erreur Be2bill %s"
|
77 |
+
"Echec de l'import","Echec de l'import"
|
78 |
+
"Edition du compte","Edition du compte"
|
79 |
+
"En attende de la capture de la transaction '%s' et de montant %s","En attende de la capture de la transaction '%s' et de montant %s"
|
80 |
+
"En attente de capture Be2bill","En attente de capture Be2bill"
|
81 |
+
"En attente de la capture. Transaction '%s de %s","En attente de la capture. Transaction '%s de %s"
|
82 |
+
"Enregistrez vos données de carte bancaire pour un prochain achat.","Enregistrez vos données de carte bancaire pour un prochain achat."
|
83 |
+
"Entrez votre cryptogramme","Entrez votre cryptogramme"
|
84 |
+
"Erreur 4001","Erreur 4001"
|
85 |
+
"Erreur 4002","Erreur 4002"
|
86 |
+
"Erreur 4003","Erreur 4003"
|
87 |
+
"Erreur 4004","Erreur 4004"
|
88 |
+
"Erreur 4005","Erreur 4005"
|
89 |
+
"Erreur 4006","Erreur 4006"
|
90 |
+
"Erreur 4007","Erreur 4007"
|
91 |
+
"Erreur 4008","Erreur 4008"
|
92 |
+
"Erreur 4009","Erreur 4009"
|
93 |
+
"Erreur 4010","Erreur 4010"
|
94 |
+
"Erreur 4011","Erreur 4011"
|
95 |
+
"Erreur 4012","Erreur 4012"
|
96 |
+
"Erreur 4013","Erreur 4013"
|
97 |
+
"Erreur 5001","Erreur 5001"
|
98 |
+
"Erreur 5002","Erreur 5002"
|
99 |
+
"Erreur 5003","Erreur 5003"
|
100 |
+
"Erreur 5004","Erreur 5004"
|
101 |
+
"Erreur 5005","Erreur 5005"
|
102 |
+
"Erreur 6001","Erreur 6001"
|
103 |
+
"Erreur 6002","Erreur 6002"
|
104 |
+
"Erreur 6003","Erreur 6003"
|
105 |
+
"Erreur 6004","Erreur 6004"
|
106 |
+
"Erreur lors du traitement du paiement. Code %s ==> %s.","Erreur lors du traitement du paiement. Code %s ==> %s."
|
107 |
+
"Êtes-vous sûr ?","Êtes-vous sûr ?"
|
108 |
+
"Facture #%s créée","Facture #%s créée"
|
109 |
+
"Fonds insuffisants ou plafond de paiement atteint","Fonds insuffisants ou plafond de paiement atteint"
|
110 |
+
"Gestion des comptes","Gestion des comptes"
|
111 |
+
"Id du compte","Id du compte"
|
112 |
+
"Identifiant","Identifiant"
|
113 |
+
"Identifier","Identifier"
|
114 |
+
"Identifiant du compte","Identifiant du compte"
|
115 |
+
"Il y a des commandes en attente de capture be2bill depuis au moins %s jour(s)","Il y a des commandes en attente de capture be2bill depuis au moins %s jour(s)"
|
116 |
+
"Import des paiements dynamiques","Import des paiements dynamiques"
|
117 |
+
"Import réalisé avec succès","Import réalisé avec succès"
|
118 |
+
"Impossible de se connecter aux serveurs be2bill","Impossible de se connecter aux serveurs be2bill"
|
119 |
+
"Impossible de se connecter aux serveurs de Be2bill","Impossible de se connecter aux serveurs de Be2bill"
|
120 |
+
"Impossible de se connecter aux serveurs de Be2bill","Impossible de se connecter aux serveurs de Be2bill"
|
121 |
+
"INTERDIT!","INTERDIT!"
|
122 |
+
"Label front office","Label front office"
|
123 |
+
"L'annulation de la commande par le cron Be2bill a échoué","L'annulation de la commande par le cron Be2bill a échoué"
|
124 |
+
"La date de validité de votre carte Bleue ne permet pas d’effectuer un paiement en plusieurs fois, nous vous invitons à changer de Carte Bleue ou bien à vous diriger vers le paiement en une fois.","La date de validité de votre carte Bleue ne permet pas d’effectuer un paiement en plusieurs fois, nous vous invitons à changer de Carte Bleue ou bien à vous diriger vers le paiement en une fois."
|
125 |
+
"La methode Be2bill paiement doit être activée pour utiliser la méthode de paiement en plusieurs fois.","La methode Be2bill paiement doit être activée pour utiliser la méthode de paiement en plusieurs fois."
|
126 |
+
"Label visible sur le front office","Label visible sur le front office"
|
127 |
+
"Le client à été notifié de la facture #%s.","Le client à été notifié de la facture #%s."
|
128 |
+
"Le client doit saisir son cryptogramme à chaque paiement.","Le client doit saisir son cryptogramme à chaque paiement."
|
129 |
+
"Le compte a bien été supprimé","Le compte a bien été supprimé"
|
130 |
+
"Le montant total sera affiché avant que vous envoyer la commande","Le montant total sera affiché avant que vous envoyer la commande"
|
131 |
+
"Le produit n'a pas pu être trouvé","Le produit n'a pas pu être trouvé"
|
132 |
+
"Le produit n'existe pas","Le produit n'existe pas"
|
133 |
+
"Livraison standard","Livraison standard"
|
134 |
+
"Libellé","Libellé"
|
135 |
+
"Log les requêtes et les réponses du serveur dans le fichier 'var/log/payment_be2bill_standard.log'","Log les requêtes et les réponses du serveur dans le fichier 'var/log/payment_be2bill_standard.log'"
|
136 |
+
"Logo","Logo"
|
137 |
+
"Magasin","Magasin"
|
138 |
+
"Magento Connector Version: v%s","Version du connecteur Magento : v%s"
|
139 |
+
"Mauvaise IP : ","Mauvaise IP : "
|
140 |
+
"Maximum de commande","Maximum de commande"
|
141 |
+
"Merci de votre compréhension.","Merci de votre compréhension."
|
142 |
+
"Minimum de commande","Minimum de commande"
|
143 |
+
"Mode","Mode"
|
144 |
+
"Mode de paiement autorisé pour","Mode de paiement autorisé pour"
|
145 |
+
"Mode de paiement autorisé pour les pays spécifiques","Mode de paiement autorisé pour les pays spécifiques"
|
146 |
+
"Mode Debug","Mode Debug"
|
147 |
+
"Mode Test","Mode Test"
|
148 |
+
"Montant maximum de la commande","Montant maximum de la commande"
|
149 |
+
"Montant maximum de la commande pour afficher la méthode de paiement","Montant maximum de la commande pour afficher la méthode de paiement"
|
150 |
+
"Montant minimum de la commande","Montant minimum de la commande"
|
151 |
+
"Montant minimum de la commande pour afficher la méthode de paiement","Montant minimum de la commande pour afficher la méthode de paiement"
|
152 |
+
"Mot de passe","Mot de passe"
|
153 |
+
"Mot de passe du compte","Mot de passe du compte"
|
154 |
+
"Nombre de jours","Nombre de jours"
|
155 |
+
"Notification de Be2bill . Type d\'opération : ""%s"" , la transaction ID: %s , execcode : ""%s"" , un message: ""%s"" .","Notification de Be2bill . Type d\'opération : ""%s"" , la transaction ID: %s , execcode : ""%s"" , un message: ""%s"" ."
|
156 |
+
"Nouveau compte","Nouveau compte"
|
157 |
+
"Nouveau débit avec le code %s et le message: %s .","Nouveau débit avec le code %s et le message: %s ."
|
158 |
+
"Numéro de carte de vérification visuelle de référence","Numéro de carte de vérification visuelle de référence"
|
159 |
+
"Options de paiement Be2bill","Options de paiement Be2bill"
|
160 |
+
"Order in a click with Be2bill","Order in a click with Be2bill"
|
161 |
+
"Ordre de tri","Ordre de tri"
|
162 |
+
"Paiement","Paiement"
|
163 |
+
"Paiement à la livraison","Paiement à la livraison"
|
164 |
+
"Paiement Be2bill","Paiement Be2bill"
|
165 |
+
"Paiement différé","Paiement différé"
|
166 |
+
"Paiement échoué","Paiement échoué"
|
167 |
+
"Paiement échoué","Paiement échoué"
|
168 |
+
"Paiement échoué","Paiement échoué"
|
169 |
+
"Paiement échoué","Paiement échoué"
|
170 |
+
"Paiement échoué","Paiement échoué"
|
171 |
+
"Paiement échoué","Paiement échoué"
|
172 |
+
"Paiement échoué","Paiement échoué"
|
173 |
+
"Paiement échoué","Paiement échoué"
|
174 |
+
"Paiement en 1 clic","Paiement en 1 clic"
|
175 |
+
"Paiement n fois","Paiement n fois"
|
176 |
+
"Paiement récurrent","Paiement récurrent"
|
177 |
+
"Paiement standard","Paiement standard"
|
178 |
+
"Payer","Payer"
|
179 |
+
"Payer avec Be2bill","Payer avec Be2bill"
|
180 |
+
"Payer directement avec une autre Carte Bancaire.","Payer directement avec une autre Carte Bancaire."
|
181 |
+
"Payer en %s fois votre commande d'un montant de %s","Payer en %s fois votre commande d'un montant de %s"
|
182 |
+
"Payer en 3x","Payer en 3x"
|
183 |
+
"Payer en X fois","Payer en X fois"
|
184 |
+
"Payer en un clic avec Be2bill","Payer en un clic avec Be2bill"
|
185 |
+
"Payer par carte bancaire","Payer par carte bancaire"
|
186 |
+
"Payer votre commande","Payer votre commande"
|
187 |
+
"Paypal","Paypal"
|
188 |
+
"Pays admis","Pays admis"
|
189 |
+
"Pour confirmer votre paiement, veuillez saisir le CVV de votre carte","Pour confirmer votre paiement, veuillez saisir le CVV de votre carte"
|
190 |
+
"Proposer le paiement en plusieurs fois en un clic pour le produit avec Be2bill","Proposer le paiement en plusieurs fois en un clic pour le produit avec Be2bill"
|
191 |
+
"Qu'est-ce que c'est?","Qu'est-ce que c'est?"
|
192 |
+
"Remplacer vos données de Carte Bancaire.","Remplacer vos données de Carte Bancaire."
|
193 |
+
"S'il vous plaît, attendez...","S'il vous plaît, attendez..."
|
194 |
+
"S\'il vous plait, <a href=""%s"">ajouter une adresse de %s </a>.","S\'il vous plait, <a href=""%s"">ajouter une adresse de %s </a>."
|
195 |
+
"S\'il vous plait, <a href=""%s"">ajouter une adresse</a>","S\'il vous plait, <a href=""%s"">ajouter une adresse</a>"
|
196 |
+
"Saisie du cryptogramme","Saisie du cryptogramme"
|
197 |
+
"Sélectionner la devise","Sélectionner la devise"
|
198 |
+
"Sélectionnez une adresse :","Sélectionnez une adresse :"
|
199 |
+
"Sélectionnez une méthode de livraison :","Sélectionnez une méthode de livraison :"
|
200 |
+
"Sélectionnez une méthode de livraison :","Sélectionnez une méthode de livraison :"
|
201 |
+
"Sélectionnez votre méthode d'expédition","Sélectionnez votre méthode d'expédition"
|
202 |
+
"Si vide, le label sera le texte de ""Type de compte"" sélectionné","Si vide, le label sera le texte de ""Type de compte"" sélectionné"
|
203 |
+
"Statut","Statut"
|
204 |
+
"Suppression","Suppression"
|
205 |
+
"Taxes inclues","Taxes inclues"
|
206 |
+
"Titre","Titre"
|
207 |
+
"Tous les pays autorisés","Tous les pays autorisés"
|
208 |
+
"Toutes les transactions sont factices en mode test","Toutes les transactions sont factices en mode test"
|
209 |
+
"Transaction annulée par le client.","Transaction annulée par le client."
|
210 |
+
"Transaction invalide","Transaction invalide"
|
211 |
+
"Transaction invalide","Transaction invalide"
|
212 |
+
"Transaction refusée par le marchand","Transaction refusée par le marchand"
|
213 |
+
"Transaction refusée par le marchand","Transaction refusée par le marchand"
|
214 |
+
"Transaction refusée par le marchand","Transaction refusée par le marchand"
|
215 |
+
"Transaction refusée par le marchand","Transaction refusée par le marchand"
|
216 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
217 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
218 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
219 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
220 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
221 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
222 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
223 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
224 |
+
"Transaction refusée par votre banque","Transaction refusée par votre banque"
|
225 |
+
"Transactions de serveur à serveur","Transactions de serveur à serveur"
|
226 |
+
"Transfert commandes V1 vers V2","Transfert commandes V1 vers V2"
|
227 |
+
"Transfert des commandes de l\'Api V1 vers V2","Transfert des commandes de l\'Api V1 vers V2"
|
228 |
+
"Transfert réalisé","Transfert réalisé"
|
229 |
+
"Transfert","Transfert"
|
230 |
+
"Type de compte","Type de compte"
|
231 |
+
"Une erreur est survenue","Une erreur est survenue"
|
232 |
+
"URL -> Xml (comptes dynamiques)","URL -> Xml (comptes dynamiques)"
|
233 |
+
"Url de haute disponibilité","Url de haute disponibilité"
|
234 |
+
"Url de test du formulaire de paiement ","Url de test du formulaire de paiement "
|
235 |
+
"Url de test du paiement direct","Url de test du paiement direct"
|
236 |
+
"URL de test du service 'serveur à serveur'","URL de test principale du service 'serveur à serveur'"
|
237 |
+
"URL de test secondaire du service 'serveur à serveur'","URL de test secondaire du service 'serveur à serveur'"
|
238 |
+
"Url du formulaire de paiement","Url du formulaire de paiement"
|
239 |
+
"Url du paiement direct","Url du paiement direct"
|
240 |
+
"URL PRINCIPALE du service 'serveur à serveur'","URL PRINCIPALE du service 'serveur à serveur'"
|
241 |
+
"URL SECONDAIRE du service 'serveur à serveur'","URL SECONDAIRE du service 'serveur à serveur'"
|
242 |
+
"Url vers l'xml d'import des données","Url vers l'xml d'import des données"
|
243 |
+
"Utiliser ma carte pré-enregistrée.","Utiliser ma carte pré-enregistrée."
|
244 |
+
"Valeur en minutes. Mettre 0 pour désactiver l'option","Valeur en minutes. Mettre 0 pour désactiver l'option"
|
245 |
+
"Vérification de l\'age","Vérification de l\'age"
|
246 |
+
"Version de l'XMl","Version de l'XMl"
|
247 |
+
"Version de l'Xml d'import des données","Version de l'Xml d'import des données"
|
248 |
+
"Veuillez réessayer ultérieurement.","Veuillez réessayer ultérieurement."
|
249 |
+
"Vos données bancaires sont expirées!","Vos données bancaires sont expirées!"
|
250 |
+
"Votre paiement en %s fois :","Votre paiement en %s fois :"
|
251 |
+
"Vous allez être redirigé vers le serveur de paiement dans quelques secondes...","Vous allez être redirigé vers le serveur de paiement dans quelques secondes..."
|
252 |
+
"Vous avec %s commande(s) à capturer","Vous avec %s commande(s) à capturer"
|
253 |
+
"Si vide, pas de montant minimum","Si vide, pas de montant minimum"
|
254 |
+
"Si vide, pas de montant maximum","Si vide, pas de montant maximum"
|
255 |
+
"Xml déjà traité","Xml déjà traité"
|
256 |
+
"Séparer par une virgule / si vide pas de restriction","Séparer par une virgule / si vide pas de restriction"
|
257 |
+
"Codes Postaux autorisés","Postcode 3D Secure"
|
258 |
+
"Activer le 3D secure uniquement pour les pays :","Activer le 3D secure uniquement pour les pays :"
|
259 |
+
"Réinitialiser l’image par défaut (fournie par Be2Bill)","Réinitialiser l’image par défaut (fournie par Be2Bill)"
|
260 |
+
"Veuillez vérifier le choix de votre moyen de paiement","Veuillez vérifier le choix de votre moyen de paiement"
|
261 |
+
"Document Klarna","Document Klarna"
|
262 |
+
"Numéro fiscal de référence","Numéro fiscal de référence"
|
263 |
+
"Numéro d'identification","Numéro d'identification"
|
264 |
+
"Une erreur est survenue durant le téléchargement du logo. Veuillez réessayer ultérieurement","Une erreur est survenue durant le téléchargement du logo. Veuillez réessayer ultérieurement"
|
package.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Quadra_Be2bill</name>
|
4 |
+
<version>5.0.7</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Be2bill is the online solution for payment by cards. Dedicated to the e-merchants, it helps them improve their churn rate and fight fraud.
|
10 |
+
Be2bill, your banker thinks Web!</summary>
|
11 |
+
<description>Be2bill is the online solution for payment by cards. Dedicated to the e-merchants, it helps them improve their churn rate and fight fraud.
|
12 |
+
Be2bill, your banker thinks Web!
|
13 |
+

|
14 |
+
Quadra Informatique & Be2Bill partnership allow you to have the best of Be2Bill, already integrated in Magento
|
15 |
+

|
16 |
+
- Immediate payment
|
17 |
+
- Authorization payment
|
18 |
+
- Payment in X times
|
19 |
+
- Oneclick payment</description>
|
20 |
+
<notes>Magento CE 1.9.x.x compatibility only.</notes>
|
21 |
+
<authors><author><name>Quadra Informatique</name><user>quadrainfo</user><email>modules@quadra-informatique.fr</email></author></authors>
|
22 |
+
<date>2016-05-31</date>
|
23 |
+
<time>09:14:03</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Quadra"><dir name="Be2bill"><dir name="Block"><dir name="Adminhtml"><dir name="Field"><dir name="Version"><file name="Renderer.php" hash="d6806581752cd841781909b5b8eefda7"/></dir></dir><dir name="Merchandaccount"><dir name="Edit"><file name="Form.php" hash="4393d29e731afd890b09a7f1dfe89970"/></dir><file name="Edit.php" hash="3acdf4472c1413089e93f65ace8bbbc1"/><dir name="Grid"><dir name="Renderer"><file name="Mode.php" hash="6bdfb1d41d3825e80d811ceff2ce96e7"/></dir></dir><file name="Grid.php" hash="440e4384542ae42c2430643ebeee518b"/></dir><file name="Merchandaccount.php" hash="80854db64da07e00083eb872726c5cd3"/><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Transactions.php" hash="62d7a7f986c1dae410305b763c796457"/></dir></dir></dir><dir name="Transactions"><file name="Grid.php" hash="5c84ac43a3e652d434be9116191655df"/><dir name="Renderer"><file name="Txnamount.php" hash="93416ab290d489af95509a0a80bc287f"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="34314f84d545f975cf7b1d9ae2e23093"/></dir></dir></dir><dir name="Transfert"><dir name="Edit"><file name="Form.php" hash="5bff19261a0512fee160244289875020"/></dir><file name="Edit.php" hash="1d4ab91f1f1e9337ac8b4dd197b0dd49"/></dir></dir><dir name="Checkout"><dir name="Oneclick"><file name="Info.php" hash="5b524c8f4852423f20c281a483329409"/><file name="Product.php" hash="379a477c87f310b6dbcf052f2f131444"/></dir><dir name="Review"><file name="Info.php" hash="2d654578206b0241e8d120ef95790307"/></dir></dir><dir name="Form"><file name="PaymentMethods.php" hash="9fd7f97e4ababdbc041c9d9dfe7d0a44"/></dir><dir name="Info"><file name="PaymentMethods.php" hash="05063a4fc4a4152bd29e107a599f68ce"/></dir><dir name="Method"><file name="Iframe.php" hash="a00b5504afc3d7c978b2417a5a1a98b8"/><file name="Redirect.php" hash="ca40b0c2218e6f60c4081e6b0c8175e9"/></dir></dir><dir name="Controller"><file name="Action.php" hash="bd9be35d7e2fd7fae9f0c6c24a8df89b"/></dir><dir name="Helper"><file name="Data.php" hash="ac05567a9f31395397f1416d11841fa5"/><file name="Ip.php" hash="40e913de07427a562118c2b983ef473e"/><file name="Mirakl.php" hash="e321c13bcac59d4327cd30df61b334f5"/></dir><dir name="Model"><file name="Alias.php" hash="b998426d69fb59552b79ad1d5dd2a75d"/><dir name="Api"><dir name="Http"><dir name="Client"><dir name="Adapter"><file name="Curl.php" hash="bf23ceefe3b2f89a2b233998c2571f4b"/><file name="Stream.php" hash="2565d527829764e2b01ee9d2a56caf5c"/></dir></dir></dir><file name="Methods.php" hash="04f756427eab59cdac69b6031fc13c59"/><file name="Response.php" hash="215406e364c60084b1fba04e48804c6f"/><file name="Service.php" hash="2a2f628c5bfd0edeafc893413db3a5af"/><file name="Xml.php" hash="b77ff0ff52ffd6268f29a35867e2d52e"/></dir><file name="Customer.php" hash="2c994cf8a6e705394ba454ed59bb2dea"/><dir name="Log"><file name="Adapter.php" hash="f5c26a4ef3fdc5733ddb80f3ca6ec8b2"/></dir><file name="Merchandconfigurationaccount.php" hash="3492f2693ca80840fad823ab7d13baa8"/><file name="Merchandconfigurationaccountcountries.php" hash="c673a871e4ad517bd6cdccbe9c1fc48d"/><file name="Merchandconfigurationaccountoptions.php" hash="b4e12d0aa864b08170de0c712df07358"/><dir name="Method"><file name="Abstract.php" hash="c7e2f4f38b1004d0fb3fe5fd51657e93"/><file name="PaymentMethods.php" hash="fd883be2465a060ad44a6060d6fbdc20"/><file name="Session.php" hash="05803f6276868f395a8c7b3e7f6cb0b5"/></dir><file name="Observer.php" hash="eda5e0118cecd2f4eed7d1af6babe46b"/><dir name="Renderer"><file name="Defered.php" hash="d3dbcc26d1455469ff96c881e305eba4"/><file name="Ntimes.php" hash="7a006884b71a5211a99e53f2c8a779d1"/></dir><dir name="Resource"><dir name="Alias"><file name="Collection.php" hash="eed5945ee3433e90d3e2a725796e0d74"/></dir><file name="Alias.php" hash="03f6403665a2b52bbb149507b8f267a7"/><dir name="Merchandconfigurationaccount"><file name="Collection.php" hash="f76f932557f3bf9a205233b687b0c79e"/></dir><file name="Merchandconfigurationaccount.php" hash="8327a260c0d631cc2b7f1de2e4f1f5b1"/><dir name="Merchandconfigurationaccountcountries"><file name="Collection.php" hash="895212c62f8a86a314b4ba87eb70321d"/></dir><file name="Merchandconfigurationaccountcountries.php" hash="e5b8994f649511b5719f19bef67fc528"/><dir name="Merchandconfigurationaccountoptions"><file name="Collection.php" hash="9afafd54a9d7b8101959da07d6ee4533"/></dir><file name="Merchandconfigurationaccountoptions.php" hash="d5058a582ca871eab176bcc25a7141f5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MerchandaccountController.php" hash="04054a6353b853198c63b40fae4f4b10"/><file name="TransfertController.php" hash="8a644f67604571c5a508b37ff944cc9f"/></dir><dir name="Checkout"><file name="OneclickController.php" hash="57eb4d340cdab73ac65b53ff3316e61f"/></dir><file name="PaymentsController.php" hash="4bab98587ff878a3911ec2245bbeb5cc"/><file name="TemplateController.php" hash="040f86ded260a69bca30d6c8aeae6696"/></dir><dir name="etc"><file name="adminhtml.xml" hash="83186c52f2698622bb30757ee64bd7e6"/><file name="config.xml" hash="3a8ec05626e764b03f21a6c6855ed9b7"/><file name="system.xml" hash="9c55e763163e518c1d1fdc5c04b1fc2b"/></dir><dir name="sql"><dir name="be2bill_setup"><file name="mysql4-install-4.0.0.php" hash="ce8e3c7ab00c6f376aa882489e839379"/><file name="mysql4-upgrade-4.0.0-4.1.0.php" hash="d0b6c00d951f4f17025f340e2217a688"/><file name="mysql4-upgrade-4.1.0-4.1.1.php" hash="0ffaa3bc8d8e42b30597b0053701aa38"/><file name="mysql4-upgrade-4.1.2-4.1.3.php" hash="7cbed12a4b621a0db879897b687ce56d"/><file name="mysql4-upgrade-4.1.3-4.1.4.php" hash="1a35b96ebcefc930895e8e18796ff6d9"/><file name="mysql4-upgrade-4.1.4-4.1.5.php" hash="a833dd5cf1b031b2d0634f294fd6c5da"/><file name="mysql4-upgrade-4.1.7-4.1.8.php" hash="76a15d08c165ff9f07cab5a8a0cc547d"/><file name="mysql4-upgrade-4.2.6-4.2.7.php" hash="c93f8597208f429a81c87363d168374f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Quadra_Be2bill.xml" hash="3b469f5d48a580b38268e589f8021a96"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="be2bill.xml" hash="9030e11cbe191392d6f9954c37d22619"/></dir><dir name="template"><dir name="be2bill"><dir name="info"><file name="payment_methods.phtml" hash="02b38247230b91e63c575a0bcff0da60"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="e74579c998eda46028fbb2d922d41fa5"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="layout"><file name="be2bill.xml" hash="937c4f3113ca56bf3381fa0fcbc67c85"/></dir><dir name="template"><dir name="be2bill"><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="9dd14d560db9516bd30fca4edf863f3f"/></dir><file name="totals.phtml" hash="2477e01ce8281434566728ca87dee074"/></dir><file name="iframe.phtml" hash="ebe163b44604182b63ee69d188adfcb0"/><dir name="oneclick"><dir name="info"><file name="review.phtml" hash="22aecd24ce61a79afb93cb97cd5276fe"/></dir><file name="info.phtml" hash="56dbcacdf98f3f764dad34c45be75b1d"/><file name="product.phtml" hash="fdf0f1c828b35dbd45a3f8fbc40d886e"/></dir><dir name="onepage"><dir name="payment"><file name="additional.phtml" hash="97d2770f9f288e265419d25758f4dad8"/></dir></dir><dir name="review"><file name="button.phtml" hash="645b1f3b984481581c3c829b5b0b97a9"/><file name="info.phtml" hash="955e81f66805572ffe8ed9014d3510fc"/></dir></dir><dir name="form"><file name="payment_methods.phtml" hash="275a80a4e722b544359416a6e5bf7bdd"/></dir><dir name="info"><file name="payment_methods.phtml" hash="27a1b6bfb2c80197b7c1ca5abd1fdc04"/></dir><dir name="model"><file name="failure.phtml" hash="942e6a1897825ce944f686085a7d442b"/><file name="success.phtml" hash="797a5a3a9f61f2b152e260a91aeef53c"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Quadra_Be2bill.csv" hash="694f1371602832959b6cd2407a8d8369"/></dir><dir name="fr_FR"><file name="Quadra_Be2bill.csv" hash="52fa42afcc8dd1b4e82e4108673eb0cf"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="be2bill"><dir name="js"><file name="be2bill.js" hash="ea7ac4db6e8bbe6c89130502ff0d2725"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="css"><dir name="be2bill"><file name="checkout-onepage-payment.css" hash="cd3677bafdc41091558c13290a25646f"/><file name="checkout-success-crossell.css" hash="4aaa1ebd110fd253317431d74f33f9f2"/><file name="product.css" hash="08a30c6499a1743cd23e6bb5f6cdc19e"/></dir></dir></dir></dir></dir></target></contents>
|
25 |
+
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
+
</package>
|
skin/adminhtml/default/default/be2bill/js/be2bill.js
ADDED
@@ -0,0 +1,384 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var Be2bill = Class.create();
|
2 |
+
Be2bill.prototype = {
|
3 |
+
/**
|
4 |
+
* Init Class
|
5 |
+
*/
|
6 |
+
initialize: function () {
|
7 |
+
|
8 |
+
this.elements = {
|
9 |
+
currency: $('currency'),
|
10 |
+
account_type: $('account_type'),
|
11 |
+
mode: $('mode'),
|
12 |
+
allowed_countries: $('allowspecific_countries_code'),
|
13 |
+
logo_url: $('logo_url'),
|
14 |
+
logo_image: $('logo_image'),
|
15 |
+
name: $('name'),
|
16 |
+
allowspecific: $('allowspecific'),
|
17 |
+
secure_allowspecific: $('secure_allowspecific'),
|
18 |
+
secure_active: $('secure_active'),
|
19 |
+
secure: $('3dsecure'),
|
20 |
+
delivery: $('delivery'),
|
21 |
+
};
|
22 |
+
|
23 |
+
this.urls = {
|
24 |
+
currency: $('urlLoadAccountsType').value,
|
25 |
+
account_type: $('urlLoadModes').value,
|
26 |
+
options: $('urlLoadOptions').value,
|
27 |
+
countries: $('urlLoadCountries').value,
|
28 |
+
logo: $('urlLoadLogo').value
|
29 |
+
};
|
30 |
+
|
31 |
+
this.steps = {
|
32 |
+
currency: 'account_type',
|
33 |
+
account_type: 'mode'
|
34 |
+
};
|
35 |
+
|
36 |
+
this.options = [
|
37 |
+
$('standard'),
|
38 |
+
$('defered'),
|
39 |
+
$('delivery'),
|
40 |
+
$('ntimes'),
|
41 |
+
$('3dsecure'),
|
42 |
+
$('oneclick'),
|
43 |
+
$('recurring'),
|
44 |
+
$('ageverification')
|
45 |
+
];
|
46 |
+
|
47 |
+
//change le texte de la suppresion du logo
|
48 |
+
if($$('label[for="logo_delete"]')[0])
|
49 |
+
$$('label[for="logo_delete"]')[0].innerHTML = $('del_img').value;
|
50 |
+
|
51 |
+
|
52 |
+
this.opts = $('options').value;
|
53 |
+
this.accountId = $('id').value;
|
54 |
+
|
55 |
+
this.updateSelect = this.updateSelect.bindAsEventListener(this);
|
56 |
+
this.ajaxFailure = this.ajaxFailure.bindAsEventListener(this);
|
57 |
+
this.displayOptions = this.displayOptions.bindAsEventListener(this);
|
58 |
+
this.displayCountries = this.displayCountries.bindAsEventListener(this);
|
59 |
+
this.displayLogo = this.displayLogo.bindAsEventListener(this);
|
60 |
+
|
61 |
+
//Ajout des observeurs
|
62 |
+
Event.observe(this.elements.currency, 'change', this.loadOptionsSelect.bind(this));
|
63 |
+
Event.observe(this.elements.account_type, 'change', this.loadOptionsSelect.bind(this));
|
64 |
+
Event.observe(this.elements.allowspecific, 'change', this.allowSpecificCountry.bind(this));
|
65 |
+
Event.observe(this.elements.secure_allowspecific, 'change', this.allowSpecificCountry.bind(this));
|
66 |
+
Event.observe(this.elements.secure_active, 'change', this.showHideOptions.bind(this));
|
67 |
+
|
68 |
+
if($('mirakl_status'))
|
69 |
+
Event.observe($('mirakl_status'), 'change', this.showHideSlaveConf.bind(this));
|
70 |
+
|
71 |
+
if($('delivery_active'))
|
72 |
+
Event.observe($('delivery_active'), 'change', this.showHideSlaveConf.bind(this));
|
73 |
+
|
74 |
+
//Désactive et cache les groupes d'options
|
75 |
+
this._disabledAllOptions();
|
76 |
+
|
77 |
+
//cache tout les options du select avec les pays
|
78 |
+
this.elements.allowed_countries.select('option').invoke('hide');
|
79 |
+
|
80 |
+
if (this.accountId == 0) {
|
81 |
+
//Désactive les deux select vide
|
82 |
+
this._disableEnableAll(this.elements.account_type, true);
|
83 |
+
this._disableEnableAll(this.elements.mode, true);
|
84 |
+
} else {
|
85 |
+
|
86 |
+
//affichage des groupes d'options
|
87 |
+
this.opts.split(',').each(function (element) {
|
88 |
+
if ($(element)) {
|
89 |
+
this._hideShowGroup($(element), false);
|
90 |
+
}
|
91 |
+
}.bind(this));
|
92 |
+
|
93 |
+
|
94 |
+
this.loadCountries(this.elements.account_type.value);
|
95 |
+
|
96 |
+
// 3D secure
|
97 |
+
if (this.elements.secure_active.value == 0 || this.elements.secure_active.value == 2) {
|
98 |
+
this.elements.secure.select('table tr:nth(3),table tr:nth(4),table tr:nth(5),table tr:nth(6)').invoke('hide');
|
99 |
+
} else {
|
100 |
+
this.elements.secure.select('table tr:nth(3),table tr:nth(4),table tr:nth(5),table tr:nth(6)').invoke('show');
|
101 |
+
}
|
102 |
+
|
103 |
+
this.showHideSlaveConf();
|
104 |
+
}
|
105 |
+
},
|
106 |
+
disabledForm: function (event) {
|
107 |
+
var elmt = $(Event.element(event));
|
108 |
+
var div = elmt.up('div.fieldset');
|
109 |
+
if (elmt.value == '0') {
|
110 |
+
this._disableEnableAll(div, true, elmt.id);
|
111 |
+
} else {
|
112 |
+
this._disableEnableAll(div, false, elmt.id);
|
113 |
+
}
|
114 |
+
|
115 |
+
},
|
116 |
+
allowSpecificCountry: function (event) {
|
117 |
+
var elmt = $(Event.element(event));
|
118 |
+
if (elmt.value == 0) { //Tous les pays autorisés
|
119 |
+
$(elmt.id + '_countries_code').disabled = true;
|
120 |
+
} else { //Certains pays
|
121 |
+
$(elmt.id + '_countries_code').disabled = false;
|
122 |
+
}
|
123 |
+
},
|
124 |
+
/**
|
125 |
+
* 3D secure choix full ou selective
|
126 |
+
*/
|
127 |
+
showHideOptions: function (event) {
|
128 |
+
var elmt = $(Event.element(event));
|
129 |
+
if (elmt.value == 0 || elmt.value == 2) {
|
130 |
+
$('3dsecure').select('table tr:nth(3),table tr:nth(4),table tr:nth(5),table tr:nth(6)').invoke('hide');
|
131 |
+
} else {
|
132 |
+
$('3dsecure').select('table tr:nth(3),table tr:nth(4),table tr:nth(5),table tr:nth(6)').invoke('show');
|
133 |
+
}
|
134 |
+
},
|
135 |
+
/**
|
136 |
+
* Afficher / Masquer les id slave pour Mirakl
|
137 |
+
*/
|
138 |
+
showHideSlaveConf: function (event) {
|
139 |
+
// Options Mirakl
|
140 |
+
var bIsMPAvailable = false;
|
141 |
+
if($('mkp_code_list')){
|
142 |
+
var aMkpCodeList = $('mkp_code_list').value.split(',');
|
143 |
+
for (var i = 0, len = aMkpCodeList.length; i < len; i++) {
|
144 |
+
if(aMkpCodeList[i] == this.elements.account_type.value){
|
145 |
+
bIsMPAvailable = true;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
// si Mirakl dispo pour ce MP
|
152 |
+
if (bIsMPAvailable){
|
153 |
+
// si operateur uniquement, je desactive les champs mirakl
|
154 |
+
if ($('delivery_active').value ==0 || $('mirakl_status').value == 'op_only') {
|
155 |
+
$('delivery').select('table tr:nth(5),table tr:nth(6)').invoke('hide');
|
156 |
+
$('mirakl_status').removeClassName('required-entry');
|
157 |
+
|
158 |
+
$('delivery').select('table tr:nth(4)').invoke('show');
|
159 |
+
$('mkp_login').removeClassName('required-entry');
|
160 |
+
$('mkp_password').removeClassName('required-entry');
|
161 |
+
}
|
162 |
+
// sinon actif et obligatoire
|
163 |
+
else {
|
164 |
+
$('delivery').select('table tr:nth(4),table tr:nth(5),table tr:nth(6)').invoke('show');
|
165 |
+
$('mirakl_status').addClassName('required-entry');
|
166 |
+
$('mkp_login').addClassName('required-entry');
|
167 |
+
$('mkp_password').addClassName('required-entry');
|
168 |
+
}
|
169 |
+
}
|
170 |
+
else {
|
171 |
+
$('delivery').select('table tr:nth(4),table tr:nth(5),table tr:nth(6)').invoke('hide');
|
172 |
+
if($('mirakl_status'))
|
173 |
+
$('mirakl_status').removeClassName('required-entry');
|
174 |
+
if($('mkp_login'))
|
175 |
+
$('mkp_login').removeClassName('required-entry');
|
176 |
+
if($('mkp_password'))
|
177 |
+
$('mkp_password').removeClassName('required-entry');
|
178 |
+
}
|
179 |
+
},
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Ajax : Maj des options des selects
|
183 |
+
*/
|
184 |
+
loadOptionsSelect: function (event, id) {
|
185 |
+
if (id != null) {
|
186 |
+
var elmt = this.elements[id];
|
187 |
+
} else {
|
188 |
+
var elmt = $(Event.element(event));
|
189 |
+
}
|
190 |
+
|
191 |
+
//on recupere l'url
|
192 |
+
var url = this.urls[elmt.id];
|
193 |
+
|
194 |
+
if (url != null) {
|
195 |
+
//Ajax
|
196 |
+
var request = new Ajax.Request(url, {
|
197 |
+
method: 'post',
|
198 |
+
onSuccess: this.updateSelect.bind(this),
|
199 |
+
onFailure: this.ajaxFailure.bind(this),
|
200 |
+
parameters: {
|
201 |
+
value: elmt.value,
|
202 |
+
id: this.steps[elmt.id]
|
203 |
+
}
|
204 |
+
});
|
205 |
+
}
|
206 |
+
//Chargement des options et de la restriction des pays
|
207 |
+
if (elmt.id == this.elements.account_type.id) {
|
208 |
+
this.loadOptions(elmt.value);
|
209 |
+
this.loadCountries(elmt.value);
|
210 |
+
this.loadLogo(elmt.value);
|
211 |
+
|
212 |
+
//Maj du champ label
|
213 |
+
this.elements.name.value = this.elements.account_type.options[ this.elements.account_type.selectedIndex ].text;
|
214 |
+
}
|
215 |
+
|
216 |
+
this.showHideSlaveConf();
|
217 |
+
|
218 |
+
},
|
219 |
+
/**
|
220 |
+
* AJAX response : add options
|
221 |
+
*/
|
222 |
+
updateSelect: function (transport) {
|
223 |
+
if (transport && transport.responseText) {
|
224 |
+
try {
|
225 |
+
response = eval('(' + transport.responseText + ')');
|
226 |
+
} catch (e) {
|
227 |
+
response = {};
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
if (response.result != null) {
|
232 |
+
//suppression des options du select
|
233 |
+
this.elements[response.id].select('option').invoke('remove');
|
234 |
+
response.result.each(function (objt) {
|
235 |
+
this.elements[response.id].insert(new Element('option', {
|
236 |
+
value: objt.value
|
237 |
+
}).update(objt.label));
|
238 |
+
}.bind(this));
|
239 |
+
|
240 |
+
//charger et activer le select suivant
|
241 |
+
this.loadOptionsSelect(null, response.id);
|
242 |
+
this._disableEnableAll(this.elements[response.id], false);
|
243 |
+
}
|
244 |
+
|
245 |
+
},
|
246 |
+
loadOptions: function (val) {
|
247 |
+
var urlOptions = this.urls.options;
|
248 |
+
new Ajax.Request(urlOptions, {
|
249 |
+
method: 'post',
|
250 |
+
onSuccess: this.displayOptions.bind(this),
|
251 |
+
onFailure: this.ajaxFailure.bind(this),
|
252 |
+
parameters: {
|
253 |
+
value: val
|
254 |
+
}
|
255 |
+
});
|
256 |
+
},
|
257 |
+
displayOptions: function (transport) {
|
258 |
+
if (transport && transport.responseText) {
|
259 |
+
try {
|
260 |
+
response = eval('(' + transport.responseText + ')');
|
261 |
+
} catch (e) {
|
262 |
+
response = {};
|
263 |
+
}
|
264 |
+
}
|
265 |
+
//1 : on cache toutes les options
|
266 |
+
this._disabledAllOptions();
|
267 |
+
|
268 |
+
//2 : pour afficher uniquement celles dispo
|
269 |
+
if (response) {
|
270 |
+
response.each(function (objt) {
|
271 |
+
var group = $(objt.option);
|
272 |
+
if (group) {
|
273 |
+
this._hideShowGroup(group, false);
|
274 |
+
}
|
275 |
+
}.bind(this));
|
276 |
+
}
|
277 |
+
},
|
278 |
+
loadCountries: function (val) {
|
279 |
+
var urlCountries = this.urls.countries;
|
280 |
+
new Ajax.Request(urlCountries, {
|
281 |
+
method: 'post',
|
282 |
+
onSuccess: this.displayCountries.bind(this),
|
283 |
+
onFailure: this.ajaxFailure.bind(this),
|
284 |
+
parameters: {
|
285 |
+
value: val
|
286 |
+
}
|
287 |
+
});
|
288 |
+
},
|
289 |
+
displayCountries: function (transport) {
|
290 |
+
if (transport && transport.responseText) {
|
291 |
+
try {
|
292 |
+
response = eval('(' + transport.responseText + ')');
|
293 |
+
} catch (e) {
|
294 |
+
response = {};
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
if (response) {
|
299 |
+
//this.elements.allowspecific.select('option')[1].selected = true;
|
300 |
+
|
301 |
+
$$('select#mySelect option');
|
302 |
+
if (response.found == 'no-restriction') {
|
303 |
+
//tout afficher
|
304 |
+
this.elements.allowed_countries.select('option').invoke('show');
|
305 |
+
} else if (response.found == 'restriction') {
|
306 |
+
//afficher uniquement les pays retournés
|
307 |
+
|
308 |
+
this.elements.allowed_countries.select('option').invoke('hide');
|
309 |
+
response.countries.each(function (elmt) {
|
310 |
+
this.elements.allowed_countries.select('option[value="' + elmt.label + '"]').invoke('show');
|
311 |
+
}.bind(this));
|
312 |
+
} else {
|
313 |
+
//Tout cacher
|
314 |
+
this.elements.allowed_countries.select('option').invoke('hide');
|
315 |
+
}
|
316 |
+
|
317 |
+
if ($('allowspecific').value == 0) {
|
318 |
+
this.elements.allowed_countries.disabled = true;
|
319 |
+
} else {
|
320 |
+
this.elements.allowed_countries.disabled = false;
|
321 |
+
}
|
322 |
+
}
|
323 |
+
},
|
324 |
+
loadLogo: function (val) {
|
325 |
+
var urlLogo = this.urls.logo;
|
326 |
+
new Ajax.Request(urlLogo, {
|
327 |
+
method: 'post',
|
328 |
+
onSuccess: this.displayLogo.bind(this),
|
329 |
+
onFailure: this.ajaxFailure.bind(this),
|
330 |
+
parameters: {
|
331 |
+
value: val
|
332 |
+
}
|
333 |
+
});
|
334 |
+
},
|
335 |
+
displayLogo: function (transport) {
|
336 |
+
if (transport && transport.responseText) {
|
337 |
+
try {
|
338 |
+
response = eval('(' + transport.responseText + ')');
|
339 |
+
} catch (e) {
|
340 |
+
response = {};
|
341 |
+
}
|
342 |
+
}
|
343 |
+
|
344 |
+
if (response != null && response != '') {
|
345 |
+
this.elements.logo_url.value = response;
|
346 |
+
if (this.elements.logo_image)
|
347 |
+
this.elements.logo_image.src = response;
|
348 |
+
}
|
349 |
+
},
|
350 |
+
_disabledAllOptions: function () {
|
351 |
+
this.options.each(function (opt) {
|
352 |
+
this._hideShowGroup(opt, true);
|
353 |
+
}.bind(this));
|
354 |
+
},
|
355 |
+
_hideShowGroup: function (element, choice) {
|
356 |
+
if (choice) {
|
357 |
+
element.previous('div').hide();
|
358 |
+
element.hide();
|
359 |
+
} else {
|
360 |
+
element.previous('div').show();
|
361 |
+
element.show();
|
362 |
+
}
|
363 |
+
this._disableEnableAll(element, choice);
|
364 |
+
},
|
365 |
+
_disableEnableAll: function (element, isDisabled, exception) {
|
366 |
+
var descendants = element.descendants();
|
367 |
+
for (var k in descendants) {
|
368 |
+
if (descendants[k].id != exception) {
|
369 |
+
if (descendants[k].tagName != 'OPTION') {
|
370 |
+
descendants[k].disabled = isDisabled;
|
371 |
+
}
|
372 |
+
}
|
373 |
+
|
374 |
+
}
|
375 |
+
element.disabled = isDisabled;
|
376 |
+
},
|
377 |
+
ajaxFailure: function () {
|
378 |
+
location.reload();
|
379 |
+
}
|
380 |
+
};
|
381 |
+
|
382 |
+
document.observe("dom:loaded", function () {
|
383 |
+
new Be2bill();
|
384 |
+
});
|
skin/frontend/rwd/default/css/be2bill/checkout-onepage-payment.css
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* 1997-2016 Quadra Informatique
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
7 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
8 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
9 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
10 |
+
*
|
11 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
12 |
+
* @copyright 1997-2015 Quadra Informatique
|
13 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
14 |
+
*/
|
15 |
+
|
16 |
+
#payment_form_be2bill_standard.form-list li.form-alt .info,
|
17 |
+
#payment_form_be2bill_several.form-list li.form-alt .info {
|
18 |
+
clear: both;
|
19 |
+
}
|
20 |
+
|
21 |
+
.sp-methods #dd_method_be2bill .form-list {
|
22 |
+
padding-left: 0px;
|
23 |
+
}
|
24 |
+
|
25 |
+
#dd_method_be2bill .be2bill-extra-options{
|
26 |
+
margin-left: 40px;
|
27 |
+
}
|
28 |
+
|
29 |
+
.be2bill-label {
|
30 |
+
margin-left: 15px;
|
31 |
+
line-height: 35px;
|
32 |
+
font-weight: normal;
|
33 |
+
}
|
34 |
+
|
35 |
+
#payment_be2bill .radio {
|
36 |
+
margin-top: 19px;
|
37 |
+
}
|
skin/frontend/rwd/default/css/be2bill/checkout-success-crossell.css
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* 1997-2016 Quadra Informatique
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
7 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
8 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
9 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
10 |
+
*
|
11 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
12 |
+
* @copyright 1997-2015 Quadra Informatique
|
13 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
14 |
+
*/
|
15 |
+
|
16 |
+
/* Checkout Success Collateral boxes */
|
17 |
+
.success-collaterals { padding:25px 0 0; }
|
18 |
+
|
19 |
+
.success-collaterals:after,
|
20 |
+
.crosssell-products-grid:after { display:block; content:"."; clear:both; font-size:0; line-height:0; height:0; overflow:hidden; }
|
21 |
+
|
22 |
+
.success-collaterals .crosssell { border:1px solid #cec3b6; background:#fafaec; padding:12px 15px; }
|
23 |
+
.success-collaterals .crosssell h2 { font-size:13px; font-weight:bold; }
|
24 |
+
|
25 |
+
.success-collaterals .crosssell .crosssell-products-grid { position:relative; }
|
26 |
+
.success-collaterals .crosssell .crosssell-products-grid .last { border-bottom:0; }
|
27 |
+
.success-collaterals .crosssell .crosssell-products-grid li.item { float:left; width:138px; padding:12px 10px 80px; }
|
28 |
+
|
29 |
+
.success-collaterals .crosssell .crosssell-products-grid .product-image { display:block; width:135px; height:135px; margin:0 0 10px; border:1px solid #d0cdc9; }
|
30 |
+
.success-collaterals .crosssell .crosssell-products-grid .product-name { margin:0 0 5px; font-weight:bold; font-size:13px; color:#203548; }
|
31 |
+
.success-collaterals .crosssell .crosssell-products-grid .product-name a { color:#203548; }
|
32 |
+
.success-collaterals .crosssell .crosssell-products-grid .price-box { margin:5px 0; }
|
33 |
+
.success-collaterals .crosssell .crosssell-products-grid .actions { position:absolute; bottom:12px; }
|
skin/frontend/rwd/default/css/be2bill/product.css
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* 1997-2016 Quadra Informatique
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0) that is available
|
7 |
+
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
|
8 |
+
* If you are unable to obtain it through the world-wide-web, please send an email
|
9 |
+
* to modules@quadra-informatique.fr so we can send you a copy immediately.
|
10 |
+
*
|
11 |
+
* @author Quadra Informatique <modules@quadra-informatique.fr>
|
12 |
+
* @copyright 1997-2015 Quadra Informatique
|
13 |
+
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
14 |
+
*/
|
15 |
+
|
16 |
+
/* All products */
|
17 |
+
.add-to-cart .be2bill-simple-product-oneclick:after,
|
18 |
+
.add-to-cart .be2bill-simple-product-oneclick .actions:after,
|
19 |
+
.add-to-cart .be2bill-grouped-product-oneclick:after,
|
20 |
+
.add-to-cart .be2bill-grouped-product-oneclick .actions:after,
|
21 |
+
.add-to-cart .be2bill-configurable-product-oneclick:after,
|
22 |
+
.add-to-cart .be2bill-configurable-product-oneclick .actions:after,
|
23 |
+
.add-to-cart .be2bill-virtual-product-oneclick:after,
|
24 |
+
.add-to-cart .be2bill-virtual-product-oneclick .actions:after,
|
25 |
+
.add-to-cart .be2bill-bundle-product-oneclick:after,
|
26 |
+
.add-to-cart .be2bill-bundle-product-oneclick .actions:after,
|
27 |
+
.add-to-cart .be2bill-downloadable-product-oneclick:after,
|
28 |
+
.add-to-cart .be2bill-downloadable-product-oneclick .actions:after { display:block; content:"."; clear:both; font-size:0; line-height:0; height:0; overflow:hidden; }
|
29 |
+
|
30 |
+
.add-to-cart .be2bill-simple-product-oneclick button.button,
|
31 |
+
.add-to-cart .be2bill-grouped-product-oneclick button.button,
|
32 |
+
.add-to-cart .be2bill-configurable-product-oneclick button.button,
|
33 |
+
.add-to-cart .be2bill-virtual-product-oneclick button.button,
|
34 |
+
.add-to-cart .be2bill-bundle-product-oneclick button.button,
|
35 |
+
.add-to-cart .be2bill-downloadable-product-oneclick button.button { padding-top: 5px; }
|
36 |
+
|
37 |
+
.add-to-cart .be2bill-simple-product-oneclick button.button.last,
|
38 |
+
.add-to-cart .be2bill-grouped-product-oneclick button.button.last,
|
39 |
+
.add-to-cart .be2bill-configurable-product-oneclick button.button.last,
|
40 |
+
.add-to-cart .be2bill-virtual-product-oneclick button.button.last,
|
41 |
+
.add-to-cart .be2bill-bundle-product-oneclick button.button.last,
|
42 |
+
.add-to-cart .be2bill-downloadable-product-oneclick button.button.last { padding-left: 5px; }
|
43 |
+
|
44 |
+
.add-to-cart .be2bill-simple-product-oneclick .be2bill-product-oneclick-content,
|
45 |
+
.add-to-cart .be2bill-grouped-product-oneclick .be2bill-product-oneclick-content,
|
46 |
+
.add-to-cart .be2bill-configurable-product-oneclick .be2bill-product-oneclick-content,
|
47 |
+
.add-to-cart .be2bill-virtual-product-oneclick .be2bill-product-oneclick-content,
|
48 |
+
.add-to-cart .be2bill-bundle-product-oneclick .be2bill-product-oneclick-content,
|
49 |
+
.add-to-cart .be2bill-downloadable-product-oneclick .be2bill-product-oneclick-content { margin: 5px; }
|
50 |
+
|
51 |
+
/* Simple, grouped, virtual, downloadable products */
|
52 |
+
.add-to-cart .be2bill-simple-product-oneclick,
|
53 |
+
.add-to-cart .be2bill-grouped-product-oneclick,
|
54 |
+
.add-to-cart .be2bill-virtual-product-oneclick,
|
55 |
+
.add-to-cart .be2bill-downloadable-product-oneclick {
|
56 |
+
background: url("../../images/bkg_product_collateral.gif") repeat-x scroll 0 0 #FAF7EE;
|
57 |
+
border: 1px solid #C4C6C8;
|
58 |
+
clear: left;
|
59 |
+
margin: 10px 0;
|
60 |
+
width: 330px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.add-to-cart .be2bill-simple-product-oneclick .actions,
|
64 |
+
.add-to-cart .be2bill-grouped-product-oneclick .actions,
|
65 |
+
.add-to-cart .be2bill-virtual-product-oneclick .actions,
|
66 |
+
.add-to-cart .be2bill-configurable-product-oneclick .actions,
|
67 |
+
.add-to-cart .be2bill-downloadable-product-oneclick .actions {
|
68 |
+
margin-top : 5px
|
69 |
+
}
|
70 |
+
|
71 |
+
.add-to-cart .be2bill-simple-product-oneclick .or,
|
72 |
+
.add-to-cart .be2bill-grouped-product-oneclick .or,
|
73 |
+
.add-to-cart .be2bill-virtual-product-oneclick .or,
|
74 |
+
.add-to-cart .be2bill-downloadable-product-oneclick .or { float: none; margin: 0; }
|
75 |
+
|
76 |
+
.add-to-cart .be2bill-simple-product-oneclick .field .input-box select,
|
77 |
+
.add-to-cart .be2bill-grouped-product-oneclick .field .input-box select,
|
78 |
+
.add-to-cart .be2bill-virtual-product-oneclick .field .input-box select,
|
79 |
+
.add-to-cart .be2bill-downloadable-product-oneclick .field .input-box select { width: 320px; }
|
80 |
+
|
81 |
+
/* Configurable, bundle products */
|
82 |
+
.add-to-cart .be2bill-configurable-product-oneclick,
|
83 |
+
.add-to-cart .be2bill-bundle-product-oneclick { margin: 10px 0; }
|
84 |
+
.add-to-cart .be2bill-configurable-product-oneclick .or,
|
85 |
+
.add-to-cart .be2bill-bundle-product-oneclick .or { color: #666666; float: left; font-weight: bold; }
|
86 |
+
|
87 |
+
/* Configurable products */
|
88 |
+
.add-to-cart .be2bill-configurable-product-oneclick { clear: left; background-color: #F6F6F6; border: 1px solid #E4E4E4; }
|
89 |
+
.add-to-cart .be2bill-configurable-product-oneclick .field .input-box select { width: 276px; }
|
90 |
+
|
91 |
+
/* Bundle products */
|
92 |
+
.add-to-cart .be2bill-bundle-product-oneclick { float: none; margin-top: 30px; background-color: #F6F6F6; border: 1px solid #E4E4E4; }
|
93 |
+
.add-to-cart .be2bill-bundle-product-oneclick .field .input-box select { width: 250px; }
|
94 |
+
|
95 |
+
|
96 |
+
.add-to-cart #button_ntimes { margin-left: 0px; }
|