Version Notes
TSI_Yesbycash 0.1.2
Download this release
Release Info
Developer | TSI |
Extension | YesByCash |
Version | 0.1.2 |
Comparing to | |
See all releases |
Version 0.1.2
- app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php +46 -0
- app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Order/Invoice/Totals.php +34 -0
- app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Order/Totals.php +39 -0
- app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Totals.php +64 -0
- app/code/community/TSI/Yesbycash/Block/Adminhtml/Server.php +34 -0
- app/code/community/TSI/Yesbycash/Block/Form/Ajax.php +29 -0
- app/code/community/TSI/Yesbycash/Block/Form/Standard.php +89 -0
- app/code/community/TSI/Yesbycash/Block/Info/Standard.php +13 -0
- app/code/community/TSI/Yesbycash/Block/Onepage/Failure.php +29 -0
- app/code/community/TSI/Yesbycash/Block/Onepage/Success.php +29 -0
- app/code/community/TSI/Yesbycash/Block/Sales/Order/Cancel.php +64 -0
- app/code/community/TSI/Yesbycash/Block/Sales/Order/Creditmemo/Totals.php +90 -0
- app/code/community/TSI/Yesbycash/Block/Sales/Order/Invoice/Totals.php +52 -0
- app/code/community/TSI/Yesbycash/Block/Sales/Order/Totals.php +36 -0
- app/code/community/TSI/Yesbycash/Controller/Action.php +120 -0
- app/code/community/TSI/Yesbycash/Helper/Data.php +410 -0
- app/code/community/TSI/Yesbycash/Model/Api/Methods.php +106 -0
- app/code/community/TSI/Yesbycash/Model/Api/Response.php +113 -0
- app/code/community/TSI/Yesbycash/Model/Api/Service.php +161 -0
- app/code/community/TSI/Yesbycash/Model/Observer.php +49 -0
- app/code/community/TSI/Yesbycash/Model/Sales/Order/Creditmemo/Total/Yesbycashfee.php +26 -0
- app/code/community/TSI/Yesbycash/Model/Sales/Order/Invoice/Total/Yesbycashfee.php +26 -0
- app/code/community/TSI/Yesbycash/Model/Sales/Quote/Address/Total/Yesbycashfee.php +77 -0
- app/code/community/TSI/Yesbycash/Model/Source/Yesbycashfeetype.php +16 -0
- app/code/community/TSI/Yesbycash/Model/Standard.php +17 -0
- app/code/community/TSI/Yesbycash/controllers/AjaxController.php +16 -0
- app/code/community/TSI/Yesbycash/controllers/IpnController.php +120 -0
- app/code/community/TSI/Yesbycash/controllers/StandardController.php +5 -0
- app/code/community/TSI/Yesbycash/etc/config.xml +267 -0
- app/code/community/TSI/Yesbycash/etc/system.xml +164 -0
- app/code/community/TSI/Yesbycash/sql/tsi_yesbycash_setup/install-0.1.0.php +50 -0
- app/code/community/TSI/Yesbycash/sql/tsi_yesbycash_setup/upgrade-0.1.0-0.1.1.php +53 -0
- app/code/community/TSI/Yesbycash/sql/tsi_yesbycash_setup/upgrade-0.1.1-0.1.2.php +27 -0
- app/design/frontend/base/default/layout/yesbycash.xml +47 -0
- app/design/frontend/base/default/template/yesbycash/checkout/failure.phtml +4 -0
- app/design/frontend/base/default/template/yesbycash/checkout/success.phtml +10 -0
- app/design/frontend/base/default/template/yesbycash/payment/form.phtml +137 -0
- app/design/frontend/base/default/template/yesbycash/payment/form_ajax.phtml +56 -0
- app/design/frontend/base/default/template/yesbycash/payment/info.phtml +3 -0
- app/design/frontend/base/default/template/yesbycash/sales/order/cancel.phtml +7 -0
- app/etc/modules/TSI_Yesbycash.xml +12 -0
- app/locale/fr_FR/TSI_Yesbycash.csv +120 -0
- package.xml +46 -0
- skin/frontend/base/default/css/yesbycash/yesbycash.css +234 -0
- skin/frontend/base/default/images/yesbycash/ybc-ajax-loader.gif +0 -0
- skin/frontend/base/default/images/yesbycash/yesbycash_logo.png +0 -0
- skin/frontend/base/default/js/yesbycash/yesbycash.js +204 -0
app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php
ADDED
@@ -0,0 +1,46 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Adminhtml_Sales_order_Creditmemo_Totals extends TSI_Yesbycash_Block_Adminhtml_Sales_Totals {
|
4 |
+
|
5 |
+
protected $_creditmemo;
|
6 |
+
|
7 |
+
public function getCreditmemo() {
|
8 |
+
if ($this->_creditmemo === null) {
|
9 |
+
if ($this->hasData('creditmemo')) {
|
10 |
+
$this->_creditmemo = $this->_getData('creditmemo');
|
11 |
+
} elseif (Mage::registry('current_creditmemo')) {
|
12 |
+
$this->_creditmemo = Mage::registry('current_creditmemo');
|
13 |
+
} elseif ($this->getParentBlock() && $this->getParentBlock()->getCreditmemo()) {
|
14 |
+
$this->_creditmemo = $this->getParentBlock()->getCreditmemo();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
return $this->_creditmemo;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getSource() {
|
21 |
+
return $this->getCreditmemo();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Initialize creditmemo totals array
|
26 |
+
*
|
27 |
+
* @return TSI_Yesbycash_Block_Adminhtml_Sales_Totals
|
28 |
+
*/
|
29 |
+
protected function _initTotals() {
|
30 |
+
parent::_initTotals();
|
31 |
+
$this->addTotal(new Varien_Object(array(
|
32 |
+
'code' => 'adjustment_positive',
|
33 |
+
'value' => $this->getSource()->getAdjustmentPositive(),
|
34 |
+
'base_value' => $this->getSource()->getBaseAdjustmentPositive(),
|
35 |
+
'label' => $this->helper('sales')->__('Adjustment Refund')
|
36 |
+
)));
|
37 |
+
$this->addTotal(new Varien_Object(array(
|
38 |
+
'code' => 'adjustment_negative',
|
39 |
+
'value' => $this->getSource()->getAdjustmentNegative(),
|
40 |
+
'base_value' => $this->getSource()->getBaseAdjustmentNegative(),
|
41 |
+
'label' => $this->helper('sales')->__('Adjustment Fee')
|
42 |
+
)));
|
43 |
+
return $this;
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Order/Invoice/Totals.php
ADDED
@@ -0,0 +1,34 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Adminhtml_Sales_order_Invoice_Totals extends TSI_Yesbycash_Block_Adminhtml_Sales_Totals {
|
4 |
+
|
5 |
+
protected $_invoice = null;
|
6 |
+
|
7 |
+
public function getInvoice() {
|
8 |
+
if ($this->_invoice === null) {
|
9 |
+
if ($this->hasData('invoice')) {
|
10 |
+
$this->_invoice = $this->_getData('invoice');
|
11 |
+
} elseif (Mage::registry('current_invoice')) {
|
12 |
+
$this->_invoice = Mage::registry('current_invoice');
|
13 |
+
} elseif ($this->getParentBlock()->getInvoice()) {
|
14 |
+
$this->_invoice = $this->getParentBlock()->getInvoice();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
return $this->_invoice;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getSource() {
|
21 |
+
return $this->getInvoice();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Initialize order totals array
|
26 |
+
*
|
27 |
+
* @return TSI_Yesbycash_Block_Adminhtml_Sales_Totals
|
28 |
+
*/
|
29 |
+
protected function _initTotals() {
|
30 |
+
parent::_initTotals();
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Order/Totals.php
ADDED
@@ -0,0 +1,39 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Adminhtml_Sales_Order_Totals extends TSI_Yesbycash_Block_Adminhtml_Sales_Totals {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Initialize order totals array
|
7 |
+
*
|
8 |
+
* @return TSI_Yesbycash_Block_Adminhtml_Sales_Order_Totals
|
9 |
+
*/
|
10 |
+
protected function _initTotals() {
|
11 |
+
parent::_initTotals();
|
12 |
+
$this->_totals['paid'] = new Varien_Object(array(
|
13 |
+
'code' => 'paid',
|
14 |
+
'strong' => true,
|
15 |
+
'value' => $this->getSource()->getTotalPaid(),
|
16 |
+
'base_value' => $this->getSource()->getBaseTotalPaid(),
|
17 |
+
'label' => $this->helper('sales')->__('Total Paid'),
|
18 |
+
'area' => 'footer'
|
19 |
+
));
|
20 |
+
$this->_totals['refunded'] = new Varien_Object(array(
|
21 |
+
'code' => 'refunded',
|
22 |
+
'strong' => true,
|
23 |
+
'value' => $this->getSource()->getTotalRefunded(),
|
24 |
+
'base_value' => $this->getSource()->getBaseTotalRefunded(),
|
25 |
+
'label' => $this->helper('sales')->__('Total Refunded'),
|
26 |
+
'area' => 'footer'
|
27 |
+
));
|
28 |
+
$this->_totals['due'] = new Varien_Object(array(
|
29 |
+
'code' => 'due',
|
30 |
+
'strong' => true,
|
31 |
+
'value' => $this->getSource()->getTotalDue(),
|
32 |
+
'base_value' => $this->getSource()->getBaseTotalDue(),
|
33 |
+
'label' => $this->helper('sales')->__('Total Due'),
|
34 |
+
'area' => 'footer'
|
35 |
+
));
|
36 |
+
return $this;
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Adminhtml/Sales/Totals.php
ADDED
@@ -0,0 +1,64 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Adminhtml_Sales_Totals extends Mage_Adminhtml_Block_Sales_Totals {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Initialize order totals array
|
7 |
+
*
|
8 |
+
* @return TSI_Yesbycash_Block_Adminhtml_Sales_Totals
|
9 |
+
*/
|
10 |
+
protected function _initTotals() {
|
11 |
+
parent::_initTotals();
|
12 |
+
|
13 |
+
$source = $this->getSource();
|
14 |
+
|
15 |
+
$this->_totals['paid'] = new Varien_Object(array(
|
16 |
+
'code' => 'paid',
|
17 |
+
'strong' => true,
|
18 |
+
'value' => $this->getSource()->getTotalPaid(),
|
19 |
+
'base_value' => $this->getSource()->getBaseTotalPaid(),
|
20 |
+
'label' => $this->helper('sales')->__('Total Paid'),
|
21 |
+
'area' => 'footer'
|
22 |
+
));
|
23 |
+
$this->_totals['refunded'] = new Varien_Object(array(
|
24 |
+
'code' => 'refunded',
|
25 |
+
'strong' => true,
|
26 |
+
'value' => $this->getSource()->getTotalRefunded(),
|
27 |
+
'base_value' => $this->getSource()->getBaseTotalRefunded(),
|
28 |
+
'label' => $this->helper('sales')->__('Total Refunded'),
|
29 |
+
'area' => 'footer'
|
30 |
+
));
|
31 |
+
$this->_totals['due'] = new Varien_Object(array(
|
32 |
+
'code' => 'due',
|
33 |
+
'strong' => true,
|
34 |
+
'value' => $this->getSource()->getTotalDue(),
|
35 |
+
'base_value' => $this->getSource()->getBaseTotalDue(),
|
36 |
+
'label' => $this->helper('sales')->__('Total Due'),
|
37 |
+
'area' => 'footer'
|
38 |
+
));
|
39 |
+
|
40 |
+
$totals = $this->_totals;
|
41 |
+
$newTotals = array();
|
42 |
+
if (count($totals) > 0) {
|
43 |
+
foreach ($totals as $index => $arr) {
|
44 |
+
if ($index == "grand_total") {
|
45 |
+
if (((float) $this->getSource()->getYesbycashFee()) != 0) {
|
46 |
+
$label = $this->__('Frais de service Yesbycash');
|
47 |
+
$newTotals['yesbycash_fee'] = new Varien_Object(array(
|
48 |
+
'code' => 'yesbycash_fee',
|
49 |
+
'field' => 'yesbycash_fee',
|
50 |
+
'base_value' => $source->getBaseYesbycashFee(),
|
51 |
+
'value' => $source->getYesbycashFee(),
|
52 |
+
'label' => $label
|
53 |
+
));
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$newTotals[$index] = $arr;
|
57 |
+
}
|
58 |
+
$this->_totals = $newTotals;
|
59 |
+
}
|
60 |
+
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Adminhtml/Server.php
ADDED
@@ -0,0 +1,34 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Adminhtml_Server extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Test if the module is in test mode or not
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
12 |
+
$this->setElement($element);
|
13 |
+
|
14 |
+
if ($this->getStoreConfig('mode_test')) {
|
15 |
+
$html = $this->getStoreConfig('server_dev');
|
16 |
+
$html .= '<br /><strong><span style="color:red">' . $this->__('Mode test activé') . '</span></strong>';
|
17 |
+
} else {
|
18 |
+
$html = $this->getStoreConfig('server_prod');
|
19 |
+
}
|
20 |
+
|
21 |
+
return $html;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Retrieve config value by path
|
26 |
+
*
|
27 |
+
* @param string $param
|
28 |
+
* @return mixed
|
29 |
+
*/
|
30 |
+
protected function getStoreConfig($param) {
|
31 |
+
return Mage::helper('tsi_yesbycash')->getStoreConfig($param);
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Form/Ajax.php
ADDED
@@ -0,0 +1,29 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Form_Ajax extends TSI_Yesbycash_Block_Form_Standard {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
protected function _construct() {
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('yesbycash/payment/form.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* @return type
|
16 |
+
*/
|
17 |
+
public function getPostcode() {
|
18 |
+
return $this->_getRequest()->getParam('postcode');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
*
|
23 |
+
* @return type
|
24 |
+
*/
|
25 |
+
public function getCountryId() {
|
26 |
+
return $this->_getRequest()->getParam('country_id');
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Form/Standard.php
ADDED
@@ -0,0 +1,89 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Form_Standard extends Mage_Payment_Block_Form {
|
4 |
+
|
5 |
+
protected function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('yesbycash/payment/form.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Get outlets list with postcode and country id param
|
12 |
+
*
|
13 |
+
* @return type
|
14 |
+
*/
|
15 |
+
public function getOutlets() {
|
16 |
+
$outlets = $this->getApi()->getOutletsList($this->getPostcode(), $this->getCountryId());
|
17 |
+
return $outlets->outlets;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
*
|
22 |
+
* @return type
|
23 |
+
*/
|
24 |
+
protected function getApi() {
|
25 |
+
return Mage::getModel('tsi_yesbycash/api_methods');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* @return type
|
31 |
+
*/
|
32 |
+
protected function _getHelper() {
|
33 |
+
return Mage::helper('tsi_yesbycash');
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
*
|
38 |
+
* @return type
|
39 |
+
*/
|
40 |
+
protected function _getQuote() {
|
41 |
+
return Mage::getSingleton('checkout/session')->getQuote();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
*
|
46 |
+
* @return type
|
47 |
+
*/
|
48 |
+
public function getPostcode() {
|
49 |
+
return $this->_getQuote()->getBillingAddress()->getData('postcode');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
*
|
54 |
+
* @return type
|
55 |
+
*/
|
56 |
+
public function getCountryId() {
|
57 |
+
return $this->_getHelper()->getCountryAlpha3($this->_getQuote()->getBillingAddress()->getData('country_id'));
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get allowed country with alpha3 code
|
62 |
+
*
|
63 |
+
* @return array
|
64 |
+
*/
|
65 |
+
public function getAllowedCountrys() {
|
66 |
+
$allowedCountrys = explode(',', $this->_getHelper()->getAllowedCountrys());
|
67 |
+
$newAllowedCountrys = array();
|
68 |
+
foreach ($allowedCountrys as $allowedCountry) {
|
69 |
+
$countryName = Mage::getModel('directory/country')->load($allowedCountry)->getName();
|
70 |
+
$newAllowedCountrys[$this->_getHelper()->getCountryAlpha3($allowedCountry)] = $countryName;
|
71 |
+
}
|
72 |
+
return $newAllowedCountrys;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get the Fee for yesbycash method
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
public function getYesbycashFee() {
|
81 |
+
if (!$this->_getHelper()->getStoreConfig('yesbycash_fee')) {
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
$baseAmount = Mage::helper('tsi_yesbycash')->getYesbycashFee();
|
85 |
+
$amount = Mage::helper('core')->currency($baseAmount, true, false);
|
86 |
+
return $amount;
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Info/Standard.php
ADDED
@@ -0,0 +1,13 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Info_Standard extends Mage_Payment_Block_Info {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
protected function _construct() {
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('yesbycash/payment/info.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Onepage/Failure.php
ADDED
@@ -0,0 +1,29 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Onepage_Failure extends Mage_Checkout_Block_Onepage_Failure {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @return type
|
8 |
+
*/
|
9 |
+
public function getOrderId() {
|
10 |
+
return $this->getRealOrderId();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* @return type
|
16 |
+
*/
|
17 |
+
public function getOrder() {
|
18 |
+
return Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
*
|
23 |
+
* @return type
|
24 |
+
*/
|
25 |
+
public function getPayment() {
|
26 |
+
return $this->getOrder()->getPayment()->getMethod();
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Onepage/Success.php
ADDED
@@ -0,0 +1,29 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Onepage_Success extends Mage_Checkout_Block_Onepage_Success {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @return type
|
8 |
+
*/
|
9 |
+
public function getOrderId() {
|
10 |
+
return $this->_getData('order_id');
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* @return type
|
16 |
+
*/
|
17 |
+
public function getOrder() {
|
18 |
+
return Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
*
|
23 |
+
* @return type
|
24 |
+
*/
|
25 |
+
public function getPayment() {
|
26 |
+
return $this->getOrder()->getPayment()->getMethod();
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Sales/Order/Cancel.php
ADDED
@@ -0,0 +1,64 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Sales_Order_Cancel extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get the current order
|
7 |
+
*
|
8 |
+
* @return type
|
9 |
+
*/
|
10 |
+
public function getOrder() {
|
11 |
+
return Mage::registry('current_order');
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Test if the order is a yesbycash order
|
16 |
+
*
|
17 |
+
* @return boolean
|
18 |
+
*/
|
19 |
+
public function isYesByCash() {
|
20 |
+
$order = $this->getOrder();
|
21 |
+
$barcode = $order->getYesbycashBarcode();
|
22 |
+
if (!is_null($barcode)) {
|
23 |
+
return true;
|
24 |
+
}
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Test if the order is alreay canceled
|
30 |
+
*
|
31 |
+
* @return boolean
|
32 |
+
*/
|
33 |
+
public function isCanceled() {
|
34 |
+
$order = $this->getOrder();
|
35 |
+
$status = $order->getStatus();
|
36 |
+
if ($status == 'canceled') {
|
37 |
+
return true;
|
38 |
+
}
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Test if its possible to show or not the button for canceled the order
|
44 |
+
*
|
45 |
+
* @return boolean
|
46 |
+
*/
|
47 |
+
public function showButton() {
|
48 |
+
if ($this->isYesByCash() && !$this->isCanceled()) {
|
49 |
+
return true;
|
50 |
+
}
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get the Cancel url
|
56 |
+
*
|
57 |
+
* @param object $order
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function getCancelUrl($order) {
|
61 |
+
return $this->getUrl('tsi_yesbycash/ipn/cancel', array('order_id' => $order->getId()));
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Sales/Order/Creditmemo/Totals.php
ADDED
@@ -0,0 +1,90 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Sales_order_Creditmemo_Totals extends TSI_Yesbycash_Block_Sales_Order_Totals {
|
4 |
+
|
5 |
+
protected $_creditmemo = null;
|
6 |
+
|
7 |
+
/**
|
8 |
+
*
|
9 |
+
* @return type
|
10 |
+
*/
|
11 |
+
public function getCreditmemo() {
|
12 |
+
if ($this->_creditmemo === null) {
|
13 |
+
if ($this->hasData('creditmemo')) {
|
14 |
+
$this->_creditmemo = $this->_getData('creditmemo');
|
15 |
+
} elseif (Mage::registry('current_creditmemo')) {
|
16 |
+
$this->_creditmemo = Mage::registry('current_creditmemo');
|
17 |
+
} elseif ($this->getParentBlock()->getCreditmemo()) {
|
18 |
+
$this->_creditmemo = $this->getParentBlock()->getCreditmemo();
|
19 |
+
}
|
20 |
+
}
|
21 |
+
return $this->_creditmemo;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @param type $creditmemo
|
27 |
+
* @return \TSI_Yesbycash_Block_Sales_order_Creditmemo_Totals
|
28 |
+
*/
|
29 |
+
public function setCreditmemo($creditmemo) {
|
30 |
+
$this->_creditmemo = $creditmemo;
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Get totals source object
|
36 |
+
*
|
37 |
+
* @return Mage_Sales_Model_Order
|
38 |
+
*/
|
39 |
+
public function getSource() {
|
40 |
+
return $this->getCreditmemo();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Initialize order totals array
|
45 |
+
*
|
46 |
+
* @return Mage_Sales_Block_Order_Totals
|
47 |
+
*/
|
48 |
+
protected function _initTotals() {
|
49 |
+
parent::_initTotals();
|
50 |
+
$this->removeTotal('base_grandtotal');
|
51 |
+
if ((float) $this->getSource()->getAdjustmentPositive()) {
|
52 |
+
$total = new Varien_Object(array(
|
53 |
+
'code' => 'adjustment_positive',
|
54 |
+
'value' => $this->getSource()->getAdjustmentPositive(),
|
55 |
+
'label' => $this->__('Adjustment Refund')
|
56 |
+
));
|
57 |
+
$this->addTotal($total);
|
58 |
+
}
|
59 |
+
if ((float) $this->getSource()->getAdjustmentNegative()) {
|
60 |
+
$total = new Varien_Object(array(
|
61 |
+
'code' => 'adjustment_negative',
|
62 |
+
'value' => $this->getSource()->getAdjustmentNegative(),
|
63 |
+
'label' => $this->__('Adjustment Fee')
|
64 |
+
));
|
65 |
+
$this->addTotal($total);
|
66 |
+
}
|
67 |
+
/**
|
68 |
+
<?php if ($this->getCanDisplayTotalPaid()): ?>
|
69 |
+
<tr>
|
70 |
+
<td colspan="6" class="a-right"><strong><?php echo $this->__('Total Paid') ?></strong></td>
|
71 |
+
<td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalPaid()) ?></strong></td>
|
72 |
+
</tr>
|
73 |
+
<?php endif; ?>
|
74 |
+
<?php if ($this->getCanDisplayTotalRefunded()): ?>
|
75 |
+
<tr>
|
76 |
+
<td colspan="6" class="a-right"><strong><?php echo $this->__('Total Refunded') ?></strong></td>
|
77 |
+
<td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalRefunded()) ?></strong></td>
|
78 |
+
</tr>
|
79 |
+
<?php endif; ?>
|
80 |
+
<?php if ($this->getCanDisplayTotalDue()): ?>
|
81 |
+
<tr>
|
82 |
+
<td colspan="6" class="a-right"><strong><?php echo $this->__('Total Due') ?></strong></td>
|
83 |
+
<td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalDue()) ?></strong></td>
|
84 |
+
</tr>
|
85 |
+
<?php endif; ?>
|
86 |
+
*/
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Sales/Order/Invoice/Totals.php
ADDED
@@ -0,0 +1,52 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Sales_order_Invoice_Totals extends TSI_Yesbycash_Block_Sales_Order_Totals {
|
4 |
+
|
5 |
+
protected $_invoice = null;
|
6 |
+
|
7 |
+
/**
|
8 |
+
*
|
9 |
+
* @return type
|
10 |
+
*/
|
11 |
+
public function getInvoice() {
|
12 |
+
if ($this->_invoice === null) {
|
13 |
+
if ($this->hasData('invoice')) {
|
14 |
+
$this->_invoice = $this->_getData('invoice');
|
15 |
+
} elseif (Mage::registry('current_invoice')) {
|
16 |
+
$this->_invoice = Mage::registry('current_invoice');
|
17 |
+
} elseif ($this->getParentBlock()->getInvoice()) {
|
18 |
+
$this->_invoice = $this->getParentBlock()->getInvoice();
|
19 |
+
}
|
20 |
+
}
|
21 |
+
return $this->_invoice;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @param type $invoice
|
27 |
+
* @return \TSI_Yesbycash_Block_Sales_order_Invoice_Totals
|
28 |
+
*/
|
29 |
+
public function setInvoice($invoice) {
|
30 |
+
$this->_invoice = $invoice;
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
*
|
36 |
+
* @return type
|
37 |
+
*/
|
38 |
+
public function getSource() {
|
39 |
+
return $this->getInvoice();
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
* @return \TSI_Yesbycash_Block_Sales_order_Invoice_Totals
|
45 |
+
*/
|
46 |
+
protected function _initTotals() {
|
47 |
+
parent::_initTotals();
|
48 |
+
$this->removeTotal('base_grandtotal');
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
app/code/community/TSI/Yesbycash/Block/Sales/Order/Totals.php
ADDED
@@ -0,0 +1,36 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @return \TSI_Yesbycash_Block_Sales_Order_Totals
|
8 |
+
*/
|
9 |
+
protected function _initTotals() {
|
10 |
+
parent::_initTotals();
|
11 |
+
|
12 |
+
$source = $this->getSource();
|
13 |
+
$totals = $this->_totals;
|
14 |
+
$newTotals = array();
|
15 |
+
if (count($totals) > 0) {
|
16 |
+
foreach ($totals as $index => $arr) {
|
17 |
+
if ($index == "grand_total") {
|
18 |
+
if (((float) $this->getSource()->getYesbycashFee()) != 0) {
|
19 |
+
$label = $this->__('Frais de service Yesbycash');
|
20 |
+
$newTotals['yesbycash_fee'] = new Varien_Object(array(
|
21 |
+
'code' => 'yesbycash_fee',
|
22 |
+
'field' => 'yesbycash_fee',
|
23 |
+
'value' => $source->getYesbycashFee(),
|
24 |
+
'label' => $label
|
25 |
+
));
|
26 |
+
}
|
27 |
+
}
|
28 |
+
$newTotals[$index] = $arr;
|
29 |
+
}
|
30 |
+
$this->_totals = $newTotals;
|
31 |
+
}
|
32 |
+
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
app/code/community/TSI/Yesbycash/Controller/Action.php
ADDED
@@ -0,0 +1,120 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Controller_Action extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
protected $_quote = false;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Test for a method s2s and paymentupdate if the server is authorized
|
9 |
+
* to execute the next step
|
10 |
+
*
|
11 |
+
* @return type
|
12 |
+
*/
|
13 |
+
public function preDispatch() {
|
14 |
+
if ($this->_getHelper()->isEnabled()) {
|
15 |
+
$action = $this->getRequest()->getActionName();
|
16 |
+
$pattern = '/^(s2s)|(paymentupdate)/i';
|
17 |
+
if (preg_match($pattern, $action)) {
|
18 |
+
if (!$this->_validateServer()) {
|
19 |
+
$this->getResponse()->setBody("KO - Unauthorized ip : " . $this->_getHelper()->getRemoteAddr());
|
20 |
+
$this->setFlag('', 'no-dispatch', true);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
} else {
|
24 |
+
$this->getResponse()->setBody("KO - Module not enabled");
|
25 |
+
$this->setFlag('', 'no-dispatch', true);
|
26 |
+
}
|
27 |
+
|
28 |
+
return parent::preDispatch();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
*
|
33 |
+
* @return boolean
|
34 |
+
*/
|
35 |
+
protected function _validateServer() {
|
36 |
+
if (!$this->_getHelper()->isGoodServer()) {
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
return true;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
* @return type
|
45 |
+
*/
|
46 |
+
protected function _getHelper() {
|
47 |
+
return Mage::helper('tsi_yesbycash');
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get the session and api yesbycash
|
52 |
+
* Set the response to database
|
53 |
+
* Set state
|
54 |
+
* Send email
|
55 |
+
* Redirect to success or failure page
|
56 |
+
*/
|
57 |
+
public function redirectAction() {
|
58 |
+
$session = $this->_getCheckoutSession();
|
59 |
+
$session->setYesbycashStandardQuoteId($session->getQuoteId());
|
60 |
+
$session->unsQuoteId();
|
61 |
+
|
62 |
+
$api = Mage::getModel('tsi_yesbycash/api_methods');
|
63 |
+
|
64 |
+
try {
|
65 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
66 |
+
if (!$order->getId())
|
67 |
+
Mage::throwException("Order not found!");
|
68 |
+
|
69 |
+
$billingAddress = $order->getBillingAddress();
|
70 |
+
|
71 |
+
$mobile = null;
|
72 |
+
if (preg_match('#^(06|07)#', $billingAddress->getTelephone()))
|
73 |
+
$mobile = $billingAddress->getTelephone();
|
74 |
+
|
75 |
+
$outletId = $session->getOutletId();
|
76 |
+
|
77 |
+
$response = $api->createOrder($order->getCustomerId(), $this->_getHelper()->formatAmount($order->getBaseGrandTotal()), $order->getBaseCurrencyCode(), $order->getIncrementId(), $billingAddress->getEmail(), $billingAddress->getFirstname(), $billingAddress->getLastname(), $billingAddress->getTelephone(), $mobile, $billingAddress->getStreetFull(), $billingAddress->getCity(), $billingAddress->getCountryId(), $billingAddress->getPostcode(), $outletId);
|
78 |
+
|
79 |
+
$order->setYesbycashBarcode($response->barcode);
|
80 |
+
$order->setYesbycashStatus($response->status);
|
81 |
+
$order->setYesbycashMessage($response->message);
|
82 |
+
$order->setYesbycashErrorcode($response->errorcode);
|
83 |
+
$order->setYesbycashOutletsid($outletId);
|
84 |
+
$order->setState('pending_payment', 'pending_yesbycash', '', false);
|
85 |
+
$order->save();
|
86 |
+
|
87 |
+
$session->setQuoteId($session->getYesbycashStandardQuoteId(true));
|
88 |
+
$this->_getQuote()->setIsActive(false)->save();
|
89 |
+
$this->_getCheckoutSession()->unsQuoteId();
|
90 |
+
|
91 |
+
$order->sendNewOrderEmail();
|
92 |
+
|
93 |
+
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
94 |
+
} catch (Exception $e) {
|
95 |
+
Mage::logException($e);
|
96 |
+
$session->setErrorMessage($e->getMessage());
|
97 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
*
|
103 |
+
* @return type
|
104 |
+
*/
|
105 |
+
protected function _getCheckoutSession() {
|
106 |
+
return Mage::getSingleton('checkout/session');
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
*
|
111 |
+
* @return type
|
112 |
+
*/
|
113 |
+
protected function _getQuote() {
|
114 |
+
if (!$this->_quote) {
|
115 |
+
$this->_quote = $this->_getCheckoutSession()->getQuote();
|
116 |
+
}
|
117 |
+
return $this->_quote;
|
118 |
+
}
|
119 |
+
|
120 |
+
}
|
app/code/community/TSI/Yesbycash/Helper/Data.php
ADDED
@@ -0,0 +1,410 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Helper_Data extends Mage_Core_Helper_Data {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @param type $param
|
8 |
+
* @return type
|
9 |
+
*/
|
10 |
+
public function getStoreConfig($param) {
|
11 |
+
return Mage::getStoreConfig('payment/yesbycash_standard/' . $param);
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
*
|
16 |
+
* @return type
|
17 |
+
*/
|
18 |
+
public function isEnabled() {
|
19 |
+
return $this->getStoreConfig('active');
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
*
|
24 |
+
* @return type
|
25 |
+
*/
|
26 |
+
public function getAllowedIps() {
|
27 |
+
return $this->getStoreConfig('allowed_ips');
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
*
|
32 |
+
* @return type
|
33 |
+
*/
|
34 |
+
public function getAllowedCountrys() {
|
35 |
+
return $this->getStoreConfig('specificcountry');
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
*
|
40 |
+
* @return type
|
41 |
+
*/
|
42 |
+
public function getRemoteAddr() {
|
43 |
+
return Mage::helper('core/http')->getRemoteAddr();
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @return boolean
|
49 |
+
*/
|
50 |
+
public function isGoodServer() {
|
51 |
+
$allowedIps = explode(",", $this->getAllowedIps());
|
52 |
+
foreach ($allowedIps as $ip) {
|
53 |
+
if ($ip === $this->getRemoteAddr())
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
*
|
62 |
+
* @param type $amount
|
63 |
+
* @return type
|
64 |
+
*/
|
65 |
+
public function formatAmount($amount) {
|
66 |
+
return intval($amount * 100);
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
*
|
71 |
+
* @return type
|
72 |
+
*/
|
73 |
+
public function getBaseGrandTotal() {
|
74 |
+
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
75 |
+
return Mage::helper("core")->currency($order->getBaseGrandTotal(), true, false);
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Fee type is a percent or amount
|
80 |
+
*
|
81 |
+
* @return type
|
82 |
+
*/
|
83 |
+
public function getYesbycashFeeType() {
|
84 |
+
$yesbycashFeeType = $this->getStoreConfig('yesbycash_fee_type');
|
85 |
+
return $yesbycashFeeType;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
*
|
90 |
+
* @return type
|
91 |
+
*/
|
92 |
+
public function getYesbycashFeeValue() {
|
93 |
+
$yesbycashFeeValue = $this->getStoreConfig('yesbycash_fee_value');
|
94 |
+
return $yesbycashFeeValue;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Calcul the yesbycash fee
|
99 |
+
*
|
100 |
+
* @param type $quote
|
101 |
+
* @return type
|
102 |
+
*/
|
103 |
+
public function getYesbycashFee($quote = null) {
|
104 |
+
if (is_null($quote)) {
|
105 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
106 |
+
}
|
107 |
+
$baseAmount = 0;
|
108 |
+
$address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
|
109 |
+
|
110 |
+
$tax = 0;
|
111 |
+
if (Mage::getStoreConfig('tax/calculation/price_includes_tax') != 1) {
|
112 |
+
$tax = $address->getTaxAmount();
|
113 |
+
}
|
114 |
+
|
115 |
+
$yesbycashFeeType = $this->getYesbycashFeeType();
|
116 |
+
$baseYesbycashFeeValue = $this->getYesbycashFeeValue();
|
117 |
+
|
118 |
+
if ($yesbycashFeeType == "yesbycash_fee_type_currency") {
|
119 |
+
$baseAmount = $baseYesbycashFeeValue;
|
120 |
+
} else {
|
121 |
+
$subTotal = $address->getBaseSubtotal();
|
122 |
+
$baseAmount = ($subTotal + $tax) * floatval($baseYesbycashFeeValue) / 100;
|
123 |
+
}
|
124 |
+
return $baseAmount;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
*
|
129 |
+
* @param type $ybcStatus
|
130 |
+
* @return array
|
131 |
+
*/
|
132 |
+
public function getStatusAndStateByCodeStatus($ybcStatus) {
|
133 |
+
// code YBC => status, state magento
|
134 |
+
$statusByCode = array(
|
135 |
+
1 => array('pending_yesbycash', 'pending_payment'), // Waiting
|
136 |
+
2 => array('processing_yesbycash_paid', 'processing'), // Paid
|
137 |
+
3 => array('pending_yesbycash', 'pending_payment'), // Waiting for payment
|
138 |
+
4 => array('canceled_yesbycash_refused', 'cancelled'), // Refused
|
139 |
+
5 => array('canceled_yesbycash_expired', 'canceled'), // Expired
|
140 |
+
6 => array('canceled', 'canceled'), // Canceled
|
141 |
+
7 => array('pending_yesbycash_auth', 'processing'), //Waiting for authentication
|
142 |
+
);
|
143 |
+
if (isset($statusByCode[$ybcStatus])) {
|
144 |
+
return $statusByCode[$ybcStatus];
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* The used norm for country is ISO3166 alpha3.
|
150 |
+
* For example: France country code is FRA.
|
151 |
+
* @param string $countryId
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
public function getCountryAlpha3($countryId) {
|
155 |
+
$countryCodes = array(
|
156 |
+
'FR' => 'FRA',
|
157 |
+
'AF' => 'AFG',
|
158 |
+
'AL' => 'ALB',
|
159 |
+
'DZ' => 'DZA',
|
160 |
+
'AS' => 'ASM',
|
161 |
+
'AD' => 'AND',
|
162 |
+
'AO' => 'AGO',
|
163 |
+
'AI' => 'AIA',
|
164 |
+
'AQ' => 'ATA',
|
165 |
+
'AG' => 'ATG',
|
166 |
+
'AR' => 'ARG',
|
167 |
+
'AM' => 'ARM',
|
168 |
+
'AW' => 'ABW',
|
169 |
+
'AU' => 'AUS',
|
170 |
+
'AT' => 'AUT',
|
171 |
+
'AZ' => 'AZE',
|
172 |
+
'BS' => 'BHS',
|
173 |
+
'BH' => 'BHR',
|
174 |
+
'BD' => 'BGD',
|
175 |
+
'BB' => 'BRB',
|
176 |
+
'BY' => 'BLR',
|
177 |
+
'BE' => 'BEL',
|
178 |
+
'BZ' => 'BLZ',
|
179 |
+
'BJ' => 'BEN',
|
180 |
+
'BM' => 'BMU',
|
181 |
+
'BT' => 'BTN',
|
182 |
+
'BO' => 'BOL',
|
183 |
+
'BA' => 'BIH',
|
184 |
+
'BW' => 'BWA',
|
185 |
+
'BV' => 'BVT',
|
186 |
+
'BR' => 'BRA',
|
187 |
+
'IO' => 'IOT',
|
188 |
+
'VG' => 'VGB',
|
189 |
+
'BN' => 'BRN',
|
190 |
+
'BG' => 'BGR',
|
191 |
+
'BF' => 'BFA',
|
192 |
+
'BI' => 'BDI',
|
193 |
+
'KH' => 'KHM',
|
194 |
+
'CM' => 'CMR',
|
195 |
+
'CA' => 'CAN',
|
196 |
+
'CV' => 'CPV',
|
197 |
+
'KY' => 'CYM',
|
198 |
+
'CF' => 'CAF',
|
199 |
+
'TD' => 'TCD',
|
200 |
+
'CL' => 'CHL',
|
201 |
+
'CN' => 'CHN',
|
202 |
+
'CX' => 'CXR',
|
203 |
+
'CC' => 'CCK',
|
204 |
+
'CO' => 'COL',
|
205 |
+
'KM' => 'COM',
|
206 |
+
'CG' => 'COG',
|
207 |
+
'CD' => 'COD',
|
208 |
+
'CK' => 'COK',
|
209 |
+
'CR' => 'CRI',
|
210 |
+
'HR' => 'HRV',
|
211 |
+
'CU' => 'CUB',
|
212 |
+
'CY' => 'CYP',
|
213 |
+
'CZ' => 'CZE',
|
214 |
+
'CI' => 'CIV',
|
215 |
+
'DK' => 'DNK',
|
216 |
+
'DJ' => 'DJI',
|
217 |
+
'DM' => 'DMA',
|
218 |
+
'DO' => 'DOM',
|
219 |
+
'EC' => 'ECU',
|
220 |
+
'EG' => 'EGY',
|
221 |
+
'SV' => 'SLV',
|
222 |
+
'GQ' => 'GNQ',
|
223 |
+
'ER' => 'ERI',
|
224 |
+
'EE' => 'EST',
|
225 |
+
'ET' => 'ETH',
|
226 |
+
'FK' => 'FLK',
|
227 |
+
'FO' => 'FRO',
|
228 |
+
'FJ' => 'FJI',
|
229 |
+
'FI' => 'FIN',
|
230 |
+
'GF' => 'GUF',
|
231 |
+
'PF' => 'PYF',
|
232 |
+
'TF' => 'ATF',
|
233 |
+
'GA' => 'GAB',
|
234 |
+
'GM' => 'GMB',
|
235 |
+
'GE' => 'GEO',
|
236 |
+
'DE' => 'DEU',
|
237 |
+
'GH' => 'GHA',
|
238 |
+
'GI' => 'GIB',
|
239 |
+
'GR' => 'GRC',
|
240 |
+
'GL' => 'GRL',
|
241 |
+
'GD' => 'GRD',
|
242 |
+
'GP' => 'GLP',
|
243 |
+
'GU' => 'GUM',
|
244 |
+
'GT' => 'GTM',
|
245 |
+
'GG' => 'GGY',
|
246 |
+
'GN' => 'GIN',
|
247 |
+
'GW' => 'GNB',
|
248 |
+
'GY' => 'GUY',
|
249 |
+
'HT' => 'HTI',
|
250 |
+
'HM' => 'HMD',
|
251 |
+
'HN' => 'HND',
|
252 |
+
'HK' => 'HKG',
|
253 |
+
'HU' => 'HUN',
|
254 |
+
'IS' => 'ISL',
|
255 |
+
'IN' => 'IND',
|
256 |
+
'ID' => 'IDN',
|
257 |
+
'IR' => 'IRN',
|
258 |
+
'IQ' => 'IRQ',
|
259 |
+
'IE' => 'IRL',
|
260 |
+
'IM' => 'IMN',
|
261 |
+
'IL' => 'ISR',
|
262 |
+
'IT' => 'ITA',
|
263 |
+
'JM' => 'JAM',
|
264 |
+
'JP' => 'JPN',
|
265 |
+
'JE' => 'JEY',
|
266 |
+
'JO' => 'JOR',
|
267 |
+
'KZ' => 'KAZ',
|
268 |
+
'KE' => 'KEN',
|
269 |
+
'KI' => 'KIR',
|
270 |
+
'KW' => 'KWT',
|
271 |
+
'KG' => 'KGZ',
|
272 |
+
'LA' => 'LAO',
|
273 |
+
'LV' => 'LVA',
|
274 |
+
'LB' => 'LBN',
|
275 |
+
'LS' => 'LSO',
|
276 |
+
'LR' => 'LBR',
|
277 |
+
'LY' => 'LBY',
|
278 |
+
'LI' => 'LIE',
|
279 |
+
'LT' => 'LTU',
|
280 |
+
'LU' => 'LUX',
|
281 |
+
'MO' => 'MAC',
|
282 |
+
'MK' => 'MKD',
|
283 |
+
'MG' => 'MDG',
|
284 |
+
'MW' => 'MWI',
|
285 |
+
'MY' => 'MYS',
|
286 |
+
'MV' => 'MDV',
|
287 |
+
'ML' => 'MLI',
|
288 |
+
'MT' => 'MLT',
|
289 |
+
'MH' => 'MHL',
|
290 |
+
'MQ' => 'MTQ',
|
291 |
+
'MR' => 'MRT',
|
292 |
+
'MU' => 'MUS',
|
293 |
+
'YT' => 'MYT',
|
294 |
+
'MX' => 'MEX',
|
295 |
+
'FM' => 'FSM',
|
296 |
+
'MD' => 'MDA',
|
297 |
+
'MC' => 'MCO',
|
298 |
+
'MN' => 'MNG',
|
299 |
+
'ME' => 'MNE',
|
300 |
+
'MS' => 'MSR',
|
301 |
+
'MA' => 'MAR',
|
302 |
+
'MZ' => 'MOZ',
|
303 |
+
'MM' => 'MMR',
|
304 |
+
'NA' => 'NAM',
|
305 |
+
'NR' => 'NRU',
|
306 |
+
'NP' => 'NPL',
|
307 |
+
'NL' => 'NLD',
|
308 |
+
'AN' => 'ANT',
|
309 |
+
'NC' => 'NCL',
|
310 |
+
'NZ' => 'NZL',
|
311 |
+
'NI' => 'NIC',
|
312 |
+
'NE' => 'NER',
|
313 |
+
'NG' => 'NGA',
|
314 |
+
'NU' => 'NIU',
|
315 |
+
'NF' => 'NFK',
|
316 |
+
'KP' => 'PRK',
|
317 |
+
'MP' => 'MNP',
|
318 |
+
'NO' => 'NOR',
|
319 |
+
'OM' => 'OMN',
|
320 |
+
'PK' => 'PAK',
|
321 |
+
'PW' => 'PLW',
|
322 |
+
'PS' => 'PSE',
|
323 |
+
'PA' => 'PAN',
|
324 |
+
'PG' => 'PNG',
|
325 |
+
'PY' => 'PRY',
|
326 |
+
'PE' => 'PER',
|
327 |
+
'PH' => 'PHL',
|
328 |
+
'PN' => 'PCN',
|
329 |
+
'PL' => 'POL',
|
330 |
+
'PT' => 'PRT',
|
331 |
+
'PR' => 'PRI',
|
332 |
+
'QA' => 'QAT',
|
333 |
+
'RO' => 'ROU',
|
334 |
+
'RU' => 'RUS',
|
335 |
+
'RW' => 'RWA',
|
336 |
+
'RE' => 'REU',
|
337 |
+
'BL' => 'BLM',
|
338 |
+
'SH' => 'SHN',
|
339 |
+
'KN' => 'KNA',
|
340 |
+
'LC' => 'LCA',
|
341 |
+
'MF' => 'MAF',
|
342 |
+
'PM' => 'SPM',
|
343 |
+
'VC' => 'VCT',
|
344 |
+
'WS' => 'WSM',
|
345 |
+
'SM' => 'SMR',
|
346 |
+
'SA' => 'SAU',
|
347 |
+
'SN' => 'SEN',
|
348 |
+
'RS' => 'SRB',
|
349 |
+
'SC' => 'SYC',
|
350 |
+
'SL' => 'SLE',
|
351 |
+
'SG' => 'SGP',
|
352 |
+
'SK' => 'SVK',
|
353 |
+
'SI' => 'SVN',
|
354 |
+
'SB' => 'SLB',
|
355 |
+
'SO' => 'SOM',
|
356 |
+
'ZA' => 'ZAF',
|
357 |
+
'GS' => 'SGS',
|
358 |
+
'KR' => 'KOR',
|
359 |
+
'ES' => 'ESP',
|
360 |
+
'LK' => 'LKA',
|
361 |
+
'SD' => 'SDN',
|
362 |
+
'SR' => 'SUR',
|
363 |
+
'SJ' => 'SJM',
|
364 |
+
'SZ' => 'SWZ',
|
365 |
+
'SE' => 'SWE',
|
366 |
+
'CH' => 'CHE',
|
367 |
+
'SY' => 'SYR',
|
368 |
+
'ST' => 'STP',
|
369 |
+
'TW' => 'TWN',
|
370 |
+
'TJ' => 'TJK',
|
371 |
+
'TZ' => 'TZA',
|
372 |
+
'TH' => 'THA',
|
373 |
+
'TL' => 'TLS',
|
374 |
+
'TG' => 'TGO',
|
375 |
+
'TK' => 'TKL',
|
376 |
+
'TO' => 'TON',
|
377 |
+
'TT' => 'TTO',
|
378 |
+
'TN' => 'TUN',
|
379 |
+
'TR' => 'TUR',
|
380 |
+
'TM' => 'TKM',
|
381 |
+
'TC' => 'TCA',
|
382 |
+
'TV' => 'TUV',
|
383 |
+
'UM' => 'UMI',
|
384 |
+
'VI' => 'VIR',
|
385 |
+
'UG' => 'UGA',
|
386 |
+
'UA' => 'UKR',
|
387 |
+
'AE' => 'ARE',
|
388 |
+
'GB' => 'GBR',
|
389 |
+
'US' => 'USA',
|
390 |
+
'UY' => 'URY',
|
391 |
+
'UZ' => 'UZB',
|
392 |
+
'VU' => 'VUT',
|
393 |
+
'VA' => 'VAT',
|
394 |
+
'VE' => 'VEN',
|
395 |
+
'VN' => 'VNM',
|
396 |
+
'WF' => 'WLF',
|
397 |
+
'EH' => 'ESH',
|
398 |
+
'YE' => 'YEM',
|
399 |
+
'ZM' => 'ZMB',
|
400 |
+
'ZW' => 'ZWE',
|
401 |
+
'AX' => 'ALA');
|
402 |
+
|
403 |
+
if (isset($countryCodes[$countryId])) {
|
404 |
+
return $countryCodes[$countryId];
|
405 |
+
} else {
|
406 |
+
return 'FRA';
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Api/Methods.php
ADDED
@@ -0,0 +1,106 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Api_Methods extends TSI_Yesbycash_Model_Api_Service {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* get the outlet list with api yesbycash
|
7 |
+
*
|
8 |
+
* @param type $zipCode
|
9 |
+
* @param type $countryId
|
10 |
+
* @return type
|
11 |
+
*/
|
12 |
+
public function getOutletsList($zipCode, $countryId) {
|
13 |
+
$params = array(
|
14 |
+
'zipcode' => $zipCode,
|
15 |
+
'country' => $countryId,
|
16 |
+
'merchantid' => $this->_merchantId,
|
17 |
+
'keyid' => $this->_merchantKey);
|
18 |
+
|
19 |
+
$args = $this->hmacCalculation($params);
|
20 |
+
|
21 |
+
return $this->call('getOutletsList', $args);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Create an order with all necessary param
|
26 |
+
*
|
27 |
+
* @param type $customerId
|
28 |
+
* @param type $amount
|
29 |
+
* @param type $currency
|
30 |
+
* @param type $reference
|
31 |
+
* @param type $buyerEmail
|
32 |
+
* @param type $buyerFName
|
33 |
+
* @param type $buyerLName
|
34 |
+
* @param type $buyerPhone
|
35 |
+
* @param type $buyerMobile
|
36 |
+
* @param type $buyerAddress
|
37 |
+
* @param type $buyerCity
|
38 |
+
* @param type $buyerCountry
|
39 |
+
* @param type $buyerZip
|
40 |
+
* @param type $selectedOutlet
|
41 |
+
* @return type
|
42 |
+
*/
|
43 |
+
public function createOrder($customerId, $amount, $currency, $reference, $buyerEmail, $buyerFName, $buyerLName, $buyerPhone, $buyerMobile, $buyerAddress, $buyerCity, $buyerCountry, $buyerZip, $selectedOutlet) {
|
44 |
+
$params = array(
|
45 |
+
'customerid' => $customerId,
|
46 |
+
'amount' => $amount,
|
47 |
+
'currency' => $currency,
|
48 |
+
'reference' => $reference,
|
49 |
+
'buyeremail' => $buyerEmail,
|
50 |
+
'buyerfname' => $buyerFName,
|
51 |
+
'buyerlname' => $buyerLName,
|
52 |
+
'buyerphone' => $buyerPhone,
|
53 |
+
'buyermobile' => $buyerMobile,
|
54 |
+
'buyeraddress' => $buyerAddress,
|
55 |
+
'buyercity' => $buyerCity,
|
56 |
+
'buyercountry' => $buyerCountry,
|
57 |
+
'buyerzip' => $buyerZip,
|
58 |
+
'selectedoutlet' => $selectedOutlet);
|
59 |
+
|
60 |
+
$params['urlok'] = Mage::getUrl('checkout/onepage/success', array('_secure' => true));
|
61 |
+
//$params['urlnok'] = Mage::getUrl('checkout/onepage/failure', array('_secure' => true));
|
62 |
+
$params['urlnok'] = Mage::getUrl('tsi_yesbycash/ipn/s2s/reference/' . $reference);
|
63 |
+
$params['urls2s'] = Mage::getUrl('tsi_yesbycash/ipn/s2s/reference/' . $reference);
|
64 |
+
$params['urlpaymentupdate'] = Mage::getUrl('tsi_yesbycash/ipn/paymentupdate/reference/' . $reference);
|
65 |
+
|
66 |
+
$params['buyerip'] = Mage::helper('tsi_yesbycash')->getRemoteAddr();
|
67 |
+
|
68 |
+
$args = $this->hmacCalculation($params);
|
69 |
+
|
70 |
+
return $this->call('createOrder', $args);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Update the state to the order distant (yesbycash api)
|
75 |
+
*
|
76 |
+
* @param type $barCode
|
77 |
+
* @param type $status
|
78 |
+
* @param type $reason
|
79 |
+
* @return type
|
80 |
+
*/
|
81 |
+
public function updateOrder($barCode, $status, $reason) {
|
82 |
+
$params = array(
|
83 |
+
'barcode' => $barCode,
|
84 |
+
'status' => $status,
|
85 |
+
'reason' => $reason);
|
86 |
+
|
87 |
+
$args = $this->hmacCalculation($params);
|
88 |
+
|
89 |
+
return $this->call('updateOrder', $args);
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get the distant order yesbycash
|
94 |
+
*
|
95 |
+
* @param type $barCode
|
96 |
+
* @return type
|
97 |
+
*/
|
98 |
+
public function getOrder($barCode) {
|
99 |
+
$params = array('barcode' => $barCode);
|
100 |
+
|
101 |
+
$args = $this->hmacCalculation($params);
|
102 |
+
|
103 |
+
return $this->call('getOrder', $args);
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Api/Response.php
ADDED
@@ -0,0 +1,113 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Api_Response extends Varien_Object {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Not used
|
7 |
+
*
|
8 |
+
* @var type
|
9 |
+
*/
|
10 |
+
protected $_responseCode = array(
|
11 |
+
00000 => 'OK Method was succesful',
|
12 |
+
00001 => 'Authentication required',
|
13 |
+
01001 => 'Missing signature',
|
14 |
+
01002 => 'Invalid signature',
|
15 |
+
01003 => 'Missing merchant identifier',
|
16 |
+
01004 => 'Invalid merchant identifier',
|
17 |
+
01005 => 'Missing parameter customerid',
|
18 |
+
01006 => 'Invalid parameter customerid',
|
19 |
+
01007 => 'Missing transaction identifier',
|
20 |
+
01008 => 'Invalid transaction identifier',
|
21 |
+
01009 => 'Missing amount',
|
22 |
+
01010 => 'Invalid amount',
|
23 |
+
01011 => 'Missing currency',
|
24 |
+
01012 => 'Invalid currency',
|
25 |
+
01013 => 'Missing key identifier (keyid)',
|
26 |
+
01014 => 'Invalid key identifier (keyid)',
|
27 |
+
01015 => 'Missing timestamp parameter',
|
28 |
+
01016 => 'Missing timestamp parameter',
|
29 |
+
01017 => 'Missing expirytime parameter',
|
30 |
+
01025 => 'Missing buyeremail parameter',
|
31 |
+
01026 => 'Invalid buyeremail parameter',
|
32 |
+
01027 => 'Missing buyeraddress parameter',
|
33 |
+
01028 => 'Invalid buyeraddress parameter',
|
34 |
+
01029 => 'Missing buyercity parameter',
|
35 |
+
01030 => 'Invalid buyercity parameter',
|
36 |
+
01031 => 'Missing buyerzip parameter',
|
37 |
+
01032 => 'Invalid buyerzip parameter',
|
38 |
+
01037 => 'Missing URL OK',
|
39 |
+
01038 => 'Invalid URL OK parameter',
|
40 |
+
01039 => 'Missing URL NOK',
|
41 |
+
01040 => 'Invalid URL NOK parameter',
|
42 |
+
01041 => 'Missing URL S2S',
|
43 |
+
01042 => 'Invalid URL S2S parameter',
|
44 |
+
01043 => 'Missing lname parameter',
|
45 |
+
01044 => 'Invalid lname parameter',
|
46 |
+
01045 => 'Missing fname parameter',
|
47 |
+
01046 => 'Invalid fname parameter',
|
48 |
+
01047 => 'Missing customerip parameter',
|
49 |
+
01048 => 'Invalid customerip parameter',
|
50 |
+
01049 => 'Missing buyercountry parameter',
|
51 |
+
01050 => 'Invalid buyercountry parameter',
|
52 |
+
01051 => 'Missing buyerjob parameter',
|
53 |
+
01052 => 'Invalid buyerjob parameter',
|
54 |
+
01053 => 'Missing buyerbirthdate parameter',
|
55 |
+
01054 => 'Invalid buyerbirthdate parameter',
|
56 |
+
01055 => 'Missing buyerbirthcity parameter',
|
57 |
+
08000 => 'Unreachable Error',
|
58 |
+
01055 => 'Missing buyerbirthcity parameter',
|
59 |
+
01057 => 'Invalid HTTP USER AGENT',
|
60 |
+
01058 => 'Invalid HTTP ACCEPT',
|
61 |
+
01075 => 'Missing zipcode parameter',
|
62 |
+
01082 => 'Invalid barcode parameter',
|
63 |
+
01081 => 'Missing barcode parameter',
|
64 |
+
01076 => 'Invalid zipcode parameter',
|
65 |
+
01079 => 'Missing country parameter',
|
66 |
+
01080 => 'Invalid country parameter',
|
67 |
+
02002 => 'Incorrect merchant identifier',
|
68 |
+
02003 => 'Key identifer not found',
|
69 |
+
02004 => 'Incorrect signature',
|
70 |
+
02009 => 'Currency not available for this merchant',
|
71 |
+
02011 => 'User blacklisted',
|
72 |
+
02014 => 'Canceled: Max number of transactions/card reached',
|
73 |
+
02015 => 'Canceled: Max total amount of transactions/card reached',
|
74 |
+
02016 => 'Canceled: Max number of transactions/email reached',
|
75 |
+
02017 => 'Canceled: Max total amount of transactions/email reached',
|
76 |
+
02018 => 'Canceled: Max number of transactions/customer reached',
|
77 |
+
02019 => 'Canceled: Max total amount of transactions/customer reached',
|
78 |
+
02020 => 'No transaction found',
|
79 |
+
02028 => 'No outlet found',
|
80 |
+
02030 => 'Max total amount of transactions/customer reached',
|
81 |
+
02031 => 'Authentication not confirmed',
|
82 |
+
02101 => 'Technical Error');
|
83 |
+
|
84 |
+
/**
|
85 |
+
*
|
86 |
+
* @return type
|
87 |
+
*/
|
88 |
+
public function isSuccess() {
|
89 |
+
return $this->getErrorcode() == 0000;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
*
|
94 |
+
* @return type
|
95 |
+
*/
|
96 |
+
public function getErrorcode() {
|
97 |
+
return $this->getData('errorcode');
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
*
|
102 |
+
* @return type
|
103 |
+
*/
|
104 |
+
public function getErrormessage() {
|
105 |
+
$errormessage = 'Error';
|
106 |
+
$errorcode = (int) $this->getErrorcode();
|
107 |
+
if (isset($this->_responseCode[$errorcode]))
|
108 |
+
$errormessage = $this->_responseCode[$errorcode];
|
109 |
+
|
110 |
+
return Mage::helper('tsi_yesbycash')->__($errormessage);
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Api/Service.php
ADDED
@@ -0,0 +1,161 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Api_Service {
|
4 |
+
|
5 |
+
protected $_server;
|
6 |
+
protected $_merchantId;
|
7 |
+
protected $_merchantKey;
|
8 |
+
protected $_key;
|
9 |
+
protected $_soapClient;
|
10 |
+
protected $_soapOptions = array();
|
11 |
+
|
12 |
+
const TSI_YESBYCASH_SOAP_VERSION = SOAP_1_1;
|
13 |
+
|
14 |
+
/**
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
public function __construct() {
|
18 |
+
$this->_server = $this->getServer();
|
19 |
+
$this->_merchantId = $this->getMerchantId();
|
20 |
+
$this->_merchantKey = $this->getMerchantKey();
|
21 |
+
$this->_key = $this->getKey();
|
22 |
+
$this->_soapClient = $this->getClient();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
*
|
27 |
+
* @param type $param
|
28 |
+
* @return type
|
29 |
+
*/
|
30 |
+
public function getStoreConfig($param) {
|
31 |
+
return Mage::helper('tsi_yesbycash')->getStoreConfig($param);
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
*
|
36 |
+
* @return type
|
37 |
+
*/
|
38 |
+
public function isTestMode() {
|
39 |
+
return $this->getStoreConfig('mode_test');
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
* @return type
|
45 |
+
*/
|
46 |
+
public function getServer() {
|
47 |
+
if ($this->isTestMode()) {
|
48 |
+
$this->_server = $this->getStoreConfig('server_dev');
|
49 |
+
} else {
|
50 |
+
$this->_server = $this->getStoreConfig('server_prod');
|
51 |
+
}
|
52 |
+
|
53 |
+
return $this->_server;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
*
|
58 |
+
* @return type
|
59 |
+
*/
|
60 |
+
public function getEndpoint() {
|
61 |
+
return $this->getStoreConfig('endpoint');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
*
|
66 |
+
* @return type
|
67 |
+
*/
|
68 |
+
public function getMerchantId() {
|
69 |
+
if (is_null($this->_merchantId))
|
70 |
+
$this->_merchantId = $this->getStoreConfig('merchant_id');
|
71 |
+
|
72 |
+
return $this->_merchantId;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
*
|
77 |
+
* @return type
|
78 |
+
*/
|
79 |
+
public function getMerchantKey() {
|
80 |
+
if (is_null($this->_merchantKey))
|
81 |
+
$this->_merchantKey = $this->getStoreConfig('merchant_key');
|
82 |
+
|
83 |
+
return $this->_merchantKey;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
*
|
88 |
+
* @return type
|
89 |
+
*/
|
90 |
+
public function getKey() {
|
91 |
+
if (is_null($this->_key))
|
92 |
+
$this->_key = $this->getStoreConfig('key');
|
93 |
+
|
94 |
+
return $this->_key;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
*
|
99 |
+
* @return type
|
100 |
+
*/
|
101 |
+
public function getClient() {
|
102 |
+
if (is_null($this->_soapClient)) {
|
103 |
+
$this->_soapOptions = array(
|
104 |
+
'location' => $this->_server,
|
105 |
+
'trace' => 0,
|
106 |
+
'soap_version' => self::TSI_YESBYCASH_SOAP_VERSION);
|
107 |
+
try {
|
108 |
+
$this->_soapClient = new SoapClient($this->_server . $this->getEndpoint(), $this->_soapOptions);
|
109 |
+
} catch (Exception $e) {
|
110 |
+
Mage::throwException($e);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
return $this->_soapClient;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
*
|
119 |
+
* @param type $params
|
120 |
+
* @return type
|
121 |
+
*/
|
122 |
+
protected function hmacCalculation($params) {
|
123 |
+
$timestamp = time();
|
124 |
+
$transactionId = md5($timestamp);
|
125 |
+
|
126 |
+
$str = $this->_merchantId . '#' . $transactionId . '#' . $timestamp;
|
127 |
+
$signature = hash_hmac('sha1', $str, $this->_key);
|
128 |
+
|
129 |
+
$params['transactionid'] = $transactionId;
|
130 |
+
$params['timestamp'] = $timestamp;
|
131 |
+
$params['signature'] = $signature;
|
132 |
+
$params['merchantid'] = $this->_merchantId;
|
133 |
+
$params['keyid'] = $this->_merchantKey;
|
134 |
+
$params['orderTtl'] = null;
|
135 |
+
|
136 |
+
return $params;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
*
|
141 |
+
* @param type $service
|
142 |
+
* @param type $args
|
143 |
+
* @return \Varien_Object
|
144 |
+
*/
|
145 |
+
protected function call($service, $args) {
|
146 |
+
$result = false;
|
147 |
+
try {
|
148 |
+
$result = $this->_soapClient->__soapCall($service, array($args));
|
149 |
+
} catch (SoapFault $sf) {
|
150 |
+
if (!$result) {
|
151 |
+
$result = new Varien_Object();
|
152 |
+
$result->setData('error', true);
|
153 |
+
$result->setData('fault_code', $sf->faultcode);
|
154 |
+
$result->setData('fault_string', $sf->faultstring);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
return $result;
|
159 |
+
}
|
160 |
+
|
161 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Observer.php
ADDED
@@ -0,0 +1,49 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Observer {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @param Varien_Event_Observer $observer
|
8 |
+
* @return \TSI_Yesbycash_Model_Observer
|
9 |
+
*/
|
10 |
+
public function setRedirectUrl(Varien_Event_Observer $observer) {
|
11 |
+
$quote = $observer->getQuote();
|
12 |
+
$redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl();
|
13 |
+
Mage::getSingleton('checkout/type_onepage')->getCheckout()->setRedirectUrl($redirectUrl);
|
14 |
+
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
*
|
20 |
+
* @param Varien_Event_Observer $observer
|
21 |
+
*/
|
22 |
+
public function setOutlet(Varien_Event_Observer $observer) {
|
23 |
+
$outletId = Mage::app()->getRequest()->getPost('ybc_outlet_selecta');
|
24 |
+
Mage::getSingleton('checkout/session')->setOutletId($outletId);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
*
|
29 |
+
* @param Varien_Event_Observer $observer
|
30 |
+
*/
|
31 |
+
public function checkTelephone(Varien_Event_Observer $observer) {
|
32 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
33 |
+
$payment = $quote->getPayment();
|
34 |
+
$method = $payment->getMethod();
|
35 |
+
|
36 |
+
$telephone = $quote->getBillingAddress()->getTelephone();
|
37 |
+
|
38 |
+
if ($method == 'yesbycash_standard') {
|
39 |
+
if (!preg_match('#^(0|\+33)[1-9]([-. ]?[0-9]{2}){4}$#', $telephone)) {
|
40 |
+
Mage::getSingleton('checkout/session')->addError(Mage::helper('tsi_yesbycash')->__('Le numéro de téléphone renseigné n\'est pas correct : ' . $telephone));
|
41 |
+
$quote->setHasError(true);
|
42 |
+
Mage::app()->getResponse()
|
43 |
+
->setHeader('HTTP/1.1', '403 Session Expired')
|
44 |
+
->sendResponse();
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Sales/Order/Creditmemo/Total/Yesbycashfee.php
ADDED
@@ -0,0 +1,26 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Sales_Order_Creditmemo_Total_Yesbycashfee extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
8 |
+
* @return \TSI_Yesbycash_Model_Sales_Order_Creditmemo_Total_Yesbycashfee
|
9 |
+
*/
|
10 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) {
|
11 |
+
$creditmemo->setYesbycashFee(0);
|
12 |
+
$creditmemo->setBaseYesbycashFee(0);
|
13 |
+
|
14 |
+
$amount = $creditmemo->getOrder()->getYesbycashFee();
|
15 |
+
$creditmemo->setYesycashFee($amount);
|
16 |
+
|
17 |
+
$amount = $creditmemo->getOrder()->getBaseYesbycashFee();
|
18 |
+
$creditmemo->setBaseYesbycashFee($amount);
|
19 |
+
|
20 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $creditmemo->getYesbycashFee());
|
21 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $creditmemo->getBasePYesbycashFee());
|
22 |
+
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Sales/Order/Invoice/Total/Yesbycashfee.php
ADDED
@@ -0,0 +1,26 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Sales_Order_Invoice_Total_Yesbycashfee extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
8 |
+
* @return \TSI_Yesbycash_Model_Sales_Order_Invoice_Total_Yesbycashfee
|
9 |
+
*/
|
10 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
|
11 |
+
$invoice->setYesbycashFee(0);
|
12 |
+
$invoice->setBaseYesbycashFee(0);
|
13 |
+
|
14 |
+
$amount = $invoice->getOrder()->getYesbycashFee();
|
15 |
+
$invoice->setYesbycashFee($amount);
|
16 |
+
|
17 |
+
$amount = $invoice->getOrder()->getBaseYesbycashFee();
|
18 |
+
$invoice->setBaseYesbycashFee($amount);
|
19 |
+
|
20 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $invoice->getYesbycashFee());
|
21 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $invoice->getBaseYesbycashFee());
|
22 |
+
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Sales/Quote/Address/Total/Yesbycashfee.php
ADDED
@@ -0,0 +1,77 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Sales_Quote_Address_Total_Yesbycashfee extends Mage_Sales_Model_Quote_Address_Total_Abstract {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
public function __construct() {
|
9 |
+
$this->setCode('yesbycash_fee');
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
*
|
14 |
+
* @return type
|
15 |
+
*/
|
16 |
+
protected function _getHelper() {
|
17 |
+
return Mage::helper('tsi_yesbycash');
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
*
|
22 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
23 |
+
* @return \TSI_Yesbycash_Model_Sales_Quote_Address_Total_Yesbycashfee
|
24 |
+
*/
|
25 |
+
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
26 |
+
$address->setYesbycashFee(0);
|
27 |
+
$address->setBaseYesbycashFee(0);
|
28 |
+
|
29 |
+
if (!$this->_getHelper()->getStoreConfig('yesbycash_fee')) {
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
$items = $address->getAllItems();
|
34 |
+
if (!count($items)) {
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
|
38 |
+
$paymentMethod = $address->getQuote()->getPayment()->getMethod();
|
39 |
+
|
40 |
+
$tax = 0;
|
41 |
+
if (Mage::getStoreConfig('tax/calculation/price_includes_tax') != 1) {
|
42 |
+
$tax = $address->getTaxAmount();
|
43 |
+
}
|
44 |
+
|
45 |
+
if ($paymentMethod) {
|
46 |
+
$baseAmount = $this->_getHelper()->getYesbycashFee($address->getQuote());
|
47 |
+
$amount = Mage::helper('core')->currency($baseAmount, true, false);
|
48 |
+
$address->setYesbycashFee($amount);
|
49 |
+
$address->setBaseYesbycashFee($baseAmount);
|
50 |
+
}
|
51 |
+
|
52 |
+
$address->setGrandTotal($address->getGrandTotal() + $tax + $address->getYesbycashFee());
|
53 |
+
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $tax + $address->getBaseYesbycashFee());
|
54 |
+
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
*
|
60 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
61 |
+
* @return type
|
62 |
+
*/
|
63 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address) {
|
64 |
+
$amount = $address->getYesbycashFee();
|
65 |
+
if (($amount != 0)) {
|
66 |
+
$address->addTotal(array(
|
67 |
+
'code' => $this->getCode(),
|
68 |
+
'title' => Mage::helper('tsi_yesbycash')->__('Frais de service Yesbycash'),
|
69 |
+
'full_info' => array(),
|
70 |
+
'value' => $amount,
|
71 |
+
'base_value' => $amount
|
72 |
+
));
|
73 |
+
}
|
74 |
+
return $amount;
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Source/Yesbycashfeetype.php
ADDED
@@ -0,0 +1,16 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Source_Yesbycashfeetype {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @return type
|
8 |
+
*/
|
9 |
+
public function toOptionArray() {
|
10 |
+
return array(
|
11 |
+
array('value' => 'yesbycash_fee_type_currency', 'label' => Mage::helper('tsi_yesbycash')->__('En monnaie actuelle')),
|
12 |
+
array('value' => 'yesbycash_fee_type_percent', 'label' => Mage::helper('tsi_yesbycash')->__('En pourcentage'))
|
13 |
+
);
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/TSI/Yesbycash/Model/Standard.php
ADDED
@@ -0,0 +1,17 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_Model_Standard extends Mage_Payment_Model_Method_Abstract {
|
4 |
+
|
5 |
+
protected $_code = 'yesbycash_standard';
|
6 |
+
protected $_formBlockType = 'tsi_yesbycash/form_standard';
|
7 |
+
protected $_infoBlockType = 'tsi_yesbycash/info_standard';
|
8 |
+
|
9 |
+
/**
|
10 |
+
*
|
11 |
+
* @return type
|
12 |
+
*/
|
13 |
+
public function getOrderPlaceRedirectUrl() {
|
14 |
+
return Mage::getUrl('tsi_yesbycash/standard/redirect', array('_secure' => true));
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/TSI/Yesbycash/controllers/AjaxController.php
ADDED
@@ -0,0 +1,16 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_AjaxController extends TSI_Yesbycash_Controller_Action {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
public function outletsAction() {
|
9 |
+
$block = $this->getLayout()->createBlock('tsi_yesbycash/form_ajax');
|
10 |
+
$block->setTemplate('yesbycash/payment/form_ajax.phtml');
|
11 |
+
$this->getResponse()
|
12 |
+
->setHeader('Content-Type', 'text/html')
|
13 |
+
->setBody($block->toHtml());
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/TSI/Yesbycash/controllers/IpnController.php
ADDED
@@ -0,0 +1,120 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_IpnController extends TSI_Yesbycash_Controller_Action {
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
public function s2sAction() {
|
9 |
+
$reference = (int) $this->getRequest()->getParam('reference');
|
10 |
+
if ($reference) {
|
11 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($reference);
|
12 |
+
if ($order->getId()) {
|
13 |
+
$api = $this->getApi();
|
14 |
+
$barcode = $order->getYesbycashBarcode();
|
15 |
+
$status = $order->getStatus();
|
16 |
+
$ybcOrder = $api->getOrder($barcode);
|
17 |
+
$statusAndState = $this->_getHelper()->getStatusAndStateByCodeStatus($ybcOrder->orderstatus);
|
18 |
+
$newStatus = $statusAndState[0];
|
19 |
+
$newState = $statusAndState[1];
|
20 |
+
if ($newStatus != $status) {
|
21 |
+
$order->setState($newState, $newStatus, '', true);
|
22 |
+
$order->save();
|
23 |
+
echo 'OK - Order ' . $reference . ' updated (' . $this->_getHelper()->getRemoteAddr() . ') - status : ' . $newStatus . ' - state :' . $newState;
|
24 |
+
} else {
|
25 |
+
echo 'Order already updated';
|
26 |
+
}
|
27 |
+
} else {
|
28 |
+
echo 'Order reference invalid';
|
29 |
+
}
|
30 |
+
} else {
|
31 |
+
echo 'Missing reference';
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
public function paymentupdateAction() {
|
36 |
+
$reference = (int) $this->getRequest()->getParam('reference');
|
37 |
+
if ($reference) {
|
38 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($reference);
|
39 |
+
if ($order->getId()) {
|
40 |
+
$status = $order->getStatus();
|
41 |
+
if ($status != 'complete' && $status != 'processing_yesbycash_paid') {
|
42 |
+
if ($status == 'pending_yesbycash') {
|
43 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
44 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
45 |
+
$invoice->register();
|
46 |
+
|
47 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
48 |
+
->addObject($invoice)
|
49 |
+
->addObject($invoice->getOrder());
|
50 |
+
|
51 |
+
$transactionSave->save();
|
52 |
+
$order->setState('processing', 'processing_yesbycash_paid', '', true);
|
53 |
+
$order->save();
|
54 |
+
echo 'OK - Order ' . $reference . ' updated (' . $this->_getHelper()->getRemoteAddr() . ') - status : processing_yesbycash_paid - state : processing';
|
55 |
+
} else {
|
56 |
+
echo 'Operation denied';
|
57 |
+
}
|
58 |
+
} else {
|
59 |
+
echo 'Order already paid';
|
60 |
+
}
|
61 |
+
} else {
|
62 |
+
echo 'Order reference invalid';
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
echo 'Missing reference';
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
public function cancelAction() {
|
70 |
+
$orderId = (int) $this->getRequest()->getParam('order_id');
|
71 |
+
if ($orderId) {
|
72 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
73 |
+
if ($order->getId()) {
|
74 |
+
$status = $order->getStatus();
|
75 |
+
if ($status != 'complete' && $status != 'processing_yesbycash_paid') {
|
76 |
+
if ($status == 'pending_yesbycash') {
|
77 |
+
$api = $this->getApi();
|
78 |
+
$barcode = $order->getYesbycashBarcode();
|
79 |
+
$ybcOrder = $api->getOrder($barcode);
|
80 |
+
$statusAndState = $this->_getHelper()->getStatusAndStateByCodeStatus($ybcOrder->orderstatus);
|
81 |
+
$newStatus = $statusAndState[0];
|
82 |
+
if ($status == $newStatus) {
|
83 |
+
$order->setState('canceled', 'canceled', '', true);
|
84 |
+
$order->save();
|
85 |
+
$api->updateOrder($barcode, 6, 'Canceled by customer');
|
86 |
+
Mage::getSingleton('core/session')->addSuccess($this->__('Votre commande est annulée'));
|
87 |
+
} else {
|
88 |
+
Mage::getSingleton('core/session')->addError($this->__('Votre commande est déjà annulée'));
|
89 |
+
}
|
90 |
+
} elseif ($status == 'canceled') {
|
91 |
+
Mage::getSingleton('core/session')->addError($this->__('Votre commande est déjà annulée'));
|
92 |
+
} else {
|
93 |
+
Mage::getSingleton('core/session')->addError($this->__('Opération non permise'));
|
94 |
+
}
|
95 |
+
} else {
|
96 |
+
Mage::getSingleton('core/session')->addError($this->__('Commande déjà payée'));
|
97 |
+
}
|
98 |
+
|
99 |
+
$this->_redirect('sales/order/view', array('order_id' => $orderId));
|
100 |
+
return;
|
101 |
+
} else {
|
102 |
+
Mage::getSingleton('core/session')->addError($this->__('Numéro de commande invalide'));
|
103 |
+
}
|
104 |
+
} else {
|
105 |
+
Mage::getSingleton('core/session')->addError($this->__('Numéro de commande invalide ou non présent'));
|
106 |
+
}
|
107 |
+
$this->_redirect('sales/order/view');
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
*
|
113 |
+
* @return type
|
114 |
+
*/
|
115 |
+
|
116 |
+
protected function getApi() {
|
117 |
+
return Mage::getModel('tsi_yesbycash/api_methods');
|
118 |
+
}
|
119 |
+
|
120 |
+
}
|
app/code/community/TSI/Yesbycash/controllers/StandardController.php
ADDED
@@ -0,0 +1,5 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TSI_Yesbycash_StandardController extends TSI_Yesbycash_Controller_Action {
|
4 |
+
|
5 |
+
}
|
app/code/community/TSI/Yesbycash/etc/config.xml
ADDED
@@ -0,0 +1,267 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<TSI_Yesbycash>
|
5 |
+
<version>0.1.2</version>
|
6 |
+
</TSI_Yesbycash>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<tsi_yesbycash>
|
11 |
+
<class>TSI_Yesbycash_Block</class>
|
12 |
+
</tsi_yesbycash>
|
13 |
+
</blocks>
|
14 |
+
<blocks>
|
15 |
+
<tsi_yesbycash>
|
16 |
+
<class>TSI_Yesbycash_Block</class>
|
17 |
+
</tsi_yesbycash>
|
18 |
+
<sales>
|
19 |
+
<rewrite>
|
20 |
+
<order_totals>TSI_Yesbycash_Block_Sales_Order_Totals</order_totals>
|
21 |
+
<order_invoice_totals>TSI_Yesbycash_Block_Sales_Order_Invoice_Totals</order_invoice_totals>
|
22 |
+
<order_creditmemo_totals>TSI_Yesbycash_Block_Sales_Order_Creditmemo_Totals</order_creditmemo_totals>
|
23 |
+
</rewrite>
|
24 |
+
</sales>
|
25 |
+
<adminhtml>
|
26 |
+
<rewrite>
|
27 |
+
<sales_totals>TSI_Yesbycash_Block_Adminhtml_Sales_Totals</sales_totals>
|
28 |
+
<sales_order_totals>TSI_Yesbycash_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
|
29 |
+
<sales_order_invoice_totals>TSI_Yesbycash_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
|
30 |
+
<sales_order_creditmemo_totals>TSI_Yesbycash_Block_Adminhtml_Sales_Order_Creditmemo_Totals</sales_order_creditmemo_totals>
|
31 |
+
</rewrite>
|
32 |
+
</adminhtml>
|
33 |
+
</blocks>
|
34 |
+
<models>
|
35 |
+
<tsi_yesbycash>
|
36 |
+
<class>TSI_Yesbycash_Model</class>
|
37 |
+
<resourceModel>tsi_yesbycash_setup</resourceModel>
|
38 |
+
</tsi_yesbycash>
|
39 |
+
</models>
|
40 |
+
<resources>
|
41 |
+
<tsi_yesbycash_setup>
|
42 |
+
<setup>
|
43 |
+
<module>TSI_Yesbycash</module>
|
44 |
+
<class>Mage_Sales_Model_Mysql4_Setup</class>
|
45 |
+
</setup>
|
46 |
+
<connection>
|
47 |
+
<use>core_setup</use>
|
48 |
+
</connection>
|
49 |
+
</tsi_yesbycash_setup>
|
50 |
+
<tsi_yesbycash_write>
|
51 |
+
<connection>
|
52 |
+
<use>core_write</use>
|
53 |
+
</connection>
|
54 |
+
</tsi_yesbycash_write>
|
55 |
+
<tsi_yesbycash_read>
|
56 |
+
<connection>
|
57 |
+
<use>core_read</use>
|
58 |
+
</connection>
|
59 |
+
</tsi_yesbycash_read>
|
60 |
+
</resources>
|
61 |
+
<helpers>
|
62 |
+
<tsi_yesbycash>
|
63 |
+
<class>TSI_Yesbycash_Helper</class>
|
64 |
+
</tsi_yesbycash>
|
65 |
+
</helpers>
|
66 |
+
<fieldsets>
|
67 |
+
<sales_convert_quote_address>
|
68 |
+
<yesbycash_fee>
|
69 |
+
<to_order>*</to_order>
|
70 |
+
</yesbycash_fee>
|
71 |
+
<yesbycash_fee>
|
72 |
+
<to_order>*</to_order>
|
73 |
+
</yesbycash_fee>
|
74 |
+
</sales_convert_quote_address>
|
75 |
+
</fieldsets>
|
76 |
+
<sales>
|
77 |
+
<order>
|
78 |
+
<statuses>
|
79 |
+
<pending_yesbycash translate="label">
|
80 |
+
<label>En attente de paiement</label>
|
81 |
+
</pending_yesbycash>
|
82 |
+
<pending_yesbycash_auth translate="label">
|
83 |
+
<label>En attente de l'authentification</label>
|
84 |
+
</pending_yesbycash_auth>
|
85 |
+
<canceled_yesbycash_refused translate="label">
|
86 |
+
<label>Refusé</label>
|
87 |
+
</canceled_yesbycash_refused>
|
88 |
+
<canceled_yesbycash_expired translate="label">
|
89 |
+
<label>Expiré</label>
|
90 |
+
</canceled_yesbycash_expired>
|
91 |
+
<processing_yesbycash_paid translate="label">
|
92 |
+
<label>Payé</label>
|
93 |
+
</processing_yesbycash_paid>
|
94 |
+
</statuses>
|
95 |
+
<states>
|
96 |
+
<pending_payment>
|
97 |
+
<statuses>
|
98 |
+
<pending_yesbycash/>
|
99 |
+
<pending_yesbycash_auth/>
|
100 |
+
</statuses>
|
101 |
+
<visible_on_front>1</visible_on_front>
|
102 |
+
</pending_payment>
|
103 |
+
<canceled>
|
104 |
+
<statuses>
|
105 |
+
<canceled_yesbycash_refused/>
|
106 |
+
<canceled_yesbycash_expired/>
|
107 |
+
</statuses>
|
108 |
+
</canceled>
|
109 |
+
<processing>
|
110 |
+
<statuses>
|
111 |
+
<processing_yesbycash_paid/>
|
112 |
+
</statuses>
|
113 |
+
</processing>
|
114 |
+
</states>
|
115 |
+
</order>
|
116 |
+
<quote>
|
117 |
+
<totals>
|
118 |
+
<yesbycash_fee>
|
119 |
+
<class>tsi_yesbycash/sales_quote_address_total_yesbycashfee</class>
|
120 |
+
<after>subtotal,discount,shipping,tax</after>
|
121 |
+
<before>grand_total</before>
|
122 |
+
</yesbycash_fee>
|
123 |
+
</totals>
|
124 |
+
</quote>
|
125 |
+
<order_invoice>
|
126 |
+
<totals>
|
127 |
+
<yesbycash_fee>
|
128 |
+
<class>tsi_yesbycash/sales_order_invoice_total_yesbycashfee</class>
|
129 |
+
</yesbycash_fee>
|
130 |
+
</totals>
|
131 |
+
</order_invoice>
|
132 |
+
<order_creditmemo>
|
133 |
+
<totals>
|
134 |
+
<yesbycash_fee>
|
135 |
+
<class>tsi_yesbycash/sales_order_creditmemo_total_yesbycashfee</class>
|
136 |
+
</yesbycash_fee>
|
137 |
+
</totals>
|
138 |
+
</order_creditmemo>
|
139 |
+
</sales>
|
140 |
+
<pdf>
|
141 |
+
<totals>
|
142 |
+
<yesbycash_fee translate="title">
|
143 |
+
<title>Frais de service Yesbycash</title>
|
144 |
+
<source_field>yesbycash_fee</source_field>
|
145 |
+
<amount_prefix></amount_prefix>
|
146 |
+
<font_size>7</font_size>
|
147 |
+
<display_zero>0</display_zero>
|
148 |
+
<sort_order>200</sort_order>
|
149 |
+
</yesbycash_fee>
|
150 |
+
</totals>
|
151 |
+
</pdf>
|
152 |
+
</global>
|
153 |
+
<frontend>
|
154 |
+
<routers>
|
155 |
+
<tsi_yesbycash>
|
156 |
+
<use>standard</use>
|
157 |
+
<args>
|
158 |
+
<module>TSI_Yesbycash</module>
|
159 |
+
<frontName>tsi_yesbycash</frontName>
|
160 |
+
</args>
|
161 |
+
</tsi_yesbycash>
|
162 |
+
</routers>
|
163 |
+
<layout>
|
164 |
+
<updates>
|
165 |
+
<tsi_yesbycash>
|
166 |
+
<file>yesbycash.xml</file>
|
167 |
+
</tsi_yesbycash>
|
168 |
+
</updates>
|
169 |
+
</layout>
|
170 |
+
<translate>
|
171 |
+
<modules>
|
172 |
+
<TSI_Yesbycash>
|
173 |
+
<files>
|
174 |
+
<default>TSI_Yesbycash.csv</default>
|
175 |
+
</files>
|
176 |
+
</TSI_Yesbycash>
|
177 |
+
</modules>
|
178 |
+
</translate>
|
179 |
+
<events>
|
180 |
+
<controller_action_predispatch_checkout_onepage_savePayment>
|
181 |
+
<observers>
|
182 |
+
<tsi_yesbycash_setoutlet>
|
183 |
+
<type>singleton</type>
|
184 |
+
<class>TSI_Yesbycash_Model_Observer</class>
|
185 |
+
<method>setOutlet</method>
|
186 |
+
</tsi_yesbycash_setoutlet>
|
187 |
+
</observers>
|
188 |
+
</controller_action_predispatch_checkout_onepage_savePayment>
|
189 |
+
<controller_action_postdispatch_checkout_onepage_savePayment>
|
190 |
+
<observers>
|
191 |
+
<tsi_yesbycash_checktelephone>
|
192 |
+
<type>singleton</type>
|
193 |
+
<class>TSI_Yesbycash_Model_Observer</class>
|
194 |
+
<method>checkTelephone</method>
|
195 |
+
</tsi_yesbycash_checktelephone>
|
196 |
+
</observers>
|
197 |
+
</controller_action_postdispatch_checkout_onepage_savePayment>
|
198 |
+
<checkout_submit_all_after>
|
199 |
+
<observers>
|
200 |
+
<tsi_yesbycash_redirect_url>
|
201 |
+
<type>singleton</type>
|
202 |
+
<class>TSI_Yesbycash_Model_Observer</class>
|
203 |
+
<method>setRedirectUrl</method>
|
204 |
+
</tsi_yesbycash_redirect_url>
|
205 |
+
</observers>
|
206 |
+
</checkout_submit_all_after>
|
207 |
+
</events>
|
208 |
+
</frontend>
|
209 |
+
<adminhtml>
|
210 |
+
<translate>
|
211 |
+
<modules>
|
212 |
+
<TSI_Yesbycash>
|
213 |
+
<files>
|
214 |
+
<default>TSI_Yesbycash.csv</default>
|
215 |
+
</files>
|
216 |
+
</TSI_Yesbycash>
|
217 |
+
</modules>
|
218 |
+
</translate>
|
219 |
+
<acl>
|
220 |
+
<resources>
|
221 |
+
<admin>
|
222 |
+
<children>
|
223 |
+
<system>
|
224 |
+
<children>
|
225 |
+
<config>
|
226 |
+
<children>
|
227 |
+
<payment>
|
228 |
+
<children>
|
229 |
+
<yesbycash_standard translate="title">
|
230 |
+
<title>Yesbycash</title>
|
231 |
+
</yesbycash_standard>
|
232 |
+
</children>
|
233 |
+
</payment>
|
234 |
+
</children>
|
235 |
+
</config>
|
236 |
+
</children>
|
237 |
+
</system>
|
238 |
+
</children>
|
239 |
+
</admin>
|
240 |
+
</resources>
|
241 |
+
</acl>
|
242 |
+
</adminhtml>
|
243 |
+
<default>
|
244 |
+
<payment>
|
245 |
+
<yesbycash_standard>
|
246 |
+
<active>1</active>
|
247 |
+
<model>tsi_yesbycash/standard</model>
|
248 |
+
<server_dev>https://yesbycash.test.tsipayment.net</server_dev>
|
249 |
+
<server_prod>https://yesbycash.tsipayment.net</server_prod>
|
250 |
+
<allowed_ips>89.224.17.108,89.30.106.0,89.30.106.1,89.30.106.2,89.30.106.3,89.30.106.4,89.30.106.5,89.30.106.6,89.30.106.7,89.30.106.8,89.30.106.9,89.30.106.10,89.30.106.11,89.30.106.12,89.30.106.13,89.30.106.14,89.30.106.15,89.30.106.16,89.30.106.17,89.30.106.18,89.30.106.19,89.30.106.20,89.30.106.21,89.30.106.22,89.30.106.23,89.30.106.24,89.30.106.233,89.30.106.246,89.30.106.214,194.206.43.233,46.255.181.162,89.224.17.108</allowed_ips>
|
251 |
+
<endpoint>?wsdl</endpoint>
|
252 |
+
<title>Payer avec Yesbycash</title>
|
253 |
+
<merchant_id></merchant_id>
|
254 |
+
<merchant_key></merchant_key>
|
255 |
+
<merchant_key></merchant_key>
|
256 |
+
<key></key>
|
257 |
+
<allowspecific>1</allowspecific>
|
258 |
+
<specificcountry>FR</specificcountry>
|
259 |
+
<yesbycash_fee>0</yesbycash_fee>
|
260 |
+
<yesbycash_fee_type>yesbycash_fee_type_currency</yesbycash_fee_type>
|
261 |
+
<yesbycash_fee_value></yesbycash_fee_value>
|
262 |
+
<mode_test>0</mode_test>
|
263 |
+
<order_status>pending_yesbycash</order_status>
|
264 |
+
</yesbycash_standard>
|
265 |
+
</payment>
|
266 |
+
</default>
|
267 |
+
</config>
|
app/code/community/TSI/Yesbycash/etc/system.xml
ADDED
@@ -0,0 +1,164 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<yesbycash_standard translate="label" module="tsi_yesbycash">
|
7 |
+
<label>YesByCash</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>100</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<comment>
|
14 |
+
<![CDATA[
|
15 |
+
<span style="font-size:14px">Informations :</span> <br />
|
16 |
+
- Lire le guide d'utilisation du module <a href="http://www.yesbycash.com/doc/Manuel_installation-configuration_yesbycash_magento.pdf" target="_blank">Yesbycash</a>
|
17 |
+
<br /><br />
|
18 |
+
<hr />
|
19 |
+
]]>
|
20 |
+
</comment>
|
21 |
+
<fields>
|
22 |
+
<active translate="label">
|
23 |
+
<label>Activer</label>
|
24 |
+
<frontend_type>select</frontend_type>
|
25 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
26 |
+
<sort_order>10</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</active>
|
31 |
+
<title translate="label">
|
32 |
+
<label>Titre</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>15</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</title>
|
39 |
+
<merchant_id translate="label">
|
40 |
+
<label>Merchant Id</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>16</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</merchant_id>
|
47 |
+
<merchant_key translate="label">
|
48 |
+
<label>Merchant Key</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>17</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</merchant_key>
|
55 |
+
<key translate="label">
|
56 |
+
<label>Key</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>18</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</key>
|
63 |
+
<yesbycash_fee translate="label comment">
|
64 |
+
<label>Tax</label>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
67 |
+
<sort_order>31</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</yesbycash_fee>
|
72 |
+
<yesbycash_fee_type translate="label comment">
|
73 |
+
<label>Tax type</label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<source_model>tsi_yesbycash/source_yesbycashfeetype</source_model>
|
76 |
+
<sort_order>32</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<depends>
|
81 |
+
<yesbycash_fee>1</yesbycash_fee>
|
82 |
+
</depends>
|
83 |
+
</yesbycash_fee_type>
|
84 |
+
<yesbycash_fee_value translate="label comment">
|
85 |
+
<label>Tax value</label>
|
86 |
+
<frontend_type>text</frontend_type>
|
87 |
+
<sort_order>33</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>1</show_in_store>
|
91 |
+
<depends>
|
92 |
+
<yesbycash_fee>1</yesbycash_fee>
|
93 |
+
</depends>
|
94 |
+
</yesbycash_fee_value>
|
95 |
+
<mode_test translate="label comment">
|
96 |
+
<label>Mode test</label>
|
97 |
+
<frontend_type>select</frontend_type>
|
98 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
99 |
+
<sort_order>35</sort_order>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>1</show_in_website>
|
102 |
+
<show_in_store>1</show_in_store>
|
103 |
+
</mode_test>
|
104 |
+
<server translate="label comment">
|
105 |
+
<label>Server</label>
|
106 |
+
<frontend_type>label</frontend_type>
|
107 |
+
<frontend_model>tsi_yesbycash/adminhtml_server</frontend_model>
|
108 |
+
<sort_order>36</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</server>
|
113 |
+
<allowspecific translate="label">
|
114 |
+
<label>Payment from applicable countries</label>
|
115 |
+
<frontend_type>allowspecific</frontend_type>
|
116 |
+
<sort_order>38</sort_order>
|
117 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>1</show_in_store>
|
121 |
+
</allowspecific>
|
122 |
+
<specificcountry translate="label">
|
123 |
+
<label>Payment from Specific countries</label>
|
124 |
+
<frontend_type>multiselect</frontend_type>
|
125 |
+
<sort_order>39</sort_order>
|
126 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>1</show_in_store>
|
130 |
+
<depends>
|
131 |
+
<allowspecific>1</allowspecific>
|
132 |
+
</depends>
|
133 |
+
</specificcountry>
|
134 |
+
<sort_order translate="label">
|
135 |
+
<label>Sort order</label>
|
136 |
+
<frontend_type>text</frontend_type>
|
137 |
+
<sort_order>40</sort_order>
|
138 |
+
<show_in_default>1</show_in_default>
|
139 |
+
<show_in_website>1</show_in_website>
|
140 |
+
<show_in_store>1</show_in_store>
|
141 |
+
</sort_order>
|
142 |
+
</fields>
|
143 |
+
</yesbycash_standard>
|
144 |
+
</groups>
|
145 |
+
</payment>
|
146 |
+
<sales>
|
147 |
+
<groups>
|
148 |
+
<totals_sort translate="label" module="sales">
|
149 |
+
<tab>sales</tab>
|
150 |
+
<fields>
|
151 |
+
<yesbycash_fee translate="label">
|
152 |
+
<label>Frais de service Yesbycash</label>
|
153 |
+
<frontend_type>text</frontend_type>
|
154 |
+
<sort_order>3</sort_order>
|
155 |
+
<show_in_default>1</show_in_default>
|
156 |
+
<show_in_website>1</show_in_website>
|
157 |
+
<show_in_store>1</show_in_store>
|
158 |
+
</yesbycash_fee>
|
159 |
+
</fields>
|
160 |
+
</totals_sort>
|
161 |
+
</groups>
|
162 |
+
</sales>
|
163 |
+
</sections>
|
164 |
+
</config>
|
app/code/community/TSI/Yesbycash/sql/tsi_yesbycash_setup/install-0.1.0.php
ADDED
@@ -0,0 +1,50 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$this->removeAttribute('order', 'yesbycash_barcode');
|
7 |
+
$this->removeAttribute('order', 'yesbycash_status');
|
8 |
+
$this->removeAttribute('order', 'yesbycash_message');
|
9 |
+
$this->removeAttribute('order', 'yesbycash_errorcode');
|
10 |
+
$this->removeAttribute('order', 'yesbycash_outletsid');
|
11 |
+
|
12 |
+
$this->addAttribute('order', 'yesbycash_barcode', array(
|
13 |
+
'type' => 'varchar',
|
14 |
+
'label' => 'Yesbycash Barcode',
|
15 |
+
'visible' => true,
|
16 |
+
'required' => false,
|
17 |
+
'input' => 'text',
|
18 |
+
));
|
19 |
+
|
20 |
+
$this->addAttribute('order', 'yesbycash_status', array(
|
21 |
+
'type' => 'varchar',
|
22 |
+
'label' => 'Yesbycash Status',
|
23 |
+
'visible' => true,
|
24 |
+
'required' => false,
|
25 |
+
'input' => 'text',
|
26 |
+
));
|
27 |
+
|
28 |
+
$this->addAttribute('order', 'yesbycash_message', array(
|
29 |
+
'type' => 'varchar',
|
30 |
+
'label' => 'Yesbycash Message',
|
31 |
+
'visible' => true,
|
32 |
+
'required' => false,
|
33 |
+
'input' => 'text',
|
34 |
+
));
|
35 |
+
|
36 |
+
$this->addAttribute('order', 'yesbycash_errorcode', array(
|
37 |
+
'type' => 'varchar',
|
38 |
+
'label' => 'Yesbycash Errorcode',
|
39 |
+
'visible' => true,
|
40 |
+
'required' => false,
|
41 |
+
'input' => 'text',
|
42 |
+
));
|
43 |
+
|
44 |
+
$this->addAttribute('order', 'yesbycash_outletsid', array(
|
45 |
+
'type' => 'varchar',
|
46 |
+
'label' => 'Yesbycash Outlet id',
|
47 |
+
'visible' => true,
|
48 |
+
'required' => false,
|
49 |
+
'input' => 'text',
|
50 |
+
));
|
app/code/community/TSI/Yesbycash/sql/tsi_yesbycash_setup/upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,53 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$statusTable = $installer->getTable('sales/order_status');
|
6 |
+
$statusStateTable = $installer->getTable('sales/order_status_state');
|
7 |
+
|
8 |
+
$installer->getConnection()->insertArray(
|
9 |
+
$statusTable, array(
|
10 |
+
'status',
|
11 |
+
'label'
|
12 |
+
), array(
|
13 |
+
array('status' => 'pending_yesbycash', 'label' => 'En attente de paiement'),
|
14 |
+
array('status' => 'pending_yesbycash_auth', 'label' => 'En attente de l\'authentification'),
|
15 |
+
array('status' => 'canceled_yesbycash_refused', 'label' => 'Refusé'),
|
16 |
+
array('status' => 'canceled_yesbycash_expired', 'label' => 'Expiré'),
|
17 |
+
array('status' => 'processing_yesbycash_paid', 'label' => 'Payé')
|
18 |
+
)
|
19 |
+
);
|
20 |
+
|
21 |
+
$installer->getConnection()->insertArray(
|
22 |
+
$statusStateTable, array(
|
23 |
+
'status',
|
24 |
+
'state',
|
25 |
+
'is_default'
|
26 |
+
), array(
|
27 |
+
array(
|
28 |
+
'status' => 'pending_yesbycash',
|
29 |
+
'state' => 'pending_payment',
|
30 |
+
'is_default' => 0
|
31 |
+
),
|
32 |
+
array(
|
33 |
+
'status' => 'pending_yesbycash_auth',
|
34 |
+
'state' => 'pending',
|
35 |
+
'is_default' => 0
|
36 |
+
),
|
37 |
+
array(
|
38 |
+
'status' => 'canceled_yesbycash_refused',
|
39 |
+
'state' => 'canceled',
|
40 |
+
'is_default' => 0
|
41 |
+
),
|
42 |
+
array(
|
43 |
+
'status' => 'canceled_yesbycash_expired',
|
44 |
+
'state' => 'canceled',
|
45 |
+
'is_default' => 0
|
46 |
+
),
|
47 |
+
array(
|
48 |
+
'status' => 'processing_yesbycash_paid',
|
49 |
+
'state' => 'processing',
|
50 |
+
'is_default' => 0
|
51 |
+
)
|
52 |
+
)
|
53 |
+
);
|
app/code/community/TSI/Yesbycash/sql/tsi_yesbycash_setup/upgrade-0.1.1-0.1.2.php
ADDED
@@ -0,0 +1,27 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = new Mage_Sales_Model_Resource_Setup();
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
8 |
+
$write->beginTransaction();
|
9 |
+
|
10 |
+
try {
|
11 |
+
$installer->addAttribute('quote_address', 'yesbycash_fee', array('type' => 'decimal'));
|
12 |
+
$installer->addAttribute('quote_address', 'base_yesbycash_fee', array('type' => 'decimal'));
|
13 |
+
|
14 |
+
$installer->addAttribute('order', 'yesbycash_fee', array('type' => 'decimal'));
|
15 |
+
$installer->addAttribute('order', 'base_yesbycash_fee', array('type' => 'decimal'));
|
16 |
+
|
17 |
+
$installer->addAttribute('invoice', 'yesbycash_fee', array('type' => 'decimal'));
|
18 |
+
$installer->addAttribute('invoice', 'base_yesbycash_fee', array('type' => 'decimal'));
|
19 |
+
|
20 |
+
$installer->addAttribute('creditmemo', 'yesbycash_fee', array('type' => 'decimal'));
|
21 |
+
$installer->addAttribute('creditmemo', 'base_yesbycash_fee', array('type' => 'decimal'));
|
22 |
+
|
23 |
+
$write->commit();
|
24 |
+
} catch (Exception $e) {
|
25 |
+
$write->rollback();
|
26 |
+
}
|
27 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/yesbycash.xml
ADDED
@@ -0,0 +1,47 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addItem">
|
6 |
+
<type>skin_css</type>
|
7 |
+
<name>css/yesbycash/yesbycash.css</name>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
</default>
|
11 |
+
<checkout_onepage_index>
|
12 |
+
<reference name="head">
|
13 |
+
<action method="addItem">
|
14 |
+
<type>skin_js</type>
|
15 |
+
<name>js/yesbycash/yesbycash.js</name>
|
16 |
+
</action>
|
17 |
+
<block type="core/text" name="yesbycash.loader.js" before="-">
|
18 |
+
<action method="setText">
|
19 |
+
<text>
|
20 |
+
<![CDATA[<script type="text/javascript" id="tsi_map_ybc_loader" src="//www.yesbycash.com/api/merchant_map/loader.js"></script>]]>
|
21 |
+
</text>
|
22 |
+
</action>
|
23 |
+
</block>
|
24 |
+
</reference>
|
25 |
+
</checkout_onepage_index>
|
26 |
+
<checkout_onepage_success translate="label">
|
27 |
+
<reference name="head">
|
28 |
+
<action method="addItem">
|
29 |
+
<type>skin_js</type>
|
30 |
+
<name>js/yesbycash/yesbycash.js</name>
|
31 |
+
</action>
|
32 |
+
</reference>
|
33 |
+
<reference name="checkout.success">
|
34 |
+
<block type="tsi_yesbycash/onepage_success" name="checkout.success.yesbycash" template="yesbycash/checkout/success.phtml"/>
|
35 |
+
</reference>
|
36 |
+
</checkout_onepage_success>
|
37 |
+
<checkout_onepage_failure translate="label">
|
38 |
+
<reference name="checkout.success">
|
39 |
+
<block type="tsi_yesbycash/onepage_failure" name="checkout.failure.yesbycash" template="yesbycash/checkout/failure.phtml"/>
|
40 |
+
</reference>
|
41 |
+
</checkout_onepage_failure>
|
42 |
+
<sales_order_view>
|
43 |
+
<reference name="sales.order.info.buttons">
|
44 |
+
<block type="tsi_yesbycash/sales_order_cancel" name="order.cancel.yesbycash" as="order_cancel_yesbycash" after="-" template="yesbycash/sales/order/cancel.phtml" />
|
45 |
+
</reference>
|
46 |
+
</sales_order_view>
|
47 |
+
</layout>
|
app/design/frontend/base/default/template/yesbycash/checkout/failure.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php if (strpos($this->getPayment(), 'yesbycash') !== false): ?>
|
2 |
+
<br /><br />
|
3 |
+
<?php echo $this->__("Une erreur est survenue lors de la commande."); ?>
|
4 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/yesbycash/checkout/success.phtml
ADDED
@@ -0,0 +1,10 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php if (strpos($this->getPayment(), 'yesbycash') !== false): ?>
|
2 |
+
<br /><br />
|
3 |
+
<?php echo $this->__("La commande s'est bien déroulée."); ?>
|
4 |
+
<br /><br />
|
5 |
+
<?php echo $this->__("Vous allez recevoir par email le récapitulatif de votre commande YesByCash avec le code barre en pièce jointe à présenter dans le point de paiement."); ?>
|
6 |
+
<br /><br />
|
7 |
+
<?php echo $this->__("Vous pouvez désormais vous rendre au point de paiement choisi pour régler votre commande."); ?> <?php echo Mage::helper('tsi_yesbycash')->getBaseGrandTotal(); ?>
|
8 |
+
<br /><br />
|
9 |
+
<?php echo $this->__("Vous avez la possibilité de payer votre commande dans les points de vente accessibles sur :"); ?> <a href="http://www.yesbycash.com" target="_blank">www.yesbycash.com</a> <?php echo $this->__('rubrique "points de paiement".'); ?>
|
10 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/yesbycash/payment/form.phtml
ADDED
@@ -0,0 +1,137 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php $_code = $this->getMethodCode() ?>
|
2 |
+
<?php $_allowedCountrys = $this->getAllowedCountrys(); ?>
|
3 |
+
<?php $_postcode = $this->getPostcode(); ?>
|
4 |
+
<?php $_countryId = $this->getCountryId(); ?>
|
5 |
+
<?php $_outlets = $this->getOutlets(); ?>
|
6 |
+
<?php $_outletsNbr = count($_outlets); ?>
|
7 |
+
<?php $_ybcFee = $this->getYesbycashFee(); ?>
|
8 |
+
<?php if ($_ybcFee): ?>
|
9 |
+
<p><small><?php echo $this->__('- Frais de service Yesbycash :'); ?> <b><?php echo $this->getYesbycashFee(); ?></b></small></p>
|
10 |
+
<?php endif; ?>
|
11 |
+
<div class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
12 |
+
<div class="ybc_map_container">
|
13 |
+
<div class="ybc_map_header">
|
14 |
+
<img width="168" height="68" src="<?php echo $this->getSkinUrl('images/yesbycash/yesbycash_logo.png') ?>" alt="Logo Yes by Cash">
|
15 |
+
<p><?php echo $this->__('Le paiement en cash sur internet'); ?></p>
|
16 |
+
</div>
|
17 |
+
<div class="ybc_map_fields">
|
18 |
+
<div id="ybc_intro_content">
|
19 |
+
<p class="ybc_intro_txt">
|
20 |
+
<?php echo $this->__('Vous avez la possibilité de <b>payer votre commande</b> dans les points de vente accessibles sur :'); ?>
|
21 |
+
<b>
|
22 |
+
<a target="_blank" href="http://www.yesbycash.com">www.yesbycash.com</a>
|
23 |
+
</b>
|
24 |
+
rubrique "points de paiement".
|
25 |
+
<br />
|
26 |
+
<?php echo $this->__('Cependant, nous vous recommandons de vous assurer au préalable qu\'un point de paiement est disponible dans la ville de votre choix.'); ?>
|
27 |
+
</p>
|
28 |
+
<p>
|
29 |
+
<i><?php echo $this->__('Il vous sera toujours possible de régler votre commande dans un autre point de paiement YesByCash'); ?></i>
|
30 |
+
</p>
|
31 |
+
</div>
|
32 |
+
<div id="ybc_outlet_fields">
|
33 |
+
<h4 class="ybc_center_txt"><?php echo $this->__('Je sélectionne un point de paiement :'); ?></h4>
|
34 |
+
<div class="ybc_form">
|
35 |
+
<label for="ybc_map_department"><?php echo $this->__('Code postal'); ?> :</label>
|
36 |
+
<input type="text" value="<?php echo $_postcode; ?>" id="ybc_map_department" class="ybc_input">
|
37 |
+
<select name="ybc_map_country" id="ybc_map_country">
|
38 |
+
<option value="<?php echo $_countryId; ?>"><?php echo $_allowedCountrys[$_countryId]; ?></option>
|
39 |
+
<?php
|
40 |
+
unset($_allowedCountrys[$_countryId]);
|
41 |
+
foreach ($_allowedCountrys as $countryId => $countryName):
|
42 |
+
?>
|
43 |
+
<option value="<?php echo $countryId; ?>"><?php echo $countryName; ?></option>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
</select>
|
46 |
+
<button type="button" onclick="yesbycash.clickForMap()" id="ybc_map_submit" name="ybc_map_submit" class="ybc_btn ybc_btn_submit ybc_input"><?php echo $this->__('Rechercher'); ?></button>
|
47 |
+
<img id="ybc_loader_search" src="<?php echo $this->getSkinUrl('images/yesbycash/ybc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Veuillez patienter'); ?>" title="<?php echo $this->__('Veuillez patienter'); ?>"/>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
<div id="part-for-ajax">
|
53 |
+
<?php if ($_outletsNbr == 0): ?>
|
54 |
+
<h3 class="ybc_outlet_found">
|
55 |
+
<?php echo $this->__('Nous avons trouvé '); ?>
|
56 |
+
<b class="ybc_orange">0</b>
|
57 |
+
<?php echo $this->__('point de paiement <br />correspondant au code postal'); ?> <?php echo $this->getPostcode(); ?>
|
58 |
+
</h3>
|
59 |
+
<?php else: ?>
|
60 |
+
<h3 class="ybc_outlet_found">
|
61 |
+
<?php echo $this->__('Nous avons trouvé '); ?>
|
62 |
+
<b class="ybc_orange"><?php echo $_outletsNbr; ?></b>
|
63 |
+
<?php echo ($_outletsNbr > 1) ? $this->__('points') : $this->__('point'); ?> <?php echo $this->__('de paiement'); ?> <br />
|
64 |
+
<?php echo $this->__('correspondant au code postal'); ?> <?php echo $this->getPostcode(); ?>
|
65 |
+
</h3>
|
66 |
+
<div class="outletsList">
|
67 |
+
<div class="outletsListInner">
|
68 |
+
<ul>
|
69 |
+
<?php foreach ($_outlets as $_outlet): ?>
|
70 |
+
<li id="ybc_<?php echo $_outlet->outletsid; ?>" class="ybc_listed_outlet">
|
71 |
+
<h2><?php echo $_outlet->outletsname; ?></h2>
|
72 |
+
<h3><?php echo $_outlet->outletszipcode . ' ' . $_outlet->outletscity; ?></h3>
|
73 |
+
<p><?php echo $_outlet->outletsaddress; ?></p>
|
74 |
+
<p><?php echo $_outlet->outletsphone; ?></p>
|
75 |
+
<a id="btn_<?php echo $_outlet->outletsid; ?>" class="ybc_btn ybc_outlet_btn" href="#">Sélectionner ce point de paiement</a>
|
76 |
+
</li>
|
77 |
+
<?php endforeach; ?>
|
78 |
+
</ul>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
<div id="carte_YBC_wrapper"><div id="carte_YBC"></div></div>
|
82 |
+
<input id="ybc_outlet_selecta" type="hidden" value="" name="ybc_outlet_selecta">
|
83 |
+
<div>
|
84 |
+
<button type="button" onclick="yesbycash.handleNoOutletSelection()" id="ybc_no_outlet" name="ybc_no_outlet" class="ybc_btn ybc_btn_submit"><?php echo $this->__('Je choisirai ultérieurement un autre point de paiement'); ?></button>
|
85 |
+
<button type="button" onclick="yesbycash.OutletSelection()" id="ybc_outlet" name="ybc_outlet" class="ybc_btn ybc_btn_submit"><?php echo $this->__('Je choisis ce point de paiement'); ?></button>
|
86 |
+
<img id="ybc_loader_noselect" src="<?php echo $this->getSkinUrl('images/yesbycash/ybc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Veuillez patienter'); ?>" title="<?php echo $this->__('Veuillez patienter'); ?>"/>
|
87 |
+
</div>
|
88 |
+
<div class="ybc_clearfix"></div>
|
89 |
+
<?php endif; ?>
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
<script type="text/javascript">
|
93 |
+
//<![CDATA[
|
94 |
+
yesbycash.url = '<?php echo Mage::getBaseUrl(); ?>tsi_yesbycash/ajax/outlets/';
|
95 |
+
yesbycash.selectaTxtOn = "<?php echo $this->__('Point de paiement selectionné'); ?>";
|
96 |
+
yesbycash.selectaTxtOff = "<?php echo $this->__('Je sélectionne un point de paiement'); ?>";
|
97 |
+
<?php foreach ($_outlets as $key => $_outlet): ?>
|
98 |
+
yesbycash.tabOutlets[<?php echo $key; ?>] = new Array(
|
99 |
+
"<?php echo $_outlet->outletsname; ?>",
|
100 |
+
"<?php echo $_outlet->outletsaddress; ?>",
|
101 |
+
"<?php echo $_outlet->outletsphone; ?>",
|
102 |
+
"<?php echo $_outlet->outletszipcode . ' ' . $_outlet->outletscity; ?>",
|
103 |
+
"<?php echo $_outlet->outletslatitude; ?>",
|
104 |
+
"<?php echo $_outlet->outletslongitude; ?>");
|
105 |
+
<?php endforeach; ?>
|
106 |
+
//<![CDATA[
|
107 |
+
$$('.radio[name^=payment]').each(function (e) {
|
108 |
+
if ($(e).checked)
|
109 |
+
{
|
110 |
+
if ($(e).id === 'p_method_yesbycash_standard') {
|
111 |
+
$('p_method_yesbycash_standard').click();
|
112 |
+
yesbycash.bindMap(<?php echo $this->getPostcode() ?>);
|
113 |
+
}
|
114 |
+
}
|
115 |
+
});
|
116 |
+
$('co-payment-form').on('change', '.radio', function (event) {
|
117 |
+
if (event.target.id === 'p_method_yesbycash_standard') {
|
118 |
+
yesbycash.bindMap(<?php echo $this->getPostcode() ?>);
|
119 |
+
}
|
120 |
+
});
|
121 |
+
$$('.step-title a').each(function (e) {
|
122 |
+
Event.observe(e, 'click', function () {
|
123 |
+
$('ybc_loader_noselect').hide();
|
124 |
+
});
|
125 |
+
});
|
126 |
+
$$('#carte_YBC button').each(function (e) {
|
127 |
+
Event.observe(e, 'click', function (b) {
|
128 |
+
b.preventDefault();
|
129 |
+
});
|
130 |
+
});
|
131 |
+
$$('.step-title a').each(function (e) {
|
132 |
+
Event.observe(e, 'click', function () {
|
133 |
+
$('ybc_loader_noselect').hide();
|
134 |
+
});
|
135 |
+
});
|
136 |
+
//]]>
|
137 |
+
</script>
|
app/design/frontend/base/default/template/yesbycash/payment/form_ajax.phtml
ADDED
@@ -0,0 +1,56 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php $_outlets = $this->getOutlets(); ?>
|
2 |
+
<?php $_outletsNbr = count($_outlets); ?>
|
3 |
+
<?php if ($_outletsNbr == 0): ?>
|
4 |
+
<h3 class="ybc_outlet_found">
|
5 |
+
<?php echo $this->__('Nous avons trouvé '); ?>
|
6 |
+
<b class="ybc_orange">0</b>
|
7 |
+
<?php echo $this->__('point de paiement <br />correspondant au code postal'); ?> <?php echo $this->getPostcode(); ?>
|
8 |
+
</h3>
|
9 |
+
<?php else: ?>
|
10 |
+
<h3 class="ybc_outlet_found">
|
11 |
+
<?php echo $this->__('Nous avons trouvé '); ?>
|
12 |
+
<b class="ybc_orange"><?php echo $_outletsNbr; ?></b>
|
13 |
+
<?php echo ($_outletsNbr > 1) ? $this->__('points') : $this->__('point'); ?> <?php echo $this->__('de paiement'); ?> <br />
|
14 |
+
<?php echo $this->__('correspondant au code postal'); ?> <?php echo $this->getPostcode(); ?>
|
15 |
+
</h3>
|
16 |
+
<div class="outletsList">
|
17 |
+
<div class="outletsListInner">
|
18 |
+
<ul>
|
19 |
+
<?php foreach ($_outlets as $_outlet): ?>
|
20 |
+
<li id="ybc_<?php echo $_outlet->outletsid; ?>" class="ybc_listed_outlet">
|
21 |
+
<h2><?php echo $_outlet->outletsname; ?></h2>
|
22 |
+
<h3><?php echo $_outlet->outletszipcode . ' ' . $_outlet->outletscity; ?></h3>
|
23 |
+
<p><?php echo $_outlet->outletsaddress; ?></p>
|
24 |
+
<p><?php echo $_outlet->outletsphone; ?></p>
|
25 |
+
<a id="btn_<?php echo $_outlet->outletsid; ?>" class="ybc_btn ybc_outlet_btn" href="#">Sélectionner ce point de paiement</a>
|
26 |
+
</li>
|
27 |
+
<?php endforeach; ?>
|
28 |
+
</ul>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
<div id="carte_YBC_wrapper"><div id="carte_YBC"></div></div>
|
32 |
+
<input id="ybc_outlet_selecta" type="hidden" value="" name="ybc_outlet_selecta">
|
33 |
+
<div>
|
34 |
+
<button type="button" onclick="yesbycash.handleNoOutletSelection()" id="ybc_no_outlet" name="ybc_no_outlet" class="ybc_btn ybc_btn_submit"><?php echo $this->__('Je choisirai ultérieurement un autre point de paiement'); ?></button>
|
35 |
+
<button type="button" onclick="yesbycash.OutletSelection()" id="ybc_outlet" name="ybc_outlet" class="ybc_btn ybc_btn_submit"><?php echo $this->__('Je choisis ce point de paiement'); ?></button>
|
36 |
+
<img id="ybc_loader_noselect" src="<?php echo $this->getSkinUrl('images/yesbycash/ybc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Veuillez patienter'); ?>" title="<?php echo $this->__('Veuillez patienter'); ?>"/>
|
37 |
+
</div>
|
38 |
+
<div class="ybc_clearfix"></div>
|
39 |
+
<script type="text/javascript">
|
40 |
+
//<![CDATA[
|
41 |
+
<?php foreach ($_outlets as $key => $_outlet): ?>
|
42 |
+
yesbycash.tabOutlets[<?php echo $key; ?>] = new Array(
|
43 |
+
"<?php echo $_outlet->outletsname; ?>",
|
44 |
+
"<?php echo $_outlet->outletsaddress; ?>",
|
45 |
+
"<?php echo $_outlet->outletsphone; ?>",
|
46 |
+
"<?php echo $_outlet->outletszipcode . ' ' . $_outlet->outletscity; ?>",
|
47 |
+
"<?php echo $_outlet->outletslatitude; ?>",
|
48 |
+
"<?php echo $_outlet->outletslongitude; ?>");
|
49 |
+
<?php endforeach; ?>
|
50 |
+
yesbycash.setMap();
|
51 |
+
$('carte_YBC_wrapper').setStyle({width: '70%'});
|
52 |
+
$('carte_YBC_wrapper').setStyle({float: 'left'});
|
53 |
+
$('carte_YBC').setStyle({height: '400px'});
|
54 |
+
//]]>
|
55 |
+
</script>
|
56 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/yesbycash/payment/info.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
|
2 |
+
|
3 |
+
|
app/design/frontend/base/default/template/yesbycash/sales/order/cancel.phtml
ADDED
@@ -0,0 +1,7 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php $_order = $this->getOrder() ?>
|
2 |
+
<?php if ($this->showButton()): ?>
|
3 |
+
<button onclick="window.location = '<?php echo $this->getCancelUrl($_order); ?>';" class="button" title="Annuler la commande YesByCash" type="button" style="right:0;position: absolute;top:30px; margin-bottom:15px">
|
4 |
+
<span><span>Annuler la commande YesByCash</span></span>
|
5 |
+
</button>
|
6 |
+
<span class="clearfix"></span>
|
7 |
+
<?php endif; ?>
|
app/etc/modules/TSI_Yesbycash.xml
ADDED
@@ -0,0 +1,12 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<TSI_Yesbycash>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Payment/>
|
9 |
+
</depends>
|
10 |
+
</TSI_Yesbycash>
|
11 |
+
</modules>
|
12 |
+
</config>
|
app/locale/fr_FR/TSI_Yesbycash.csv
ADDED
@@ -0,0 +1,120 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
"Mode test activé","Mode test activé"
|
2 |
+
"Frais de service Yesbycash","Frais de service Yesbycash"
|
3 |
+
"OK Method was succesful","OK Method was succesful"
|
4 |
+
"Le numéro de téléphone renseigné n\'est pas correct : ","Le numéro de téléphone renseigné n\'est pas correct : "
|
5 |
+
"En monnaie actuelle","En monnaie actuelle"
|
6 |
+
"En pourcentage","En pourcentage"
|
7 |
+
"Votre commande est annulée","Votre commande est annulée"
|
8 |
+
"Votre commande est déjà annulée","Votre commande est déjà annulée"
|
9 |
+
"Opération non permise","Opération non permise"
|
10 |
+
"Commande déjà payée","Commande déjà payée"
|
11 |
+
"Numéro de commande invalide","Numéro de commande invalide"
|
12 |
+
"Numéro de commande invalide ou non présent","Numéro de commande invalide ou non présent"
|
13 |
+
"Activer","Activer"
|
14 |
+
"Titre","Titre"
|
15 |
+
"Merchant Id","Identifiant Marchand"
|
16 |
+
"Merchant Key","Clé marchand"
|
17 |
+
"Key","Clé"
|
18 |
+
"Tax","Frais de service"
|
19 |
+
"Tax type","Mode d'application du frais"
|
20 |
+
"Tax value","Valeur du frais"
|
21 |
+
"Mode test","Mode test"
|
22 |
+
"Server","Serveur"
|
23 |
+
"Payment from applicable countries","Payment from applicable countries"
|
24 |
+
"Payment from Specific countries","Payment from Specific countries"
|
25 |
+
"Sort order","Sort order"
|
26 |
+
"Une erreur est survenue lors de la commande.","Une erreur est survenue lors de la commande."
|
27 |
+
"La commande s'est bien déroulée.","La commande s'est bien déroulée."
|
28 |
+
"Vous allez recevoir par email le récapitulatif de votre commande YesByCash avec le code barre en pièce jointe à présenter dans le point de paiement.","Vous allez recevoir par email le récapitulatif de votre commande YesByCash avec le code barre en pièce jointe à présenter dans le point de paiement."
|
29 |
+
"Vous pouvez désormais vous rendre au point de paiement choisi pour régler votre commande.","Vous pouvez désormais vous rendre au point de paiement choisi pour régler votre commande."
|
30 |
+
"Vous avez la possibilité de payer votre commande dans les points de vente accessibles sur :","Vous avez la possibilité de payer votre commande dans les points de vente accessibles sur :"
|
31 |
+
"- Frais de service Yesbycash :","- Frais de service Yesbycash :"
|
32 |
+
"Le paiement en cash sur internet","Le paiement en cash sur internet"
|
33 |
+
"Vous avez la possibilité de <b>payer votre commande</b> dans les points de vente accessibles sur :","Vous avez la possibilité de <b>payer votre commande</b> dans les points de vente accessibles sur :"
|
34 |
+
"Cependant, nous vous recommandons de vous assurer au préalable qu\'un point de paiement est disponible dans la ville de votre choix.","Cependant, nous vous recommandons de vous assurer au préalable qu\'un point de paiement est disponible dans la ville de votre choix."
|
35 |
+
"Il vous sera toujours possible de régler votre commande dans un autre point de paiement YesByCash","Il vous sera toujours possible de régler votre commande dans un autre point de paiement YesByCash"
|
36 |
+
"Je sélectionne un point de paiement :","Je sélectionne un point de paiement :"
|
37 |
+
"Code postal","Code postal"
|
38 |
+
"Veuillez patienter","Veuillez patienter"
|
39 |
+
"Rechercher","Rechercher"
|
40 |
+
"Nous avons trouvé ","Nous avons trouvé "
|
41 |
+
"point de paiement <br />correspondant au code postal","point de paiement <br />correspondant au code postal"
|
42 |
+
"points","points"
|
43 |
+
"point","point"
|
44 |
+
"de paiement","de paiement"
|
45 |
+
"correspondant au code postal","correspondant au code postal"
|
46 |
+
"Je choisis ce point de paiement","Je choisis ce point de paiement"
|
47 |
+
"Je choisirai ultérieurement un autre point de paiement","Je choisirai ultérieurement un autre point de paiement"
|
48 |
+
"Point de paiement selectionné","Point de paiement selectionné"
|
49 |
+
"Je sélectionne un point de paiement","Je sélectionne un point de paiement"
|
50 |
+
"Authentication required","Missing signature"
|
51 |
+
"Missing signature","Missing signature"
|
52 |
+
"Invalid signature","Invalid signature"
|
53 |
+
"Missing merchant identifier","Missing merchant identifier"
|
54 |
+
"Invalid merchant identifier","Invalid merchant identifier"
|
55 |
+
"Missing parameter customerid","Missing parameter customerid"
|
56 |
+
"Invalid parameter customerid","Invalid parameter customerid"
|
57 |
+
"Missing transaction identifier","Missing transaction identifier"
|
58 |
+
"Invalid transaction identifier","Invalid transaction identifier"
|
59 |
+
"Missing amount","Missing amount"
|
60 |
+
"Invalid amount","Invalid amount"
|
61 |
+
"Missing currency","Missing currency"
|
62 |
+
"Invalid currency","Invalid currency"
|
63 |
+
"Missing key identifier (keyid)","Missing key identifier (keyid)"
|
64 |
+
"Invalid key identifier (keyid)","Invalid key identifier (keyid)"
|
65 |
+
"Missing timestamp parameter","Missing timestamp parameter"
|
66 |
+
"Missing timestamp parameter","Missing timestamp parameter"
|
67 |
+
"Missing expirytime parameter","Missing expirytime parameter"
|
68 |
+
"Missing buyeremail parameter","Missing buyeremail parameter"
|
69 |
+
"Invalid buyeremail parameter","Invalid buyeremail parameter"
|
70 |
+
"Missing buyeraddress parameter","Missing buyeraddress parameter"
|
71 |
+
"Invalid buyeraddress parameter","Invalid buyeraddress parameter"
|
72 |
+
"Missing buyercity parameter","Missing buyercity parameter"
|
73 |
+
"Invalid buyercity parameter","Invalid buyercity parameter"
|
74 |
+
"Missing buyerzip parameter","Missing buyerzip parameter"
|
75 |
+
"Invalid buyerzip parameter","Invalid buyerzip parameter"
|
76 |
+
"Missing URL OK","Missing URL OK"
|
77 |
+
"Invalid URL OK parameter","Invalid URL OK parameter"
|
78 |
+
"Missing URL NOK","Missing URL NOK"
|
79 |
+
"Invalid URL NOK parameter","Invalid URL NOK parameter"
|
80 |
+
"Missing URL S2S","Missing URL S2S"
|
81 |
+
"Invalid URL S2S parameter","Invalid URL S2S parameter"
|
82 |
+
"Missing lname parameter","Missing lname parameter"
|
83 |
+
"Invalid lname parameter","Invalid lname parameter"
|
84 |
+
"Missing fname parameter","Missing fname parameter"
|
85 |
+
"Invalid fname parameter","Invalid fname parameter"
|
86 |
+
"Missing customerip parameter","Missing customerip parameter"
|
87 |
+
"Invalid customerip parameter","Invalid customerip parameter"
|
88 |
+
"Missing buyercountry parameter","Missing buyercountry parameter"
|
89 |
+
"Invalid buyercountry parameter","Invalid buyercountry parameter"
|
90 |
+
"Missing buyerjob parameter","Missing buyerjob parameter"
|
91 |
+
"Invalid buyerjob parameter","Invalid buyerjob parameter"
|
92 |
+
"Missing buyerbirthdate parameter","Missing buyerbirthdate parameter"
|
93 |
+
"Invalid buyerbirthdate parameter","Invalid buyerbirthdate parameter"
|
94 |
+
"Missing buyerbirthcity parameter","Missing buyerbirthcity parameter"
|
95 |
+
"Unreachable Error","Unreachable Error"
|
96 |
+
"Missing buyerbirthcity parameter","Missing buyerbirthcity parameter"
|
97 |
+
"Invalid HTTP USER AGENT","Invalid HTTP USER AGENT"
|
98 |
+
"Invalid HTTP ACCEPT",Invalid HTTP ACCEPT""
|
99 |
+
"Missing zipcode parameter","Missing zipcode parameter"
|
100 |
+
"Invalid barcode parameter","Invalid barcode parameter"
|
101 |
+
"Missing barcode parameter","Missing barcode parameter"
|
102 |
+
"Invalid zipcode parameter","Invalid zipcode parameter"
|
103 |
+
"Missing country parameter","Missing country parameter"
|
104 |
+
"Invalid country parameter","Invalid country parameter"
|
105 |
+
"Incorrect merchant identifier","Incorrect merchant identifier"
|
106 |
+
"Key identifer not found","Key identifer not found"
|
107 |
+
"Incorrect signature","Incorrect signature"
|
108 |
+
"Currency not available for this merchant","Currency not available for this merchant"
|
109 |
+
"User blacklisted","User blacklisted"
|
110 |
+
"Canceled: Max number of transactions/card reached","Canceled: Max number of transactions/card reached"
|
111 |
+
"Canceled: Max total amount of transactions/card reached","Canceled: Max total amount of transactions/card reached"
|
112 |
+
"Canceled: Max number of transactions/email reached","Canceled: Max number of transactions/email reached"
|
113 |
+
"Canceled: Max total amount of transactions/email reached","Canceled: Max total amount of transactions/email reached"
|
114 |
+
"Canceled: Max number of transactions/customer reached","Canceled: Max number of transactions/customer reached"
|
115 |
+
"Canceled: Max total amount of transactions/customer reached","Canceled: Max total amount of transactions/customer reached"
|
116 |
+
"No transaction found","No transaction found"
|
117 |
+
"No outlet found","No outlet found"
|
118 |
+
"Max total amount of transactions/customer reached","Max total amount of transactions/customer reached"
|
119 |
+
"Authentication not confirmed","Authentication not confirmed"
|
120 |
+
"Technical Error","Technical Error"
|
package.xml
ADDED
@@ -0,0 +1,46 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>YesByCash</name>
|
4 |
+
<version>0.1.2</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Unique solution de paiement web-to-store permettant aux e-commerçants de réduire leur taux d’abandon de panier
|
10 |
+

|
11 |
+
Les clients remplissent leur panier d’achat sur votre site et se rendent en point de paiement, pour régler en espèces leurs commandes.</summary>
|
12 |
+
<description>Véritable moyen de paiement web-to-store, YesByCash permet aux e-commerçants de réduire leur taux de panier abandonné en cas de rejet de paiement par carte bancaire.
|
13 |
+

|
14 |
+
Avec YesByCash, les e-commerçants augmentent leurs ventes en touchant une nouvelle clientèle, qui souhaite bénéficier des offres attractives du e-commerce, tout en payant de façon sécurisée dans leur point de vente de proximité…
|
15 |
+

|
16 |
+
En choisissant YesByCash, les e-commerçants intègrent un système de paiement sans fraude.
|
17 |
+

|
18 |
+

|
19 |
+
Le parcours client est extrêmement simple :
|
20 |
+

|
21 |
+
1. Le client remplit son panier d'achat et choisit la solution de paiement YesByCash.
|
22 |
+

|
23 |
+
2. Il règle en point de paiement de proximité avec son code-barre YesByCash dans le délai imparti par l’e-commerçant.
|
24 |
+

|
25 |
+
3. Il reçoit sa commande.
|
26 |
+

|
27 |
+

|
28 |
+
YesByCash permet de payer en cash, les commandes passées sur Internet. Elle est destinée aux personnes qui ne souhaitent pas utiliser leur carte bancaire en ligne ou qui n’en possèdent pas.
|
29 |
+

|
30 |
+
Ce moyen de paiement cible les personnes qui souhaitent régler leurs achats uniquement en espèces.
|
31 |
+

|
32 |
+
o Liberté et flexibilité de paiement : Pouvoir payer en espèces des achats réalisés en ligne ou des factures.
|
33 |
+

|
34 |
+
o Simplicité de paiement : Il suffit de présenter son code-barre pour régler sa commande ou sa facture.
|
35 |
+

|
36 |
+
o Sécurité de paiement : Aucune information personnelle supplémentaire à saisir.
|
37 |
+

|
38 |
+
o Bénéficier d’une offre de paiement en mobilité : accessible sur tous les canaux : mobile, tablette, ordinateurs...</description>
|
39 |
+
<notes>TSI_Yesbycash 0.1.2</notes>
|
40 |
+
<authors><author><name>TSI</name><user>TSI</user><email>support@tsi-payment.com</email></author></authors>
|
41 |
+
<date>2015-03-26</date>
|
42 |
+
<time>13:59:55</time>
|
43 |
+
<contents><target name="magecommunity"><dir><dir name="TSI"><dir><dir name="Yesbycash"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="004ccfd8aec456dacbfe0ef5907403c2"/></dir><dir name="Invoice"><file name="Totals.php" hash="05715dcabec6aa81cea2a35100f19e24"/></dir><file name="Totals.php" hash="eb30fb7d3d9b1b17546c0ad5f0633ee8"/></dir><file name="Totals.php" hash="bd4a8905745baafbd4e6c7bd983fb6dd"/></dir><file name="Server.php" hash="d0a581618bf74beef86022e42b33abdf"/></dir><dir name="Form"><file name="Ajax.php" hash="ee5383cd1edce14be64803bef9454cb3"/><file name="Standard.php" hash="4287d35067a44fc0e84ab0b6a590a68f"/></dir><dir name="Info"><file name="Standard.php" hash="e46f8853704f21f068fdbf5d30fe54be"/></dir><dir name="Onepage"><file name="Failure.php" hash="bb35a05dbbca763188426cf1371688c6"/><file name="Success.php" hash="c72673b536120b702a78053d31454881"/></dir><dir name="Sales"><dir name="Order"><file name="Cancel.php" hash="0042964ef6a1b6ab78c7c90623b8700a"/><dir name="Creditmemo"><file name="Totals.php" hash="ca7cdc0e6e3dafa5024bfd279606cd12"/></dir><dir name="Invoice"><file name="Totals.php" hash="752fe29c4aa2e164c3e4ddfc9936218d"/></dir><file name="Totals.php" hash="21edf8dfa349aa142f6fc2cf0f087cfe"/></dir></dir></dir><dir name="Controller"><file name="Action.php" hash="3ca6bb79884afb5ce9b2972fb78fbff9"/></dir><dir name="Helper"><file name="Data.php" hash="2dc0e2cbf05b9b2cc89b17584ac8e072"/></dir><dir name="Model"><dir name="Api"><file name="Methods.php" hash="fdf7dbef762a23d7d5e115f28ba1e0cd"/><file name="Response.php" hash="43a316436e82d38f8c9e4d2199a667d2"/><file name="Service.php" hash="7a43a2ab9129947b379bc840ed8d9f30"/></dir><file name="Observer.php" hash="24913af1d06fd161584c3bbf8065bb37"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Yesbycashfee.php" hash="1395fc6aacd6364eda567c30845503e5"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Yesbycashfee.php" hash="331a6a2f6df6157cc4c1bccbe5f1a540"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Yesbycashfee.php" hash="1e2c11e2b05667eebbd042c8948071a5"/></dir></dir></dir></dir><dir name="Source"><file name="Yesbycashfeetype.php" hash="378a35d35bc7ba5f8550595395a5557e"/></dir><file name="Standard.php" hash="d21f2675c9fa3b2b069deb9353af0924"/></dir><dir name="controllers"><file name="AjaxController.php" hash="8c8f1b36aaa4e488fff9d1ebaeb97075"/><file name="IpnController.php" hash="1c99c0b7d198d8c97ef1f5d3f23de059"/><file name="StandardController.php" hash="5cb8d7b443658654558f42ade7f6184e"/></dir><dir name="etc"><file name="config.xml" hash="121a73bfa53771fc47947c3dc60502ca"/><file name="system.xml" hash="2257bffc3d0801c800181134e0ddfdb2"/></dir><dir name="sql"><dir name="tsi_yesbycash_setup"><file name="install-0.1.0.php" hash="8e26b57545426d12cd51c5bc94082811"/><file name="upgrade-0.1.0-0.1.1.php" hash="dc9d2b6db12d6a7afbce72cb6ffd0edf"/><file name="upgrade-0.1.1-0.1.2.php" hash="6430a353d91a3027af2924de68272eeb"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="yesbycash.xml" hash="8300d917adcc5868584cd09809e79baa"/></dir><dir name="template"><dir name="yesbycash"><dir><dir name="checkout"><file name="failure.phtml" hash="23f9bd87c4e1b86b704fb73039414591"/><file name="success.phtml" hash="8494948bdc3fe9da69fff983e52aa868"/></dir><dir name="payment"><file name="form.phtml" hash="6a26367a281140ce9287e7926887c445"/><file name="form_ajax.phtml" hash="914f7d508faff8eb7cc367a93b070836"/><file name="info.phtml" hash="24b4010c9163b839898a94836d03a736"/></dir><dir name="sales"><dir name="order"><file name="cancel.phtml" hash="773035d2d4fc7f8219c233c75717b1b0"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="fr_FR"><file name="TSI_Yesbycash.csv" hash="6ec63f3e871b6dc63eafd2336d220c66"/></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="yesbycash"><file name="yesbycash.css" hash="0876ac1fe43aa70114b6dcf805cad945"/></dir></dir><dir name="js"><dir name="yesbycash"><file name="yesbycash.js" hash="3eb1aaf0402c7d762b6e421e99fe3389"/></dir></dir><dir name="images"><dir name="yesbycash"><file name="ybc-ajax-loader.gif" hash="f48ee069890b16455c3ddcacee9b5f75"/><file name="yesbycash_logo.png" hash="d1d901964e0fc75d4d9db90b57583242"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="TSI_Yesbycash.xml" hash="43ad5dba119bee1617dc7fecc802795d"/></dir></dir></target></contents>
|
44 |
+
<compatible/>
|
45 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
46 |
+
</package>
|
skin/frontend/base/default/css/yesbycash/yesbycash.css
ADDED
@@ -0,0 +1,234 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
.ybc_map_container {
|
2 |
+
width: 100%;
|
3 |
+
}
|
4 |
+
|
5 |
+
.ybc_clearfix {
|
6 |
+
clear: both;
|
7 |
+
}
|
8 |
+
|
9 |
+
.ybc_map_header {
|
10 |
+
padding: 30px 25px 25px;
|
11 |
+
border: 1px solid #efefef;
|
12 |
+
text-align: center;
|
13 |
+
}
|
14 |
+
|
15 |
+
.ybc_map_header img {
|
16 |
+
margin: 0 auto;
|
17 |
+
}
|
18 |
+
|
19 |
+
.ybc_map_header p {
|
20 |
+
margin-top: 20px;
|
21 |
+
text-transform: uppercase;
|
22 |
+
font-size: 15px;
|
23 |
+
font-weight: bold;
|
24 |
+
color: #494948;
|
25 |
+
}
|
26 |
+
|
27 |
+
#ybc_intro_content {
|
28 |
+
padding: 25px;
|
29 |
+
color: #fff;
|
30 |
+
background-color: #202020;
|
31 |
+
}
|
32 |
+
|
33 |
+
#ybc_intro_content i {
|
34 |
+
font-size: 11px;
|
35 |
+
}
|
36 |
+
|
37 |
+
.ybc_intro_txt {
|
38 |
+
font-size: 14px;
|
39 |
+
}
|
40 |
+
|
41 |
+
.ybc_center_txt {
|
42 |
+
text-align:center;
|
43 |
+
}
|
44 |
+
|
45 |
+
.ybc_intro_txt a {
|
46 |
+
color: #fff;
|
47 |
+
}
|
48 |
+
|
49 |
+
#part-for-ajax {
|
50 |
+
width: 141%;
|
51 |
+
}
|
52 |
+
|
53 |
+
#ybc_outlet_fields {
|
54 |
+
padding: 30px 0 40px;
|
55 |
+
background-color: #f2f2f2;
|
56 |
+
}
|
57 |
+
|
58 |
+
#ybc_outlet_fields h4 {
|
59 |
+
margin-bottom: 15px;
|
60 |
+
font-size: 15px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.ybc_map_fields div.ybc_form {
|
64 |
+
text-align: center;
|
65 |
+
}
|
66 |
+
|
67 |
+
.ybc_map_fields #ybc_map_department, .ybc_map_fields #ybc_map_country {
|
68 |
+
border: 0 none;
|
69 |
+
border-radius: 2px;
|
70 |
+
height: 30px;
|
71 |
+
margin: 0 5px 0 0;
|
72 |
+
padding: 0 10px;
|
73 |
+
width: 130px;
|
74 |
+
}
|
75 |
+
|
76 |
+
.ybc_map_fields #ybc_map_country {
|
77 |
+
padding: 3px;
|
78 |
+
}
|
79 |
+
|
80 |
+
.ybc_btn {
|
81 |
+
display: inline-block;
|
82 |
+
position: relative;
|
83 |
+
padding: 5px 7px;
|
84 |
+
border-radius: 4px;
|
85 |
+
text-decoration: none;
|
86 |
+
font-size: 11px;
|
87 |
+
font-weight: bold;
|
88 |
+
cursor: pointer;
|
89 |
+
text-align: center;
|
90 |
+
line-height: 18px;
|
91 |
+
color: #575757;
|
92 |
+
background-color: #f0f0f0;
|
93 |
+
}
|
94 |
+
|
95 |
+
.ybc_btn:hover,
|
96 |
+
.ybc_btn:active {
|
97 |
+
color: #fff;
|
98 |
+
background-color: #db4426;
|
99 |
+
text-decoration:none;
|
100 |
+
}
|
101 |
+
|
102 |
+
.ybc_btn.ybc_btn_submit,
|
103 |
+
.ybc_btn.ybc_btn_submit:link,
|
104 |
+
.ybc_btn.ybc_btn_submit:visited {
|
105 |
+
padding: 4px 20px;
|
106 |
+
border: 0 none;
|
107 |
+
border-radius: 3px;
|
108 |
+
color: #fff;
|
109 |
+
background-color: #db4426;
|
110 |
+
}
|
111 |
+
|
112 |
+
.ybc_btn.ybc_btn_submit:hover,
|
113 |
+
.ybc_btn.ybc_btn_submit:active {
|
114 |
+
color: #fff;
|
115 |
+
background-color: #575757;
|
116 |
+
text-decoration:none;
|
117 |
+
}
|
118 |
+
|
119 |
+
.ybc_form > img {
|
120 |
+
display:none;
|
121 |
+
height: 20px;
|
122 |
+
}
|
123 |
+
|
124 |
+
.ybc_form label {
|
125 |
+
float:none;
|
126 |
+
}
|
127 |
+
|
128 |
+
#ybc_loader_noselect {
|
129 |
+
float: right;
|
130 |
+
height: 45px;
|
131 |
+
margin-right: 15px;
|
132 |
+
padding-top: 17px;
|
133 |
+
display:none;
|
134 |
+
}
|
135 |
+
|
136 |
+
.ybc_outlet_found {
|
137 |
+
padding: 15px 0;
|
138 |
+
text-align: center;
|
139 |
+
font-size: 19px;
|
140 |
+
line-height: 30px;
|
141 |
+
background-color: #f8f8f8;
|
142 |
+
margin:0;
|
143 |
+
}
|
144 |
+
|
145 |
+
.outletsList {
|
146 |
+
float: left;
|
147 |
+
width: 30%;
|
148 |
+
max-height: 400px;
|
149 |
+
border-bottom: 1px solid #efefef;
|
150 |
+
overflow: auto;
|
151 |
+
}
|
152 |
+
|
153 |
+
.outletsListInner {
|
154 |
+
border-left: 1px solid #efefef;
|
155 |
+
}
|
156 |
+
|
157 |
+
.ybc_orange {
|
158 |
+
color: #db4426;
|
159 |
+
}
|
160 |
+
|
161 |
+
.outletsList li {
|
162 |
+
padding: 20px;
|
163 |
+
border-bottom: 1px solid #efefef;
|
164 |
+
list-style-type: none;
|
165 |
+
}
|
166 |
+
|
167 |
+
.ybc_listed_outlet h2 {
|
168 |
+
font-size: 16px;
|
169 |
+
font-weight: bold;
|
170 |
+
}
|
171 |
+
|
172 |
+
.ybc_listed_outlet p,
|
173 |
+
.ybc_listed_outlet h2,
|
174 |
+
.ybc_listed_outlet h3 {
|
175 |
+
margin: 0 0 5px;
|
176 |
+
line-height: 17px;
|
177 |
+
color: #333;
|
178 |
+
}
|
179 |
+
|
180 |
+
#ybc_mapcanvas {
|
181 |
+
float: left;
|
182 |
+
width: 70%;
|
183 |
+
margin-bottom: 20px;
|
184 |
+
min-height: 400px;
|
185 |
+
position:relative;
|
186 |
+
background-color: rgb(229, 227, 223);
|
187 |
+
}
|
188 |
+
|
189 |
+
#submitYesbycash {
|
190 |
+
float: right;
|
191 |
+
width: 170px;
|
192 |
+
margin-top: 5px;
|
193 |
+
min-height: 50px;
|
194 |
+
white-space: normal;
|
195 |
+
}
|
196 |
+
|
197 |
+
#ybc_no_outlet, #ybc_outlet {
|
198 |
+
float: right;
|
199 |
+
width: 220px;
|
200 |
+
margin-top: 5px;
|
201 |
+
margin-right: 7px;
|
202 |
+
min-height: 50px;
|
203 |
+
white-space: normal;
|
204 |
+
}
|
205 |
+
|
206 |
+
#ybc_outlet {
|
207 |
+
display:none;
|
208 |
+
}
|
209 |
+
|
210 |
+
.ybc_btn.ybc_outlet_selected {
|
211 |
+
color: #fff !important;
|
212 |
+
background-color: #db4426 !important;
|
213 |
+
}
|
214 |
+
#carte_YBC_wrapper {
|
215 |
+
width:100%;
|
216 |
+
}
|
217 |
+
#carte_YBC
|
218 |
+
{
|
219 |
+
width: 100%;
|
220 |
+
height: 500px;
|
221 |
+
border: 1px solid #333333
|
222 |
+
}
|
223 |
+
.ybc_map_fields {
|
224 |
+
width: 141%;
|
225 |
+
}
|
226 |
+
.__tsi_map__ input[type="text"] {
|
227 |
+
margin:0!important;
|
228 |
+
height:27px;
|
229 |
+
}
|
230 |
+
|
231 |
+
.page-title.title-buttons{
|
232 |
+
overflow: visible;
|
233 |
+
position: relative;
|
234 |
+
}
|
skin/frontend/base/default/images/yesbycash/ybc-ajax-loader.gif
ADDED
Binary file
|
skin/frontend/base/default/images/yesbycash/yesbycash_logo.png
ADDED
Binary file
|
skin/frontend/base/default/js/yesbycash/yesbycash.js
ADDED
@@ -0,0 +1,204 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
if (typeof Yesbycash == 'undefined') {
|
2 |
+
var Yesbycash = {};
|
3 |
+
}
|
4 |
+
var Yesbycash = Class.create();
|
5 |
+
Yesbycash.prototype = {
|
6 |
+
initialize: function () {
|
7 |
+
this.locations = [];
|
8 |
+
this.tabOutlets = [];
|
9 |
+
this.url = '';
|
10 |
+
this.selectaTxtOff = '';
|
11 |
+
this.selectaTxtOn = '';
|
12 |
+
setTimeout(function () {
|
13 |
+
yesbycash.testForVersion();
|
14 |
+
}, 200);
|
15 |
+
},
|
16 |
+
testForVersion: function () {
|
17 |
+
window.tsi.maps.YBC.onReady(function (Ybc) {
|
18 |
+
if (!Ybc.isCompatible())
|
19 |
+
{
|
20 |
+
var head;
|
21 |
+
var script;
|
22 |
+
head = $$('head')[0];
|
23 |
+
if (head)
|
24 |
+
{
|
25 |
+
script = new Element('script', {type: 'text/javascript', src: 'https://maps.googleapis.com/maps/api/js?libraries=geometry,places&key=AIzaSyDuvsiEXzvlMP0GmbkgYfbOYM-TPp8GwQ0&sensor=false&v=3.17&callback=initialize'});
|
26 |
+
head.appendChild(script);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
});
|
30 |
+
},
|
31 |
+
bindMap: function (postcode) {
|
32 |
+
window.tsi.maps.YBC.onReady(function (Ybc) {
|
33 |
+
if (Ybc.isCompatible())
|
34 |
+
{
|
35 |
+
$('ybc_outlet_fields').setStyle({display: 'none'});
|
36 |
+
$$('.ybc_outlet_found').first().setStyle({display: 'none'});
|
37 |
+
$$('.outletsList').first().setStyle({display: 'none'});
|
38 |
+
$('ybc_no_outlet').setStyle({display: 'none'});
|
39 |
+
setTimeout(function () {
|
40 |
+
new Ybc.map('#carte_YBC', {
|
41 |
+
defaultAddress: "'" + postcode + "'",
|
42 |
+
geoloc: false,
|
43 |
+
onConfirmOutlet: function (outlet_id, outlet) {
|
44 |
+
if (null == outlet_id)
|
45 |
+
{
|
46 |
+
$('ybc_outlet_selecta').value = '';
|
47 |
+
yesbycash.OutletSelection();
|
48 |
+
}
|
49 |
+
else
|
50 |
+
{
|
51 |
+
$('ybc_outlet_selecta').value = outlet_id;
|
52 |
+
yesbycash.OutletSelection();
|
53 |
+
}
|
54 |
+
}
|
55 |
+
});
|
56 |
+
}, 100);
|
57 |
+
}
|
58 |
+
else {
|
59 |
+
setTimeout(function () {
|
60 |
+
$('carte_YBC_wrapper').setStyle({width: '70%'});
|
61 |
+
$('carte_YBC_wrapper').setStyle({float: 'left'});
|
62 |
+
$('carte_YBC').setStyle({height: '400px'});
|
63 |
+
yesbycash.setMap();
|
64 |
+
}, 200);
|
65 |
+
}
|
66 |
+
});
|
67 |
+
},
|
68 |
+
clickForMap: function () {
|
69 |
+
var loader = $('ybc_loader_search');
|
70 |
+
loader.show();
|
71 |
+
loader.setStyle({display: 'inline-block'});
|
72 |
+
new Ajax.Updater('part-for-ajax', this.url, {
|
73 |
+
method: 'get',
|
74 |
+
evalScripts: true,
|
75 |
+
parameters: {
|
76 |
+
postcode: $('ybc_map_department').getValue(),
|
77 |
+
country_id: $('ybc_map_country').getValue()
|
78 |
+
},
|
79 |
+
onSuccess: function () {
|
80 |
+
loader.hide();
|
81 |
+
}
|
82 |
+
});
|
83 |
+
},
|
84 |
+
setMap: function () {
|
85 |
+
this.handleOutletSelection();
|
86 |
+
for (var i = 0; i < this.tabOutlets.length; i++) {
|
87 |
+
this.locations[i] = new Array();
|
88 |
+
this.locations[i][0] = '<center><b>' + this.tabOutlets[i][0] + '<br />' + this.tabOutlets[i][1] + '</b><br />' + this.tabOutlets[i][2] + '<br />' + this.tabOutlets[i][3] + '</center>';
|
89 |
+
this.locations[i][1] = this.tabOutlets[i][4];
|
90 |
+
this.locations[i][2] = this.tabOutlets[i][5];
|
91 |
+
}
|
92 |
+
|
93 |
+
var map = new google.maps.Map($('carte_YBC'), {
|
94 |
+
zoom: 14,
|
95 |
+
center: new google.maps.LatLng(this.tabOutlets[0][4], this.tabOutlets[0][5]),
|
96 |
+
mapTypeControl: true,
|
97 |
+
mapTypeControlOptions: {
|
98 |
+
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
|
99 |
+
},
|
100 |
+
navigationControl: true,
|
101 |
+
navigationControlOptions: {
|
102 |
+
style: google.maps.NavigationControlStyle.SMALL,
|
103 |
+
position: google.maps.ControlPosition.TOP_RIGHT
|
104 |
+
},
|
105 |
+
scaleControl: true,
|
106 |
+
streetViewControl: false,
|
107 |
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
108 |
+
});
|
109 |
+
var marker, i;
|
110 |
+
for (i = 0; i < this.locations.length; i++) {
|
111 |
+
marker = new google.maps.Marker({
|
112 |
+
position: new google.maps.LatLng(this.locations[i][1], this.locations[i][2]),
|
113 |
+
map: map
|
114 |
+
});
|
115 |
+
var infowindow = new google.maps.InfoWindow({
|
116 |
+
});
|
117 |
+
var locations = this.locations;
|
118 |
+
google.maps.event.addListener(marker, 'click', (function (marker, i) {
|
119 |
+
return function () {
|
120 |
+
infowindow.setContent('<div style="width:200px">' + locations[i][0] + '</div>');
|
121 |
+
infowindow.open(map, marker);
|
122 |
+
}
|
123 |
+
})(marker, i));
|
124 |
+
}
|
125 |
+
|
126 |
+
},
|
127 |
+
handleOutletSelection: function () {
|
128 |
+
var arrBtns = $$('.ybc_outlet_btn');
|
129 |
+
var hidden = $('ybc_outlet_selecta');
|
130 |
+
var prevId = '';
|
131 |
+
var outletId = '';
|
132 |
+
for (var k = 0; k < arrBtns.length; k++) {
|
133 |
+
var btn = $(arrBtns[k].id);
|
134 |
+
var selectaTxtOff = this.selectaTxtOff;
|
135 |
+
var selectaTxtOn = this.selectaTxtOn;
|
136 |
+
btn.onclick = function (e) {
|
137 |
+
$('ybc_outlet').setStyle({display: 'block'});
|
138 |
+
e.preventDefault();
|
139 |
+
var btnId = this.id;
|
140 |
+
outletId = btnId.substr(4);
|
141 |
+
hidden.value = outletId;
|
142 |
+
if (prevId !== '') {
|
143 |
+
$(prevId).innerHTML = selectaTxtOff;
|
144 |
+
$(prevId).className = $(prevId).className.replace(/(?:^|\s)ybc_outlet_selected(?!\S)/, '');
|
145 |
+
}
|
146 |
+
$(btnId).innerHTML = selectaTxtOn;
|
147 |
+
$(btnId).className += ' ybc_outlet_selected';
|
148 |
+
prevId = btnId;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
},
|
152 |
+
handleNoOutletSelection: function () {
|
153 |
+
$('ybc_loader_noselect').show();
|
154 |
+
$('ybc_loader_noselect').setStyle({display: 'block'});
|
155 |
+
$('ybc_outlet_selecta').value = '';
|
156 |
+
payment.save();
|
157 |
+
},
|
158 |
+
OutletSelection: function () {
|
159 |
+
payment.save();
|
160 |
+
},
|
161 |
+
}
|
162 |
+
|
163 |
+
Validation.addMethods({
|
164 |
+
validate: function () {
|
165 |
+
var result = false;
|
166 |
+
var useTitles = this.options.useTitles;
|
167 |
+
var callback = this.options.onElementValidate;
|
168 |
+
try {
|
169 |
+
if (this.form.id == 'co-payment-form') {
|
170 |
+
result = true;
|
171 |
+
} else {
|
172 |
+
if (this.options.stopOnFirst) {
|
173 |
+
result = Form.getElements(this.form).all(function (elm) {
|
174 |
+
if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
|
175 |
+
return true;
|
176 |
+
}
|
177 |
+
return Validation.validate(elm, {useTitle: useTitles, onElementValidate: callback});
|
178 |
+
}, this);
|
179 |
+
} else {
|
180 |
+
result = Form.getElements(this.form).collect(function (elm) {
|
181 |
+
if (elm.hasClassName('local-validation')) {
|
182 |
+
return true;
|
183 |
+
}
|
184 |
+
return Validation.validate(elm, {useTitle: useTitles, onElementValidate: callback});
|
185 |
+
}, this).all();
|
186 |
+
}
|
187 |
+
}
|
188 |
+
} catch (e) {
|
189 |
+
}
|
190 |
+
if (!result && this.options.focusOnError) {
|
191 |
+
try {
|
192 |
+
Form.getElements(this.form).findAll(function (elm) {
|
193 |
+
return $(elm).hasClassName('validation-failed')
|
194 |
+
}).first().focus()
|
195 |
+
}
|
196 |
+
catch (e) {
|
197 |
+
}
|
198 |
+
}
|
199 |
+
this.options.onFormValidate(result, this.form);
|
200 |
+
return result;
|
201 |
+
}
|
202 |
+
});
|
203 |
+
|
204 |
+
yesbycash = new Yesbycash();
|