pagueveloz - Version 1.0.6

Version Notes

Features:

- Configuração para ordenar forma de pagamento;
- Adicionado botão para imprimir boleto na pagina do pedido e no Success;

Download this release

Release Info

Developer Trezo
Extension pagueveloz
Version 1.0.6
Comparing to
See all releases


Code changes from version 1.0.5 to 1.0.6

Files changed (103) hide show
  1. app/code/community/PagueVeloz/Api/Helper/Data.php +9 -0
  2. app/code/community/PagueVeloz/Api/Model/Common/HttpContext.php +90 -0
  3. app/code/community/PagueVeloz/Api/Model/Common/HttpResponse.php +48 -0
  4. app/code/community/PagueVeloz/Api/Model/Dto/AssinarDTO.php +121 -0
  5. app/code/community/PagueVeloz/Api/Model/Dto/AuthenticationDTO.php +39 -0
  6. app/code/community/PagueVeloz/Api/Model/Dto/BoletoDTO.php +193 -0
  7. app/code/community/PagueVeloz/Api/Model/Dto/ClienteDTO.php +142 -0
  8. app/code/community/PagueVeloz/Api/Model/Dto/ComprarCreditosSMSDTO.php +47 -0
  9. app/code/community/PagueVeloz/Api/Model/Dto/ConsultarBoletoDTO.php +22 -0
  10. app/code/community/PagueVeloz/Api/Model/Dto/ConsultarClienteDTO.php +32 -0
  11. app/code/community/PagueVeloz/Api/Model/Dto/ContaBancariaDTO.php +76 -0
  12. app/code/community/PagueVeloz/Api/Model/Dto/ContaDTO.php +108 -0
  13. app/code/community/PagueVeloz/Api/Model/Dto/CreditoSMSDTO.php +22 -0
  14. app/code/community/PagueVeloz/Api/Model/Dto/EmailDTO.php +33 -0
  15. app/code/community/PagueVeloz/Api/Model/Dto/EmitirBoletoDTO.php +144 -0
  16. app/code/community/PagueVeloz/Api/Model/Dto/MensagemSMSDTO.php +68 -0
  17. app/code/community/PagueVeloz/Api/Model/Dto/PacotesSMSDTO.php +6 -0
  18. app/code/community/PagueVeloz/Api/Model/Dto/SaqueDTO.php +38 -0
  19. app/code/community/PagueVeloz/Api/Model/Dto/TransferenciaDTO.php +52 -0
  20. app/code/community/PagueVeloz/Api/Model/Exceptions/ArgumentNullException.php +6 -0
  21. app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidEmailException.php +11 -0
  22. app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidHostException.php +11 -0
  23. app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidJSONException.php +11 -0
  24. app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidMethodException.php +11 -0
  25. app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidValueException.php +11 -0
  26. app/code/community/PagueVeloz/Api/Model/Interfaces/IHttpClient.php +7 -0
  27. app/code/community/PagueVeloz/Api/Model/Observer.php +38 -0
  28. app/code/community/PagueVeloz/Api/Model/Services/Curl.php +62 -0
  29. app/code/community/PagueVeloz/Api/Model/Source/States.php +39 -0
  30. app/code/community/PagueVeloz/Api/Model/Webservice.php +198 -0
  31. app/code/community/PagueVeloz/Api/Model/Webservice/Assinar.php +44 -0
  32. app/code/community/PagueVeloz/Api/Model/Webservice/Boleto.php +69 -0
  33. app/code/community/PagueVeloz/Api/Model/Webservice/Cliente.php +57 -0
  34. app/code/community/PagueVeloz/Api/Model/Webservice/ComprarCreditosSMS.php +56 -0
  35. app/code/community/PagueVeloz/Api/Model/Webservice/ConsultarBoleto.php +38 -0
  36. app/code/community/PagueVeloz/Api/Model/Webservice/ConsultarCliente.php +38 -0
  37. app/code/community/PagueVeloz/Api/Model/Webservice/Conta.php +49 -0
  38. app/code/community/PagueVeloz/Api/Model/Webservice/ContaBancaria.php +103 -0
  39. app/code/community/PagueVeloz/Api/Model/Webservice/CreditoSMS.php +38 -0
  40. app/code/community/PagueVeloz/Api/Model/Webservice/EmitirBoleto.php +55 -0
  41. app/code/community/PagueVeloz/Api/Model/Webservice/MensagemSMS.php +58 -0
  42. app/code/community/PagueVeloz/Api/Model/Webservice/PacotesSMS.php +39 -0
  43. app/code/community/PagueVeloz/Api/Model/Webservice/PagueVeloz.php +69 -0
  44. app/code/community/PagueVeloz/Api/Model/Webservice/Saldo.php +38 -0
  45. app/code/community/PagueVeloz/Api/Model/Webservice/Saque.php +83 -0
  46. app/code/community/PagueVeloz/Api/Model/Webservice/Transferencia.php +59 -0
  47. app/code/community/PagueVeloz/Api/controllers/Adminhtml/PaguevelozController.php +53 -0
  48. app/code/community/PagueVeloz/Api/etc/adminhtml.xml +14 -0
  49. app/code/community/PagueVeloz/Api/etc/config.xml +73 -0
  50. app/code/community/PagueVeloz/Api/etc/system.xml +179 -0
  51. app/code/community/PagueVeloz/Boleto/Block/Adminhtml/Content.php +17 -0
  52. app/code/community/PagueVeloz/Boleto/Block/Adminhtml/Js.php +6 -0
  53. app/code/community/PagueVeloz/Boleto/Block/Adminhtml/Sales/Order/View/Tab/Boleto.php +60 -0
  54. app/code/community/PagueVeloz/Boleto/Block/Form/Boleto.php +35 -0
  55. app/code/community/PagueVeloz/Boleto/Block/Info/Boleto.php +36 -0
  56. app/code/community/PagueVeloz/Boleto/Block/Onepage/Success.php +5 -0
  57. app/code/community/PagueVeloz/Boleto/Helper/Data.php +6 -0
  58. app/code/community/PagueVeloz/Boleto/Model/Boleto.php +183 -0
  59. app/code/community/PagueVeloz/Boleto/Model/BoletoMethod.php +72 -0
  60. app/code/community/PagueVeloz/Boleto/Model/Cron.php +29 -0
  61. app/code/community/PagueVeloz/Boleto/Model/Mysql4/Boleto.php +11 -0
  62. app/code/community/PagueVeloz/Boleto/Model/Mysql4/Boleto/Collection.php +11 -0
  63. app/code/community/PagueVeloz/Boleto/controllers/Adminhtml/BoletoController.php +81 -0
  64. app/code/community/PagueVeloz/Boleto/controllers/Adminhtml/ContaController.php +40 -0
  65. app/code/community/PagueVeloz/Boleto/etc/adminhtml.xml +33 -0
  66. app/code/community/PagueVeloz/Boleto/etc/config.xml +108 -0
  67. app/code/community/PagueVeloz/Boleto/etc/system.xml +136 -0
  68. app/code/community/PagueVeloz/Boleto/sql/pagueveloz_boleto_setup/mysql4-install-1.0.0.php +19 -0
  69. app/code/community/PagueVeloz/Boleto/sql/pagueveloz_boleto_setup/mysql4-upgrade-1.0.0-1.0.1.php +8 -0
  70. app/code/community/PagueVeloz/Boleto/sql/pagueveloz_boleto_setup/mysql4-upgrade-1.0.1-1.0.2.php +9 -0
  71. app/code/community/PagueVeloz/Sms/Block/Adminhtml/Content.php +46 -0
  72. app/code/community/PagueVeloz/Sms/Block/Adminhtml/Js.php +27 -0
  73. app/code/community/PagueVeloz/Sms/Helper/Data.php +6 -0
  74. app/code/community/PagueVeloz/Sms/Model/Cron.php +47 -0
  75. app/code/community/PagueVeloz/Sms/Model/Mysql4/Sms.php +11 -0
  76. app/code/community/PagueVeloz/Sms/Model/Mysql4/Sms/Collection.php +11 -0
  77. app/code/community/PagueVeloz/Sms/Model/Mysql4/Template.php +11 -0
  78. app/code/community/PagueVeloz/Sms/Model/Mysql4/Template/Collection.php +11 -0
  79. app/code/community/PagueVeloz/Sms/Model/Observer.php +29 -0
  80. app/code/community/PagueVeloz/Sms/Model/Sms.php +37 -0
  81. app/code/community/PagueVeloz/Sms/Model/Template.php +47 -0
  82. app/code/community/PagueVeloz/Sms/controllers/Adminhtml/SmsController.php +140 -0
  83. app/code/community/PagueVeloz/Sms/etc/adminhtml.xml +33 -0
  84. app/code/community/PagueVeloz/Sms/etc/config.xml +109 -0
  85. app/code/community/PagueVeloz/Sms/etc/system.xml +40 -0
  86. app/code/community/PagueVeloz/Sms/sql/pagueveloz_sms_setup/mysql4-install-1.0.0.php +17 -0
  87. app/code/community/PagueVeloz/Sms/sql/pagueveloz_sms_setup/mysql4-upgrade-1.0.0-1.0.1.php +19 -0
  88. app/design/adminhtml/default/default/layout/pagueveloz_boleto.xml +42 -0
  89. app/design/adminhtml/default/default/layout/pagueveloz_sms.xml +14 -0
  90. app/design/adminhtml/default/default/template/pagueveloz/boleto.phtml +83 -0
  91. app/design/adminhtml/default/default/template/pagueveloz/js.phtml +154 -0
  92. app/design/adminhtml/default/default/template/pagueveloz_boleto/content.phtml +221 -0
  93. app/design/adminhtml/default/default/template/pagueveloz_boleto/js.phtml +43 -0
  94. app/design/adminhtml/default/default/template/pagueveloz_sms/content.phtml +361 -0
  95. app/design/adminhtml/default/default/template/pagueveloz_sms/js.phtml +212 -0
  96. app/design/adminhtml/default/default/template/payment/info/pagueveloz_boleto.phtml +45 -0
  97. app/design/frontend/base/default/layout/pagueveloz_boleto.xml +10 -0
  98. app/design/frontend/base/default/template/pagueveloz_boleto/success.phtml +33 -0
  99. app/design/frontend/base/default/template/payment/form/pagueveloz_boleto.phtml +17 -0
  100. app/design/frontend/base/default/template/payment/info/pagueveloz_boleto.phtml +45 -0
  101. app/etc/modules/PagueVeloz_All.xml +32 -0
  102. package.xml +6 -6
  103. skin/frontend/base/default/images/pagueveloz/botao-imprimir-boleto.png +0 -0
