Buscape_Fcontrol - Version 0.1.9

Version Notes

Extensão Buscapé Fcontrol para Magento CE 1.3+, PE 1.9+ e EE 1.7+.

Download this release

Release Info

Developer Buscapé Developer
Extension Buscape_Fcontrol
Version 0.1.9
Comparing to
See all releases


Code changes from version 0.1.8 to 0.1.9

app/code/community/Buscape/Fcontrol/Block/Adminhtml/Sales/Order/View/Info.php CHANGED
@@ -1,54 +1,63 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
14
- *
15
- * @category Buscape
16
- * @package Buscape_Fcontrol
17
- * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- if (version_compare(Mage::getVersion(), '1.3.3', '<='))
22
- {
23
- class Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_Abstract
24
- {
25
- /*
26
- * @Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info
27
- *
28
- * Implementação somente para o uso de Frame
29
- */
30
- public function getScore()
31
- {
32
- if ($this->getOrder()) {
33
- Mage::getModel('fcontrol/observer')->frameOrder($this, true);
34
- }
35
- }
36
- }
37
- }
38
- else
39
- {
40
- class Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info
41
- {
42
- /*
43
- * @Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info
44
- *
45
- * Implementação somente para o uso de Frame
46
- */
47
- public function getScore()
48
- {
49
- if ($this->getOrder()) {
50
- Mage::getModel('fcontrol/observer')->frameOrder($this, true);
51
- }
52
- }
53
- }
 
 
 
 
 
 
 
 
 
54
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
14
+ *
15
+ * @category Buscape
16
+ * @package Buscape_Fcontrol
17
+ * @copyright Copyright (c) 2010 Buscap? Company (http://www.buscapecompany.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ if (version_compare(Mage::getVersion(), '1.3.3', '<=')) {
21
+
22
+ class Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_Abstract {
23
+ /*
24
+ * @Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info
25
+ *
26
+ * Implementa??o somente para o uso de Frame
27
+ */
28
+
29
+ public function getScore() {
30
+ if ($this->getOrder() && Mage::getModel('fcontrol/adapter_payment')->validate($this->getOrder()->getPayment())) {
31
+ Mage::getModel('fcontrol/observer')->frameOrder($this, true);
32
+ } else {
33
+ $texto_fail = 'Este pedido n�o precisa ou n�o possui suporte para a An�lise do Fcontrol';
34
+
35
+ echo utf8_decode($texto_fail);
36
+ }
37
+ }
38
+
39
+ }
40
+
41
+ } else {
42
+
43
+ class Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info {
44
+ /*
45
+ * @Buscape_Fcontrol_Block_Adminhtml_Sales_Order_View_Info
46
+ *
47
+ * Implementa??o somente para o uso de Frame
48
+ *
49
+ * @todo: incluir a possibilidade de escolher se determinado
50
+ *
51
+ */
52
+
53
+ public function getScore() {
54
+ if ($this->getOrder() && Mage::getModel('fcontrol/adapter_payment')->validate($this->getOrder()->getPayment())) {
55
+ Mage::getModel('fcontrol/observer')->frameOrder($this, true);
56
+ } else {
57
+ echo 'Este pedido n?o precisa ou n?o possui suporte para an?lise no FControl.';
58
+ }
59
+ }
60
+
61
+ }
62
+
63
  }
app/code/community/Buscape/Fcontrol/Model/Adapter/Payment.php CHANGED
@@ -14,43 +14,45 @@
14
  *
15
  * @category Buscape
16
  * @package Buscape_Fcontrol
17
- * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
20
 
21
- class Buscape_Fcontrol_Model_Adapter_Payment extends Varien_Object
22
- {
23
-
24
  protected static $_service = array(
25
- 'ccsave' => true,
26
- 'checkmo' => true,
27
- 'free' => true,
28
- 'purchaseorder' => true,
29
- 'authorizenet_directpost' => false,
30
- 'authorizenet' => false,
31
- 'googlecheckout' => false,
32
- 'paypal_standard' => false,
33
- 'paypal_express' => false,
34
- 'paypal_direct' => false,
35
- 'paypaluk_direct' => false,
36
- 'paypaluk_express' => false,
37
- 'verisign' => false,
38
- 'payflow_link' => false,
39
- 'hosted_pro' => false,
40
- 'paypal_billing_agreement' => false,
41
- 'pagamentodigital_standard' => false,
42
- 'pagseguro_standard' => true,
43
- 'pagseguro' => true,
44
- 'brunoassarisse_pagseguro' => false,
45
- 'cobredireto' => false,
46
- 'pagamentodigital_geral' => false,
47
- 'pagamentodigital_vista' => false,
48
- 'pagamentodigital_prazo' => false,
49
- 'dineromail_standard' => false
 
 
 
 
50
  );
51
-
52
  /* Verifica se a forma de pagamento pode ser utilizada com o FControl */
53
- public function validate($payment = null)
 
54
  {
55
  if(in_array($payment->getMethod(), self::$_service)) {
56
  if(self::$_service[$payment->getMethod()]) {
@@ -60,21 +62,21 @@ class Buscape_Fcontrol_Model_Adapter_Payment extends Varien_Object
60
 
61
  return false;
62
  }
63
-
64
- public function filter($payment = null, Buscape_Fcontrol_Model_Api_Abstract $api = null)
65
- {
66
- if($api && in_array($payment->getMethod(), self::$_service)) {
67
-
68
- switch($payment->getMethod())
69
- {
70
  case 'ccsave':
71
-
72
- if(intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
73
  $api->metodoPagamento = 1;
74
  } else {
75
  $api->metodoPagamento = 'CartaoCredito';
76
  }
77
-
78
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
79
 
80
  $api->nomeBancoEmissor = $payment->getCcType();
@@ -84,58 +86,59 @@ class Buscape_Fcontrol_Model_Adapter_Payment extends Varien_Object
84
  $api->dataValidadeCartao = $payment->getCcExpMonth() . '/' . $payment->getCcExpYear();
85
 
86
  $api->nomeTitularCartao = $payment->getCcOwner();
87
-
88
  $api->quatroUltimosDigitosCartao = $payment->getCcLast4();
89
- break;
90
  case 'checkmo':
91
-
92
- if(intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
93
  $api->metodoPagamento = 15;
94
  } else {
95
  $api->metodoPagamento = 'Deposito';
96
  }
97
-
98
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
99
- break;
100
  case 'pagamentodigital_geral':
101
  case 'pagamentodigital_vista':
102
  case 'pagamentodigital_prazo':
103
  case 'dineromail_standard':
104
-
105
- if(intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
106
  $api->metodoPagamento = 10;
107
  } else {
108
  $api->metodoPagamento = 'PagamentoEntrega';
109
  }
110
-
111
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
112
- break;
113
  case 'free':
114
  case 'purchaseorder':
115
-
116
- if(intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
117
  $api->metodoPagamento = 18;
118
  } else {
119
  $api->metodoPagamento = 'ValePresente';
120
  }
121
-
122
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
123
- break;
124
  default:
125
-
126
- if(intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
127
  $api->metodoPagamento = 1;
128
  } else {
129
  $api->metodoPagamento = 'CartaoCredito';
130
  }
131
-
132
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
133
- break;
134
  }
135
  }
136
-
137
  $api->numeroParcelas = 1;
138
-
139
  return $api;
140
  }
 
141
  }
14
  *
15
  * @category Buscape
16
  * @package Buscape_Fcontrol
17
+ * @copyright Copyright (c) 2010 Buscap� Company (http://www.buscapecompany.com)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+ class Buscape_Fcontrol_Model_Adapter_Payment extends Varien_Object {
21
 
 
 
 
22
  protected static $_service = array(
23
+ 'ccsave' => true,
24
+ 'checkmo' => true,
25
+ 'free' => true,
26
+ 'purchaseorder' => true,
27
+ 'authorizenet_directpost' => false,
28
+ 'authorizenet' => false,
29
+ 'googlecheckout' => false,
30
+ 'paypal_standard' => false,
31
+ 'paypal_express' => false,
32
+ 'paypal_direct' => false,
33
+ 'paypaluk_direct' => false,
34
+ 'paypaluk_express' => false,
35
+ 'verisign' => false,
36
+ 'payflow_link' => false,
37
+ 'hosted_pro' => false,
38
+ 'paypal_billing_agreement' => false,
39
+ 'pagamentodigital_standard' => true,
40
+ 'pagseguro_standard' => false,
41
+ 'pagseguro' => false,
42
+ 'brunoassarisse_pagseguro' => false,
43
+ 'cobredireto' => false,
44
+ 'pagamentodigital_geral' => true,
45
+ 'pagamentodigital_vista' => false,
46
+ 'pagamentodigital_prazo' => true,
47
+ 'dineromail_standard' => false,
48
+ 'brunoassarisse_pagseguro' => true,
49
+ 'banco' => true,
50
+ 'BoletoBancario_standard' => false,
51
+ 'payments_cielowebservice' => true
52
  );
 
53
  /* Verifica se a forma de pagamento pode ser utilizada com o FControl */
54
+
55
+ public function validate($payment = null)
56
  {
57
  if(in_array($payment->getMethod(), self::$_service)) {
58
  if(self::$_service[$payment->getMethod()]) {
62
 
63
  return false;
64
  }
65
+
66
+
67
+
68
+ public function filter($payment = null, Buscape_Fcontrol_Model_Api_Abstract $api = null) {
69
+ if ($api && in_array($payment->getMethod(), self::$_service)) {
70
+
71
+ switch ($payment->getMethod()) {
72
  case 'ccsave':
73
+
74
+ if (intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
75
  $api->metodoPagamento = 1;
76
  } else {
77
  $api->metodoPagamento = 'CartaoCredito';
78
  }
79
+
80
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
81
 
82
  $api->nomeBancoEmissor = $payment->getCcType();
86
  $api->dataValidadeCartao = $payment->getCcExpMonth() . '/' . $payment->getCcExpYear();
87
 
88
  $api->nomeTitularCartao = $payment->getCcOwner();
89
+
90
  $api->quatroUltimosDigitosCartao = $payment->getCcLast4();
91
+ break;
92
  case 'checkmo':
93
+
94
+ if (intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
95
  $api->metodoPagamento = 15;
96
  } else {
97
  $api->metodoPagamento = 'Deposito';
98
  }
99
+
100
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
101
+ break;
102
  case 'pagamentodigital_geral':
103
  case 'pagamentodigital_vista':
104
  case 'pagamentodigital_prazo':
105
  case 'dineromail_standard':
106
+
107
+ if (intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
108
  $api->metodoPagamento = 10;
109
  } else {
110
  $api->metodoPagamento = 'PagamentoEntrega';
111
  }
112
+
113
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
114
+ break;
115
  case 'free':
116
  case 'purchaseorder':
117
+
118
+ if (intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
119
  $api->metodoPagamento = 18;
120
  } else {
121
  $api->metodoPagamento = 'ValePresente';
122
  }
123
+
124
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
125
+ break;
126
  default:
127
+
128
+ if (intval(Mage::helper('fcontrol')->getConfig('type_service')) === Buscape_Fcontrol_Model_Api::FRAME) {
129
  $api->metodoPagamento = 1;
130
  } else {
131
  $api->metodoPagamento = 'CartaoCredito';
132
  }
133
+
134
  $api->valorPedido = number_format($payment->getAmountOrdered(), 2, ".", "");
135
+ break;
136
  }
137
  }
138
+
139
  $api->numeroParcelas = 1;
140
+
141
  return $api;
142
  }
143
+
144
  }
app/code/community/Buscape/Fcontrol/Model/Api.php CHANGED
@@ -23,32 +23,91 @@ class Buscape_Fcontrol_Model_Api extends Buscape_Fcontrol_Model_Api_Abstract
23
 
24
  protected $_urlFrame = 'https://secure.fcontrol.com.br/validatorframe/validatorframe.aspx';
25
 
 
 
 
26
  public function analisaFrame()
27
  {
28
- $url = $this->_urlFrame;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  $url .= '?login=' . $this->getUser();
31
  $url .= '&senha=' . $this->getPassword();
32
  $url .= '&nomeComprador=' . $this->compradorNome;
33
  $url .= '&ruaComprador=' . $this->compradorRua;
34
  $url .= '&numeroComprador=' . $this->compradorNumero;
 
 
35
  $url .= '&cidadeComprador=' . $this->compradorCidade;
36
- $url .= '&ufComprador=' . $this->compradorEstado;
37
  $url .= '&paisComprador=' . $this->compradorPais;
38
  $url .= '&cepComprador=' . $this->compradorCep;
39
  $url .= '&dddComprador=' . $this->compradorDddTelefone1;
40
  $url .= '&telefoneComprador=' . $this->compradorTelefone1;
 
 
 
 
41
  $url .= '&cpfComprador=' . $this->compradorCpfCnpj;
42
  $url .= '&emailComprador=' . $this->compradorEmail;
43
  $url .= '&nomeEntrega=' . $this->entregaNome;
44
  $url .= '&ruaEntrega=' . $this->entregaRua;
45
  $url .= '&numeroEntrega=' . $this->entregaNumero;
46
  $url .= '&cidadeEntrega=' . $this->entregaCidade;
47
- $url .= '&ufEntrega=' . $this->entregaEstado;
 
 
48
  $url .= '&paisEntrega=' . $this->entregaPais;
49
  $url .= '&cepEntrega=' . $this->entregaCep;
50
  $url .= '&dddEntrega=' . $this->entregaDddTelefone1;
51
  $url .= '&telefoneEntrega=' . $this->entregaTelefone1;
 
 
 
 
 
52
  $url .= '&codigoPedido=' . $this->codigoPedido;
53
  $url .= '&quantidadeItensDistintos=' . $this->itensDistintos;
54
  $url .= '&quantidadeTotalItens=' . $this->itensTotal;
@@ -57,7 +116,21 @@ class Buscape_Fcontrol_Model_Api extends Buscape_Fcontrol_Model_Api_Abstract
57
  $url .= '&metodoPagamentos=' . $this->metodoPagamento;
58
  $url .= '&numeroParcelasPagamentos=' . $this->numeroParcelas;
59
  $url .= '&valorPagamentos=' . ($this->valorPedido * 100);
 
 
 
 
 
 
 
 
 
 
 
 
60
 
 
 
61
  echo '<iframe height="115" frameborder="0" width="300" src="'. $url .'"></iframe>';
62
  }
63
 
23
 
24
  protected $_urlFrame = 'https://secure.fcontrol.com.br/validatorframe/validatorframe.aspx';
25
 
26
+
27
+
28
+
29
  public function analisaFrame()
30
  {
31
+ function retira_acentos($texto){
32
+ return strtr($texto, "��������������������������", "aaaaeeiooouucAAAAEEIOOOUUC");
33
+ }
34
+
35
+ $url = $this->_urlFrame;
36
+
37
+ $uf = retira_acentos($this->compradorEstado);
38
+
39
+ $uf = strtolower($uf);
40
+
41
+ $uf = str_replace(' ', '_', $uf);
42
+
43
+ $_state_sigla = array(
44
+ 'acre' => 'AC',
45
+ 'alagoas' => 'AL',
46
+ 'amapa' => 'AP',
47
+ 'amazonas' => 'AM',
48
+ 'bahia' => 'BA',
49
+ 'ceara' => 'CE',
50
+ 'distrito_federal' => 'DF',
51
+ 'espirito_santo' => 'ES',
52
+ 'goias' => 'GO',
53
+ 'maranhao' => 'MA',
54
+ 'mato_grosso' => 'MT',
55
+ 'mato_grosso_do_sul' => 'MS',
56
+ 'minas_gerais' => 'MG',
57
+ 'para' => 'PA',
58
+ 'paraiba' => 'PB',
59
+ 'parana' => 'PR',
60
+ 'pernambuco' => 'PE',
61
+ 'piaui' => 'PI',
62
+ 'rio_de_janeiro' => 'RJ',
63
+ 'rio_grande_do_norte' => 'RN',
64
+ 'rio_grande_do_sul' => 'RS',
65
+ 'rondonia' => 'RO',
66
+ 'roraima' => 'RR',
67
+ 'santa_catarina' => 'SC',
68
+ 'sao_paulo' => 'SP',
69
+ 'sergipe' => 'SE',
70
+ 'tocatins' => 'TO'
71
+ );
72
+
73
+ $uf= $_state_sigla[$uf];
74
+
75
 
76
  $url .= '?login=' . $this->getUser();
77
  $url .= '&senha=' . $this->getPassword();
78
  $url .= '&nomeComprador=' . $this->compradorNome;
79
  $url .= '&ruaComprador=' . $this->compradorRua;
80
  $url .= '&numeroComprador=' . $this->compradorNumero;
81
+ $url .= '&bairroComprador=' . $this->compradorBairro; //Atualizacao
82
+ $url .= '&complementoComprador='. $this->compradorComplemento; //Atualizacao
83
  $url .= '&cidadeComprador=' . $this->compradorCidade;
84
+ $url .= '&ufComprador=' . $uf;
85
  $url .= '&paisComprador=' . $this->compradorPais;
86
  $url .= '&cepComprador=' . $this->compradorCep;
87
  $url .= '&dddComprador=' . $this->compradorDddTelefone1;
88
  $url .= '&telefoneComprador=' . $this->compradorTelefone1;
89
+ $url .= '&dddCelularComprador=' . $this->compradorDddCelular; // Atualizacao
90
+ $url .= '&celularComprador=' . $this->compradorCelular; // Atualizacao
91
+ $url .= '&dddComprador2=' . $this->compradorDddCelular; // Atualizacao
92
+ $url .= '&telefoneComprador2=' . $this->compradorCelular; // Atualizacao
93
  $url .= '&cpfComprador=' . $this->compradorCpfCnpj;
94
  $url .= '&emailComprador=' . $this->compradorEmail;
95
  $url .= '&nomeEntrega=' . $this->entregaNome;
96
  $url .= '&ruaEntrega=' . $this->entregaRua;
97
  $url .= '&numeroEntrega=' . $this->entregaNumero;
98
  $url .= '&cidadeEntrega=' . $this->entregaCidade;
99
+ $url .= '&complementoEntrega=' . $this->entregaComplemento; // Atualizacao
100
+ $url .= '&bairroEntrega=' . $this->entregaBairro; // Atualizacao
101
+ $url .= '&ufEntrega=' . $uf;
102
  $url .= '&paisEntrega=' . $this->entregaPais;
103
  $url .= '&cepEntrega=' . $this->entregaCep;
104
  $url .= '&dddEntrega=' . $this->entregaDddTelefone1;
105
  $url .= '&telefoneEntrega=' . $this->entregaTelefone1;
106
+ $url .= '&dddCelularEntrega=' . $this->entregaDddCelular; // Atualizacao
107
+ $url .= '&celularEntrega=' . $this->entregaCelular; // Atualizacao
108
+ $url .= '&dddEntrega2=' . $this->entregaDddCelular; // Atualizacao
109
+ $url .= '&telefoneEntrega2=' . $this->entregaCelular; // Atualizacao
110
+ $url .= '&ip=' . $this->compradorIp; // Atualizacao
111
  $url .= '&codigoPedido=' . $this->codigoPedido;
112
  $url .= '&quantidadeItensDistintos=' . $this->itensDistintos;
113
  $url .= '&quantidadeTotalItens=' . $this->itensTotal;
116
  $url .= '&metodoPagamentos=' . $this->metodoPagamento;
117
  $url .= '&numeroParcelasPagamentos=' . $this->numeroParcelas;
118
  $url .= '&valorPagamentos=' . ($this->valorPedido * 100);
119
+
120
+
121
+ $url = retira_acentos($url);
122
+
123
+
124
+ /* $datetime = new Datetime();
125
+
126
+ $datetime->setTimezone('America/Sao_Paulo');
127
+
128
+ $name = $datetime->format("Y-m-d");
129
+
130
+ $data = var_export(parse_url($url), true);
131
 
132
+ Mage::log($datetime->format("h:m:s").'-'.$data."\n--------------------------------------------------", null, $name.'-fcontrol.log', true);
133
+ */
134
  echo '<iframe height="115" frameborder="0" width="300" src="'. $url .'"></iframe>';
135
  }
136
 
app/code/community/Buscape/Fcontrol/Model/Api/Abstract.php CHANGED
@@ -751,32 +751,32 @@ abstract class Buscape_Fcontrol_Model_Api_Abstract extends Varien_Object
751
  /* @required */
752
  $this->compradorCidade = utf8_decode($order->getBillingAddress()->getCity());
753
 
754
- /* @required */
755
  $this->compradorEstado = utf8_decode($order->getBillingAddress()->getRegion());
756
-
757
  $telBilling = preg_replace("/[^0-9]/","", $order->getBillingAddress()->getTelephone());
758
-
759
  $telBilling = trim($telBilling);
760
 
761
  switch(strlen($telBilling))
762
  {
763
- case 8:
764
- $telephoneBilling = $telBilling;
765
- $dddTelephoneBilling = '';
766
- break;
767
- case 10:
768
- $telephoneBiling = substr($telBilling, -8);
769
- $dddTelephoneBilling = substr($telBilling, -10, 2);
770
- break;
771
- case 12:
772
- $telephoneBiling = substr($telBilling, -8);
773
- $dddTelephoneBilling = substr($telBilling, -10, 2);
774
- break;
775
  }
776
 
777
  $this->compradorDddTelefone1 = $dddTelephoneBilling;
778
-
779
- $this->compradorTelefone1 = $telephoneBiling;
780
 
781
  /* @required */
782
  $this->compradorCpfCnpj = preg_replace("/[^0-9]/","", $order->getCustomerTaxvat());
@@ -801,6 +801,70 @@ abstract class Buscape_Fcontrol_Model_Api_Abstract extends Varien_Object
801
  break;
802
  }
803
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
  /* @required */
805
  $this->compradorEmail = (is_null($order->getBillingAddress()->getEmail())) ? $order->getCustomerEmail() : $order->getBillingAddress()->getEmail();
806
 
@@ -816,19 +880,30 @@ abstract class Buscape_Fcontrol_Model_Api_Abstract extends Varien_Object
816
 
817
  $this->entregaEstado = utf8_decode($order->getShippingAddress()->getRegion());
818
 
 
 
 
819
  /* @required */
820
  $this->entregaNome = $order->getShippingAddress()->getFirstname() . ' ' . $order->getShippingAddress()->getLastname();
821
-
822
- $this->entregaDddTelefone1 = $dddTelephoneShipping;
823
 
824
  $this->entregaTelefone1 = $telephoneShipping;
 
 
 
 
 
 
 
 
825
 
826
  $this->entregaCpfCnpj = preg_replace("/[^0-9]/","", $order->getCustomerTaxvat());
827
 
828
  $this->entregaEmail = $order->getShippingAddress()->getEmail();
829
 
830
  /* @required */
831
- $adapter_payment = Mage::getModel('fcontrol/adapter_payment');
832
 
833
  $adapter_payment->filter($order->getPayment(), $this);
834
 
@@ -885,12 +960,12 @@ abstract class Buscape_Fcontrol_Model_Api_Abstract extends Varien_Object
885
  $this->compradorEstado = utf8_decode($order->getBillingAddress()->getRegion());
886
 
887
  /* @required */
888
- $this->compradorCpfCnpj = preg_replace("/[^0-9]/","", $order->getCustomerTaxvat());
889
 
890
  /* @required */
891
- $this->compradorTelefone1 = str_replace("-", "", $order->getBillingAddress()->getTelephone());
892
 
893
- $this->compradorCelular = str_replace("-", "", $order->getBillingAddress()->getTelephone());
894
 
895
  if($order->getRemoteIp()) {
896
  $this->compradorIp = $order->getRemoteIp();
@@ -1160,10 +1235,10 @@ abstract class Buscape_Fcontrol_Model_Api_Abstract extends Varien_Object
1160
  <DddTelefone>{$this->entregaDddTelefone1}</DddTelefone>
1161
  <NumeroTelefone>{$this->entregaTelefone1}</NumeroTelefone>
1162
  <NomeEntrega>{$this->entregaNome}</NomeEntrega>
1163
- <DddCelular>{$this->entregaDddCelular}</DddCelular>
1164
- <NumeroCelular>{$this->entregaCelular}</NumeroCelular>
1165
  <DddTelefone2>{$this->entregaDddTelefone2}</DddTelefone2>
1166
  <NumeroTelefone2>{$this->entregaTelefone2}</NumeroTelefone2>
 
 
1167
  <CpfCnpj>{$this->entregaCpfCnpj}</CpfCnpj>
1168
  <Sexo>{$this->entregaSexo}</Sexo>
1169
  <DataNascimento>{$this->entregaDataNascimento}</DataNascimento>
751
  /* @required */
752
  $this->compradorCidade = utf8_decode($order->getBillingAddress()->getCity());
753
 
754
+ /* @required */
755
  $this->compradorEstado = utf8_decode($order->getBillingAddress()->getRegion());
756
+
757
  $telBilling = preg_replace("/[^0-9]/","", $order->getBillingAddress()->getTelephone());
758
+
759
  $telBilling = trim($telBilling);
760
 
761
  switch(strlen($telBilling))
762
  {
763
+ case 8:
764
+ $telephoneBilling = $telBilling;
765
+ $dddTelephoneBilling = '';
766
+ break;
767
+ case 10:
768
+ $telephoneBilling = substr($telBilling, -8);
769
+ $dddTelephoneBilling = substr($telBilling, -10, 2);
770
+ break;
771
+ case 12:
772
+ $telephoneBilling = substr($telBilling, -8);
773
+ $dddTelephoneBilling = substr($telBilling, -10, 2);
774
+ break;
775
  }
776
 
777
  $this->compradorDddTelefone1 = $dddTelephoneBilling;
778
+
779
+ $this->compradorTelefone1 = $telephoneBilling;
780
 
781
  /* @required */
782
  $this->compradorCpfCnpj = preg_replace("/[^0-9]/","", $order->getCustomerTaxvat());
801
  break;
802
  }
803
 
804
+
805
+ /* Altera��o Rodrigo - Ddd Celular*/
806
+
807
+ $celBilling = preg_replace("/[^0-9]/","", $order->getBillingAddress()->getFax());
808
+
809
+ $celBilling = trim($celBilling);
810
+
811
+ switch(strlen($celBilling))
812
+ {
813
+ case 8:
814
+ $celularBilling = $celBilling;
815
+ $dddCelularBilling = '';
816
+ break;
817
+ case 9:
818
+ $celularBilling = $celBilling;
819
+ $dddCelularBilling = '';
820
+ break;
821
+ case 10:
822
+ $celularBilling = substr($celBilling, -8);
823
+ $dddCelularBilling = substr($celBilling, -10, 2);
824
+ break;
825
+ case 12:
826
+ $celularBilling = substr($celBilling, -8);
827
+ $dddCelularBilling = substr($celBilling, -10, 2);
828
+ break;
829
+ case 11:
830
+ $celularBilling = substr($celBilling, -9);
831
+ $dddCelularBilling = substr($celBilling, -11, 2);
832
+ break;
833
+ }
834
+
835
+ $this->compradorDddCelular = $dddCelularBilling;
836
+
837
+ $this->compradorCelular = $celularBilling;
838
+
839
+ /* Altera��o Rodrigo - Ddd Shipping*/
840
+ $celShipping = preg_replace("/[^0-9]/","", $order->getShippingAddress()->getFax());
841
+
842
+ $celShipping = trim($celShipping);
843
+
844
+ switch(strlen($celShipping))
845
+ {
846
+ case 8:
847
+ $celularShipping = $celShipping;
848
+ $dddCelularShipping = '';
849
+ break;
850
+ case 9:
851
+ $celularShipping = $celShipping;
852
+ $dddCelularShipping = '';
853
+ break;
854
+ case 10:
855
+ $celularShipping = substr($celShipping, -8);
856
+ $dddCelularShipping = substr($celShipping, -10, 2);
857
+ break;
858
+ case 12:
859
+ $celularShipping = substr($celShipping, -8);
860
+ $dddCelularShipping = substr($celShipping, -10, 2);
861
+ break;
862
+ case 11:
863
+ $celularShipping = substr($celShipping, -9);
864
+ $dddCelularShipping = substr($celShipping, -11, 2);
865
+ break;
866
+ }
867
+
868
  /* @required */
869
  $this->compradorEmail = (is_null($order->getBillingAddress()->getEmail())) ? $order->getCustomerEmail() : $order->getBillingAddress()->getEmail();
870
 
880
 
881
  $this->entregaEstado = utf8_decode($order->getShippingAddress()->getRegion());
882
 
883
+ $this->entregaComplemento = utf8_decode($order->getShippingAddress()->getStreet3());
884
+
885
+
886
  /* @required */
887
  $this->entregaNome = $order->getShippingAddress()->getFirstname() . ' ' . $order->getShippingAddress()->getLastname();
888
+
889
+ $this->entregaDddTelefone1 = $dddTelephoneShipping;
890
 
891
  $this->entregaTelefone1 = $telephoneShipping;
892
+
893
+ $this->entregaDddCelular = $dddCelularShipping; //Altera��o Rodrigo
894
+
895
+ $this->entregaCelular = $celularShipping; // Altera��o Rodrigo
896
+
897
+ if($order->getRemoteIp()) { //Altera��o Rodrigo
898
+ $this->compradorIp = $order->getRemoteIp();
899
+ }
900
 
901
  $this->entregaCpfCnpj = preg_replace("/[^0-9]/","", $order->getCustomerTaxvat());
902
 
903
  $this->entregaEmail = $order->getShippingAddress()->getEmail();
904
 
905
  /* @required */
906
+ $adapter_payment = Mage::getModel('fcontrol/adapter_payment');
907
 
908
  $adapter_payment->filter($order->getPayment(), $this);
909
 
960
  $this->compradorEstado = utf8_decode($order->getBillingAddress()->getRegion());
961
 
962
  /* @required */
963
+ $this->compradorCpfCnpj = preg_replace("/[^0-9]/","", $this->getData('customer_taxvat')); //$order->getCustomerTaxvat()
964
 
965
  /* @required */
966
+ $this->compradorTelefone1 = str_replace("-", "", $order->getBillingAddress()->getData('telephone'));
967
 
968
+ $this->compradorCelular = str_replace("-", "", $order->getBillingAddress()->getData('fax')); //Altera��o Rodrigo
969
 
970
  if($order->getRemoteIp()) {
971
  $this->compradorIp = $order->getRemoteIp();
1235
  <DddTelefone>{$this->entregaDddTelefone1}</DddTelefone>
1236
  <NumeroTelefone>{$this->entregaTelefone1}</NumeroTelefone>
1237
  <NomeEntrega>{$this->entregaNome}</NomeEntrega>
 
 
1238
  <DddTelefone2>{$this->entregaDddTelefone2}</DddTelefone2>
1239
  <NumeroTelefone2>{$this->entregaTelefone2}</NumeroTelefone2>
1240
+ <DddCelular>{$this->entregaDddCelular}</DddCelular>
1241
+ <NumeroCelular>{$this->entregaCelular}</NumeroCelular>
1242
  <CpfCnpj>{$this->entregaCpfCnpj}</CpfCnpj>
1243
  <Sexo>{$this->entregaSexo}</Sexo>
1244
  <DataNascimento>{$this->entregaDataNascimento}</DataNascimento>
app/code/community/Buscape/Fcontrol/controllers/Adminhtml/Sales/OrderController.php CHANGED
@@ -183,7 +183,7 @@ class Buscape_Fcontrol_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sa
183
  return Mage::getSingleton('admin/session')->isAllowed($aclResource);
184
  break;
185
  default:
186
- return Mage::getSingleton('admin/session')->isAllowed('sales/order/');
187
  break;
188
  }
189
  }
183
  return Mage::getSingleton('admin/session')->isAllowed($aclResource);
184
  break;
185
  default:
186
+ return Mage::getSingleton('admin/session')->isAllowed('sales/order');
187
  break;
188
  }
189
  }
app/code/community/Buscape/Fcontrol/etc/config.xml CHANGED
@@ -1,4 +1,4 @@
1
- <?xml version="1.0"?>
2
  <!--
3
  /**
4
  * Magento
@@ -22,7 +22,7 @@
22
  <config>
23
  <modules>
24
  <Buscape_Fcontrol>
25
- <version>0.1.8</version>
26
  </Buscape_Fcontrol>
27
  </modules>
28
  <global>
1
+ <?xml version="1.0"?>
2
  <!--
3
  /**
4
  * Magento
22
  <config>
23
  <modules>
24
  <Buscape_Fcontrol>
25
+ <version>0.1.9</version>
26
  </Buscape_Fcontrol>
27
  </modules>
28
  <global>
package.xml CHANGED
@@ -1,18 +1,30 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Buscape_Fcontrol</name>
4
- <version>0.1.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Extens&#xE3;o Buscap&#xE9; Fcontrol para Magento</summary>
10
- <description>O FControl &#xE9; um sofisticado sistema que utiliza redes neurais e intelig&#xEA;ncia artificial para detectar fraudes em tempo real.</description>
11
- <notes>Buscap&#xE9; Fcontrol &#xE9; compat&#xED;vel com Magento Enterprise Edition 1.7.0.0 ou superior, Professional Edition 1.9.0.0 ou superior, e Magento Community Edition 1.3.3.0 ou superior.</notes>
12
- <authors><author><name>buscapedev</name><user>auto-converted</user><email>suporte.developer@buscapecompany.com</email></author></authors>
13
- <date>2012-07-06</date>
14
- <time>18:04:53</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Buscape_Fcontrol.xml" hash="1883e6e4a5f712adbb28fc48b91b77ed"/></dir></target><target name="magecommunity"><dir name="Buscape"><dir name="Fcontrol"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><file name="Info.php" hash="23565f6e5ff898d0d32993dda14acfe4"/></dir><file name="Grid.php" hash="8a9cd394c7d05c875353b9a6a9c509f8"/></dir><file name="Order.php" hash="306f634ac46d7dec061fd18e76f11e34"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="533804f2631993dbfd1d2cbb978510a1"/></dir><dir name="Model"><dir name="Adapter"><file name="Payment.php" hash="bb3114c2b7aae84f2c261cc110cc3220"/><file name="Shipping.php" hash="d40c268415ec2a2c50870bf811176b44"/></dir><dir name="Api"><file name="Abstract.php" hash="a383b76906e116fb279c696b40d17e2f"/></dir><dir name="Source"><file name="Service.php" hash="ce9458ee8419c55346ab96ead62915de"/></dir><file name="Api.php" hash="635befcf547671471a8b68401e377d5d"/><file name="Config.php" hash="fab005089945576b2b6cf4ecf076d3af"/><file name="Observer.php" hash="8b68046645290c9f91957fa38a1df290"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><file name="OrderController.php" hash="db12a93be59057875d4c488fde37956d"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="a6ef64905fd9ce16a34ffcd194cc881c"/><file name="system.xml" hash="0bbf7e2fd0ffc57a30f02fc2211c616d"/></dir></dir></dir></target><target name="magelib"><dir name="nusoap"><file name="nusoap.php" hash="be25f8f414d3bc104fa32fd33d1ca670"/><file name="nusoap_base.php" hash="2b58ef48c2588c9eb1e197e609cf3578"/><file name="nusoap_fault.php" hash="b1e071de96ac6ec4401fc3378985b915"/><file name="nusoapmime.php" hash="385906df53d95e99d44a3ccf826657b0"/><file name="soap_parser.php" hash="5fd16dfe735ba059a2bcd6f13b2e4200"/><file name="soap_server.php" hash="7335a46989fcb2e6a0cb094bea9636f6"/><file name="soap_transport_http.php" hash="47e7e9295559211833aa733259ae4426"/><file name="soap_val.php" hash="bfe395c44feee1833806ffb87f53d301"/><file name="soapclient.php" hash="a386ecd977dcef79dacebd596808773f"/><file name="wsdl.php" hash="848f9fce1e0da0d88584d0e6ca1f242d"/><file name="wsdlcache.php" hash="e06853ca25271b5cb4b8a7016c960a40"/><file name="xmlschema.php" hash="5d5c67fd3e30dd96a186551a7c7221c8"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="buscape"><dir name="fcontrol"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="d413cbc0c742f78e24e5dfcd1859dc66"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
 
 
 
 
 
 
 
 
 
 
 
 
16
  <compatible/>
17
- <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Buscape_Fcontrol</name>
4
+ <version>0.1.9</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Extens&#xE3;o Buscap&#xE9; FControl para Magento</summary>
10
+ <description>&lt;p&gt;FControl extension for Magento uses neural network and artificial intelligence (AI) to detect frauds in real time through the score per customer in the risk scale.&lt;/p&gt;&#xD;
11
+ &#xD;
12
+ &lt;p&gt;For more information, read the following manuals: &lt;a href="https://www.fcontrol.com.br/manuaisfcontrol/integracao/FilaAnalise/NormalEnglish.aspx"&gt;FControl - Analysis Queue&lt;/a&gt;, for stores with risk analysts, and &lt;a href="https://www.fcontrol.com.br/manuaisfcontrol/integracao/Frame/frame.aspx"&gt;FControl - Frame&lt;/a&gt;, for stores without risk analysts.&lt;/p&gt;&#xD;
13
+ &#xD;
14
+ &lt;p&gt;For support, contacts us: &lt;a href="mailto:suporte.developer@buscapecompany.com"&gt;suporte.developer@buscapecompany.com&lt;/a&gt;&lt;/p&gt;&#xD;
15
+ &#xD;
16
+ *&#xD;
17
+ &#xD;
18
+ &lt;p&gt;A extens&#xE3;o para Magento da FControl utiliza conhecimentos de rede neural e intelig&#xEA;ncia artificial para detectar fraudes em tempo real atrav&#xE9;s da pontua&#xE7;&#xE3;o do consumidor na escala de risco.&lt;/p&gt;&#xD;
19
+ &#xD;
20
+ &lt;p&gt;Para mais informa&#xE7;&#xF5;es, leia os seguintes manuais: &lt;a href="https://www.fcontrol.com.br/manuaisfcontrol/integracao/FilaAnalise/NormalEnglish.aspx"&gt;FControl - Fila de An&#xE1;lise&lt;/a&gt;, para lojas com analistas de risco, and &lt;a href="https://www.fcontrol.com.br/manuaisfcontrol/integracao/Frame/frame.aspx"&gt;FControl - Frame&lt;/a&gt;, para lojas sem analistas de risco.&lt;/p&gt;&#xD;
21
+ &#xD;
22
+ &lt;p&gt;Para suporte, mande um e-mail para: &lt;a href="mailto:suporte.developer@buscapecompany.com"&gt;suporte.developer@buscapecompany.com&lt;/a&gt;&lt;/p&gt;</description>
23
+ <notes>Extens&#xE3;o Buscap&#xE9; Fcontrol para Magento CE 1.3+, PE 1.9+ e EE 1.7+.</notes>
24
+ <authors><author><name>Buscap&#xE9; Developer</name><user>buscapedev</user><email>suporte.developer@buscape-inc.com</email></author></authors>
25
+ <date>2013-06-06</date>
26
+ <time>17:52:34</time>
27
+ <contents><target name="mageetc"><dir name="modules"><file name="Buscape_Fcontrol.xml" hash="1883e6e4a5f712adbb28fc48b91b77ed"/></dir></target><target name="magecommunity"><dir name="Buscape"><dir name="Fcontrol"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="8a9cd394c7d05c875353b9a6a9c509f8"/><dir name="View"><file name="Info.php" hash="7c9df00716de71af13594b2a0459e82b"/></dir></dir><file name="Order.php" hash="306f634ac46d7dec061fd18e76f11e34"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="533804f2631993dbfd1d2cbb978510a1"/></dir><dir name="Model"><dir name="Adapter"><file name="Payment.php" hash="48a581bdb1a6473e9ce3986219d65281"/><file name="Shipping.php" hash="d40c268415ec2a2c50870bf811176b44"/></dir><dir name="Api"><file name="Abstract.php" hash="1c09c03e3ded8330776d4c8b207c6023"/></dir><file name="Api.php" hash="849b4185338eb165e2460e5994d6f607"/><file name="Config.php" hash="fab005089945576b2b6cf4ecf076d3af"/><file name="Observer.php" hash="8b68046645290c9f91957fa38a1df290"/><dir name="Source"><file name="Service.php" hash="ce9458ee8419c55346ab96ead62915de"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><file name="OrderController.php" hash="d5689003f317b36edf4f29f87762d522"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="757eedfa882bc286981a3c82a0002a5b"/><file name="system.xml" hash="0bbf7e2fd0ffc57a30f02fc2211c616d"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="buscape"><dir name="fcontrol"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="d413cbc0c742f78e24e5dfcd1859dc66"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="nusoap"><file name="nusoap.php" hash="be25f8f414d3bc104fa32fd33d1ca670"/><file name="nusoap_base.php" hash="2b58ef48c2588c9eb1e197e609cf3578"/><file name="nusoap_fault.php" hash="b1e071de96ac6ec4401fc3378985b915"/><file name="nusoapmime.php" hash="385906df53d95e99d44a3ccf826657b0"/><file name="soap_parser.php" hash="5fd16dfe735ba059a2bcd6f13b2e4200"/><file name="soap_server.php" hash="7335a46989fcb2e6a0cb094bea9636f6"/><file name="soap_transport_http.php" hash="47e7e9295559211833aa733259ae4426"/><file name="soap_val.php" hash="bfe395c44feee1833806ffb87f53d301"/><file name="soapclient.php" hash="a386ecd977dcef79dacebd596808773f"/><file name="wsdl.php" hash="848f9fce1e0da0d88584d0e6ca1f242d"/><file name="wsdlcache.php" hash="e06853ca25271b5cb4b8a7016c960a40"/><file name="xmlschema.php" hash="5d5c67fd3e30dd96a186551a7c7221c8"/></dir></target></contents>
28
  <compatible/>
29
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
30
  </package>