├── .editorconfig ├── .gitignore ├── Gruntfile.js ├── LICENSE.txt ├── README.md ├── assets └── images │ ├── banking-billet.png │ └── itau.png ├── includes ├── views │ ├── html-admin-page.php │ ├── html-notice-currency-not-supported.php │ └── html-notice-woocommerce-missing.php ├── wc-class-itau-shopline-api.php ├── wc-class-itau-shopline-cripto.php ├── wc-class-itau-shopline-gateway.php └── wc-class-itau-shopline-sounder.php ├── languages └── wc-itau-shopline.pot ├── package.json ├── readme.txt ├── templates ├── emails │ ├── html-instructions.php │ └── plain-instructions.php └── payment-instructions.php └── wc-itau-shopline.php /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 4 8 | tab_width = 4 9 | indent_style = tab 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false 15 | 16 | [*.txt] 17 | trim_trailing_whitespace = false 18 | 19 | [*.json] 20 | insert_final_newline = false 21 | indent_size = 2 22 | tab_width = 2 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | /* jshint node:true */ 2 | var expandHomeDir = require( 'expand-home-dir' ); 3 | 4 | module.exports = function( grunt ) { 5 | 'use strict'; 6 | 7 | grunt.initConfig({ 8 | 9 | // Gets the package vars 10 | pkg: grunt.file.readJSON( 'package.json' ), 11 | svn_settings: { 12 | path: expandHomeDir( '~/Projects/wordpress-plugins-svn/' ) + '<%= pkg.name %>', 13 | tag: '<%= svn_settings.path %>/tags/<%= pkg.version %>', 14 | trunk: '<%= svn_settings.path %>/trunk', 15 | exclude: [ 16 | '.git/', 17 | '.tx/', 18 | '.editorconfig', 19 | '.gitignore', 20 | '.jshintrc', 21 | 'node_modules/', 22 | 'Gruntfile.js', 23 | 'README.md', 24 | 'package.json', 25 | '*.zip' 26 | ] 27 | }, 28 | 29 | // Rsync commands used to take the files to svn repository 30 | rsync: { 31 | options: { 32 | args: ['--verbose'], 33 | exclude: '<%= svn_settings.exclude %>', 34 | syncDest: true, 35 | recursive: true 36 | }, 37 | tag: { 38 | options: { 39 | src: './', 40 | dest: '<%= svn_settings.tag %>' 41 | } 42 | }, 43 | trunk: { 44 | options: { 45 | src: './', 46 | dest: '<%= svn_settings.trunk %>' 47 | } 48 | } 49 | }, 50 | 51 | // Make .pot files 52 | makepot: { 53 | dist: { 54 | options: { 55 | type: 'wp-plugin' 56 | } 57 | } 58 | }, 59 | 60 | // Check text domain 61 | checktextdomain: { 62 | options:{ 63 | text_domain: '<%= pkg.name %>', 64 | keywords: [ 65 | '__:1,2d', 66 | '_e:1,2d', 67 | '_x:1,2c,3d', 68 | 'esc_html__:1,2d', 69 | 'esc_html_e:1,2d', 70 | 'esc_html_x:1,2c,3d', 71 | 'esc_attr__:1,2d', 72 | 'esc_attr_e:1,2d', 73 | 'esc_attr_x:1,2c,3d', 74 | '_ex:1,2c,3d', 75 | '_n:1,2,4d', 76 | '_nx:1,2,4c,5d', 77 | '_n_noop:1,2,3d', 78 | '_nx_noop:1,2,3c,4d' 79 | ] 80 | }, 81 | files: { 82 | src: [ 83 | '**/*.php', // Include all files 84 | '!node_modules/**' // Exclude node_modules/ 85 | ], 86 | expand: true 87 | } 88 | }, 89 | 90 | // Shell command to commit the new version of the plugin 91 | shell: { 92 | // Remove delete files. 93 | svn_remove: { 94 | command: 'svn st | grep \'^!\' | awk \'{print $2}\' | xargs svn --force delete', 95 | options: { 96 | stdout: true, 97 | stderr: true, 98 | execOptions: { 99 | cwd: '<%= svn_settings.path %>' 100 | } 101 | } 102 | }, 103 | // Add new files. 104 | svn_add: { 105 | command: 'svn add --force * --auto-props --parents --depth infinity -q', 106 | options: { 107 | stdout: true, 108 | stderr: true, 109 | execOptions: { 110 | cwd: '<%= svn_settings.path %>' 111 | } 112 | } 113 | }, 114 | // Commit the changes. 115 | svn_commit: { 116 | command: 'svn commit -m "updated the plugin version to <%= pkg.version %>"', 117 | options: { 118 | stdout: true, 119 | stderr: true, 120 | execOptions: { 121 | cwd: '<%= svn_settings.path %>' 122 | } 123 | } 124 | } 125 | }, 126 | 127 | // Create README.md for GitHub. 128 | wp_readme_to_markdown: { 129 | options: { 130 | screenshot_url: 'http://ps.w.org/<%= pkg.name %>/assets/{screenshot}.png' 131 | }, 132 | dest: { 133 | files: { 134 | 'README.md': 'readme.txt', 135 | }, 136 | }, 137 | }, 138 | }); 139 | 140 | // Load tasks 141 | grunt.loadNpmTasks( 'grunt-checktextdomain' ); 142 | grunt.loadNpmTasks( 'grunt-wp-i18n' ); 143 | grunt.loadNpmTasks( 'grunt-rsync' ); 144 | grunt.loadNpmTasks( 'grunt-shell' ); 145 | grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' ); 146 | 147 | // Register tasks 148 | grunt.registerTask( 'default', [] ); 149 | 150 | // Deploy task 151 | grunt.registerTask( 'deploy', [ 152 | 'default', 153 | 'rsync:tag', 154 | 'rsync:trunk', 155 | 'shell:svn_remove', 156 | 'shell:svn_add', 157 | 'shell:svn_commit' 158 | ] ); 159 | 160 | grunt.registerTask( 'readme', 'wp_readme_to_markdown' ); 161 | }; 162 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Itau Shopline for WooCommerce # 2 | **Contributors:** claudiosanches 3 | **Tags:** woocommerce, itau, shopline, payment 4 | **Requires at least:** 4.0 5 | **Tested up to:** 4.7 6 | **Stable tag:** 1.1.1 7 | **License:** GPLv2 or later 8 | **License URI:** http://www.gnu.org/licenses/gpl-2.0.html 9 | 10 | Itau Shopline gateway for WooCommerce 11 | 12 | ## Description ## 13 | 14 | Adicione o Itaú Shopline como método de pagamento em sua loja WooCommerce. 15 | 16 | [Itaú Shopline](https://www.itau.com.br/empresas/recebimentos/shopline/) é um método de pagamento brasileiro desenvolvido pelo Itaú. 17 | 18 | O plugin Itaú Shopline for WooCommerce foi desenvolvido sem nenhum incentivo do Itaú Shopline ou da Itaú. Nenhum dos desenvolvedores deste plugin possuem vínculos com estas empresas. 19 | 20 | Este plugin foi desenvolvido a partir da documentação oficial do Itaú Shopline. 21 | 22 | ### Compatibilidade ### 23 | 24 | Compatível desde a versão 2.3.x até 2.6.x do WooCommerce. 25 | 26 | É requerido o plugin [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/) para o envio do CPF ou CPNJ para o Itaú, junto com o número do endereço e bairro. 27 | 28 | ### Instalação ### 29 | 30 | Confira o nosso guia de instalação e configuração do Itaú Shopline na aba [Installation](http://wordpress.org/plugins/wc-itau-shopline/installation/). 31 | 32 | ### Dúvidas? ### 33 | 34 | Você pode esclarecer suas dúvidas usando: 35 | 36 | * A nossa sessão de [FAQ](http://wordpress.org/plugins/wc-itau-shopline/faq/). 37 | * Utilizando o nosso [fórum no Github](https://github.com/claudiosmweb/wc-itau-shopline). 38 | * Criando um tópico no [fórum de ajuda do WordPress](http://wordpress.org/support/plugin/wc-itau-shopline). 39 | 40 | ### Colaborar ### 41 | 42 | Você pode contribuir com código-fonte em nossa página no [GitHub](https://github.com/claudiosmweb/wc-itau-shopline). 43 | 44 | ## Installation ## 45 | 46 | ### Instalação do plugin: ### 47 | 48 | * Envie os arquivos do plugin para a pasta wp-content/plugins, ou instale usando o instalador de plugins do WordPress. 49 | * Ative o plugin. 50 | 51 | ### Requerimentos: ### 52 | 53 | * É necessário possuir uma conta empresa no [Itaú Shopline](https://www.itau.com.br/empresas/recebimentos/shopline/). 54 | * Ter instalada a versão mais recente do [WooCommerce](http://wordpress.org/plugins/woocommerce/). 55 | * E ter instalada a versão mais recente do [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/). 56 | 57 | ### Configurações do Plugin: ### 58 | 59 | Com o plugin instalado acesse o admin do WordPress e entre em "WooCommerce" > "Configurações" > "Finalizar compra" > "Itau Shopline". 60 | 61 | Habilite o Itau Shopline, preenche os campos de "Código do site" e "Chave de criptografia". Importante observar que este plugin irá funcionar com todos os métodos de pagamento configurados na sua conta do Itau Shopline, caso você necessite ativar cartão de crédito, isso deve ser feito junto ao Itaú e a Rede, sem ter a necessidade de mudar qualquer coisa neste plugin ou na configuração. 62 | 63 | Pronto, sua loja já pode receber pagamentos pelo Itau Shopline. 64 | 65 | ## Frequently Asked Questions ## 66 | 67 | ### Qual é a licença do plugin? ### 68 | 69 | Este plugin esta licenciado como GPL. 70 | 71 | ### O que eu preciso para utilizar este plugin? ### 72 | 73 | * Ter instalada a versão mais recente do [WooCommerce](http://wordpress.org/plugins/woocommerce/) 74 | * Instalar a versão mais recente do [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/). 75 | * Possuir uma conta empresa no [Itaú Shopline](https://www.itau.com.br/empresas/recebimentos/shopline/). 76 | 77 | ### Quais são os meios de pagamento que o plugin aceita? ### 78 | 79 | Serão aceitos todos os meios de pagamento do Itau Shopline, sendo eles boleto bancário, débito em conta e financiamento para clientes Itaú e cartão de crédito (que deve ser habilitado junto ao Itaú e a [Rede](https://www.userede.com.br/)). 80 | 81 | ### O status do pedido não é alterado automaticamente? ### 82 | 83 | Sim é alterado automaticamente usando um sistema de sounda que irá consultar os dados dos pedidos no Itau Shopline. 84 | 85 | Esta sounda é ativada a cada 3 horas por cron, desta forma é de vital importância que o cron do WordPress esteja funcionando corretamente. 86 | 87 | Caso os status não estejam sendo alterados, é recomendado desativar o cron do WordPress e configurar o servidor para rodar o cron acessando o arquivo `wp-cron.php` pelo menos a cada 5 minutos. 88 | 89 | ### O pedido foi pago e ficou com o status de "processando" e não como "concluído", isto esta certo? ### 90 | 91 | Sim, esta certo e significa que o plugin esta trabalhando como deveria. 92 | 93 | Todo gateway de pagamentos no WooCommerce deve mudar o status do pedido para "processando" no momento que é confirmado o pagamento e nunca deve ser alterado sozinho para "concluído", pois o pedido deve ir apenas para o status "concluído" após ele ter sido entregue. 94 | 95 | Para produtos baixáveis a configuração padrão do WooCommerce é permitir o acesso apenas quando o pedido tem o status "concluído", entretanto nas configurações do WooCommerce na aba *Produtos* é possível ativar a opção **"Conceder acesso para download do produto após o pagamento"** e assim liberar o download quando o status do pedido esta como "processando". 96 | 97 | ### Mais dúvidas relacionadas ao funcionamento do plugin? ### 98 | 99 | Por favor, caso você tenha algum problema com o funcionamento do plugin, [abra um tópico no fórum do plugin](https://wordpress.org/support/plugin/wc-itau-shopline#postform) com o link arquivo de log (ative ele nas opções do plugin e tente fazer uma compra, depois vá até WooCommerce > Status do Sistema, selecione o log do *itau-shopline* e copie os dados, depois crie um link usando o [pastebin.com](http://pastebin.com) ou o [gist.github.com](http://gist.github.com)), desta forma fica mais rápido para fazer o diagnóstico. 100 | 101 | ## Screenshots ## 102 | 103 | ### 1. Configurações do plugin. ### 104 | ![Configurações do plugin.](http://ps.w.org/wc-itau-shopline/assets/screenshot-1.png) 105 | 106 | ### 2. Método de pagamento na página de finalizar o pedido. ### 107 | ![Método de pagamento na página de finalizar o pedido.](http://ps.w.org/wc-itau-shopline/assets/screenshot-2.png) 108 | 109 | ### 3. Exemplo dos meios de pagamentos sendo exibidos no Itaú Shopline. ### 110 | ![Exemplo dos meios de pagamentos sendo exibidos no Itaú Shopline.](http://ps.w.org/wc-itau-shopline/assets/screenshot-3.png) 111 | 112 | 113 | ## Changelog ## 114 | 115 | ### 1.1.1 - 2016/12/24 ### 116 | 117 | - Melhorias na forma que coleta os números de CPF e CNPJ. 118 | 119 | ### 1.1.0 - 2016/09/22 ### 120 | 121 | - Adicionada opção para gerar apenas boletos. 122 | - Corrigida uma mensagem de erro incorreta que aparecia na página de pagar o pedido quando feito pelo painel de administração. 123 | 124 | ### 1.0.0 - 2015/09/03 ### 125 | 126 | - Versão inicial. 127 | 128 | ## Upgrade Notice ## 129 | 130 | ### 1.1.1 ### 131 | 132 | - Melhorias na forma que coleta os números de CPF e CNPJ. 133 | -------------------------------------------------------------------------------- /assets/images/banking-billet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudiosanches/wc-itau-shopline/c166cd7bc5b1c6f2a9dc42a781a6dd40754430ad/assets/images/banking-billet.png -------------------------------------------------------------------------------- /assets/images/itau.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudiosanches/wc-itau-shopline/c166cd7bc5b1c6f2a9dc42a781a6dd40754430ad/assets/images/itau.png -------------------------------------------------------------------------------- /includes/views/html-admin-page.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |

method_title; ?>

12 | 13 | using_supported_currency() && ! class_exists( 'woocommerce_wpml' ) ) { 15 | include dirname( __FILE__ ) . '/html-notice-currency-not-supported.php'; 16 | } 17 | ?> 18 | 19 | method_description ); ?> 20 | 21 | 22 |
23 |

' . __( 'Itau Shopline for WooCommerce', 'wc-itau-shopline' ) . '', '' . __( 'donation', 'wc-itau-shopline' ) . '', '★★★★★', '' . __( 'WordPress.org', 'wc-itau-shopline' ) . '' ); ?>

24 |
25 | 26 | 27 | 28 | generate_settings_html(); ?> 29 |
30 | -------------------------------------------------------------------------------- /includes/views/html-notice-currency-not-supported.php: -------------------------------------------------------------------------------- 1 | 11 | 12 |
13 |

%s is not supported. Works only with Brazilian Real.', 'wc-itau-shopline' ), get_woocommerce_currency() ); ?> 14 |

15 |
16 | -------------------------------------------------------------------------------- /includes/views/html-notice-woocommerce-missing.php: -------------------------------------------------------------------------------- 1 | 18 | 19 |
20 |

: ' . __( 'WooCommerce', 'wc-itau-shopline' ) . '' ); ?>

21 |
22 | -------------------------------------------------------------------------------- /includes/wc-class-itau-shopline-api.php: -------------------------------------------------------------------------------- 1 | website_code = $website_code; 121 | $this->encryption_key = $encryption_key; 122 | $this->title = $title; 123 | $this->days_to_pay = $days_to_pay; 124 | $this->note_line1 = $note_line1; 125 | $this->note_line2 = $note_line2; 126 | $this->note_line3 = $note_line3; 127 | $this->debug = $debug; 128 | 129 | // Active logs. 130 | if ( 'yes' === $this->debug ) { 131 | $this->log = new WC_Logger(); 132 | } 133 | } 134 | 135 | /** 136 | * Get Shopline URL. 137 | * 138 | * @param string $hash 139 | * 140 | * @return string 141 | */ 142 | public function get_shopline_url( $hash ) { 143 | return $this->shopline_url . '?DC=' . $hash; 144 | } 145 | 146 | /** 147 | * Get billet URL. 148 | * 149 | * @param string $hash 150 | * 151 | * @return string 152 | */ 153 | public function get_billet_url( $hash ) { 154 | return $this->billet_url . '?DC=' . $hash; 155 | } 156 | 157 | /** 158 | * Get request URL. 159 | * 160 | * @param string $hash 161 | * 162 | * @return string 163 | */ 164 | public function get_request_url( $hash ) { 165 | return $this->request_url . '?DC=' . $hash; 166 | } 167 | 168 | /** 169 | * Get payment type name. 170 | * 171 | * @param string $type 172 | * 173 | * @return string 174 | */ 175 | protected function get_payment_type_name( $type ) { 176 | $types = array( 177 | '01' => __( 'direct debit or financing', 'wc-itau-shopline' ), 178 | '02' => __( 'banking billet', 'wc-itau-shopline' ), 179 | '03' => __( 'credit card', 'wc-itau-shopline' ), 180 | ); 181 | 182 | return isset( $types[ $type ] ) ? $types[ $type ] : ''; 183 | } 184 | 185 | /** 186 | * Only numbers. 187 | * 188 | * @param string|int $string 189 | * 190 | * @return string|int 191 | */ 192 | protected function only_numbers( $string ) { 193 | return preg_replace( '([^0-9])', '', $string ); 194 | } 195 | 196 | /** 197 | * Safe load XML. 198 | * 199 | * @param string $source 200 | * @param int $options 201 | * 202 | * @return SimpleXMLElement|bool 203 | */ 204 | protected function safe_load_xml( $source, $options = 0 ) { 205 | $old = null; 206 | 207 | if ( '<' !== substr( $source, 0, 1 ) ) { 208 | return false; 209 | } 210 | 211 | if ( function_exists( 'libxml_disable_entity_loader' ) ) { 212 | $old = libxml_disable_entity_loader( true ); 213 | } 214 | 215 | $dom = new DOMDocument(); 216 | $return = $dom->loadXML( $source, $options ); 217 | 218 | if ( ! is_null( $old ) ) { 219 | libxml_disable_entity_loader( $old ); 220 | } 221 | 222 | if ( ! $return ) { 223 | return false; 224 | } 225 | 226 | return simplexml_import_dom( $dom ); 227 | } 228 | 229 | /** 230 | * Get CPF or CNPJ. 231 | * 232 | * @param WC_Order $order Order object. 233 | * 234 | * @return array 235 | */ 236 | protected function get_cpf_cnpj( $order ) { 237 | $code = '00'; 238 | $number = ''; 239 | $wcbcf_settings = get_option( 'wcbcf_settings' ); 240 | $type = (int) $wcbcf_settings['person_type']; 241 | $person_type = (int) $order->billing_persontype; 242 | 243 | if ( ( 1 === $type && 1 === $person_type ) || 2 === $type ) { 244 | $code = '01'; 245 | $number = $this->only_numbers( $order->billing_cpf ); 246 | } elseif ( ( 1 === $type && 2 === $person_type ) || 3 === $type ) { 247 | $code = '02'; 248 | $number = $this->only_numbers( $order->billing_cnpj ); 249 | } 250 | 251 | return array( 252 | 'code' => $code, 253 | 'number' => $number, 254 | ); 255 | } 256 | 257 | /** 258 | * Get Customer name. 259 | * 260 | * @param WC_Order $order 261 | * @param string $document_type 262 | * 263 | * @return string 264 | */ 265 | protected function get_customer_name( $order, $document_type ) { 266 | if ( '02' == $document_type ) { 267 | return sanitize_text_field( $order->billing_company ); 268 | } 269 | 270 | return sanitize_text_field( $order->billing_first_name . ' ' . $order->billing_last_name ); 271 | } 272 | 273 | /** 274 | * Save expiry time in the database. 275 | * 276 | * @param int $order_id 277 | * 278 | * @return int 279 | */ 280 | public function save_expiry_time( $order_id ) { 281 | $days = absint( $this->days_to_pay ); 282 | $now = strtotime( current_time( 'mysql' ) ); 283 | $expiry = strtotime( '+' . $days . ' days', $now ); 284 | 285 | update_post_meta( $order_id, '_wc_itau_shopline_expiry_time', $expiry ); 286 | 287 | return $expiry; 288 | } 289 | 290 | /** 291 | * Get expiry date. 292 | * 293 | * @param int $order_id 294 | * 295 | * @return string 296 | */ 297 | protected function get_expiry_date( $order_id ) { 298 | $time = get_post_meta( $order_id, '_wc_itau_shopline_expiry_time', true ); 299 | 300 | if ( '' == $time ) { 301 | $time = $this->save_expiry_time( $order_id ); 302 | } 303 | 304 | return date( 'dmY', $time ); 305 | } 306 | 307 | /** 308 | * Generating payment hash. 309 | * 310 | * @param WC_Order $order 311 | * 312 | * @return string 313 | */ 314 | public function get_payment_hash( $order ) { 315 | if ( 'yes' === $this->debug ) { 316 | $this->log->add( $this->id, 'Generating payment hash for order ' . $order->id ); 317 | } 318 | 319 | $document = $this->get_cpf_cnpj( $order ); 320 | 321 | $data = array( 322 | 'order_number' => $order->id, 323 | 'order_total' => (float) $order->get_total(), 324 | 'description' => sprintf( __( 'Payment for order %s', 'wc-itau-shopline' ), $order->get_order_number() ), 325 | 'customer_name' => $this->get_customer_name( $order, $document['code'] ), 326 | 'registration' => $document['code'], 327 | 'document' => $document['number'], 328 | 'address' => $order->billing_address_1, 329 | 'neighborhood' => $order->billing_neighborhood, 330 | 'zipcode' => $this->only_numbers( $order->billing_postcode ), 331 | 'city' => $order->billing_city, 332 | 'state' => $order->billing_state, 333 | 'expiry' => $this->get_expiry_date( $order->id ), 334 | 'return_url' => '', // Just for payment type notification and for websites over SSL. 335 | 'note_line1' => $this->note_line1, 336 | 'note_line2' => $this->note_line2, 337 | 'note_line3' => $this->note_line3, 338 | ); 339 | 340 | $data = apply_filters( 'wc_itau_shopline_payment_data', $data ); 341 | 342 | if ( 'yes' === $this->debug ) { 343 | $this->log->add( $this->id, 'Hash data for order ' . $order->id . ': ' . print_r( $data, true ) ); 344 | } 345 | 346 | try { 347 | $cripto = new WC_Itau_Shopline_Cripto( $this->website_code, $this->encryption_key ); 348 | $hash = $cripto->generate_data( $data ); 349 | 350 | return $hash; 351 | } catch ( Exception $e ) { 352 | if ( 'yes' === $this->debug ) { 353 | $this->log->add( $this->id, 'Error while creating the payment hash for order ' . $order->id . ': ' . $e->getMessage() ); 354 | } 355 | 356 | wc_add_notice( '' . esc_html( $this->title ) . '' . esc_html( $e->getMessage() ), 'error' ); 357 | 358 | return ''; 359 | } 360 | } 361 | 362 | /** 363 | * Get payment details. 364 | * 365 | * @param int $order_id 366 | * 367 | * @return array 368 | */ 369 | protected function get_payment_details( $order_id ) { 370 | if ( 'yes' === $this->debug ) { 371 | $this->log->add( $this->id, 'Requesting payment details for order ' . $order_id ); 372 | } 373 | 374 | try { 375 | $cripto = new WC_Itau_Shopline_Cripto( $this->website_code, $this->encryption_key ); 376 | $hash = $cripto->generate_request( $order_id ); 377 | $params = array( 378 | 'sslverify' => false, 379 | 'timeout' => 60 380 | ); 381 | 382 | $response = wp_remote_get( $this->get_request_url( $hash ), $params ); 383 | 384 | if ( 'yes' === $this->debug ) { 385 | $this->log->add( $this->id, 'Request data of payment details for order ' . $order_id . ': ' . print_r( $response['body'], true ) ); 386 | } 387 | 388 | if ( is_wp_error( $response ) ) { 389 | throw new Exception( 'WP_Error when requesting the payment details for order ' . $order_id . ': ' . $response->get_error_message() ); 390 | } 391 | $details = array(); 392 | $data = $this->safe_load_xml( $response['body'], LIBXML_NOCDATA ); 393 | 394 | if ( ! isset( $data->PARAMETER->PARAM[3] ) || ! isset( $data->PARAMETER->PARAM[4] ) || ! is_object( $data->PARAMETER->PARAM[3] ) || ! is_object( $data->PARAMETER->PARAM[4] ) ) { 395 | throw new Exception( 'Invalid returned data for order ' . $order_id . ': ' . print_r( $data, true ) ); 396 | } 397 | 398 | $payment_type = get_object_vars( $data->PARAMETER->PARAM[3] ); 399 | $payment_status = get_object_vars( $data->PARAMETER->PARAM[4] ); 400 | 401 | $details = array( 402 | 'payment_type' => sanitize_text_field( $payment_type['@attributes']['VALUE'] ), 403 | 'status' => sanitize_text_field( $payment_status['@attributes']['VALUE'] ) 404 | ); 405 | 406 | if ( 'yes' === $this->debug ) { 407 | $this->log->add( $this->id, 'Payment details for order ' . $order_id . ' requested successfully: ' . print_r( $details, true ) ); 408 | } 409 | 410 | return $details; 411 | } catch ( Exception $e ) { 412 | if ( 'yes' === $this->debug ) { 413 | $this->log->add( $this->id, $e->getMessage() ); 414 | } 415 | 416 | return array(); 417 | } 418 | } 419 | 420 | /** 421 | * Process order status. 422 | * 423 | * @param int $order_id 424 | * 425 | * @return bool 426 | */ 427 | public function process_order_status( $order_id ) { 428 | if ( 'yes' === $this->debug ) { 429 | $this->log->add( $this->id, 'Processing payment status for order ' . $order_id ); 430 | } 431 | 432 | $payment_details = $this->get_payment_details( $order_id ); 433 | 434 | if ( ! $payment_details ) { 435 | if ( 'yes' === $this->debug ) { 436 | $this->log->add( $this->id, 'Order status change failed for order ' . $order_id ); 437 | } 438 | 439 | return false; 440 | } 441 | 442 | $order = wc_get_order( $order_id ); 443 | $now = strtotime( current_time( 'mysql' ) ); 444 | 445 | // Cancel order if expired. 446 | if ( $order->wc_itau_shopline_expiry_time < $now && 'on-hold' === $order->get_status() ) { 447 | $order->update_status( 'cancelled', __( 'Itau Shopline: Order expired for lack of pay.', 'wc-itau-shopline' ) ); 448 | 449 | return false; 450 | } 451 | 452 | // Cancel order if the customer does not selected any payment type in one hour. 453 | if ( '00' == $payment_details['payment_type'] ) { 454 | $limit_time = strtotime( '+60 minutes', strtotime( $order->order_date ) ); 455 | 456 | if ( $limit_time < $now ) { 457 | $order->update_status( 'cancelled', __( 'Itau Shopline: Order canceled because customers not selected a form of payment yet.', 'wc-itau-shopline' ) ); 458 | 459 | return false; 460 | } 461 | } 462 | 463 | $return = false; 464 | 465 | // Process the order status. 466 | switch ( $payment_details['status'] ) { 467 | case '00' : 468 | case '05' : 469 | if ( ! in_array( $order->get_status(), array( 'processing', 'completed' ) ) ) { 470 | $payment_type_name = $this->get_payment_type_name( $payment_details['payment_type'] ); 471 | 472 | $order->add_order_note( sprintf( __( 'Itau Shopline: Payment approved using %s.', 'wc-itau-shopline' ), $payment_type_name ) ); 473 | } 474 | 475 | // Changing the order for processing and reduces the stock. 476 | $order->payment_complete(); 477 | 478 | $return = true; 479 | 480 | break; 481 | case '03' : 482 | $order->update_status( 'cancelled', __( 'Itau Shopline: Order expired for lack of pay.', 'wc-itau-shopline' ) ); 483 | break; 484 | 485 | default : 486 | // Do nothing! 487 | break; 488 | } 489 | 490 | return $return; 491 | } 492 | } 493 | -------------------------------------------------------------------------------- /includes/wc-class-itau-shopline-cripto.php: -------------------------------------------------------------------------------- 1 | code = strtoupper( $code ); 68 | $this->key = strtoupper( $key ); 69 | } 70 | 71 | /** 72 | * Generate the algorithm. 73 | * 74 | * @param string $data 75 | * @param string $key 76 | * 77 | * @return string 78 | */ 79 | private function algorithm( $data, $key ) { 80 | $key = strtoupper( $key ); 81 | 82 | $k = 0; 83 | $m = 0; 84 | 85 | $string = ''; 86 | $this->initialize( $key ); 87 | 88 | for ( $j = 1; $j <= strlen( $data ); $j++ ) { 89 | $k = ( $k + 1 ) % 256; 90 | $m = ( $m + $this->data[ $k ] ) % 256; 91 | $i = $this->data[ $k ]; 92 | $this->data[ $k ] = $this->data[ $m ]; 93 | $this->data[ $m ] = $i; 94 | $n = $this->data[ ( ( $this->data[ $k ] + $this->data[ $m ] ) % 256 ) ]; 95 | $i1 = ( ord( substr( $data, ( $j - 1 ), 1 ) ) ^ $n ); 96 | $string .= chr( $i1 ); 97 | } 98 | 99 | return $string; 100 | } 101 | 102 | /** 103 | * Fill params with empty spaces. 104 | * 105 | * @param string $data 106 | * @param int $quantity 107 | * 108 | * @return string 109 | */ 110 | private function fill_empty( $data, $quantity ) { 111 | while ( strlen( $data ) < $quantity ) { 112 | $data .= ' '; 113 | } 114 | 115 | return substr( $data, 0, $quantity ); 116 | } 117 | 118 | /** 119 | * Fill params with zeros. 120 | * 121 | * @param string $data 122 | * @param int $quantity 123 | * 124 | * @return string 125 | */ 126 | private function fill_zeros( $data, $quantity ) { 127 | while ( strlen( $data ) < $quantity ) { 128 | $data = '0' . $data; 129 | } 130 | 131 | return substr( $data, 0, $quantity ); 132 | } 133 | 134 | /** 135 | * Initialize data. 136 | * 137 | * @param string $key 138 | */ 139 | private function initialize( $key ) { 140 | $m = strlen( $key ); 141 | 142 | for ( $j = 0; $j <= 255; $j++ ) { 143 | $this->key[ $j ] = substr( $key, ( $j % $m ), 1 ); 144 | $this->data[ $j ] = $j; 145 | } 146 | 147 | $k = 0; 148 | 149 | for ( $j = 0; $j <= 255; $j++ ) { 150 | $k = ( $k + $this->data[ $j ] + ord( $this->key[ $j ] ) ) % 256; 151 | $i = $this->data[ $j ]; 152 | $this->data[ $j ] = $this->data[ $k ]; 153 | $this->data[ $k ] = $i; 154 | } 155 | } 156 | 157 | /** 158 | * Get random number based on Java Math.get_random_number() 159 | * 160 | * @return float 161 | */ 162 | private function get_random_number() { 163 | return rand( 0, 999999999 ) / 1000000000; 164 | } 165 | 166 | /** 167 | * Convert data. 168 | * 169 | * @param string $data 170 | * 171 | * @return string 172 | */ 173 | private function convert( $data ) { 174 | $string = chr( floor( 26.0 * $this->get_random_number() + 65.0 ) ); 175 | 176 | for ( $i = 0; $i < strlen( $data ); $i++ ) { 177 | $string .= ord( substr( $data, $i, 1 ) ); 178 | $string .= chr( floor( 26.0 * $this->get_random_number() + 65.0 ) ); 179 | } 180 | 181 | return $string; 182 | } 183 | 184 | /** 185 | * Unconver data. 186 | * 187 | * @param string $data 188 | * 189 | * @return string 190 | */ 191 | private function unconvert( $data ) { 192 | $string = ''; 193 | 194 | for ( $i = 0; $i < strlen( $data ); $i++ ) { 195 | $_string = ''; 196 | 197 | $c = substr( $data, $i, 1 ); 198 | 199 | while ( is_numeric( $c ) ) { 200 | $_string .= substr( $data, $i, 1 ); 201 | $i += 1; 202 | $c = substr( $data, $i, 1 ); 203 | } 204 | 205 | if ( '' != $_string ) { 206 | $string .= chr( $_string + 0 ); 207 | } 208 | } 209 | 210 | return $string; 211 | } 212 | 213 | /** 214 | * Generate payment data. 215 | * 216 | * @param array $data 217 | * 218 | * @return string 219 | */ 220 | public function generate_data( $data ) { 221 | $default = array( 222 | 'order_number' => '', 223 | 'order_total' => '', 224 | 'description' => '', 225 | 'customer_name' => '', 226 | 'registration' => '', 227 | 'document' => '', 228 | 'address' => '', 229 | 'neighborhood' => '', 230 | 'zipcode' => '', 231 | 'city' => '', 232 | 'state' => '', 233 | 'expiry' => '', 234 | 'return_url' => '', 235 | 'note_line1' => '', 236 | 'note_line2' => '', 237 | 'note_line3' => '', 238 | ); 239 | $args = wp_parse_args( $data, $default ); 240 | 241 | if ( ( 1 > strlen( $args['order_number'] ) ) || ( 8 < strlen( $args['order_number'] ) ) ) { 242 | throw new Exception( __( 'Invalid order number.', 'wc-itau-shopline' ) ); 243 | } 244 | 245 | if ( ! in_array( $args['registration'], array( '01', '02' ) ) ) { 246 | throw new Exception( __( 'Invalid registration code.', 'wc-itau-shopline' ) ); 247 | } 248 | 249 | if ( '' != $args['document'] && ( ! is_numeric( $args['document'] ) && 14 < strlen( $args['document'] ) ) ) { 250 | throw new Exception( __( 'Invalid document number.', 'wc-itau-shopline' ) ); 251 | } 252 | 253 | if ( '' != $args['zipcode'] && ( ! is_numeric( $args['zipcode'] ) || 8 != strlen( $args['zipcode'] ) ) ) { 254 | throw new Exception( __( 'Invalid zipcode.', 'wc-itau-shopline' ) ); 255 | } 256 | 257 | if ( '' != $args['expiry'] && ( ! is_numeric( $args['expiry'] ) || 8 != strlen( $args['expiry'] ) ) ) { 258 | throw new Exception( __( 'Invalid expiry date.', 'wc-itau-shopline' ) ); 259 | } 260 | 261 | if ( 60 < strlen( $args['note_line1'] ) ) { 262 | throw new Exception( sprintf( __( 'Invalid note line %s. Can not be more than 60 characters.', 'wc-itau-shopline' ), 1 ) ); 263 | } 264 | 265 | if ( 60 < strlen( $args['note_line2'] ) ) { 266 | throw new Exception( sprintf( __( 'Invalid note line %s. Can not be more than 60 characters.', 'wc-itau-shopline' ), 2 ) ); 267 | } 268 | 269 | if ( 60 < strlen( $args['note_line3'] ) ) { 270 | throw new Exception( sprintf( __( 'Invalid note line %s. Can not be more than 60 characters.', 'wc-itau-shopline' ), 3 ) ); 271 | } 272 | 273 | // Fix zeros. 274 | $args['order_number'] = $this->fill_zeros( $args['order_number'], 8 ); 275 | $args['order_total'] = $this->fill_zeros( number_format( $args['order_total'], 2, '', '' ), 10 ); 276 | 277 | // Remove accents. 278 | $args['description'] = remove_accents( $args['description'] ); 279 | $args['customer_name'] = remove_accents( $args['customer_name'] ); 280 | $args['address'] = remove_accents( $args['address'] ); 281 | $args['neighborhood'] = remove_accents( $args['neighborhood'] ); 282 | $args['city'] = remove_accents( $args['city'] ); 283 | $args['note_line1'] = remove_accents( $args['note_line1'] ); 284 | $args['note_line2'] = remove_accents( $args['note_line2'] ); 285 | $args['note_line3'] = remove_accents( $args['note_line3'] ); 286 | 287 | // Fill empty values. 288 | $args['description'] = $this->fill_empty( $args['description'], 40 ); 289 | $args['customer_name'] = $this->fill_empty( $args['customer_name'], 30 ); 290 | $args['registration'] = $this->fill_empty( $args['registration'], 2 ); 291 | $args['document'] = $this->fill_empty( $args['document'], 14 ); 292 | $args['address'] = $this->fill_empty( $args['address'], 40 ); 293 | $args['neighborhood'] = $this->fill_empty( $args['neighborhood'], 15 ); 294 | $args['zipcode'] = $this->fill_empty( $args['zipcode'], 8 ); 295 | $args['city'] = $this->fill_empty( $args['city'], 15 ); 296 | $args['state'] = $this->fill_empty( $args['state'], 2 ); 297 | $args['expiry'] = $this->fill_empty( $args['expiry'], 8 ); 298 | $args['return_url'] = $this->fill_empty( $args['return_url'], 60 ); 299 | $args['note_line1'] = $this->fill_empty( $args['note_line1'], 60 ); 300 | $args['note_line2'] = $this->fill_empty( $args['note_line2'], 60 ); 301 | $args['note_line3'] = $this->fill_empty( $args['note_line3'], 60 ); 302 | 303 | $_algorithm = $this->algorithm( $args['order_number'] . $args['order_total'] . $args['description'] . $args['customer_name'] . $args['registration'] . $args['document'] . $args['address'] . $args['neighborhood'] . $args['zipcode'] . $args['city'] . $args['state'] . $args['expiry'] . $args['return_url'] . $args['note_line1'] . $args['note_line2'] . $args['note_line3'], $this->key ); 304 | 305 | $algorithm = $this->algorithm( $this->code . $_algorithm, self::ITAU_KEY ); 306 | 307 | return $this->convert( $algorithm ); 308 | } 309 | 310 | /** 311 | * Generate cripto. 312 | * 313 | * @param string $customer_code 314 | * 315 | * @return string 316 | */ 317 | public function generate_cripto( $customer_code ) { 318 | $_algorithm = $this->algorithm( $customer_code, $this->key ); 319 | $algorithm = $this->algorithm( $this->code . $_algorithm, self::ITAU_KEY ); 320 | 321 | return $this->convert( $algorithm ); 322 | } 323 | 324 | /** 325 | * Generate request. 326 | * 327 | * @param string $order_number 328 | * @param string $type 329 | * 330 | * @return string 331 | */ 332 | public function generate_request( $order_number, $type = '1' ) { 333 | if ( ! in_array( $type, array( '0', '1' ) ) ) { 334 | throw new Exception( __( 'Invalid type.', 'wc-itau-shopline' ) ); 335 | } 336 | 337 | $order_number = $this->fill_zeros( $order_number, 8 ); 338 | 339 | $_algorithm = $this->algorithm( $order_number . $type, $this->key ); 340 | $algorithm = $this->algorithm( $this->code . $_algorithm, self::ITAU_KEY ); 341 | 342 | return $this->convert( $algorithm ); 343 | } 344 | 345 | /** 346 | * Decripto. 347 | * 348 | * @param string $data 349 | * 350 | * @return array 351 | */ 352 | public function decripto( $data ) { 353 | $data = $this->unconvert( $data ); 354 | $algorithm = $this->algorithm( $data, $this->key ); 355 | 356 | return array( 357 | 'code' => substr( $algorithm, 0, 26 ), 358 | 'order_number' => substr( $algorithm, 26, 8 ), 359 | 'payment_type' => substr( $algorithm, 34, 2 ), 360 | ); 361 | } 362 | 363 | /** 364 | * Generate generic data. 365 | * 366 | * @param string $data 367 | * 368 | * @return string 369 | */ 370 | public function generate_generic_data( $data ) { 371 | $_algorithm = $this->algorithm( $algorithm, $this->key ); 372 | $algorithm = $this->algorithm( $this->code . $_algorithm, self::ITAU_KEY ); 373 | 374 | return $this->convert( $algorithm ); 375 | } 376 | } 377 | -------------------------------------------------------------------------------- /includes/wc-class-itau-shopline-gateway.php: -------------------------------------------------------------------------------- 1 | id = 'itau-shopline'; 29 | $this->method_title = __( 'Itau Shopline', 'wc-itau-shopline' ); 30 | $this->method_description = __( 'Accept payments by credit card, online debit or banking billet using the Itau Shopline.', 'wc-itau-shopline' ); 31 | 32 | // Load the form fields. 33 | $this->init_form_fields(); 34 | 35 | // Load the settings. 36 | $this->init_settings(); 37 | 38 | // Options. 39 | $this->title = $this->get_option( 'title' ); 40 | $this->description = $this->get_option( 'description' ); 41 | $this->website_code = $this->get_option( 'website_code' ); 42 | $this->encryption_key = $this->get_option( 'encryption_key' ); 43 | $this->billet_only = $this->get_option( 'billet_only', 'no' ); 44 | $this->days_to_pay = $this->get_option( 'days_to_pay' ); 45 | $this->note_line1 = $this->get_option( 'note_line1' ); 46 | $this->note_line2 = $this->get_option( 'note_line2' ); 47 | $this->note_line3 = $this->get_option( 'note_line3' ); 48 | $this->debug = $this->get_option( 'debug' ); 49 | $this->api = new WC_Itau_Shopline_API( 50 | $this->website_code, 51 | $this->encryption_key, 52 | $this->title, 53 | $this->days_to_pay, 54 | $this->note_line1, 55 | $this->note_line2, 56 | $this->note_line3, 57 | $this->debug 58 | ); 59 | 60 | // Set the icon. 61 | $this->icon = apply_filters( 'wc_itau_shopline_icon', $this->get_custom_icon_url() ); 62 | 63 | // Actions. 64 | add_action( 'woocommerce_api_wc_itau_shopline_gateway', array( $this, 'payment_redirect' ) ); 65 | add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); 66 | add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) ); 67 | add_action( 'woocommerce_email_after_order_table', array( $this, 'email_instructions' ), 10, 3 ); 68 | } 69 | 70 | /** 71 | * Get custom icon URL. 72 | * 73 | * @return string 74 | */ 75 | protected function get_custom_icon_url() { 76 | if ( 'yes' === $this->billet_only ) { 77 | $icon = 'banking-billet.png'; 78 | } else { 79 | $icon = 'itau.png'; 80 | } 81 | 82 | return plugins_url( 'assets/images/' . $icon, plugin_dir_path( __FILE__ ) ); 83 | } 84 | 85 | /** 86 | * Returns a bool that indicates if currency is amongst the supported ones. 87 | * 88 | * @return bool 89 | */ 90 | protected function using_supported_currency() { 91 | return apply_filters( 'wc_itau_shopline_using_supported_currency', 'BRL' == get_woocommerce_currency() ); 92 | } 93 | 94 | /** 95 | * Returns a value indicating the the Gateway is available or not. It's called 96 | * automatically by WooCommerce before allowing customers to use the gateway 97 | * for payment. 98 | * 99 | * @return bool 100 | */ 101 | public function is_available() { 102 | // Test if is valid for use. 103 | $api = ! empty( $this->website_code ) && ! empty( $this->encryption_key ); 104 | 105 | $available = 'yes' == $this->get_option( 'enabled' ) && $api && $this->using_supported_currency(); 106 | 107 | return $available; 108 | } 109 | 110 | /** 111 | * Initialise Gateway Settings Form Fields. 112 | */ 113 | public function init_form_fields() { 114 | $this->form_fields = array( 115 | 'enabled' => array( 116 | 'title' => __( 'Enable/Disable', 'wc-itau-shopline' ), 117 | 'type' => 'checkbox', 118 | 'label' => __( 'Enable Itau Shopline', 'wc-itau-shopline' ), 119 | 'default' => 'no', 120 | ), 121 | 'title' => array( 122 | 'title' => __( 'Title', 'wc-itau-shopline' ), 123 | 'type' => 'text', 124 | 'description' => __( 'This controls the title which the user sees during checkout.', 'wc-itau-shopline' ), 125 | 'desc_tip' => true, 126 | 'default' => __( 'Backing Billet or Online Debit', 'wc-itau-shopline' ), 127 | ), 128 | 'description' => array( 129 | 'title' => __( 'Description', 'wc-itau-shopline' ), 130 | 'type' => 'textarea', 131 | 'description' => __( 'This controls the description which the user sees during checkout.', 'wc-itau-shopline' ), 132 | 'default' => __( 'Pay with banking billet or online debit in Itau safe environment.', 'wc-itau-shopline' ), 133 | ), 134 | 'integration' => array( 135 | 'title' => __( 'Integration Settings', 'wc-itau-shopline' ), 136 | 'type' => 'title', 137 | 'description' => '', 138 | ), 139 | 'website_code' => array( 140 | 'title' => __( 'Website Code', 'wc-itau-shopline' ), 141 | 'type' => 'text', 142 | 'description' => __( 'Please enter your Website Code. This is needed in order to take payment.', 'wc-itau-shopline' ), 143 | 'default' => '', 144 | 'custom_attributes' => array( 145 | 'required' => 'required', 146 | ), 147 | ), 148 | 'encryption_key' => array( 149 | 'title' => __( 'Encryption Key', 'wc-itau-shopline' ), 150 | 'type' => 'text', 151 | 'description' => __( 'Please enter your Encryption Key. This is needed in order to take payment.', 'wc-itau-shopline' ), 152 | 'default' => '', 153 | 'custom_attributes' => array( 154 | 'required' => 'required', 155 | ), 156 | ), 157 | 'behavior' => array( 158 | 'title' => __( 'Integration Behavior', 'wc-itau-shopline' ), 159 | 'type' => 'title', 160 | 'description' => '', 161 | ), 162 | 'billet_only' => array( 163 | 'title' => __( 'Only banking billet', 'wc-itau-shopline' ), 164 | 'type' => 'checkbox', 165 | 'label' => __( 'Allow only banking billet', 'wc-itau-shopline' ), 166 | 'description' => __( 'Allows only payments by banking billet.', 'wc-itau-shopline' ), 167 | 'desc_tip' => true, 168 | 'default' => 'no', 169 | ), 170 | 'days_to_pay' => array( 171 | 'title' => __( 'Days to Pay', 'wc-itau-shopline' ), 172 | 'type' => 'number', 173 | 'description' => __( 'Please enter how many consecutive days customers will have to pay.', 'wc-itau-shopline' ), 174 | 'desc_tip' => true, 175 | 'default' => '1', 176 | 'custom_attributes' => array( 177 | 'step' => '1', 178 | 'min' => '1', 179 | 'max' => '30', 180 | ), 181 | ), 182 | 'note_line1' => array( 183 | 'title' => __( 'Notes (line 1)', 'wc-itau-shopline' ), 184 | 'type' => 'textarea', 185 | 'description' => __( 'Can not be more than 60 characters.', 'wc-itau-shopline' ), 186 | 'desc_tip' => true, 187 | 'default' => '', 188 | ), 189 | 'note_line2' => array( 190 | 'title' => __( 'Notes (line 2)', 'wc-itau-shopline' ), 191 | 'type' => 'textarea', 192 | 'description' => __( 'Can not be more than 60 characters.', 'wc-itau-shopline' ), 193 | 'desc_tip' => true, 194 | 'default' => '', 195 | ), 196 | 'note_line3' => array( 197 | 'title' => __( 'Notes (line 3)', 'wc-itau-shopline' ), 198 | 'type' => 'textarea', 199 | 'description' => __( 'Can not be more than 60 characters.', 'wc-itau-shopline' ), 200 | 'desc_tip' => true, 201 | 'default' => '', 202 | ), 203 | 'testing' => array( 204 | 'title' => __( 'Gateway Testing', 'wc-itau-shopline' ), 205 | 'type' => 'title', 206 | 'description' => '', 207 | ), 208 | 'debug' => array( 209 | 'title' => __( 'Debug Log', 'wc-itau-shopline' ), 210 | 'type' => 'checkbox', 211 | 'label' => __( 'Enable logging', 'wc-itau-shopline' ), 212 | 'default' => 'no', 213 | 'description' => sprintf( __( 'Log Itau Shopline events, you can check this log in %s.', 'wc-itau-shopline' ), '' . __( 'System Status > Logs', 'wc-itau-shopline' ) . '' ), 214 | ), 215 | ); 216 | } 217 | 218 | /** 219 | * Admin page. 220 | */ 221 | public function admin_options() { 222 | include dirname( __FILE__ ) . '/views/html-admin-page.php'; 223 | } 224 | 225 | /** 226 | * Validate fields. 227 | * 228 | * @return bool 229 | */ 230 | public function validate_fields() { 231 | // Disable validation on Checkout pay page. 232 | if ( is_checkout_pay_page() ) { 233 | return true; 234 | } 235 | 236 | if ( empty( $_REQUEST['billing_cpf'] ) && empty( $_REQUEST['billing_cnpj'] ) ) { 237 | wc_add_notice( '' . $this->get_title() . ': ' . __( 'Missing CPF or CNPJ.', 'wc-itau-shopline' ), 'error' ); 238 | 239 | return false; 240 | } 241 | 242 | return true; 243 | } 244 | 245 | /** 246 | * Process the payment and return the result. 247 | * 248 | * @param int $order_id 249 | * 250 | * @return array 251 | */ 252 | public function process_payment( $order_id ) { 253 | $order = wc_get_order( $order_id ); 254 | 255 | // Mark as on-hold (we're awaiting the payment). 256 | $order->update_status( 'on-hold', __( 'Itau Shopline: Awaiting payment.', 'wc-itau-shopline' ) ); 257 | 258 | // Remove cart. 259 | WC()->cart->empty_cart(); 260 | 261 | // Set the expiry date. 262 | $this->api->save_expiry_time( $order_id ); 263 | 264 | // Return thankyou redirect. 265 | return array( 266 | 'result' => 'success', 267 | 'redirect' => $this->get_return_url( $order ) 268 | ); 269 | } 270 | 271 | /** 272 | * Payment redirect. 273 | */ 274 | public function payment_redirect() { 275 | @ob_start(); 276 | 277 | if ( isset( $_GET['key'] ) ) { 278 | $order_key = wc_clean( $_GET['key'] ); 279 | $order_id = wc_get_order_id_by_order_key( $order_key ); 280 | $order = wc_get_order( $order_id ); 281 | 282 | if ( is_object( $order ) && $this->id === $order->payment_method ) { 283 | if ( 'on-hold' !== $order->status ) { 284 | $message = sprintf( __( 'You can no longer make the payment for order %s.', 'wc-itau-shopline' ), $order->get_order_number() ); 285 | wp_die( $message, __( 'Payment method expired', 'wc-itau-shopline' ), array( 'response' => 200 ) ); 286 | } 287 | 288 | $hash = $this->api->get_payment_hash( $order ); 289 | 290 | if ( 'yes' === $this->billet_only ) { 291 | $url = $this->api->get_billet_url( $hash ); 292 | } else { 293 | $url = $this->api->get_shopline_url( $hash ); 294 | } 295 | 296 | wp_redirect( esc_url_raw( $url ) ); 297 | exit; 298 | } 299 | } 300 | 301 | wp_die( __( 'Invalid request!', 'wc-itau-shopline' ), __( 'Invalid request!', 'wc-itau-shopline' ), array( 'response' => 401 ) ); 302 | } 303 | 304 | /** 305 | * Thank you message. 306 | * Displays the Itau Shopline link. 307 | * 308 | * @param int $order_id 309 | */ 310 | public function thankyou_page( $order_id ) { 311 | $order = wc_get_order( $order_id ); 312 | 313 | wc_get_template( 314 | 'payment-instructions.php', 315 | array( 316 | 'url' => WC_Itau_Shopline::get_payment_url( $order->order_key ), 317 | 'billet_only' => 'yes' === $this->billet_only, 318 | ), 319 | 'woocommerce/itau-shopline/', 320 | WC_Itau_Shopline::get_templates_path() 321 | ); 322 | } 323 | 324 | /** 325 | * Add payment instructions to order email. 326 | * 327 | * @param object $order Order object. 328 | * @param bool $sent_to_admin Send to admin. 329 | * @param bool $plain_text Plain text or HTML. 330 | */ 331 | public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { 332 | if ( $sent_to_admin || 'on-hold' !== $order->get_status() || $this->id !== $order->payment_method ) { 333 | return; 334 | } 335 | 336 | $url = WC_Itau_Shopline::get_payment_url( $order->order_key ); 337 | 338 | if ( $plain_text ) { 339 | wc_get_template( 340 | 'emails/plain-instructions.php', 341 | array( 342 | 'url' => $url, 343 | 'billet_only' => 'yes' === $this->billet_only, 344 | ), 345 | 'woocommerce/itau-shopline/', 346 | WC_Itau_Shopline::get_templates_path() 347 | ); 348 | } else { 349 | wc_get_template( 350 | 'emails/html-instructions.php', 351 | array( 352 | 'url' => $url, 353 | 'billet_only' => 'yes' === $this->billet_only, 354 | ), 355 | 'woocommerce/itau-shopline/', 356 | WC_Itau_Shopline::get_templates_path() 357 | ); 358 | } 359 | } 360 | } 361 | -------------------------------------------------------------------------------- /includes/wc-class-itau-shopline-sounder.php: -------------------------------------------------------------------------------- 1 | 10800, 32 | 'display' => __( 'Itau Shoptine - Every 3 hours', 'wc-itau-shopline' ) 33 | ); 34 | 35 | return $schedules; 36 | } 37 | 38 | /** 39 | * Schedule event. 40 | */ 41 | public static function schedule_event() { 42 | wp_schedule_event( current_time( 'timestamp' ), 'itau_shopline', 'wc_itau_shopline_sounder' ); 43 | } 44 | 45 | /** 46 | * Clear scheduled event. 47 | */ 48 | public static function clear_scheduled_event() { 49 | wp_clear_scheduled_hook( 'wc_itau_shopline_sounder' ); 50 | } 51 | 52 | /** 53 | * Get API instance. 54 | * 55 | * @return WC_Itau_Shopline_API|null 56 | */ 57 | protected static function get_api_instance() { 58 | $settings = get_option( 'woocommerce_itau-shopline_settings', array() ); 59 | 60 | if ( empty( $settings ) ) { 61 | return null; 62 | } 63 | 64 | $api = new WC_Itau_Shopline_API( 65 | $settings['website_code'], 66 | $settings['encryption_key'], 67 | $settings['title'], 68 | $settings['days_to_pay'], 69 | $settings['note_line1'], 70 | $settings['note_line2'], 71 | $settings['note_line3'], 72 | $settings['debug'] 73 | ); 74 | 75 | return $api; 76 | } 77 | 78 | /** 79 | * Sounder. 80 | */ 81 | public static function sounder() { 82 | global $wpdb; 83 | 84 | $api = self::get_api_instance(); 85 | 86 | if ( is_null( $api ) ) { 87 | return; 88 | } 89 | 90 | $orders = $wpdb->get_results( " 91 | SELECT posts.ID 92 | FROM $wpdb->posts AS posts 93 | LEFT JOIN $wpdb->postmeta AS postmeta ON postmeta.post_id = posts.ID 94 | WHERE postmeta.meta_key = '_payment_method' 95 | AND postmeta.meta_value = 'itau-shopline' 96 | AND posts.post_status = 'wc-on-hold' 97 | " ); 98 | 99 | // Process the order status for on-hold orders. 100 | foreach ( $orders as $_order ) { 101 | $api->process_order_status( intval( $_order->ID ) ); 102 | } 103 | } 104 | } 105 | 106 | new WC_Itau_Shopline_Sounder(); 107 | -------------------------------------------------------------------------------- /languages/wc-itau-shopline.pot: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 CLaudio Sanches 2 | # This file is distributed under the GPLv2 or later. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: Itau Shopline for WooCommerce 1.1.1\n" 6 | "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-itau-shopline\n" 7 | "POT-Creation-Date: 2016-12-24 14:29:25+00:00\n" 8 | "MIME-Version: 1.0\n" 9 | "Content-Type: text/plain; charset=utf-8\n" 10 | "Content-Transfer-Encoding: 8bit\n" 11 | "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: LANGUAGE \n" 14 | "X-Generator: grunt-wp-i18n 0.5.3\n" 15 | 16 | #: includes/views/html-admin-page.php:23 17 | msgid "" 18 | "Help us keep the %s plugin free making a %s or rate %s on %s. Thank you in " 19 | "advance!" 20 | msgstr "" 21 | 22 | #. Plugin Name of the plugin/theme 23 | msgid "Itau Shopline for WooCommerce" 24 | msgstr "" 25 | 26 | #: includes/views/html-admin-page.php:23 27 | msgid "donation" 28 | msgstr "" 29 | 30 | #: includes/views/html-admin-page.php:23 31 | msgid "WordPress.org" 32 | msgstr "" 33 | 34 | #: includes/views/html-notice-currency-not-supported.php:13 35 | msgid "Currency %s is not supported. Works only with Brazilian Real." 36 | msgstr "" 37 | 38 | #: includes/views/html-notice-woocommerce-missing.php:20 39 | msgid "Itau Shopline for WooCommerce Disabled" 40 | msgstr "" 41 | 42 | #: includes/views/html-notice-woocommerce-missing.php:20 43 | msgid "This plugin depends on the last version of %s to work!" 44 | msgstr "" 45 | 46 | #: includes/views/html-notice-woocommerce-missing.php:20 47 | msgid "WooCommerce" 48 | msgstr "" 49 | 50 | #: includes/wc-class-itau-shopline-api.php:177 51 | msgid "direct debit or financing" 52 | msgstr "" 53 | 54 | #: includes/wc-class-itau-shopline-api.php:178 55 | msgid "banking billet" 56 | msgstr "" 57 | 58 | #: includes/wc-class-itau-shopline-api.php:179 59 | msgid "credit card" 60 | msgstr "" 61 | 62 | #: includes/wc-class-itau-shopline-api.php:324 63 | msgid "Payment for order %s" 64 | msgstr "" 65 | 66 | #: includes/wc-class-itau-shopline-api.php:447 67 | #: includes/wc-class-itau-shopline-api.php:482 68 | msgid "Itau Shopline: Order expired for lack of pay." 69 | msgstr "" 70 | 71 | #: includes/wc-class-itau-shopline-api.php:457 72 | msgid "" 73 | "Itau Shopline: Order canceled because customers not selected a form of " 74 | "payment yet." 75 | msgstr "" 76 | 77 | #: includes/wc-class-itau-shopline-api.php:472 78 | msgid "Itau Shopline: Payment approved using %s." 79 | msgstr "" 80 | 81 | #: includes/wc-class-itau-shopline-cripto.php:60 82 | msgid "The company code size can not be different of %d positions." 83 | msgstr "" 84 | 85 | #: includes/wc-class-itau-shopline-cripto.php:64 86 | msgid "The key size can not be different of %d positions." 87 | msgstr "" 88 | 89 | #: includes/wc-class-itau-shopline-cripto.php:242 90 | msgid "Invalid order number." 91 | msgstr "" 92 | 93 | #: includes/wc-class-itau-shopline-cripto.php:246 94 | msgid "Invalid registration code." 95 | msgstr "" 96 | 97 | #: includes/wc-class-itau-shopline-cripto.php:250 98 | msgid "Invalid document number." 99 | msgstr "" 100 | 101 | #: includes/wc-class-itau-shopline-cripto.php:254 102 | msgid "Invalid zipcode." 103 | msgstr "" 104 | 105 | #: includes/wc-class-itau-shopline-cripto.php:258 106 | msgid "Invalid expiry date." 107 | msgstr "" 108 | 109 | #: includes/wc-class-itau-shopline-cripto.php:262 110 | #: includes/wc-class-itau-shopline-cripto.php:266 111 | #: includes/wc-class-itau-shopline-cripto.php:270 112 | msgid "Invalid note line %s. Can not be more than 60 characters." 113 | msgstr "" 114 | 115 | #: includes/wc-class-itau-shopline-cripto.php:334 116 | msgid "Invalid type." 117 | msgstr "" 118 | 119 | #: includes/wc-class-itau-shopline-gateway.php:29 120 | msgid "Itau Shopline" 121 | msgstr "" 122 | 123 | #: includes/wc-class-itau-shopline-gateway.php:30 124 | msgid "" 125 | "Accept payments by credit card, online debit or banking billet using the " 126 | "Itau Shopline." 127 | msgstr "" 128 | 129 | #: includes/wc-class-itau-shopline-gateway.php:116 130 | msgid "Enable/Disable" 131 | msgstr "" 132 | 133 | #: includes/wc-class-itau-shopline-gateway.php:118 134 | msgid "Enable Itau Shopline" 135 | msgstr "" 136 | 137 | #: includes/wc-class-itau-shopline-gateway.php:122 138 | msgid "Title" 139 | msgstr "" 140 | 141 | #: includes/wc-class-itau-shopline-gateway.php:124 142 | msgid "This controls the title which the user sees during checkout." 143 | msgstr "" 144 | 145 | #: includes/wc-class-itau-shopline-gateway.php:126 146 | msgid "Backing Billet or Online Debit" 147 | msgstr "" 148 | 149 | #: includes/wc-class-itau-shopline-gateway.php:129 150 | msgid "Description" 151 | msgstr "" 152 | 153 | #: includes/wc-class-itau-shopline-gateway.php:131 154 | msgid "This controls the description which the user sees during checkout." 155 | msgstr "" 156 | 157 | #: includes/wc-class-itau-shopline-gateway.php:132 158 | msgid "Pay with banking billet or online debit in Itau safe environment." 159 | msgstr "" 160 | 161 | #: includes/wc-class-itau-shopline-gateway.php:135 162 | msgid "Integration Settings" 163 | msgstr "" 164 | 165 | #: includes/wc-class-itau-shopline-gateway.php:140 166 | msgid "Website Code" 167 | msgstr "" 168 | 169 | #: includes/wc-class-itau-shopline-gateway.php:142 170 | msgid "Please enter your Website Code. This is needed in order to take payment." 171 | msgstr "" 172 | 173 | #: includes/wc-class-itau-shopline-gateway.php:149 174 | msgid "Encryption Key" 175 | msgstr "" 176 | 177 | #: includes/wc-class-itau-shopline-gateway.php:151 178 | msgid "Please enter your Encryption Key. This is needed in order to take payment." 179 | msgstr "" 180 | 181 | #: includes/wc-class-itau-shopline-gateway.php:158 182 | msgid "Integration Behavior" 183 | msgstr "" 184 | 185 | #: includes/wc-class-itau-shopline-gateway.php:163 186 | msgid "Only banking billet" 187 | msgstr "" 188 | 189 | #: includes/wc-class-itau-shopline-gateway.php:165 190 | msgid "Allow only banking billet" 191 | msgstr "" 192 | 193 | #: includes/wc-class-itau-shopline-gateway.php:166 194 | msgid "Allows only payments by banking billet." 195 | msgstr "" 196 | 197 | #: includes/wc-class-itau-shopline-gateway.php:171 198 | msgid "Days to Pay" 199 | msgstr "" 200 | 201 | #: includes/wc-class-itau-shopline-gateway.php:173 202 | msgid "Please enter how many consecutive days customers will have to pay." 203 | msgstr "" 204 | 205 | #: includes/wc-class-itau-shopline-gateway.php:183 206 | msgid "Notes (line 1)" 207 | msgstr "" 208 | 209 | #: includes/wc-class-itau-shopline-gateway.php:185 210 | #: includes/wc-class-itau-shopline-gateway.php:192 211 | #: includes/wc-class-itau-shopline-gateway.php:199 212 | msgid "Can not be more than 60 characters." 213 | msgstr "" 214 | 215 | #: includes/wc-class-itau-shopline-gateway.php:190 216 | msgid "Notes (line 2)" 217 | msgstr "" 218 | 219 | #: includes/wc-class-itau-shopline-gateway.php:197 220 | msgid "Notes (line 3)" 221 | msgstr "" 222 | 223 | #: includes/wc-class-itau-shopline-gateway.php:204 224 | msgid "Gateway Testing" 225 | msgstr "" 226 | 227 | #: includes/wc-class-itau-shopline-gateway.php:209 228 | msgid "Debug Log" 229 | msgstr "" 230 | 231 | #: includes/wc-class-itau-shopline-gateway.php:211 232 | msgid "Enable logging" 233 | msgstr "" 234 | 235 | #: includes/wc-class-itau-shopline-gateway.php:213 236 | msgid "Log Itau Shopline events, you can check this log in %s." 237 | msgstr "" 238 | 239 | #: includes/wc-class-itau-shopline-gateway.php:213 240 | msgid "System Status > Logs" 241 | msgstr "" 242 | 243 | #: includes/wc-class-itau-shopline-gateway.php:237 244 | msgid "Missing CPF or CNPJ." 245 | msgstr "" 246 | 247 | #: includes/wc-class-itau-shopline-gateway.php:256 248 | msgid "Itau Shopline: Awaiting payment." 249 | msgstr "" 250 | 251 | #: includes/wc-class-itau-shopline-gateway.php:284 252 | msgid "You can no longer make the payment for order %s." 253 | msgstr "" 254 | 255 | #: includes/wc-class-itau-shopline-gateway.php:285 256 | msgid "Payment method expired" 257 | msgstr "" 258 | 259 | #: includes/wc-class-itau-shopline-gateway.php:301 260 | msgid "Invalid request!" 261 | msgstr "" 262 | 263 | #: includes/wc-class-itau-shopline-sounder.php:32 264 | msgid "Itau Shoptine - Every 3 hours" 265 | msgstr "" 266 | 267 | #: templates/emails/html-instructions.php:15 268 | #: templates/emails/plain-instructions.php:14 269 | msgid "Payment" 270 | msgstr "" 271 | 272 | #: templates/emails/html-instructions.php:19 273 | #: templates/emails/plain-instructions.php:19 274 | #: templates/payment-instructions.php:20 275 | msgid "Please use the link below get your banking billet:" 276 | msgstr "" 277 | 278 | #: templates/emails/html-instructions.php:21 279 | #: templates/emails/plain-instructions.php:21 280 | #: templates/payment-instructions.php:22 281 | msgid "Please use the link below to make your payment:" 282 | msgstr "" 283 | 284 | #: templates/emails/html-instructions.php:24 285 | msgid "Pay order" 286 | msgstr "" 287 | 288 | #: templates/emails/html-instructions.php:24 289 | #: templates/emails/plain-instructions.php:30 290 | #: templates/payment-instructions.php:25 291 | msgid "After we receive the payment confirmation, your order will be processed." 292 | msgstr "" 293 | 294 | #: templates/payment-instructions.php:18 295 | msgid "Make payment" 296 | msgstr "" 297 | 298 | #: wc-itau-shopline.php:158 299 | msgid "Settings" 300 | msgstr "" 301 | 302 | #. Plugin URI of the plugin/theme 303 | msgid "https://github.com/claudiosanches/wc-itau-shopline" 304 | msgstr "" 305 | 306 | #. Description of the plugin/theme 307 | msgid "Itau Shopline payment gateway for WooCommerce." 308 | msgstr "" 309 | 310 | #. Author of the plugin/theme 311 | msgid "CLaudio Sanches" 312 | msgstr "" 313 | 314 | #. Author URI of the plugin/theme 315 | msgid "https://claudiosmweb.com" 316 | msgstr "" -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wc-itau-shopline", 3 | "description": "Itaú Shopline payment gateway for WooCommerce.", 4 | "version": "1.1.1", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/claudiosmweb/wc-itau-shopline.git" 8 | }, 9 | "main": "Gruntfile.js", 10 | "devDependencies": { 11 | "expand-home-dir": "0.0.2", 12 | "grunt": "^0.4.5", 13 | "grunt-checktextdomain": "^1.0.0", 14 | "grunt-rsync": "^0.6.2", 15 | "grunt-shell": "^1.1.2", 16 | "grunt-wp-i18n": "^0.5.3", 17 | "grunt-wp-readme-to-markdown": "^1.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Itau Shopline for WooCommerce === 2 | Contributors: claudiosanches 3 | Tags: woocommerce, itau, shopline, payment 4 | Requires at least: 4.0 5 | Tested up to: 4.7 6 | Stable tag: 1.1.1 7 | License: GPLv2 or later 8 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 | 10 | Itau Shopline gateway for WooCommerce 11 | 12 | == Description == 13 | 14 | Adicione o Itaú Shopline como método de pagamento em sua loja WooCommerce. 15 | 16 | [Itaú Shopline](https://www.itau.com.br/empresas/recebimentos/shopline/) é um método de pagamento brasileiro desenvolvido pelo Itaú. 17 | 18 | O plugin Itaú Shopline for WooCommerce foi desenvolvido sem nenhum incentivo do Itaú Shopline ou da Itaú. Nenhum dos desenvolvedores deste plugin possuem vínculos com estas empresas. 19 | 20 | Este plugin foi desenvolvido a partir da documentação oficial do Itaú Shopline. 21 | 22 | = Compatibilidade = 23 | 24 | Compatível desde a versão 2.3.x até 2.6.x do WooCommerce. 25 | 26 | É requerido o plugin [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/) para o envio do CPF ou CPNJ para o Itaú, junto com o número do endereço e bairro. 27 | 28 | = Instalação = 29 | 30 | Confira o nosso guia de instalação e configuração do Itaú Shopline na aba [Installation](http://wordpress.org/plugins/wc-itau-shopline/installation/). 31 | 32 | = Dúvidas? = 33 | 34 | Você pode esclarecer suas dúvidas usando: 35 | 36 | * A nossa sessão de [FAQ](http://wordpress.org/plugins/wc-itau-shopline/faq/). 37 | * Utilizando o nosso [fórum no Github](https://github.com/claudiosmweb/wc-itau-shopline). 38 | * Criando um tópico no [fórum de ajuda do WordPress](http://wordpress.org/support/plugin/wc-itau-shopline). 39 | 40 | = Colaborar = 41 | 42 | Você pode contribuir com código-fonte em nossa página no [GitHub](https://github.com/claudiosmweb/wc-itau-shopline). 43 | 44 | == Installation == 45 | 46 | = Instalação do plugin: = 47 | 48 | * Envie os arquivos do plugin para a pasta wp-content/plugins, ou instale usando o instalador de plugins do WordPress. 49 | * Ative o plugin. 50 | 51 | = Requerimentos: = 52 | 53 | * É necessário possuir uma conta empresa no [Itaú Shopline](https://www.itau.com.br/empresas/recebimentos/shopline/). 54 | * Ter instalada a versão mais recente do [WooCommerce](http://wordpress.org/plugins/woocommerce/). 55 | * E ter instalada a versão mais recente do [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/). 56 | 57 | = Configurações do Plugin: = 58 | 59 | Com o plugin instalado acesse o admin do WordPress e entre em "WooCommerce" > "Configurações" > "Finalizar compra" > "Itau Shopline". 60 | 61 | Habilite o Itau Shopline, preenche os campos de "Código do site" e "Chave de criptografia". Importante observar que este plugin irá funcionar com todos os métodos de pagamento configurados na sua conta do Itau Shopline, caso você necessite ativar cartão de crédito, isso deve ser feito junto ao Itaú e a Rede, sem ter a necessidade de mudar qualquer coisa neste plugin ou na configuração. 62 | 63 | Pronto, sua loja já pode receber pagamentos pelo Itau Shopline. 64 | 65 | == Frequently Asked Questions == 66 | 67 | = Qual é a licença do plugin? = 68 | 69 | Este plugin esta licenciado como GPL. 70 | 71 | = O que eu preciso para utilizar este plugin? = 72 | 73 | * Ter instalada a versão mais recente do [WooCommerce](http://wordpress.org/plugins/woocommerce/) 74 | * Instalar a versão mais recente do [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/). 75 | * Possuir uma conta empresa no [Itaú Shopline](https://www.itau.com.br/empresas/recebimentos/shopline/). 76 | 77 | = Quais são os meios de pagamento que o plugin aceita? = 78 | 79 | Serão aceitos todos os meios de pagamento do Itau Shopline, sendo eles boleto bancário, débito em conta e financiamento para clientes Itaú e cartão de crédito (que deve ser habilitado junto ao Itaú e a [Rede](https://www.userede.com.br/)). 80 | 81 | = O status do pedido não é alterado automaticamente? = 82 | 83 | Sim é alterado automaticamente usando um sistema de sounda que irá consultar os dados dos pedidos no Itau Shopline. 84 | 85 | Esta sounda é ativada a cada 3 horas por cron, desta forma é de vital importância que o cron do WordPress esteja funcionando corretamente. 86 | 87 | Caso os status não estejam sendo alterados, é recomendado desativar o cron do WordPress e configurar o servidor para rodar o cron acessando o arquivo `wp-cron.php` pelo menos a cada 5 minutos. 88 | 89 | = O pedido foi pago e ficou com o status de "processando" e não como "concluído", isto esta certo? = 90 | 91 | Sim, esta certo e significa que o plugin esta trabalhando como deveria. 92 | 93 | Todo gateway de pagamentos no WooCommerce deve mudar o status do pedido para "processando" no momento que é confirmado o pagamento e nunca deve ser alterado sozinho para "concluído", pois o pedido deve ir apenas para o status "concluído" após ele ter sido entregue. 94 | 95 | Para produtos baixáveis a configuração padrão do WooCommerce é permitir o acesso apenas quando o pedido tem o status "concluído", entretanto nas configurações do WooCommerce na aba *Produtos* é possível ativar a opção **"Conceder acesso para download do produto após o pagamento"** e assim liberar o download quando o status do pedido esta como "processando". 96 | 97 | = Mais dúvidas relacionadas ao funcionamento do plugin? = 98 | 99 | Por favor, caso você tenha algum problema com o funcionamento do plugin, [abra um tópico no fórum do plugin](https://wordpress.org/support/plugin/wc-itau-shopline#postform) com o link arquivo de log (ative ele nas opções do plugin e tente fazer uma compra, depois vá até WooCommerce > Status do Sistema, selecione o log do *itau-shopline* e copie os dados, depois crie um link usando o [pastebin.com](http://pastebin.com) ou o [gist.github.com](http://gist.github.com)), desta forma fica mais rápido para fazer o diagnóstico. 100 | 101 | == Screenshots == 102 | 103 | 1. Configurações do plugin. 104 | 2. Método de pagamento na página de finalizar o pedido. 105 | 3. Exemplo dos meios de pagamentos sendo exibidos no Itaú Shopline. 106 | 107 | == Changelog == 108 | 109 | = 1.1.1 - 2016/12/24 = 110 | 111 | - Melhorias na forma que coleta os números de CPF e CNPJ. 112 | 113 | = 1.1.0 - 2016/09/22 = 114 | 115 | - Adicionada opção para gerar apenas boletos. 116 | - Corrigida uma mensagem de erro incorreta que aparecia na página de pagar o pedido quando feito pelo painel de administração. 117 | 118 | = 1.0.0 - 2015/09/03 = 119 | 120 | - Versão inicial. 121 | 122 | == Upgrade Notice == 123 | 124 | = 1.1.1 = 125 | 126 | - Melhorias na forma que coleta os números de CPF e CNPJ. 127 | -------------------------------------------------------------------------------- /templates/emails/html-instructions.php: -------------------------------------------------------------------------------- 1 | 14 | 15 |

16 | 17 |

18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |

26 | -------------------------------------------------------------------------------- /templates/emails/plain-instructions.php: -------------------------------------------------------------------------------- 1 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 |
27 |
28 | -------------------------------------------------------------------------------- /wc-itau-shopline.php: -------------------------------------------------------------------------------- 1 | . 26 | * 27 | * @package WC_Itau_Shopline 28 | */ 29 | 30 | if ( ! defined( 'ABSPATH' ) ) { 31 | exit; 32 | } 33 | 34 | if ( ! class_exists( 'WC_Itau_Shopline' ) ) : 35 | 36 | // Load plugin classes. 37 | include_once dirname( __FILE__ ) . '/includes/wc-class-itau-shopline-cripto.php'; 38 | include_once dirname( __FILE__ ) . '/includes/wc-class-itau-shopline-api.php'; 39 | include_once dirname( __FILE__ ) . '/includes/wc-class-itau-shopline-sounder.php'; 40 | 41 | /** 42 | * Itau Shopline for WooCommerce main class. 43 | */ 44 | class WC_Itau_Shopline { 45 | 46 | /** 47 | * Plugin version. 48 | * 49 | * @var string 50 | */ 51 | const VERSION = '1.1.1'; 52 | 53 | /** 54 | * Instance of this class. 55 | * 56 | * @var object 57 | */ 58 | protected static $instance = null; 59 | 60 | /** 61 | * Initialize the plugin actions. 62 | */ 63 | public function __construct() { 64 | // Load plugin text domain. 65 | add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); 66 | 67 | // Checks with WooCommerce and WooCommerce is installed. 68 | if ( class_exists( 'WC_Payment_Gateway' ) && defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.2', '>=' ) ) { 69 | $this->includes(); 70 | 71 | // Hook to add Itau Shopline Gateway to WooCommerce. 72 | add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway' ) ); 73 | add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); 74 | } else { 75 | add_action( 'admin_notices', array( $this, 'dependencies_notices' ) ); 76 | } 77 | } 78 | 79 | /** 80 | * Return an instance of this class. 81 | * 82 | * @return object A single instance of this class. 83 | */ 84 | public static function get_instance() { 85 | // If the single instance hasn't been set, set it now. 86 | if ( null == self::$instance ) { 87 | self::$instance = new self; 88 | } 89 | 90 | return self::$instance; 91 | } 92 | 93 | /** 94 | * Load the plugin text domain for translation. 95 | */ 96 | public function load_plugin_textdomain() { 97 | load_plugin_textdomain( 'wc-itau-shopline', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 98 | } 99 | 100 | /** 101 | * Includes. 102 | */ 103 | private function includes() { 104 | include_once dirname( __FILE__ ) . '/includes/wc-class-itau-shopline-gateway.php'; 105 | } 106 | 107 | /** 108 | * Get templates path. 109 | * 110 | * @return string 111 | */ 112 | public static function get_templates_path() { 113 | return plugin_dir_path( __FILE__ ) . 'templates/'; 114 | } 115 | 116 | /** 117 | * Get payment url. 118 | * 119 | * @param string $order_key 120 | * 121 | * @return string 122 | */ 123 | public static function get_payment_url( $order_key ) { 124 | $url = WC()->api_request_url( 'WC_Itau_Shopline_Gateway' ); 125 | 126 | return add_query_arg( array( 'key' => $order_key ), $url ); 127 | } 128 | 129 | /** 130 | * Add the gateway to WooCommerce. 131 | * 132 | * @param array $methods WooCommerce payment methods. 133 | * 134 | * @return array Payment methods with Itau Shopline. 135 | */ 136 | public function add_gateway( $methods ) { 137 | $methods[] = 'WC_Itau_Shopline_Gateway'; 138 | 139 | return $methods; 140 | } 141 | 142 | /** 143 | * Dependencies notices. 144 | */ 145 | public function dependencies_notices() { 146 | include_once dirname( __FILE__ ) . '/includes/views/html-notice-woocommerce-missing.php'; 147 | } 148 | 149 | /** 150 | * Action links. 151 | * 152 | * @param array $links 153 | * 154 | * @return array 155 | */ 156 | public function plugin_action_links( $links ) { 157 | $plugin_links = array(); 158 | $plugin_links[] = '' . __( 'Settings', 'wc-itau-shopline' ) . ''; 159 | 160 | return array_merge( $plugin_links, $links ); 161 | } 162 | } 163 | 164 | // Sounder schedule. 165 | register_activation_hook( __FILE__, array( 'WC_Itau_Shopline_Sounder', 'schedule_event' ) ); 166 | 167 | // Remove sounder schedule. 168 | register_deactivation_hook( __FILE__, array( 'WC_Itau_Shopline_Sounder', 'clear_scheduled_event' ) ); 169 | 170 | add_action( 'plugins_loaded', array( 'WC_Itau_Shopline', 'get_instance' ) ); 171 | 172 | endif; 173 | --------------------------------------------------------------------------------