app/code/community/PagueVeloz/Api/Helper/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author andre
5
+ */
6
+ class PagueVeloz_Api_Helper_Data extends Mage_Core_Helper_Abstract
7
+ {
8
+
9
+ }
app/code/community/PagueVeloz/Api/Model/Common/HttpContext.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Common_HttpContext
4
+ {
5
+
6
+ private $_headers = array();
7
+ private $_method = 'GET';
8
+ private $_body = '';
9
+ private $_host = '';
10
+
11
+ public function setAuthorization($email, $token)
12
+ {
13
+ if (empty($token)) {
14
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$token é nulo");
15
+ }
16
+
17
+ $this->addHeader('Authorization: Basic ' . base64_encode($email . ":" . $token));
18
+ }
19
+
20
+ public function addHeader($header)
21
+ {
22
+ if (empty($header)) {
23
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$header é nulo");
24
+ }
25
+
26
+ if (!in_array($header, $this->getHeaders()))
27
+ $this->_headers[] = $header;
28
+ }
29
+
30
+ public function setMethod($method)
31
+ {
32
+ if (empty($method)) {
33
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$method é nulo");
34
+ }
35
+
36
+ $method = strtolower($method);
37
+
38
+ if (!in_array($method, array('get', 'post', 'put', 'delete'))) {
39
+ throw new PagueVeloz_Api_Model_Exceptions_InvalidMethodException("$method é inválido");
40
+ }
41
+
42
+ $this->_method = $method;
43
+ }
44
+
45
+ public function setBody($body)
46
+ {
47
+ if (empty($body)) {
48
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$body é nulo, este argumento deve ser informado");
49
+ }
50
+
51
+ // TODO
52
+ // se header contem content/type json? então faz json_decode($body)
53
+
54
+ if (json_decode($body) === null) {
55
+ throw new PagueVeloz_Api_Model_Exceptions_InvalidJSONException("$body é inválido");
56
+ }
57
+
58
+ $this->_body = $body;
59
+ }
60
+
61
+ public function setHost($host)
62
+ {
63
+ if (empty($host)) {
64
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$host é nulo, este argumento deve ser informado");
65
+ }
66
+
67
+ $this->_host = $host;
68
+ }
69
+
70
+ public function getHeaders()
71
+ {
72
+ return $this->_headers;
73
+ }
74
+
75
+ public function getMethod()
76
+ {
77
+ return $this->_method;
78
+ }
79
+
80
+ public function getBody()
81
+ {
82
+ return $this->_body;
83
+ }
84
+
85
+ public function getHost()
86
+ {
87
+ return $this->_host;
88
+ }
89
+
90
+ }
app/code/community/PagueVeloz/Api/Model/Common/HttpResponse.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Common_HttpResponse
4
+ {
5
+
6
+ private $_status = 200;
7
+ private $_headers = array();
8
+ private $_body;
9
+
10
+ public function setStatus($status)
11
+ {
12
+ if (empty($status)) {
13
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$status é null. O parametro \"Status\" não deve ser NULL ou vazio.");
14
+ }
15
+
16
+ $this->_status = $status;
17
+ }
18
+
19
+ public function addHeaders($headers)
20
+ {
21
+ if (empty($headers)) {
22
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$headers é null. O \"Header\" não pode ser NULL ou vazio.");
23
+ }
24
+
25
+ $this->_headers[] = $headers;
26
+ }
27
+
28
+ public function setBody($body)
29
+ {
30
+ $this->_body = $body;
31
+ }
32
+
33
+ public function getStatus()
34
+ {
35
+ return $this->_status;
36
+ }
37
+
38
+ public function getHeaders()
39
+ {
40
+ return $this->_headers;
41
+ }
42
+
43
+ public function getBody()
44
+ {
45
+ return $this->_body;
46
+ }
47
+
48
+ }
app/code/community/PagueVeloz/Api/Model/Dto/AssinarDTO.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_AssinarDTO
4
+ {
5
+
6
+ private $_nome = '';
7
+ private $_documento = '';
8
+ private $_tipoPessoa = '';
9
+ private $_email = '';
10
+ private $_loginUsuarioDefault = '';
11
+ private $estado = '';
12
+ private $cidade = '';
13
+ private $rua = '';
14
+ private $cep = '';
15
+ private $numero = '';
16
+
17
+ public function getEstado()
18
+ {
19
+ return $this->estado;
20
+ }
21
+
22
+ public function getCidade()
23
+ {
24
+ return $this->cidade;
25
+ }
26
+
27
+ public function getRua()
28
+ {
29
+ return $this->rua;
30
+ }
31
+
32
+ public function getCep()
33
+ {
34
+ return $this->cep;
35
+ }
36
+
37
+ public function getNumero()
38
+ {
39
+ return $this->numero;
40
+ }
41
+
42
+ public function setEstado($estado)
43
+ {
44
+ $this->estado = $estado;
45
+ }
46
+
47
+ public function setCidade($cidade)
48
+ {
49
+ $this->cidade = $cidade;
50
+ }
51
+
52
+ public function setRua($rua)
53
+ {
54
+ $this->rua = $rua;
55
+ }
56
+
57
+ public function setCep($cep)
58
+ {
59
+ $this->cep = $cep;
60
+ }
61
+
62
+ public function setNumero($numero)
63
+ {
64
+ $this->numero = $numero;
65
+ }
66
+
67
+ public function setNome($nome)
68
+ {
69
+ if (empty($nome)) {
70
+ throw new Exception("$nome vazio");
71
+ }
72
+
73
+ $this->_nome = $nome;
74
+ }
75
+
76
+ public function setDocumento($documento)
77
+ {
78
+ $this->_documento = $documento;
79
+ }
80
+
81
+ public function setTipoPessoa($tipoPessoa)
82
+ {
83
+ $this->_tipoPessoa = $tipoPessoa;
84
+ }
85
+
86
+ public function setEmail($email)
87
+ {
88
+ $this->_email = $email;
89
+ }
90
+
91
+ public function setLoginUsuarioDefault($loginUsuarioDefault)
92
+ {
93
+ $this->_loginUsuarioDefault = $loginUsuarioDefault;
94
+ }
95
+
96
+ public function getNome()
97
+ {
98
+ return $this->_nome;
99
+ }
100
+
101
+ public function getDocumento()
102
+ {
103
+ return $this->_documento;
104
+ }
105
+
106
+ public function getTipoPessoa()
107
+ {
108
+ return $this->_tipoPessoa;
109
+ }
110
+
111
+ public function getEmail()
112
+ {
113
+ return $this->_email;
114
+ }
115
+
116
+ public function getLoginUsuarioDefault()
117
+ {
118
+ return $this->_loginUsuarioDefault;
119
+ }
120
+
121
+ }
app/code/community/PagueVeloz/Api/Model/Dto/AuthenticationDTO.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_AuthenticationDTO
4
+ {
5
+
6
+ private $_email;
7
+ private $_token;
8
+
9
+ public function __construct($email, $token)
10
+ {
11
+ $this->setEmail($email);
12
+ $this->setToken($token);
13
+ }
14
+
15
+ public function setEmail($email)
16
+ {
17
+ $this->_email = $email;
18
+ }
19
+
20
+ public function setToken($token)
21
+ {
22
+ if (empty($token)) {
23
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$token é null. Argumento \"Token\" não pode ser NULL ou vazio.");
24
+ }
25
+
26
+ $this->_token = $token;
27
+ }
28
+
29
+ public function getEmail()
30
+ {
31
+ return $this->_email;
32
+ }
33
+
34
+ public function getToken()
35
+ {
36
+ return $this->_token;
37
+ }
38
+
39
+ }
app/code/community/PagueVeloz/Api/Model/Dto/BoletoDTO.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_BoletoDTO
4
+ {
5
+ private $_email;
6
+ private $_pdf = false;
7
+ private $_data;
8
+ private $_vencimento;
9
+ private $_valor;
10
+ private $_seuNumero;
11
+ private $_sacado;
12
+ private $_cpfCnpjSacado;
13
+ private $_parcela;
14
+ private $_linha1;
15
+ private $_linha2;
16
+ private $_cpfCnpjCedente;
17
+ private $_cedente;
18
+
19
+ public function setVencimento($vencimento)
20
+ {
21
+ if (empty($vencimento)) {
22
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$vencimento\" é null.");
23
+ }
24
+
25
+ $this->_vencimento = $vencimento;
26
+ }
27
+
28
+ public function setValor($valor)
29
+ {
30
+ if (empty($valor)) {
31
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$valor\" é null.");
32
+ }
33
+ $this->_valor = $valor;
34
+ }
35
+
36
+ public function setSeuNumero($seuNumero)
37
+ {
38
+ if (empty($seuNumero)) {
39
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$seuNumero\" é null.");
40
+ }
41
+
42
+ $this->_seuNumero = $seuNumero;
43
+ }
44
+
45
+ public function setSacado($sacado)
46
+ {
47
+ if (empty($sacado)) {
48
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$sacado\" é null.");
49
+ }
50
+
51
+ $this->_sacado = $sacado;
52
+ }
53
+
54
+ public function setCpfCnpjSacado($cpfCnpjSacado)
55
+ {
56
+ if (empty($cpfCnpjSacado)) {
57
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$cpfCnpjSacado\" é null.");
58
+ }
59
+
60
+ $this->_cpfCnpjSacado = $cpfCnpjSacado;
61
+ }
62
+
63
+ public function setParcela($parcela)
64
+ {
65
+ $this->_parcela = $parcela;
66
+ }
67
+
68
+ public function setLinha1($linha1)
69
+ {
70
+ $this->_linha1 = $linha1;
71
+ }
72
+
73
+ public function setLinha2($linha2)
74
+ {
75
+ $this->_linha2 = $linha2;
76
+ }
77
+
78
+ public function setCpfCnpjCedente($cpfCnpjCedente)
79
+ {
80
+ if (empty($cpfCnpjCedente)) {
81
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$cpfCnpjCedente\" é null.");
82
+ }
83
+
84
+ $this->_cpfCnpjCedente = $cpfCnpjCedente;
85
+ }
86
+
87
+ public function setCedente($cedente)
88
+ {
89
+ if (empty($cedente)) {
90
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$cedente\" é null.");
91
+ }
92
+
93
+ $this->_cedente = $cedente;
94
+ }
95
+
96
+ public function getVencimento()
97
+ {
98
+ return $this->_vencimento;
99
+ }
100
+
101
+ public function getValor()
102
+ {
103
+ return $this->_valor;
104
+ }
105
+
106
+ public function getSeuNumero()
107
+ {
108
+ return $this->_seuNumero;
109
+ }
110
+
111
+ public function getSacado()
112
+ {
113
+ return $this->_sacado;
114
+ }
115
+
116
+ public function getCpfCnpjSacado()
117
+ {
118
+ return $this->_cpfCnpjSacado;
119
+ }
120
+
121
+ public function getParcela()
122
+ {
123
+ return $this->_parcela;
124
+ }
125
+
126
+ public function getLinha1()
127
+ {
128
+ return $this->_linha1;
129
+ }
130
+
131
+ public function getLinha2()
132
+ {
133
+ if (Mage::getStoreConfig('payment/pagueveloz_boleto/generate_line_2')) {
134
+ return " - Ref pedido {$this->getSeuNumero()} efetuado em " . Mage::getStoreConfig('web/unsecure/base_url');
135
+ }
136
+
137
+ return $this->_linha2;
138
+
139
+ }
140
+
141
+ public function getCpfCnpjCedente()
142
+ {
143
+ return $this->_cpfCnpjCedente;
144
+ }
145
+
146
+ public function getCedente()
147
+ {
148
+ return $this->_cedente;
149
+ }
150
+
151
+ public function setData($data)
152
+ {
153
+ if (empty($data)) {
154
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$data\" é null.");
155
+ }
156
+
157
+ $this->_data = $data;
158
+ }
159
+
160
+ public function getData()
161
+ {
162
+ return $this->_data;
163
+ }
164
+
165
+ public function getEmail()
166
+ {
167
+ if (Mage::getStoreConfig('payment/pagueveloz_boleto/send_email')) {
168
+ return $this->_email;
169
+ }
170
+
171
+ return false;
172
+ }
173
+
174
+ public function getPdf()
175
+ {
176
+ if (!$this->_pdf) {
177
+ $this->_pdf = Mage::getStoreConfig('payment/pagueveloz_boleto/pdf') ? true : false;
178
+ }
179
+
180
+ return $this->_pdf;
181
+ }
182
+
183
+ public function setEmail($_email)
184
+ {
185
+ $this->_email = $_email;
186
+ }
187
+
188
+ public function setPdf($_pdf)
189
+ {
190
+ $this->_pdf = $_pdf;
191
+ }
192
+
193
+ }
app/code/community/PagueVeloz/Api/Model/Dto/ClienteDTO.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_ClienteDTO
4
+ {
5
+
6
+ private $nome;
7
+ private $email;
8
+ private $enviarEmailBoletosPagos;
9
+ private $cidade;
10
+ private $estado;
11
+ private $rua;
12
+ private $numero;
13
+ private $cep;
14
+
15
+ /**
16
+ * @return mixed
17
+ */
18
+ public function getCep()
19
+ {
20
+ return $this->cep;
21
+ }
22
+
23
+ /**
24
+ * @param mixed $cep
25
+ */
26
+ public function setCep($cep)
27
+ {
28
+ $this->cep = $cep;
29
+ }
30
+
31
+ /**
32
+ * @return mixed
33
+ */
34
+ public function getCidade()
35
+ {
36
+ return $this->cidade;
37
+ }
38
+
39
+ /**
40
+ * @param mixed $cidade
41
+ */
42
+ public function setCidade($cidade)
43
+ {
44
+ $this->cidade = $cidade;
45
+ }
46
+
47
+ /**
48
+ * @return mixed
49
+ */
50
+ public function getEmail()
51
+ {
52
+ return $this->email;
53
+ }
54
+
55
+ /**
56
+ * @param mixed $email
57
+ */
58
+ public function setEmail($email)
59
+ {
60
+ $this->email = $email;
61
+ }
62
+
63
+ /**
64
+ * @return mixed
65
+ */
66
+ public function getEnviarEmailBoletosPagos()
67
+ {
68
+ return ($this->enviarEmailBoletosPagos) ? true : false;
69
+ }
70
+
71
+ /**
72
+ * @param mixed $enviarEmailBoletosPagos
73
+ */
74
+ public function setEnviarEmailBoletosPagos($enviarEmailBoletosPagos)
75
+ {
76
+ $this->enviarEmailBoletosPagos = $enviarEmailBoletosPagos;
77
+ }
78
+
79
+ /**
80
+ * @return mixed
81
+ */
82
+ public function getEstado()
83
+ {
84
+ return $this->estado;
85
+ }
86
+
87
+ /**
88
+ * @param mixed $estado
89
+ */
90
+ public function setEstado($estado)
91
+ {
92
+ $this->estado = $estado;
93
+ }
94
+
95
+ /**
96
+ * @return mixed
97
+ */
98
+ public function getNome()
99
+ {
100
+ return $this->nome;
101
+ }
102
+
103
+ /**
104
+ * @param mixed $nome
105
+ */
106
+ public function setNome($nome)
107
+ {
108
+ $this->nome = $nome;
109
+ }
110
+
111
+ /**
112
+ * @return mixed
113
+ */
114
+ public function getNumero()
115
+ {
116
+ return $this->numero;
117
+ }
118
+
119
+ /**
120
+ * @param mixed $numero
121
+ */
122
+ public function setNumero($numero)
123
+ {
124
+ $this->numero = $numero;
125
+ }
126
+
127
+ /**
128
+ * @return mixed
129
+ */
130
+ public function getRua()
131
+ {
132
+ return $this->rua;
133
+ }
134
+
135
+ /**
136
+ * @param mixed $rua
137
+ */
138
+ public function setRua($rua)
139
+ {
140
+ $this->rua = $rua;
141
+ }
142
+ }
app/code/community/PagueVeloz/Api/Model/Dto/ComprarCreditosSMSDTO.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_ComprarCreditosSMSDTO
4
+ {
5
+
6
+ private $_creditos;
7
+ private $_formaPgto = 1;
8
+
9
+ public function setCreditos($creditos)
10
+ {
11
+ if (empty($creditos)) {
12
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"creditos\" passado está NULL. \"$creditos\" é null.");
13
+ }
14
+
15
+ $this->_creditos = $creditos;
16
+ }
17
+
18
+ public function setValor($valor)
19
+ {
20
+ if (empty($valor)) {
21
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"valor\" passado está NULL. \"$valor\" é null.");
22
+ }
23
+
24
+ $this->_valor = $valor;
25
+ }
26
+
27
+ public function setFormaPgto($formaPgto)
28
+ {
29
+ $this->_formaPgto = $formaPgto;
30
+ }
31
+
32
+ public function getCreditos()
33
+ {
34
+ return $this->_creditos;
35
+ }
36
+
37
+ public function getValor()
38
+ {
39
+ return $this->_valor;
40
+ }
41
+
42
+ public function getFormatPto()
43
+ {
44
+ return $this->_formaPgto;
45
+ }
46
+
47
+ }
app/code/community/PagueVeloz/Api/Model/Dto/ConsultarBoletoDTO.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_ConsultarBoletoDTO
4
+ {
5
+
6
+ private $_data;
7
+
8
+ public function setData($data)
9
+ {
10
+ if (empty($data)) {
11
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$data\" é null.");
12
+ }
13
+
14
+ $this->_data = $data;
15
+ }
16
+
17
+ public function getData()
18
+ {
19
+ return $this->_data;
20
+ }
21
+
22
+ }
app/code/community/PagueVeloz/Api/Model/Dto/ConsultarClienteDTO.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_ConsultarClienteDTO
4
+ {
5
+
6
+ private $_tipo;
7
+ private $_filtro;
8
+
9
+ public function setTipo($tipo)
10
+ {
11
+ if (empty($tipo))
12
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL ou vazio. O tipo informado é null.");
13
+
14
+ $this->_tipo = $tipo;
15
+ }
16
+
17
+ public function setFiltro($filtro)
18
+ {
19
+ $this->_filtro = $filtro;
20
+ }
21
+
22
+ public function getTipo()
23
+ {
24
+ return $this->_tipo;
25
+ }
26
+
27
+ public function getFiltro()
28
+ {
29
+ return $this->_filtro;
30
+ }
31
+
32
+ }
app/code/community/PagueVeloz/Api/Model/Dto/ContaBancariaDTO.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_ContaBancariaDTO
4
+ {
5
+
6
+ private $_id = '';
7
+ private $_banco = '';
8
+ private $_agencia = '';
9
+ private $_conta = '';
10
+ private $_descricao = '';
11
+
12
+ public function setId($id)
13
+ {
14
+ if (empty($id))
15
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento \"id\" não deve ser NULL");
16
+ $this->_id = $id;
17
+ }
18
+
19
+ public function setBanco($banco)
20
+ {
21
+ if (empty($banco))
22
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"Banco\" está NULL ou vazio.");
23
+
24
+ $this->_banco = $banco;
25
+ }
26
+
27
+ public function setAgencia($agencia)
28
+ {
29
+ if (empty($agencia))
30
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"Agencia\" está NULL ou vazio.");
31
+
32
+ $this->_agencia = $agencia;
33
+ }
34
+
35
+ public function setConta($conta)
36
+ {
37
+ if (empty($conta))
38
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"Conta\" está NULL ou vazio.");
39
+
40
+ $this->_conta = $conta;
41
+ }
42
+
43
+ public function setDescricao($descricao)
44
+ {
45
+ if (empty($descricao))
46
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento \"Descrição\" não pode ser NULL ou vazio.");
47
+
48
+ $this->_descricao = $descricao;
49
+ }
50
+
51
+ public function getId()
52
+ {
53
+ return $this->_id;
54
+ }
55
+
56
+ public function getBanco()
57
+ {
58
+ return $this->_banco;
59
+ }
60
+
61
+ public function getAgencia()
62
+ {
63
+ return $this->_agencia;
64
+ }
65
+
66
+ public function getConta()
67
+ {
68
+ return $this->_conta;
69
+ }
70
+
71
+ public function getDescricao()
72
+ {
73
+ return $this->_descricao;
74
+ }
75
+
76
+ }
app/code/community/PagueVeloz/Api/Model/Dto/ContaDTO.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_ContaDTO
4
+ {
5
+ protected $valor;
6
+ protected $titulo;
7
+ protected $nomeTitulo;
8
+ protected $vencimento;
9
+ protected $codigoDeBarras;
10
+ protected $id;
11
+
12
+ /**
13
+ * @return mixed
14
+ */
15
+ public function getCodigoDeBarras()
16
+ {
17
+ return $this->codigoDeBarras;
18
+ }
19
+
20
+ /**
21
+ * @param mixed $codigoDeBarras
22
+ */
23
+ public function setCodigoDeBarras($codigoDeBarras)
24
+ {
25
+ $this->codigoDeBarras = $codigoDeBarras;
26
+ }
27
+
28
+ /**
29
+ * @return mixed
30
+ */
31
+ public function getId()
32
+ {
33
+ return $this->id;
34
+ }
35
+
36
+ /**
37
+ * @param mixed $id
38
+ */
39
+ public function setId($id)
40
+ {
41
+ $this->id = $id;
42
+ }
43
+
44
+ /**
45
+ * @return mixed
46
+ */
47
+ public function getNomeTitulo()
48
+ {
49
+ return $this->nomeTitulo;
50
+ }
51
+
52
+ /**
53
+ * @param mixed $nomeTitulo
54
+ */
55
+ public function setNomeTitulo($nomeTitulo)
56
+ {
57
+ $this->nomeTitulo = $nomeTitulo;
58
+ }
59
+
60
+ /**
61
+ * @return mixed
62
+ */
63
+ public function getTitulo()
64
+ {
65
+ return $this->titulo;
66
+ }
67
+
68
+ /**
69
+ * @param mixed $titulo
70
+ */
71
+ public function setTitulo($titulo)
72
+ {
73
+ $this->titulo = $titulo;
74
+ }
75
+
76
+ /**
77
+ * @return mixed
78
+ */
79
+ public function getValor()
80
+ {
81
+ return $this->valor;
82
+ }
83
+
84
+ /**
85
+ * @param mixed $valor
86
+ */
87
+ public function setValor($valor)
88
+ {
89
+ $this->valor = $valor;
90
+ }
91
+
92
+ /**
93
+ * @return mixed
94
+ */
95
+ public function getVencimento()
96
+ {
97
+ return $this->vencimento;
98
+ }
99
+
100
+ /**
101
+ * @param mixed $vencimento
102
+ */
103
+ public function setVencimento($vencimento)
104
+ {
105
+ $this->vencimento = $vencimento;
106
+ }
107
+
108
+ }
app/code/community/PagueVeloz/Api/Model/Dto/CreditoSMSDTO.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_CreditoSMSDTO
4
+ {
5
+
6
+ protected $_data;
7
+
8
+ public function setData($data)
9
+ {
10
+ if (empty($data)) {
11
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$data\" é null.");
12
+ }
13
+
14
+ $this->_data = $data;
15
+ }
16
+
17
+ public function getData()
18
+ {
19
+ return $this->_data;
20
+ }
21
+
22
+ }
app/code/community/PagueVeloz/Api/Model/Dto/EmailDTO.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_EmailDTO
4
+ {
5
+
6
+ private $_email;
7
+
8
+ public function __construct($email)
9
+ {
10
+ $this->setEmail($email);
11
+ }
12
+
13
+ public function setEmail($email)
14
+ {
15
+ if (empty($email))
16
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$email é null");
17
+ else if (!self::isValidEmail($email))
18
+ throw new PagueVeloz_Api_Model_Exceptions_InvalidEmailException("$email é inválido");
19
+
20
+ $this->_email = $email;
21
+ }
22
+
23
+ public function getEmail()
24
+ {
25
+ return $this->_email;
26
+ }
27
+
28
+ private static function isValidEmail($email)
29
+ {
30
+ return 1 === preg_match('/(?:[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*|"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])/', $email);
31
+ }
32
+
33
+ }
app/code/community/PagueVeloz/Api/Model/Dto/EmitirBoletoDTO.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_EmitirBoletoDTO
4
+ {
5
+
6
+ private $_vencimento;
7
+ private $_valor;
8
+ private $_seuNumero;
9
+ private $_sacado;
10
+ private $_cpfCnpjSacado;
11
+ private $_parcela;
12
+ private $_linha1;
13
+ private $_linha2;
14
+ private $_cpfCnpjCedente;
15
+ private $_cedente;
16
+
17
+ public function setVencimento($vencimento)
18
+ {
19
+ if (empty($vencimento))
20
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$vencimento\" é null.");
21
+
22
+ $this->_vencimento = $vencimento;
23
+ }
24
+
25
+ public function setValor($valor)
26
+ {
27
+ if (empty($valor))
28
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$valor\" é null.");
29
+ $valor *= 100;
30
+ $this->_valor = $valor;
31
+ }
32
+
33
+ public function setSeuNumero($seuNumero)
34
+ {
35
+ if (empty($seuNumero))
36
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$seuNumero\" é null.");
37
+
38
+ $this->_seuNumero = $seuNumero;
39
+ }
40
+
41
+ public function setSacado($sacado)
42
+ {
43
+ if (empty($sacado))
44
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$sacado\" é null.");
45
+
46
+ $this->_sacado = $sacado;
47
+ }
48
+
49
+ public function setCpfCnpjSacado($cpfCnpjSacado)
50
+ {
51
+ if (empty($cpfCnpjSacado))
52
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$cpfCnpjSacado\" é null.");
53
+
54
+ $this->_cpfCnpjSacado = $cpfCnpjSacado;
55
+ }
56
+
57
+ public function setParcela($parcela)
58
+ {
59
+ $this->_parcela = $parcela;
60
+ }
61
+
62
+ public function setLinha1($linha1)
63
+ {
64
+ if (empty($linha1))
65
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$linha1\" é null.");
66
+
67
+ $this->_linha1 = $linha1;
68
+ }
69
+
70
+ public function setLinha2($linha2)
71
+ {
72
+ if (empty($linha2))
73
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$linha2\" é null.");
74
+
75
+ $this->_linha2 = $linha2;
76
+ }
77
+
78
+ public function setCpfCnpjCedente($cpfCnpjCedente)
79
+ {
80
+ if (empty($cpfCnpjCedente))
81
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$cpfCnpjCedente\" é null.");
82
+
83
+ $this->_cpfCnpjCedente = $cpfCnpjCedente;
84
+ }
85
+
86
+ public function setCedente($cedente)
87
+ {
88
+ if (empty($cedente))
89
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("Argumento informado não deve ser NULL. \"$cedente\" é null.");
90
+
91
+ $this->_cedente = $cedente;
92
+ }
93
+
94
+ public function getVencimento()
95
+ {
96
+ return $this->_vencimento;
97
+ }
98
+
99
+ public function getValor()
100
+ {
101
+ return $this->_valor;
102
+ }
103
+
104
+ public function getSeuNumero()
105
+ {
106
+ return $this->_seuNumero;
107
+ }
108
+
109
+ public function getSacado()
110
+ {
111
+ return $this->_sacado;
112
+ }
113
+
114
+ public function getCpfCnpjSacado()
115
+ {
116
+ return $this->_cpfCnpjSacado;
117
+ }
118
+
119
+ public function getParcela()
120
+ {
121
+ return $this->_parcela;
122
+ }
123
+
124
+ public function getLinha1()
125
+ {
126
+ return $this->_linha1;
127
+ }
128
+
129
+ public function getLinha2()
130
+ {
131
+ return $this->_linha2;
132
+ }
133
+
134
+ public function getCpfCnpjCedente()
135
+ {
136
+ return $this->_cpfCnpjCedente;
137
+ }
138
+
139
+ public function getCedente()
140
+ {
141
+ return $this->_cedente;
142
+ }
143
+
144
+ }
app/code/community/PagueVeloz/Api/Model/Dto/MensagemSMSDTO.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_MensagemSMSDTO
4
+ {
5
+
6
+ private $seuId;
7
+ private $telefoneRemetente;
8
+ private $telefoneDestino;
9
+ private $conteudo;
10
+ private $agendarPara;
11
+
12
+ public function getSeuId()
13
+ {
14
+ return $this->seuId;
15
+ }
16
+
17
+ public function getTelefoneRemetente()
18
+ {
19
+ return $this->telefoneRemetente;
20
+ }
21
+
22
+ public function getTelefoneDestino()
23
+ {
24
+ return $this->telefoneDestino;
25
+ }
26
+
27
+ public function getConteudo()
28
+ {
29
+ return $this->conteudo;
30
+ }
31
+
32
+ public function getAgendarPara()
33
+ {
34
+ if (!$this->agendarPara) {
35
+ $this->agendarPara = date('c');
36
+ }
37
+
38
+ return $this->agendarPara;
39
+ }
40
+
41
+ public function setSeuId($seuId)
42
+ {
43
+ $this->seuId = $seuId;
44
+ }
45
+
46
+ public function setTelefoneRemetente($telefoneRemetente)
47
+ {
48
+ $this->telefoneRemetente = $telefoneRemetente;
49
+ }
50
+
51
+ public function setTelefoneDestino($telefoneDestino)
52
+ {
53
+ $this->telefoneDestino = $telefoneDestino;
54
+ }
55
+
56
+ public function setConteudo($conteudo)
57
+ {
58
+ $this->conteudo = $conteudo;
59
+ }
60
+
61
+ public function setAgendarPara($agendarPara)
62
+ {
63
+ $this->agendarPara = $agendarPara;
64
+ }
65
+
66
+
67
+
68
+ }
app/code/community/PagueVeloz/Api/Model/Dto/PacotesSMSDTO.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_PacotesSMSDTO
4
+ {
5
+
6
+ }
app/code/community/PagueVeloz/Api/Model/Dto/SaqueDTO.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_SaqueDTO
4
+ {
5
+
6
+ private $_id = '';
7
+ private $_valor = '';
8
+
9
+ public function setId($id)
10
+ {
11
+ if (empty($id))
12
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"id\" é requirido. Não deve ser NULL ou vazio.");
13
+
14
+ $this->_id = $id;
15
+ }
16
+
17
+ public function setValor($valor)
18
+ {
19
+ if (empty($valor))
20
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"valor\" é requirido. Não deve ser NULL ou vazio.");
21
+
22
+ if (!is_numeric($valor))
23
+ throw new PagueVeloz_Api_Model_Exceptions_InvalidValueException("O argumento \"valor\" deve ser um valor numérico válido.");
24
+
25
+ $this->_valor = $valor;
26
+ }
27
+
28
+ public function getId()
29
+ {
30
+ return $this->_id;
31
+ }
32
+
33
+ public function getValor()
34
+ {
35
+ return $this->_valor;
36
+ }
37
+
38
+ }
app/code/community/PagueVeloz/Api/Model/Dto/TransferenciaDTO.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Dto_TransferenciaDTO
4
+ {
5
+
6
+ private $_clienteDestino = '';
7
+ private $_valor = '';
8
+ private $_descricao = '';
9
+
10
+ public function setClienteDestino(PagueVeloz_Api_Model_Dto_EmailDTO $clienteDestino)
11
+ {
12
+ if (empty($clienteDestino))
13
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"clienteDestino\" é requirido. Não deve ser NULL ou vazio.");
14
+
15
+ $this->_clienteDestino = $clienteDestino;
16
+ }
17
+
18
+ public function setValor($valor)
19
+ {
20
+ if (empty($valor))
21
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"valor\" é requirido. Não deve ser NULL ou vazio.");
22
+
23
+ if (!is_numeric($valor))
24
+ throw new PagueVeloz_Api_Model_Exceptions_InvalidValueException("O argumento \"valor\" deve ser um valor numérico válido.");
25
+
26
+ $this->_valor = $valor;
27
+ }
28
+
29
+ public function setDescricao($descricao)
30
+ {
31
+ if (empty($descricao))
32
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("O argumento \"descricao\" é requerido. Não deve ser NULL ou vazio.");
33
+
34
+ $this->_descricao = $descricao;
35
+ }
36
+
37
+ public function getClienteDestino()
38
+ {
39
+ return $this->_clienteDestino;
40
+ }
41
+
42
+ public function getValor()
43
+ {
44
+ return $this->_valor;
45
+ }
46
+
47
+ public function getDescricao()
48
+ {
49
+ return $this->_descricao;
50
+ }
51
+
52
+ }
app/code/community/PagueVeloz/Api/Model/Exceptions/ArgumentNullException.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Exceptions_ArgumentNullException extends Exception
4
+ {
5
+
6
+ }
app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidEmailException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Exceptions_InvalidEmailException extends Exception
4
+ {
5
+
6
+ public function __construct($message, $code, $previous)
7
+ {
8
+ parent::__construct($message, $code, $previous);
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidHostException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Exceptions_InvalidHostException extends Exception
4
+ {
5
+
6
+ public function __construct($message, $code, $previous)
7
+ {
8
+ parent::__construct($message, $code, $previous);
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidJSONException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Exceptions_InvalidJSONException extends Exception
4
+ {
5
+
6
+ public function __construct($message, $code, $previous)
7
+ {
8
+ parent::__construct($message, $code, $previous);
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidMethodException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Exceptions_InvalidMethodException extends Exception
4
+ {
5
+
6
+ public function __construct($message, $code, $previous)
7
+ {
8
+ parent::__construct($message, $code, $previous);
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Api/Model/Exceptions/InvalidValueException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Exceptions_InvalidValueException extends Exception
4
+ {
5
+
6
+ public function __construct($message, $code, $previous)
7
+ {
8
+ parent::__construct($message, $code, $previous);
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Api/Model/Interfaces/IHttpClient.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ interface PagueVeloz_Api_Model_Interfaces_IHttpClient
4
+ {
5
+
6
+ function Send(PagueVeloz_Api_Model_Common_HttpContext $context);
7
+ }
app/code/community/PagueVeloz/Api/Model/Observer.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Observer {
4
+
5
+ public function savePaguevelozConfig($object)
6
+ {
7
+ $event = $object->getEvent();
8
+
9
+ $fields = array(
10
+ 'name' => 'setNome',
11
+ 'email' => 'setEmail',
12
+ 'send_boleto_pago' => 'setEnviarEmailBoletosPagos',
13
+ 'cidade' => 'setCidade',
14
+ 'estado' => 'setEstado',
15
+ 'logradouro' => 'setRua',
16
+ 'numero' => 'setNumero',
17
+ 'cep' => 'setCep'
18
+ );
19
+
20
+ $hasData = false;
21
+ $webservice = Mage::getModel('pagueveloz_api/webservice');
22
+ $clienteDto = Mage::getModel('pagueveloz_api/dto_clienteDTO');
23
+ foreach ($fields as $field => $setMethod) {
24
+ if (Mage::getStoreConfig("pagueveloz/pagueveloz_cliente/{$field}")) {
25
+ $hasData = true;
26
+ $clienteDto->$setMethod(Mage::getStoreConfig("pagueveloz/pagueveloz_cliente/{$field}"));
27
+ }
28
+ }
29
+
30
+ // Se a configuracao de endereco não é alterado/cadastrado
31
+ if (!$hasData)
32
+ return;
33
+
34
+ $result = $webservice->atualizaCliente($clienteDto);
35
+ if (!$result)
36
+ Mage::getSingleton('core/session')->addNotice('Cliente salvo no pagueveloz com sucesso');
37
+ }
38
+ }
app/code/community/PagueVeloz/Api/Model/Services/Curl.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Services_Curl implements PagueVeloz_Api_Model_Interfaces_IHttpClient
4
+ {
5
+
6
+ private $_curl;
7
+
8
+ public function __construct()
9
+ {
10
+ $this->_curl = curl_init();
11
+
12
+ if (empty($this->_curl)) {
13
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("curl_init is null");
14
+ }
15
+ }
16
+
17
+ public function Send(PagueVeloz_Api_Model_Common_HttpContext $context)
18
+ {
19
+ if (empty($context)) {
20
+ throw new PagueVeloz_Api_Model_Exceptions_ArgumentNullException("$context is null");
21
+ }
22
+
23
+ curl_setopt($this->_curl, CURLOPT_URL, $context->getHost());
24
+ curl_setopt($this->_curl, CURLOPT_CUSTOMREQUEST, $context->getMethod());
25
+ curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $context->getBody());
26
+ curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, 1);
27
+ curl_setopt($this->_curl, CURLOPT_HEADER, 1);
28
+
29
+ if (substr($context->getHost(), 0, 5) == 'https') {
30
+ curl_setopt($this->_curl, CURLOPT_SSL_VERIFYHOST, 0);
31
+ curl_setopt($this->_curl, CURLOPT_SSL_VERIFYPEER, 0);
32
+ }
33
+
34
+ if (in_array($context->getMethod(), array('post', 'put'))) {
35
+ $context->addHeader('Content-Length: ' . strlen($context->getBody()));
36
+ }
37
+
38
+ curl_setopt($this->_curl, CURLOPT_HTTPHEADER, $context->getHeaders());
39
+
40
+ $raw_result = curl_exec($this->_curl);
41
+ $pos = strpos($raw_result, "\r\n\r\n");
42
+
43
+ $headers = explode("\r\n", substr($raw_result, 0, $pos));
44
+
45
+ $response = new PagueVeloz_Api_Model_Common_HttpResponse();
46
+ $response->addHeaders($headers);
47
+
48
+ // +4 porque é duplo \r\n que são as 2 linhas no fim do header
49
+ $response->setBody(substr($raw_result, $pos + 4));
50
+
51
+ $return_info = curl_getinfo($this->_curl);
52
+ $response->setStatus($return_info['http_code']);
53
+
54
+ return $response;
55
+ }
56
+
57
+ public function __destruct()
58
+ {
59
+ curl_close($this->_curl);
60
+ }
61
+
62
+ }
app/code/community/PagueVeloz/Api/Model/Source/States.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class PagueVeloz_Api_Model_Source_States
3
+ {
4
+
5
+ public function toOptionArray() {
6
+ $options = array(
7
+ "AC" => "Acre",
8
+ "AL" => "Alagoas",
9
+ "AP" => "Amapá",
10
+ "AM" => "Amazonas",
11
+ "BA" => "Bahia",
12
+ "CE" => "Ceará",
13
+ "DF" => "Distrito Federal",
14
+ "ES" => "Espírito Santo",
15
+ "GO" => "Goiás",
16
+ "MA" => "Maranhão",
17
+ "MT" => "Mato Grosso",
18
+ "MS" => "Mato Grosso do Sul",
19
+ "MG" => "Minas Gerais",
20
+ "PA" => "Pará",
21
+ "PB" => "Paraíba",
22
+ "PR" => "Paraná",
23
+ "PE" => "Pernambuco",
24
+ "PI" => "Piauí",
25
+ "RJ" => "Rio de Janeiro",
26
+ "RN" => "Rio Grande do Norte",
27
+ "RS" => "Rio Grande do Sul",
28
+ "RO" => "Rondônia",
29
+ "SC" => "Santa Catarina",
30
+ "RR" => "Roraima",
31
+ "SP" => "São Paulo",
32
+ "SE" => "Sergipe",
33
+ "TO" => "Tocantins"
34
+ );
35
+
36
+ return $options;
37
+ }
38
+
39
+ }
app/code/community/PagueVeloz/Api/Model/Webservice.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Cria metodos que mapeia as funcionalidades da API PagueVeloz
5
+ */
6
+
7
+ class PagueVeloz_Api_Model_Webservice extends Mage_Core_Model_Abstract
8
+ {
9
+
10
+ const PAGUEVELOZ_URL_STAGING = 'http://sandbox.pagueveloz.com.br/';
11
+ const PAGUEVELOZ_URL_PRODUCTION = 'https://www.pagueveloz.com.br/';
12
+
13
+ public function getPaguevelozEmail()
14
+ {
15
+ return Mage::getStoreConfig('pagueveloz/pagueveloz_configuration/email');
16
+ }
17
+
18
+ public function getPaguevelozToken()
19
+ {
20
+ return Mage::getStoreConfig('pagueveloz/pagueveloz_configuration/token');
21
+ }
22
+
23
+ public function getIsProduction()
24
+ {
25
+ return Mage::getStoreConfig('pagueveloz/pagueveloz_configuration/production');
26
+ }
27
+
28
+ public function getPaguevelozUrl()
29
+ {
30
+ if ($this->getIsProduction()) {
31
+ return self::PAGUEVELOZ_URL_PRODUCTION;
32
+ }
33
+
34
+ return self::PAGUEVELOZ_URL_STAGING;
35
+ }
36
+
37
+ public function getCreditoSMS()
38
+ {
39
+ $creditoSMS = new PagueVeloz_Api_Model_Webservice_CreditoSMS(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getPaguevelozEmail()), $this->getPaguevelozToken());
40
+ $dto = Mage::getModel('pagueveloz_api/dto_creditoSMSDTO');
41
+
42
+ $resposta_final = $creditoSMS->Get($dto);
43
+
44
+ $saldo = $resposta_final->getBody();
45
+ if (stripos($saldo, 'Erro') !== false) {
46
+ $saldo = "";
47
+ }
48
+
49
+ return $saldo;
50
+ }
51
+
52
+ public function comprarCreditosSMS($tipo_pagamento, $tipo_credito, $valor)
53
+ {
54
+ $comprarCreditosSMS = new PagueVeloz_Api_Model_Webservice_ComprarCreditosSMS(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getPaguevelozEmail()), $this->getPaguevelozToken());
55
+ $dto = Mage::getModel('pagueveloz_api/dto_ComprarCreditosSMSDTO');
56
+ $dto->setFormaPgto($tipo_pagamento);
57
+
58
+ if ($tipo_credito == PagueVeloz_Api_Model_Webservice_ComprarCreditosSMS::COMPRA_POR_VALOR) {
59
+ $dto->setValor($valor);
60
+ } else {
61
+ $dto->setCreditos($valor);
62
+ }
63
+
64
+ $resposta_final = $comprarCreditosSMS->Post($dto);
65
+
66
+ $result = $resposta_final->getBody();
67
+ if (stripos($result, 'Erro') !== false) {
68
+ $result = "";
69
+ }
70
+
71
+ return json_decode($result);
72
+ }
73
+
74
+ public function getPacotesSMS()
75
+ {
76
+ $pacotesSMS = new PagueVeloz_Api_Model_Webservice_PacotesSMS(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getPaguevelozEmail()), $this->getPaguevelozToken());
77
+ $dto = Mage::getModel('pagueveloz_api/dto_PacotesSMSDTO');
78
+
79
+ $resposta_final = $pacotesSMS->Get($dto);
80
+
81
+ $pacotes = $resposta_final->getBody();
82
+ if (stripos($pacotes, 'Erro') !== false) {
83
+ $pacotes = "";
84
+ }
85
+
86
+ return json_decode($pacotes);
87
+ }
88
+
89
+ public function sendSms($msg, $telefoneDestino)
90
+ {
91
+ $telefoneRemetente = Mage::getStoreConfig('pagueveloz/sms/telephone');
92
+ $msgSMS = new PagueVeloz_Api_Model_Webservice_MensagemSMS(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getPaguevelozEmail()), $this->getPaguevelozToken());
93
+ $dto = Mage::getModel('pagueveloz_api/dto_MensagemSMSDTO');
94
+ $dto->setTelefoneDestino($telefoneDestino);
95
+ $dto->setConteudo($msg);
96
+ $dto->setTelefoneRemetente($telefoneRemetente);
97
+
98
+ $resposta_final = $msgSMS->Post($dto);
99
+
100
+ $result = $resposta_final->getBody();
101
+ if (stripos($result, 'Erro') !== false) {
102
+ $result = "";
103
+ }
104
+
105
+ return json_decode($result);
106
+ }
107
+
108
+ public function atualizaCliente($clienteDto)
109
+ {
110
+ $cliente = new PagueVeloz_Api_Model_Webservice_Cliente(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getPaguevelozEmail()), $this->getPaguevelozToken());
111
+ $resposta_final = $cliente->Put($clienteDto);
112
+
113
+ $result = $resposta_final->getBody();
114
+ if (stripos($result, 'Erro') !== false) {
115
+ $result = "";
116
+ }
117
+
118
+ return json_decode($result);
119
+ }
120
+
121
+ public function cadastrarConta($codigo_barras, $nome_titulo, $titulo, $valor, $vencimento)
122
+ {
123
+ $contaWebservice = new PagueVeloz_Api_Model_Webservice_Conta(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getPaguevelozEmail()), $this->getPaguevelozToken());
124
+ $dto = Mage::getModel('pagueveloz_api/dto_contaDTO');
125
+ $dto->setCodigoDeBarras($codigo_barras);
126
+ $dto->setValor($valor);
127
+ $dto->setTitulo($titulo);
128
+ $dto->setNomeTitulo($nome_titulo);
129
+ $dto->setVencimento($vencimento);
130
+
131
+ $resposta_final = $contaWebservice->Post($dto);
132
+
133
+ $result = $resposta_final->getBody();
134
+ if (stripos($result, 'Erro') !== false) {
135
+ $result = "";
136
+ }
137
+
138
+ return json_decode($result);
139
+ }
140
+
141
+ public function generateBoletoUrl($valor, $seuNumero, $nome, $cpf, $email)
142
+ {
143
+ $boleto = new PagueVeloz_Api_Model_Webservice_Boleto(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getPaguevelozEmail()), $this->getPaguevelozToken());
144
+ $dto = Mage::getModel('pagueveloz_api/dto_boletoDTO');
145
+ $boletoMethod = Mage::getModel('pagueveloz_boleto/boletoMethod');
146
+
147
+ $vencimento = (int) $boletoMethod->getConfig('vencimento');
148
+ $date = date("Y-m-d"); // Data de hoje
149
+ $mod_date = strtotime($date . "+ {$vencimento} days"); // Soma dias na data
150
+ $dataVencimento = date("Y-m-d", $mod_date);
151
+
152
+ $dto->setEmail($email);
153
+ $dto->setVencimento($dataVencimento);
154
+ $dto->setValor($valor);
155
+ $dto->setSeuNumero($seuNumero);
156
+ $dto->setSacado($nome);
157
+ $dto->setCpfCnpjSacado($cpf);
158
+ $dto->setParcela(1);
159
+ $dto->setLinha1($boletoMethod->getConfig('instruction1'));
160
+ $dto->setLinha2($boletoMethod->getConfig('instruction2'));
161
+ $dto->setCpfCnpjCedente($boletoMethod->getConfig('taxvat'));
162
+ $dto->setCedente($boletoMethod->getConfig('cedente_name'));
163
+ $resposta_final = $boleto->Post($dto);
164
+ $url = $resposta_final->getBody();
165
+
166
+ if (stripos($url, 'Erro') !== false) {
167
+ $url = "";
168
+ }
169
+
170
+ return $url;
171
+ }
172
+
173
+ public function assinar($nome, $doc, $tipoPessoa, $email, $login, $estado, $cidade, $rua, $cep, $numero)
174
+ {
175
+ $assinar = new PagueVeloz_Api_Model_Webservice_Assinar();
176
+ $dto = new PagueVeloz_Api_Model_Dto_AssinarDTO(); //Mage::getModel('pagueveloz_api/dto_assinarDTO');
177
+
178
+ $dto->setEmail($email);
179
+ $dto->setNome($nome);
180
+ $dto->setDocumento($doc);
181
+ $dto->setTipoPessoa($tipoPessoa);
182
+ $dto->setLoginUsuarioDefault($login);
183
+ $dto->setEstado($estado);
184
+ $dto->setCidade($cidade);
185
+ $dto->setRua($rua);
186
+ $dto->setCep($cep);
187
+ $dto->setNumero($numero);
188
+
189
+ $resposta_final = $assinar->Post($dto);
190
+ $result = $resposta_final->getBody();
191
+ if (stripos($result, 'Erro') !== false) {
192
+ $url = "";
193
+ }
194
+
195
+ return json_decode($result);
196
+ }
197
+
198
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/Assinar.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_Assinar extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+
8
+ public function __construct()
9
+ {
10
+ parent::__construct('api/v2/Assinar');
11
+ }
12
+
13
+ public function Post(PagueVeloz_Api_Model_Dto_AssinarDTO $dto)
14
+ {
15
+ $contexto = new PagueVeloz_Api_Model_Common_HttpContext();
16
+ $contexto->setMethod('post');
17
+ $contexto->addHeader($this->_default_header);
18
+ $contexto->setHost($this->getHost());
19
+
20
+ $json = array(
21
+ "Endereco" => array(
22
+ "Cidade" => array(
23
+ "Nome" => $dto->getCidade(),
24
+ "Estado" => $dto->getEstado()
25
+ ),
26
+ "Logradouro" => $dto->getRua(),
27
+ "Numero" => $dto->getNumero(),
28
+ "CEP" => $dto->getCep()
29
+ ),
30
+ "Nome" => $dto->getNome(),
31
+ "Documento" => $dto->getDocumento(),
32
+ "TipoPessoa" => $dto->getTipoPessoa(),
33
+ "Email" => $dto->getEmail(),
34
+ "LoginUsuarioDefault" => $dto->getLoginUsuarioDefault(),
35
+ //"UrlNotificacao" => '',
36
+ //"Id" => 6
37
+ );
38
+ $json = json_encode($json);
39
+
40
+ $contexto->setBody($json);
41
+ return $this->getMachine()->Send($contexto);
42
+ }
43
+
44
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/Boleto.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_Boleto extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v3/Boleto', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Get(PagueVeloz_Api_Model_Dto_BoletoDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('get');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost() . '?SeuNumero=' . $dto->getSeuNumero());
24
+
25
+ return $this->getMachine()->Send($contexto);
26
+ }
27
+
28
+ public function Post(PagueVeloz_Api_Model_Dto_BoletoDTO $dto)
29
+ {
30
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
31
+ $contexto->setMethod('post');
32
+ $contexto->addHeader($this->_default_header);
33
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
34
+ $contexto->setHost($this->getHost());
35
+ $json = array(
36
+ "Pdf" => $dto->getPdf(),
37
+ "Vencimento" => $dto->getVencimento(),
38
+ "Valor" => $dto->getValor(),
39
+ "SeuNumero" => $dto->getSeuNumero(),
40
+ "Sacado" => $dto->getSacado(),
41
+ "CPFCNPJSacado" => $dto->getCpfCnpjSacado(),
42
+ "Parcela" => $dto->getParcela(),
43
+ "Linha1" => $dto->getLinha1(),
44
+ "Linha2" => $dto->getLinha2(),
45
+ "CPFCNPJCedente" => $dto->getCpfCnpjCedente(),
46
+ "Cedente" => $dto->getCedente()
47
+ );
48
+
49
+ if ($dto->getEmail()) {
50
+ $json['Email'] = $dto->getEmail();
51
+ }
52
+
53
+ $json = json_encode($json);
54
+
55
+ $contexto->setBody($json);
56
+ return $this->getMachine()->Send($contexto);
57
+ }
58
+
59
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
60
+ {
61
+ $this->_authDto = $authDto;
62
+ }
63
+
64
+ public function getAuthDto()
65
+ {
66
+ return $this->_authDto;
67
+ }
68
+
69
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/Cliente.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_Cliente extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/Cliente', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Put(PagueVeloz_Api_Model_Dto_ClienteDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('put');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ $json = array(
26
+ 'Id' => 4,
27
+ 'Nome' => $dto->getNome(),
28
+ 'Email' => $dto->getEmail(),
29
+ 'EnviarEmailBoletosPagos' => $dto->getEnviarEmailBoletosPagos(),
30
+ 'Endereco' => array(
31
+ 'Logradouro' => $dto->getRua(),
32
+ 'Numero' => $dto->getNumero(),
33
+ 'CEP' => $dto->getCep(),
34
+ 'Cidade' => array(
35
+ 'Nome' => $dto->getCidade(),
36
+ 'Estado' => $dto->getEstado(),
37
+ )
38
+ )
39
+ );
40
+
41
+ $json = json_encode($json);
42
+ $contexto->setBody($json);
43
+
44
+ return $this->getMachine()->Send($contexto);
45
+ }
46
+
47
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
48
+ {
49
+ $this->_authDto = $authDto;
50
+ }
51
+
52
+ public function getAuthDto()
53
+ {
54
+ return $this->_authDto;
55
+ }
56
+
57
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/ComprarCreditosSMS.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_ComprarCreditosSMS extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ const COMPRA_POR_CREDITO = 0;
7
+ const COMPRA_POR_VALOR = 1;
8
+ const PAGAMENTO_POR_BOLETO = 0;
9
+ const PAGAMENTO_POR_DEPOSITO = 1;
10
+
11
+ private $_default_header = 'Content-Type: application/json';
12
+ private $_authDto;
13
+
14
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
15
+ {
16
+ $machine = null;
17
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
18
+ $host = 'api/v2/ComprarCreditoSMS';
19
+
20
+ parent::__construct($host, $this->getAuthDto(), $machine);
21
+ }
22
+
23
+ public function Post(PagueVeloz_Api_Model_Dto_ComprarCreditosSMSDTO $dto)
24
+ {
25
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
26
+ $contexto->setMethod('post');
27
+ $contexto->addHeader($this->_default_header);
28
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
29
+ $contexto->setHost($this->getHost());
30
+
31
+ $json = array(
32
+ 'FormaPagto' => $dto->getFormatPto()
33
+ );
34
+
35
+ if ($dto->getCreditos()) {
36
+ $json['Creditos'] = $dto->getCreditos();
37
+ } else {
38
+ $json['Valor'] = $dto->getValor();
39
+ }
40
+
41
+ $json = json_encode($json);
42
+ $contexto->setBody($json);
43
+ return $this->getMachine()->Send($contexto);
44
+ }
45
+
46
+ private function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
47
+ {
48
+ $this->_authDto = $authDto;
49
+ }
50
+
51
+ private function getAuthDto()
52
+ {
53
+ return $this->_authDto;
54
+ }
55
+
56
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/ConsultarBoleto.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_ConsultarBoleto extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/ConsultarBoleto', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Get(PagueVeloz_Api_Model_Dto_ConsultarBoletoDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('get');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost() . '?data=' . $dto->getData());
24
+
25
+ return $this->getMachine()->Send($contexto);
26
+ }
27
+
28
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
29
+ {
30
+ $this->_authDto = $authDto;
31
+ }
32
+
33
+ public function getAuthDto()
34
+ {
35
+ return $this->_authDto;
36
+ }
37
+
38
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/ConsultarCliente.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_ConsultarCliente extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/Consultar', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Get(PagueVeloz_Api_Model_Dto_ConsultarClienteDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('get');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost() . '?tipo=' . $dto->getTipo() . '&filtro=' . $dto->getFiltro());
24
+
25
+ return $this->getMachine()->Send($contexto);
26
+ }
27
+
28
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
29
+ {
30
+ $this->_authDto = $authDto;
31
+ }
32
+
33
+ public function getAuthDto()
34
+ {
35
+ return $this->_authDto;
36
+ }
37
+
38
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/Conta.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_Conta extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/Conta', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Post(PagueVeloz_Api_Model_Dto_ContaDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('post');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ $json = array(
26
+ 'Valor' => $dto->getValor(),
27
+ 'Titulo' => $dto->getTitulo(),
28
+ 'NomeTitulo' => $dto->getNomeTitulo(),
29
+ 'Vencimento' => $dto->getVencimento(),
30
+ 'CodigoDeBarras' => $dto->getCodigoDeBarras()
31
+ );
32
+
33
+ $json = json_encode($json);
34
+ $contexto->setBody($json);
35
+
36
+ return $this->getMachine()->Send($contexto);
37
+ }
38
+
39
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
40
+ {
41
+ $this->_authDto = $authDto;
42
+ }
43
+
44
+ public function getAuthDto()
45
+ {
46
+ return $this->_authDto;
47
+ }
48
+
49
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/ContaBancaria.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_ContaBancaria extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v2/ContaBancaria', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Get()
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('get');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ return $this->getMachine()->Send($contexto);
26
+ }
27
+
28
+ public function GetById(PagueVeloz_Api_Model_Dto_ContaBancariaDTO $dto)
29
+ {
30
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
31
+ $contexto->setMethod('get');
32
+ $contexto->addHeader($this->_default_header);
33
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
34
+ $contexto->setHost($this->getHost() . '?id=' . $dto->getId());
35
+
36
+ return $this->getMachine()->Send($contexto);
37
+ }
38
+
39
+ public function Post(PagueVeloz_Api_Model_Dto_ContaBancariaDTO $dto)
40
+ {
41
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
42
+ $contexto->setMethod('post');
43
+ $contexto->addHeader($this->_default_header);
44
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
45
+ $contexto->setHost($this->getHost());
46
+
47
+ $json = '{
48
+ "CodigoBanco": %u,
49
+ "CodigoAgencia": %u,
50
+ "NumeroConta": %u,
51
+ "Descricao": "%s"
52
+ }';
53
+ $json = sprintf($json, $dto->getBanco(), $dto->getAgencia(), $dto->getConta(), $dto->getDescricao());
54
+
55
+ $contexto->setBody($json);
56
+
57
+ return $this->getMachine()->Send($contexto);
58
+ }
59
+
60
+ public function Put(PagueVeloz_Api_Model_Dto_ContaBancariaDTO $dto)
61
+ {
62
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
63
+ $contexto->setMethod('put');
64
+ $contexto->addHeader($this->_default_header);
65
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
66
+ $contexto->setHost($this->getHost() . '?id=' . $dto->getId());
67
+
68
+ $json = '{
69
+ "CodigoBanco" : %u,
70
+ "CodigoAgencia" : %u,
71
+ "NumeroConta" : %u,
72
+ "Descricao" : "%s",
73
+ "Id" : %u
74
+ }';
75
+ $json = sprintf($json, $dto->getBanco(), $dto->getAgencia(), $dto->getConta(), $dto->getDescricao(), $dto->getId());
76
+
77
+ $contexto->setBody($json);
78
+
79
+ return $this->getMachine()->Send($contexto);
80
+ }
81
+
82
+ public function Delete(PagueVeloz_Api_Model_Dto_ContaBancariaDTO $dto)
83
+ {
84
+ $contexto = Mage::getModel('pageuveloz/common_httpContext');
85
+ $contexto->setMethod('delete');
86
+ $contexto->addHeader($this->_default_header);
87
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
88
+ $contexto->setHost($this->getHost() . '?id=' . $dto->getId());
89
+
90
+ return $this->getMachine()->Send($contexto);
91
+ }
92
+
93
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
94
+ {
95
+ $this->_authDto = $authDto;
96
+ }
97
+
98
+ public function getAuthDto()
99
+ {
100
+ return $this->_authDto;
101
+ }
102
+
103
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/CreditoSMS.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_CreditoSMS extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/CreditoSMS', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Get(PagueVeloz_Api_Model_Dto_CreditoSMSDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('get');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost() . '?data=' . $dto->getData());
24
+
25
+ return $this->getMachine()->Send($contexto);
26
+ }
27
+
28
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
29
+ {
30
+ $this->_authDto = $authDto;
31
+ }
32
+
33
+ public function getAuthDto()
34
+ {
35
+ return $this->_authDto;
36
+ }
37
+
38
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/EmitirBoleto.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_EmitirBoleto extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'content-type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token, PagueVeloz_Api_Model_Interfaces_IHttpClient $machine = null)
10
+ {
11
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
12
+
13
+ parent::__construct('api/v1/EmitirBoleto', $this->getAuthDto(), $machine);
14
+ }
15
+
16
+ public function Post(PagueVeloz_Api_Model_Dto_EmitirBoletoDTO $dto)
17
+ {
18
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
19
+ $contexto->setMethod('post');
20
+ $contexto->addHeader($this->_default_header);
21
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
22
+ $contexto->setHost($this->getHost());
23
+
24
+ $json = '{
25
+ "Vencimento": "%s"
26
+ , "Valor" : %u
27
+ , "SeuNumero" : "%s"
28
+ , "Sacado" : "%s"
29
+ , "CPFCNPJSacado" : "%s"
30
+ , "Parcela" : "%s"
31
+ , "Linha1" : "%s"
32
+ , "Linha2" : "%s"
33
+ , "CPFCNPJCedente" : "%s"
34
+ , "Cedente" : "%s"
35
+ }';
36
+
37
+ $json = sprintf($json, $dto->getVencimento(), $dto->getValor(), $dto->getSeuNumero(), $dto->getSacado(), $dto->getCpfCnpjSacado(), $dto->getParcela(), $dto->getLinha1(), $dto->getLinha2(), $dto->getCpfCnpjCedente(), $dto->getCedente()
38
+ );
39
+
40
+ $contexto->setBody($json);
41
+
42
+ return $this->getMachine()->Send($contexto);
43
+ }
44
+
45
+ private function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
46
+ {
47
+ $this->_authDto = $authDto;
48
+ }
49
+
50
+ private function getAuthDto()
51
+ {
52
+ return $this->_authDto;
53
+ }
54
+
55
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/MensagemSMS.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_MensagemSMS extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/MensagemSMS', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Post(PagueVeloz_Api_Model_Dto_MensagemSMSDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('post');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ $json = array(
26
+ 'TelefoneRemetente' => $dto->getTelefoneRemetente(),
27
+ 'TelefoneDestino' => $dto->getTelefoneDestino(),
28
+ 'Conteudo' => $dto->getConteudo(),
29
+ 'AgendarPara' => $dto->getAgendarPara()
30
+ );
31
+
32
+ $json = json_encode($json);
33
+ $contexto->setBody($json);
34
+ return $this->getMachine()->Send($contexto);
35
+ }
36
+
37
+ public function Get(PagueVeloz_Api_Model_Dto_MensagemSMSDTO $dto)
38
+ {
39
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
40
+ $contexto->setMethod('get');
41
+ $contexto->addHeader($this->_default_header);
42
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
43
+ $contexto->setHost($this->getHost());
44
+
45
+ return $this->getMachine()->Send($contexto);
46
+ }
47
+
48
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
49
+ {
50
+ $this->_authDto = $authDto;
51
+ }
52
+
53
+ public function getAuthDto()
54
+ {
55
+ return $this->_authDto;
56
+ }
57
+
58
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/PacotesSMS.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_PacotesSMS extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/PacotesSMS', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Get(PagueVeloz_Api_Model_Dto_PacotesSMSDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('get');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ return $this->getMachine()->Send($contexto);
26
+ }
27
+
28
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
29
+ {
30
+ $this->_authDto = $authDto;
31
+ }
32
+
33
+ public function getAuthDto()
34
+ {
35
+ return $this->_authDto;
36
+ }
37
+
38
+ }
39
+
app/code/community/PagueVeloz/Api/Model/Webservice/PagueVeloz.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @copyright - 2013 (c) Bludata Software
6
+ * @version - 1.0.51r
7
+ *
8
+ */
9
+ abstract class PagueVeloz_Api_Model_Webservice_PagueVeloz extends Mage_Core_Model_Abstract
10
+ {
11
+
12
+ private $_machine;
13
+ private $_host;
14
+ private $_authentication = null;
15
+
16
+ public function __construct($host, PagueVeloz_Api_Model_Dto_AuthenticationDTO $auth = null, PagueVeloz_Api_Model_Interfaces_IHttpClient $machine = null)
17
+ {
18
+ if (empty($machine)) {
19
+ $this->_machine = new PagueVeloz_Api_Model_Services_Curl();
20
+ } else {
21
+ $this->_machine = $machine;
22
+ }
23
+
24
+ $this->setHost($host);
25
+
26
+ if ($auth) {
27
+ $this->setAuthentication($auth);
28
+ }
29
+
30
+ return parent::__construct();
31
+ }
32
+
33
+ public function setHost($host)
34
+ {
35
+ $host = Mage::getModel('pagueveloz_api/webservice')->getPaguevelozUrl() . $host;
36
+
37
+ if (!self::isValidHost($host)) {
38
+ throw new PagueVeloz_Api_Model_Exceptions_InvalidHostException("$host é inválido.");
39
+ }
40
+
41
+ $this->_host = $host;
42
+ }
43
+
44
+ public function setAuthentication(PagueVeloz_Api_Model_Dto_AuthenticationDTO $auth)
45
+ {
46
+ $this->_authentication = $auth;
47
+ }
48
+
49
+ public function getAuthentication()
50
+ {
51
+ return $this->_authentication;
52
+ }
53
+
54
+ public function getMachine()
55
+ {
56
+ return $this->_machine;
57
+ }
58
+
59
+ public function getHost()
60
+ {
61
+ return $this->_host;
62
+ }
63
+
64
+ private static function isValidHost($host)
65
+ {
66
+ return 1 === preg_match('|^http(s)?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $host);
67
+ }
68
+
69
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/Saldo.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_Saldo extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/Saldo', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Get()
18
+ {
19
+ $contexto = Mage::getModl('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('get');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ return $this->getMachine()->Send($contexto);
26
+ }
27
+
28
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
29
+ {
30
+ $this->_authDto = $authDto;
31
+ }
32
+
33
+ public function getAuthDto()
34
+ {
35
+ return $this->_authDto;
36
+ }
37
+
38
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/Saque.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_Saque extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/Saque', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Post(PagueVeloz_Api_Model_Dto_SaqueDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('post');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ $json = '{
26
+ "ContaBancaria":
27
+ {
28
+ "Id": %u
29
+ },
30
+ "Valor": %s
31
+ }';
32
+ $json = sprintf($json, $dto->getId(), $dto->getValor()
33
+ );
34
+
35
+ $contexto->setBody($json);
36
+
37
+ return $this->getMachine()->Send($contexto);
38
+ }
39
+
40
+ public function Get()
41
+ {
42
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
43
+ $contexto->setMethod('get');
44
+ $contexto->addHeader($this->_default_header);
45
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
46
+ $contexto->setHost($this->getHost());
47
+
48
+ return $this->getMachine()->Send($contexto);
49
+ }
50
+
51
+ public function GetById(PagueVeloz_Api_Model_Dto_SaqueDTO $dto)
52
+ {
53
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
54
+ $contexto->setMethod('get');
55
+ $contexto->addHeader($this->_default_header);
56
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
57
+ $contexto->setHost($this->getHost() . '?id=' . $dto->getId());
58
+
59
+ return $this->getMachine()->Send($contexto);
60
+ }
61
+
62
+ public function Delete(PagueVeloz_Api_Model_Dto_SaqueDTO $dto)
63
+ {
64
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
65
+ $contexto->setMethod('delete');
66
+ $contexto->addHeader($this->_default_header);
67
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
68
+ $contexto->setHost($this->getHost() . '?id=' . $dto->getId());
69
+
70
+ return $this->getMachine()->Send($contexto);
71
+ }
72
+
73
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
74
+ {
75
+ $this->_authDto = $authDto;
76
+ }
77
+
78
+ public function getAuthDto()
79
+ {
80
+ return $this->_authDto;
81
+ }
82
+
83
+ }
app/code/community/PagueVeloz/Api/Model/Webservice/Transferencia.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Model_Webservice_Transferencia extends PagueVeloz_Api_Model_Webservice_PagueVeloz
4
+ {
5
+
6
+ private $_default_header = 'Content-Type: application/json';
7
+ private $_authDto;
8
+
9
+ public function __construct(PagueVeloz_Api_Model_Dto_EmailDTO $email, $token)
10
+ {
11
+ $machine = null;
12
+ $this->setAuthDto(new PagueVeloz_Api_Model_Dto_AuthenticationDTO($email->getEmail(), $token));
13
+
14
+ parent::__construct('api/v1/Transferencia', $this->getAuthDto(), $machine);
15
+ }
16
+
17
+ public function Post(PagueVeloz_Api_Model_Dto_TransferenciaDTO $dto)
18
+ {
19
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
20
+ $contexto->setMethod('post');
21
+ $contexto->addHeader($this->_default_header);
22
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
23
+ $contexto->setHost($this->getHost());
24
+
25
+ $json = '{
26
+ "ClienteDestino": "%s",
27
+ "Valor": %u,
28
+ "Descricao": "%s"
29
+ }';
30
+ $json = sprintf($json, $dto->getClienteDestino()->getEmail(), $dto->getValor(), $dto->getDescricao()
31
+ );
32
+
33
+ $contexto->setBody($json);
34
+
35
+ return $this->getMachine()->Send($contexto);
36
+ }
37
+
38
+ public function Get()
39
+ {
40
+ $contexto = Mage::getModel('pagueveloz_api/common_httpContext');
41
+ $contexto->setMethod('get');
42
+ $contexto->addHeader($this->_default_header);
43
+ $contexto->setAuthorization($this->getAuthDto()->getEmail(), $this->getAuthDto()->getToken());
44
+ $contexto->setHost($this->getHost());
45
+
46
+ return $this->getMachine()->Send($contexto);
47
+ }
48
+
49
+ public function setAuthDto(PagueVeloz_Api_Model_Dto_AuthenticationDTO $authDto)
50
+ {
51
+ $this->_authDto = $authDto;
52
+ }
53
+
54
+ public function getAuthDto()
55
+ {
56
+ return $this->_authDto;
57
+ }
58
+
59
+ }
app/code/community/PagueVeloz/Api/controllers/Adminhtml/PaguevelozController.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Api_Adminhtml_PaguevelozController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function indexAction()
7
+ {
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ public function assinarAction()
13
+ {
14
+ $response = array('msg' => '', 'success' => false);
15
+
16
+
17
+ $cidade = $this->getRequest()->getParam('Cidade');
18
+ $estado = $this->getRequest()->getParam('Estado');
19
+ $rua = $this->getRequest()->getParam('Logradouro');
20
+ $numero = $this->getRequest()->getParam('Numero');
21
+ $nome = $this->getRequest()->getParam('Nome');
22
+ $cep = $this->getRequest()->getParam('CEP');
23
+ $doc = $this->getRequest()->getParam('Documento');
24
+ $tipoPessoa = $this->getRequest()->getParam('TipoPessoa');
25
+ $email = $this->getRequest()->getParam('Email');
26
+ $login = $this->getRequest()->getParam('LoginUsuarioDefault');
27
+ $isProduction = $this->getRequest()->getParam('isProduction', 0);
28
+
29
+ $config = new Mage_Core_Model_Config();
30
+ $config->saveConfig('pagueveloz/pagueveloz_configuration/production', $isProduction);
31
+ Mage::app()->getConfig()->reinit(); // Reinicia as configuracoes do magento do getConfig
32
+
33
+
34
+ try {
35
+ $webservice = Mage::getModel('pagueveloz_api/webservice');
36
+
37
+ $result = $webservice->assinar($nome, $doc, $tipoPessoa, $email, $login, $estado, $cidade, $rua, $cep, $numero);
38
+ $response['result'] = $result;
39
+ if ($result && is_object($result) && isset($result->Token)) {
40
+ $response['success'] = true;
41
+ $config->saveConfig('pagueveloz/pagueveloz_configuration/token', $result->Token);
42
+ $config->saveConfig('pagueveloz/pagueveloz_configuration/email', $email);
43
+ $config->saveConfig('pagueveloz/pagueveloz_configuration/id', $result->Id);
44
+ }
45
+ } catch (Exception $e) {
46
+ $response['msg'] = $e->getMessage();
47
+ }
48
+
49
+ $this->getResponse()->setHeader('Content-type', 'application/json');
50
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
51
+ }
52
+
53
+ }
app/code/community/PagueVeloz/Api/etc/adminhtml.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <pagueveloz translate="title" module="pagueveloz_sms">
5
+ <children>
6
+ <configuration>
7
+ <title>Configuration</title>
8
+ <sort_order>100</sort_order>
9
+ <action>adminhtml/system_config/edit/section/pagueveloz</action>
10
+ </configuration>
11
+ </children>
12
+ </pagueveloz>
13
+ </menu>
14
+ </config>
app/code/community/PagueVeloz/Api/etc/config.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <PagueVeloz_Api>
5
+ <version>1.0.0</version>
6
+ </PagueVeloz_Api>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <pagueveloz_api>
11
+ <class>PagueVeloz_Api_Helper</class>
12
+ </pagueveloz_api>
13
+ </helpers>
14
+ <models>
15
+ <pagueveloz_api>
16
+ <class>PagueVeloz_Api_Model</class>
17
+ </pagueveloz_api>
18
+ </models>
19
+ <events>
20
+ <admin_system_config_changed_section_pagueveloz>
21
+ <observers>
22
+ <pagueveloz_api>
23
+ <type>singleton</type>
24
+ <class>pagueveloz_api/observer</class>
25
+ <method>savePaguevelozConfig</method>
26
+ </pagueveloz_api>
27
+ </observers>
28
+ </admin_system_config_changed_section_pagueveloz>
29
+ </events>
30
+ </global>
31
+ <admin>
32
+ <routers>
33
+ <adminhtml>
34
+ <args>
35
+ <modules>
36
+ <PagueVeloz_Api before="Mage_Adminhtml">PagueVeloz_Api_Adminhtml</PagueVeloz_Api>
37
+ </modules>
38
+ </args>
39
+ </adminhtml>
40
+ </routers>
41
+ </admin>
42
+ <adminhtml>
43
+ <layout>
44
+ <updates>
45
+ <pagueveloz_api>
46
+ <file>pagueveloz_api.xml</file>
47
+ </pagueveloz_api>
48
+ </updates>
49
+ </layout>
50
+ <acl>
51
+ <resources>
52
+ <all>
53
+ <title>Allow Everything</title>
54
+ </all>
55
+ <admin>
56
+ <children>
57
+ <system>
58
+ <children>
59
+ <config>
60
+ <children>
61
+ <pagueveloz>
62
+ <title>PagueVeloz - All</title>
63
+ </pagueveloz>
64
+ </children>
65
+ </config>
66
+ </children>
67
+ </system>
68
+ </children>
69
+ </admin>
70
+ </resources>
71
+ </acl>
72
+ </adminhtml>
73
+ </config>
app/code/community/PagueVeloz/Api/etc/system.xml ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <pagueveloz translate="label" module="pagueveloz_api">
5
+ <label>PagueVeloz</label>
6
+ <sort_order>100</sort_order>
7
+ </pagueveloz>
8
+ </tabs>
9
+ <sections>
10
+ <pagueveloz translate="label" module="pagueveloz_api">
11
+ <label>Configuração</label>
12
+ <tab>pagueveloz</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1000</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <pagueveloz_configuration translate="label">
20
+ <label>Integração Pagueveloz</label>
21
+ <sort_order>670</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>0</show_in_store>
25
+ <comment>
26
+ <![CDATA[
27
+ <div class="config-heading">
28
+ <strong style="font-size:14px">Informações Importantes</strong><br /><br />
29
+ <div>
30
+ <button style="height: 50px; margin-left: 50px;" onclick="pagueveloz.cadastrar()" class="scalable save" type="button" title="Salvar Configuração" id="id_78fc26f7eeebbd0b527349a17a37de66">
31
+ <span><span><span>Assinar PagueVeloz</span></span></span>
32
+ </button>
33
+ </div>
34
+ <div style="color: #fc862e;
35
+ font-size: xx-large;
36
+ font-weight: bold;
37
+ margin-bottom: 25px;
38
+ margin-left: 100px;
39
+ margin-top: 25px;">OU</div>
40
+ Para criar seu token de produção faça o cadastro em
41
+ <a href="https://www.pagueveloz.com.br/Cliente" target="_blank">PagueVeloz</a>.<br />
42
+ Para criar seu token para testes, em homologação, faça o cadastro em
43
+ <a href="http://pagueveloz.homolog.bludata.net/Cliente" target="_blank">PagueVeloz Homolog</a>.
44
+
45
+ </div>
46
+ ]]>
47
+ </comment>
48
+ <fields>
49
+ <id translate="label">
50
+ <label>Id</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>0</sort_order>
53
+ <show_in_default>0</show_in_default>
54
+ <show_in_website>0</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </id>
57
+ <active translate="label">
58
+ <label>Habilitado</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>1</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </active>
66
+ <production translate="label">
67
+ <label>Produção</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ <sort_order>50</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>0</show_in_store>
74
+ </production>
75
+ <email translate="label">
76
+ <label>E-mail</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>75</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>0</show_in_store>
82
+ <comment>Email de cadastro no PagueVeloz</comment>
83
+ </email>
84
+ <token translate="label">
85
+ <label>Token</label>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>85</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>0</show_in_store>
91
+ <comment>Token gerado pela conta PagueVeloz</comment>
92
+ </token>
93
+ </fields>
94
+ </pagueveloz_configuration>
95
+ <pagueveloz_cliente translate="label">
96
+ <label>Informações do Cliente</label>
97
+ <sort_order>670</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>0</show_in_store>
101
+ <comment>
102
+ <![CDATA[
103
+ <div class="config-heading">
104
+ Informe seus dados para atualizar informações no pagueveloz
105
+ </div>
106
+ ]]>
107
+ </comment>
108
+ <fields>
109
+ <name translate="label">
110
+ <label>Nome</label>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>0</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>0</show_in_store>
116
+ </name>
117
+ <email translate="label">
118
+ <label>E-mail</label>
119
+ <frontend_type>text</frontend_type>
120
+ <sort_order>75</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>0</show_in_store>
124
+ </email>
125
+ <send_boleto_pago translate="label">
126
+ <label>Enviar por email boletos pagos</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>adminhtml/system_config_source_yesno</source_model>
129
+ <sort_order>200</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>0</show_in_store>
133
+ </send_boleto_pago>
134
+ <cidade translate="label">
135
+ <label>Cidade</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>250</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>0</show_in_store>
141
+ </cidade>
142
+ <estado translate="label">
143
+ <label>Estado</label>
144
+ <frontend_type>text</frontend_type>
145
+ <sort_order>300</sort_order>
146
+ <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
+ <show_in_store>0</show_in_store>
149
+ </estado>
150
+ <logradouro translate="label">
151
+ <label>Rua</label>
152
+ <frontend_type>text</frontend_type>
153
+ <sort_order>350</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>1</show_in_website>
156
+ <show_in_store>0</show_in_store>
157
+ </logradouro>
158
+ <numero translate="label">
159
+ <label>Numero</label>
160
+ <frontend_type>text</frontend_type>
161
+ <sort_order>400</sort_order>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>1</show_in_website>
164
+ <show_in_store>0</show_in_store>
165
+ </numero>
166
+ <cep translate="label">
167
+ <label>Cep</label>
168
+ <frontend_type>text</frontend_type>
169
+ <sort_order>450</sort_order>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>1</show_in_website>
172
+ <show_in_store>0</show_in_store>
173
+ </cep>
174
+ </fields>
175
+ </pagueveloz_cliente>
176
+ </groups>
177
+ </pagueveloz>
178
+ </sections>
179
+ </config>
app/code/community/PagueVeloz/Boleto/Block/Adminhtml/Content.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Block_Adminhtml_Content extends Mage_Adminhtml_Block_Template
4
+ {
5
+
6
+ protected $_webservice;
7
+
8
+ public function getWebService()
9
+ {
10
+ if (!$this->_webservice) {
11
+ $this->_webservice = Mage::getModel("pagueveloz_api/webservice");
12
+ }
13
+
14
+ return $this->_webservice;
15
+ }
16
+
17
+ }
app/code/community/PagueVeloz/Boleto/Block/Adminhtml/Js.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Block_Adminhtml_Js extends Mage_Adminhtml_Block_Template
4
+ {
5
+
6
+ }
app/code/community/PagueVeloz/Boleto/Block/Adminhtml/Sales/Order/View/Tab/Boleto.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Block_Adminhtml_Sales_Order_View_Tab_Boleto extends Mage_Adminhtml_Block_Sales_Order_Abstract implements Mage_Adminhtml_Block_Widget_Tab_Interface
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->setTemplate('pagueveloz/boleto.phtml');
10
+ }
11
+
12
+ /**
13
+ * Retrieve order model instance
14
+ *
15
+ * @return Mage_Sales_Model_Order
16
+ */
17
+ public function getOrder()
18
+ {
19
+ return Mage::registry('current_order');
20
+ }
21
+
22
+ /**
23
+ * Retrieve source model instance
24
+ *
25
+ * @return Mage_Sales_Model_Order
26
+ */
27
+ public function getSource()
28
+ {
29
+ return $this->getOrder();
30
+ }
31
+
32
+ public function getBoleto()
33
+ {
34
+ return Mage::getModel('pagueveloz_boleto/boleto')->loadByOrderId($this->getOrder()->getId());
35
+ }
36
+
37
+ /**
38
+ * ######################## TAB settings #################################
39
+ */
40
+ public function getTabLabel()
41
+ {
42
+ return Mage::helper('sales')->__('Pague Veloz - Boleto');
43
+ }
44
+
45
+ public function getTabTitle()
46
+ {
47
+ return Mage::helper('sales')->__('Pague Veloz - Boleto');
48
+ }
49
+
50
+ public function canShowTab()
51
+ {
52
+ return ($this->getOrder()->getPayment()->getMethodInstance()->getCode() == 'pagueveloz_boleto') ? true : false;
53
+ }
54
+
55
+ public function isHidden()
56
+ {
57
+ return ($this->getOrder()->getPayment()->getMethodInstance()->getCode() == 'pagueveloz_boleto') ? false : true;
58
+ }
59
+
60
+ }
app/code/community/PagueVeloz/Boleto/Block/Form/Boleto.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Boleto
5
+ * @package PagueVeloz_Boleto
6
+ * @copyright André Felipe (andrew.daluz@gmail.com)
7
+ */
8
+ class PagueVeloz_Boleto_Block_Form_Boleto extends Mage_Payment_Block_Form
9
+ {
10
+
11
+ protected $_instructions;
12
+
13
+ /**
14
+ * Block construction. Set block template.
15
+ */
16
+ protected function _construct()
17
+ {
18
+ parent::_construct();
19
+ $this->setTemplate('payment/form/pagueveloz_boleto.phtml');
20
+ }
21
+
22
+ /**
23
+ * Get instructions text from config
24
+ *
25
+ * @return string
26
+ */
27
+ public function getInstructions()
28
+ {
29
+ if (is_null($this->_instructions)) {
30
+ $this->_instructions = $this->getMethod()->getInstructions();
31
+ }
32
+ return $this->_instructions;
33
+ }
34
+
35
+ }
app/code/community/PagueVeloz/Boleto/Block/Info/Boleto.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Boleto
5
+ * @package PagueVeloz_Boleto
6
+ * @copyright André Felipe (andrew.daluz@gmail.com)
7
+ */
8
+ class PagueVeloz_Boleto_Block_Info_Boleto extends Mage_Payment_Block_Info
9
+ {
10
+
11
+ protected $_instructions;
12
+
13
+ protected function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->setTemplate('payment/info/pagueveloz_boleto.phtml');
17
+ }
18
+
19
+ /**
20
+ * Get instructions text from order payment
21
+ * (or from config, if instructions are missed in payment)
22
+ *
23
+ * @return string
24
+ */
25
+ public function getInstructions()
26
+ {
27
+ if (is_null($this->_instructions)) {
28
+ $this->_instructions = $this->getInfo()->getAdditionalInformation('instructions');
29
+ if (empty($this->_instructions)) {
30
+ $this->_instructions = $this->getMethod()->getInstructions();
31
+ }
32
+ }
33
+ return $this->_instructions;
34
+ }
35
+
36
+ }
app/code/community/PagueVeloz/Boleto/Block/Onepage/Success.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class PagueVeloz_Boleto_Block_Onepage_Success extends Mage_Checkout_Block_Onepage_Success
3
+ {
4
+
5
+ }
app/code/community/PagueVeloz/Boleto/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/PagueVeloz/Boleto/Model/Boleto.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Model_Boleto extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('pagueveloz_boleto/boleto'); // this is location of the resource file.
10
+ }
11
+
12
+ public function saveWithConfigData()
13
+ {
14
+ $vencimento = (int) Mage::getModel('pagueveloz_boleto/boletoMethod')->getConfig('vencimento');
15
+ $date = date("Y-m-d"); // Data de hoje
16
+ $mod_date = strtotime($date . "+ {$vencimento} days"); // Soma dias na data
17
+ $dataVencimento = date("Y-m-d", $mod_date);
18
+
19
+ $this->setDataVencimento($dataVencimento);
20
+ $this->setStatus(0);
21
+
22
+ return $this->save();
23
+ }
24
+
25
+ public function loadByOrderId($orderId)
26
+ {
27
+ $item = $this->getCollection()->addFieldToFilter('order_id', array('in' => $orderId))->getFirstItem();
28
+ if ($item) {
29
+ return $item;
30
+ }
31
+
32
+ return $this;
33
+ }
34
+
35
+ public function getId()
36
+ {
37
+ return $this->getBoletoId();
38
+ }
39
+
40
+ public function getDateVencimento()
41
+ {
42
+ return $this->getDataVencimento();
43
+ }
44
+
45
+ public function getPagamento()
46
+ {
47
+ $boletoMethod = Mage::getModel('pagueveloz_boleto/boletoMethod');
48
+ $_order = Mage::getModel('sales/order')->load($this->getOrderId());
49
+
50
+ try {
51
+ $_boletosData = $boletoMethod->getBoletoPago($this->getSeuNumero());
52
+
53
+ if ($_boletosData) {
54
+ foreach ($_boletosData as $_boleto) {
55
+ if (($_boleto->SeuNumero == $this->getSeuNumero()) && $_boleto->TemPagamento) {
56
+ $this->invoiceOrder($_order);
57
+ $_order->addStatusHistoryComment("BOLETO PAGO EM: {$_boleto->DataPagamento} | R$ {$_boleto->ValorPago}")
58
+ ->save();
59
+ $_order->setStatus($boletoMethod->getPaidOrderStatus())
60
+ ->save();
61
+
62
+ $this->setStatus('pago')
63
+ ->setValorPago($_boleto->ValorPago)
64
+ ->setUpdatedTime(Mage::getSingleton('core/date')->gmtDate())
65
+ ->save();
66
+
67
+ $_boleto->Status = 'pago';
68
+
69
+ $boletoMethod->log("[{$this->getSeuNumero()}] Boleto Pago | ID: " . $_boleto->Id . " | URL: " . $_boleto->Url);
70
+ return $_boleto;
71
+ }
72
+ }
73
+ }
74
+ } catch (Exception $e) {
75
+ $boletoMethod->log($e->getMessage());
76
+ }
77
+ }
78
+
79
+ protected function invoiceOrder($order)
80
+ {
81
+ try {
82
+ if(!$order->canInvoice())
83
+ {
84
+ Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
85
+ }
86
+
87
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
88
+
89
+ if (!$invoice->getTotalQty()) {
90
+ Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
91
+ }
92
+
93
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
94
+ $invoice->register();
95
+ $transactionSave = Mage::getModel('core/resource_transaction')
96
+ ->addObject($invoice)
97
+ ->addObject($invoice->getOrder());
98
+
99
+ $transactionSave->save();
100
+ }
101
+ catch (Mage_Core_Exception $e) {
102
+ $order->addStatusHistoryComment("ERRO AO GERAR FATURA BOLETO: " . $e->getMessage())
103
+ ->save();
104
+ }
105
+ }
106
+
107
+ public function generate($order)
108
+ {
109
+ $customer = Mage::getModel("customer/customer")->load($order->getCustomerId());
110
+ $valor = $order->getGrandTotal();
111
+ $seuNumero = $order->getIncrementId();
112
+ $nome = $order->getCustomerName();
113
+ $cpf = ($order->getCustomerTaxvat()) ? $order->getCustomerTaxvat() : $customer->getTaxvat();
114
+ $email = $order->getCustomerEmail();
115
+ $boleto = $this->loadByOrderId($order->getId());
116
+ if (!$boleto->getId()) {
117
+ $webservice = Mage::getModel('pagueveloz_api/webservice');
118
+ $url = $webservice->generateBoletoUrl($valor, $seuNumero, $nome, $cpf, $email);
119
+ if ($url) {
120
+ $this->setUrl($url);
121
+ $this->setValor($valor);
122
+ $this->setOrderId($order->getId());
123
+ $this->setSeuNumero($seuNumero);
124
+ $this->saveWithConfigData();
125
+ }
126
+
127
+ $boleto = $this;
128
+ }
129
+
130
+ return $boleto;
131
+ }
132
+
133
+ public function regenerate()
134
+ {
135
+ $this->setQtyRegerado($this->getQtyRegerado()+1);
136
+ $order = $this->getOrder();
137
+ $customer = Mage::getModel("customer/customer")->load($order->getCustomerId());
138
+ $webservice = Mage::getModel('pagueveloz_api/webservice');
139
+ $seuNumero = $order->getIncrementId() . "-" . $this->getQtyRegerado();
140
+ $this->setSeuNumero($seuNumero);
141
+ $nome = $order->getCustomerName();
142
+ $cpf = ($order->getCustomerTaxvat()) ? $order->getCustomerTaxvat() : $customer->getTaxvat();
143
+ $email = $order->getCustomerEmail();
144
+
145
+ $url = $webservice->generateBoletoUrl($this->getValor(), $seuNumero, $nome, $cpf, $email);
146
+ if ($url) {
147
+ $this->url = $url;
148
+ $this->save();
149
+ }
150
+
151
+ return $url;
152
+ }
153
+
154
+ public function getOrder()
155
+ {
156
+ return Mage::getModel('sales/order')->load($this->getOrderId());
157
+ }
158
+
159
+ public function isVencimento($pagamento)
160
+ {
161
+ $boletoMethod = Mage::getModel('pagueveloz_boleto/boletoMethod');
162
+ $_diasPosVencimento = $boletoMethod->getConfig('posvencimento') ? '+'.$boletoMethod->getConfig('posvencimento').' days' : '+ 0 days';
163
+
164
+ $dateVencimento = date('Y-m-d',strtotime($this->getDateVencimento() . $_diasPosVencimento));
165
+ $today = date('Y-m-d');
166
+
167
+ // Cancela, por que está vencido
168
+ if (strtotime($today) > strtotime($this->getDateVencimento()) && !$pagamento) {
169
+ $_order = Mage::getModel('sales/order')->load($this->getOrderId());
170
+
171
+ $_order->cancel();
172
+ $_order->setStatus('canceled')
173
+ ->setState('canceled')
174
+ ->save();
175
+
176
+ $this->setStatus('vencido')
177
+ ->setValorPago(0)
178
+ ->setUpdatedTime(Mage::getSingleton('core/date')->gmtDate())
179
+ ->save();
180
+ $boletoMethod->log("[{$this->getSeuNumero()}] Boleto Cancelado Por Vencimento");
181
+ }
182
+ }
183
+ }
app/code/community/PagueVeloz/Boleto/Model/BoletoMethod.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Model_BoletoMethod extends Mage_Payment_Model_Method_Banktransfer
4
+ {
5
+
6
+ const PAYMENT_METHOD_BANKTRANSFER_CODE = 'pagueveloz_boleto';
7
+
8
+ protected $webserivce = null;
9
+ protected $_code = self::PAYMENT_METHOD_BANKTRANSFER_CODE;
10
+ protected $_formBlockType = 'pagueveloz_boleto/form_boleto';
11
+ protected $_infoBlockType = 'pagueveloz_boleto/info_boleto';
12
+
13
+ public function getInstructions()
14
+ {
15
+ if (!$this->getConfig('instruction1') && !$this->getConfig('instruction2')) {
16
+ return '';
17
+ }
18
+
19
+ return $this->getConfig('instruction1') . "<br>" . $this->getConfig('instruction2');
20
+ }
21
+
22
+ public function getPaidOrderStatus()
23
+ {
24
+ return Mage::getStoreConfig('payment/pagueveloz_boleto/order_status_paid');
25
+ }
26
+
27
+ public function getNewOrderStatus()
28
+ {
29
+ return Mage::getStoreConfig('payment/pagueveloz_boleto/order_status_new');
30
+ }
31
+
32
+ public function log($msg)
33
+ {
34
+ Mage::log($msg, null, $this->_code . '.log');
35
+ }
36
+
37
+ public function getConfig($key)
38
+ {
39
+ return Mage::getStoreConfig("payment/{$this->_code}/{$key}");
40
+ }
41
+
42
+ public function getEmail()
43
+ {
44
+ return $this->getWebservice()->getPaguevelozEmail();
45
+ }
46
+
47
+ public function getToken()
48
+ {
49
+ return $this->getWebservice()->getPaguevelozToken();
50
+ }
51
+
52
+ public function getWebservice()
53
+ {
54
+ if (!$this->webservice) {
55
+ $this->webservice = Mage::getModel('pagueveloz_api/webservice');
56
+ }
57
+
58
+ return $this->webservice;
59
+ }
60
+
61
+ public function getBoletoPago($seuNumero)
62
+ {
63
+ $boleto = new PagueVeloz_Api_Model_Webservice_Boleto(Mage::getModel('pagueveloz_api/dto_emailDTO', $this->getEmail()), $this->getToken());
64
+
65
+ $dto = Mage::getModel('pagueveloz_api/dto_boletoDTO');
66
+ $dto->setSeuNumero($seuNumero);
67
+ $resposta_final = $boleto->Get($dto);
68
+
69
+ return json_decode($resposta_final->getBody());
70
+ }
71
+
72
+ }
app/code/community/PagueVeloz/Boleto/Model/Cron.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Model_Cron
4
+ {
5
+
6
+ public static function verificaBoletoPago()
7
+ {
8
+ $boletosPago = array();
9
+ $boletoMethod = Mage::getModel('pagueveloz_boleto/boletoMethod');
10
+
11
+ /*
12
+ * @TODO Usar enum/constante para status de "pago"
13
+ */
14
+
15
+ $_boletos = Mage::getModel('pagueveloz_boleto/boleto')->getCollection()
16
+ ->addFieldToFilter('status', array('nin' => array('pago','vencido')));
17
+
18
+ try {
19
+ if ($_boletos) {
20
+ foreach ($_boletos as $_boleto) {
21
+ $pagamento = $_boleto->getPagamento();
22
+ $_boleto->isVencimento($pagamento);
23
+ }
24
+ }
25
+ } catch (Exception $e) {
26
+ $boletoMethod->log($e->getMessage());
27
+ }
28
+ }
29
+ }
app/code/community/PagueVeloz/Boleto/Model/Mysql4/Boleto.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Model_Mysql4_Boleto extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ $this->_init('pagueveloz_boleto/boleto', 'boleto_id'); // here test_id is the primary of the table test. And test/test, is the magento table name as mentioned in the //config.xml file.
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Boleto/Model/Mysql4/Boleto/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Model_Mysql4_Boleto_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init('pagueveloz_boleto/boleto');
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Boleto/controllers/Adminhtml/BoletoController.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Adminhtml_BoletoController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function indexAction()
7
+ {
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ public function regerarAction()
13
+ {
14
+ if ($this->getRequest()->getParam('isAjax')) {
15
+ $response = array('msg' => '', 'success' => false);
16
+
17
+ $boleto_id = $this->getRequest()->getParam('boleto_id');
18
+ if ($boleto_id) {
19
+ try {
20
+ $boleto = Mage::getModel('pagueveloz_boleto/boleto')->load($boleto_id);
21
+
22
+ if ($boleto) {
23
+ /** Gerar novo boleto **/
24
+ $response['url'] = $boleto->regenerate();
25
+ $response['success'] = true;
26
+ } else {
27
+ $response['msg'] = 'Boleto não encontrado';
28
+ }
29
+ } catch (Exception $e) {
30
+ $response['msg'] = $e->getMessage();
31
+ }
32
+ } else {
33
+ $order_id = $boleto_id = $this->getRequest()->getParam('order_id');
34
+ $boleto = Mage::getModel('pagueveloz_boleto/boleto')->generate(Mage::getModel('sales/order')->load($order_id));
35
+ if ($boleto->getUrl()) {
36
+ $response['url'] = $boleto->getUrl();
37
+ $response['boleto_id'] = $boleto->getId();
38
+ $response['success'] = true;
39
+ } else {
40
+ $response['msg'] = 'Boleto não informado.';
41
+ }
42
+ }
43
+
44
+ $this->getResponse()->setHeader('Content-type', 'application/json');
45
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
46
+ }
47
+ }
48
+
49
+ public function verificarAction()
50
+ {
51
+ if ($this->getRequest()->getParam('isAjax')) {
52
+ $response = array('msg' => '', 'success' => false);
53
+
54
+ $boleto_id = $this->getRequest()->getParam('boleto_id');
55
+ if ($boleto_id) {
56
+ try {
57
+ $boleto = Mage::getModel('pagueveloz_boleto/boleto')->load($boleto_id);
58
+
59
+ if ($boleto) {
60
+ $pagamento = $boleto->getPagamento();
61
+ if ($pagamento) {
62
+ $response['success'] = true;
63
+ $response['pagamento'] = $pagamento;
64
+ } else {
65
+ $response['msg'] = 'Pagamento não efetuado';
66
+ }
67
+ } else {
68
+ $response['msg'] = 'Boleto não encontrado';
69
+ }
70
+ } catch (Exception $e) {
71
+ $response['msg'] = $e->getMessage();
72
+ }
73
+ } else {
74
+ $response['msg'] = 'Boleto não informado.';
75
+ }
76
+
77
+ $this->getResponse()->setHeader('Content-type', 'application/json');
78
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
79
+ }
80
+ }
81
+ }
app/code/community/PagueVeloz/Boleto/controllers/Adminhtml/ContaController.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Boleto_Adminhtml_ContaController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function cadastrarAction()
7
+ {
8
+ if ($this->getRequest()->getParam('isAjax')) {
9
+ $response = array('msg' => '', 'success' => false);
10
+
11
+ $codigo_barras = $this->getRequest()->getParam('codigo_barras');
12
+ $nome_titulo = $this->getRequest()->getParam('nome_titulo');
13
+ $titulo = $this->getRequest()->getParam('titulo');
14
+ $valor = $this->getRequest()->getParam('valor');
15
+ $vencimento = $this->getRequest()->getParam('vencimento');
16
+
17
+ if ($codigo_barras && $valor && $vencimento) {
18
+ try {
19
+ $webservice = Mage::getModel('pagueveloz_api/webservice');
20
+
21
+ $result = $webservice->cadastrarConta($codigo_barras, $nome_titulo, $titulo, $valor, $vencimento);
22
+ if (is_array($result)) {
23
+ $response['error'] = $result;
24
+ } else if ($result) {
25
+ $response['msg'] = $result;
26
+ } else {
27
+ $response['success'] = true;
28
+ }
29
+ } catch (Exception $e) {
30
+ $response['msg'] = $e->getMessage();
31
+ }
32
+ } else {
33
+ $response['msg'] = 'Campos não informado corretamente.';
34
+ }
35
+
36
+ $this->getResponse()->setHeader('Content-type', 'application/json');
37
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
38
+ }
39
+ }
40
+ }
app/code/community/PagueVeloz/Boleto/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <pagueveloz translate="title" module="pagueveloz_boleto">
5
+ <title>PagueVeloz</title>
6
+ <sort_order>1000</sort_order>
7
+ <children>
8
+ <boleto>
9
+ <title>Boleto</title>
10
+ <sort_order>1</sort_order>
11
+ <action>adminhtml/boleto/index</action>
12
+ </boleto>
13
+ </children>
14
+ </pagueveloz>
15
+ </menu>
16
+ <acl>
17
+ <resources>
18
+ <admin>
19
+ <children>
20
+ <pagueveloz translate="title" module="pagueveloz_boleto">
21
+ <title>PagueVeloz Boleto</title>
22
+ <sort_order>1</sort_order>
23
+ <children>
24
+ <all>
25
+ <title>All</title>
26
+ </all>
27
+ </children>
28
+ </pagueveloz>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/PagueVeloz/Boleto/etc/config.xml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <PagueVeloz_Boleto>
5
+ <version>1.0.6</version>
6
+ </PagueVeloz_Boleto>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <pagueveloz_boleto>
11
+ <class>PagueVeloz_Boleto_Helper</class>
12
+ </pagueveloz_boleto>
13
+ </helpers>
14
+ <blocks>
15
+ <pagueveloz_boleto>
16
+ <class>PagueVeloz_Boleto_Block</class>
17
+ </pagueveloz_boleto>
18
+ </blocks>
19
+ <models>
20
+ <pagueveloz_boleto>
21
+ <class>PagueVeloz_Boleto_Model</class>
22
+ <resourceModel>pagueveloz_boleto_mysql4</resourceModel>
23
+ </pagueveloz_boleto>
24
+ <pagueveloz_boleto_mysql4>
25
+ <class>PagueVeloz_Boleto_Model_Mysql4</class>
26
+ <entities>
27
+ <boleto>
28
+ <table>pagueveloz_boleto</table>
29
+ </boleto>
30
+ </entities>
31
+ </pagueveloz_boleto_mysql4>
32
+ </models>
33
+ <resources>
34
+ <pagueveloz_boleto_setup>
35
+ <setup>
36
+ <module>PagueVeloz_Boleto</module>
37
+ </setup>
38
+ <connection>
39
+ <use>core_setup</use>
40
+ </connection>
41
+ </pagueveloz_boleto_setup>
42
+ <pagueveloz_boleto_write>
43
+ <connection>
44
+ <use>core_write</use>
45
+ </connection>
46
+ </pagueveloz_boleto_write>
47
+ <pagueveloz_boleto_read>
48
+ <connection>
49
+ <use>core_read</use>
50
+ </connection>
51
+ </pagueveloz_boleto_read>
52
+ </resources>
53
+ </global>
54
+ <frontend>
55
+ <layout>
56
+ <updates>
57
+ <pagueveloz_boleto>
58
+ <file>pagueveloz_boleto.xml</file>
59
+ </pagueveloz_boleto>
60
+ </updates>
61
+ </layout>
62
+ </frontend>
63
+ <admin>
64
+ <routers>
65
+ <adminhtml>
66
+ <args>
67
+ <modules>
68
+ <PagueVeloz_Boleto before="Mage_Adminhtml">PagueVeloz_Boleto_Adminhtml</PagueVeloz_Boleto>
69
+ </modules>
70
+ </args>
71
+ </adminhtml>
72
+ </routers>
73
+ </admin>
74
+ <adminhtml>
75
+ <layout>
76
+ <updates>
77
+ <pagueveloz_boleto>
78
+ <file>pagueveloz_boleto.xml</file>
79
+ </pagueveloz_boleto>
80
+ </updates>
81
+ </layout>
82
+ </adminhtml>
83
+ <default>
84
+ <payment>
85
+ <pagueveloz_boleto>
86
+ <active>0</active>
87
+ <production>0</production>
88
+ <model>pagueveloz_boleto/boletoMethod</model>
89
+ <order_status>pending</order_status>
90
+ <title>Boleto</title>
91
+ <allowspecific>0</allowspecific>
92
+ <instructions>Pague em qualquer banco</instructions>
93
+ </pagueveloz_boleto>
94
+ </payment>
95
+ </default>
96
+ <crontab>
97
+ <jobs>
98
+ <pagueveloz_boleto>
99
+ <schedule>
100
+ <cron_expr>* * * * *</cron_expr>
101
+ </schedule>
102
+ <run>
103
+ <model>pagueveloz_boleto/cron::verificaBoletoPago</model>
104
+ </run>
105
+ </pagueveloz_boleto>
106
+ </jobs>
107
+ </crontab>
108
+ </config>
app/code/community/PagueVeloz/Boleto/etc/system.xml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <pagueveloz_boleto translate="label" module="pagueveloz_boleto">
7
+ <label>PagueVeloz - Boleto</label>
8
+ <sort_order>670</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <fields>
13
+ <active translate="label">
14
+ <label>Enabled</label>
15
+ <frontend_type>select</frontend_type>
16
+ <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ </active>
22
+ <pdf translate="label">
23
+ <label>Generate Pdf</label>
24
+ <frontend_type>select</frontend_type>
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <sort_order>50</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>0</show_in_store>
30
+ </pdf>
31
+ <send_email translate="label">
32
+ <label>Enviar por email</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_yesno</source_model>
35
+ <sort_order>75</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>0</show_in_store>
39
+ <comment>
40
+ Permite que o pagueveloz envie o email automaticamente para o cliente com o boleto gerado
41
+ </comment>
42
+ </send_email>
43
+ <order_status_paid translate="label">
44
+ <label>Status Pago</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
47
+ <sort_order>100</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </order_status_paid>
52
+ <title translate="label">
53
+ <label>Title</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>200</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>0</show_in_store>
59
+ </title>
60
+ <taxvat translate="label">
61
+ <label>Cpf/Cnpj</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>300</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </taxvat>
68
+ <cedente_name translate="label">
69
+ <label>Nome Cedente</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>400</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </cedente_name>
76
+ <vencimento translate="label">
77
+ <label>Dias vencimento</label>
78
+ <frontend_type>text</frontend_type>
79
+ <sort_order>450</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>0</show_in_store>
83
+ </vencimento>
84
+ <posvencimento translate="label">
85
+ <label>Dias pós vencimento</label>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>460</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>0</show_in_store>
91
+ <comment>Será incrementado aos dias de vencimento.</comment>
92
+ </posvencimento>
93
+ <generate_line_2 translate="label">
94
+ <label>Gerar informações na segunda linha?</label>
95
+ <frontend_type>select</frontend_type>
96
+ <source_model>adminhtml/system_config_source_yesno</source_model>
97
+ <sort_order>475</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>0</show_in_store>
101
+ <comment>
102
+ Na segunda linha do boleto irá as informações do pedido.
103
+ Ex.: Ref pedido 100000002 efetuado em www.trezo.com.br
104
+ </comment>
105
+ </generate_line_2>
106
+ <instruction1 translate="label">
107
+ <label>Instrução primeira linha</label>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>500</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>0</show_in_store>
113
+ </instruction1>
114
+ <instruction2 translate="label">
115
+ <label>Instrução segunda linha</label>
116
+ <frontend_type>text</frontend_type>
117
+ <sort_order>600</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>0</show_in_store>
121
+ <depends><generate_line_2>0</generate_line_2></depends>
122
+ </instruction2>
123
+ <sort_order translate="label">
124
+ <label>Sort Order</label>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>700</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ </sort_order>
131
+ </fields>
132
+ </pagueveloz_boleto>
133
+ </groups>
134
+ </payment>
135
+ </sections>
136
+ </config>
app/code/community/PagueVeloz/Boleto/sql/pagueveloz_boleto_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // here are the table creation for this module e.g.:
4
+ $this->startSetup();
5
+ $this->run("
6
+ -- DROP TABLE IF EXISTS {$this->getTable('pagueveloz_boleto')};
7
+ CREATE TABLE {$this->getTable('pagueveloz_boleto')} (
8
+ `boleto_id` int(11) unsigned NOT NULL auto_increment,
9
+ `order_id` int(11) NOT NULL,
10
+ `data_vencimento` datetime NOT NULL,
11
+ `url` TEXT NOT NULL,
12
+ `valor` float NOT NULL,
13
+ `status` varchar(20) NOT NULL default 'novo',
14
+ `created_time` TIMESTAMP default CURRENT_TIMESTAMP,
15
+ `updated_time` datetime NULL,
16
+ PRIMARY KEY (`boleto_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
+ ");
19
+ $this->endSetup();
app/code/community/PagueVeloz/Boleto/sql/pagueveloz_boleto_setup/mysql4-upgrade-1.0.0-1.0.1.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // here are the table creation for this module e.g.:
4
+ $this->startSetup();
5
+ $this->run("
6
+ ALTER TABLE {$this->getTable('pagueveloz_boleto')} ADD valor_pago float;
7
+ ");
8
+ $this->endSetup();
app/code/community/PagueVeloz/Boleto/sql/pagueveloz_boleto_setup/mysql4-upgrade-1.0.1-1.0.2.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // here are the table creation for this module e.g.:
4
+ $this->startSetup();
5
+ $this->run("
6
+ ALTER TABLE {$this->getTable('pagueveloz_boleto')} ADD qty_regerado int;
7
+ ALTER TABLE {$this->getTable('pagueveloz_boleto')} ADD seu_numero text;
8
+ ");
9
+ $this->endSetup();
app/code/community/PagueVeloz/Sms/Block/Adminhtml/Content.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Block_Adminhtml_Content extends Mage_Adminhtml_Block_Template
4
+ {
5
+
6
+ protected $_webservice;
7
+
8
+ public function getWebService()
9
+ {
10
+ if (!$this->_webservice) {
11
+ $this->_webservice = Mage::getModel("pagueveloz_api/webservice");
12
+ }
13
+
14
+ return $this->_webservice;
15
+ }
16
+
17
+ public function getSaldo()
18
+ {
19
+ return $this->getWebservice()->getCreditoSMS();
20
+ }
21
+
22
+ public function getPacotesSms()
23
+ {
24
+ return $this->getWebservice()->getPacotesSMS();
25
+ }
26
+
27
+ public function getTemplatesSMS()
28
+ {
29
+ return Mage::getModel('pagueveloz_sms/template')->getCollection();
30
+ }
31
+
32
+ public function getStatuses()
33
+ {
34
+ return Mage::getModel('sales/order_status')->getResourceCollection();
35
+ }
36
+
37
+ public function getTemplateByStatus($status)
38
+ {
39
+ if ($templateSms = Mage::getModel('pagueveloz_sms/template')->loadByStatusCode($status)) {
40
+ return $templateSms;
41
+ }
42
+
43
+ return new Varien_Object();
44
+ }
45
+
46
+ }
app/code/community/PagueVeloz/Sms/Block/Adminhtml/Js.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Block_Adminhtml_Js extends Mage_Adminhtml_Block_Template
4
+ {
5
+ /**
6
+ * Get currently edited product
7
+ *
8
+ * @return Mage_Catalog_Model_Product
9
+ public function getProduct()
10
+ {
11
+ return Mage::registry('current_product');
12
+ }
13
+ */
14
+ /**
15
+ * Get store object of curently edited product
16
+ *
17
+ * @return Mage_Core_Model_Store
18
+ public function getStore()
19
+ {
20
+ $product = $this->getProduct();
21
+ if ($product) {
22
+ return Mage::app()->getStore($product->getStoreId());
23
+ }
24
+ return Mage::app()->getStore();
25
+ }
26
+ */
27
+ }
app/code/community/PagueVeloz/Sms/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/PagueVeloz/Sms/Model/Cron.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Cron
4
+ {
5
+
6
+ public function sendSMS()
7
+ {
8
+ try {
9
+ $_smsCollection = Mage::getModel('pagueveloz_sms/sms')->getCollection();
10
+ $_smsCollection->addFieldToFilter('status', array(
11
+ 'in' => array(PagueVeloz_Sms_Model_Sms::SMS_NEW, PagueVeloz_Sms_Model_Sms::SMS_RESEND)
12
+ )
13
+ )
14
+ ->setOrder('created_time') // Os ultimos criados primeiro
15
+ ->setPageSize(100); // Processa 100 por vez
16
+
17
+ $webservicePagueveloz = Mage::getModel('pagueveloz_api/webservice');
18
+
19
+ foreach ($_smsCollection as $sms) {
20
+ $order = $sms->getOrder();
21
+ if ($order->getIncrementId()) {
22
+ $billing_address = $order->getBillingAddress();
23
+ $telephone = $billing_address->getTelephone();
24
+ $msg = $sms->getTemplate()->getMessage();
25
+ $result = $webservicePagueveloz->sendSMS($msg, $telephone);
26
+ $this->writeFile("Result : " . $result);
27
+ $sms->log($order->getIncrementId() . ": " . $result);
28
+ }
29
+ }
30
+ } catch (Exception $e) {
31
+ //$this->writeFile($e->getMessage());
32
+ $sms->log($e->getMessage());
33
+ }
34
+ }
35
+
36
+ public function writeFile($msg)
37
+ {
38
+ $file = '/home/andre/workspace/magento/var/log/SMS_TESTES.txt';
39
+ // Open the file to get existing content
40
+ $current = file_get_contents($file);
41
+ // Append a new person to the file
42
+ $current .= $msg . "\n";
43
+ // Write the contents back to the file
44
+ file_put_contents($file, $current);
45
+ }
46
+
47
+ }
app/code/community/PagueVeloz/Sms/Model/Mysql4/Sms.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Mysql4_Sms extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ $this->_init('pagueveloz_sms/sms', 'sms_id'); // here test_id is the primary of the table test. And test/test, is the magento table name as mentioned in the //config.xml file.
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Sms/Model/Mysql4/Sms/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Mysql4_Sms_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init('pagueveloz_sms/sms');
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Sms/Model/Mysql4/Template.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Mysql4_Template extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ $this->_init('pagueveloz_sms/template', 'sms_template_id'); // here test_id is the primary of the table test. And test/test, is the magento table name as mentioned in the //config.xml file.
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Sms/Model/Mysql4/Template/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Mysql4_Template_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init('pagueveloz_sms/template');
9
+ }
10
+
11
+ }
app/code/community/PagueVeloz/Sms/Model/Observer.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Observer
4
+ {
5
+ /*
6
+ verify to send sms by pagueveloz api
7
+ */
8
+
9
+ public function after_save_order($object)
10
+ {
11
+ $order = $object->getEvent()->getOrder();
12
+
13
+ try {
14
+ $template = Mage::getModel('pagueveloz_sms/template')->loadEnabledByStatusCode($order->getStatus());
15
+ if ($template) {
16
+ $sms = Mage::getModel('pagueveloz_sms/sms');
17
+ $sms->setOrderId($order->getId())
18
+ ->setStatus(PagueVeloz_Sms_Model_Sms::SMS_NEW)
19
+ ->setTemplateId($template->getId())
20
+ ->save();
21
+ }
22
+ } catch (Exception $ex) {
23
+ Mage::getModel('pagueveloz_sms/sms')->log($ex->getMessage());
24
+ }
25
+
26
+ return $this;
27
+ }
28
+
29
+ }
app/code/community/PagueVeloz/Sms/Model/Sms.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Sms extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ const SMS_SENDED = 'enviado';
7
+ const SMS_RESEND = 'reenviar';
8
+ const SMS_NEW = 'novo';
9
+ const SMS_ERROR = 'erro';
10
+
11
+ public function _construct()
12
+ {
13
+ parent::_construct();
14
+ $this->_init('pagueveloz_sms/sms'); // this is location of the resource file.
15
+ }
16
+
17
+ public function getId()
18
+ {
19
+ return $this->getSmsId();
20
+ }
21
+
22
+ public function getTemplate()
23
+ {
24
+ return Mage::getModel('pagueveloz_sms/template')->load($this->getTemplateId());
25
+ }
26
+
27
+ public function getOrder()
28
+ {
29
+ return Mage::getModel('sales/order')->load($this->getOrderId());
30
+ }
31
+
32
+ public function log($msg)
33
+ {
34
+ return Mage::log($msg, null, 'pagueveloz_sms.log');
35
+ }
36
+
37
+ }
app/code/community/PagueVeloz/Sms/Model/Template.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Model_Template extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('pagueveloz_sms/template'); // this is location of the resource file.
10
+ }
11
+
12
+ public function loadByStatusCode($statusCode)
13
+ {
14
+ $collection = $this->getCollection();
15
+ $collection->addFieldToSelect('*')
16
+ ->addFieldToFilter('status_code', array('eq' => $statusCode))
17
+ ->getSelect()
18
+ ->limit(1);
19
+ $collection->load();
20
+
21
+ return $collection->getLastItem();
22
+ }
23
+
24
+ public function loadEnabledByStatusCode($statusCode)
25
+ {
26
+ $collection = $this->getCollection();
27
+ $collection->addFieldToSelect('*')
28
+ ->addFieldToFilter('status_code', array('eq' => $statusCode))
29
+ ->addFieldToFilter('enabled', array('eq' => 1))
30
+ ->getSelect()
31
+ ->limit(1);
32
+ $collection->load();
33
+
34
+ return $collection->getLastItem();
35
+ }
36
+
37
+ public function getId()
38
+ {
39
+ return $this->getSmsTemplateId();
40
+ }
41
+
42
+ public function getMessage()
43
+ {
44
+ return $this->getTemplate();
45
+ }
46
+
47
+ }
app/code/community/PagueVeloz/Sms/controllers/Adminhtml/SmsController.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PagueVeloz_Sms_Adminhtml_SmsController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function indexAction()
7
+ {
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ /*
13
+ * Retorno do result:
14
+ * object(stdClass)#282 (5) {
15
+ * ["Codigo"]=>
16
+ * string(36) "74f68154-011a-43c9-9190-0fa9a9c59add"
17
+ * ["Creditos"]=>
18
+ * int(780)
19
+ * ["Valor"]=>
20
+ * float(117)
21
+ * ["UrlBoleto"]=>
22
+ * string(77) "https://x.credinet.com.br/Boleto/01698616500000117000001001000738900000009801"
23
+ * ["Id"]=>
24
+ * int(58)
25
+ * }
26
+ *
27
+ */
28
+
29
+ public function comprarAction()
30
+ {
31
+ if ($this->getRequest()->getParam('isAjax')) {
32
+ $response = array('msg' => '', 'success' => false);
33
+
34
+ $payment_type = $this->getRequest()->getParam('payment_type');
35
+ $buy_type = $this->getRequest()->getParam('buy_type');
36
+ $value = $this->getRequest()->getParam('value');
37
+
38
+ if ($value) {
39
+ try {
40
+ $webservicePagueveloz = Mage::getModel('pagueveloz_api/webservice');
41
+ $result = $webservicePagueveloz->comprarCreditosSMS($payment_type, $buy_type, $value);
42
+ $response['success'] = true;
43
+ $response['urlBoleto'] = $result->UrlBoleto;
44
+ } catch (Exception $e) {
45
+ $response['msg'] = $e->getMessage();
46
+ }
47
+ } else {
48
+ $response['msg'] = 'Valor não informado.';
49
+ }
50
+
51
+ $this->getResponse()->setHeader('Content-type', 'application/json');
52
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
53
+ }
54
+ }
55
+
56
+ public function saveTemplatesAction()
57
+ {
58
+ if ($this->getRequest()->getParam('isAjax')) {
59
+ $response = array('msg' => '', 'success' => false);
60
+
61
+ try {
62
+ $templates = $this->getRequest()->getParam('templates');
63
+ foreach ($templates as $statusCode => $template) {
64
+ $smsTemplate = Mage::getModel('pagueveloz_sms/template')->loadByStatusCode($statusCode);
65
+ $smsTemplate->setTemplate($template['template'])
66
+ ->setEnabled($template['enabled'])
67
+ ->setStatusCode($statusCode)
68
+ ->save();
69
+ }
70
+ $response['success'] = true;
71
+ } catch (Exception $e) {
72
+ $response['msg'] = $e->getMessage();
73
+ }
74
+
75
+ $this->getResponse()->setHeader('Content-type', 'application/json');
76
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
77
+ }
78
+ }
79
+
80
+ public function smsListAction()
81
+ {
82
+ $limit = $this->_getLimit();
83
+
84
+ $smsCollection = Mage::getModel('pagueveloz_sms/sms')->getCollection()
85
+ ->setOrder('created_time')
86
+ ->addFieldToSelect('*')
87
+ ->setPageSize($limit);
88
+
89
+ if ($name = $this->_getName()) {
90
+ $smsCollection->addFieldToFilter('name', array('like' => "%" . $name . "%"));
91
+ }
92
+
93
+ $total = $smsCollection->getSize();
94
+ $total_pages = $total / $limit;
95
+ $total_pages = ceil($total_pages);
96
+
97
+ $smsCollection->setCurPage($this->_getPage()); // Set cur page after calculate total pages
98
+
99
+ foreach ($smsCollection as $sms) {
100
+ $smsList[$sms->getId()] = array(
101
+ 'id' => $sms->getId(),
102
+ 'result' => $sms->getResult(),
103
+ 'message' => $sms->getTemplate()->getMessage(),
104
+ 'order_id' => $sms->getOrderId(),
105
+ 'status' => $sms->getStatus(),
106
+ 'created_at' => $sms->getCreatedTime(),
107
+ );
108
+ }
109
+
110
+ $response = array('total_sms' => $total, 'total_pages' => $total_pages, 'smsList' => $smsList);
111
+ $this->getResponse()->setHeader('Content-type', 'application/json');
112
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
113
+ }
114
+
115
+ private function _getPage()
116
+ {
117
+ return $this->getRequest()->getParam('page', 1);
118
+ }
119
+
120
+ private function _getLimit()
121
+ {
122
+ return $this->getRequest()->getParam('limit', 10);
123
+ }
124
+
125
+ private function _getName()
126
+ {
127
+ return $this->getRequest()->getParam('name', '');
128
+ }
129
+
130
+ protected function _validateFormKey()
131
+ {
132
+ return true;
133
+ }
134
+
135
+ protected function _validateSecretKey()
136
+ {
137
+ return true;
138
+ }
139
+
140
+ }
app/code/community/PagueVeloz/Sms/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <pagueveloz translate="title" module="pagueveloz_sms">
5
+ <title>PagueVeloz</title>
6
+ <sort_order>1000</sort_order>
7
+ <children>
8
+ <sms>
9
+ <title>Sms</title>
10
+ <sort_order>1</sort_order>
11
+ <action>adminhtml/sms/index</action>
12
+ </sms>
13
+ </children>
14
+ </pagueveloz>
15
+ </menu>
16
+ <acl>
17
+ <resources>
18
+ <admin>
19
+ <children>
20
+ <pagueveloz translate="title" module="pagueveloz_sms">
21
+ <title>PagueVeloz SMS</title>
22
+ <sort_order>1</sort_order>
23
+ <children>
24
+ <all>
25
+ <title>All</title>
26
+ </all>
27
+ </children>
28
+ </pagueveloz>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/PagueVeloz/Sms/etc/config.xml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <PagueVeloz_Sms>
5
+ <version>1.0.1</version>
6
+ </PagueVeloz_Sms>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <pagueveloz_sms>
11
+ <class>PagueVeloz_Sms_Helper</class>
12
+ </pagueveloz_sms>
13
+ </helpers>
14
+ <blocks>
15
+ <pagueveloz_sms>
16
+ <class>PagueVeloz_Sms_Block</class>
17
+ </pagueveloz_sms>
18
+ </blocks>
19
+ <models>
20
+ <pagueveloz_sms>
21
+ <class>PagueVeloz_Sms_Model</class>
22
+ <resourceModel>pagueveloz_sms_mysql4</resourceModel>
23
+ </pagueveloz_sms>
24
+ <pagueveloz_sms_mysql4>
25
+ <class>PagueVeloz_Sms_Model_Mysql4</class>
26
+ <entities>
27
+ <sms>
28
+ <table>pagueveloz_sms</table>
29
+ </sms>
30
+ <template>
31
+ <table>pagueveloz_sms_template</table>
32
+ </template>
33
+ </entities>
34
+ </pagueveloz_sms_mysql4>
35
+ </models>
36
+ <resources>
37
+ <pagueveloz_sms_setup>
38
+ <setup>
39
+ <module>PagueVeloz_Sms</module>
40
+ </setup>
41
+ <connection>
42
+ <use>core_setup</use>
43
+ </connection>
44
+ </pagueveloz_sms_setup>
45
+ <pagueveloz_sms_write>
46
+ <connection>
47
+ <use>core_write</use>
48
+ </connection>
49
+ </pagueveloz_sms_write>
50
+ <pagueveloz_sms_read>
51
+ <connection>
52
+ <use>core_read</use>
53
+ </connection>
54
+ </pagueveloz_sms_read>
55
+ </resources>
56
+ <events>
57
+ <sales_order_save_after>
58
+ <observers>
59
+ <pagueveloz_sms>
60
+ <type>singleton</type>
61
+ <class>pagueveloz_sms/observer</class>
62
+ <method>after_save_order</method>
63
+ </pagueveloz_sms>
64
+ </observers>
65
+ </sales_order_save_after>
66
+ </events>
67
+ </global>
68
+ <crontab>
69
+ <jobs>
70
+ <pagueveloz_sms_send>
71
+ <schedule>
72
+ <cron_expr>* * * * *</cron_expr>
73
+ </schedule>
74
+ <run>
75
+ <model>pagueveloz_sms/cron::sendSMS</model>
76
+ </run>
77
+ </pagueveloz_sms_send>
78
+ </jobs>
79
+ </crontab>
80
+ <frontend>
81
+ <layout>
82
+ <updates>
83
+ <pagueveloz_sms>
84
+ <file>pagueveloz_sms.xml</file>
85
+ </pagueveloz_sms>
86
+ </updates>
87
+ </layout>
88
+ </frontend>
89
+ <admin>
90
+ <routers>
91
+ <adminhtml>
92
+ <args>
93
+ <modules>
94
+ <PagueVeloz_Sms before="Mage_Adminhtml">PagueVeloz_Sms_Adminhtml</PagueVeloz_Sms>
95
+ </modules>
96
+ </args>
97
+ </adminhtml>
98
+ </routers>
99
+ </admin>
100
+ <adminhtml>
101
+ <layout>
102
+ <updates>
103
+ <pagueveloz_sms>
104
+ <file>pagueveloz_sms.xml</file>
105
+ </pagueveloz_sms>
106
+ </updates>
107
+ </layout>
108
+ </adminhtml>
109
+ </config>
app/code/community/PagueVeloz/Sms/etc/system.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <pagueveloz translate="label">
5
+ <tab>pagueveloz</tab>
6
+ <frontend_type>text</frontend_type>
7
+ <groups>
8
+ <sms translate="label">
9
+ <label>Sms</label>
10
+ <sort_order>800</sort_order>
11
+ <show_in_default>1</show_in_default>
12
+ <show_in_website>1</show_in_website>
13
+ <show_in_store>0</show_in_store>
14
+ <fields>
15
+ <active translate="label">
16
+ <label>Habilitado</label>
17
+ <frontend_type>select</frontend_type>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <sort_order>1</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>0</show_in_store>
23
+ </active>
24
+ <telephone>
25
+ <label>Telefone Remetente</label>
26
+ <frontend_type>text</frontend_type>
27
+ <sort_order>100</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>0</show_in_store>
31
+ <comment>
32
+ formato: (xx) xxxx-xxxx
33
+ </comment>
34
+ </telephone>
35
+ </fields>
36
+ </sms>
37
+ </groups>
38
+ </pagueveloz>
39
+ </sections>
40
+ </config>
app/code/community/PagueVeloz/Sms/sql/pagueveloz_sms_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // here are the table creation for this module e.g.:
4
+ $this->startSetup();
5
+ $this->run("
6
+ -- DROP TABLE IF EXISTS {$this->getTable('pagueveloz_sms_template')};
7
+ CREATE TABLE {$this->getTable('pagueveloz_sms_template')} (
8
+ `sms_template_id` int(11) unsigned NOT NULL auto_increment,
9
+ `template` TEXT NOT NULL,
10
+ `enabled` int(1) default 0,
11
+ `status_code` VARCHAR(250) NOT NULL,
12
+ `created_time` TIMESTAMP default CURRENT_TIMESTAMP,
13
+ `updated_time` datetime NULL,
14
+ PRIMARY KEY (`sms_template_id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+ ");
17
+ $this->endSetup();
app/code/community/PagueVeloz/Sms/sql/pagueveloz_sms_setup/mysql4-upgrade-1.0.0-1.0.1.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // here are the table creation for this module e.g.:
4
+ $this->startSetup();
5
+ $this->run("
6
+ -- DROP TABLE IF EXISTS {$this->getTable('pagueveloz_sms')};
7
+ CREATE TABLE {$this->getTable('pagueveloz_sms')} (
8
+ `sms_id` int(11) unsigned NOT NULL auto_increment,
9
+ `order_id` int(11) NOT NULL,
10
+ `result` TEXT NULL,
11
+ `template_id` int(11) unsigned NOT NULL,
12
+ `status` varchar(20) NOT NULL default 'novo',
13
+ `created_time` TIMESTAMP default CURRENT_TIMESTAMP,
14
+ `updated_time` datetime NULL,
15
+ CONSTRAINT `FK__pagueveloz_sms_template` FOREIGN KEY (`template_id`) REFERENCES {$this->getTable('pagueveloz_sms_template')} (`sms_template_id`),
16
+ PRIMARY KEY (`sms_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
+ ");
19
+ $this->endSetup();
app/design/adminhtml/default/default/layout/pagueveloz_boleto.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout>
2
+ <default>
3
+ <reference name="js">
4
+ <!-- Utilizado na configuracao do modulo para assinar pagueveloz -->
5
+ <block type="core/template" template="pagueveloz/js.phtml" name="pagueveloz_js"></block>
6
+ </reference>
7
+ <reference name="head">
8
+ <action method="addJs">
9
+ <script>prototype/window.js</script>
10
+ </action>
11
+ <action method="addItem">
12
+ <type>js_css</type>
13
+ <name>prototype/windows/themes/default.css</name>
14
+ </action>
15
+ <action method="addItem">
16
+ <type>js_css</type>
17
+ <name>prototype/windows/themes/alphacube.css</name>
18
+ </action>
19
+ </reference>
20
+ </default>
21
+ <adminhtml_sales_order_view>
22
+ <reference name="sales_order_tabs">
23
+ <action method="addTab">
24
+ <name>pagueveloz_boleto</name>
25
+ <block>pagueveloz_boleto/adminhtml_sales_order_view_tab_boleto</block>
26
+ </action>
27
+ </reference>
28
+ </adminhtml_sales_order_view>
29
+ <adminhtml_boleto_index>
30
+ <reference name="menu">
31
+ <action method="setActive">
32
+ <menupath>pagueveloz/boleto</menupath>
33
+ </action>
34
+ </reference>
35
+ <reference name="content">
36
+ <block type="pagueveloz_boleto/adminhtml_content" name="pagueveloz_boleto_content" template="pagueveloz_boleto/content.phtml"></block>
37
+ </reference>
38
+ <reference name="js">
39
+ <block type="pagueveloz_boleto/adminhtml_js" template="pagueveloz_boleto/js.phtml" name="pagueveloz_boleto_js"></block>
40
+ </reference>
41
+ </adminhtml_boleto_index>
42
+ </layout>
app/design/adminhtml/default/default/layout/pagueveloz_sms.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <adminhtml_sms_index>
4
+ <reference name="menu">
5
+ <action method="setActive"><menupath>pagueveloz/sms</menupath></action>
6
+ </reference>
7
+ <reference name="content">
8
+ <block type="pagueveloz_sms/adminhtml_content" name="pagueveloz_sms_content" template="pagueveloz_sms/content.phtml"></block>
9
+ </reference>
10
+ <reference name="js">
11
+ <block type="pagueveloz_sms/adminhtml_js" template="pagueveloz_sms/js.phtml" name="pagueveloz_sms_js"></block>
12
+ </reference>
13
+ </adminhtml_sms_index>
14
+ </layout>
app/design/adminhtml/default/default/template/pagueveloz/boleto.phtml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ boleto = {
3
+ verificar: function(boleto_id) {
4
+ new Ajax.Request('<?php echo Mage::getUrl('adminhtml/boleto/verificar') ?>', {
5
+ method: 'post',
6
+ parameters: {
7
+ boleto_id: boleto_id,
8
+ },
9
+ onSuccess: function(response) {
10
+ var dados = response.responseText.evalJSON();
11
+ if (!dados.success) {
12
+ alert(dados.msg);
13
+ } else {
14
+ $('boleto-status').innerHTML = dados.pagamento.Status;
15
+ $('valor-pago').innerHTML = dados.pagamento.Valor;
16
+ }
17
+ },
18
+ onFailure: function() {
19
+ alert('Não foi possível completar a operação, tente novamente...');
20
+ }
21
+ });
22
+ },
23
+ regerar: function(boleto_id) {
24
+ new Ajax.Request('<?php echo Mage::getUrl('adminhtml/boleto/regerar') ?>', {
25
+ method: 'post',
26
+ parameters: {
27
+ boleto_id: boleto_id,
28
+ order_id: <?php echo $this->getRequest()->getParam('order_id') ?>
29
+ },
30
+ onSuccess: function(response) {
31
+ var dados = response.responseText.evalJSON();
32
+ if (!dados.success) {
33
+ alert(dados.msg);
34
+ } else {
35
+ $('url-boleto').innerHTML = dados.url;
36
+ }
37
+ },
38
+ onFailure: function() {
39
+ alert('Não foi possível completar a operação, tente novamente...');
40
+ }
41
+ });
42
+ }
43
+ };
44
+ </script>
45
+ <div style="" id="sales_order_view_tabs_order_history_content"><div class="entry-edit">
46
+ <fieldset>
47
+ <ul>
48
+ <?php $boleto = $this->getBoleto(); ?>
49
+ <li>
50
+ <strong>Vencimento: </strong><?php $date = new DateTime($boleto->getDataVencimento());
51
+ echo $date->format('d/m/Y'); ?>
52
+ </li>
53
+ <li>
54
+ <strong>Url: </strong><span id="url-boleto"><?php echo $boleto->getUrl() ?></span>
55
+ <button id="bt-regerar" title="Verificar" type="button" class="scalable add" onclick="boleto.regerar(<?php echo $boleto->getId() ?>)" style="">
56
+ <span><span><span>Regerar Boleto</span></span></span>
57
+ </button>
58
+ </li>
59
+ <li>
60
+ <strong>Valor: </strong><?php echo Mage::helper('core')->currency($boleto->getValor(), true, false) ?>
61
+ </li>
62
+ <li>
63
+ <strong>Status: </strong><span id="boleto-status"><?php echo ($boleto->getStatus()) ? $boleto->getStatus() : "Não Pago" ?></span>
64
+ </li>
65
+ <li>
66
+ <?php $valorPago = ($boleto->getValorPago()) ? $boleto->getValorPago() : 0; ?>
67
+ <strong>Valor Pago: </strong><span id="valor-pago"><?php echo Mage::helper('core')->currency($valorPago, true, false) ?></span>
68
+ </li>
69
+ <li>
70
+ <strong>Verificado automaticamente em: </strong><?php
71
+ $date = new DateTime($boleto->getUpdatedTime());
72
+ echo ($boleto->getUpdatedTime()) ? $date->format('d/m/Y') : "Não Verificado" ?>
73
+ </li>
74
+ <?php if (!$boleto->getStatus()): ?>
75
+ <li>
76
+ <button id="bt-verificar" title="Verificar" type="button" class="scalable add" onclick="boleto.verificar(<?php echo $boleto->getId() ?>)" style="">
77
+ <span><span><span>Verificar Pagamento</span></span></span>
78
+ </button>
79
+ </li>
80
+ <?php endif; ?>
81
+ </ul>
82
+ </fieldset>
83
+ </div>
app/design/adminhtml/default/default/template/pagueveloz/js.phtml ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ pagueveloz = {
3
+ cadastrar: function() {
4
+ win = new Window({className: "alphacube", title: "", width: 510, height: 430, destroyOnClose: true, recenterAuto: false});
5
+
6
+ var cadastrarWindow = "<h1>Informe os campos para se cadastrar</h1>";
7
+ cadastrarWindow += '<table cellspacing="0" class="form-list">';
8
+ cadastrarWindow += '<colgroup class="label"></colgroup>';
9
+ cadastrarWindow += '<colgroup class="value"></colgroup>';
10
+ cadastrarWindow += '<tbody>';
11
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
12
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Produção</label></td>';
13
+ cadastrarWindow += '<td class="value">';
14
+ cadastrarWindow += '<select name="production" id="production">';
15
+ cadastrarWindow += '<option value="1">Sim</option>';
16
+ cadastrarWindow += '<option value="0">Não</option>';
17
+ cadastrarWindow += '</select>';
18
+ cadastrarWindow += '</td>';
19
+ cadastrarWindow += "</tr>";
20
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
21
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Nome</label></td>';
22
+ cadastrarWindow += '<td class="value">';
23
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="name" id="name">';
24
+ cadastrarWindow += '<p class="note"><span>Sem Acentuação, ex: Joao da Silva</span></p>';
25
+ cadastrarWindow += '</td>';
26
+ cadastrarWindow += "</tr>";
27
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
28
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Tipo Pessoa</label></td>';
29
+ cadastrarWindow += '<td class="value">';
30
+ cadastrarWindow += '<select name="type_person" id="type_person">';
31
+ cadastrarWindow += '<option value="0">Selecione</option>';
32
+ cadastrarWindow += '<option value="1">Pessoa Física</option>';
33
+ cadastrarWindow += '<option value="2">Pessoa Jurídica</option>';
34
+ cadastrarWindow += '</select>';
35
+ cadastrarWindow += '</td>';
36
+ cadastrarWindow += "</tr>";
37
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
38
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">CPF/CNPJ</label></td>';
39
+ cadastrarWindow += '<td class="value">';
40
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="document" id="document">';
41
+ cadastrarWindow += '</td>';
42
+ cadastrarWindow += "</tr>";
43
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
44
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Email</label></td>';
45
+ cadastrarWindow += '<td class="value">';
46
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="email" id="email">';
47
+ cadastrarWindow += '<p class="note"><span>Email de notificações</span></p>';
48
+ cadastrarWindow += '</td>';
49
+ cadastrarWindow += "</tr>";
50
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
51
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Email de Login</label></td>';
52
+ cadastrarWindow += '<td class="value">';
53
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="login_default" id="login_default">';
54
+ cadastrarWindow += '<p class="note"><span>Email para login no pagueveloz</span></p>';
55
+ cadastrarWindow += '</td>';
56
+ cadastrarWindow += "</tr>";
57
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
58
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Cidade</label></td>';
59
+ cadastrarWindow += '<td class="value">';
60
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="city" id="city">';
61
+ cadastrarWindow += '</td>';
62
+ cadastrarWindow += "</tr>";
63
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
64
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Estado</label></td>';
65
+ cadastrarWindow += '<td class="value">';
66
+ cadastrarWindow += '<select name="state" id="state">';
67
+ <?php
68
+ $estados = new PagueVeloz_Api_Model_Source_States();
69
+ $estados = $estados->toOptionArray();
70
+ ?>
71
+ cadastrarWindow += '<option value="">Selecione...</option>';
72
+ <?php foreach ($estados as $sigla => $name): ?>
73
+ cadastrarWindow += '<option value="<?php echo $sigla; ?>"><?php echo $name ?></option>';
74
+ <?php endforeach; ?>
75
+ cadastrarWindow += '</select>';
76
+ cadastrarWindow += '</td>';
77
+ cadastrarWindow += "</tr>";
78
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
79
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Rua</label></td>';
80
+ cadastrarWindow += '<td class="value">';
81
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="street" id="street">';
82
+ cadastrarWindow += '</td>';
83
+ cadastrarWindow += "</tr>";
84
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
85
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Numero</label></td>';
86
+ cadastrarWindow += '<td class="value">';
87
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="number" id="number">';
88
+ cadastrarWindow += '</td>';
89
+ cadastrarWindow += "</tr>";
90
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
91
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token">Cep</label></td>';
92
+ cadastrarWindow += '<td class="value">';
93
+ cadastrarWindow += '<input type="text" class=" input-text" value="" name="cep" id="cep">';
94
+ cadastrarWindow += '</td>';
95
+ cadastrarWindow += "</tr>";
96
+ cadastrarWindow += '<tr id="row_pagueveloz_pagueveloz_configuration_token">';
97
+ cadastrarWindow += '<td class="label"><label for="pagueveloz_pagueveloz_configuration_token"></label></td>';
98
+ cadastrarWindow += '<td class="value">';
99
+ cadastrarWindow += '<button style="" onclick="pagueveloz.submit()" class="scalable save" type="button" title="Salvar Configuração" id="id_78">';
100
+ cadastrarWindow += '<span><span><span>Salvar</span></span></span>';
101
+ cadastrarWindow += '</button>';
102
+ cadastrarWindow += '</td>';
103
+ cadastrarWindow += "</tr>";
104
+ cadastrarWindow += "</tbody>";
105
+ cadastrarWindow += "</table>";
106
+
107
+ win.getContent().update(cadastrarWindow);
108
+ win.showCenter();
109
+ },
110
+ submit: function() {
111
+ new Ajax.Request('<?php echo Mage::getUrl('adminhtml/pagueveloz/assinar') ?>', {
112
+ method: 'post',
113
+ parameters: {
114
+ isProduction: $('production').value,
115
+ Cidade: $('city').value,
116
+ Estado: $('state').value,
117
+ Logradouro: $('street').value,
118
+ Numero: $('number').value,
119
+ Nome: $('name').value,
120
+ CEP: $('cep').value,
121
+ Documento: $('document').value,
122
+ TipoPessoa: $('type_person').value,
123
+ Email: $('email').value,
124
+ LoginUsuarioDefault: $('login_default').value
125
+ },
126
+ onSuccess: function(response) {
127
+ var dados = response.responseText.evalJSON();
128
+ if (dados.success) {
129
+ $('pagueveloz_pagueveloz_configuration_token').value = dados.result.Token;
130
+ $('pagueveloz_pagueveloz_configuration_email').value = $('email').value;
131
+ $('pagueveloz_pagueveloz_configuration_production').value = $('production').value;
132
+
133
+ alert("Sua senha gerada: " + dados.result.Senha);
134
+ } else {
135
+ if (dados.result) {
136
+ msg = "";
137
+ for (var prop in dados.result) {
138
+ if (dados.result.hasOwnProperty(prop))
139
+ msg += "- " + dados.result[prop] + "\n";
140
+ }
141
+ alert(msg);
142
+ }
143
+ else {
144
+ alert(dados.msg);
145
+ }
146
+ }
147
+ },
148
+ onFailure: function() {
149
+ alert('Não foi possível completar a operação, tente novamente...');
150
+ }
151
+ });
152
+ }
153
+ };
154
+ </script>
app/design/adminhtml/default/default/template/pagueveloz_boleto/content.phtml ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="page:main-container">
2
+ <div id="messages">
3
+ </div>
4
+ <div class="content-header">
5
+ <table cellspacing="0">
6
+ <tbody>
7
+ <tr>
8
+ <td style="width:50%;">
9
+ <h3 class="">Contas</h3>
10
+ </td>
11
+ </tr>
12
+ </tbody>
13
+ </table>
14
+ </div>
15
+ <div id="" style="">
16
+ <div class="entry-edit">
17
+ <div class="entry-edit-head">
18
+ <h4 class="icon-head head-edit-form fieldset-legend">Agendar contas a pagar</h4>
19
+ </div>
20
+ <div id="group_fields7" class="fieldset fieldset-wide">
21
+ <div class="hor-scroll">
22
+ <form action="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/conta/cadastrar') ?>" method="post" enctype="multipart/form-data">
23
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
24
+ <table cellspacing="0" class="form-list">
25
+ <tbody>
26
+ <tr>
27
+ <td class="label"><label for="name">Boleto <span class="required">*</span></label></td>
28
+ <td class="value">
29
+ <input type="file" class="required-entry input-text required-entry" name="titulo_arquivo" id="titulo_arquivo">
30
+ </td>
31
+ <td class="scope-label"><span class="nobr"></span></td>
32
+ </tr>
33
+ <tr>
34
+ <td class="label"><label for="name">Vencimento </label></td>
35
+ <td class="value">
36
+ <input style="width:110px !important;" type="text" class="required-entry input-text required-entry" value="" name="vencimento" id="vencimento"><img id="vencimento_button" class="arrow" alt="Go to Previous page" src="<?php echo $this->getSkinUrl('images/grid-cal.gif') ?>">
37
+ </td>
38
+ <td class="scope-label"><span class="nobr"></span></td>
39
+ </tr>
40
+ <tr>
41
+ <td class="label"><label for="name">Valor </label></td>
42
+ <td class="value">
43
+ <input style="width:110px !important;" type="text" class=" required-entry input-text required-entry" value="" name="valor" id="valor">
44
+ </td>
45
+ <td class="scope-label"><span class="nobr"></span></td>
46
+ </tr>
47
+ <tr>
48
+ <td class="label"><label for="name">Código de Barras </label></td>
49
+ <td class="value">
50
+ <input type="text" class=" required-entry input-text required-entry" value="" name="codigo_de_barras" id="codigo_de_barras">
51
+ </td>
52
+ <td class="scope-label"><span class="nobr"></span></td>
53
+ </tr>
54
+ <tr>
55
+ <td style="" class="a-right">
56
+ <button style="" class="scalable add" type="submit" title="Cadastrar Conta" id="id_testes">
57
+ <span><span><span>Cadastrar Conta</span></span></span>
58
+ </button>
59
+ </td>
60
+ </tr>
61
+ </tbody>
62
+ </table>
63
+ </form>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ <?php
69
+ /*
70
+ <div class="content-header">
71
+ <table cellspacing="0">
72
+ <tbody>
73
+ <tr>
74
+ <td style="width:50%;">
75
+ <h3 class="">Boletos</h3>
76
+ </td>
77
+ </tr>
78
+ </tbody>
79
+ </table>
80
+ </div>
81
+ <div>
82
+ <div id="productGrid">
83
+ <table cellspacing="0" class="actions">
84
+ <tbody>
85
+ <tr>
86
+ <td class="pager">Página<img class="arrow" alt="Go to Previous page" src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>">
87
+ <form action="ebook.formLoad($('page').value)">
88
+ <input type="text" class="input-text page" id="page" value="1">
89
+ </form>
90
+ <img class="arrow" alt="Go to Previous page" src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>">
91
+ de <span id='total_pages'>0</span> páginas<span class="separator">|</span>
92
+ Ver
93
+ <select onchange="javascript:ebook.formLoad($('page').value)" name="limit" id='limit'>
94
+ <option selected="selected" value="20">20</option>
95
+ <option value="30">30</option>
96
+ <option value="50">50</option>
97
+ <option value="100">100</option>
98
+ <option value="200">200</option>
99
+ </select>
100
+ por página<span class="separator">|</span>
101
+ Total de <span id='total_produtos'>0</span> registros encontrados
102
+ </td>
103
+ <td class="filter-actions a-right">
104
+ <button style="" onclick="ebook.resetFilter()" class="scalable " type="button" title="Reiniciar Filtro" id="id_1615dbc01a31f3c21ca83893f7519628">
105
+ <span>
106
+ <span>
107
+ <span>Reiniciar Filtro</span>
108
+ </span>
109
+ </span>
110
+ </button>
111
+ <button style="" onclick="ebook.doFilter()" class="scalable task" type="button" title="Pesquisa" id="id_901291ee967136c40f7caf2c00aefb06">
112
+ <span>
113
+ <span>
114
+ <span>Pesquisa</span>
115
+ </span>
116
+ </span>
117
+ </button>
118
+ </td>
119
+ </tr>
120
+ </tbody>
121
+ </table>
122
+ <div id="productGrid_massaction">
123
+ <table cellspacing="0" cellpadding="0" class="massaction">
124
+ <tbody>
125
+ <tr>
126
+ <td>
127
+ <a onclick="return ebook.selectAll()" href="#">Selecionar Tudo</a>
128
+ <span class="separator">|</span>
129
+ <a onclick="return ebook.unselectAll()" href="#">Desselecionar Todos</a>
130
+ <span class="separator">|</span>
131
+ <strong id="ebookSelected-count">0</strong> itens selecionados
132
+ </td>
133
+ </tr>
134
+ </tbody>
135
+ </table>
136
+ </div>
137
+ <div class="grid">
138
+ <div class="hor-scroll">
139
+ <table cellspacing="0" id="productGrid_table" class="data">
140
+ <colgroup>
141
+ <col width="20" class="a-center">
142
+ <col width="50">
143
+ <col width="500">
144
+ <col width="200">
145
+ <col width="50">
146
+ </colgroup>
147
+ <thead>
148
+ <tr class="headings">
149
+ <th>
150
+ <span class="nobr">&nbsp;</span>
151
+ </th>
152
+ <th>
153
+ <span class="nobr"><span class="sort-title">Imagem</span></span>
154
+ </th>
155
+ <th>
156
+ <span class="nobr"><a class="not-sort" title="asc" name="name" href="#"><span class="sort-title">Nome</span></a></span>
157
+ </th>
158
+ <th>
159
+ <span class="nobr"><a class="not-sort" title="asc" name="price" href="#"><span class="sort-title">SKU</span></a></span>
160
+ </th>
161
+ <th>
162
+ <span class="nobr"><a class="not-sort" title="asc" name="price" href="#"><span class="sort-title">Preço</span></a></span>
163
+ </th>
164
+ </tr>
165
+ <tr class="filter">
166
+ <th>
167
+ </th>
168
+ <th>
169
+ </th>
170
+ <th>
171
+ <div class="field-100">
172
+ <form action="javascript:ebook.formLoad($('page').value)">
173
+ <input type="text" class="input-text no-changes" value="" id="name_filter" name="name_filter">
174
+ </form>
175
+ </div>
176
+ </th>
177
+ <th>
178
+ <div class="field-100">
179
+ <form action="javascript:ebook.formLoad($('page').value)">
180
+ <input type="text" class="input-text no-changes" value="" id="sku_filter" name="sku_filter">
181
+ </form>
182
+ </div>
183
+ </th>
184
+ <th>
185
+ <div class="range">
186
+ <form action="javascript:ebook.formLoad($('page').value)">
187
+ <div class="range-line">
188
+ <span class="label">De:</span>
189
+ <input type="text" class="input-text no-changes" value="" id="priceFrom_filter" name="price[from]">
190
+ </div>
191
+ <div class="range-line">
192
+ <span class="label">Para : </span>
193
+ <input type="text" class="input-text no-changes" value="" id="priceTo_filter" name="price[to]">
194
+ </div>
195
+ </form>
196
+ </div>
197
+ </th>
198
+ </tr>
199
+ </thead>
200
+ <tbody id="ebook_container">
201
+ <!-- All products rows are added here -->
202
+ </tbody>
203
+ </table>
204
+ </div>
205
+ </div>
206
+ <table cellspacing="0" class="hor-scroll">
207
+ <tbody>
208
+ <tr>
209
+ <td class="a-right" style="padding: 10px !important">
210
+ <button id="id_5a1bd68f1d36ca85b36800d2b570033b" title="Adicionar Produtos" type="button" class="scalable add" onclick="ebook.addSelectedEbooks()" style=""><span><span><span>Adicionar Produtos</span></span></span>
211
+ </button>
212
+ </td>
213
+ </tr>
214
+ </tbody>
215
+ </table>
216
+ </div>
217
+ </div>
218
+ */
219
+ ?>
220
+ </div>
221
+
app/design/adminhtml/default/default/template/pagueveloz_boleto/js.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ conta = {
3
+ cadastrar: function(titulo, nome_titulo, vencimento, valor, codigo_barras) {
4
+ new Ajax.Request('<?php echo Mage::getUrl('adminhtml/conta/cadastrar') ?>', {
5
+ method: 'post',
6
+ parameters: {
7
+ titulo: titulo,
8
+ nome_titulo: nome_titulo,
9
+ vencimento: vencimento,
10
+ valor: valor,
11
+ codigo_barras: codigo_barras
12
+ },
13
+ onSuccess: function(response) {
14
+ var dados = response.responseText.evalJSON();
15
+ if (dados.success) {
16
+ alert(dados.result.Message);
17
+ } else {
18
+ if (dados.error) {
19
+ for(var prop in dados.error) {
20
+ if(dados.error.hasOwnProperty(prop))
21
+ alert(dados.error[prop]);
22
+ }
23
+ }
24
+ else {
25
+ alert(dados.msg);
26
+ }
27
+ }
28
+ },
29
+ onFailure: function() {
30
+ alert('Não foi possível completar a operação, tente novamente...');
31
+ }
32
+ });
33
+ }
34
+ };
35
+
36
+ Calendar.setup({
37
+ inputField : 'vencimento',
38
+ ifFormat : '%Y-%m-%e',
39
+ button : 'vencimento_button',
40
+ align : 'Bl',
41
+ singleClick : true
42
+ });
43
+ </script>
app/design/adminhtml/default/default/template/pagueveloz_sms/content.phtml ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="page:main-container">
2
+ <div id="messages">
3
+ </div>
4
+ <div style="">
5
+ <div style="margin-left: 50%; position: absolute; width: 47%;">
6
+ <div class="content-header">
7
+ <table cellspacing="0">
8
+ <tbody>
9
+ <tr>
10
+ <td style="width:50%;">
11
+ <h3 style="width: 98%;" class="">Planos e preços <div style="float: right">Saldo: <span style=""><?php echo $this->getSaldo() //Mage::helper('core')->currency($price, true, false); ?> Crédito</span></div></h3>
12
+ </td>
13
+ </tr>
14
+ </tbody>
15
+ </table>
16
+ </div>
17
+ <div>
18
+ <?php
19
+ $pacotesSms = $this->getPacotesSms();
20
+ if (!empty($pacotesSms)) : ?>
21
+ <div id="productGrid">
22
+ <div class="grid">
23
+ <div class="hor-scroll">
24
+ <table cellspacing="0" id="productGrid_table" class="data">
25
+ <colgroup>
26
+ <col width="250">
27
+ <col width="100">
28
+ <col width="150">
29
+ <col width="250" class="a-center">
30
+ <col width="100" class="a-center">
31
+ </colgroup>
32
+ <thead>
33
+ <tr class="headings">
34
+ <th>
35
+ <span class="nobr"><span class="sort-title">Plano</span></span>
36
+ </th>
37
+ <th>
38
+ <span class="nobr"><span class="sort-title">Apartir de</span></span>
39
+ </th>
40
+ <th>
41
+ <span class="nobr"><span class="sort-title">Valor</span></span>
42
+ </th>
43
+ <th>
44
+ <span class="nobr"><span class="sort-title">Valor Total Pacote</span></span>
45
+ </th>
46
+ <th>
47
+ <span class="nobr"><span class="sort-title"></span></span>
48
+ </th>
49
+ </tr>
50
+ </thead>
51
+ <tbody id="sms_gerar_container">
52
+ <?php
53
+ foreach ($pacotesSms as $pacote):
54
+ ?>
55
+ <tr class='even pointer'>
56
+ <td><?php echo $pacote->Nome ?></td>
57
+ <td><?php echo $pacote->QuantidadeDeCreditos ?> SMS</td>
58
+ <td class='a-center'><?php echo Mage::helper('core')->currency($pacote->ValorDoCredito, true, false) ?> por SMS</td>
59
+ <td class='a-center'>
60
+ <?php echo $pacote->QuantidadeDeCreditos ?> SMS por <?php echo Mage::helper('core')->currency($pacote->ValorDoPacote, true, false) ?>
61
+ </td>
62
+ <td class='a-center'>
63
+ <button id="" title="Comprar" type="button" class="scalable add" onclick="smsComprar.comprarPacote(
64
+ 0,
65
+ 0,
66
+ <?php echo $pacote->QuantidadeDeCreditos ?>
67
+ )" style="">
68
+ <span><span><span>Comprar</span></span></span>
69
+ </button>
70
+ </td>
71
+ </tr>
72
+ <?php endforeach; ?>
73
+ </tbody>
74
+ </table>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ <?php
79
+ endif;
80
+ ?>
81
+ </div>
82
+ <div id="boleto_compra_sms"></div>
83
+ <div class="content-header">
84
+ <table cellspacing="0">
85
+ <tbody>
86
+ <tr>
87
+ <td style="width:50%;">
88
+ <h3 class="">Compra de créditos Avulso</h3>
89
+ </td>
90
+ </tr>
91
+ </tbody>
92
+ </table>
93
+ </div>
94
+ <div id="productGrid">
95
+ <div class="grid">
96
+ <div class="hor-scroll">
97
+ <table cellspacing="0" id="productGrid_table" class="data">
98
+ <colgroup>
99
+ <col width="250">
100
+ <col width="100">
101
+ <col width="150">
102
+ <col width="250" class="a-center">
103
+ </colgroup>
104
+ <thead>
105
+ <tr class="headings">
106
+ <th>
107
+ <span class="nobr"><span class="sort-title">Pagar com</span></span>
108
+ </th>
109
+ <th>
110
+ <span class="nobr"><span class="sort-title">Selecione</span></span>
111
+ </th>
112
+ <th>
113
+ <span class="nobr"><span class="sort-title">Qtd/Valor</span></span>
114
+ </th>
115
+ <th>
116
+ </th>
117
+ </tr>
118
+ </thead>
119
+ <tbody id="sms_gerar_container">
120
+ <tr class='even pointer'>
121
+ <td>
122
+ <select id="payment_type" name="payment_type">
123
+ <option value="<?php echo PagueVeloz_Api_Model_Webservice_ComprarCreditosSMS::PAGAMENTO_POR_BOLETO ?>">Boleto</option>
124
+ <option value="<?php echo PagueVeloz_Api_Model_Webservice_ComprarCreditosSMS::PAGAMENTO_POR_DEPOSITO ?>">Depósito</option>
125
+ </select>
126
+ </td>
127
+ <td>
128
+ <select id="buy_type" name="buy_type">
129
+ <option value="<?php echo PagueVeloz_Api_Model_Webservice_ComprarCreditosSMS::COMPRA_POR_CREDITO ?>">Créditos (SMS)</option>
130
+ <option value="<?php echo PagueVeloz_Api_Model_Webservice_ComprarCreditosSMS::COMPRA_POR_VALOR ?>">Valor (R$)</option>
131
+ </select>
132
+ </td>
133
+ <td class='a-center'>
134
+ <input id="buy_sms_value" name="buy_sms_value" />
135
+ </td>
136
+ <td class='a-center'>
137
+ <button id="" title="Comprar" type="button" class="scalable add" onclick="smsComprar.comprarAvulso(
138
+ $('payment_type').value,
139
+ $('buy_type').value,
140
+ $('buy_sms_value').value
141
+ )" style="">
142
+ <span><span><span>Comprar</span></span></span>
143
+ </button>
144
+ </td>
145
+ </tr>
146
+ </tbody>
147
+ </table>
148
+ </div>
149
+ </div>
150
+ </div>
151
+ <div id="boleto_compra_sms_avulso"></div>
152
+ </div>
153
+ <div style="position: unset; width: 49%;">
154
+ <div class="content-header">
155
+ <table cellspacing="0">
156
+ <tbody>
157
+ <tr>
158
+ <td style="width:50%;">
159
+ <h3 style="width: 98%;" class="">Templates SMS</h3>
160
+ </td>
161
+ </tr>
162
+ </tbody>
163
+ </table>
164
+ </div>
165
+ <div id="productGrid">
166
+ <form id="form_templates" action="<?php echo Mage::getUrl('adminhtml/sms/saveTemplates') ?>" method="POST">
167
+ <div class="grid">
168
+ <div class="hor-scroll">
169
+ <table cellspacing="0" id="productGrid_table" class="data">
170
+ <colgroup>
171
+ <col width="20" class="a-center">
172
+ <col width="150">
173
+ <col width="500">
174
+ </colgroup>
175
+ <thead>
176
+ <tr class="headings">
177
+ <th>
178
+ <span class="nobr"><span class="sort-title">Ativo</span></span>
179
+ </th>
180
+ <th>
181
+ <span class="nobr"><span class="sort-title">Enviar SMS para Status</span></span>
182
+ </th>
183
+ <th>
184
+ <span class="nobr"><span class="sort-title">Mensagem</span></span>
185
+ </th>
186
+ </tr>
187
+ </thead>
188
+ <tbody id="sms_template_container">
189
+ <?php
190
+ $statuses = $this->getStatuses();
191
+ foreach ($statuses as $status): ?>
192
+ <?php $template = $this->getTemplateByStatus($status->getStatus()); ?>
193
+ <tr class='even pointer'>
194
+ <td class='a-center'>
195
+ <select name="templates[<?php echo $status->getStatus(); ?>][enabled]">
196
+ <option value="0" <?php if(!$template->getEnabled()): ?>selected<?php endif; ?> >Não</option>
197
+ <option value="1" <?php if($template->getEnabled()): ?>selected<?php endif; ?>>Sim</option>
198
+ </select>
199
+ </td>
200
+ <td class=''><?php echo $status->getLabel() ?></td>
201
+ <td class=''>
202
+ <textarea style="height: 15px" name="templates[<?php echo $status->getStatus(); ?>][template]"><?php echo $template->getTemplate() ?></textarea>
203
+ </td>
204
+ </tr>
205
+ <?php endforeach; ?>
206
+ </tbody>
207
+ </table>
208
+ </div>
209
+ </div>
210
+ <table cellspacing="0" class="hor-scroll">
211
+ <tbody>
212
+ <tr>
213
+ <td class="a-right" style="padding: 10px !important">
214
+ <button id="id_5a1bd68f1d36ca85b36800d2b570033b" title="Salvar Templates" type="button" class="scalable add" onclick="smsTemplate.send()" style="">
215
+ <span><span><span>Salvar Templates SMS</span></span></span>
216
+ </button>
217
+ </td>
218
+ </tr>
219
+ </tbody>
220
+ </table>
221
+ </form>
222
+ </div>
223
+ <div class="content-header">
224
+ <table cellspacing="0">
225
+ <tbody>
226
+ <tr>
227
+ <td style="width:50%;">
228
+ <h3 style="width: 98%;" class="">Envios de SMS</h3>
229
+ </td>
230
+ </tr>
231
+ </tbody>
232
+ </table>
233
+ </div>
234
+ <div id="productGrid">
235
+ <table cellspacing="0" class="actions">
236
+ <tbody>
237
+ <tr>
238
+ <td class="pager">Página<img class="arrow" alt="Go to Previous page" src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>">
239
+ <form action="sms.formLoad($('page').value)">
240
+ <input type="text" class="input-text page" id="page" value="1">
241
+ </form>
242
+ <img class="arrow" alt="Go to Previous page" src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>">
243
+ de <span id='total_pages'>0</span> páginas<span class="separator">|</span>
244
+ Ver
245
+ <select onchange="javascript:sms.formLoad($('page').value)" name="limit" id='limit'>
246
+ <option selected="selected" value="20">20</option>
247
+ <option value="30">30</option>
248
+ <option value="50">50</option>
249
+ <option value="100">100</option>
250
+ <option value="200">200</option>
251
+ </select>
252
+ por página<span class="separator">|</span>
253
+ Total de <span id='total_sms'>0</span> registros encontrados
254
+ </td>
255
+ <td class="filter-actions a-right">
256
+ <button style="" onclick="sms.resetFilter()" class="scalable " type="button" title="Reiniciar Filtro" id="id_1615dbc01a31f3c21ca83893f7519628">
257
+ <span>
258
+ <span>
259
+ <span>Reiniciar Filtro</span>
260
+ </span>
261
+ </span>
262
+ </button>
263
+ <button style="" onclick="sms.doFilter()" class="scalable task" type="button" title="Pesquisa" id="id_901291ee967136c40f7caf2c00aefb06">
264
+ <span>
265
+ <span>
266
+ <span>Pesquisa</span>
267
+ </span>
268
+ </span>
269
+ </button>
270
+ </td>
271
+ </tr>
272
+ </tbody>
273
+ </table>
274
+ <div id="productGrid_massaction">
275
+ <table cellspacing="0" cellpadding="0" class="massaction">
276
+ <tbody>
277
+ <tr>
278
+ <td>
279
+ <a onclick="return sms.selectAll()" href="#">Selecionar Tudo</a>
280
+ <span class="separator">|</span>
281
+ <a onclick="return sms.unselectAll()" href="#">Desselecionar Todos</a>
282
+ <span class="separator">|</span>
283
+ <strong id="smsSelected-count">0</strong> itens selecionados
284
+ </td>
285
+ </tr>
286
+ </tbody>
287
+ </table>
288
+ </div>
289
+ <div class="grid">
290
+ <div class="hor-scroll">
291
+ <table cellspacing="0" id="productGrid_table" class="data">
292
+ <colgroup>
293
+ <col width="20" class="a-center">
294
+ <col width="50">
295
+ <col width="500">
296
+ <col width="200">
297
+ <col width="50">
298
+ </colgroup>
299
+ <thead>
300
+ <tr class="headings">
301
+ <th>
302
+ <span class="nobr">&nbsp;</span>
303
+ </th>
304
+ <th>
305
+ <span class="nobr"><span class="sort-title">Pedido</span></span>
306
+ </th>
307
+ <th>
308
+ <span class="nobr"><a class="not-sort" title="asc" name="name" href="#"><span class="sort-title">Status</span></a></span>
309
+ </th>
310
+ <th>
311
+ <span class="nobr"><a class="not-sort" title="asc" name="price" href="#"><span class="sort-title">Mensagem</span></a></span>
312
+ </th>
313
+ <th>
314
+ <span class="nobr"><a class="not-sort" title="asc" name="price" href="#"><span class="sort-title">Criado em</span></a></span>
315
+ </th>
316
+ </tr>
317
+ <tr class="filter">
318
+ <th>
319
+ </th>
320
+ <th>
321
+ </th>
322
+ <th>
323
+ <div class="field-100">
324
+ <form action="javascript:sms.formLoad($('page').value)">
325
+ <input type="text" class="input-text no-changes" value="" id="name_filter" name="name_filter">
326
+ </form>
327
+ </div>
328
+ </th>
329
+ <th>
330
+ <div class="field-100">
331
+ <form action="javascript:sms.formLoad($('page').value)">
332
+ <input type="text" class="input-text no-changes" value="" id="sku_filter" name="sku_filter">
333
+ </form>
334
+ </div>
335
+ </th>
336
+ <th>
337
+ <div class="range">
338
+ <form action="javascript:sms.formLoad($('page').value)">
339
+ <div class="range-line">
340
+ <span class="label">De:</span>
341
+ <input type="text" class="input-text no-changes" value="" id="priceFrom_filter" name="price[from]">
342
+ </div>
343
+ <div class="range-line">
344
+ <span class="label">Para : </span>
345
+ <input type="text" class="input-text no-changes" value="" id="priceTo_filter" name="price[to]">
346
+ </div>
347
+ </form>
348
+ </div>
349
+ </th>
350
+ </tr>
351
+ </thead>
352
+ <tbody id="sms_container">
353
+ <!-- All sms rows are added here -->
354
+ </tbody>
355
+ </table>
356
+ </div>
357
+ </div>
358
+ </div>
359
+ </div>
360
+ </div>
361
+ </div>
app/design/adminhtml/default/default/template/pagueveloz_sms/js.phtml ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ Event.observe(window, 'load', recalculateTax);
4
+ Event.observe(window, 'load', registerTaxRecalcs);
5
+
6
+ function registerTaxRecalcs()
7
+ {
8
+ if (typeof dynamicTaxes == 'undefined') {
9
+ return;
10
+ }
11
+
12
+ for (var i = 0; i < dynamicTaxes.length; i++) {
13
+ Event.observe($(dynamicTaxes[i]), 'change', recalculateTax);
14
+ }
15
+ Event.observe($('tax_class_id'), 'change', recalculateTax);
16
+ }
17
+
18
+ var priceFormat = <?php echo $this->helper('tax')->getPriceFormat($this->getStore()); ?>;
19
+ var taxRates = <?php echo $this->helper('tax')->getAllRatesByProductClass($this->getStore()); ?>;
20
+
21
+ function recalculateTax()
22
+ {
23
+ if (typeof dynamicTaxes == 'undefined') {
24
+ return;
25
+ }
26
+
27
+ for (var i = 0; i < dynamicTaxes.length; i++) {
28
+ var code = dynamicTaxes[i];
29
+ var span = $('dynamic-tax-' + code);
30
+ var input = $(code);
31
+
32
+ if (!input.value) {
33
+ span.innerHTML = '';
34
+ continue;
35
+ }
36
+
37
+ var rate = 0;
38
+ var taxClass = $('tax_class_id').options[$('tax_class_id').selectedIndex].value;
39
+ eval('var value = taxRates.value_' + taxClass);
40
+
41
+ if (value != undefined) {
42
+ rate = value;
43
+ }
44
+
45
+ var spanValue = '';
46
+ if (rate != 0) {
47
+ spanValue = ' ' + formatCurrency(input.value / (100 + rate) * rate, priceFormat);
48
+ }
49
+ span.innerHTML = spanValue;
50
+ }
51
+ }
52
+
53
+ // Bind tab changes
54
+ function bindActiveProductTab(event) {
55
+ if (event.tab && event.tab.name && $('store_switcher')) {
56
+ $('store_switcher').switchParams = 'active_tab/' + event.tab.name + '/';
57
+ }
58
+ }
59
+ varienGlobalEvents.attachEventHandler('showTab', bindActiveProductTab);
60
+
61
+ // bind active tab
62
+ <?php if ($tabsBlock = $this->getLayout()->getBlock('product_tabs')): ?>
63
+ if (<?php echo $tabsBlock->getJsObjectName() ?> && <?php echo $tabsBlock->getJsObjectName() ?>.activeTab && $('store_switcher')) {
64
+ $('store_switcher').switchParams = 'active_tab/' +<?php echo $tabsBlock->getJsObjectName() ?>.activeTab.name + '/';
65
+ }
66
+ <?php endif; ?>
67
+ //]]>
68
+ </script>
69
+
70
+
71
+
72
+
73
+ <script type="text/javascript">
74
+ smsComprar = {
75
+ div_boleto: 'boleto_compra_sms',
76
+ totalSelected: 0,
77
+ produtosAdded: {},
78
+ comprarPacote: function(payment_type, buy_type, value) {
79
+ smsComprar.div_boleto = 'boleto_compra_sms';
80
+ smsComprar.comprar(payment_type, buy_type, value);
81
+ },
82
+ comprarAvulso: function(payment_type, buy_type, value) {
83
+ smsComprar.div_boleto = 'boleto_compra_sms_avulso';
84
+ smsComprar.comprar(payment_type, buy_type, value);
85
+ },
86
+ comprar: function(payment_type, buy_type, value) {
87
+ new Ajax.Request('<?php echo Mage::getUrl('adminhtml/sms/comprar') ?>', {
88
+ method: 'post',
89
+ parameters: {
90
+ payment_type: payment_type,
91
+ buy_type: buy_type,
92
+ value: value
93
+ },
94
+ onSuccess: function(response) {
95
+ var dados = response.responseText.evalJSON();
96
+ $(smsComprar.div_boleto).innerHTML = '<div style="margin: 10px;">Imprimir boleto: <a style="background-color: #fb913e; border: 1px solid #ee5f02; color: white; font-weight: bold; padding: 5px; text-decoration: none;" target="_blank" href="' + dados.urlBoleto + '">clique aqui</a></div>';
97
+ },
98
+ onFailure: function() {
99
+ alert('Não foi possível completar a operação, tente novamente...');
100
+ }
101
+ });
102
+ }
103
+ };
104
+
105
+ smsTemplate = {
106
+ form: 'form_templates',
107
+ table: 'sms_template_container',
108
+ addNew: function() {
109
+ $(smsTemplate.table).innerHTML = $(smsTemplate.table).innerHTML
110
+ + '<tr class="even pointer">'
111
+ + '<td class="a-center">##</td>'
112
+ + '<td class="a-center">Pringles</td>'
113
+ + '<td class="">Pringles</td>'
114
+ + '</tr>\n';
115
+ },
116
+ send: function() {
117
+ $(smsTemplate.form).request({
118
+ method: 'post',
119
+ onComplete: function(response){
120
+ var dados = response.responseText.evalJSON();
121
+ alert('Informaçoes salvas com sucesso');
122
+ }
123
+ });
124
+ }
125
+ };
126
+
127
+ sms = {
128
+ tableContainer: 'sms_container',
129
+ totalSelected: 0,
130
+ smsLoaded: {},
131
+ loadSms: function(dados) {
132
+ $('total_sms').innerHTML = dados.total_sms;
133
+ $('total_pages').innerHTML = dados.total_pages;
134
+
135
+ var smsListHtml = "";
136
+
137
+ for (var sms in dados.smsList) {
138
+ if (dados.smsList.hasOwnProperty(sms)) {
139
+ smsListHtml += "<tr class='even pointer'><td class='a-center'><input onchange='sms.observeCheck(this)' id='" + dados.smsList[sms].order_id + "' value='" + dados.smsList[sms].order_id + "' class='checkbox' name='productID[" + dados.smsList[sms].order_id + "]' type='checkbox' />";
140
+ smsListHtml += "</td><td class=' '>" + dados.smsList[sms].order_id + "</td><td class=' '>" + dados.smsList[sms].status + "</td><td class=' '>" + dados.smsList[sms].message + "</td><td class=' '>" + dados.smsList[sms].created_at + "</td></tr>";
141
+ }
142
+ }
143
+ $('sms_container').innerHTML = smsListHtml;
144
+ sms.smsLoaded = dados.smsList;
145
+ },
146
+ formLoad: function(pageNumber) {
147
+ new Ajax.Request('<?php echo Mage::getUrl('adminhtml/sms/smsList') ?>', {
148
+ method: 'post',
149
+ parameters: {
150
+ page: pageNumber,
151
+ limit: $('limit').value,
152
+ name: $('name_filter').value,
153
+ sku: $('sku_filter').value,
154
+ price_to: $('priceTo_filter').value,
155
+ price_from: $('priceFrom_filter').value,
156
+ },
157
+ onSuccess: function(response) {
158
+ $('page').value = pageNumber;
159
+ var dados = response.responseText.evalJSON();
160
+ sms.loadSms(dados);
161
+ },
162
+ onFailure: function() {
163
+ alert('Something went wrong...');
164
+ }
165
+ });
166
+ },
167
+ previousPage: function() {
168
+ var previous_page = parseInt($('page').value) - 1;
169
+ sms.formLoad(previous_page);
170
+ },
171
+ nextPage: function() {
172
+ var next_page = parseInt($('page').value) + 1;
173
+ sms.formLoad(next_page);
174
+ },
175
+ selectAll: function() {
176
+ $$('#sms_container input[type=checkbox]').each(function(check) {
177
+ check.checked = true;
178
+ sms.totalSelected++;
179
+ });
180
+ $('smsSelected-count').innerHTML = sms.totalSelected;
181
+ },
182
+ unselectAll: function() {
183
+ $$('#sms_container input[type=checkbox]').each(function(check) {
184
+ check.checked = false;
185
+ sms.totalSelected--;
186
+ });
187
+ $('smsSelected-count').innerHTML = sms.totalSelected;
188
+ },
189
+ doFilter: function() {
190
+ alert('@TODO');
191
+ },
192
+ resetFilter: function() {
193
+ alert('@TODO');
194
+ },
195
+ observeCheck: function(element) {
196
+ if (!element.checked) {
197
+ return;
198
+ }
199
+ },
200
+ addSelectedSms: function() {
201
+ $$('#sms_container input[type=checkbox]').each(function(check) {
202
+ if (check.checked) {
203
+ id = check.value;
204
+ smsGerar.addSms(id);
205
+ }
206
+ });
207
+
208
+ }
209
+ };
210
+
211
+ sms.formLoad(1);
212
+ </script>
app/design/adminhtml/default/default/template/payment/info/pagueveloz_boleto.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package base_default
5
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
6
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
7
+ */
8
+ ?>
9
+ <?php
10
+ /**
11
+ * @see Mage_Payment_Block_Info
12
+ */
13
+ ?>
14
+ <p><?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?></p>
15
+ <?php if ($this->getInstructions()): ?>
16
+ <table>
17
+ <tbody>
18
+ <tr>
19
+ <td><?php echo nl2br($this->getInstructions()) ?></td>
20
+ </tr>
21
+ </tbody>
22
+ </table>
23
+ <?php endif; ?>
24
+
25
+ <?php
26
+ $order = $this->getInfo()->getOrder();
27
+
28
+ if ($order) {
29
+ try
30
+ {
31
+ $boleto = Mage::getModel('pagueveloz_boleto/boleto')->generate($order);
32
+
33
+ if ($boleto->getId()) {
34
+ echo "<a href=\"{$boleto->getUrl()}\" target=\"_blank\">Imprimir Boleto</a>";
35
+ }
36
+ else {
37
+ echo "<b>Não foi possível gerar o Boleto<br>"
38
+ . "Favor contate o administrador do site</b>";
39
+ }
40
+ }
41
+ catch (Exception $e) {
42
+ echo $e->getMessage();
43
+ }
44
+ }
45
+ ?>
app/design/frontend/base/default/layout/pagueveloz_boleto.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_success translate="label">
4
+ <reference name="content">
5
+ <reference name="checkout.success">
6
+ <block type="pagueveloz_boleto/onepage_success" name="pagueveloz_boleto" template="pagueveloz_boleto/success.phtml" />
7
+ </reference>
8
+ </reference>
9
+ </checkout_onepage_success>
10
+ </layout>
app/design/frontend/base/default/template/pagueveloz_boleto/success.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <br /><br />
2
+ <?php
3
+ $incrementId = $this->getOrderId();
4
+
5
+ if ($incrementId) {
6
+ $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
7
+
8
+ if ($order->getPayment()->getMethodInstance()->getCode() == PagueVeloz_Boleto_Model_BoletoMethod::PAYMENT_METHOD_BANKTRANSFER_CODE) {
9
+
10
+ try
11
+ {
12
+ $boleto = Mage::getModel('pagueveloz_boleto/boleto')->generate($order);
13
+
14
+ if ($boleto->getId()) {
15
+ echo '<div style=" margin: 0 auto; width: 50%;">';
16
+ echo "<a href=\"{$boleto->getUrl()}\" target=\"_blank\">";
17
+ echo "<img src='".$this->getSkinUrl('images/pagueveloz/botao-imprimir-boleto.png') . "' />";
18
+ echo "</a></div>";
19
+ if (Mage::getModel('pagueveloz_boleto/boletoMethod')->getConfig('send_email')) {
20
+ echo "<div style='margin: 0 auto; width: 50%;'>Você reberá um e-mail com informações do boleto emitido pelo PagueVeloz</div>";
21
+ }
22
+ }
23
+ else {
24
+ echo "<b>Não foi possível gerar o Boleto<br />"
25
+ . "Favor contate o administrador do site</b>";
26
+ }
27
+ }
28
+ catch (Exception $e) {
29
+ echo $e->getMessage();
30
+ }
31
+ }
32
+ }
33
+ ?>
app/design/frontend/base/default/template/payment/form/pagueveloz_boleto.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package base_default
5
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
6
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
7
+ */
8
+ ?>
9
+ <?php if ($instructions = $this->getInstructions()): ?>
10
+ <ul class="form-list checkout-agreements" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
11
+ <li>
12
+ <div class="<?php echo $this->getMethodCode() ?>-instructions-content agreement-content">
13
+ <?php echo nl2br($instructions) ?>
14
+ </div>
15
+ </li>
16
+ </ul>
17
+ <?php endif; ?>
app/design/frontend/base/default/template/payment/info/pagueveloz_boleto.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package base_default
5
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
6
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
7
+ */
8
+ ?>
9
+ <?php
10
+ /**
11
+ * @see Mage_Payment_Block_Info
12
+ */
13
+ ?>
14
+ <p><?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?></p>
15
+ <?php if ($this->getInstructions()): ?>
16
+ <table>
17
+ <tbody>
18
+ <tr>
19
+ <td><?php echo nl2br($this->getInstructions()) ?></td>
20
+ </tr>
21
+ </tbody>
22
+ </table>
23
+ <?php endif; ?>
24
+
25
+ <?php
26
+ $order = $this->getInfo()->getOrder();
27
+
28
+ if ($order) {
29
+ try {
30
+ $boleto = Mage::getModel('pagueveloz_boleto/boleto')->generate($order);
31
+
32
+ if ($boleto->getId()) {
33
+ echo "<a href=\"{$boleto->getUrl()}\" target=\"_blank\">";
34
+ echo "<img src='".$this->getSkinUrl('images/pagueveloz/botao-imprimir-boleto.png') . "' />";
35
+ echo "</a>";
36
+ }
37
+ else {
38
+ echo "<b>Não foi possível gerar o Boleto<br>"
39
+ . "Favor contate o administrador do site</b>";
40
+ }
41
+ } catch (Exception $e) {
42
+ echo $e->getMessage();
43
+ }
44
+ }
45
+ ?>
app/etc/modules/PagueVeloz_All.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category PagueVeloz
5
+ * @package PagueVeloz_Boleto
6
+ * @author André Felipe <andrew.daluz@gmail.com>
7
+ * @copyright Copyright (c) 2013 André Felipe Teixeira da Luz <andrew.daluz@gmail.com>
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <PagueVeloz_Api>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </PagueVeloz_Api>
16
+ <PagueVeloz_Boleto>
17
+ <active>true</active>
18
+ <codePool>community</codePool>
19
+ <depends>
20
+ <Mage_Payment />
21
+ </depends>
22
+ </PagueVeloz_Boleto>
23
+ <PagueVeloz_Cliente>
24
+ <active>true</active>
25
+ <codePool>community</codePool>
26
+ </PagueVeloz_Cliente>
27
+ <PagueVeloz_Sms>
28
+ <active>true</active>
29
+ <codePool>community</codePool>
30
+ </PagueVeloz_Sms>
31
+ </modules>
32
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>pagueveloz</name>
4
- <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -25,14 +25,14 @@ Envia SMS para o cliente sobre as suas transa&#xE7;&#xF5;es;&#xD;
25
  - Cadastrar-se na API pelo painel administrativo do Magento;&#xD;
26
  - Consultar saldo de cr&#xE9;ditos SMS;&#xD;
27
  - Regerar boletos para o pedido pelo painel administrativo.</description>
28
- <notes>Features:&amp;#xD;&#xD;
29
  &amp;#xD;&#xD;
30
- - Configura&amp;#xE7;&amp;#xE3;o para ordenar forma de pagamento;&amp;#xD;&#xD;
31
- - Adicionado bot&amp;#xE3;o para imprimir boleto na pagina do pedido e no Success;</notes>
32
  <authors><author><name>Trezo</name><user>trezo</user><email>contato@trezo.com.br</email></author><author><name>Andr&#xE9; Felipe</name><user>AndrewDaluz</user><email>andrew.daluz@gmail.com</email></author></authors>
33
  <date>2016-01-27</date>
34
- <time>12:44:14</time>
35
- <contents><target name="mageetc"><dir name="."><dir name="app"><dir name="etc"><dir name="modules"><file name="PagueVeloz_All.xml" hash=""/></dir></dir></dir></dir></target><target name="magedesign"><dir name="."><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pagueveloz_boleto.xml" hash=""/><file name="pagueveloz_sms.xml" hash=""/></dir><dir name="template"><dir name="payment"><dir name="info"><file name="pagueveloz_boleto.phtml" hash=""/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pagueveloz_boleto.xml" hash=""/></dir><dir name="template"><dir name="payment"><dir name="form"><file name="pagueveloz_boleto.phtml" hash=""/></dir><dir name="info"><file name="pagueveloz_boleto.phtml" hash=""/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>4.3.0</min><max>6.2.0</max></php></required></dependencies>
38
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>pagueveloz</name>
4
+ <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
25
  - Cadastrar-se na API pelo painel administrativo do Magento;&#xD;
26
  - Consultar saldo de cr&#xE9;ditos SMS;&#xD;
27
  - Regerar boletos para o pedido pelo painel administrativo.</description>
28
+ <notes>Features:&#xD;
29
  &amp;#xD;&#xD;
30
+ - Configura&#xE7;&#xE3;o para ordenar forma de pagamento;&#xD;
31
+ - Adicionado bot&#xE3;o para imprimir boleto na pagina do pedido e no Success;</notes>
32
  <authors><author><name>Trezo</name><user>trezo</user><email>contato@trezo.com.br</email></author><author><name>Andr&#xE9; Felipe</name><user>AndrewDaluz</user><email>andrew.daluz@gmail.com</email></author></authors>
33
  <date>2016-01-27</date>
34
+ <time>14:32:48</time>
35
+ <contents><target name="mageetc"><dir name="modules"><file name="PagueVeloz_All.xml" hash="fb817a06d78e0b2d688cbece00082b61"/></dir></target><target name="magecommunity"><dir name="PagueVeloz"><dir name="Api"><dir name="Helper"><file name="Data.php" hash="5dd22a3dfaaec130dedf9beb9c7582c7"/></dir><dir name="Model"><dir name="Common"><file name="HttpContext.php" hash="87b8a23bb37ce28c8d133141f7192ea4"/><file name="HttpResponse.php" hash="8824a5b81f241eba95d1bb05eeaa2445"/></dir><dir name="Dto"><file name="AssinarDTO.php" hash="9f973ca8adbf9f03cfb49ff9945ab843"/><file name="AuthenticationDTO.php" hash="32adad741bd0488f153b6742b8ae05ef"/><file name="BoletoDTO.php" hash="305cde3edf6251336764c877d7f0dc36"/><file name="ClienteDTO.php" hash="68cc74cbe60d3aca11512cf428329e0e"/><file name="ComprarCreditosSMSDTO.php" hash="23faffe9ba86409a9baee5e9d5dc2d10"/><file name="ConsultarBoletoDTO.php" hash="d40d21746ddb2b5600b1126418c12126"/><file name="ConsultarClienteDTO.php" hash="81f0d0efd6c628e58036f411dcf4e54f"/><file name="ContaBancariaDTO.php" hash="ec010aca621bd4bd999d6a8690da3d73"/><file name="ContaDTO.php" hash="979c4cd877a5f4fe171741519d543837"/><file name="CreditoSMSDTO.php" hash="dc8ab72c5ce940fdf4703878e75af13b"/><file name="EmailDTO.php" hash="b59163a5e46981ad4f6766160de5b4f9"/><file name="EmitirBoletoDTO.php" hash="d643c25c36bdd9d84e047962a0206162"/><file name="MensagemSMSDTO.php" hash="1e82c6ebd460e71ed3d7f49229b324a7"/><file name="PacotesSMSDTO.php" hash="dc72eb8777fbb05f31a9545504ab0211"/><file name="SaqueDTO.php" hash="3088396e76abbcba0a0dd8946e74b849"/><file name="TransferenciaDTO.php" hash="4ec678f2308cca18ecc1ba4839e316f4"/></dir><dir name="Exceptions"><file name="ArgumentNullException.php" hash="849eab61181df20d28c76d27f90ea4e6"/><file name="InvalidEmailException.php" hash="78f26c55091d93311c561a3b82d23ede"/><file name="InvalidHostException.php" hash="1604677bc1ae445e078beb5c7eba3847"/><file name="InvalidJSONException.php" hash="802ef96e2f52fa168c3fb970e0f6c778"/><file name="InvalidMethodException.php" hash="a00a3f9e2ee43d7c2221c7fd87ec47d7"/><file name="InvalidValueException.php" hash="fd91721837c1a2b9d3762e0fd5b8c27c"/></dir><dir name="Interfaces"><file name="IHttpClient.php" hash="b4f3d163a7a5ee4e5f5a7ea6d132f3ed"/></dir><file name="Observer.php" hash="1e672ee02cee0ffdb585c5a157d1aa95"/><dir name="Services"><file name="Curl.php" hash="c73fb2938c780fc7a652d86cff68b635"/></dir><dir name="Source"><file name="States.php" hash="e2c1ee6aaa6c5ee930e619a2de13f929"/></dir><dir name="Webservice"><file name="Assinar.php" hash="d7f6ff66c4c07cff0cdc68d357eced9c"/><file name="Boleto.php" hash="5384f5fced8a083fe926e053ff1e6abc"/><file name="Cliente.php" hash="292297b56176d88033bd87064336fc07"/><file name="ComprarCreditosSMS.php" hash="805465acad1fa70fc0f0ca0164dbfd2a"/><file name="ConsultarBoleto.php" hash="4237724947a67f76cdeda0d261c3ddd7"/><file name="ConsultarCliente.php" hash="e1122f61ad83d0f83be61b58a8f3840a"/><file name="Conta.php" hash="20b39c7d57b5967be343f0ddfc54c4a9"/><file name="ContaBancaria.php" hash="9b9536d4e242755c42d104c5ca821747"/><file name="CreditoSMS.php" hash="e14cffd70ae25de85fdc385347d0ec55"/><file name="EmitirBoleto.php" hash="3a18a5f5dfec23ade179404a5b7612f2"/><file name="MensagemSMS.php" hash="7997c50d8e6295302c067b7ec0330f4c"/><file name="PacotesSMS.php" hash="ec8ca595e5dc6c4b44326f263ec0da59"/><file name="PagueVeloz.php" hash="22919d70c45a616760e1c54c34ae246b"/><file name="Saldo.php" hash="44cc18583e198e38f4dff2da7d28cded"/><file name="Saque.php" hash="d34c5726993945445e327f6f794ed8aa"/><file name="Transferencia.php" hash="a0e41d439c92ac87c7480b42ef35cbf2"/></dir><file name="Webservice.php" hash="cd676d2dc2fa4d18ab68503f3f8d6a94"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PaguevelozController.php" hash="05bea1a4ac58edb59bbac81f73dc28dd"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9c7b1a6fdcd5f8406c6da0d25f6abf13"/><file name="config.xml" hash="8ef885b51b334c9ec421551d39c49510"/><file name="system.xml" hash="9dd946555687576e913a62c0da089bfd"/></dir></dir><dir name="Boleto"><dir name="Block"><dir name="Adminhtml"><file name="Content.php" hash="4cef37b3e9506ef93e535a6635fe6e0e"/><file name="Js.php" hash="70cffb7e203a75ba2fdddfa4b88b3ac5"/><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Boleto.php" hash="311d65f72b67f967961725da616a120f"/></dir></dir></dir></dir></dir><dir name="Form"><file name="Boleto.php" hash="abbe1492aa0fd16117c3b565c2e57425"/></dir><dir name="Info"><file name="Boleto.php" hash="ed7f2649513be3643e929c0c2af2f98c"/></dir><dir name="Onepage"><file name="Success.php" hash="b9cf5a95c7c5a41fb889396e86d7bde8"/></dir></dir><dir name="Helper"><file name="Data.php" hash="6c396287706a2fae0fabca1f964632fc"/></dir><dir name="Model"><file name="Boleto.php" hash="30dc3107d16ddcaec549c80e8b90838a"/><file name="BoletoMethod.php" hash="e734ed1977045ebec492d2ed94f98c86"/><file name="Cron.php" hash="cc7d52dc6003112047f207e4d95f2a44"/><dir name="Mysql4"><dir name="Boleto"><file name="Collection.php" hash="367a9911d7e9a98b58851e57c2556bea"/></dir><file name="Boleto.php" hash="ccd1b3c9f523236da3a7f26327ee158d"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BoletoController.php" hash="a5e3b6fda6f793cef26dfc4a68faeac0"/><file name="ContaController.php" hash="9d4381834b4dee98effd2decdc38ed35"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c1c2d8726d0985e26d2d96353b252161"/><file name="config.xml" hash="f45f93ea06a231781310c7fa59730ae4"/><file name="system.xml" hash="c20858c743c2361320d2cd1a0a5e0c99"/></dir><dir name="sql"><dir name="pagueveloz_boleto_setup"><file name="mysql4-install-1.0.0.php" hash="95a197e8d72480a9fc2304e05808c7f1"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="55024d5f3b074e2302a57850a290bfad"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="dd01cbf26c2cea6ae99b7c559b62074b"/></dir></dir></dir><dir name="Sms"><dir name="Block"><dir name="Adminhtml"><file name="Content.php" hash="bb303d97dbdb73f0dd9672ae9457d470"/><file name="Js.php" hash="ba85fce0c0ef747e3cb2d5f9871c569a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c8018e7556f54eaf875bbe6f30630984"/></dir><dir name="Model"><file name="Cron.php" hash="4b2410d50a29f97a95e004bf374a4abd"/><dir name="Mysql4"><dir name="Sms"><file name="Collection.php" hash="b892e920b4e6c72ffad043d6136983e6"/></dir><file name="Sms.php" hash="cea8e93d288a3166ede32788212db818"/><dir name="Template"><file name="Collection.php" hash="f3f10f9a36161a00fd68b7d4c3938f8d"/></dir><file name="Template.php" hash="b23a4c8d530dd9c3bbe47f01c6c80ae4"/></dir><file name="Observer.php" hash="5ace26216c02db7fd4129924be66db2e"/><file name="Sms.php" hash="92bb8f32b0aca393af078745d5d71767"/><file name="Template.php" hash="4f6a500e1af540e03592a4416e71635b"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SmsController.php" hash="37b3d3d6f72de79963bed53d7532591a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="dac3f4eed8cefa32fadee773d4595208"/><file name="config.xml" hash="5adcbfdd6bfd9fad96c1a3f89478cf44"/><file name="system.xml" hash="134ddc80172a4c408d1f808e0730b41f"/></dir><dir name="sql"><dir name="pagueveloz_sms_setup"><file name="mysql4-install-1.0.0.php" hash="4a1e0fa19e30245ea70fe2319fbf901e"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="f206b98382ba544fb6dd60d7303eb2fc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="pagueveloz"><file name="boleto.phtml" hash="e331797b39ab943901d80da065b80c5a"/><file name="js.phtml" hash="3fb8c6613b14b63792d094ea6b3e9f7b"/></dir><dir name="pagueveloz_boleto"><file name="content.phtml" hash="53eeb2e00dec472ed8ed9d682eada203"/><file name="js.phtml" hash="7840ba742ba5375d34e5ee26452b4205"/></dir><dir name="pagueveloz_sms"><file name="content.phtml" hash="a55f737503bd54251c0f632db433caa6"/><file name="js.phtml" hash="dbfbb647452be17a39d94d3dff8e1dc2"/></dir><dir name="payment"><dir name="info"><file name="pagueveloz_boleto.phtml" hash="a6dc876486a849067454a3be07504a46"/></dir></dir></dir><dir name="layout"><file name="pagueveloz_boleto.xml" hash="04bb884d0171f1018a9e21454cf3043e"/><file name="pagueveloz_sms.xml" hash="c4a3fd25cf57dd2f56e780211d981eb4"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pagueveloz_boleto"><file name="success.phtml" hash="3aef8398e40624c9b6481b3891ccb799"/></dir><dir name="payment"><dir name="form"><file name="pagueveloz_boleto.phtml" hash="9916b6426aeb0948e3910297594e06d2"/></dir><dir name="info"><file name="pagueveloz_boleto.phtml" hash="54aaad5ba596271ce7ed76f624078e14"/></dir></dir></dir><dir name="layout"><file name="pagueveloz_boleto.xml" hash="32296931b036ace56f584349d191ddce"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="pagueveloz"><file name="botao-imprimir-boleto.png" hash="7f9313cae22687b8e61ec1c9494bb416"/></dir></dir></dir></dir></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>4.3.0</min><max>6.2.0</max></php></required></dependencies>
38
  </package>
skin/frontend/base/default/images/pagueveloz/botao-imprimir-boleto.png ADDED
Binary file